API Documentation
Loading...
Searching...
No Matches
LineSegment< t_dims, t_type, t_vertex > Class Template Reference

A line segment represented by two vertices, a start and end. More...

#include <Line.hpp>

Inheritance diagram for LineSegment< t_dims, t_type, t_vertex >:
[legend]
Collaboration diagram for LineSegment< t_dims, t_type, t_vertex >:
[legend]

Public Member Functions

constexpr LineSegment ()
 
constexpr LineSegment (const t_vertex &p1, const t_vertex &p2)
 
constexpr LineSegment (const Vector< 2, t_vertex > &line)
 
template<uint01 t_new_dims, class t_new_type , class t_new_vertex = Vertex<t_new_dims, t_new_type>>
constexpr LineSegment< t_new_dims, t_new_type, t_new_vertex > as () const
 
template<class t_inter_type >
constexpr t_vertex pointAt (t_inter_type index) const
 
constexpr t_vertex midpoint () const
 
constexpr t_vertex ray () const
 
constexpr t_vertex center () const
 
constexpr const t_vertex & vertex (uint01 index) const
 
constexpr t_vertex & vertex (uint01 index)
 
template<class t_precision = t_type>
constexpr bool isParallel (const LineSegment< t_dims, t_type, t_vertex > &line, t_precision epsilon=0) const
 
template<class t_precision = t_type>
constexpr bool isCollinear (const LineSegment< t_dims, t_type > &line, t_precision epsilon=0) const
 
template<class t_precision = t_type>
constexpr bool isCollinear (const t_vertex &vert, t_precision epsilon=0) const
 
template<class t_precision , class t_other_vertex >
constexpr LineSegment< t_dims, t_precision > closestPoints (const LineSegment< t_dims, t_type, t_other_vertex > &l2, t_precision epsilon=0) const
 
constexpr t_type closestPos (const t_vertex &p) const
 
constexpr t_vertex closestValue (const t_vertex &p) const
 
template<class t_precision = t_type>
t_precision distanceSquared (const LineSegment< t_dims, t_type, t_vertex > &right, const t_precision &epsilon=cast< t_precision >(0)) const
 
template<class t_inter_type >
constexpr LineSegment< t_dims, t_type > scale (const t_inter_type &scale) const
 
template<class t_inter_type >
constexpr LineSegment< t_dims, t_type > scale (const t_inter_type &a_scale, const t_inter_type &b_scale) const
 
constexpr LineSegment< t_dims, t_type > extend (const t_type &extension) const
 
constexpr LineSegment< t_dims, t_type > extend (const t_type &a_extension, const t_type &b_extension) const
 
template<class t_precision = t_type>
constexpr t_precision length () const
 
constexpr t_type lengthSquared () const
 
template<class t_precision = t_type>
constexpr Vector< t_dims, t_precision > intersection (const LineSegment &r, t_precision epsilon=0) const
 
template<class t_precision = t_type>
constexpr t_precision intersectionPosition (const LineSegment< t_dims, t_type > &segment) const
 
template<class t_precision = t_type>
constexpr bool intersects (const LineSegment &segment, t_precision epsilon=cast< t_precision >(0.001)) const
 
template<bool t_clip, class t_precision >
constexpr t_precision getLocationAt (t_precision value, uint01 dim) const
 
template<bool t_clip, class t_precision >
constexpr t_vertex pointAt (t_precision value, uint01 dim, const t_vertex &nan_return=Constant< t_vertex >::NaN) const
 
- Public Member Functions inherited from Vector< t_dims, t_type >
constexpr Vector () noexcept
 
template<class t_vec_type >
constexpr Vector (const Vector< t_dims, t_vec_type > &vector) noexcept
 
constexpr Vector (const t_type &scaler) noexcept
 
template<uint01 tdims = t_dims>
constexpr Vector (const t_type &x, typename std::enable_if< tdims==2, const t_type & >::type y)
 
template<uint01 tdims = t_dims>
constexpr Vector (const t_type &x, const t_type &y, const typename std::enable_if< tdims==3, const t_type & >::type z)
 
template<uint01 tdims = t_dims>
constexpr Vector (const t_type &x, const t_type &y, const t_type &z, typename std::enable_if< tdims==4, const t_type & >::type w)
 
template<uint01 tdims = t_dims>
constexpr Vector (const t_type &x, const t_type &y, const t_type &z, const t_type &w, typename std::enable_if< tdims==5, const t_type & >::type v)
 
