A PointLocatorData object represents a collection of point locators. A point locator is a geometric surface coordinate, and represents a precise location on a geometry.
Point locators are topologically defined, so they are not dependent on the position or the deformation of the geometry (they "stick" to the surface). The actual data defining a point locator is abstracted and depends on the geometry type.
Point locators are a generalization of Point. As points, point locators can be processed independently from the geometry type. Like point indices, point locators are not related to a particular geometry instance. You can query any geometry having the same topology with the same PointLocatorData. For instance, you can use point locators to evaluate positions of an animated geometry at different times.
Because point locators don't apply to a particular geometry instance, the PointLocatorData object has no functionality by itself. Most methods related to PointLocatorData are defined in Geometry, PolygonMesh and NurbsSurfaceMesh. PointLocatorData can be created by the following methods:
- Note:
- Point locators are currently only supported by NurbsSurfaceMesh and PolygonMesh objects.
Other examples of PointLocatorData usage can be found in various related methods such as PointLocatorData::Count and PolygonMesh::ConstructPointLocators. A JScript example of a scripted operator can be found at PointLocatorData .
- See also:
- Geometry, Geometry::GetClosestLocations, Geometry::GetClosestLocationsWithinRadius, Geometry::SetupPointLocatorQueries, Geometry::GetSurfacePointLocatorsFromPoints, Geometry::GetRaycastIntersections, Geometry::EvaluatePositions, Geometry::EvaluateNormals, Geometry::EvaluateClusterProperty, PolygonMesh::GetPolygonIndexArray, PolygonMesh::GetTriangleVertexIndexArray, PolygonMesh::GetTriangleNodeIndexArray, PolygonMesh::GetTriangleWeightArray, PolygonMesh::ConstructPointLocators, NurbsSurfaceMesh::GetSubSurfaceIndexArray, NurbsSurfaceMesh::GetNormalizedUVArray, NurbsSurfaceMesh::ConstructPointLocators
- Since:
- 5.0
- Example:
- This example uses PointLocatorData to deform a polygon mesh based on the closest weight map value of a NURBS surface mesh.
using namespace XSI;
Application app;
Model root = app.GetActiveSceneRoot();
X3DObject meshGridObj;
root.AddGeometry( L"Grid", L"MeshSurface", L"", meshGridObj );
meshGridObj.PutParameterValue(L"subdivu", 24l);
meshGridObj.PutParameterValue(L"subdivv", 24l);
CValueArray args(3);
CValue outArg;
args[0] = meshGridObj.GetRef();
app.ExecuteCommand(L"FreezeObj",args, outArg);
Geometry meshGridGeom( meshGridObj.GetActivePrimitive().GetGeometry() );
X3DObject NURBSGridObj;
root.AddGeometry( L"Grid", L"NurbsSurface", L"", NURBSGridObj );
NURBSGridObj.PutParameterValue(L"subdivu", 2l);
NURBSGridObj.PutParameterValue(L"subdivv", 2l);
NurbsSurfaceMesh NURBSGridGeom( NURBSGridObj.GetActivePrimitive().GetGeometry() );
args.Clear();
args.Resize(4);
args[0] = CValue( CString(L"WeightMap") );
args[1] = CValue( NURBSGridObj.GetRef() );
args[2] = CValue(CString(L"MyWeightMap"));
args[3] = CValue(CString(L"Weight Map Property"));
app.ExecuteCommand( L"CreateWeightMap", args, outArg );
ClusterProperty NURBSWeightMap(Cluster(NURBSGridGeom.GetClusters()[0]).GetProperties()[0]);
args.Clear();
args.Resize(2);
args[0] = CValue(NURBSWeightMap.GetFullName() + L".weightmapop.type");
args[1] = 5l ;
app.ExecuteCommand( L"SetValue", args, outArg ) ;
args[0] = CValue(NURBSWeightMap.GetFullName() + L".weightmapop.weight");
args[1] = 1l ;
app.ExecuteCommand( L"SetValue", args, outArg ) ;
args[0] = CValue(NURBSWeightMap.GetFullName() + L".weightmapop.invert");
args[1] = true ;
app.ExecuteCommand( L"SetValue", args, outArg ) ;
ClusterProperty NURBSWeightMap2(Cluster(NURBSGridGeom.GetClusters()[0]).GetProperties()[0]);
MATH::CVector3Array posArray = meshGridGeom.GetPoints().GetPositionArray();
PointLocatorData pointLocators = NURBSGridGeom.GetClosestLocations(posArray.GetCount(), (double*)&posArray[0]);
std::vector<float> data;
data.resize(NURBSWeightMap2.GetValueSize()*pointLocators.GetCount());
NURBSGridGeom.EvaluateClusterProperty(pointLocators, -1, NULL, NURBSWeightMap2.GetParent(), NURBSWeightMap2, &data.front());
for(LONG i = 0; i < posArray.GetCount(); i++)
posArray[i].PutY(posArray[i].GetY() + data[i]*5);
meshGridGeom.GetPoints().PutPositionArray(posArray);