Geogram  Version 1.9.1
A programming library of geometric algorithms
GEO::CSGMesh Class Reference

A Mesh with reference counting and bounding box. More...

#include <geogram/mesh/mesh_CSG.h>

Inheritance diagram for GEO::CSGMesh:
GEO::Mesh GEO::Counted

Public Member Functions

const Box3dbbox () const
 Gets the bounding box. More...
 
bool bbox_initialized () const
 Tests whether the bounding box was initialized. More...
 
void update_bbox ()
 Computes the bounding box. More...
 
void append_mesh (const CSGMesh *other, index_t operand=index_t(-1))
 Appends a mesh to this mesh. More...
 
bool may_have_intersections_with (const CSGMesh *other) const
 Tests whether this mesh may have an intersection with another mesh. More...
 
- Public Member Functions inherited from GEO::Mesh
 Mesh (index_t dimension=3, bool single_precision=false)
 Mesh constructor. More...
 
virtual ~Mesh ()
 Mesh destructor.
 
void clear (bool keep_attributes=true, bool keep_memory=false)
 Removes all the elements and attributes of this mesh. More...
 
void show_stats (const std::string &tag="Mesh") const
 Displays number of vertices, facets and borders.
 
void assert_is_valid ()
 Does some validity checks. More...
 
void copy (const Mesh &rhs, bool copy_attributes=true, MeshElementsFlags what=MESH_ALL_ELEMENTS)
 Copies a mesh onto this one. More...
 
std::string get_attributes () const
 Gets the list of all attributes. More...
 
std::string get_scalar_attributes () const
 Gets the list of all scalar attributes. More...
 
std::string get_vector_attributes (index_t max_dim=0) const
 Gets the list of all vector attributes. More...
 
index_t nb_subelements_types () const
 Gets the number of subelements types. More...
 
MeshSubElementsStoreget_subelements_by_index (index_t i)
 Gets a MeshSubElementsStore by index. More...
 
const MeshSubElementsStoreget_subelements_by_index (index_t i) const
 Gets a MeshSubElementsStore by index. More...
 
MeshSubElementsStoreget_subelements_by_type (MeshElementsFlags what)
 Gets a MeshSubElementsStore by subelements type. More...
 
const MeshSubElementsStoreget_subelements_by_type (MeshElementsFlags what) const
 Gets a MeshSubElementsStore by subelements type. More...
 
- Public Member Functions inherited from GEO::Counted
void ref () const
 Increments the reference count. More...
 
void unref () const
 Decrements the reference count. More...
 
bool is_shared () const
 Check if the object is shared. More...
 
int nb_refs () const
 Gets the number of references that point to this object. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from GEO::Mesh
static std::string subelements_type_to_name (MeshElementsFlags what)
 Gets a subelement name by subelement type. More...
 
static MeshElementsFlags name_to_subelements_type (const std::string &name)
 Gets a subelement type by subelement name. More...
 
static bool parse_attribute_name (const std::string &full_attribute_name, MeshElementsFlags &where, std::string &attribute_name, index_t &component)
 Extracts localisation, name and optional component from an attribute name. More...
 
- Static Public Member Functions inherited from GEO::Counted
static void ref (const Counted *counted)
 Increments the reference count. More...
 
static void unref (const Counted *counted)
 Decrements the reference count. More...
 
- Public Attributes inherited from GEO::Mesh
MeshVertices vertices
 
MeshEdges edges
 
MeshFacets facets
 
MeshFacetCornersStore facet_corners
 
MeshCells cells
 
MeshCellCornersStore cell_corners
 
MeshCellFacetsStore cell_facets
 
- Protected Member Functions inherited from GEO::Mesh
void display_attributes (const std::string &tag, const std::string &subelement_name, const MeshSubElementsStore &subelements) const
 Displays the list of attributes to the Logger. More...
 
- Protected Member Functions inherited from GEO::Counted
 Counted ()
 Creates a reference counted object. More...
 
virtual ~Counted ()
 Destroys a reference counted object. More...
 
 Indicates the mesh elements (vertices, facets or cells) present in a mesh. More...

Detailed Description

A Mesh with reference counting and bounding box.

Definition at line 61 of file mesh_CSG.h.

Member Function Documentation

◆ append_mesh()

void GEO::CSGMesh::append_mesh ( const CSGMesh other,
index_t  operand = index_t(-1) 
)

Appends a mesh to this mesh.

Parameters
[in]othera const pointer to the mesh to be appended
[in]operandan optional operand id, or index_t(-1) if not setting operand_bit attribute

Copies all the vertices and the facets of other

◆ bbox()

const Box3d& GEO::CSGMesh::bbox ( ) const
inline

Gets the bounding box.

Returns
a const reference to the bounding box, as a a Box3d. If it is a 2d mesh, then z bounds are set to 0

Definition at line 70 of file mesh_CSG.h.

◆ bbox_initialized()

bool GEO::CSGMesh::bbox_initialized ( ) const

Tests whether the bounding box was initialized.

Used for debugging purposes, for instance, to detect that the bounding box of a mesh was not properly updated

Return values
trueif the bounding box was not changed since construction
falseotherwise

◆ may_have_intersections_with()

bool GEO::CSGMesh::may_have_intersections_with ( const CSGMesh other) const
inline

Tests whether this mesh may have an intersection with another mesh.

Tests the bounding boxes for intersection. To be used as a filter before calling the (costly) intersection algorithm.

Parameters
[in]othera const pointer to the other mesh to be tested
Return values
falseif there is no intersection with other
trueif there is possibly an intersection, but there may be false positives

Definition at line 110 of file mesh_CSG.h.

◆ update_bbox()

void GEO::CSGMesh::update_bbox ( )

Computes the bounding box.

This function needs to be called each time the mesh is modified


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