Geogram  Version 1.9.1-rc
A programming library of geometric algorithms
GLUP::MarchingCell Class Reference

Implements the MarchingCells algorithm. More...

#include <geogram_gfx/GLUP/GLUP_marching_cells.h>

Public Member Functions

 MarchingCell (GLUPprimitive prim)
 MarchingCell constructor. More...
 
 ~MarchingCell ()
 MarchingCell destructor.
 
index_t nb_vertices () const
 Gets the number of vertices. More...
 
index_t nb_edges () const
 Gets the number of edges. More...
 
index_t nb_configs () const
 Gets the number of configurations. More...
 
index_t edge_vertex (index_t e, index_t lv) const
 Gets a vertex by edge index and local vertex index. More...
 
index_t config_size (index_t config) const
 Gets the number of intersected edges in a configuration. More...
 
index_t max_config_size () const
 Gets the maximum configuration size. More...
 
const index_tconfig_edges (index_t config) const
 Gets the list of intersected edges in a configuration. More...
 
const char * GLSL_uniform_state_declaration () const
 Gets the GLSL declaration of marching cell uniform state. More...
 
const char * GLSL_compute_intersections () const
 Gets the GLSL declaration of the function that computes the intersections. More...
 
GLuint uniform_binding_point () const
 Gets the binding point of the uniform buffer that contains the tables for the marching cell. More...
 
GLuint create_UBO ()
 Creates a Uniform Buffer Object that contains the tables for the marching cell. More...
 
GLuint create_elements_VBO ()
 Creates a Vertex Buffer Object with the indices for all configurations. More...
 
void bind_uniform_state (GLuint program)
 Binds the uniform state marching cell variables to a given program.
 

Protected Member Functions

void compute_config (index_t config)
 Computes the intersection polygon for a configuration. More...
 
void move_to_next (index_t &f, index_t &lv)
 Moves from a given halfedge to the next halfege. More...
 
index_t origin_vertex (index_t f, index_t lv)
 Gets the origin vertex of a halfedge. More...
 
index_t destination_vertex (index_t f, index_t lv)
 Gets the destination vertex of a halfedge. More...
 
index_t edge (index_t f, index_t lv)
 Gets the edge index that corresponds to a given halfedge. More...
 
void move_to_opposite (index_t &f, index_t &lv)
 Moves from a given halfedge to the opposite halfege. More...
 
bool edge_is_intersected (index_t f, index_t lv, index_t config)
 Tests whether a given edge is intersected. More...
 
bool config_is_ambiguous (index_t config)
 Tests whether a vertex configuration bitcode is ambiguous. More...
 
bool get_first_edge (index_t &f, index_t &lv, index_t config)
 Gets the first intersected halfedge given a vertex configuration. More...
 

Detailed Description

Implements the MarchingCells algorithm.

MarchingCell compute the intersection between a cell and a plane, using only combinatorial information. It uses the static tables from the Mesh class, so that cell numberings are coherent between storage and graphics.

Definition at line 66 of file GLUP_marching_cells.h.

Constructor & Destructor Documentation

◆ MarchingCell()

GLUP::MarchingCell::MarchingCell ( GLUPprimitive  prim)

MarchingCell constructor.

Parameters
[in]primthe GLUP volumetric primitive, should be one of GLUP_TETRAHEDRA, GLUP_HEXAHEDRA, GLUP_PRISMS, GLUP_PYRAMIDS.

Member Function Documentation

◆ compute_config()

void GLUP::MarchingCell::compute_config ( index_t  config)
protected

Computes the intersection polygon for a configuration.

Parameters
[in]configthe vertex configuration bitcode. The bit corresponding to vertex v is set if v is on the positive side of the intersection plane.

◆ config_edges()

const index_t* GLUP::MarchingCell::config_edges ( index_t  config) const
inline

Gets the list of intersected edges in a configuration.

Parameters
[in]configthe vertex configuration bitcode. The bit corresponding to vertex v is set if v is on the positive side of the intersection plane.
Returns
a pointer to the array of edge indices that correspond to this configuration, of size config_size()

Definition at line 146 of file GLUP_marching_cells.h.

◆ config_is_ambiguous()

bool GLUP::MarchingCell::config_is_ambiguous ( index_t  config)
protected

Tests whether a vertex configuration bitcode is ambiguous.

A configuration is ambiguous if it results in several intersection polygons.

Parameters
[in]configthe vertex configuration bitcode. The bit corresponding to vertex v is set if v is on the positive side of the intersection plane.
Return values
trueif the configuration is ambiguous
falseotherwise

◆ config_size()

index_t GLUP::MarchingCell::config_size ( index_t  config) const
inline

Gets the number of intersected edges in a configuration.

Parameters
[in]configthe vertex configuration bitcode. The bit corresponding to vertex v is set if v is on the positive side of the intersection plane.
Returns
the number of intersected edges in configuration config

Definition at line 125 of file GLUP_marching_cells.h.

◆ create_elements_VBO()

GLuint GLUP::MarchingCell::create_elements_VBO ( )

Creates a Vertex Buffer Object with the indices for all configurations.

Used by GLUPES2 that does not support UBOs. This MarchingCells keeps ownership of the created VBO (it is destroyed by the destructor of this MarchingCells).

Note
NOT USED YET.

◆ create_UBO()

GLuint GLUP::MarchingCell::create_UBO ( )

Creates a Uniform Buffer Object that contains the tables for the marching cell.

