L_VecHitTest

Summary

Performs a hit test using the specified 2D point.

Syntax

#include "ltvkrn.h"

L_LVKRN_API L_INT L_VecHitTest(pVector, pPoint, pObject)

Parameters

const pVECTORHANDLE pVector

Pointer to a vector handle.

const L_POINT * pPoint

Pointer to a POINT structure that contains the point to test.

pVECTOROBJECT pObject

Pointer to a VECTOROBJECT structure to be updated with the object found under the specified point, if one exists.

Returns

Value Meaning
SUCCESS The function was successful and an object was copied into pObject.
ERROR_VECTOR_OBJECT_NOT_FOUND No object was found under the specified point.
< 1 An error occurred. Refer to Return Codes.

Comments

This function will copy the first object under the specified physical point into pObject.

To set the options to use when performing the hit test, call L_VecSetHitTest.

Camera, view port, rotation, translation and scaling are all considered when determining whether or not an object is under the specified point.

Required DLLs and Libraries

See Also

Functions

Example

This example will select the object under the mouse cursor.

L_INT VecHitTestExample( 
   pVECTORHANDLE pVector, 
   POINT* pptMouse) 
{ 
   VECTOROBJECT   Object; 
   VECTOROBJECT   TempObject; 
   L_INT          nRet; 
 
   nRet = L_VecHitTest( pVector, pptMouse, &Object ); 
   if( nRet == SUCCESS ) 
   { 
      /* Get the object to edit */ 
      nRet = L_VecGetObject( pVector, &Object, Object.nType, &TempObject ); 
      if(nRet != SUCCESS) 
         return nRet; 
 
      /* Select it */ 
      TempObject.dwFlags |= VECTOR_OBJECT_SELECTED; 
 
      /* Apply changes */ 
      nRet = L_VecSetObject( pVector, &Object, Object.nType, &TempObject ); 
      if(nRet != SUCCESS) 
         return nRet; 
 
      /* Must free the temporary object when not used anymore */ 
      nRet = L_VecFreeObject( TempObject.nType, &TempObject ); 
   } 
 
   return nRet; 
} 

Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Vector C API Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.