NDEVR
API Documentation
Triangle< t_dims, t_type, t_vertex >

A three-vertex polygon representing a triangle in N-dimensional space. More...

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

Public Member Functions

template<class t_angle_type>
constexpr Angle< t_angle_type > angle (TriangleLocation location) const
template<class t_angle_type>
constexpr Angle< t_angle_type > angle (uint01 triangle_node) const
template<class t_area_type>
constexpr t_area_type area () const
template<uint01 t_new_dims, class t_new_type>
constexpr Triangle< t_new_dims, t_new_type > as () const
constexpr t_vertex center () const
constexpr t_vertex centroid () const
constexpr bool contains (const t_vertex &vertex_point, t_type epsilon=t_type(0.0001)) const
constexpr bool contains (const Vector< t_dims - 1, t_type > &p) const
constexpr LineSegment< t_dims, t_type, t_vertex > edge (TriangleLocation location) const
 Edges the given location.
constexpr LineSegment< t_dims, t_type, t_vertex > edge (uint01 triangle_node_a, uint01 triangle_node_b) const
constexpr void invert ()
constexpr const t_vertex & nextVertexCCW (const t_vertex &point) const
constexpr const t_vertex & nextVertexCW (const t_vertex &point) const
template<bool is_normalized, class t_normal_type = t_type>
constexpr Vector< t_dims, t_normal_type > normal () const
constexpr TriangleLocation sharesObject (TriangleLocation object_to_check, const Triangle< t_dims, t_type, t_vertex > &tri, t_type epsilon=0) const
constexpr t_vertex & vertex (TriangleLocation triangle_node)
 Vertices the given triangle node.
constexpr const t_vertex & vertex (TriangleLocation triangle_node) const
 Vertices the given triangle node.
constexpr t_vertex & vertex (uint01 triangle_node)
constexpr const t_vertex & vertex (uint01 triangle_node) const
constexpr uint01 vertexIndex (const t_vertex &p) const
Public Member Functions inherited from Vector< t_dims, t_type >
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)
 Creates a vector where the prefix scaler is combined with the suffix 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)
 Creates a vector where the prefix scaler values are combined with the suffix vector.
constexpr Vector (const t_type &scaler) noexcept
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)
 Sets values in each dimension to the respective value in the passed in scaler.
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)
 Sets values in each dimension to the respective value in the passed in scaler.
template<uint01 tdims = t_dims>
constexpr Vector (const t_type &x, typename std::enable_if< tdims==2, const t_type & >::type y)
 Sets values in each dimension to the respective value in the passed in scaler.
constexpr Vector (const t_type(&vector)[t_dims])
 Given a container of statically determined array, transforms it to a vector.
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)
 Creates a vector where the prefix vector is combined with the suffix scalers.
template<class t_vec_type>
constexpr Vector (const Vector< t_dims, t_vec_type > &vector) noexcept
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)
 Creates a vector where the prefix vector is combined with the suffix scalers.
template<class t_new_type>
constexpr decltype(auto) as () const
 Returns the vector as a new time of vector.
template<LocationValues t_max_min>
constexpr uint01 dimensionalIndex () const
 Used with template arguments MAX or MIN, Gets the dimensional index for the value that is either max or min.
template<LocationValues t_max_min>
constexpr t_type dimensionalValue () const
 Used with template arguments MAX or MIN, Gets the dimensional value for the value that is either max or min.
template<class t_magnitude_type = t_type>
constexpr t_magnitude_type magnitude () const
 Vectors are commonly used to model forces such as wind, sea current, gravity, and electromagnetism.
constexpr t_type magnitudeSquared () const
 Vectors are commonly used to model forces such as wind, sea current, gravity, and electromagnetism.
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 > >::Invalid) const
 Gets the normalized, or unit length representation of this vector.
template<uint01 tdims = t_dims, typename = typename std::enable_if<tdims == 1>::type>
constexpr operator t_type & ()
 For Single dimensional objects, they may also be considered a scaler, thus allow implicit conversion from a vector to a scaler when the dimension of the vector is 1.
constexpr Vector< t_dims, t_type > operator- () const
 Negation operator.
constexpr Vector< t_dims, t_type > & operator= (const t_type &scaler)
 Assignment operator.