Used by GLUP150 and GLUP440 profiles that support UBOs. This MarchingCells keeps ownership of the created UBO (it is destroyed by the destructor of this MarchingCells).

◆ destination_vertex()

index_t GLUP::MarchingCell::destination_vertex ( index_t  f,
index_t  lv 
)
inlineprotected

Gets the destination vertex of a halfedge.

The halfedge is refered to as a facet index and a local vertex index within the facet.

Parameters
[in]fthe index of the facet
[in]lvthe local index of the vertex in the facet.
Returns
the index of the destination vertex of the halfedge

Definition at line 245 of file GLUP_marching_cells.h.

◆ edge()

index_t GLUP::MarchingCell::edge ( index_t  f,
index_t  lv 
)
inlineprotected

Gets the edge index that corresponds to a given halfedge.

The halfedge is refered to as a facet index and a local vertex index within the facet.

Parameters
[in]fthe index of the facet
[in]lvthe local index of the vertex in the facet.
Returns
the index of the edge.

Definition at line 258 of file GLUP_marching_cells.h.

◆ edge_is_intersected()

bool GLUP::MarchingCell::edge_is_intersected ( index_t  f,
index_t  lv,
index_t  config 
)
inlineprotected

Tests whether a given edge is intersected.

The halfedge is refered to as a facet index and a local vertex index within the facet.

Parameters
[in]fthe index of the facet
[in]lvthe local index of the vertex in the facet.
[in]configthe vertex configuration bitcode. The bit corresponding to vertex v is set if v is on the positive side of the intersection plane.
Return values
trueif the edge is intersected
falseotherwise

Definition at line 287 of file GLUP_marching_cells.h.

◆ edge_vertex()

index_t GLUP::MarchingCell::edge_vertex ( index_t  e,
index_t  lv 
) const
inline

Gets a vertex by edge index and local vertex index.

Parameters
[in]ethe index of the edge
[in]lvthe local vertex index in the edge, one of 0,1
Returns
the vertex index

Definition at line 112 of file GLUP_marching_cells.h.

◆ get_first_edge()

bool GLUP::MarchingCell::get_first_edge ( index_t f,
index_t lv,
index_t  config 
)
protected

Gets the first intersected halfedge given a vertex configuration.

Parameters
[out]fthe facet of the first intersected halfedge
[out]lvthe local vertex index of the first intersected halfedge
[in]configthe vertex configuration bitcode. The bit corresponding to vertex v is set if v is on the positive side of the intersection plane.
Return values
trueif there was an intersection
falseotherwise

◆ GLSL_compute_intersections()

const char* GLUP::MarchingCell::GLSL_compute_intersections ( ) const
inline

Gets the GLSL declaration of the function that computes the intersections.

Returns
a pointer to GLSL source code.

Definition at line 165 of file GLUP_marching_cells.h.

◆ GLSL_uniform_state_declaration()

const char* GLUP::MarchingCell::GLSL_uniform_state_declaration ( ) const
inline

Gets the GLSL declaration of marching cell uniform state.

Returns
a pointer to GLSL source code that declares this marching cell's uniform state.

Definition at line 156 of file GLUP_marching_cells.h.

◆ max_config_size()

index_t GLUP::MarchingCell::max_config_size ( ) const
inline

Gets the maximum configuration size.

Returns
the largest number of vertices in an intersection polygon

Definition at line 134 of file GLUP_marching_cells.h.

◆ move_to_next()

void GLUP::MarchingCell::move_to_next ( index_t f,
index_t lv 
)
inlineprotected

Moves from a given halfedge to the next halfege.

The halfedge is refered to as a facet index and a local vertex index within the facet.

Parameters
[in,out]fthe index of the facet
[in,out]lvthe local index of the vertex in the facet.

Definition at line 221 of file GLUP_marching_cells.h.

◆ move_to_opposite()

void GLUP::MarchingCell::move_to_opposite ( index_t f,
index_t lv 
)
protected

Moves from a given halfedge to the opposite halfege.

The halfedge is refered to as a facet index and a local vertex index within the facet.

Parameters
[in,out]fthe index of the facet
[in,out]lvthe local index of the vertex in the facet.

◆ nb_configs()

index_t GLUP::MarchingCell::nb_configs ( ) const
inline

Gets the number of configurations.

Returns
the number of configurations

Definition at line 102 of file GLUP_marching_cells.h.

◆ nb_edges()

index_t GLUP::MarchingCell::nb_edges ( ) const
inline

Gets the number of edges.

Returns
the number of edges in a cell

Definition at line 93 of file GLUP_marching_cells.h.

◆ nb_vertices()

index_t GLUP::MarchingCell::nb_vertices ( ) const
inline

Gets the number of vertices.

Returns
the number of vertices in a cell

Definition at line 85 of file GLUP_marching_cells.h.

◆ origin_vertex()

index_t GLUP::MarchingCell::origin_vertex ( index_t  f,
index_t  lv 
)
inlineprotected

Gets the origin vertex of a halfedge.

The halfedge is refered to as a facet index and a local vertex index within the facet.

Parameters
[in]fthe index of the facet
[in]lvthe local index of the vertex in the facet.
Returns
the index of the origin vertex of the halfedge

Definition at line 233 of file GLUP_marching_cells.h.

◆ uniform_binding_point()

GLuint GLUP::MarchingCell::uniform_binding_point ( ) const
inline

Gets the binding point of the uniform buffer that contains the tables for the marching cell.

Returns
the uniform binding point

Definition at line 175 of file GLUP_marching_cells.h.


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