VTK
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
vtkOrderedTriangulator Class Reference

helper class to generate triangulations More...

#include <vtkOrderedTriangulator.h>

Inheritance diagram for vtkOrderedTriangulator:
[legend]
Collaboration diagram for vtkOrderedTriangulator:
[legend]

Public Types

typedef vtkObject Superclass
 

Public Member Functions

virtual vtkTypeBool IsA (const char *type)
 Return 1 if this class is the same type of (or a subclass of) the named class. More...
 
vtkOrderedTriangulatorNewInstance () const
 
void PrintSelf (ostream &os, vtkIndent indent) override
 Methods invoked by print to print information about the object including superclasses. More...
 
void InitTriangulation (double xmin, double xmax, double ymin, double ymax, double zmin, double zmax, int numPts)
 Initialize the triangulation process. More...
 
void InitTriangulation (double bounds[6], int numPts)
 
vtkIdType InsertPoint (vtkIdType id, double x[3], double p[3], int type)
 For each point to be inserted, provide an id, a position x, parametric coordinate p, and whether the point is inside (type=0), outside (type=1), or on the boundary (type=2). More...
 
vtkIdType InsertPoint (vtkIdType id, vtkIdType sortid, double x[3], double p[3], int type)
 
vtkIdType InsertPoint (vtkIdType id, vtkIdType sortid, vtkIdType sortid2, double x[3], double p[3], int type)
 
void Triangulate ()
 Perform the triangulation. More...
 
void TemplateTriangulate (int cellType, int numPts, int numEdges)
 
void UpdatePointType (vtkIdType internalId, int type)
 Update the point type. More...
 
double * GetPointPosition (vtkIdType internalId)
 Return the parametric coordinates of point ‘internalId’. More...
 
double * GetPointLocation (vtkIdType internalId)
 Return the global coordinates of point ‘internalId’. More...
 
vtkIdType GetPointId (vtkIdType internalId)
 Return the Id of point ‘internalId’. More...
 
virtual int GetNumberOfPoints ()
 Return the number of inserted points. More...
 
virtual void SetUseTemplates (vtkTypeBool)
 If this flag is set, then the ordered triangulator will create and use templates for the triangulation. More...
 
virtual vtkTypeBool GetUseTemplates ()
 
virtual void UseTemplatesOn ()
 
virtual void UseTemplatesOff ()
 
virtual void SetPreSorted (vtkTypeBool)
 Boolean indicates whether the points have been pre-sorted. More...
 
virtual vtkTypeBool GetPreSorted ()
 
virtual void PreSortedOn ()
 
virtual void PreSortedOff ()
 
virtual void SetUseTwoSortIds (vtkTypeBool)
 Tells the triangulator that a second sort id is provided for each point and should also be considered when sorting. More...
 
virtual vtkTypeBool GetUseTwoSortIds ()
 
virtual void UseTwoSortIdsOn ()
 
virtual void UseTwoSortIdsOff ()
 
vtkIdType GetTetras (int classification, vtkUnstructuredGrid *ugrid)
 Initialize and add the tetras and points from the triangulation to the unstructured grid provided. More...
 
vtkIdType AddTetras (int classification, vtkUnstructuredGrid *ugrid)
 Add the tetras to the unstructured grid provided. More...
 
vtkIdType AddTetras (int classification, vtkCellArray *connectivity)
 Add the tetrahedra classified (0=inside,1=outside) to the connectivity list provided. More...
 
vtkIdType AddTetras (int classification, vtkIncrementalPointLocator *locator, vtkCellArray *outConnectivity, vtkPointData *inPD, vtkPointData *outPD, vtkCellData *inCD, vtkIdType cellId, vtkCellData *outCD)
 Assuming that all the inserted points come from a cell ‘cellId’ to triangulate, get the tetrahedra in outConnectivity, the points in locator and copy point data and cell data. More...
 
vtkIdType AddTetras (int classification, vtkIdList *ptIds, vtkPoints *pts)
 Add the tetrahedra classified (0=inside,1=outside) to the list of ids and coordinates provided. More...
 
vtkIdType AddTriangles (vtkCellArray *connectivity)
 Add the triangle faces classified (2=boundary) to the connectivity list provided. More...
 
