L_VecHitTest
#include "lvkrn.h"
L_INT EXT_FUNCTION L_VecHitTest(pVector, pPoint, pObject)
const pVECTORHANDLE pVector; |
/* pointer to a vector handle */ |
const POINT L_FAR * pPoint; |
/* pointer to a POINT structure */ |
pVECTOROBJECT pObject; |
/* pointer to a VECTOROBJECT structure */ |
Performs a hit test using the specified 2D point.
Parameter |
Description |
pVector |
Pointer to a vector handle. |
pPoint |
Pointer to a POINT structure that contains the point to test. |
pObject |
Pointer to a VECTOROBJECT structure to be updated with the object found under the specified point, if one exists. |
Returns
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.
This function is not supported in the OpenGL and DirectX engines.
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: |
Example
/* This example will select the object under the mouse cursor */
L_VOID SelectObject( 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 */
L_VecGetObject( pVector, &Object, Object.nType, &TempObject );
/* Select it */
TempObject.dwFlags |= VECTOR_OBJECT_SELECTED;
/* Apply changes */
L_VecSetObject( pVector, &Object, Object.nType, &TempObject );
/* Must free the temporary object when not used anymore */
L_VecFreeObject( TempObject.nType, &TempObject );
}
}