template<uint01 tdims = t_dims>
constexpr Vector (const t_type &x, const t_type &y, const t_type &z, const t_type &w, const t_type &v, typename std::enable_if< tdims==6, const t_type & >::type u)
 
template<uint01 tdims = t_dims>
constexpr Vector (const t_type &x, const t_type &y, const t_type &z, const t_type &w, const t_type &v, const t_type &u, const t_type &t, const t_type &s, typename std::enable_if< tdims==9, const t_type & >::type r)
 
constexpr Vector (const t_type(&vector)[t_dims])
 
template<uint01 tdims = t_dims>
constexpr Vector (const Vector< tdims - 1, t_type > &vector, typename std::enable_if< tdims >=2, const t_type & >::type suffix)
 
template<uint01 tdims = t_dims>
constexpr Vector (const Vector< getMax(tdims - 2, 0), t_type > &vector, const t_type &suffix_a, typename std::enable_if< tdims >=3, const t_type & >::type suffix_b)
 
template<uint01 tdims = t_dims>
constexpr Vector (const t_type &prefix, typename std::enable_if< tdims >=2, const Vector< t_dims - 1, t_type > & >::type vector)
 
template<uint01 tdims = t_dims>
constexpr Vector (const t_type &prefix_a, const t_type &prefix_b, typename std::enable_if< tdims >=3, const Vector< tdims - 1, t_type > & >::type vector)
 
template<class t_new_type >
constexpr Vector< t_dims, t_new_type > as () const
 
template<uint01 t_new_dim, class t_new_type >
constexpr Vector< t_new_dim, t_new_type > as () const
 
template<uint01 t_new_dim, class t_new_type >
constexpr Vector< t_new_dim, t_new_type > as (t_new_type extra_fill_value) const
 
template<LocationValues t_max_min>
constexpr t_type dimensionalValue () const
 
template<LocationValues t_max_min>
constexpr uint01 dimensionalIndex () const
 
template<uint01 tdims = t_dims, typename = typename std::enable_if<tdims == 1>::type>
constexpr operator t_type & ()
 
template<uint01 tdims = t_dims, typename = typename std::enable_if<tdims == 1>::type>
constexpr operator const t_type & () const
 
constexpr t_type magnitudeSquared () const
 
template<class t_magnitude_type = t_type>
constexpr t_magnitude_type magnitude () const
 
template<class t_norm_type = t_type>
constexpr Vector< t_dims, t_norm_type > normalized (Vector< t_dims, t_norm_type > value_if_nan=Constant< Vector< t_dims, t_norm_type > >::NaN) const
 
constexpr t_type product () const
 
constexpr t_type sum () const
 
constexpr t_type & operator[] (uint01 dimension_index)
 
constexpr const t_type & operator[] (const uint01 dimension_index) const
 
constexpr Vector< t_dims, t_type > operator- () const
 
constexpr Vector< t_dims, t_type > & operator= (const t_type &scaler)
 

Static Public Member Functions

template<class t_buffer_type >
static constexpr LineSegment createBestFitLine (const t_buffer_type &vertices, uint01 dim_0, uint01 dim_1)
 
- Static Public Member Functions inherited from Vector< t_dims, t_type >
static constexpr uint01 NumberOfDimensions ()
 
static constexpr t_type Type ()
 

Additional Inherited Members

- Protected Attributes inherited from Vector< t_dims, t_type >
t_type m_values [t_dims]
 

Detailed Description

template<uint01 t_dims, class t_type, class t_vertex = Vertex<t_dims, t_type>>
class NDEVR::LineSegment< t_dims, t_type, t_vertex >

A line segment represented by two vertices, a start and end.


Class: LineSegment

Author: Tyler Parke

Date: 2017-11-19

Constructor & Destructor Documentation

◆ LineSegment() [1/3]

template<uint01 t_dims, class t_type , class t_vertex = Vertex<t_dims, t_type>>
LineSegment ( )
inlineconstexpr

◆ LineSegment() [2/3]

template<uint01 t_dims, class t_type , class t_vertex = Vertex<t_dims, t_type>>
LineSegment ( const t_vertex & p1,
const t_vertex & p2 )
inlineconstexpr

◆ LineSegment() [3/3]