vtkIdType AddTriangles (vtkIdType id, vtkCellArray *connectivity)
 Add the triangle faces classified (2=boundary) and attached to the specified point id to the connectivity list provided. More...
 
void InitTetraTraversal ()
 Methods to get one tetra at a time. More...
 
int GetNextTetra (int classification, vtkTetra *tet, vtkDataArray *cellScalars, vtkDoubleArray *tetScalars)
 Methods to get one tetra at a time. More...
 
- Public Member Functions inherited from vtkObject
 vtkBaseTypeMacro (vtkObject, vtkObjectBase)
 
virtual void DebugOn ()
 Turn debugging output on. More...
 
virtual void DebugOff ()
 Turn debugging output off. More...
 
bool GetDebug ()
 Get the value of the debug flag. More...
 
void SetDebug (bool debugFlag)
 Set the value of the debug flag. More...
 
virtual void Modified ()
 Update the modification time for this object. More...
 
virtual vtkMTimeType GetMTime ()
 Return this object's modified time. More...
 
unsigned long AddObserver (unsigned long event, vtkCommand *, float priority=0.0f)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object. More...
 
unsigned long AddObserver (const char *event, vtkCommand *, float priority=0.0f)
 
vtkCommandGetCommand (unsigned long tag)
 
void RemoveObserver (vtkCommand *)
 
void RemoveObservers (unsigned long event, vtkCommand *)
 
void RemoveObservers (const char *event, vtkCommand *)
 
vtkTypeBool HasObserver (unsigned long event, vtkCommand *)
 
vtkTypeBool HasObserver (const char *event, vtkCommand *)
 
void RemoveObserver (unsigned long tag)
 
void RemoveObservers (unsigned long event)
 
void RemoveObservers (const char *event)
 
void RemoveAllObservers ()
 
vtkTypeBool HasObserver (unsigned long event)
 
vtkTypeBool HasObserver (const char *event)
 
template<class U , class T >
unsigned long AddObserver (unsigned long event, U observer, void(T::*callback)(), float priority=0.0f)
 Overloads to AddObserver that allow developers to add class member functions as callbacks for events. More...
 
