A class representing static n-dimensional vectors.
A vector is a one-dimensional statically sized array, useful for representing points and directions. For a general introduction on vectors, see Math Classes. For vector's interoperation with fcppt::math::matrix::object, see Operators.
Additionally, there are arithmetic operators that take a vector on the left-hand side and a dim on the right-hand side. These are defined in fcppt/math/vector/dim.hpp
.
|
template<typename T , fcppt::math::size_type N, typename S1 , typename S2 > |
fcppt::optional::object< T > | fcppt::math::vector::angle_between (fcppt::math::vector::object< T, N, S1 > const &_from, fcppt::math::vector::object< T, N, S2 > const &_to) |
| Calculates the angle between two floating point vectors.
|
|
template<typename Dest , typename T , fcppt::math::size_type N, typename S1 , typename S2 > |
fcppt::optional::object< Dest > | fcppt::math::vector::angle_between_cast (fcppt::math::vector::object< T, N, S1 > const &_from, fcppt::math::vector::object< T, N, S2 > const &_to) |
| Calculates the angle between two arbitrary vector types.
|
|
template<typename T , fcppt::math::size_type N, typename S > |
fcppt::math::vector::static_< FCPPT_MATH_DETAIL_UNARY_TYPE(T, -), N > | fcppt::math::vector::operator- (fcppt::math::vector::object< T, N, S > const &_left) |
| Negates a vector.
|
|
template<typename L , typename R , fcppt::math::size_type N, typename S1 , typename S2 > |
fcppt::math::vector::static_< FCPPT_MATH_DETAIL_BINARY_TYPE(L,+, R), N > | fcppt::math::vector::operator+ (fcppt::math::vector::object< L, N, S1 > const &_left, fcppt::math::vector::object< R, N, S2 > const &_right) |
| Adds a vector to a vector.
|
|
template<typename L , typename R , fcppt::math::size_type N, typename S1 , typename S2 > |
fcppt::math::vector::static_< FCPPT_MATH_DETAIL_BINARY_TYPE(L, -, R), N > | fcppt::math::vector::operator- (fcppt::math::vector::object< L, N, S1 > const &_left, fcppt::math::vector::object< R, N, S2 > const &_right) |
| Subtracts a vector from a vector.
|
|
template<typename L , typename R , fcppt::math::size_type N, typename S1 , typename S2 > |
fcppt::math::vector::static_< FCPPT_MATH_DETAIL_BINARY_TYPE(L, *, R), N > | fcppt::math::vector::operator* (fcppt::math::vector::object< L, N, S1 > const &_left, fcppt::math::vector::object< R, N, S2 > const &_right) |
| Multiplies a vector by a vector.
|
|
template<typename L , typename R , fcppt::math::size_type N, typename S1 , typename S2 > |
fcppt::optional::object< fcppt::math::vector::static_< FCPPT_MATH_DETAIL_BINARY_TYPE(L,/, R), N > > | fcppt::math::vector::operator/ (fcppt::math::vector::object< L, N, S1 > const &_left, fcppt::math::vector::object< R, N, S2 > const &_right) |
| Divides a vector by a vector.
|
|
template<typename L , typename R , fcppt::math::size_type N, typename S > |
fcppt::math::vector::static_< FCPPT_MATH_DETAIL_BINARY_TYPE(L, *, R), N > | fcppt::math::vector::operator* (fcppt::math::vector::object< L, N, S > const &_left, R const &_right) |
| Multiplies a vector by a scalar on the right.
|
|
template<typename L , typename R , fcppt::math::size_type N, typename S > |
fcppt::math::vector::static_< FCPPT_MATH_DETAIL_BINARY_TYPE(L, *, R), N > | fcppt::math::vector::operator* (L const &_left, fcppt::math::vector::object< R, N, S > const &_right) |
| Multiplies a vector by a scalar on the left.
|
|
template<typename L , typename R , fcppt::math::size_type N, typename S > |
fcppt::optional::object< fcppt::math::vector::static_< FCPPT_MATH_DETAIL_BINARY_TYPE(L,/, R), N > > | fcppt::math::vector::operator/ (fcppt::math::vector::object< L, N, S > const &_left, R const &_right) |
| Divides a vector by a scalar.
|
|
template<fcppt::math::size_type Index, typename Vector > |
fcppt::container::to_reference_type< std::remove_reference_t< Vector > > | fcppt::math::vector::at (Vector &_value) |
| Access an element using a compile-time constant.
|
|
template<typename T , typename S > |
fcppt::optional::object< T > | fcppt::math::vector::atan2 (fcppt::math::vector::object< T, 2, S > const &_vector) |
| Computes atan2 of a vector.
|
|
template<typename T1 , typename T2 , fcppt::math::size_type N, typename S1 , typename S2 , typename Function > |
fcppt::math::vector::static_< std::invoke_result_t< Function, T1, T2 >, N > | fcppt::math::vector::binary_map (fcppt::math::vector::object< T1, N, S1 > const &_left, fcppt::math::vector::object< T2, N, S2 > const &_right, Function const &_function) |
| Maps over two vectors.
|
|
template<typename T , fcppt::math::size_type N> |
fcppt::array::object< fcppt::math::vector::static_< T, N >, fcppt::math::power_of_2< std::size_t >(fcppt::math::size_type{N})> | fcppt::math::vector::bit_strings () |
| Generates vectors consisting of zeros and ones.
|
|
template<typename T , fcppt::math::size_type N, typename S > |
fcppt::optional::object< fcppt::math::vector::static_< T, N > > | fcppt::math::vector::ceil_div_signed (fcppt::math::vector::object< T, N, S > const _vector, T const _divisor) |
| Division rounded up for signed vectors.
|
|
template<typename T , fcppt::math::size_type N, typename S1 , typename S2 > |
bool | fcppt::math::vector::operator== (fcppt::math::vector::object< T, N, S1 > const &_v1, fcppt::math::vector::object< T, N, S2 > const &_v2) |
| Compares two vectors for equality.
|
|
template<typename T , fcppt::math::size_type N, typename S1 , typename S2 > |
bool | fcppt::math::vector::operator!= (fcppt::math::vector::object< T, N, S1 > const &_v1, fcppt::math::vector::object< T, N, S2 > const &_v2) |
| Compares two vectors for disequality.
|
|
template<typename T , fcppt::math::size_type N, typename S1 , typename S2 > |
bool | fcppt::math::vector::componentwise_equal (fcppt::math::vector::object< T, N, S1 > const &_v1, fcppt::math::vector::object< T, N, S2 > const &_v2, T const _epsilon) |
| Compares two vectors for equality using an epsilon.
|
|
template<typename T , typename S1 , typename S2 > |
fcppt::math::vector::static_< T, 3 > | fcppt::math::vector::cross (fcppt::math::vector::object< T, 3, S1 > const &l, fcppt::math::vector::object< T, 3, S2 > const &r) |
| Calculates the cross product of two three-dimensional vectors.
|
|
template<typename L , typename R , fcppt::math::size_type N, typename S1 , typename S2 > |
fcppt::math::vector::static_< FCPPT_MATH_DETAIL_BINARY_TYPE(L,+, R), N > | fcppt::math::vector::operator+ (fcppt::math::vector::object< L, N, S1 > const &_left, fcppt::math::dim::object< R, N, S2 > const &_right) |
| Adds a dim to a vector.
|
|
template<typename L , typename R , fcppt::math::size_type N, typename S1 , typename S2 > |
fcppt::math::vector::static_< FCPPT_MATH_DETAIL_BINARY_TYPE(L, -, R), N > | fcppt::math::vector::operator- (fcppt::math::vector::object< L, N, S1 > const &_left, fcppt::math::dim::object< R, N, S2 > const &_right) |
| Subtracts a dim from a vector.
|
|
template<typename L , typename R , fcppt::math::size_type N, typename S1 , typename S2 > |
fcppt::math::vector::static_< FCPPT_MATH_DETAIL_BINARY_TYPE(L, *, R), N > | fcppt::math::vector::operator* (fcppt::math::vector::object< L, N, S1 > const &_left, fcppt::math::dim::object< R, N, S2 > const &_right) |
| Multiplies a vector by a dim.
|
|
template<typename L , typename R , fcppt::math::size_type N, typename S1 , typename S2 > |
fcppt::optional::object< fcppt::math::vector::static_< FCPPT_MATH_DETAIL_BINARY_TYPE(L,/, R), N > > | fcppt::math::vector::operator/ (fcppt::math::vector::object< L, N, S1 > const &_left, fcppt::math::dim::object< R, N, S2 > const &_right) |
| Divides a vector by a dim.
|
|
template<typename T , fcppt::math::size_type N, typename S1 , typename S2 >
requires (std::is_floating_point_v<T>) |
T | fcppt::math::vector::distance (fcppt::math::vector::object< T, N, S1 > const &_v1, fcppt::math::vector::object< T, N, S2 > const &_v2) |
| Computes the distance between two floating-point vectors.
|
|
template<typename Dest , typename T , fcppt::math::size_type N, typename S1 , typename S2 >
requires (!std::is_floating_point_v<T>) |
Dest | fcppt::math::vector::distance (fcppt::math::vector::object< T, N, S1 > const &_v1, fcppt::math::vector::object< T, N, S2 > const &_v2) |
| Computes the distance between two non floating-point vectors.
|
|
template<typename T , fcppt::math::size_type N, typename S1 , typename S2 > |
T | fcppt::math::vector::dot (fcppt::math::vector::object< T, N, S1 > const &_left, fcppt::math::vector::object< T, N, S2 > const &_right) |
| Calculates the dot product of two vectors.
|
|
template<typename Vector > |
Vector | fcppt::math::vector::fill (fcppt::type_traits::value_type< Vector > const &_value) |
| Constructs a static vector with all components set to a given value.
|
|
template<typename T , fcppt::math::size_type N, typename S > |
fcppt::math::vector::static_< T, N+1U > | fcppt::math::vector::hypersphere_to_cartesian (fcppt::math::vector::object< T, N, S > const &_angles) |
| Calculate the n dimensional polar coordinates, also called "hyperspherical coordinates".
|
|
template<typename Vector , typename Function > |
Vector | fcppt::math::vector::init (Function const &_function) |
| Initializes a vector.
|
|
template<typename T , fcppt::math::size_type N, typename S , typename Ch , typename Traits > |
std::basic_istream< Ch, Traits > & | fcppt::math::vector::operator>> (std::basic_istream< Ch, Traits > &_stream, fcppt::math::vector::object< T, N, S > &_vector) |
| Reads a vector from s , expecting it in the format.
|
|
template<typename T , fcppt::math::size_type N, typename S >
requires (std::is_floating_point_v<T>) |
T | fcppt::math::vector::length (fcppt::math::vector::object< T, N, S > const &_vec) |
| Calculates the length of a vector.
|
|
template<typename Dest , typename T , fcppt::math::size_type N, typename S >
requires (!std::is_floating_point_v<T>) |
Dest | fcppt::math::vector::length (fcppt::math::vector::object< T, N, S > const &_vec) |
| Calculates the length of a vector.
|
|
template<typename T , fcppt::math::size_type N, typename S > |
T | fcppt::math::vector::length_square (fcppt::math::vector::object< T, N, S > const &_vector) |
| Calculate the square of the vector's length.
|
|
template<typename T , fcppt::math::size_type N, typename S , typename Function > |
fcppt::math::vector::static_< std::invoke_result_t< Function, T >, N > | fcppt::math::vector::map (fcppt::math::vector::object< T, N, S > const &_value, Function const &_function) |
| Maps over the elements of a vector.
|
|
template<typename T , fcppt::math::size_type N, typename S > |
fcppt::optional::object< fcppt::math::vector::static_< T, N > > | fcppt::math::vector::mod (fcppt::math::vector::object< T, N, S > const &_arg, T const _div) |
| Calculate vector modulo a scalar.
|
|
template<typename T , fcppt::math::size_type N, typename S1 , typename S2 > |
fcppt::optional::object< fcppt::math::vector::static_< T, N > > | fcppt::math::vector::mod (fcppt::math::vector::object< T, N, S1 > const &_v0, fcppt::math::vector::object< T, N, S2 > const &_v1) |
| Calculate vector modulo a vector.
|
|
template<typename Dest , typename T , fcppt::math::size_type N, typename S > |
Dest | fcppt::math::vector::narrow_cast (fcppt::math::vector::object< T, N, S > const &_src) |
| Shortens a vector to a smaller dimension.
|
|
template<typename T , fcppt::math::size_type N, typename S > |
fcppt::optional::object< fcppt::math::vector::static_< T, N > > | fcppt::math::vector::normalize (fcppt::math::vector::object< T, N, S > const &_vec) |
| Normalizes a vector.
|
|
template<typename Vector > |
fcppt::math::vector::static_< fcppt::type_traits::value_type< Vector >, Vector::static_size::value > | fcppt::math::vector::null () |
| Returns the null vector.
|
|
template<typename T , fcppt::math::size_type N, typename S , typename Ch , typename Traits > |
std::basic_ostream< Ch, Traits > & | fcppt::math::vector::operator<< (std::basic_ostream< Ch, Traits > &_stream, fcppt::math::vector::object< T, N, S > const &_vector) |
| Outputs a vector to a stream.
|
|
template<typename T , fcppt::math::size_type N, typename S > |
fcppt::math::vector::static_< T, N > | fcppt::math::vector::point_rotate (fcppt::math::vector::object< T, N, S > const &_point, fcppt::math::vector::object< T, N, S > const &_around, T const _rot) |
| Rotates a two dimensional point around another point.
|
|
template<typename T , fcppt::math::size_type N, typename S > |
fcppt::math::vector::static_< T, N+1 > | fcppt::math::vector::push_back (fcppt::math::vector::object< T, N, S > const &_vector, T const &_value) |
| Pushes an element to the back of a vector.
|
|
template<typename T , fcppt::math::size_type N, typename S > |
fcppt::optional::object< fcppt::math::vector::static_< T, N > > | fcppt::math::vector::sequence (fcppt::math::vector::object< fcppt::optional::object< T >, N, S > const &_value) |
| Sequence for a vector.
|
|
template<typename T , typename S1 , typename S2 > |
fcppt::optional::object< T > | fcppt::math::vector::signed_angle_between (fcppt::math::vector::object< T, 2, S1 > const &_from, fcppt::math::vector::object< T, 2, S2 > const &_to) |
| Calculates the signed angle between two 2D vectors.
|
|
template<typename Dest , typename T , typename S1 , typename S2 > |
fcppt::optional::object< Dest > | fcppt::math::vector::signed_angle_between_cast (fcppt::math::vector::object< T, 2, S1 > const &_from, fcppt::math::vector::object< T, 2, S2 > const &_to) |
| Calculates the signed angle between two arbitrary 2D vector types.
|
|
template<typename Dest , typename Conv , typename T , fcppt::math::size_type N, typename S > |
Dest | fcppt::math::vector::structure_cast (fcppt::math::vector::object< T, N, S > const &_src) |
| Converts a vector into a different vector of the same dimension.
|
|
template<typename T , fcppt::math::size_type N, typename S > |
fcppt::math::dim::static_< T, N > | fcppt::math::vector::to_dim (fcppt::math::vector::object< T, N, S > const &_src) |
| Converts a vector into a corresponding dim.
|
|
template<typename T , fcppt::math::size_type N, typename S > |
fcppt::math::vector::static_< std::make_signed_t< T >, N > | fcppt::math::vector::to_signed (fcppt::math::vector::object< T, N, S > const &_src) |
| Converts a vector into a corresponding signed vector.
|
|
template<typename T , fcppt::math::size_type N, typename S > |
fcppt::math::vector::static_< std::make_unsigned_t< T >, N > | fcppt::math::vector::to_unsigned (fcppt::math::vector::object< T, N, S > const &_src) |
| Converts a vector into a corresponding unsigned vector.
|
|
template<typename Vec > |
Vec | fcppt::math::vector::unit (typename Vec::size_type const _axis) |
| Returns the n-th basis vector of the canonical basis.
|
|