Geogram  Version 1.9.1-rc
A programming library of geometric algorithms
convex_cell.h File Reference

Class to compute the intersection of a set of half-spaces in 3D. More...

#include <geogram/basic/common.h>
#include <geogram/basic/memory.h>
#include <geogram/basic/numeric.h>
#include <geogram/basic/geometry.h>
#include <geogram/basic/attributes.h>
#include <string>
#include <vector>
#include <iostream>
#include <cmath>
#include <cassert>

Go to the source code of this file.

Classes

struct  VBW::Triangle
 A triangle with the local indices of its three vertices. More...
 
struct  VBW::TriangleWithFlags
 A triangle with flags. More...
 
class  VBW::ConvexCell
 Computes the intersection between a set of halfplanes using Bowyer-Watson algorithm. More...
 

Namespaces

 GEO
 Global Vorpaline namespace.
 

Macros

#define vbw_assert(x)   geo_debug_assert(x)
 

Typedefs

typedef unsigned int VBW::index_t
 
typedef GEO::index_t VBW::global_index_t
 
typedef unsigned char VBW::uchar
 Type for flags.
 
typedef unsigned short VBW::ushort
 Type for local indices. More...
 
typedef index_t VBW::ConvexCellFlags
 

Enumerations

enum  { VBW::CONFLICT_MASK = 32768 , VBW::MARKED_MASK = 16384 , VBW::END_OF_LIST = 16383 , VBW::VERTEX_AT_INFINITY = 0 }
 Some constants for the flags in TriangleWithFlags. More...
 
enum  VBW::ConvexCellFlag { VBW::None = 0 , VBW::WithVGlobal = 1 , VBW::WithTFlags = 2 }
 

Functions

vec2 VBW::make_vec2 (double x, double y)
 Creates a vec2 from its components. More...
 
vec3 VBW::make_vec3 (double x, double y, double z)
 Creates a vec3 from its components. More...
 
vec3 VBW::cross (vec3 v1, vec3 v2)
 Computes the cross product between two vectors. More...
 
double VBW::dot (vec3 v1, vec3 v2)
 Computes the dot product between two vectors. More...
 
double VBW::squared_length (vec3 v)
 Computes the squared length of a vector. More...
 
double VBW::squared_distance (vec3 v, vec3 w)
 Computes the squared distance between two points. More...
 
double VBW::length (vec3 v)
 Computes the length of a vector. More...
 
vec3 VBW::normalize (vec3 v)
 Computes a normalized vector. More...
 
vec4 VBW::make_vec4 (double x, double y, double z, double w)
 Creates a vec4 from its components. More...
 
double VBW::dot (vec4 v1, vec4 v2)
 Computes the dot product between two vectors. More...
 
double VBW::squared_length (vec4 v)
 Computes the squared length of a vector. More...
 
double VBW::length (vec4 v)
 Computes the length of a vector. More...
 
double VBW::squared_point_plane_distance (VBW::vec3 p, VBW::vec4 P)
 Computes the squared distance between a point and a plane. More...
 
Triangle VBW::make_triangle (ushort i, ushort j, ushort k)
 Creates a triangle from its three vertices. More...
 
TriangleWithFlags VBW::make_triangle_with_flags (ushort i, ushort j, ushort k, ushort f)
 
double VBW::det2x2 (double a11, double a12, double a21, double a22)
 
double VBW::det3x3 (double a11, double a12, double a13, double a21, double a22, double a23, double a31, double a32, double a33)
 
double VBW::det4x4 (double a11, double a12, double a13, double a14, double a21, double a22, double a23, double a24, double a31, double a32, double a33, double a34, double a41, double a42, double a43, double a44)
 

Detailed Description

Class to compute the intersection of a set of half-spaces in 3D.

Has its own types for points and vectors because it can be used independently from Geogram. In that case, define STANDALONE_CONVEX_CELL

Definition in file convex_cell.h.

Typedef Documentation

◆ ushort

typedef unsigned short VBW::ushort

Type for local indices.

Valid values are between 0 and 32766. Full range is not used due to bookkeeping reasons,

See also
TriangleWithFlags.

Definition at line 303 of file convex_cell.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Some constants for the flags in TriangleWithFlags.

