Graphite  Version 3
An experimental 3D geometry processing program
GEO::CoplanarFacets Class Reference

Detects and retriangulates a set of coplanar facets for MeshSurfaceIntersection. More...

#include <geogram/mesh/mesh_surface_intersection_internal.h>

Public Types

typedef MeshSurfaceIntersection::ExactPoint ExactPoint
 

Public Member Functions

 CoplanarFacets (MeshSurfaceIntersection &I, bool clear_attributes, double angle_tolerance=0.0)
 Constructs a CoplanarFacets object associated with a MeshSurfaceIntersection. More...
 
void get (index_t f, index_t group_id)
 Gets the set of coplanar facets from a given facet and group id. More...
 
void mark_vertices_to_keep ()
 Marks the vertices that need to be kept in the simplified facets. More...
 
void save_borders (const std::string &filename)
 For debugging purposes, saves border edges to a file. More...
 
void save_facet_group (const std::string &filename)
 For debugging purposes, saves all the facets of the group to a file. More...
 
void triangulate ()
 Triangulates the kept vertices. More...
 
index_t nb_facets ()
 Gets the number of coplanar facets. More...
 
void mark_facets (vector< index_t > &facet_is_marked)
 Marks the facets. More...
 

Public Attributes

ExactCDT2d CDT
 

Static Public Attributes

static constexpr index_t NON_MANIFOLD = index_t(-2)
 

Protected Member Functions

void find_coplanar_facets ()
 Finds all the pairs of coplanar facets. More...
 
bool triangles_are_coplanar (const ExactPoint &P1, const ExactPoint &P2, const ExactPoint &P3, const ExactPoint &P4) const
 Tests whether two adjacent triangles are coplanar. More...
 
bool edges_are_colinear (const ExactPoint &P1, const ExactPoint &P2, const ExactPoint &P3) const
 Tests whether two edges are co-linear. More...
 

Static Protected Member Functions

static coord_index_t triangle_normal_axis (const ExactPoint &p1, const ExactPoint &p2, const ExactPoint &p3)
 Gets the coordinate along which one can project a triangle without creating degeneracies. More...
 

Detailed Description

Detects and retriangulates a set of coplanar facets for MeshSurfaceIntersection.

Definition at line 492 of file mesh_surface_intersection_internal.h.

Constructor & Destructor Documentation

◆ CoplanarFacets()

GEO::CoplanarFacets::CoplanarFacets ( MeshSurfaceIntersection I,
bool  clear_attributes,
double  angle_tolerance = 0.0 
)

Constructs a CoplanarFacets object associated with a MeshSurfaceIntersection.

No set of facets is identified. One needs to call get().

Parameters
[in]Ia reference to the MeshSurfaceIntersection
[in]clear_attributesif set, resets facet_chart and keep_vertex
[in]angle_toleranceangle tolerance for detecting coplanar facets and colinear edges (in degrees)

Member Function Documentation

◆ edges_are_colinear()

bool GEO::CoplanarFacets::edges_are_colinear ( const ExactPoint P1,
const ExactPoint P2,
const ExactPoint P3 
) const
protected

Tests whether two edges are co-linear.

Parameters
[in]P1,P2,P3the vertices of the two edges
Return values
trueif [P1,P2] and [P2,P3] are co-linear, and P2 is between P1 and p3
falseotherwise

uses angle_tolerance specified to the constructor (if set to zero, uses exact computation)

◆ find_coplanar_facets()

void GEO::CoplanarFacets::find_coplanar_facets ( )
protected

Finds all the pairs of coplanar facets.

Initializes c_is_coplanar_[], a vector of booleans indexed by facet corners.

◆ get()

void GEO::CoplanarFacets::get ( index_t  f,
index_t  group_id 
)

Gets the set of coplanar facets from a given facet and group id.

Uses the "group" facets attribute. If f's group is uninitialized (NO_INDEX), determines the facets of the group geometrically and initializes the attribute, else gets the facets based on the attribute.

Parameters
[in]fthe facet
[in]group_idthe facet group id

◆ mark_facets()

void GEO::CoplanarFacets::mark_facets ( vector< index_t > &  facet_is_marked)
inline

Marks the facets.

Parameters
[out]facet_is_markedon exit, set to 1 for facets present in the list of coplanar facets. Needs to be of size mesh_.facets.nb().

Definition at line 623 of file mesh_surface_intersection_internal.h.

◆ mark_vertices_to_keep()

void GEO::CoplanarFacets::mark_vertices_to_keep ( )

Marks the vertices that need to be kept in the simplified facets.

A vertex is kept if it is incident to at least two non-colinear edges on the border. The status of the vertices is stored in the "keep" vertex attribute.

◆ nb_facets()

index_t GEO::CoplanarFacets::nb_facets ( )
inline

Gets the number of coplanar facets.

Returns
the number of coplanar facets present in the mesh

Definition at line 613 of file mesh_surface_intersection_internal.h.

◆ save_borders()

void GEO::CoplanarFacets::save_borders ( const std::string &  filename)

For debugging purposes, saves border edges to a file.

Parameters
[in]filenamethe file where to store the borders.

◆ save_facet_group()

void GEO::CoplanarFacets::save_facet_group ( const std::string &  filename)

For debugging purposes, saves all the facets of the group to a file.

Parameters
[in]filenamethe file where to store the facets of the group.

◆ triangle_normal_axis()

static coord_index_t GEO::CoplanarFacets::triangle_normal_axis ( const ExactPoint p1,
const ExactPoint p2,
const ExactPoint p3 
)
staticprotected

Gets the coordinate along which one can project a triangle without creating degeneracies.

Parameters
[in]p1,p2,p3the three vertices of the triangle, with exact homogeneous coordinates.
Returns
one of {0,1,2}

◆ triangles_are_coplanar()

bool GEO::CoplanarFacets::triangles_are_coplanar ( const ExactPoint P1,
const ExactPoint P2,
const ExactPoint P3,
const ExactPoint P4 
) const
protected

Tests whether two adjacent triangles are coplanar.

This is used to determine the facets that can be merged

Parameters
[in]P1,P2,P3,P4the vertices of the triangles, as points with exact homogeneous coordinates. The two triangles are P1, P2, P3 and P2, P1, P4
Return values
trueif the two triangles are coplanar
falseotherwise

uses angle_tolerance specified to the constructor (if set to zero, uses exact computation)

◆ triangulate()

void GEO::CoplanarFacets::triangulate ( )

Triangulates the kept vertices.

One can get the triangle through the (public) CDT member (ExactCDT2d).


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