Antkeeper  0.0.1
Namespaces | Classes | Typedefs | Enumerations | Functions
geom Namespace Reference

Geometric algorithms. More...

Namespaces

 mc
 Marching cubes (MC) algorithm functions and constants.
 
 primitives
 
 sdf
 Signed distance functions.
 
 solid_angle
 Solid angle functions.
 

Classes

class  brep_attribute_map
 Maps names to B-rep attributes. More...
 
class  brep_attribute_base
 Abstract base class for B-rep element attributes. More...
 
class  brep_attribute
 Per-element B-rep data. More...
 
class  brep_element_container
 Container for B-rep elements. More...
 
class  brep_edge_loop_list
 List of B-rep loops that share a common edge. More...
 
class  brep_edge
 Curve segment bounded by two vertices. More...
 
class  brep_edge_container
 B-rep edge container. More...
 
class  brep_face_loop_list
 List of B-rep loops that bound a common face. More...
 
class  brep_face
 Portion of a shell bounded by loops. More...
 
class  brep_face_container
 B-rep face container. More...
 
class  brep_loop
 Connected boundary of a single face. More...
 
class  brep_loop_container
 B-rep loop container. More...
 
class  brep_mesh
 Boundary representation (B-rep) of a mesh. More...
 
class  brep_vertex_edge_list
 List of B-rep edges bounded by a common vertex. More...
 
class  brep_vertex
 A point in space. More...
 
class  brep_vertex_container
 B-rep vertex container. More...
 
struct  bvh_node
 Single node in a bounding volume hierarchy. More...
 
struct  bvh_primitive
 BVH primitive. More...
 
class  bvh
 Bounding volume hierarchy (BVH). More...
 
class  hyperoctree
 Hashed linear hyperoctree. More...
 
struct  rect_pack_node
 Node used in 2D rectangle packing. More...
 
class  rect_pack
 Packs 2D rectangles. More...
 

Typedefs

template<std::unsigned_integral T, std::size_t N>
using unordered_hyperoctree = hyperoctree< T, N, hyperoctree_order::unordered >
 Hyperoctree with unordered node storage and traversal. More...
 
template<std::unsigned_integral T, hyperoctree_order Order>
using octree = hyperoctree< T, 3, Order >
 An octree, or 3-dimensional hyperoctree. More...
 
template<hyperoctree_order Order>
using octree8 = octree< std::uint8_t, Order >
 Octree with an 8-bit node type (2 depth levels). More...
 
template<hyperoctree_order Order>
using octree16 = octree< std::uint16_t, Order >
 Octree with a 16-bit node type (4 depth levels). More...
 
template<hyperoctree_order Order>
using octree32 = octree< std::uint32_t, Order >
 Octree with a 32-bit node type (9 depth levels). More...
 
template<hyperoctree_order Order>
using octree64 = octree< std::uint64_t, Order >
 Octree with a 64-bit node type (19 depth levels). More...
 
template<std::unsigned_integral T>
using unordered_octree = octree< T, hyperoctree_order::unordered >
 Octree with unordered node storage and traversal. More...
 
typedef unordered_octree< std::uint8_t > unordered_octree8
 Unordered octree with an 8-bit node type (2 depth levels). More...
 
typedef unordered_octree< std::uint16_t > unordered_octree16
 Unordered octree with a 16-bit node type (4 depth levels). More...
 
typedef unordered_octree< std::uint32_t > unordered_octree32
 Unordered octree with a 32-bit node type (9 depth levels). More...
 
typedef unordered_octree< std::uint64_t > unordered_octree64
 Unordered octree with a 64-bit node type (19 depth levels). More...
 
template<std::unsigned_integral T, hyperoctree_order Order>
using quadtree = hyperoctree< T, 2, Order >
 A quadtree, or 2-dimensional hyperoctree. More...
 
template<hyperoctree_order Order>
using quadtree8 = quadtree< std::uint8_t, Order >
 Quadtree with an 8-bit node type (2 depth levels). More...
 
template<hyperoctree_order Order>
using quadtree16 = quadtree< std::uint16_t, Order >
 Quadtree with a 16-bit node type (6 depth levels). More...
 
template<hyperoctree_order Order>
using quadtree32 = quadtree< std::uint32_t, Order >
 Quadtree with a 32-bit node type (13 depth levels). More...
 
template<hyperoctree_order Order>
using quadtree64 = quadtree< std::uint64_t, Order >
 Quadtree with a 64-bit node type (29 depth levels). More...
 
template<std::unsigned_integral T>
using unordered_quadtree = quadtree< T, hyperoctree_order::unordered >
 Quadtree with unordered node storage and traversal. More...
 
