Unit CastleTriangulate
Description
Triangulating a polygon.
Uses
Overview
Functions and Procedures
procedure TriangulateFace( FaceIndices: PInt32Array; Count: Integer; Vertices: PVector3Array; VerticesCount: Integer; TriangulatorProc: TTriangulatorProc; AddToIndices: Integer); overload; |
procedure TriangulateFace( FaceIndices: PInt32Array; Count: Integer; Vertices: TGetVertexFromIndexFunc; TriangulatorProc: TTriangulatorProc; AddToIndices: Integer); overload; |
procedure TriangulateConvexFace(Count: Integer; TriangulatorProc: TTriangulatorProc; AddToIndices: Integer); |
function IndexedPolygonNormal( Indices: PInt32Array; IndicesCount: Integer; Vertices: PVector3Array; const VerticesCount: Integer; const ResultForIncorrectPoly: TVector3; const Convex: boolean): TVector3; |
Types
TTriangulatorProc = procedure (const Tri: TVector3Integer) of object; |
Variables
LogTriangulation: boolean; |
Description
Functions and Procedures
procedure TriangulateFace( FaceIndices: PInt32Array; Count: Integer; Vertices: PVector3Array; VerticesCount: Integer; TriangulatorProc: TTriangulatorProc; AddToIndices: Integer); overload; |
Triangulate potentially non-convex face. FaceIndices[0]..FaceIndices[Count - 1] are indices to the Vertices array. They describe the outline of the polygon (face). You can pass FaceIndices = For each resulting triangle we will call TriangulatorProc with Tri (first param of TriangulatorProc) containing indices to FaceIndices[] array. We return indices to FaceIndices (not ready vectors from Vertices, not even indices to Vertices[] array) to allow the caller to obtain all information about the triangle. In the simple case, you can just use Vertices[FaceIndices[Tri[0..2]]] to obtain your triangle, in the more sophisticated cases you have other options to e.g. extract other vertex information from whatever data you have (see e.g. VRML/X3D IndexedFaceSet renderer). Generated triangles have the same orientation (normal from ccw etc.) as original polygon. This also means that if you're sure that your polygon is planar (and it should be — although we handle gracefully small deviations from planar, this procedure doesn't actually handle arbitrary (dis)located 3D data) then normal vector of all your triangles is the same. Note that you generally shouldn't use this procedure if you know that your polygon is convex. Then using this is a waste of time, after all convex polygons can be triangulated much easier. You can use TriangulateConvexFace in this case, which has deliberately very similar interface to this procedure.
Parameters
See also
|
procedure TriangulateFace( FaceIndices: PInt32Array; Count: Integer; Vertices: TGetVertexFromIndexFunc; TriangulatorProc: TTriangulatorProc; AddToIndices: Integer); overload; |
This item has no description. |
procedure TriangulateConvexFace(Count: Integer; TriangulatorProc: TTriangulatorProc; AddToIndices: Integer); |
Triangulate convex polygon. This performs very easy triangulation. It has deliberately similar interface to TriangulateFace, so it can be used as drop-in replacement for TriangulateFace, when you know that your face is convex. Note that it doesn't even need to know FaceIndices or Vertices, it's enough to know Count. This also guarantees consequent triangles orientation, like TriangulateFace. See also |
function IndexedPolygonNormal( Indices: PInt32Array; IndicesCount: Integer; Vertices: PVector3Array; const VerticesCount: Integer; const ResultForIncorrectPoly: TVector3; const Convex: boolean): TVector3; |
Calculate normal vector of possibly concave polygon. |
Types
TTriangulatorProc = procedure (const Tri: TVector3Integer) of object; |
This item has no description. |
Variables
LogTriangulation: boolean; |
Write to Log a lot of comments how the triangulation goes. Useful for examples/visualize_triangulation/ . |
Generated by PasDoc 0.16.0-snapshot.