MMeshIntersector Class Reference
[OpenMaya - API module for common classes]

#include <MMeshIntersector.h>

List of all members.


Detailed Description

Mesh intersector.

The MMeshIntersector class contains methods for efficiently finding the closest point to a mesh. An octree algorithm is used to find the closest point.

The create() method builds the internal data required for the algorithm. As a result, calls to it should be minimized as it is a heavy operation.

This class allows multiple threads to evaluate closest points simultaneously as the method getClosestPoint is threadsafe.

Examples:

closestPointCmd.cpp.


Public Member Functions

  MMeshIntersector (void)
virtual  ~MMeshIntersector (void)
MStatus  create (MObject &meshObject, const MMatrix &matrix=MMatrix::identity)
bool  isCreated (void)
MStatus  getClosestPoint (MPoint &point, MPointOnMesh &meshPoint, double maxDistance=DBL_MAX)

Constructor & Destructor Documentation

MMeshIntersector::MMeshIntersector ( void   ) 

Constructor

MMeshIntersector::~MMeshIntersector ( void   )  [virtual]

Destructor.


Member Function Documentation

MStatus MMeshIntersector::create ( MObject meshObject,
const MMatrix matrix = MMatrix::identity  
)

This method creates the data required by the intersector. It is a heavy operation that should be called only when necessary.

Parameters:
[in]  meshObject  a kMesh or kMeshData object
[in]  matrix  specify the mapping to apply for transforming points that are specified in the getClosestPoint method into the object space of the mesh.
Returns:
Status code
Status Codes:
Examples:

bool MMeshIntersector::isCreated ( void   ) 

This method returns true if the intersector is created. False is return otherwise.

MStatus MMeshIntersector::getClosestPoint ( MPoint point,
MPointOnMesh &  meshPoint,
double  maxDistance = DBL_MAX  
)

This method finds the closest point. Information is returned in the meshPoint object.

This method is threadsafe.

Parameters:
[in]  point  Specifies the location for which to evaluate the closest point on the mesh. `point' is transformed using the matrix parameter passed to the create() method, so for example if your matrix maps world to object space, then `point' should be specified in world space.
[out]  meshPoint  Resulting closest point in object space.
[in]  maxDistance  Maximum distance to consider in object space.
Returns:
Status code
Status Codes:
Examples:

Autodesk® Maya® 2011 © 1997-2010 Autodesk, Inc. All rights reserved. Generated with doxygen 1.5.6