typedef unordered_quadtree< std::uint8_t > unordered_quadtree8
 Unordered quadtree with an 8-bit node type (2 depth levels). More...
 
typedef unordered_quadtree< std::uint16_t > unordered_quadtree16
 Unordered quadtree with a 16-bit node type (6 depth levels). More...
 
typedef unordered_quadtree< std::uint32_t > unordered_quadtree32
 Unordered quadtree with a 32-bit node type (13 depth levels). More...
 
typedef unordered_quadtree< std::uint64_t > unordered_quadtree64
 Unordered quadtree with a 64-bit node type (29 depth levels). More...
 

Enumerations

enum class  triangle_region : std::uint8_t {
  abc = 0b000 , ab = 0b100 , bc = 0b001 , ca = 0b010 ,
  a = 0b110 , b = 0b101 , c = 0b011
}
 Voronoi regions of a triangle. More...
 
enum class  hyperoctree_order { unordered , dfs_pre , bfs }
 Orders in which hyperoctree nodes can be stored and traversed. More...
 

Functions

void generate_face_normals (brep_mesh &mesh)
 Generates the math::fvec3 face attribute "normal" for a B-rep mesh. More...
 
void generate_vertex_normals (brep_mesh &mesh)
 Generates the math::fvec3 vertex attribute "normal" for a B-rep mesh. More...
 
void generate_loop_barycentric (brep_mesh &mesh)
 Generates the math::fvec3 loop attribute "barycentric" for a B-rep mesh. More...
 
std::unique_ptr< render::modelgenerate_model (const brep_mesh &mesh, std::shared_ptr< render::material > material=nullptr)
 Generates a model from a B-rep mesh. More...
 
template<class T , std::size_t N>
constexpr point< T, N > closest_point (const ray< T, N > &a, const point< T, N > &b) noexcept
 Calculates the closest point on a ray to a point. More...
 
template<class T , std::size_t N>
constexpr point< T, N > closest_point (const line_segment< T, N > &ab, const point< T, N > &c) noexcept
 Calculates the closest point on a line segment to a point. More...
 
template<class T , std::size_t N>
constexpr std::tuple< point< T, N >, point< T, N > > closest_point (const line_segment< T, N > &ab, const line_segment< T, N > &cd) noexcept
 Calculates the closest points on two line segments. More...
 
template<class T , std::size_t N>
constexpr point< T, N > closest_point (const hyperplane< T, N > &a, const point< T, N > &b) noexcept
 Calculates the closest point on a hyperplane to a point. More...
 
template<class T , std::size_t N>
point< T, N > closest_point (const hypersphere< T, N > &a, const point< T, N > &b)
 Calculates the closest point on or in a hypersphere to a point. More...
 
template<class T , std::size_t N>
point< T, N > closest_point (const hypercapsule< T, N > &a, const point< T, N > &b)
 Calculates the closest point on or in a hypercapsule to a point. More...
 
template<class T , std::size_t N>
constexpr point< T, N > closest_point (const hyperrectangle< T, N > &a, const point< T, N > &b) noexcept
 Calculates the closest point on or in a hyperrectangle to a point. More...
 
constexpr bool is_face_region (triangle_region region) noexcept
 Checks whether a triangle voronoi region is a face region. More...
 
constexpr bool is_edge_region (triangle_region region) noexcept
 Checks whether a triangle voronoi region is an edge region. More...
 
constexpr bool is_vertex_region (triangle_region region) noexcept
 Checks whether a triangle voronoi region is a vertex region. More...
 
constexpr std::uint8_t edge_index (triangle_region region) noexcept
 Returns the edge index of an edge region. More...
 
constexpr std::uint8_t vertex_index (triangle_region region) noexcept
 Returns the vertex index of a vertex region. More...
 
template<class T >
constexpr triangle_region barycentric_to_region (const point< T, 3 > &p) noexcept
 Classifies barycentric coordinates according to their Voronoi region. More...
 
template<class T >
constexpr point< T, 3 > barycentric_to_cartesian (const point< T, 3 > &p, const point< T, 3 > &a, const point< T, 3 > &b, const point< T, 3 > &c) noexcept
 Converts Cartesian coordinates to barycentric coordinates. More...
 
template<class T >
constexpr point< T, 3 > cartesian_to_barycentric (const point< T, 3 > &p, const point< T, 3 > &a, const point< T, 3 > &b, const point< T, 3 > &c) noexcept
 Converts Cartesian coordinates to barycentric coordinates. More...
 
