NurbsSurfaceMesh.ConstructPointLocators operator

Introduced

v5.0

Description

Builds a PointLocatorData from NurbsSurfaceMesh-specific topological information. Subsurface indices and normalized UV surface parameters are required in order to define each point locator. The UV array should contain two values for each specified subsurface index.

Notice that the returned point locators can be evaluated on any NurbsSurfaceMesh instance having the same topology.

C# Syntax

PointLocatorData NurbsSurfaceMesh.ConstructPointLocators( Object in_pSubSurfaceIndices, Object in_pNormalizedUVs );

Scripting Syntax

oReturn = NurbsSurfaceMesh.ConstructPointLocators( SubSurfaceIndices, NormalizedUVs );

Return Value

PointLocatorData

Parameters

Parameter Type Description
SubSurfaceIndices 1-dimensional Array An array of subsurface indices on which the point locators are created.
NormalizedUVs Array An array of Double, either formatted as a 1D array of packed UV pairs, or as a 2D array of UV pairs. The UVs are normalized (0..1) parametric values defining the position the corresponding subsurface.

Examples

JScript Example

/*
	This example creates point locators at random surface locations,
	and positions a Null at each of these point locators.
*/
NewScene( null, false );
var root = Application.ActiveSceneRoot;
var SphereGeom = root.AddGeometry("Sphere", "NurbsSurface").ActivePrimitive.Geometry;
var NbPtLocators = 50;
var SubSurfaceArray = new Array(NbPtLocators);
var UVArray = new Array(NbPtLocators*2);
for(i = 0; i < NbPtLocators; i++)
{
	SubSurfaceArray[i] = 0;
	UVArray[i*2] = Math.random();
	UVArray[i*2+1] = Math.random();
}
var PointLocatorsFromRandomUVs = SphereGeom.ConstructPointLocators(SubSurfaceArray, UVArray);
CreateNullsAtPointLocations(SphereGeom, PointLocatorsFromRandomUVs);
function CreateNullsAtPointLocations( InGeom, InPointLocators )
{
	var SpherePositions = InGeom.EvaluatePositions(InPointLocators).toArray();
	var SphereNormals = InGeom.EvaluateNormals(InPointLocators).toArray();
	var TempVector = XSIMath.CreateVector3();
	var TempRotation = XSIMath.CreateRotation();
	for (i = 0; i < SpherePositions.length; i+=3)
	{
		var NullObj = root.AddNull();
		TempVector.Set(SpherePositions[i], SpherePositions[i+1], SpherePositions[i+2]);
		NullObj.LocalTranslation = TempVector;
		TempVector.Set(SphereNormals[i], SphereNormals[i+1], SphereNormals[i+2]);
		TempRotation.SetFromXYZAxes( TempVector, TempVector, TempVector );
		NullObj.LocalRotation = TempRotation;
	}
}

See Also

PointLocatorData Geometry Geometry.GetClosestLocations Geometry.GetClosestLocationsWithinRadius Geometry.GetRaycastIntersections Geometry.SetupPointLocatorQueries Geometry.GetSurfacePointLocatorsFromPoints Geometry.EvaluatePositions Geometry.EvaluateNormals Geometry.EvaluateClusterProperty PolygonMesh.GetPolygonIndexArray PolygonMesh.GetTriangleVertexIndexArray PolygonMesh.GetTriangleNodeIndexArray PolygonMesh.GetTriangleWeightArray PolygonMesh.ConstructPointLocators NurbsSurfaceMesh.GetSubSurfaceIndexArray NurbsSurfaceMesh.GetNormalizedUVArray