template<class U , class T >
unsigned long AddObserver (unsigned long event, U observer, void(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f)
 
template<class U , class T >
unsigned long AddObserver (unsigned long event, U observer, bool(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f)
 Allow user to set the AbortFlagOn() with the return value of the callback method. More...
 
int InvokeEvent (unsigned long event, void *callData)
 This method invokes an event and return whether the event was aborted or not. More...
 
int InvokeEvent (const char *event, void *callData)
 
int InvokeEvent (unsigned long event)
 
int InvokeEvent (const char *event)
 
- Public Member Functions inherited from vtkObjectBase
const char * GetClassName () const
 Return the class name as a string. More...
 
virtual void Delete ()
 Delete a VTK object. More...
 
virtual void FastDelete ()
 Delete a reference to this object. More...
 
void InitializeObjectBase ()
 
void Print (ostream &os)
 Print an object to an ostream. More...
 
virtual void PrintHeader (ostream &os, vtkIndent indent)
 
virtual void PrintTrailer (ostream &os, vtkIndent indent)
 
virtual void Register (vtkObjectBase *o)
 Increase the reference count (mark as used by another object). More...
 
virtual void UnRegister (vtkObjectBase *o)
 Decrease the reference count (release by another object). More...
 
int GetReferenceCount ()
 Return the current reference count of this object. More...
 
void SetReferenceCount (int)
 Sets the reference count. More...
 
void PrintRevisions (ostream &)
 Legacy. More...
 

Static Public Member Functions

static vtkTypeBool IsTypeOf (const char *type)
 
static vtkOrderedTriangulatorSafeDownCast (vtkObjectBase *o)
 
static vtkOrderedTriangulatorNew ()
 Construct object. More...
 
- Static Public Member Functions inherited from vtkObject
static vtkObjectNew ()
 Create an object with Debug turned off, modified time initialized to zero, and reference counting on. More...
 
static void BreakOnError ()
 This method is called when vtkErrorMacro executes. More...
 
static void SetGlobalWarningDisplay (int val)
 This is a global flag that controls whether any debug, warning or error messages are displayed. More...
 
static void GlobalWarningDisplayOn ()
 
static void GlobalWarningDisplayOff ()
 
static int GetGlobalWarningDisplay ()
 
- Static Public Member Functions inherited from vtkObjectBase
static vtkTypeBool IsTypeOf (const char *name)
 Return 1 if this class type is the same type of (or a subclass of) the named class. More...
 
static vtkObjectBaseNew ()
 Create an object with Debug turned off, modified time initialized to zero, and reference counting on. More...
 

Protected Member Functions

virtual vtkObjectBaseNewInstanceInternal () const
 
 vtkOrderedTriangulator ()
 
 ~vtkOrderedTriangulator () override
 
- Protected Member Functions inherited from vtkObject
 vtkObject ()
 
 ~vtkObject () override
 
void RegisterInternal (vtkObjectBase *, vtkTypeBool check) override
 
void UnRegisterInternal (vtkObjectBase *, vtkTypeBool check) override
 
void InternalGrabFocus (vtkCommand *mouseEvents, vtkCommand *keypressEvents=nullptr)
 These methods allow a command to exclusively grab all events. More...
 
void InternalReleaseFocus ()
 
- Protected Member Functions inherited from vtkObjectBase
 vtkObjectBase ()
 
virtual ~vtkObjectBase ()
 
virtual void CollectRevisions (ostream &)
 
virtual void ReportReferences (vtkGarbageCollector *)
 
 vtkObjectBase (const vtkObjectBase &)
 
void operator= (const vtkObjectBase &)
 

Additional Inherited Members

- Protected Attributes inherited from vtkObject
bool Debug
 
vtkTimeStamp MTime
 
vtkSubjectHelper * SubjectHelper
 
- Protected Attributes inherited from vtkObjectBase
std::atomic< int32_t > ReferenceCount
 
vtkWeakPointerBase ** WeakPointers
 

Detailed Description

helper class to generate triangulations

This class is used to generate unique triangulations of points. The uniqueness of the triangulation is controlled by the id of the inserted points in combination with a Delaunay criterion. The class is designed to be as fast as possible (since the algorithm can be slow) and uses block memory allocations to support rapid triangulation generation. Also, the assumption behind the class is that a maximum of hundreds of points are to be triangulated. If you desire more robust triangulation methods use vtkPolygon::Triangulate(), vtkDelaunay2D, or vtkDelaunay3D.

Background:
This work is documented in the technical paper: W.J. Schroeder, B. Geveci, M. Malaterre. Compatible Triangulations of Spatial Decompositions. In Proceedings of Visualization 2004, IEEE Press October 2004.
Background:
Delaunay triangulations are unique assuming a random distribution of input points. The 3D Delaunay criterion is as follows: the circumsphere of each tetrahedron contains no other points of the triangulation except for the four points defining the tetrahedron. In application this property is hard to satisfy because objects like cubes are defined by eight points all sharing the same circumsphere (center and radius); hence the Delaunay triangulation is not unique. These so-called degenerate situations are typically resolved by arbitrary selecting a triangulation. This code does something different: it resolves degenerate triangulations by modifying the "InCircumsphere" method to use a slightly smaller radius. Hence, degenerate points are always considered "out" of the circumsphere. This, in combination with an ordering (based on id) of the input points, guarantees a unique triangulation.
Background:
There is another related characteristic of Delaunay triangulations. Given a N-dimensional Delaunay triangulation, points laying on a (N-1) dimensional plane also form a (N-1) Delaunay triangulation. This means for example, that if a 3D cell is defined by a set of (2D) planar faces, then the face triangulations are Delaunay. Combining this with the method to generate unique triangulations described previously, the triangulations on the face are guaranteed unique. This fact can be used to triangulate 3D objects in such a way to guarantee compatible face triangulations. This is a very useful fact for parallel processing, or performing operations like clipping that require compatible triangulations across 3D cell faces. (See vtkClipVolume for an example.)
Background:
A special feature of this class is that it can generate triangulation templates on the fly. If template triangulation is enabled, then the ordered triangulator will first triangulate the cell using the slower ordered Delaunay approach, and then store the result as a template. Later, if the same cell type and cell configuration is encountered, then the template is reused which greatly speeds the triangulation.
Warning
Duplicate vertices will be ignored, i.e., if two points have the same coordinates the second one is discarded. The implications are that the user of this class must prevent duplicate points. Because the precision of this algorithm is double, it's also a good idea to merge points that are within some epsilon of one another.
The triangulation is performed using the parametric coordinates of the inserted points. Therefore the bounds (see InitTriangulation()) should represent the range of the parametric coordinates of the inserted points.
See also
vtkDelaunay2D vtkDelaunay3D vtkPolygon

Definition at line 114 of file vtkOrderedTriangulator.h.

Member Typedef Documentation

◆ Superclass

Definition at line 117 of file vtkOrderedTriangulator.h.

Constructor & Destructor Documentation

◆ vtkOrderedTriangulator()

vtkOrderedTriangulator::vtkOrderedTriangulator ( )
protected

◆ ~vtkOrderedTriangulator()

vtkOrderedTriangulator::~vtkOrderedTriangulator ( )
overrideprotected

Member Function Documentation

◆ IsTypeOf()

static vtkTypeBool vtkOrderedTriangulator::IsTypeOf ( const char *  type)
static

◆ IsA()

virtual vtkTypeBool vtkOrderedTriangulator::IsA ( const char *  name)
virtual

Return 1 if this class is the same type of (or a subclass of) the named class.

Returns 0 otherwise. This method works in combination with vtkTypeMacro found in vtkSetGet.h.

Reimplemented from vtkObjectBase.

◆ SafeDownCast()

static vtkOrderedTriangulator* vtkOrderedTriangulator::SafeDownCast ( vtkObjectBase o)
static

◆ NewInstanceInternal()

virtual vtkObjectBase* vtkOrderedTriangulator::NewInstanceInternal ( ) const
protectedvirtual

◆ NewInstance()

vtkOrderedTriangulator* vtkOrderedTriangulator::NewInstance ( ) const

◆ PrintSelf()

void vtkOrderedTriangulator::PrintSelf ( ostream &  os,
vtkIndent  indent 
)
overridevirtual

Methods invoked by print to print information about the object including superclasses.

Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes.

Reimplemented from vtkObject.

◆ New()

static vtkOrderedTriangulator* vtkOrderedTriangulator::New ( )
static

Construct object.

◆ InitTriangulation() [1/2]

void vtkOrderedTriangulator::InitTriangulation ( double  xmin,
double  xmax,
double  ymin,
double  ymax,
double  zmin,
double  zmax,
int  numPts 
)

Initialize the triangulation process.

Provide a bounding box and the maximum number of points to be inserted. Note that since the triangulation is performed using parametric coordinates (see InsertPoint()) the bounds should be represent the range of the parametric coordinates inserted.

Postcondition
no_point_inserted: GetNumberOfPoints()==0

◆ InitTriangulation() [2/2]

void vtkOrderedTriangulator::InitTriangulation ( double  bounds[6],
int  numPts 
)

◆ InsertPoint() [1/3]

vtkIdType vtkOrderedTriangulator::InsertPoint ( vtkIdType  id,
double  x[3],
double  p[3],
int  type 
)

For each point to be inserted, provide an id, a position x, parametric coordinate p, and whether the point is inside (type=0), outside (type=1), or on the boundary (type=2).

You must call InitTriangulation() prior to invoking this method. Make sure that the number of points inserted does not exceed the numPts specified in InitTriangulation(). Also note that the "id" can be any integer and can be greater than numPts. It is used to create tetras (in AddTetras()) with the appropriate connectivity ids. The method returns an internal id that can be used prior to the Triangulate() method to update the type of the point with UpdatePointType(). (Note: the algorithm triangulated with the parametric coordinate p[3] and creates tetras with the global coordinate x[3]. The parametric coordinates and global coordinates may be the same.)

◆ InsertPoint() [2/3]

vtkIdType vtkOrderedTriangulator::InsertPoint ( vtkIdType  id,
vtkIdType  sortid,
double  x[3],
double  p[3],
int  type 
)

◆ InsertPoint() [3/3]

vtkIdType vtkOrderedTriangulator::InsertPoint ( vtkIdType  id,
vtkIdType  sortid,
vtkIdType  sortid2,
double  x[3],
double  p[3],
int  type 
)

◆ Triangulate()

void vtkOrderedTriangulator::Triangulate ( )

Perform the triangulation.

(Complete all calls to InsertPoint() prior to invoking this method.) A special version is available when templates should be used.

◆ TemplateTriangulate()

void vtkOrderedTriangulator::TemplateTriangulate ( int  cellType,
int  numPts,
int  numEdges 
)

◆ UpdatePointType()

void vtkOrderedTriangulator::UpdatePointType ( vtkIdType  internalId,
int  type 
)

Update the point type.

This is useful when the merging of nearly coincident points is performed. The id is the internal id returned from InsertPoint(). The method should be invoked prior to the Triangulate method. The type is specified as inside (type=0), outside (type=1), or on the boundary (type=2).

Precondition
valid_range: internalId>=0 && internalId<this->GetNumberOfPoints()

◆ GetPointPosition()

double* vtkOrderedTriangulator::GetPointPosition ( vtkIdType  internalId)

Return the parametric coordinates of point ‘internalId’.

It assumes that the point has already been inserted. The method should be invoked prior to the Triangulate method.

Precondition
valid_range: internalId>=0 && internalId<this->GetNumberOfPoints()

◆ GetPointLocation()

double* vtkOrderedTriangulator::GetPointLocation ( vtkIdType  internalId)

Return the global coordinates of point ‘internalId’.

It assumes that the point has already been inserted. The method should be invoked prior to the Triangulate method.

Precondition
valid_range: internalId>=0 && internalId<this->GetNumberOfPoints()

◆ GetPointId()

vtkIdType vtkOrderedTriangulator::GetPointId ( vtkIdType  internalId)

Return the Id of point ‘internalId’.

This id is the one passed in argument of InsertPoint. It assumes that the point has already been inserted. The method should be invoked prior to the Triangulate method.

Precondition
valid_range: internalId>=0 && internalId<this->GetNumberOfPoints()

◆ GetNumberOfPoints()

virtual int vtkOrderedTriangulator::GetNumberOfPoints ( )
virtual

Return the number of inserted points.

◆ SetUseTemplates()

virtual void vtkOrderedTriangulator::SetUseTemplates ( vtkTypeBool  )
virtual

If this flag is set, then the ordered triangulator will create and use templates for the triangulation.

To use templates, the TemplateTriangulate() method should be called when appropriate. (Note: the TemplateTriangulate() method works for complete (interior) cells without extra points due to intersection, etc.)

◆ GetUseTemplates()

virtual vtkTypeBool vtkOrderedTriangulator::GetUseTemplates ( )
virtual

◆ UseTemplatesOn()

virtual void vtkOrderedTriangulator::UseTemplatesOn ( )
virtual

◆ UseTemplatesOff()

virtual void vtkOrderedTriangulator::UseTemplatesOff ( )
virtual

◆ SetPreSorted()

virtual void vtkOrderedTriangulator::SetPreSorted ( vtkTypeBool  )
virtual

Boolean indicates whether the points have been pre-sorted.

If pre-sorted is enabled, the points are not sorted on point id. By default, presorted is off. (The point id is defined in InsertPoint().)

◆ GetPreSorted()

virtual vtkTypeBool vtkOrderedTriangulator::GetPreSorted ( )
virtual

◆ PreSortedOn()

virtual void vtkOrderedTriangulator::PreSortedOn ( )
virtual

◆ PreSortedOff()

virtual void vtkOrderedTriangulator::PreSortedOff ( )
virtual

◆ SetUseTwoSortIds()

virtual void vtkOrderedTriangulator::SetUseTwoSortIds ( vtkTypeBool  )
virtual

Tells the triangulator that a second sort id is provided for each point and should also be considered when sorting.

◆ GetUseTwoSortIds()

virtual vtkTypeBool vtkOrderedTriangulator::GetUseTwoSortIds ( )
virtual

◆ UseTwoSortIdsOn()

virtual void vtkOrderedTriangulator::UseTwoSortIdsOn ( )
virtual

◆ UseTwoSortIdsOff()

virtual void vtkOrderedTriangulator::UseTwoSortIdsOff ( )
virtual

◆ GetTetras()

vtkIdType vtkOrderedTriangulator::GetTetras ( int  classification,
vtkUnstructuredGrid ugrid 
)

Initialize and add the tetras and points from the triangulation to the unstructured grid provided.

New points are created and the mesh is allocated. (This method differs from AddTetras() in that it inserts points and cells; AddTetras only adds the tetra cells.) The tetrahdera added are of the type specified (0=inside,1=outside,2=all). Inside tetrahedron are those whose points are classified "inside" or on the "boundary." Outside tetrahedron have at least one point classified "outside." The method returns the number of tetrahedrahedron of the type requested.

◆ AddTetras() [1/4]

vtkIdType vtkOrderedTriangulator::AddTetras ( int  classification,
vtkUnstructuredGrid ugrid 
)

Add the tetras to the unstructured grid provided.

The unstructured grid is assumed to have been initialized (with Allocate()) and points set (with SetPoints()). The tetrahdera added are of the type specified (0=inside,1=outside,2=all). Inside tetrahedron are those whose points are classified "inside" or on the "boundary." Outside tetrahedron have at least one point classified "outside." The method returns the number of tetrahedrahedron of the type requested.

◆ AddTetras() [2/4]

vtkIdType vtkOrderedTriangulator::AddTetras ( int  classification,
vtkCellArray connectivity 
)

Add the tetrahedra classified (0=inside,1=outside) to the connectivity list provided.

Inside tetrahedron are those whose points are all classified "inside." Outside tetrahedron have at least one point classified "outside." The method returns the number of tetrahedron of the type requested.

◆ AddTetras() [3/4]

vtkIdType vtkOrderedTriangulator::AddTetras ( int  classification,
vtkIncrementalPointLocator locator,
vtkCellArray outConnectivity,
vtkPointData inPD,
vtkPointData outPD,
vtkCellData inCD,
vtkIdType  cellId,
vtkCellData outCD 
)

Assuming that all the inserted points come from a cell ‘cellId’ to triangulate, get the tetrahedra in outConnectivity, the points in locator and copy point data and cell data.

Return the number of added tetras.

Precondition
locator_exists: locator!=0
outConnectivity: outConnectivity!=0
inPD_exists: inPD!=0
outPD_exists: outPD!=0
inCD_exists: inCD!=0
outCD_exists: outCD!=0

◆ AddTetras() [4/4]

vtkIdType vtkOrderedTriangulator::AddTetras ( int  classification,
vtkIdList ptIds,
vtkPoints pts 
)

Add the tetrahedra classified (0=inside,1=outside) to the list of ids and coordinates provided.

These assume that the first four points form a tetrahedron, the next four the next, and so on.

◆ AddTriangles() [1/2]

vtkIdType vtkOrderedTriangulator::AddTriangles ( vtkCellArray connectivity)

Add the triangle faces classified (2=boundary) to the connectivity list provided.

The method returns the number of triangles.

◆ AddTriangles() [2/2]

vtkIdType vtkOrderedTriangulator::AddTriangles ( vtkIdType  id,
vtkCellArray connectivity 
)

Add the triangle faces classified (2=boundary) and attached to the specified point id to the connectivity list provided.

(The id is the same as that specified in InsertPoint().)

◆ InitTetraTraversal()

void vtkOrderedTriangulator::InitTetraTraversal ( )

Methods to get one tetra at a time.

Start with InitTetraTraversal() and then invoke GetNextTetra() until the method returns 0.

◆ GetNextTetra()

int vtkOrderedTriangulator::GetNextTetra ( int  classification,
vtkTetra tet,
vtkDataArray cellScalars,
vtkDoubleArray tetScalars 
)

Methods to get one tetra at a time.

Start with InitTetraTraversal() and then invoke GetNextTetra() until the method returns 0. cellScalars are point-centered scalars on the original cell. tetScalars are point-centered scalars on the tetra: the values will be copied from cellScalars.

Precondition
tet_exists: tet!=0
cellScalars_exists: cellScalars!=0
tetScalars_exists: tetScalars!=0
tetScalars_valid_size: tetScalars->GetNumberOfTuples()==4

The documentation for this class was generated from the following file: