C# Class TriangleNet.Quality

Provides methods for mesh quality enforcement and testing.
Show file Open project: RegrowthStudios/VoxelRTS Class Usage Examples

Public Methods

Method Description
AddBadSubseg ( TriangleNet.Data.BadSubseg badseg ) : void

Add a bad subsegment to the queue.

CheckDelaunay ( ) : bool

Ensure that the mesh is (constrained) Delaunay.

CheckMesh ( ) : bool

Test the mesh for topological consistency.

CheckSeg4Encroach ( TriangleNet.Data.Osub &testsubseg ) : int

Check a subsegment to see if it is encroached; add it to the list if it is.

A subsegment is encroached if there is a vertex in its diametral lens. For Ruppert's algorithm (-D switch), the "diametral lens" is the diametral circle. For Chew's algorithm (default), the diametral lens is just big enough to enclose two isosceles triangles whose bases are the subsegment. Each of the two isosceles triangles has two angles equal to 'b.minangle'. Chew's algorithm does not require diametral lenses at all--but they save time. Any vertex inside a subsegment's diametral lens implies that the triangle adjoining the subsegment will be too skinny, so it's only a matter of time before the encroaching vertex is deleted by Chew's algorithm. It's faster to simply not insert the doomed vertex in the first place, which is why I use diametral lenses with Chew's algorithm.

EnforceQuality ( ) : void

Remove all the encroached subsegments and bad triangles from the triangulation.

Quality ( Mesh mesh ) : System
TestTriangle ( TriangleNet.Data.Otri &testtri ) : void

Test a triangle for quality and size.

Tests a triangle to see if it satisfies the minimum angle condition and the maximum area condition. Triangles that aren't up to spec are added to the bad triangle queue.

Private Methods

Method Description
SplitEncSegs ( bool triflaws ) : void

Split all the encroached subsegments.

Each encroached subsegment is repaired by splitting it - inserting a vertex at or near its midpoint. Newly inserted vertices may encroach upon other subsegments; these are also repaired.

SplitTriangle ( TriangleNet.Data.BadTriangle badtri ) : void

Inserts a vertex at the circumcenter of a triangle. Deletes the newly inserted vertex if it encroaches upon a segment.

TallyEncs ( ) : void

Traverse the entire list of subsegments, and check each to see if it is encroached. If so, add it to the list.

TallyFaces ( ) : void

Test every triangle in the mesh for quality measures.

Method Details

AddBadSubseg() public method

Add a bad subsegment to the queue.
public AddBadSubseg ( TriangleNet.Data.BadSubseg badseg ) : void
badseg TriangleNet.Data.BadSubseg Bad subsegment.
return void

CheckDelaunay() public method

Ensure that the mesh is (constrained) Delaunay.
public CheckDelaunay ( ) : bool
return bool

CheckMesh() public method

Test the mesh for topological consistency.
public CheckMesh ( ) : bool
return bool

CheckSeg4Encroach() public method

Check a subsegment to see if it is encroached; add it to the list if it is.
A subsegment is encroached if there is a vertex in its diametral lens. For Ruppert's algorithm (-D switch), the "diametral lens" is the diametral circle. For Chew's algorithm (default), the diametral lens is just big enough to enclose two isosceles triangles whose bases are the subsegment. Each of the two isosceles triangles has two angles equal to 'b.minangle'. Chew's algorithm does not require diametral lenses at all--but they save time. Any vertex inside a subsegment's diametral lens implies that the triangle adjoining the subsegment will be too skinny, so it's only a matter of time before the encroaching vertex is deleted by Chew's algorithm. It's faster to simply not insert the doomed vertex in the first place, which is why I use diametral lenses with Chew's algorithm.
public CheckSeg4Encroach ( TriangleNet.Data.Osub &testsubseg ) : int
testsubseg TriangleNet.Data.Osub The subsegment to check.
return int

EnforceQuality() public method

Remove all the encroached subsegments and bad triangles from the triangulation.
public EnforceQuality ( ) : void
return void

Quality() public method

public Quality ( Mesh mesh ) : System
mesh Mesh
return System

TestTriangle() public method

Test a triangle for quality and size.
Tests a triangle to see if it satisfies the minimum angle condition and the maximum area condition. Triangles that aren't up to spec are added to the bad triangle queue.
public TestTriangle ( TriangleNet.Data.Otri &testtri ) : void
testtri TriangleNet.Data.Otri Triangle to check.
return void