template<uint01 t_dims, class t_type , class t_vertex = Vertex<t_dims, t_type>>
LineSegment ( const Vector< 2, t_vertex > & line)
inlineexplicitconstexpr

Member Function Documentation

◆ as()

template<uint01 t_dims, class t_type , class t_vertex = Vertex<t_dims, t_type>>
template<uint01 t_new_dims, class t_new_type , class t_new_vertex = Vertex<t_new_dims, t_new_type>>
LineSegment< t_new_dims, t_new_type, t_new_vertex > as ( ) const
inlineconstexpr

Fn: constexpr LineSegment<t_new_dims, t_new_type, t_new_vertex> LineSegment::as() const

Gets as.

Author: Tyler Parke

Date: 2017-11-19

Returns: A LineSegment<t_new_dims,t_new_type,t_new_vertex>

◆ center()

template<uint01 t_dims, class t_type , class t_vertex = Vertex<t_dims, t_type>>
t_vertex center ( ) const
inlineconstexpr

Fn: constexpr inline t_vertex LineSegment::center() const

Gets the center.

Author: Tyler Parke

Date: 2017-11-19

Returns: A t_vertex.

◆ closestPoints()

template<uint01 t_dims, class t_type , class t_vertex = Vertex<t_dims, t_type>>
template<class t_precision , class t_other_vertex >
LineSegment< t_dims, t_precision > closestPoints ( const LineSegment< t_dims, t_type, t_other_vertex > & l2,
t_precision epsilon = 0 ) const
inlineconstexpr

Fn: constexpr LineSegment<t_dims, t_precision> LineSegment::closestPoints(const LineSegment<t_dims, t_type>& l2, t_precision epsilon = 0) const

Closest vertices.

Author: Tyler Parke

Date: 2017-11-19

Parameters: l2 - The second LineSegment<t_dims,t_type> epsilon - (Optional) The epsilon.

Returns: A LineSegment<t_dims,t_precision>

◆ closestPos()

template<uint01 t_dims, class t_type , class t_vertex = Vertex<t_dims, t_type>>
t_type closestPos ( const t_vertex & p) const
inlineconstexpr

Fn: constexpr t_type LineSegment::closestPos(const t_vertex& p) const

Closest position.

Author: Tyler Parke

Date: 2017-11-19

Parameters: p - A t_vertex to process.

Returns: A t_type.

◆ closestValue()

template<uint01 t_dims, class t_type , class t_vertex = Vertex<t_dims, t_type>>
t_vertex closestValue ( const t_vertex & p) const
inlineconstexpr

Fn: constexpr t_vertex LineSegment::closestValue(const t_vertex& p) const

Closest value.

Author: Tyler Parke

Date: 2017-11-19

Parameters: p - A t_vertex to process.

Returns: A t_vertex.

◆ createBestFitLine()

template<uint01 t_dims, class t_type , class t_vertex = Vertex<t_dims, t_type>>
template<class t_buffer_type >
static constexpr LineSegment createBestFitLine ( const t_buffer_type & vertices,
uint01 dim_0,
uint01 dim_1 )
inlinestaticconstexpr

Fn: constexpr static LineSegment LineSegment::createBestFitLine(const t_buffer_type& vertices, uint01 dim_0, uint01 dim_1)

Creates best fit line.

Author: Tyler Parke

Date: 2017-11-19

Parameters: vertices - The vertices. dim_0 - The dim 0. dim_1 - The first dim.

Returns: The new best fit line.

◆ distanceSquared()

template<uint01 t_dims, class t_type , class t_vertex = Vertex<t_dims, t_type>>
template<class t_precision = t_type>
t_precision distanceSquared ( const LineSegment< t_dims, t_type, t_vertex > & right,
const t_precision & epsilon = cast<t_precision>(0) ) const
inline

◆ extend() [1/2]

template<uint01 t_dims, class t_type , class t_vertex = Vertex<t_dims, t_type>>
LineSegment< t_dims, t_type > extend ( const t_type & a_extension,
const t_type & b_extension ) const
inlineconstexpr

◆ extend() [2/2]

template<uint01 t_dims, class t_type , class t_vertex = Vertex<t_dims, t_type>>
LineSegment< t_dims, t_type > extend ( const t_type & extension) const
inlineconstexpr

◆ getLocationAt()

template<uint01 t_dims, class t_type , class t_vertex = Vertex<t_dims, t_type>>
template<bool t_clip, class t_precision >
t_precision getLocationAt ( t_precision value,
uint01 dim ) const
inlineconstexpr