template<class T >
point< T, 3 > cartesian_to_spherical (const point< T, 3 > &p)
 Converts Cartesian (rectangular) coordinates to spherical coordinates. More...
 
template<class T >
point< T, 3 > spherical_to_cartesian (const point< T, 3 > &p)
 Converts spherical coordinates to Cartesian (rectangular) coordinates. More...
 
template<class T , std::size_t N>
std::optional< std::tuple< T, T > > intersection (const ray< T, N > &ray, const hypersphere< T, N > &hypersphere) noexcept
 Ray-hypersphere intersection test. More...
 
template<class T , std::size_t N>
constexpr bool intersection (const hyperrectangle< T, N > &a, const hyperrectangle< T, N > &b) noexcept
 Hyperrectangle-hyperrectangle intersection test. More...
 
template<class T , std::size_t N>
constexpr bool intersection (const hypersphere< T, N > &a, const hypersphere< T, N > &b) noexcept
 Hypersphere-hypersphere intersection test. More...
 
template<std::unsigned_integral T>
constexpr T morton_encode (T x, T y) noexcept
 Encodes 2D coordinates as a Morton location code. More...
 
template<std::unsigned_integral T>
constexpr T morton_encode (T x, T y, T z) noexcept
 Encodes 3D coordinates as a Morton location code. More...
 
template<std::unsigned_integral T>
void morton_decode (T code, T &x, T &y) noexcept
 Decodes 2D coordinates from a Morton location code. More...
 
template<std::unsigned_integral T>
void morton_decode (T code, T &x, T &y, T &z) noexcept
 Decodes 3D coordinates from a Morton location code. More...
 
template<class T >
math::vec3< T > project_on_plane (const math::vec3< T > &v, const math::vec3< T > &p, const math::vec3< T > &n)
 
template<class T >
constexpr std::tuple< point< T, 3 >, triangle_regionclosest_point (const point< T, 3 > &a, const point< T, 3 > &b, const point< T, 3 > &c, const point< T, 3 > &p) noexcept
 Calculates the closest point on a triangle to a point. More...
 
template<class T >
constexpr std::tuple< point< T, 3 >, triangle_regionclosest_point (const triangle< T, 3 > &tri, const point< T, 3 > &p) noexcept
 Calculates the closest point on a triangle to a point. More...
 
template<class T , std::size_t N>
constexpr std::optional< T > intersection (const ray< T, N > &ray, const hyperplane< T, N > &hyperplane) noexcept
 Ray-hyperplane intersection test. More...
 
template<class T , std::size_t N>
constexpr std::optional< T > intersection (const hyperplane< T, N > &hyperplane, const ray< T, N > &ray) noexcept
 Ray-hyperplane intersection test. More...
 
template<class T , std::size_t N>
constexpr std::optional< std::tuple< T, T > > intersection (const ray< T, N > &ray, const hyperrectangle< T, N > &hyperrectangle) noexcept
 Ray-hyperrectangle intersection test. More...
 
template<class T , std::size_t N>
constexpr std::optional< std::tuple< T, T > > intersection (const hyperrectangle< T, N > &hyperrectangle, const ray< T, N > &ray) noexcept
 Ray-hyperrectangle intersection test. More...
 
template<class T >
constexpr std::optional< std::tuple< T, T, T > > intersection (const ray< T, 3 > &ray, const math::vec3< T > &a, const math::vec3< T > &b, const math::vec3< T > &c) noexcept
 Ray-triangle intersection test. More...
 
template<class T >
constexpr std::optional< std::tuple< T, T, T > > intersection (const math::vec3< T > &a, const math::vec3< T > &b, const math::vec3< T > &c, const ray< T, 3 > &ray) noexcept
 Ray-triangle intersection test. More...
 
template<class T , std::size_t N>
constexpr bool intersection (const hyperrectangle< T, N > &hyperrectangle, const hypersphere< T, N > &hypersphere) noexcept
 Hyperrectangle-hypersphere intersection test. More...
 
template<class T , std::size_t N>
constexpr bool intersection (const hypersphere< T, N > &hypersphere, const hyperrectangle< T, N > &hyperrectangle) noexcept
 Hyperrectangle-hypersphere intersection test. More...
 

Detailed Description

Geometric algorithms.

Typedef Documentation

◆ octree

template<std::unsigned_integral T, hyperoctree_order Order>
using geom::octree = typedef hyperoctree<T, 3, Order>

An octree, or 3-dimensional hyperoctree.

Definition at line 30 of file octree.hpp.

◆ octree16

template<hyperoctree_order Order>
using geom::octree16 = typedef octree<std::uint16_t, Order>

