PolygonMesh.GetApproximatedMesh

Introduced

v5.0

Description

Gives the geometry description of the subdivided mesh given the subdivision rule, the level of subdivision and the discontinuity angle if used. The geometry data is returned in a 1-dimensional array and contains the following values:

1) vertices: polygon vertex 2D array (Nx3) of x,y,z values.

2) polygon data: ordered array of polygon definitions, each polygon is defined by a list of elements, the first element of a polygon definition must be set with the number of indices for that polygon. The ordering of vertices must respect a ccw ordering to get out going normals (right-hand rule). For example, an array of polygons with 4 indices each: {4,0,1,4,3,4,1,2,5,4... }

3) polygon node normal array: 2D array containing the normal x,y,z values for every polygon node.

4) polygon node for each polygon face: 1D array containing the number of polygon nodes on each polygon face followed by the corresponding polygon node index.

Note: The C++ API equivalent function, PolygonMesh::GetGeometryAccessor, returns the CGeometryAccessor object which allows you to get only the data you need, and is therefore a much more efficient way to access this data.

C# Syntax

Object PolygonMesh.GetApproximatedMesh( siSubdivisionRuleType in_SubRule, Int32 in_lSubdivisionLevel, Boolean in_bDiscontinuity, Double in_dDiscontinuityAngle );

Scripting Syntax

oArray = PolygonMesh.GetApproximatedMesh( SubdivisionRule, SubdivisionLevel, UseDiscontinuity, DiscontinuityAngle );

Return Value

1-dimensional Array

Parameters

Parameter Type Description
SubdivisionRule siSubdivisionRuleType This parameter contains the subdivision rule to use for the approximation.
SubdivisionLevel Long This parameter contains the subdivision rule to use for the approximation.
UseDiscontinuity Boolean Specified if we want to use the discontinuity angle or not.
DiscontinuityAngle Double Specifies the angle of discontinuity.

Examples

VBScript Example

set oCube = ActiveSceneRoot.AddGeometry( "Cube","MeshSurface" )
set oGApprox = oCube.Properties.Find("geomapprox")
MakeLocal oGApprox
oGApprox.Parameters("gapproxmosl").value = 1
values = oCube.ActivePrimitive.Geometry.GetApproximatedMesh( _
		oGApprox.Parameters("gapproxmosr").value,_
		oGApprox.Parameters("gapproxmosl").value,_
		oGApprox.Parameters("gapproxmoad").value,_
		oGApprox.Parameters("gapproxmoan").value )
aVertices = values(0)
aPolygonData = values(1)
set oApproximatedCube = ActiveSceneRoot.AddPolygonMesh( aVertices, aPolygonData )