Fn: constexpr t_precision LineSegment::getLocationAt(t_precision value, uint01 dim) const

Gets location at.

Author: Tyler Parke

Date: 2017-11-19

Parameters: value - The value. dim - The dim.

Returns: The location at.

◆ intersection()

template<uint01 t_dims, class t_type , class t_vertex = Vertex<t_dims, t_type>>
template<class t_precision = t_type>
Vector< t_dims, t_precision > intersection ( const LineSegment< t_dims, t_type, t_vertex > & r,
t_precision epsilon = 0 ) const
inlineconstexpr

Fn: constexpr Vector<t_dims, t_precision> LineSegment::intersection(const LineSegment& r, t_precision epsilon = 0) const

Intersections.

Author: Tyler Parke

Date: 2017-11-19

Parameters: r - A LineSegment to process. epsilon - (Optional) The epsilon.

Returns: A Vector<t_dims,t_precision>

◆ intersectionPosition()

template<uint01 t_dims, class t_type , class t_vertex = Vertex<t_dims, t_type>>
template<class t_precision = t_type>
t_precision intersectionPosition ( const LineSegment< t_dims, t_type > & segment) const
inlineconstexpr

Fn: constexpr t_precision LineSegment::intersectionPosition(const LineSegment<t_dims, t_type>& segment) const

Intersection position.

Author: Tyler Parke

Date: 2017-11-19

Parameters: segment - The segment.

Returns: A t_precision.

◆ intersects()

template<uint01 t_dims, class t_type , class t_vertex = Vertex<t_dims, t_type>>
template<class t_precision = t_type>
bool intersects ( const LineSegment< t_dims, t_type, t_vertex > & segment,
t_precision epsilon = cast<t_precision>(0.001) ) const
inlineconstexpr

Fn: constexpr bool LineSegment::intersects(const LineSegment& segment, t_precision epsilon = cast<t_precision>(0))

Query if this object intersects the given segment.

Author: Tyler Parke

Date: 2017-11-19

Parameters: segment - The segment. epsilon - (Optional) The epsilon.

Returns: True if it succeeds, false if it fails.

◆ isCollinear() [1/2]

template<uint01 t_dims, class t_type , class t_vertex = Vertex<t_dims, t_type>>
template<class t_precision = t_type>
bool isCollinear ( const LineSegment< t_dims, t_type > & line,
t_precision epsilon = 0 ) const
inlineconstexpr

Fn: constexpr bool LineSegment::isCollinear(const LineSegment<t_dims, t_type>& line, t_precision epsilon = 0) const

Query if 'line' is collinear.

Author: Tyler Parke

Date: 2017-11-19

Parameters: line - The line. epsilon - (Optional) The epsilon.

Returns: True if collinear, false if not.

◆ isCollinear() [2/2]

template<uint01 t_dims, class t_type , class t_vertex = Vertex<t_dims, t_type>>
template<class t_precision = t_type>
bool isCollinear ( const t_vertex & vert,
t_precision epsilon = 0 ) const
inlineconstexpr

Fn: constexpr bool LineSegment::isCollinear(const t_vertex& vert, t_precision epsilon = 0) const

Query if 'vert' is collinear.

Author: Tyler Parke

Date: 2017-11-19

Parameters: vert - The vertical. epsilon - (Optional) The epsilon.

Returns: True if collinear, false if not.

◆ isParallel()

template<uint01 t_dims, class t_type , class t_vertex = Vertex<t_dims, t_type>>
template<class t_precision = t_type>
bool isParallel ( const LineSegment< t_dims, t_type, t_vertex > & line,
t_precision epsilon = 0 ) const
inlineconstexpr

Fn: constexpr bool LineSegment::isParallel(const LineSegment<t_dims, t_type, t_vertex>& line, t_precision epsilon = 0) const

Query if 'line' is parallel.

Author: Tyler Parke

Date: 2017-11-19

Parameters: line - The line. epsilon - (Optional) The epsilon.

Returns: True if parallel, false if not.

◆ length()

template<uint01 t_dims, class t_type , class t_vertex = Vertex<t_dims, t_type>>
template<class t_precision = t_type>
t_precision length ( ) const
inlineconstexpr

Fn: constexpr t_precision LineSegment::length() const

Gets the length.

Author: Tyler Parke