Octree with a 16-bit node type (4 depth levels).

Definition at line 38 of file octree.hpp.

◆ octree32

template<hyperoctree_order Order>
using geom::octree32 = typedef octree<std::uint32_t, Order>

Octree with a 32-bit node type (9 depth levels).

Definition at line 42 of file octree.hpp.

◆ octree64

template<hyperoctree_order Order>
using geom::octree64 = typedef octree<std::uint64_t, Order>

Octree with a 64-bit node type (19 depth levels).

Definition at line 46 of file octree.hpp.

◆ octree8

template<hyperoctree_order Order>
using geom::octree8 = typedef octree<std::uint8_t, Order>

Octree with an 8-bit node type (2 depth levels).

Definition at line 34 of file octree.hpp.

◆ quadtree

template<std::unsigned_integral T, hyperoctree_order Order>
using geom::quadtree = typedef hyperoctree<T, 2, Order>

A quadtree, or 2-dimensional hyperoctree.

Definition at line 30 of file quadtree.hpp.

◆ quadtree16

template<hyperoctree_order Order>
using geom::quadtree16 = typedef quadtree<std::uint16_t, Order>

Quadtree with a 16-bit node type (6 depth levels).

Definition at line 38 of file quadtree.hpp.

◆ quadtree32

template<hyperoctree_order Order>
using geom::quadtree32 = typedef quadtree<std::uint32_t, Order>

Quadtree with a 32-bit node type (13 depth levels).

Definition at line 42 of file quadtree.hpp.

◆ quadtree64

template<hyperoctree_order Order>
using geom::quadtree64 = typedef quadtree<std::uint64_t, Order>

Quadtree with a 64-bit node type (29 depth levels).

Definition at line 46 of file quadtree.hpp.

◆ quadtree8

template<hyperoctree_order Order>
using geom::quadtree8 = typedef quadtree<std::uint8_t, Order>

Quadtree with an 8-bit node type (2 depth levels).

Definition at line 34 of file quadtree.hpp.

◆ unordered_hyperoctree

template<std::unsigned_integral T, std::size_t N>
using geom::unordered_hyperoctree = typedef hyperoctree<T, N, hyperoctree_order::unordered>

Hyperoctree with unordered node storage and traversal.

Definition at line 573 of file hyperoctree.hpp.

◆ unordered_octree

template<std::unsigned_integral T>
using geom::unordered_octree = typedef octree<T, hyperoctree_order::unordered>

Octree with unordered node storage and traversal.

Definition at line 50 of file octree.hpp.

◆ unordered_octree16

Unordered octree with a 16-bit node type (4 depth levels).

Definition at line 56 of file octree.hpp.

◆ unordered_octree32

Unordered octree with a 32-bit node type (9 depth levels).

Definition at line 59 of file octree.hpp.

◆ unordered_octree64

Unordered octree with a 64-bit node type (19 depth levels).

Definition at line 62 of file octree.hpp.

◆ unordered_octree8

Unordered octree with an 8-bit node type (2 depth levels).

Definition at line 53 of file octree.hpp.

◆ unordered_quadtree

template<std::unsigned_integral T>
using geom::unordered_quadtree = typedef quadtree<T, hyperoctree_order::unordered>

Quadtree with unordered node storage and traversal.

Definition at line 50 of file quadtree.hpp.

◆ unordered_quadtree16

Unordered quadtree with a 16-bit node type (6 depth levels).

Definition at line 56 of file quadtree.hpp.

◆ unordered_quadtree32

Unordered quadtree with a 32-bit node type (13 depth levels).

Definition at line 59 of file quadtree.hpp.

◆ unordered_quadtree64

Unordered quadtree with a 64-bit node type (29 depth levels).

Definition at line 62 of file quadtree.hpp.

◆ unordered_quadtree8

Unordered quadtree with an 8-bit node type (2 depth levels).

Definition at line 53 of file quadtree.hpp.

Enumeration Type Documentation

◆ hyperoctree_order

Orders in which hyperoctree nodes can be stored and traversed.

Enumerator
unordered 

Hyperoctree nodes are unordered, potentially resulting in faster insertions through the internal use of std::unordered_set rather than std::set.

dfs_pre 

Hyperoctree nodes are stored and traversed in depth-first preorder.

bfs 

Hyperoctree nodes are stored and traversed in breadth-first order.

Definition at line 36 of file hyperoctree.hpp.

◆ triangle_region

enum geom::triangle_region : std::uint8_t
strong

Voronoi regions of a triangle.

Enumerator
abc 

