Graphite Version 3
An experimental 3D geometry processing program
Loading...
Searching...
No Matches
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.
 
void get (index_t f, index_t group_id)
 Gets the set of coplanar facets from a given facet and group id.
 
void mark_vertices_to_keep ()
 Marks the vertices that need to be kept in the simplified facets.
 
void save_borders (const std::string &filename)
 For debugging purposes, saves border edges to a file.
 
void save_facet_group (const std::string &filename)
 For debugging purposes, saves all the facets of the group to a file.
 
void triangulate ()
 Triangulates the kept vertices.
 
index_t nb_facets ()
 Gets the number of coplanar facets.
 
void mark_facets (vector< index_t > &facet_is_marked)
 Marks the facets.
 

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.
 
bool triangles_are_coplanar (const vec3 &p1, const vec3 &p2, const vec3 &p3, const vec3 &q1, const vec3 &q2, const vec3 &q3) const
 Tests whether two triangles are coplanar.
 
bool edges_are_colinear (const ExactPoint &P1, const ExactPoint &P2, const ExactPoint &P3) const
 Tests whether two edges are co-linear.
 

Detailed Description

Detects and retriangulates a set of coplanar facets for MeshSurfaceIntersection.

Definition at line 493 of file mesh_surface_intersection_internal.h.

Member Typedef Documentation

◆ ExactPoint

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 613 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 603 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.

◆ triangles_are_coplanar()

bool GEO::CoplanarFacets::triangles_are_coplanar ( const vec3 p1,
const vec3 p2,
const vec3 p3,
const vec3 q1,
const vec3 q2,
const vec3 q3 
) const
protected

Tests whether two triangles are coplanar.

This is used to determine the facets that can be merged

Parameters
[in]p1,p2,p3the vertices of the first triangle
[in]q1,q2,q3the vertices of the second triangle
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).

Member Data Documentation

◆ CDT

ExactCDT2d GEO::CoplanarFacets::CDT

Definition at line 597 of file mesh_surface_intersection_internal.h.

◆ NON_MANIFOLD

constexpr index_t GEO::CoplanarFacets::NON_MANIFOLD = index_t(-2)
staticconstexpr

Definition at line 495 of file mesh_surface_intersection_internal.h.


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