Date: 2017-11-19

Returns: A t_precision.

◆ lengthSquared()

template<uint01 t_dims, class t_type , class t_vertex = Vertex<t_dims, t_type>>
t_type lengthSquared ( ) const
inlineconstexpr

Fn: constexpr t_type LineSegment::lengthSquared() const

Length squared.

Author: Tyler Parke

Date: 2017-11-19

Returns: A t_type.

◆ midpoint()

template<uint01 t_dims, class t_type , class t_vertex = Vertex<t_dims, t_type>>
t_vertex midpoint ( ) const
inlineconstexpr

Fn: constexpr inline t_vertex LineSegment::midpoint() const

Gets the midpoint.

Author: Tyler Parke

Date: 2017-11-19

Returns: A t_vertex.

◆ pointAt() [1/2]

template<uint01 t_dims, class t_type , class t_vertex = Vertex<t_dims, t_type>>
template<class t_inter_type >
t_vertex pointAt ( t_inter_type index) const
inlineconstexpr

Fn: constexpr inline t_vertex LineSegment::pointAt(t_inter_type index) const

Point at.

Author: Tyler Parke

Date: 2017-11-19

Parameters: index - Zero-based index of the.

Returns: A t_vertex.

◆ pointAt() [2/2]

template<uint01 t_dims, class t_type , class t_vertex = Vertex<t_dims, t_type>>
template<bool t_clip, class t_precision >
t_vertex pointAt ( t_precision value,
uint01 dim,
const t_vertex & nan_return = Constant<t_vertex>::NaN ) const
inlineconstexpr

Fn: constexpr t_vertex LineSegment::pointAt(t_precision value, uint01 dim, const t_vertex& nan_return = Constant<t_vertex>::NaN) const

Point at.

Author: Tyler Parke

Date: 2017-11-19

Parameters: value - The value. dim - The dim. nan_return - (Optional) The NaN return.

Returns: A t_vertex.

◆ ray()

template<uint01 t_dims, class t_type , class t_vertex = Vertex<t_dims, t_type>>
t_vertex ray ( ) const
inlineconstexpr

Fn: constexpr inline t_vertex LineSegment::ray() const

Gets the ray.

Author: Tyler Parke

Date: 2017-11-19

Returns: A t_vertex.

◆ scale() [1/2]

template<uint01 t_dims, class t_type , class t_vertex = Vertex<t_dims, t_type>>
template<class t_inter_type >
LineSegment< t_dims, t_type > scale ( const t_inter_type & a_scale,
const t_inter_type & b_scale ) const
inlineconstexpr

◆ scale() [2/2]

template<uint01 t_dims, class t_type , class t_vertex = Vertex<t_dims, t_type>>
template<class t_inter_type >
LineSegment< t_dims, t_type > scale ( const t_inter_type & scale) const
inlineconstexpr

Fn: constexpr LineSegment<t_dims, t_type> LineSegment::scale(const Vector<t_dims, t_type>& scale, const t_vertex& center) const

Scales.

Author: Tyler Parke

Date: 2017-11-19

Parameters: scale - The scale. center - The center.

Returns: A LineSegment<t_dims,t_type>


Fn: constexpr LineSegment<t_dims, t_type> LineSegment::scale(const t_type& scale, const t_vertex& center) const

Scales.

Author: Tyler Parke

Date: 2017-11-19

Parameters: scale - The scale. center - The center.

Returns: A LineSegment<t_dims,t_type>

◆ vertex() [1/2]

template<uint01 t_dims, class t_type , class t_vertex = Vertex<t_dims, t_type>>
t_vertex & vertex ( uint01 index)
inlineconstexpr

Fn: constexpr inline t_vertex& LineSegment::vertex(uint01 index)

Vertices the given index.

Author: Tyler Parke

Date: 2017-11-19

Parameters: index - Zero-based index of the.

Returns: A reference to a t_vertex.

◆ vertex() [2/2]

template<uint01 t_dims, class t_type , class t_vertex = Vertex<t_dims, t_type>>
const t_vertex & vertex ( uint01 index) const
inlineconstexpr

Fn: constexpr inline const t_vertex& LineSegment::vertex(uint01 index) const

Vertices the given index.

Author: Tyler Parke

Date: 2017-11-19

Parameters: index - Zero-based index of the.

Returns: A reference to a const t_vertex.


The documentation for this class was generated from the following file: