NDEVR
API Documentation
Bounds< t_dims, t_type, t_vertex >

A specification of upper and lower bounds in N-dimensions. More...

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

Public Member Functions

constexpr Bounds (const t_vertex &center, t_type size)
 Given the center, creates bounds of size where max and min are both equal to the vertex + size and.
constexpr Bounds (const t_vertex &vertex)
 Given the vector, creates bounds of size 0 where max and min are both equal to the vertex.
constexpr void addToBounds (const Bounds &bounds)
constexpr void addToBounds (const LineSegment< t_dims, t_type, t_vertex > &line_segment)
constexpr void addToBounds (const t_vertex &vector)
constexpr void addToBounds (const Triangle< t_dims, t_type, t_vertex > &triangle)
template<uint01 t_new_dims, class t_new_type, class t_new_vertex = Vertex<t_new_dims, t_new_type>>
constexpr decltype(auto) as (t_new_type extra_fill_value=t_new_type(0)) const
 Casts this object into an object of different dimension or precision.
constexpr t_vertex center () const
 Returns the center of the bounds.
constexpr t_type center (uint01 dim) const
 Returns the center of the bounds in a single dimention.
constexpr t_vertex closestEdge (const t_vertex &vertex) const
constexpr t_vertex closestValue (const t_vertex &vertex) const
template<bool t_allow_bounds = true>
constexpr bool contains (const Bounds &bounds) const
template<bool t_allow_bounds = true>
constexpr bool contains (const LineSegment< t_dims, t_type, t_vertex > &line) const
 Author: Tyler Parke.
template<bool t_allow_bounds = true>
constexpr bool contains (const RadialObject< t_dims, t_type > &radial_object) const
template<bool t_allow_bounds = true, uint01 tdims = t_dims, typename = typename std::enable_if<tdims == 1>::type>
constexpr bool contains (const t_type &value) const
 Query if this object contains the given value.
template<bool t_allow_bounds = true>
constexpr bool contains (const t_vertex &vector) const
 Query if this object contains the given vector.
template<bool t_allow_bounds = true>
constexpr bool contains (const Triangle< t_dims, t_type, t_vertex > &tri) const
constexpr bool doesIntersect (t_type distance_a, t_type distance_b, const t_vertex &origin, const Vector< t_dims, t_type > &ray, uint01 exclusion_axis) const
 Checks for intersection of the ray from a given distance, excluding one axis.
void ensureValid ()
 Ensures that this is a valid bounds object.
constexpr void expand (const t_type &expansion_scaler)
 Expands the given expansion scaler.
constexpr void expand (const t_vertex &expansion_vector)
 Expands the given expansion scaler.
constexpr t_vertex furthestValue (const t_vertex &vertex) const
template<class t_other_vertex_type>
constexpr bool intersects (const Bounds< t_dims, t_type, t_other_vertex_type > &bounds) const
template<bool t_allow_bounds = true>
constexpr bool intersects (const RadialObject< t_dims, t_type > &circle) const
 Query if this object contains the given circle.
constexpr Bounds< t_dims, t_type > scale (const Vector< t_dims, t_type > &scale, const Vector< t_dims, t_type > &center) const
 Scales this geometry about a center point.
constexpr Ray< t_dims, t_type > span () const
 The side lengths of these bounds.
constexpr t_type span (uint01 dim) const
 The side length of one axis of the bounds.
constexpr t_type surfaceArea () const
 The surface area of the shape.
constexpr bool validate () const
 Validates this object.
constexpr t_type volume () const
 Returns the volume of the bounds.
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.
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 Bounds< t_dims, t_type, t_vertex >

A specification of upper and lower bounds in N-dimensions.


Class: Bounds

Author: Tyler Parke

Date: 2017-11-17

\see Vector, Vertex, LineSegment, Triangle

Definition at line 53 of file Bounds.hpp.

Constructor & Destructor Documentation

◆ Bounds() [1/2]

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

Given the vector, creates bounds of size 0 where max and min are both equal to the vertex.

Parameters
[in]vertexThe vertex around which a bounds of size 0 will be made.

Definition at line 63 of file Bounds.hpp.

◆ Bounds() [2/2]

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

Given the center, creates bounds of size where max and min are both equal to the vertex + size and.

  • size respectively.
    Parameters
    [in]center- The center of the bounds.
    [in]size- The size of the bounds.

Definition at line 74 of file Bounds.hpp.

Member Function Documentation

◆ addToBounds() [1/4]