See also
TriangleWithFlags.
Enumerator
CONFLICT_MASK 

The mask for conflict triangles.

MARKED_MASK 

The mask for marked triangles.

END_OF_LIST 

Constant to indicate end of list.

VERTEX_AT_INFINITY 

Vertex at infinity.

Definition at line 284 of file convex_cell.h.

◆ ConvexCellFlag

Enumerator
None 

default

WithVGlobal 

store global vertex indices

WithTFlags 

store user triange flags

Definition at line 406 of file convex_cell.h.

Function Documentation

◆ cross()

vec3 VBW::cross ( vec3  v1,
vec3  v2 
)
inline

Computes the cross product between two vectors.

Parameters
[in]v1,v2the two vectors.
Returns
the cross product between v1 and v2.

Definition at line 151 of file convex_cell.h.

◆ dot() [1/2]

double VBW::dot ( vec3  v1,
vec3  v2 
)
inline

Computes the dot product between two vectors.

Parameters
[in]v1,v2the two vectors.
Returns
the dot product between v1 and v2.

Definition at line 166 of file convex_cell.h.

◆ dot() [2/2]

double VBW::dot ( vec4  v1,
vec4  v2 
)
inline

Computes the dot product between two vectors.

Parameters
[in]v1,v2the two vectors.
Returns
the dot product between v1 and v2.

Definition at line 239 of file convex_cell.h.

◆ length() [1/2]

double VBW::length ( vec3  v)
inline

Computes the length of a vector.

Parameters
[in]vthe vector.
Returns
the length of v.

Definition at line 198 of file convex_cell.h.

◆ length() [2/2]

double VBW::length ( vec4  v)
inline

Computes the length of a vector.

Parameters
[in]vthe vector.
Returns
the length of v.

Definition at line 263 of file convex_cell.h.

◆ make_triangle()

Triangle VBW::make_triangle ( ushort  i,
ushort  j,
ushort  k 
)
inline

Creates a triangle from its three vertices.

Parameters
[in]i,j,kthe local indices of the three vertices.
Returns
The created triangle.

Definition at line 329 of file convex_cell.h.

◆ make_vec2()

vec2 VBW::make_vec2 ( double  x,
double  y 
)
inline

Creates a vec2 from its components.

Parameters
[in]x,ythe components of the vector.
Returns
the created vector.

Definition at line 117 of file convex_cell.h.

◆ make_vec3()

vec3 VBW::make_vec3 ( double  x,
double  y,
double  z 
)
inline

Creates a vec3 from its components.

Parameters
[in]x,y,zthe components of the vector.
Returns
the created vector.

Definition at line 133 of file convex_cell.h.

◆ make_vec4()

vec4 VBW::make_vec4 ( double  x,
double  y,
double  z,
double  w 
)
inline

Creates a vec4 from its components.

Parameters
[in]x,y,z,wthe components of the vector.
Returns
the created vector.

Definition at line 221 of file convex_cell.h.

◆ normalize()

vec3 VBW::normalize ( vec3  v)
inline

Computes a normalized vector.

Parameters
[in]vthe vector.
Returns
a vector with the same direction as \v and unit length.

Definition at line 208 of file convex_cell.h.

◆ squared_distance()

double VBW::squared_distance ( vec3  v,
vec3  w 
)
inline

Computes the squared distance between two points.

Parameters
[in]v,wthe two points.
Returns
the squared distance between v and w.

Definition at line 186 of file convex_cell.h.

◆ squared_length() [1/2]

double VBW::squared_length ( vec3  v)
inline

Computes the squared length of a vector.

Parameters
[in]vthe vector.
Returns
the squared length of v.

Definition at line 177 of file convex_cell.h.

◆ squared_length() [2/2]

double VBW::squared_length ( vec4  v)
inline

Computes the squared length of a vector.

Parameters
[in]vthe vector.
Returns
the squared length of v.

Definition at line 251 of file convex_cell.h.

◆ squared_point_plane_distance()

double VBW::squared_point_plane_distance ( VBW::vec3  p,
VBW::vec4  P 
)
inline

Computes the squared distance between a point and a plane.

Parameters
[in]pthe point
[in]Pthe plane equation
Returns
the squared distance between p and P

Definition at line 273 of file convex_cell.h.