Face ABC region.

ab 

Edge AB region.

bc 

Edge BC region.

ca 

Edge CA region.

Vertex A region.

Vertex B region.

Vertex C region.

Definition at line 33 of file coordinates.hpp.

Function Documentation

◆ barycentric_to_cartesian()

template<class T >
constexpr point<T, 3> geom::barycentric_to_cartesian ( const point< T, 3 > &  p,
const point< T, 3 > &  a,
const point< T, 3 > &  b,
const point< T, 3 > &  c 
)
inlineconstexprnoexcept

Converts Cartesian coordinates to barycentric coordinates.

Template Parameters
TReal type.
Parameters
pBarycentric coordinates of point to convert.
aCartesian coordinates of first point of triangle.
bCartesian coordinates of second point of triangle.
cCartesian coordinates of third point of triangle.
Returns
Cartesian coordinates of point p.

Definition at line 148 of file coordinates.hpp.

◆ barycentric_to_region()

template<class T >
constexpr triangle_region geom::barycentric_to_region ( const point< T, 3 > &  p)
constexprnoexcept

Classifies barycentric coordinates according to their Voronoi region.

Template Parameters
TReal type.
Parameters
pBarycentric coordinates of point to classify.
Returns
Voronoi region of point p.

Definition at line 127 of file coordinates.hpp.

◆ cartesian_to_barycentric()

template<class T >
constexpr point<T, 3> geom::cartesian_to_barycentric ( const point< T, 3 > &  p,
const point< T, 3 > &  a,
const point< T, 3 > &  b,
const point< T, 3 > &  c 
)
constexprnoexcept

Converts Cartesian coordinates to barycentric coordinates.

Template Parameters
TReal type.
Parameters
pCartesian coordinates of point to convert.
aCartesian coordinates of first point of triangle.
bCartesian coordinates of second point of triangle.
cCartesian coordinates of third point of triangle.
Returns
Barycentric coordinates of point p.

Definition at line 166 of file coordinates.hpp.

◆ cartesian_to_spherical()

template<class T >
point<T, 3> geom::cartesian_to_spherical ( const point< T, 3 > &  p)

Converts Cartesian (rectangular) coordinates to spherical coordinates.

Template Parameters
TReal type.
Parameters
pCartesian coordinates of point to convert.
Returns
Spherical coordinates of point p, in the ISO order of radial distance, polar angle (radians), and azimuthal angle (radians).

Definition at line 208 of file coordinates.hpp.

◆ closest_point() [1/9]

template<class T , std::size_t N>
point<T, N> geom::closest_point ( const hypercapsule< T, N > &  a,
const point< T, N > &  b 
)

Calculates the closest point on or in a hypercapsule to a point.

Template Parameters
TReal type.
NNumber of dimensions.
Parameters
aHypercapsule a.
bPoint b.
Returns
Closest point on or in hypercapsule a to point b.

Definition at line 309 of file closest-point.hpp.

◆ closest_point() [2/9]

template<class T , std::size_t N>
constexpr point<T, N> geom::closest_point ( const hyperplane< T, N > &  a,
const point< T, N > &  b 
)
constexprnoexcept

Calculates the closest point on a hyperplane to a point.

Template Parameters
TReal type.
NNumber of dimensions.
Parameters
aHyperplane a.
bPoint b.
Returns
Closest point on hyperplane a to point b.

Definition at line 191 of file closest-point.hpp.

◆ closest_point() [3/9]

template<class T , std::size_t N>
constexpr point<T, N> geom::closest_point ( const hyperrectangle< T, N > &  a,
const point< T, N > &  b 
)
constexprnoexcept

Calculates the closest point on or in a hyperrectangle to a point.

Template Parameters
TReal type.
NNumber of dimensions.
Parameters
aHyperrectangle a.
bPoint b.
Returns
Closest point on or in hyperrectangle a to point b.

Definition at line 329 of file closest-point.hpp.

◆ closest_point() [4/9]

template<class T , std::size_t N>
point<T, N> geom::closest_point ( const hypersphere< T, N > &  a,
const point< T, N > &  b 
)

Calculates the closest point on or in a hypersphere to a point.

Template Parameters
TReal type.
NNumber of dimensions.
Parameters
aHypersphere a.
bPoint b.
Returns
Closest point on or in hypersphere a to point b.

Definition at line 290 of file closest-point.hpp.

◆ closest_point() [5/9]

template<class T , std::size_t N>
constexpr std::tuple<point<T, N>, point<T, N> > geom::closest_point ( const line_segment< T, N > &  ab,
const line_segment< T, N > &  cd 
)
constexprnoexcept