template<uint01 t_dims, class t_type, class t_vertex = Vertex<t_dims, t_type>>
void Bounds< t_dims, t_type, t_vertex >::addToBounds ( const Bounds< t_dims, t_type, t_vertex > & bounds)
inlineconstexpr
    \brief Adds to the bounds such that the new bounds fully encompasses the argument.

Author: Tyler Parke.

Date: 2017-11-17.

Parameters:

Parameters
[in]bounds- The bounds to add to this bounds.

Definition at line 449 of file Bounds.hpp.

◆ addToBounds() [2/4]

template<uint01 t_dims, class t_type, class t_vertex = Vertex<t_dims, t_type>>
void Bounds< t_dims, t_type, t_vertex >::addToBounds ( const LineSegment< t_dims, t_type, t_vertex > & line_segment)
inlineconstexpr
    \brief Adds to the bounds such that the new bounds fully encompasses the argument.

Author: Tyler Parke.

Date: 2017-11-17.

Parameters:

Parameters
[in]line_segment- The line segment.

Definition at line 472 of file Bounds.hpp.

◆ addToBounds() [3/4]

template<uint01 t_dims, class t_type, class t_vertex = Vertex<t_dims, t_type>>
void Bounds< t_dims, t_type, t_vertex >::addToBounds ( const t_vertex & vector)
inlineconstexpr

◆ addToBounds() [4/4]

template<uint01 t_dims, class t_type, class t_vertex = Vertex<t_dims, t_type>>
void Bounds< t_dims, t_type, t_vertex >::addToBounds ( const Triangle< t_dims, t_type, t_vertex > & triangle)
inlineconstexpr
    \brief Adds to the bounds such that the new bounds fully encompesses the argument.

Author: Tyler Parke.

Date: 2017-11-17.

Parameters:

Parameters
[in]triangle- The triangle.

Definition at line 490 of file Bounds.hpp.

◆ 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>>
decltype(auto) Bounds< t_dims, t_type, t_vertex >::as ( t_new_type extra_fill_value = t_new_type(0)) const
inlineconstexpr

Casts this object into an object of different dimension or precision.

Parameters
[in]extra_fill_value(Optional) The extra fill value, or value to set dimensions extra that may be created when t_new_dim > t_dim.

Definition at line 236 of file Bounds.hpp.

Referenced by TableVectorType< 1, T >::set(), and TableVectorType< 1, T >::set().

◆ center() [1/2]

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

Returns the center of the bounds.

Returns
A t_vertex representing the center.

Definition at line 129 of file Bounds.hpp.

Referenced by GravityIntersection::FindGravityPoints(), and TreeBoundarySorter< t_dims, t_type >::getBounds().

◆ center() [2/2]

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

Returns the center of the bounds in a single dimention.

Returns
A Vertex representing the center.

Definition at line 137 of file Bounds.hpp.

◆ closestEdge()

template<uint01 t_dims, class t_type, class t_vertex = Vertex<t_dims, t_type>>
t_vertex Bounds< t_dims, t_type, t_vertex >::closestEdge ( const t_vertex & vertex) const
inlineconstexpr
    \brief Closest edge.

Author: Tyler Parke.

Date: 2017 - 11-17.

Parameters:

Parameters
[in]vertex- The first t_vertex.
Returns
The closest edge.

Definition at line 532 of file Bounds.hpp.

Referenced by Bounds< 3, fltp08 >::contains().

◆ closestValue()

template<uint01 t_dims, class t_type, class t_vertex = Vertex<t_dims, t_type>>
t_vertex Bounds< t_dims, t_type, t_vertex >::closestValue ( const t_vertex & vertex) const
inlineconstexpr
    \brief Closest value.

Author: Tyler Parke.

Date: 2017 - 11-17.

Parameters:

Parameters
[in]vertex- The first t_vertex.
Returns
The closest element.

Definition at line 554 of file Bounds.hpp.

◆ contains() [1/6]

template<uint01 t_dims, class t_type, class t_vertex = Vertex<t_dims, t_type>>
template<bool t_allow_bounds = true>
bool Bounds< t_dims, t_type, t_vertex >::contains ( const Bounds< t_dims, t_type, t_vertex > & bounds) const
inlineconstexpr
    \brief Query if this object contains the given bounds.

Author: Tyler Parke

Date: 2017-11-17

Parameters: t_allow_bounds - whether or not to allow boundary cases to be considered valid.

Parameters
[in]bounds- The bounds to check if it is inside object.
Returns
True if it succeeds, false if it fails.

Definition at line 319 of file Bounds.hpp.

◆ contains() [2/6]

