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<class T>
class Circle
Circle in 2D Euclidean space.
template<class T, class OtherGeometry, class = void>
struct has_connect_method
Type trait to detect if a type has a connect method.
template<class T, class OtherGeometry>
struct has_connect_method<T, OtherGeometry, std::void_t<decltype(std::declval<T>().connect(std::declval<const OtherGeometry&>()))>>
Specialization when connect method exists.
template<class T, class OtherGeometry, class = void>
struct has_distance_method
Type trait to detect if a type has a distance method.
template<class T, class OtherGeometry>
struct has_distance_method<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 has_intersect_method
Type trait to detect if a type has an intersect method.
template<class T, class OtherGeometry>
struct has_intersect_method<T, OtherGeometry, std::void_t<decltype(std::declval<T>().intersect(std::declval<const OtherGeometry&>()))>>
Specialization when intersect method exists.
template<class T>
class Line2D
Infinite line in 2D Euclidean space.
template<class T>
class LineSegment2D
Line segment in 2D Euclidean space.
template<class T>
class Point2D
Point in 2D Euclidean space.
template<class T>
class Rectangle
Axis-aligned rectangle in 2D Euclidean space.

Functions

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

Function documentation

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

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 \]