Calculates the closest points on two line segments.

Template Parameters
TReal type.
NNumber of dimensions.
Parameters
abLine segment ab.
cdLine segment cd.
Returns
Tuple containing the closest point on segment ab to segment cd, followed by the closest point on segment cd to segment ab.
See also
Ericson, C. (2004). Real-time collision detection. Crc Press.

Definition at line 104 of file closest-point.hpp.

◆ closest_point() [6/9]

template<class T , std::size_t N>
constexpr point<T, N> geom::closest_point ( const line_segment< T, N > &  ab,
const point< T, N > &  c 
)
constexprnoexcept

Calculates the closest point on a line segment to a point.

Template Parameters
TReal type.
NNumber of dimensions.
Parameters
abLine segment ab.
cPoint c.
Returns
Closest point on line segment ab to point c.

Definition at line 67 of file closest-point.hpp.

◆ closest_point() [7/9]

template<class T >
constexpr std::tuple<point<T, 3>, triangle_region> geom::closest_point ( const point< T, 3 > &  a,
const point< T, 3 > &  b,
const point< T, 3 > &  c,
const point< T, 3 > &  p 
)
constexprnoexcept

Calculates the closest point on a triangle to a point.

Template Parameters
TReal type.
Parameters
triTriangle.
aFirst point of triangle.
bSecond point of triangle.
cThird point of triangle.
pPoint.
Returns
Closest point on the triangle to point p, followed by the Voronoi region of the point.
See also
Ericson, C. (2004). Real-time collision detection. Crc Press.

Definition at line 213 of file closest-point.hpp.

◆ closest_point() [8/9]

template<class T , std::size_t N>
constexpr point<T, N> geom::closest_point ( const ray< T, N > &  a,
const point< T, N > &  b 
)
constexprnoexcept

Calculates the closest point on a ray to a point.

Template Parameters
TReal type.
NNumber of dimensions.
Parameters
aRay a.
bPoint b.
Returns
Closest point on ray a to point b.

Definition at line 50 of file closest-point.hpp.

◆ closest_point() [9/9]

template<class T >
constexpr std::tuple<point<T, 3>, triangle_region> geom::closest_point ( const triangle< T, 3 > &  tri,
const point< T, 3 > &  p 
)
inlineconstexprnoexcept

Calculates the closest point on a triangle to a point.

Template Parameters
TReal type.
Parameters
triTriangle.
aFirst point of triangle.
bSecond point of triangle.
cThird point of triangle.
pPoint.
Returns
Closest point on the triangle to point p, followed by the Voronoi region of the point.
See also
Ericson, C. (2004). Real-time collision detection. Crc Press.

Definition at line 272 of file closest-point.hpp.

◆ edge_index()

constexpr std::uint8_t geom::edge_index ( triangle_region  region)
inlineconstexprnoexcept

Returns the edge index of an edge region.

Parameters
regionTriangle edge region.
Returns
Edge index.

Definition at line 100 of file coordinates.hpp.

◆ generate_face_normals()

void geom::generate_face_normals ( brep_mesh mesh)

Generates the math::fvec3 face attribute "normal" for a B-rep mesh.

Parameters
meshMesh for which to generate normals.
Warning
Requires the math::fvec3 vertex attribute "position".

Definition at line 29 of file brep-operations.cpp.

◆ generate_loop_barycentric()

void geom::generate_loop_barycentric ( brep_mesh mesh)

Generates the math::fvec3 loop attribute "barycentric" for a B-rep mesh.

Parameters
meshMesh for which to generate barycentric coordinates.

Definition at line 122 of file brep-operations.cpp.

◆ generate_model()

std::unique_ptr< render::model > geom::generate_model ( const brep_mesh mesh,
std::shared_ptr< render::material material = nullptr 
)

Generates a model from a B-rep mesh.

Parameters
meshMesh for which to generate a model. @parma material Material to assign to the model.
Returns
Generated model.

Definition at line 136 of file brep-operations.cpp.

◆ generate_vertex_normals()

void geom::generate_vertex_normals ( brep_mesh mesh)

Generates the math::fvec3 vertex attribute "normal" for a B-rep mesh.

Parameters
meshMesh for which to generate normals.
Note
The math::fvec3 face attribute "normal" will also be generated if not found.
Warning
Requires the math::fvec3 vertex attribute "position".

Definition at line 45 of file brep-operations.cpp.

◆ intersection() [1/11]

template<class T , std::size_t N>
constexpr std::optional<T> geom::intersection ( const hyperplane< T, N > &  hyperplane,
const ray< T, N > &  ray 
)
inlineconstexprnoexcept