constexpr t_type & operator[] (uint01 dimension_index)
 Accesses the value of a certain dimension.
constexpr t_type product () const
 Returns the product, or value of each dimension multiplied together.
constexpr t_type sum () const
 Returns the sum, or value of each dimension added together.

Additional Inherited Members

Static Public Member Functions inherited from Vector< t_dims, t_type >
static constexpr uint01 NumberOfDimensions ()
 Number of dimensions in this vector class.
static constexpr t_type Type ()
 Returns the type of this class.
Static Public Member Functions inherited from TriangleBase
static constexpr TriangleLocation NextVertexCCW (TriangleLocation location)
 Returns the point location counter-clockwise to given point location.
static constexpr TriangleLocation NextVertexCW (TriangleLocation location)
 Returns the point location clockwise to given point location.
Protected Attributes inherited from Vector< t_dims, t_type >
t_type m_values [t_dims]
 The values[t dims].

Detailed Description

template<uint01 t_dims, class t_type, class t_vertex = Vertex<t_dims, t_type>>
class Triangle< t_dims, t_type, t_vertex >

A three-vertex polygon representing a triangle in N-dimensional space.


Class: Triangle

A triangle is a polygon with three edges and three vertices. It is one of the basic shapes in geometry. This triangle with vertices A, B, and C is which can be accessed using vertex(...)

Author: Tyler Parke

Date: 2017-11-17

See also
Vertex, Bounds, Polygon, LineSegment

Definition at line 141 of file Triangle.hpp.

Member Function Documentation

◆ angle() [1/2]

template<uint01 t_dims, class t_type, class t_vertex = Vertex<t_dims, t_type>>
template<class t_angle_type>
Angle< t_angle_type > Triangle< t_dims, t_type, t_vertex >::angle ( TriangleLocation location) const
inlinenodiscardconstexpr

Angles the given location.

Author: Tyler Parke

Date: 2017-11-17

Parameters: location - The location.

Returns
An Angle.

Definition at line 339 of file Triangle.hpp.

References angle(), and RADIANS.

◆ angle() [2/2]

template<uint01 t_dims, class t_type, class t_vertex = Vertex<t_dims, t_type>>
template<class t_angle_type>
Angle< t_angle_type > Triangle< t_dims, t_type, t_vertex >::angle ( uint01 triangle_node) const
inlinenodiscardconstexpr

Angles the given triangle node.

Author: Tyler Parke

Date: 2018-11-24

Parameters: triangle_node - The triangle node.

Returns
An Angle.

Definition at line 303 of file Triangle.hpp.

References AngleDefinitions::Rotation(), and vertex().

Referenced by angle().

◆ area()

template<uint01 t_dims, class t_type, class t_vertex = Vertex<t_dims, t_type>>
template<class t_area_type>
t_area_type Triangle< t_dims, t_type, t_vertex >::area ( ) const
inlinenodiscardconstexpr

Gets the area.

Author: Tyler Parke

Date: 2017-11-17

Returns
A t_area_type.

Definition at line 361 of file Triangle.hpp.

References cast(), cross(), Vector< t_dims, t_type >::magnitudeSquared(), sqrt(), and vertex().

◆ 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>
Triangle< t_new_dims, t_new_type > Triangle< t_dims, t_type, t_vertex >::as ( ) const
inlinenodiscardconstexpr

Gets as.

Author: Tyler Parke

Date: 2017-11-17

Returns
as.

Definition at line 409 of file Triangle.hpp.

References as(), and vertex().

Referenced by as(), and normal().

◆ center()

template<uint01 t_dims, class t_type, class t_vertex = Vertex<t_dims, t_type>>
t_vertex Triangle< t_dims, t_type, t_vertex >::center ( ) const
inlinenodiscardconstexpr

Gets the center.

Author: Tyler Parke

Date: 2017-11-17

Returns
A t_vertex.

Definition at line 391 of file Triangle.hpp.

References cast(), clip(), getMax(), getMin(), and vertex().

◆ centroid()

template<uint01 t_dims, class t_type, class t_vertex = Vertex<t_dims, t_type>>
t_vertex Triangle< t_dims, t_type, t_vertex >::centroid ( ) const
inlinenodiscardconstexpr

