%%PageItemTitle%%

VectorDraw Web Library

JsPropertiesExtractor Send comments on this topic.
TriangulatePolyface Method
See Also  Example
vdWebLibrary Namespace > vdrawObj Class : TriangulatePolyface Method
pface
An existing polyface object.AddPolyface
precision
Integer that defines the number of decimals used for the passed points triangulation.
Triangulates the VertexList of an existing vdPolyface using Delaunay algorithm and change the FaceList of the object according to calculated triangles.

Syntax

JScript 
public function TriangulatePolyface( 
   pface : Object,
   precision : int
) : boolean;

Parameters

pface
An existing polyface object.AddPolyface
precision
Integer that defines the number of decimals used for the passed points triangulation.

Return Value

True if the triangulation succesully done.

Example

Create a polyface by triangulating an array of points.
C#Copy Code
var points = [ 
                  [0, 0, 0], 
                  [4, 0, 0], 
                  [4, 4, 0], 
                  [0, 4, 0], 
                  [1, 1, 1], 
                  [3, 1, 1], 
                  [3, 3, 1], 
                  [1, 3, 1], 
                  [2, 2, 2] 
       ]; 
       var pface = vdcanvas.AddPolyface(points, []); 
       var res = vdcanvas.TriangulatePolyface(pface,8); 
       if(res) vdcanvas.redraw();

See Also