v6.0
Sets up how subsequent calls to Geometry.GetClosestLocations,
Geometry.GetClosestLocationsWithinRadius
and Geometry.GetRaycastIntersections
will operate.
An acceleration cache is built either on the first call to this
method or to Geometry.GetClosestLocations
or Geometry.GetClosestLocationsWithinRadius.
The cache assumes that the geometry is not deformed during all
subsequent calls to Geometry.GetClosestLocations,
Geometry.GetClosestLocationsWithinRadius
and Geometry.GetRaycastIntersections.
If that is not the case, you should get the geometry again or force
a rebuild of the acceleration cache by calling this method,
otherwise you may get wrong results.
Geometry.SetupPointLocatorQueries( Int32 in_Method, Object in_Transfo, Object in_FacetsToRestrictSearch, Int32 in_NbLocatorsToBeQueried ); |
Geometry.SetupPointLocatorQueries( Method, Reference, Facets, NbLocatorsToBeQueried ); |
Parameter | Type | Description |
---|---|---|
Method | siClosestLocationMethod | Method to use when searching the closest location. This must be
set to siClosestSurfaceRaycastIntersections if you will be calling
Geometry.GetRaycastIntersections
next.
Default Value: siClosestSurface |
Reference | SITransformation | Allows you to specify the reference transformation in which the input positions will be interpreted, and in which the search will be executed. Notice that the "closest distance" relationship may change relative to the spatial reference of the geometry and the input positions. For instance, if you copy closest locations of an object's points onto another one, you will generally have different results if you scale both of them non-uniformly or if you add some shearing to the pose. In such case, computing the closest locations in local space will lead to different results from computing the closest locations in global space. |
Facets | 1-dimensional Array | Restricts the search to a subset of facets (instead of all the geometry). This allows faster searches and a lower memory usage for the acceleration cache. |
NbLocatorsToBeQueried | Long | Approximate number of point locators that will be queried after the call. This helps improving the overall performance. Pass -1 if you have no clue. |
/* This example uses PointLocatorData to shrink-wrap a sphere on only two faces of a cube */ NewScene( null, false ); var root = Application.ActiveSceneRoot; var CubeGeom = root.AddGeometry("Cube", "MeshSurface").ActivePrimitive.Geometry; var SphereObj = root.AddGeometry("Sphere", "MeshSurface"); SphereObj.subdivv = 24; SphereObj.subdivu = 24; // Freeze it, otherwise its position array cannot be set: FreezeObj(SphereObj); var SphereGeom = SphereObj.ActivePrimitive.Geometry; var Facets = new Array(2); var Transform = XSIMath.CreateTransform(); Facets[0] = 2; Facets[1] = 3; CubeGeom.SetupPointLocatorQueries(siClosestSurface,Transform,Facets,-1); var SphereOnCubePointLocators = CubeGeom.GetClosestLocations(SphereGeom.Points.PositionArray); SphereGeom.Points.PositionArray = CubeGeom.EvaluatePositions(SphereOnCubePointLocators); |
PointLocatorData Geometry Geometry.GetClosestLocations Geometry.GetClosestLocationsWithinRadius Geometry.GetRaycastIntersections Geometry.GetSurfacePointLocatorsFromPoints Geometry.EvaluatePositions Geometry.EvaluateNormals Geometry.EvaluateClusterProperty PolygonMesh.GetPolygonIndexArray PolygonMesh.GetTriangleVertexIndexArray PolygonMesh.GetTriangleNodeIndexArray PolygonMesh.GetTriangleWeightArray PolygonMesh.ConstructPointLocators NurbsSurfaceMesh.GetSubSurfaceIndexArray NurbsSurfaceMesh.GetNormalizedUVArray NurbsSurfaceMesh.ConstructPointLocators