Gets the centroid.

Author: Tyler Parke

Date: 2017-11-17

Returns
A t_vertex.

Definition at line 376 of file Triangle.hpp.

References cast(), edge(), and vertex().

◆ contains() [1/2]

template<uint01 t_dims, class t_type, class t_vertex = Vertex<t_dims, t_type>>
bool Triangle< t_dims, t_type, t_vertex >::contains ( const t_vertex & vertex_point,
t_type epsilon = t_type(0.0001) ) const
inlinenodiscardconstexpr

Query if this object contains the given vertex.

Author: Tyler Parke

Date: 2017-11-17

Parameters: vertex_point - The const t_vertex& to test for containment.

Returns
True if the object is in this collection, false if not.

Definition at line 479 of file Triangle.hpp.

References cast(), dot(), edge(), getMax(), getMin(), and vertex().

◆ contains() [2/2]

template<uint01 t_dims, class t_type, class t_vertex = Vertex<t_dims, t_type>>
bool Triangle< t_dims, t_type, t_vertex >::contains ( const Vector< t_dims - 1, t_type > & p) const
inlinenodiscardconstexpr

Query if this object contains the given p.

Author: Tyler Parke

Date: 2017-11-17

Parameters: p - The const Vector<t_dims-1,t_type>& to test for containment.

Returns
True if the object is in this collection, false if not.

Definition at line 447 of file Triangle.hpp.

References cast(), and vertex().

◆ edge() [1/2]

template<uint01 t_dims, class t_type, class t_vertex = Vertex<t_dims, t_type>>
LineSegment< t_dims, t_type, t_vertex > Triangle< t_dims, t_type, t_vertex >::edge ( TriangleLocation location) const
inlinenodiscardconstexpr

Edges the given location.


Author: Tyler Parke

Date: 2017-11-17

Parameters: location - The location.

Returns
A LineSegment<t_dims,t_type,t_vertex>

Definition at line 279 of file Triangle.hpp.

References vertex().

◆ edge() [2/2]

template<uint01 t_dims, class t_type, class t_vertex = Vertex<t_dims, t_type>>
LineSegment< t_dims, t_type, t_vertex > Triangle< t_dims, t_type, t_vertex >::edge ( uint01 triangle_node_a,
uint01 triangle_node_b ) const
inlinenodiscardconstexpr

Edges.

Author: Tyler Parke

Date: 2017-11-17

Parameters: triangle_node_a - The triangle node a. triangle_node_b - The triangle node b.

Returns
A LineSegment<t_dims,t_type,t_vertex>

Definition at line 260 of file Triangle.hpp.

Referenced by centroid(), ClosestPoint(), contains(), intersection(), and sharesObject().

◆ invert()

template<uint01 t_dims, class t_type, class t_vertex = Vertex<t_dims, t_type>>
void Triangle< t_dims, t_type, t_vertex >::invert ( )
inlineconstexpr

Inverts this object.

Author: Tyler Parke

Date: 2017-11-17

Definition at line 807 of file Triangle.hpp.

References vertex().

◆ nextVertexCCW()

template<uint01 t_dims, class t_type, class t_vertex = Vertex<t_dims, t_type>>
const t_vertex & Triangle< t_dims, t_type, t_vertex >::nextVertexCCW ( const t_vertex & point) const
inlineconstexpr

Returns the point counter-clockwise to given point. Note the given point must be a vertex of the triangle

Author: Tyler Parke

Date: 2017-05-15

Definition at line 821 of file Triangle.hpp.

References TriangleBase::NextVertexCCW(), and vertex().

◆ nextVertexCW()

template<uint01 t_dims, class t_type, class t_vertex = Vertex<t_dims, t_type>>
const t_vertex & Triangle< t_dims, t_type, t_vertex >::nextVertexCW ( const t_vertex & point) const
inlineconstexpr

Returns the point clockwise to given point. Note the given point must be a vertex of the triangle

Author: Tyler Parke

Date: 2017-05-15

Definition at line 833 of file Triangle.hpp.

References TriangleBase::NextVertexCW(), and vertex().

◆ normal()