template<uint01 t_dims, class t_type, class t_vertex = Vertex<t_dims, t_type>>
template<bool t_allow_bounds = true>
bool Bounds< t_dims, t_type, t_vertex >::contains ( const LineSegment< t_dims, t_type, t_vertex > & line) const
inlineconstexpr

Author: Tyler Parke.

    Fully contains.

Date: 2017-11-17

Parameters:

Parameters
[in]line- The vector.
Returns
True if it succeeds, false if it fails.

Definition at line 357 of file Bounds.hpp.

◆ contains() [3/6]

template<uint01 t_dims, class t_type, class t_vertex = Vertex<t_dims, t_type>>
template<bool t_allow_bounds = true>
bool Bounds< t_dims, t_type, t_vertex >::contains ( const RadialObject< t_dims, t_type > & radial_object) const
inlineconstexpr
    \brief Query if this object contains the given radial_object.

Author: Tyler Parke

Date: 2017-11-18

Parameters:

Parameters
[in]radial_object- The const RadialObject<t_dims,t_type>& to test for containment.
Returns
True if the object is in this collection, false if not.

Definition at line 510 of file Bounds.hpp.

◆ contains() [4/6]

template<uint01 t_dims, class t_type, class t_vertex = Vertex<t_dims, t_type>>
template<bool t_allow_bounds = true, uint01 tdims = t_dims, typename = typename std::enable_if<tdims == 1>::type>
bool Bounds< t_dims, t_type, t_vertex >::contains ( const t_type & value) const
inlineconstexpr

Query if this object contains the given value.

t_allow_bounds - whether or not to allow boundary cases to be considered valid.

Parameters
[in]valueThe const t_vertex& to test for containment.
Returns
True if the object is in the bounds, false if not.

Definition at line 262 of file Bounds.hpp.

◆ contains() [5/6]

template<uint01 t_dims, class t_type, class t_vertex = Vertex<t_dims, t_type>>
template<bool t_allow_bounds = true>
bool Bounds< t_dims, t_type, t_vertex >::contains ( const t_vertex & vector) const
inlineconstexpr

Query if this object contains the given vector.

t_allow_bounds - whether or not to allow boundary cases to be considered valid.

Parameters
[in]vector- The const t_vertex& to test for containment.
Returns
True if the object is in the bounds, false if not.

Definition at line 283 of file Bounds.hpp.

◆ contains() [6/6]

template<uint01 t_dims, class t_type, class t_vertex = Vertex<t_dims, t_type>>
template<bool t_allow_bounds = true>
bool Bounds< t_dims, t_type, t_vertex >::contains ( const Triangle< t_dims, t_type, t_vertex > & tri) const
inlineconstexpr
    \brief Fully contains.

Author: Tyler Parke

Date: 2017-11-17

Parameters:

Parameters
[in]tri- The triangle.
Returns
True if it succeeds, false if it fails.

Definition at line 396 of file Bounds.hpp.

◆ doesIntersect()

template<uint01 t_dims, class t_type, class t_vertex = Vertex<t_dims, t_type>>
bool Bounds< t_dims, t_type, t_vertex >::doesIntersect ( t_type distance_a,
t_type distance_b,
const t_vertex & origin,
const Vector< t_dims, t_type > & ray,
uint01 exclusion_axis ) const
inlineconstexpr

Checks for intersection of the ray from a given distance, excluding one axis.

Author: Tyler Parke

Date: 2017-11-18

Parameters:

Parameters
[in]distance_a- The distance a.
[in]distance_b- The distance b.
[in]origin- The origin.
[in]ray- The ray.
[in]exclusion_axis- The exclusion axis.
Returns
True if it succeeds, false if it fails.

< for Invalid

Definition at line 602 of file Bounds.hpp.

◆ ensureValid()

template<uint01 t_dims, class t_type, class t_vertex = Vertex<t_dims, t_type>>
void Bounds< t_dims, t_type, t_vertex >::ensureValid ( )
inline

Ensures that this is a valid bounds object.

Values are swapped within the structure to ensure that MAX >= MIN

Definition at line 717 of file Bounds.hpp.

◆ expand() [1/2]

template<uint01 t_dims, class t_type, class t_vertex = Vertex<t_dims, t_type>>
void Bounds< t_dims, t_type, t_vertex >::expand ( const t_type & expansion_scaler)
inlineconstexpr

Expands the given expansion scaler.

such that max and min are both expanded outward from the center by the given expansion scaler

Parameters
[in]expansion_scaler- The expansion scaler.

Definition at line 177 of file Bounds.hpp.

◆ expand() [2/2]

