Rodin::Geometry::Euclidean namespace

Module for dealing with Euclidean geometries.

Classes

template<class Derived, class T>
class Base
Base class for Euclidean geometric objects using CRTP.
template<size_t Dimension, class T>
class Box
Closed axis-aligned box $ \prod_i[l_i,u_i] $ .
template<class T, class OtherGeometry, class = void>
struct HasIntersectMethod
Type trait to detect if a type has an intersect method.
See specializations
SpecializationDescription
T, OtherGeometry, std::void_t<…>
Full specialization
template <
  class T,
  class OtherGeometry>
struct HasIntersectMethod<
  T,
  OtherGeometry,
  std::void_t< decltype(std::declval< T >().intersect(std::declval< const OtherGeometry & >()))>>;
Specialization when intersect method exists.
template<class T, class OtherGeometry, class = void>
struct HasDistanceMethod
Type trait to detect if a type has a distance method.
See specializations
SpecializationDescription
T, OtherGeometry, std::void_t<…>
Full specialization
template <
  class T,
  class OtherGeometry>
struct HasDistanceMethod<
  T,
  OtherGeometry,
  std::void_t< decltype(std::declval< T >().distance(std::declval< const OtherGeometry & >()))>>;
Specialization when distance method exists.
template<class T, class OtherGeometry, class = void>
struct HasConnectMethod
Type trait to detect if a type has a connect method.
See specializations
SpecializationDescription
T, OtherGeometry, std::void_t<…>
Full specialization
template <
  class T,
  class OtherGeometry>
struct HasConnectMethod<
  T,
  OtherGeometry,
  std::void_t< decltype(std::declval< T >().connect(std::declval< const OtherGeometry & >()))>>;
Specialization when connect method exists.
template<size_t Dimension, class T>
class Point
Point $ p\in\mathbb{R}^{Dimension} $ with compile-time fixed coordinate storage. Arithmetic applies componentwise; subtracting two points yields a spatial displacement. The template dimension is a nonnegative compile-time coordinate count.
template<size_t Dimension, class T>
class LineSegment
Segment $ s(t)=p+t(q-p) $ between distinct endpoints. The closed segment corresponds to $ 0\leq t\leq1 $ ; parameter evaluation also accepts extrapolation. Storage has exactly Dimension components. Intersection returns a point only when unique, including a shared endpoint of collinear segments; positive-length overlaps return no unique point.
template<size_t Dimension, class T>
class Line
Affine line in a compile-time Euclidean dimension. $ L(t)=p+tv $ with nonzero direction $ v $ . Projection uses the Euclidean inner product. Closest points use direct formulas through dimension three and a fixed-size QR solve in higher dimensions. Unit direction columns use a rank threshold of twice scalar machine epsilon (relative to the largest QR pivot in higher dimensions). Numerically parallel directions have rank below two and admit no unique line intersection. Intersections return only unique points; coincident lines return no point.
template<size_t Dimension, class T>
class Sphere
Sphere $ \|x-c\|^2=r^2 $ in a compile-time ambient dimension. In one dimension the sphere comprises two endpoints; in two it is a circle.
template<size_t Dimension, class T>
class Hyperplane
Affine hyperplane $ n\cdot(x-p)=0 $ .

Typedefs

template<class T>
using Point2D = Point<2, T>
Point in the Euclidean plane.
template<class T>
using LineSegment2D = LineSegment<2, T>
Line segment in the Euclidean plane.
template<class T>
using Line2D = Line<2, T>
Affine line in the Euclidean plane.
template<class T>
using Circle = Sphere<2, T>
Circle in the Euclidean plane.
template<class T>
using Rectangle = Box<2, T>
Axis-aligned box in the Euclidean plane.

Functions

template<class P0, class ... Ps>
auto barycenter(const P0& p0, const Ps&... ps) -> auto
Computes the barycenter (centroid) of multiple points.

Typedef documentation

template<class T>
using Point2D = Point<2, T>

Defined in Rodin/Geometry/Euclidean/ForwardDecls.h

Point in the Euclidean plane.

Template parameters
T Coordinate scalar type.

template<class T>
using LineSegment2D = LineSegment<2, T>

Defined in Rodin/Geometry/Euclidean/ForwardDecls.h

Line segment in the Euclidean plane.

Template parameters
T Coordinate scalar type.

template<class T>
using Line2D = Line<2, T>

Defined in Rodin/Geometry/Euclidean/ForwardDecls.h

Affine line in the Euclidean plane.

Template parameters
T Coordinate scalar type.

template<class T>
using Circle = Sphere<2, T>

Defined in Rodin/Geometry/Euclidean/ForwardDecls.h

Circle in the Euclidean plane.

Template parameters
T Coordinate scalar type.

template<class T>
using Rectangle = Box<2, T>

Defined in Rodin/Geometry/Euclidean/ForwardDecls.h

Axis-aligned box in the Euclidean plane.

Template parameters
T Coordinate scalar type.

Function documentation

template<class P0, class ... Ps>
auto barycenter(const P0& p0, const Ps&... ps)

Defined in Rodin/Geometry/Euclidean/Common.h

Computes the barycenter (centroid) of multiple points.

Template parameters
P0 Type of first point
Ps Types of remaining points
Parameters
p0 in First point
ps in Remaining points
Returns Barycenter of all points

Given points $ p_0, p_1, \ldots, p_n $ , computes:

\[ \text{barycenter} = \frac{1}{n+1} \sum_{i=0}^{n} p_i \]