LVectorObject::IsObjectInsideParallelogram

#include "ltwrappr.h"

virtual L_INT LVectorObject::IsObjectInsideParallelogram(pLeftTop, pRightBottom, bInside)

const pVECTORPOINT pLeftTop;

/* pointer to a vector point */

const pVECTORPOINT pRightBottom;

/* pointer to a vector point */

L_BOOL *bInside;

/* pointer to a variable */

Determines whether the class object is within the specified parallelogram.

Parameter

Description

pLeftTop

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

pRightBottom

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

bInside

Pointer to a variable to be updated with a value that indicates whether the class object is inside the specified parallelogram. Possible values are:

 

Value

Meaning

 

TRUE

The class object is within the specified parallelogram.

 

FALSE

The class object is not within the specified parallelogram.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

This function determines whether the class object exists within the parallelogram specified by pLeftTop and pRightBottom. 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.

Not supported in DirectX.

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:

LVectorObject::IsObjectInsideRect, LVectorObject::GetObjectParallelogram, LVectorObject::GetObjectRect

Topics:

Manipulating Objects or Vertices within a Vector Image

 

Vector Images: Obtaining Object Information

Example

This example selects all vertices inside a given parallelogram.

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName
class LMyVectorBase: public LVectorBase
{
public:
   L_INT          m_nObjectCount ;
   VECTORPOINT    m_LeftTop, m_RightBottom;
public:
   LMyVectorBase();
   virtual ~LMyVectorBase() ;
   virtual L_INT EnumObjectsCallBack(pVECTORHANDLE pVector, pVECTOROBJECT pObject);
};
LMyVectorBase::LMyVectorBase()
{
   m_nObjectCount = 0 ;
}
LMyVectorBase::~LMyVectorBase()
{
}
L_INT LMyVectorBase::EnumObjectsCallBack(pVECTORHANDLE pVector, pVECTOROBJECT pObject)
{
   L_BOOL bInside;
   LVectorBase   VectorBase(pVector);
   LVectorObject VectorObject(pObject, &VectorBase);
   //Select object if inside parallelogram
   VectorObject.IsObjectInsideParallelogram(&m_LeftTop,&m_RightBottom,&bInside);
   if (bInside)
      VectorObject.SelectObject();
   return SUCCESS ;
}
L_INT LVectorObject__IsObjectInsideParallelogramExample(HWND hWnd)
{
   UNREFERENCED_PARAMETER(hWnd);
   L_INT          nRet;
   LMyVectorBase  Vector;
   nRet = Vector.Load(MAKE_IMAGE_PATH(TEXT("random.dxf")));
   if(nRet != SUCCESS)
      return nRet;
   //Define a 3D parallelogram
   Vector.m_LeftTop.x=0;
   Vector.m_LeftTop.y=0;
   Vector.m_LeftTop.z=0;
   Vector.m_RightBottom.x=50;
   Vector.m_RightBottom.y=50;
   Vector.m_RightBottom.z=50;
   return SUCCESS;
}