C# Class LibTessDotNet.Tess

The main tessellation class
Mostra file Open project: Ideefixze/TutorialUnityMultiplayer Class Usage Examples

Public Properties

Property Type Description
NoEmptyPolygons bool
SUnitX Real
SUnitY Real
SentinelCoord Real
UsePooling bool

Public Methods

Method Description
AddContour ( Array vertices ) : void
AddContour ( Array vertices, ContourOrientation forceOrientation ) : void
Tess ( ) : System
Tessellate ( WindingRule windingRule, ElementType elementType, int polySize ) : void
Tessellate ( WindingRule windingRule, ElementType elementType, int polySize, CombineCallback combineCallback ) : void

Private Methods

Method Description
CheckOrientation ( ) : void
ComputeNormal ( LibTessDotNet.Vec3 &norm ) : void
DiscardExterior ( ) : void

DiscardExterior zaps (ie. sets to null) all faces which are not marked "inside" the polygon. Since further mesh operations on NULL faces are not allowed, the main purpose is to clean up the mesh so that exterior loops are not represented in the data structure.

GetNeighbourFace ( LibTessDotNet.MeshUtils.Edge edge ) : int
OutputContours ( ) : void
OutputPolymesh ( ElementType elementType, int polySize ) : void
ProjectPolygon ( ) : void
SetWindingNumber ( int value, bool keepOnlyBoundary ) : void

SetWindingNumber( value, keepOnlyBoundary ) resets the winding numbers on all edges so that regions marked "inside" the polygon have a winding number of "value", and regions outside have a winding number of 0. If keepOnlyBoundary is TRUE, it also deletes all edges which do not separate an interior region from an exterior one.

SignedArea ( Array vertices ) : Real
TessellateInterior ( ) : void

TessellateInterior( mesh ) tessellates each region of the mesh which is marked "inside" the polygon. Each such region must be monotone.

TessellateMonoRegion ( LibTessDotNet.MeshUtils.Face face ) : void

TessellateMonoRegion( face ) tessellates a monotone region (what else would it do??) The region must consist of a single loop of half-edges (see mesh.h) oriented CCW. "Monotone" in this case means that any vertical line intersects the interior of the region in a single interval. Tessellation consists of adding interior edges (actually pairs of half-edges), to split the region into non-overlapping triangles. The basic idea is explained in Preparata and Shamos (which I don't have handy right now), although their implementation is more complicated than this one. The are two edge chains, an upper chain and a lower chain. We process all vertices from both chains in order, from right to left. The algorithm ensures that the following invariant holds after each vertex is processed: the untessellated region consists of two chains, where one chain (say the upper) is a single edge, and the other chain is concave. The left vertex of the single edge is always to the left of all vertices in the concave chain. Each step consists of adding the rightmost unprocessed vertex to one of the two chains, and forming a fan of triangles from the rightmost of two chain endpoints. Determining whether we can add each triangle to the fan is a simple orientation test. By making the fan as large as possible, we restore the invariant (check it yourself).

Method Details

AddContour() public method

public AddContour ( Array vertices ) : void
vertices Array
return void

AddContour() public method

public AddContour ( Array vertices, ContourOrientation forceOrientation ) : void
vertices Array
forceOrientation ContourOrientation
return void

Tess() public method

public Tess ( ) : System
return System

Tessellate() public method

public Tessellate ( WindingRule windingRule, ElementType elementType, int polySize ) : void
windingRule WindingRule
elementType ElementType
polySize int
return void

Tessellate() public method

public Tessellate ( WindingRule windingRule, ElementType elementType, int polySize, CombineCallback combineCallback ) : void
windingRule WindingRule
elementType ElementType
polySize int
combineCallback CombineCallback
return void

Property Details

NoEmptyPolygons public_oe property

If true, will remove empty (zero area) polygons.
public bool NoEmptyPolygons
return bool

SUnitX public_oe property

public Real SUnitX
return Real

SUnitY public_oe property

public Real SUnitY
return Real

SentinelCoord public_oe property

public Real SentinelCoord
return Real

UsePooling public_oe property

If true, will use pooling to reduce GC (compare performance with/without, can vary wildly).
public bool UsePooling
return bool