template<uint01 t_dims, class t_type, class t_vertex = Vertex<t_dims, t_type>>
template<bool is_normalized, class t_normal_type = t_type>
Vector< t_dims, t_normal_type > Triangle< t_dims, t_type, t_vertex >::normal ( ) const
inlinenodiscardconstexpr

Gets the normal.

Author: Tyler Parke

Date: 2017-11-17

Returns
A Vector<t_dims,t_normal_type>

Definition at line 425 of file Triangle.hpp.

References as(), cross(), Vector< t_dims, t_type >::normalized(), and vertex().

◆ sharesObject()

template<uint01 t_dims, class t_type, class t_vertex = Vertex<t_dims, t_type>>
TriangleLocation Triangle< t_dims, t_type, t_vertex >::sharesObject ( TriangleLocation object_to_check,
const Triangle< t_dims, t_type, t_vertex > & tri,
t_type epsilon = 0 ) const
inlinenodiscardconstexpr

Shares object.

Author: Tyler Parke

Date: 2017-11-17

Parameters: object_to_check - The object to check. tri - The triangle. epsilon - (Optional) The epsilon.

Returns
A TriangleLocation.

Definition at line 533 of file Triangle.hpp.

References cast(), edge(), equals(), and vertex().

◆ vertex() [1/4]

template<uint01 t_dims, class t_type, class t_vertex = Vertex<t_dims, t_type>>
t_vertex & Triangle< t_dims, t_type, t_vertex >::vertex ( TriangleLocation triangle_node)
inlinenodiscardconstexpr

Vertices the given triangle node.


Author: Tyler Parke

Date: 2017-11-17

Parameters: triangle_node - The triangle node.

Returns
A reference to a t_vertex.

Definition at line 172 of file Triangle.hpp.

References vertex().

Referenced by Bounds< 3, fltp08 >::addToBounds(), angle(), area(), as(), center(), centroid(), Bounds< 3, fltp08 >::contains(), contains(), contains(), edge(), Equals(), intersection(), intersection(), intersection(), invert(), nextVertexCCW(), nextVertexCW(), normal(), operator*(), sharesObject(), vertex(), vertex(), and vertexIndex().

◆ vertex() [2/4]

template<uint01 t_dims, class t_type, class t_vertex = Vertex<t_dims, t_type>>
const t_vertex & Triangle< t_dims, t_type, t_vertex >::vertex ( TriangleLocation triangle_node) const
inlinenodiscardconstexpr

Vertices the given triangle node.


Author: Tyler Parke

Date: 2017-11-17

Parameters: triangle_node - The triangle node.

Returns
A reference to a const t_vertex.

Definition at line 196 of file Triangle.hpp.

References vertex().

◆ vertex() [3/4]

template<uint01 t_dims, class t_type, class t_vertex = Vertex<t_dims, t_type>>
t_vertex & Triangle< t_dims, t_type, t_vertex >::vertex ( uint01 triangle_node)
inlinenodiscardconstexpr

Vertices the given triangle node.

Author: Tyler Parke

Date: 2017-11-17

Parameters: triangle_node - The triangle node.

Returns
A reference to a t_vertex.

Definition at line 220 of file Triangle.hpp.

◆ vertex() [4/4]

template<uint01 t_dims, class t_type, class t_vertex = Vertex<t_dims, t_type>>
const t_vertex & Triangle< t_dims, t_type, t_vertex >::vertex ( uint01 triangle_node) const
inlinenodiscardconstexpr

Vertices the given triangle node.

Author: Tyler Parke

Date: 2017-11-17

Parameters: triangle_node - The triangle node.

Returns
A reference to a const t_vertex.

Definition at line 239 of file Triangle.hpp.

◆ vertexIndex()

template<uint01 t_dims, class t_type, class t_vertex = Vertex<t_dims, t_type>>
uint01 Triangle< t_dims, t_type, t_vertex >::vertexIndex ( const t_vertex & p) const
inlinenodiscardconstexpr

Gets a location.

Author: Tyler Parke

Date: 2017-11-17

Parameters: p - A Vector<t_dims,t_type> to process. epsilon - (Optional) The epsilon.

Returns
The location.

Definition at line 598 of file Triangle.hpp.

References vertex().


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