L_VecIsObjectInsideParallelogram

#include "lvkrn.h"

L_LVKRN_API L_BOOL L_VecIsObjectInsideParallelogram(pVector, pObject, pMin, pMax, dwFlags)

const pVECTORHANDLE pVector;

/* pointer to a vector handle */

const pVECTOROBJECT pObject;

/* pointer to a vector object */

const pVECTORPOINT pMin;

/* pointer to a vector point */

const pVECTORPOINT pMax;

/* pointer to a vector point */

L_UINT32 dwFlags;

/* flags */

Determines whether the specified object is within the specified parallelogram.

Parameter

Description

pVector

Pointer to a vector handle.

pObject

Pointer to a VECTOROBJECT structure that contains information about a specific vector object. If this parameter is NULL, the object(s) to test is(are) determined by dwFlags.

pMin

Pointer to a VECTORPOINT structure that contains the minimum point of a parallelogram.

pMax

Pointer to a VECTORPOINT structure that contains the maximum point of a parallelogram.

dwFlags

Flag that indicates which object(s) to test. This flag is valid only if pObject is NULL. If pObject is not NULL, this parameter is ignored. Possible values are:

 

Value

Meaning

 

0

Test all objects in the vector handle to determine whether they are in the specified parallelogram.

 

VECTOR_FLAGS_SELECTED_ONLY

Test only the selected objects within the vector handle.

Returns

TRUE

The specified object(s) is(are) within the specified parallelogram.

FALSE

The specified object(s) is(are) not within the specified parallelogram OR the specified object is not valid.

Comments

This function determines whether the object specified in pObject exists within the parallelogram specified by pMin and pMax. The parallelogram is given in logical units.

For this function, the current view port, pan position, camera, rotation, translation and scale do not effect the actual image position in 3D space.

Required DLLs and Libraries

LVKRN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions:

L_VecIsObjectInsideRect, L_VecGetObjectParallelogram, L_VecGetObjectRect

Example

/* This example will selects all objects inside a given parallelogram */

typedef struct tagSELECTDATA
{
   VECTORPOINT Min;
   VECTORPOINT Max;
}
SELECTDATA, *pSELECTDATA;

static L_INT EXT_CALLBACK EnumObjectsProcCallback(
   pVECTORHANDLE pVector,
   pVECTOROBJECT pObject,
   L_VOID* pSD)
{
   L_INT nRet = SUCCESS;
   VECTOROBJECT ObjectDesc;
   pSELECTDATA pSelectData = (pSELECTDATA) pSD;

   /* Check if object is inside the parallelogram */
   if( L_VecIsObjectInsideParallelogram( pVector, pObject, &pSelectData->Min, &pSelectData->Max, 0L ) )
   {
      nRet = L_VecGetObject( pVector, pObject, VECTOR_OBJECT, &ObjectDesc);
      if(nRet != SUCCESS)
         return nRet;

      ObjectDesc.dwFlags |= VECTOR_OBJECT_SELECTED;
      nRet = L_VecSetObject(pVector, pObject, VECTOR_OBJECT, &ObjectDesc);
      if(nRet != SUCCESS)
         return nRet;

      nRet = L_VecFreeObject(VECTOR_OBJECT, &ObjectDesc);
   }

   /* Continue the enumeration */
   return nRet;
}

L_INT VecIsObjectInsideParallelogramCBExample(
   pVECTORHANDLE pVector,
   pVECTORPOINT pMin,
   pVECTORPOINT pMax)
{
   SELECTDATA  sd;

   /* Fill in out custom data structure */
   sd.Min.x = pMin->x;
   sd.Min.y = pMin->y;
   sd.Min.z = pMin->z;
   sd.Max.x = pMax->x;
   sd.Max.y = pMax->y;
   sd.Max.z = pMax->z;

   /* Enumerate all objects in the drawing */
   return L_VecEnumObjects( pVector, (pVECTORENUMOBJECTSPROC)EnumObjectsProcCallback, &sd, 0 );
}