template<uint01 t_dims, class t_type, class t_vertex = Vertex<t_dims, t_type>>
void Bounds< t_dims, t_type, t_vertex >::expand ( const t_vertex & expansion_vector)
inlineconstexpr

Expands the given expansion scaler.

such that max and min are both expanded outward from the center by the given expansion vector. That is that each dimension may be scaled out differently.

Parameters
[in]expansion_vector- The expansion vector.

Definition at line 189 of file Bounds.hpp.

◆ furthestValue()

template<uint01 t_dims, class t_type, class t_vertex = Vertex<t_dims, t_type>>
t_vertex Bounds< t_dims, t_type, t_vertex >::furthestValue ( const t_vertex & vertex) const
inlineconstexpr
    \brief Furthest value.

Author: Tyler Parke.

Date: 2017 - 11-17.

Parameters:

Parameters
[in]vertex- The first t_vertex.
Returns
The furthest point.

Definition at line 576 of file Bounds.hpp.

◆ intersects() [1/2]

template<uint01 t_dims, class t_type, class t_vertex = Vertex<t_dims, t_type>>
template<class t_other_vertex_type>
bool Bounds< t_dims, t_type, t_vertex >::intersects ( const Bounds< t_dims, t_type, t_other_vertex_type > & bounds) const
inlineconstexpr
    \brief Query if this object intersects the given pair.

Author: Tyler Parke

Date: 2017-11-17

Parameters:

Parameters
[in]bounds- The pair.
Returns
True if it succeeds, false if it fails.

Definition at line 636 of file Bounds.hpp.

◆ intersects() [2/2]

template<uint01 t_dims, class t_type, class t_vertex = Vertex<t_dims, t_type>>
template<bool t_allow_bounds = true>
bool Bounds< t_dims, t_type, t_vertex >::intersects ( const RadialObject< t_dims, t_type > & circle) const
inlineconstexpr

Query if this object contains the given circle.

Parameters
[in]circle- The const RadialObject<t_rad_dims,t_rad_type>& to test for containment.
Returns
True if the object is in this collection, false if not.

Definition at line 670 of file Bounds.hpp.

◆ scale()

template<uint01 t_dims, class t_type, class t_vertex = Vertex<t_dims, t_type>>
Bounds< t_dims, t_type > Bounds< t_dims, t_type, t_vertex >::scale ( const Vector< t_dims, t_type > & scale,
const Vector< t_dims, t_type > & center ) const
inlineconstexpr

Scales this geometry about a center point.

Parameters
[in]scale- The scale.
[in]center- The center.
Returns
A Bounds<t_dims,t_type>

Definition at line 201 of file Bounds.hpp.

◆ span() [1/2]

template<uint01 t_dims, class t_type, class t_vertex = Vertex<t_dims, t_type>>
Ray< t_dims, t_type > Bounds< t_dims, t_type, t_vertex >::span ( ) const
inlineconstexpr

◆ span() [2/2]

template<uint01 t_dims, class t_type, class t_vertex = Vertex<t_dims, t_type>>
t_type Bounds< t_dims, t_type, t_vertex >::span ( uint01 dim) const
inlineconstexpr

The side length of one axis of the bounds.

The span is max[dim - min[dim].

Returns
A Ray defining the span of the range in the specified dimension.

Definition at line 121 of file Bounds.hpp.

◆ surfaceArea()

template<uint01 t_dims, class t_type, class t_vertex = Vertex<t_dims, t_type>>
t_type Bounds< t_dims, t_type, t_vertex >::surfaceArea ( ) const
inlineconstexpr

The surface area of the shape.

This is defined as the area between internal space and non-internal space.

Returns
A t_type representing the area of the surface created by the bounds.

Definition at line 154 of file Bounds.hpp.

◆ validate()

template<uint01 t_dims, class t_type, class t_vertex = Vertex<t_dims, t_type>>
bool Bounds< t_dims, t_type, t_vertex >::validate ( ) const
inlinenodiscardconstexpr

Validates this object.

Returns true if the value at MIN is less than or equal the value at MAX in all dimensions.

Returns
True if it succeeds, false if it fails.

Definition at line 704 of file Bounds.hpp.

◆ volume()

template<uint01 t_dims, class t_type, class t_vertex = Vertex<t_dims, t_type>>
t_type Bounds< t_dims, t_type, t_vertex >::volume ( ) const
inlineconstexpr

Returns the volume of the bounds.

This is defined as length in 1 dimension, area in 2 dimensions.

Returns
A t_type giving the volume of the bounds.

Definition at line 146 of file Bounds.hpp.


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