20 #ifndef ANTKEEPER_GEOM_PRIMITIVES_LINE_SEGMENT_HPP
21 #define ANTKEEPER_GEOM_PRIMITIVES_LINE_SEGMENT_HPP
26 namespace primitives {
34 template <
class T, std::
size_t N>
61 [[nodiscard]]
inline T
length() const noexcept
86 if (t >= ab_sqr_length)
110 using namespace primitives;
constexpr T sqr_distance(const vector< T, N > &p0, const vector< T, N > &p1) noexcept
Calculates the square distance between two points.
constexpr T sqr_length(const quaternion< T > &q) noexcept
Calculates the square length of a quaternion.
vector< T, N > sqrt(const vector< T, N > &x)
Takes the square root of each element.
constexpr T dot(const quaternion< T > &a, const quaternion< T > &b) noexcept
Calculates the dot product of two quaternions.
n-dimensional line segment.
T distance(const vector_type &point) const
Calculates the distance from the line segment to a point.
vector_type a
First endpoint.
T sqr_length() const noexcept
Calculates the square length of the line segment.
vector_type b
Second endpoint.
T length() const noexcept
Calculates the length of the line segment.
T sqr_distance(const vector_type &point) const noexcept
Calculates the square distance from the line segment to a point.