Ray-hyperplane intersection test.

Parameters
rayRay.
hyperplaneHyperplane.
Returns
Distance along the ray to the point of intersection, or std::nullopt if no intersection occurred.

Definition at line 58 of file intersection.hpp.

◆ intersection() [2/11]

template<class T , std::size_t N>
constexpr bool geom::intersection ( const hyperrectangle< T, N > &  a,
const hyperrectangle< T, N > &  b 
)
inlineconstexprnoexcept

Hyperrectangle-hyperrectangle intersection test.

Parameters
aFirst hyperrectangle.
bSecond hyperrectangle.
Returns
true if an intersection occurred, false otherwise.

Definition at line 206 of file intersection.hpp.

◆ intersection() [3/11]

template<class T , std::size_t N>
constexpr bool geom::intersection ( const hyperrectangle< T, N > &  hyperrectangle,
const hypersphere< T, N > &  hypersphere 
)
constexprnoexcept

Hyperrectangle-hypersphere intersection test.

Parameters
hyperrectangleHyperrectangle.
hypersphereHypersphere.
Returns
true if an intersection occurred, false otherwise.

Definition at line 221 of file intersection.hpp.

◆ intersection() [4/11]

template<class T , std::size_t N>
constexpr std::optional<std::tuple<T, T> > geom::intersection ( const hyperrectangle< T, N > &  hyperrectangle,
const ray< T, N > &  ray 
)
inlineconstexprnoexcept

Ray-hyperrectangle intersection test.

Parameters
rayRay.
hyperrectangleHyperrectangle.
Returns
Tuple containing the distances along the ray to the first and second points of intersection, or std::nullopt if no intersection occurred.

Definition at line 106 of file intersection.hpp.

◆ intersection() [5/11]

template<class T , std::size_t N>
constexpr bool geom::intersection ( const hypersphere< T, N > &  a,
const hypersphere< T, N > &  b 
)
inlineconstexprnoexcept

Hypersphere-hypersphere intersection test.

Parameters
aFirst hypersphere.
bSecond hypersphere.
Returns
true if an intersection occurred, false otherwise.

Definition at line 257 of file intersection.hpp.

◆ intersection() [6/11]

template<class T , std::size_t N>
constexpr bool geom::intersection ( const hypersphere< T, N > &  hypersphere,
const hyperrectangle< T, N > &  hyperrectangle 
)
inlineconstexprnoexcept

Hyperrectangle-hypersphere intersection test.

Parameters
hyperrectangleHyperrectangle.
hypersphereHypersphere.
Returns
true if an intersection occurred, false otherwise.

Definition at line 242 of file intersection.hpp.

◆ intersection() [7/11]

template<class T >
constexpr std::optional<std::tuple<T, T, T> > geom::intersection ( const math::vec3< T > &  a,
const math::vec3< T > &  b,
const math::vec3< T > &  c,
const ray< T, 3 > &  ray 
)
inlineconstexprnoexcept

Ray-triangle intersection test.

Parameters
rayRay.
a,b,cTriangle points.
Returns
Tuple containing the distance along the ray to the point of intersection, followed by two barycentric coordinates of the point of intersection, or std::nullopt if no intersection occurred.

Definition at line 191 of file intersection.hpp.

◆ intersection() [8/11]

template<class T >
constexpr std::optional<std::tuple<T, T, T> > geom::intersection ( const ray< T, 3 > &  ray,
const math::vec3< T > &  a,
const math::vec3< T > &  b,
const math::vec3< T > &  c 
)
constexprnoexcept

Ray-triangle intersection test.

Parameters
rayRay.
a,b,cTriangle points.
Returns
Tuple containing the distance along the ray to the point of intersection, followed by two barycentric coordinates of the point of intersection, or std::nullopt if no intersection occurred.

Definition at line 149 of file intersection.hpp.

◆ intersection() [9/11]

template<class T , std::size_t N>
constexpr std::optional<T> geom::intersection ( const ray< T, N > &  ray,
const hyperplane< T, N > &  hyperplane 
)
constexprnoexcept

Ray-hyperplane intersection test.

Parameters
rayRay.
hyperplaneHyperplane.
Returns
Distance along the ray to the point of intersection, or std::nullopt if no intersection occurred.

Definition at line 42 of file intersection.hpp.

◆ intersection() [10/11]

template<class T , std::size_t N>
constexpr std::optional<std::tuple<T, T> > geom::intersection ( const ray< T, N > &  ray,
const hyperrectangle< T, N > &  hyperrectangle 
)
constexprnoexcept

Ray-hyperrectangle intersection test.

Parameters
rayRay.
hyperrectangleHyperrectangle.
Returns
Tuple containing the distances along the ray to the first and second points of intersection, or std::nullopt if no intersection occurred.

Definition at line 74 of file intersection.hpp.

◆ intersection() [11/11]

template<class T , std::size_t N>
std::optional<std::tuple<T, T> > geom::intersection ( const ray< T, N > &  ray,
const hypersphere< T, N > &  hypersphere 
)
noexcept

Ray-hypersphere intersection test.

Parameters
rayRay.
hypersphereHypersphere.
Returns
Tuple containing the distances along the ray to the first and second points of intersection, or std::nullopt if no intersection occurred.
See also
Haines, E., Günther, J., & Akenine-Möller, T. (2019). Precision improvements for ray/sphere intersection. Ray Tracing Gems: High-Quality and Real-Time Rendering with DXR and Other APIs, 87-94.

Definition at line 123 of file intersection.hpp.

◆ is_edge_region()

constexpr bool geom::is_edge_region ( triangle_region  region)
inlineconstexprnoexcept

Checks whether a triangle voronoi region is an edge region.

Parameters
regionTriangle region.
Returns
true if region is an edge region, false otherwise.

Definition at line 76 of file coordinates.hpp.

◆ is_face_region()

constexpr bool geom::is_face_region ( triangle_region  region)
inlineconstexprnoexcept

Checks whether a triangle voronoi region is a face region.

Parameters
regionTriangle region.
Returns
true if region is a face region, false otherwise.

Definition at line 64 of file coordinates.hpp.

◆ is_vertex_region()

constexpr bool geom::is_vertex_region ( triangle_region  region)
inlineconstexprnoexcept

Checks whether a triangle voronoi region is a vertex region.

Parameters
regionTriangle region.
Returns
true if region is an vertex region, false otherwise.

Definition at line 88 of file coordinates.hpp.

◆ morton_decode() [1/2]

template<std::unsigned_integral T>
void geom::morton_decode ( code,
T &  x,
T &  y 
)
noexcept

Decodes 2D coordinates from a Morton location code.

Parameters
[in]codeMorton location code to decode.
[out]xDecoded x-coordinate.
[out]yDecoded y-coordinate.

Definition at line 122 of file morton.hpp.

◆ morton_decode() [2/2]

template<std::unsigned_integral T>
void geom::morton_decode ( code,
T &  x,
T &  y,
T &  z 
)
noexcept

Decodes 3D coordinates from a Morton location code.

Parameters
[in]codeMorton location code to decode.
[out]xDecoded x-coordinate.
[out]yDecoded y-coordinate.
[out]zDecoded z-coordinate.

Definition at line 159 of file morton.hpp.

◆ morton_encode() [1/2]

template<std::unsigned_integral T>
constexpr T geom::morton_encode ( x,
y 
)
constexprnoexcept

Encodes 2D coordinates as a Morton location code.

Parameters
[in]xX-coordinate to encode.
[in]yY-coordinate to encode.
Returns
Morton location code.

Definition at line 36 of file morton.hpp.

◆ morton_encode() [2/2]

template<std::unsigned_integral T>
constexpr T geom::morton_encode ( x,
y,
z 
)
constexprnoexcept

Encodes 3D coordinates as a Morton location code.

Parameters
[in]xX-coordinate to encode.
[in]yY-coordinate to encode.
[in]zZ-coordinate to encode.
Returns
Morton location code.

Definition at line 74 of file morton.hpp.

◆ project_on_plane()

template<class T >
math::vec3<T> geom::project_on_plane ( const math::vec3< T > &  v,
const math::vec3< T > &  p,
const math::vec3< T > &  n 
)

Definition at line 28 of file geom/projection.hpp.

◆ spherical_to_cartesian()

template<class T >
point<T, 3> geom::spherical_to_cartesian ( const point< T, 3 > &  p)

Converts spherical coordinates to Cartesian (rectangular) coordinates.

Template Parameters
TReal type.
Parameters
pSpherical coordinates to convert, in the ISO order of radial distance, polar angle (radians), and azimuthal angle (radians).
Returns
Cartesian coordinates of point p.

Definition at line 230 of file coordinates.hpp.

◆ vertex_index()

constexpr std::uint8_t geom::vertex_index ( triangle_region  region)
inlineconstexprnoexcept

Returns the vertex index of a vertex region.

Parameters
regionTriangle vertex region.
Returns
Vertex index.

Definition at line 112 of file coordinates.hpp.