Ion
|
Namespaces | |
internal | |
Internal helper functions. | |
Classes | |
class | Angle |
A simple class to represent angles. More... | |
class | FieldOfView |
Encapsulates a generalized, asymmetric field of view with four half angles. More... | |
class | Matrix |
The Matrix class defines a square N-dimensional matrix. More... | |
struct | Range1TWrapper |
This struct allows the Endpoint and Size types in a Range<1, T> to be treated like those of higher-dimension Range classes (specifically the use of index operators) to simplify templated functions that use them. More... | |
class | RangeBase |
The RangeBase class makes it possible to treat Ranges with Dimension=1 specially. More... | |
class | RangeBase< 1, T > |
Specialize for Dimension=1. More... | |
class | Range |
The Range class defines an N-dimensional interval defined by minimum and maximum N-dimensional endpoints. More... | |
class | Rotation |
The Rotation class represents a rotation around a 3-dimensional axis. More... | |
class | VectorBase |
VectorBase. More... | |
class | Vector |
Vector. More... | |
class | Point |
Point. More... | |
Typedefs | |
typedef Angle< float > | Anglef |
Type-specific typedefs. More... | |
typedef Angle< double > | Angled |
typedef FieldOfView< float > | FieldOfViewf |
typedef FieldOfView< double > | FieldOfViewd |
typedef Matrix< 2, float > | Matrix2f |
Dimension- and type-specific typedefs. More... | |
typedef Matrix< 2, double > | Matrix2d |
typedef Matrix< 3, float > | Matrix3f |
typedef Matrix< 3, double > | Matrix3d |
typedef Matrix< 4, float > | Matrix4f |
typedef Matrix< 4, double > | Matrix4d |
typedef Range< 1, int8 > | Range1i8 |
Dimension- and type-specific typedefs. More... | |
typedef Range< 1, uint8 > | Range1ui8 |
typedef Range< 1, int16 > | Range1i16 |
typedef Range< 1, uint16 > | Range1ui16 |
typedef Range< 1, int32 > | Range1i |
typedef Range< 1, uint32 > | Range1ui |
typedef Range< 1, float > | Range1f |
typedef Range< 1, double > | Range1d |
typedef Range< 2, int8 > | Range2i8 |
typedef Range< 2, uint8 > | Range2ui8 |
typedef Range< 2, int16 > | Range2i16 |
typedef Range< 2, uint16 > | Range2ui16 |
typedef Range< 2, int32 > | Range2i |
typedef Range< 2, uint32 > | Range2ui |
typedef Range< 2, float > | Range2f |
typedef Range< 2, double > | Range2d |
typedef Range< 3, int8 > | Range3i8 |
typedef Range< 3, uint8 > | Range3ui8 |
typedef Range< 3, int16 > | Range3i16 |
typedef Range< 3, uint16 > | Range3ui16 |
typedef Range< 3, int32 > | Range3i |
typedef Range< 3, uint32 > | Range3ui |
typedef Range< 3, float > | Range3f |
typedef Range< 3, double > | Range3d |
typedef Range< 4, int8 > | Range4i8 |
typedef Range< 4, uint8 > | Range4ui8 |
typedef Range< 4, int16 > | Range4i16 |
typedef Range< 4, uint16 > | Range4ui16 |
typedef Range< 4, int32 > | Range4i |
typedef Range< 4, uint32 > | Range4ui |
typedef Range< 4, float > | Range4f |
typedef Range< 4, double > | Range4d |
typedef Rotation< float > | Rotationf |
Type-specific typedefs. More... | |
typedef Rotation< double > | Rotationd |
Functions | |
template<typename T > | |
std::ostream & | operator<< (std::ostream &out, const Angle< T > &a) |
An Angle is streamed as degrees. More... | |
template<typename T > | |
std::istream & | operator>> (std::istream &in, Angle< T > &a) |
template<typename T > | |
Angle< T > | ArcCosine (T v) |
Returns the inverse cosine of the given value. More... | |
template<> | |
Angle< float > | ArcCosine (float v) |
float specialization of ArcCosine. More... | |
template<typename T > | |
Angle< T > | ArcSine (T v) |
Returns the inverse sine of the given value. More... | |
template<> | |
Angle< float > | ArcSine (float v) |
float specialization of ArcSine. More... | |
template<typename T > | |
Angle< T > | ArcTangent (T v) |
Returns the inverse tangent of the given value. More... | |
template<> | |
Angle< float > | ArcTangent (float v) |
float specialization of ArcTan. More... | |
template<typename T > | |
Angle< T > | ArcTangent2 (T y, T x) |
Returns the four-quadrant inverse tangent of the given values. More... | |
template<> | |
Angle< float > | ArcTangent2 (float y, float x) |
float specialization of ArcTangent2. More... | |
template<typename T > | |
T | Cosine (const ion::math::Angle< T > &angle) |
ion::math::Angle specialization of Cosine. More... | |
template<typename T > | |
T | Sine (const ion::math::Angle< T > &angle) |
ion::math::Angle specialization of Sine. More... | |
template<typename T > | |
T | Tangent (const ion::math::Angle< T > &angle) |
ion::math::Angle specialization of Tangent. More... | |
template<int Dimension, typename T > | |
Angle< T > | AngleBetween (const ion::math::Vector< Dimension, T > &a, const ion::math::Vector< Dimension, T > &b) |
Returns the angle between two unit vectors. More... | |
template<typename T > | |
std::ostream & | operator<< (std::ostream &out, const FieldOfView< T > &f) |
template<typename T > | |
std::istream & | operator>> (std::istream &in, FieldOfView< T > &f) |
template<int Dimension, typename T > | |
std::ostream & | operator<< (std::ostream &out, const Matrix< Dimension, T > &m) |
Prints a Matrix to a stream. More... | |
template<int Dimension, typename T > | |
std::istream & | operator>> (std::istream &in, Matrix< Dimension, T > &m) |
Reads a Matrix from a stream. More... | |
template<int Dimension, typename T > | |
T | Determinant (const Matrix< Dimension, T > &m) |
Public functions. More... | |
template<int Dimension, typename T > | |
Matrix< Dimension, T > | CofactorMatrix (const Matrix< Dimension, T > &m) |
Returns the signed cofactor matrix (adjunct) of the matrix. More... | |
template<int Dimension, typename T > | |
Matrix< Dimension, T > | AdjugateWithDeterminant (const Matrix< Dimension, T > &m, T *determinant) |
Returns the adjugate of the matrix, which is defined as the transpose of the cofactor matrix. More... | |
template<int Dimension, typename T > | |
Matrix< Dimension, T > | InverseWithDeterminant (const Matrix< Dimension, T > &m, T *determinant) |
Returns the inverse of the matrix. More... | |
template<int Dimension, typename T > | |
bool | MatrixAlmostOrthogonal (const Matrix< Dimension, T > &m, T tolerance) |
Returns true if the dot product of all column vector pairs in the matrix is less than a provided tolerance, and if all column vectors have unit length. More... | |
ION_SPECIALIZE_MATRIX_FUNCS (2, float) | |
ION_SPECIALIZE_MATRIX_FUNCS (2, double) | |
ION_SPECIALIZE_MATRIX_FUNCS (3, float) | |
ION_SPECIALIZE_MATRIX_FUNCS (3, double) | |
ION_SPECIALIZE_MATRIX_FUNCS (4, float) | |
ION_SPECIALIZE_MATRIX_FUNCS (4, double) | |
template<int Dimension, typename T > | |
Matrix< Dimension, T > | Transpose (const Matrix< Dimension, T > &m) |
Public functions. More... | |
template<int Dimension, typename T > | |
Vector< Dimension, T > | operator* (const Matrix< Dimension, T > &m, const Vector< Dimension, T > &v) |
Multiplies a Matrix and a column Vector of the same Dimension to produce another column Vector. More... | |
template<int Dimension, typename T > | |
Point< Dimension, T > | operator* (const Matrix< Dimension, T > &m, const Point< Dimension, T > &p) |
Multiplies a Matrix and a Point of the same Dimension to produce another Point. More... | |
template<int Dimension, typename T > | |
Vector< Dimension, T > | Row (const Matrix< Dimension, T > &m, int row) |
Returns a particular row of a matrix as a vector. More... | |
template<int Dimension, typename T > | |
Vector< Dimension, T > | Column (const Matrix< Dimension, T > &m, int col) |
Returns a particular column of a matrix as a vector. More... | |
template<int Dimension, typename T > | |
ION_API T | Determinant (const Matrix< Dimension, T > &m) |
Returns the determinant of the matrix. More... | |
template<int Dimension, typename T > | |
ION_API Matrix< Dimension, T > | CofactorMatrix (const Matrix< Dimension, T > &m) |
Returns the signed cofactor matrix (adjunct) of the matrix. More... | |
template<int Dimension, typename T > | |
ION_API Matrix< Dimension, T > | AdjugateWithDeterminant (const Matrix< Dimension, T > &m, T *determinant) |
Returns the adjugate of the matrix, which is defined as the transpose of the cofactor matrix. More... | |
template<int Dimension, typename T > | |
Matrix< Dimension, T > | Adjugate (const Matrix< Dimension, T > &m) |
Returns the adjugate of the matrix, which is defined as the transpose of the cofactor matrix. More... | |
template<int Dimension, typename T > | |
ION_API Matrix< Dimension, T > | InverseWithDeterminant (const Matrix< Dimension, T > &m, T *determinant) |
Returns the inverse of the matrix. More... | |
template<int Dimension, typename T > | |
Matrix< Dimension, T > | Inverse (const Matrix< Dimension, T > &m) |
Returns the inverse of the matrix. More... | |
template<typename T > | |
std::istream & | operator>> (std::istream &in, Range1TWrapper< T, 0 > &w) |
template<int Dimension, typename T > | |
std::ostream & | operator<< (std::ostream &out, const Range< Dimension, T > &r) |
Prints a Range to a stream. More... | |
template<int Dimension, typename T > | |
std::istream & | operator>> (std::istream &in, Range< Dimension, T > &r) |
Reads a Range from a stream. More... | |
template<int Dimension, typename T > | |
const Range< Dimension, T > | RangeUnion (const Range< Dimension, T > &r0, const Range< Dimension, T > &r1) |
Returns the union of two Range instances. More... | |
template<int Dimension, typename T > | |
const Range< Dimension, T > | RangeIntersection (const Range< Dimension, T > &r0, const Range< Dimension, T > &r1) |
Returns the intersection of two Range instances. More... | |
template<int Dimension, typename T > | |
T | NVolume (const Range< Dimension, T > &r) |
Returns the NVolume of a Range, which is the product of its sizes in all dimensions. More... | |
template<int Dimension, typename T > | |
bool | RangesAlmostEqual (const Range< Dimension, T > &r0, const Range< Dimension, T > &r1, const T threshold) |
Returns true if all dimensions of the two ranges are equal within the threshold. More... | |
template<int Dimension, typename T > | |
const Range< Dimension, T > | ScaleRange (const Range< Dimension, T > &r, T scale_factor) |
Returns a Range that is the input Range scaled uniformly about its center by the given factor. More... | |
template<int Dimension, typename T > | |
const Range< Dimension, T > | ScaleRangeNonUniformly (const Range< Dimension, T > &r, const Vector< Dimension, T > scale_factors) |
Returns a Range that is the input Range scaled nonuniformly about its center by the given per-dimension factors. More... | |
template<int Dimension, typename T1 , typename T2 > | |
const Range< Dimension, T1 > | ModulateRange (const Range< Dimension, T1 > &r, const Vector< Dimension, T2 > modulation) |
Modulate a Range by a Vector. More... | |
ION_INSTANTIATE_ROTATION_FUNCTIONS (double) | |
ION_INSTANTIATE_ROTATION_FUNCTIONS (float) | |
template<typename T > | |
std::ostream & | operator<< (std::ostream &out, const Rotation< T > &a) |
Prints a Rotation to a stream. More... | |
template<typename T > | |
std::istream & | operator>> (std::istream &in, Rotation< T > &a) |
Reads a Rotation from a stream. More... | |
template<typename T > | |
const Matrix< 4, T > | OrthoInverseH (const Matrix< 4, T > &m) |
Public functions. More... | |
template<typename T > | |
ION_API const Matrix< 4, T > | RotationMatrixH (const Rotation< T > &r) |
Returns a 4x4 Matrix representing a 3D rotation. More... | |
template<typename T > | |
ION_API const Matrix< 3, T > | RotationMatrixNH (const Rotation< T > &r) |
Returns a 3x3 Matrix representing a 3D rotation. More... | |
template<typename T > | |
ION_API const Matrix< 4, T > | LookAtMatrixFromCenter (const Point< 3, T > &eye, const Point< 3, T > ¢er, const Vector< 3, T > &up) |
View matrices. More... | |
template<typename T > | |
ION_API const Matrix< 4, T > | LookAtMatrixFromDir (const Point< 3, T > &eye, const Vector< 3, T > &dir, const Vector< 3, T > &up) |
Returns a 4x4 viewing matrix based on the given camera parameters, which use a view direction rather than look at center point. More... | |
template<typename T > | |
ION_API const Matrix< 4, T > | OrthographicMatrixFromFrustum (T x_left, T x_right, T y_bottom, T y_top, T z_near, T z_far) |
Projection matrices. More... | |
template<typename T > | |
ION_API const Matrix< 4, T > | PerspectiveMatrixFromFrustum (T x_left, T x_right, T y_bottom, T y_top, T z_near, T z_far) |
Returns a 4x4 perspective projection matrix based on the given parameters, which follow the conventions of the old glFrustum() function. More... | |
template<typename T > | |
ION_API const Matrix< 4, T > | PerspectiveMatrixFromView (const Angle< T > &fovy, T aspect, T z_near, T z_far) |
Returns a 4x4 perspective projection matrix based on the given parameters, which follow the conventions of the gluPerspective() function. More... | |
template<typename T > | |
ION_API const Matrix< 4, T > | PerspectiveMatrixInverse (const Matrix< 4, T > &m) |
Returns the inverse of m iff m is a perspective projection matrix, i.e., iff it has the following form:
[X 0 A 0]
[0 Y B 0]
[0 0 C D]
[0 0 -1 0]
Triggers a DCHECK otherwise. More... | |
ION_INSTANTIATE_FUNCTIONS (double) | |
ION_INSTANTIATE_FUNCTIONS (float) | |
template<int Dimension, typename T > | |
const Vector< Dimension, T > | operator* (const Matrix< Dimension+1, T > &m, const Vector< Dimension, T > &v) |
Transforming vectors and points. More... | |
template<int Dimension, typename T > | |
const Point< Dimension, T > | operator* (const Matrix< Dimension+1, T > &m, const Point< Dimension, T > &p) |
Multiplies a Matrix and a Point of one smaller Dimension (the template parameter) to produce another Point. More... | |
template<int Dimension, typename T > | |
const Point< Dimension, T > | ProjectPoint (const Matrix< Dimension+1, T > &m, const Point< Dimension, T > &p) |
Multiplies a Matrix and a Point of one smaller Dimension (the template parameter) to produce another Point and projects it by dividing by the homogeneous coordinate. More... | |
template<typename T > | |
Matrix< 3, T > | NonhomogeneousSubmatrixH (const Matrix< 4, T > &m) |
Homogeneous matrices. More... | |
template<int Dimension, typename T > | |
const Matrix< Dimension+1, T > | TranslationMatrix (const VectorBase< Dimension, T > &t) |
Affine transformation matrices. More... | |
template<int Dimension, typename T > | |
const Matrix< Dimension+1, T > | ScaleMatrixH (const Vector< Dimension, T > &s) |
Returns a Matrix representing a scale by the factors in a Vector whose Dimension is one less than the Dimension of the Matrix. More... | |
template<int Dimension, typename T > | |
const Matrix< Dimension, T > | ScaleMatrixNH (const Vector< Dimension, T > &s) |
Returns a Matrix representing a scale by the factors in a Vector, which is the same Dimension as the Matrix. More... | |
template<typename T > | |
const Matrix< 4, T > | RotationMatrixAxisAngleH (const Vector< 3, T > &axis, const Angle< T > &angle) |
Returns a 4x4 Matrix representing a 3D rotation specified as axis and angle. More... | |
template<typename T > | |
const Matrix< 3, T > | RotationMatrixAxisAngleNH (const Vector< 3, T > &axis, const Angle< T > &angle) |
Returns a 3x3 Matrix representing a 3D rotation specified as axis and angle. More... | |
template<typename T > | |
const Matrix< 4, T > | PerspectiveMatrixInverse (const Matrix< 4, T > &m) |
Returns the inverse of m iff m is a perspective projection matrix, i.e., iff it has the following form:
[X 0 A 0]
[0 Y B 0]
[0 0 C D]
[0 0 -1 0]
Triggers a DCHECK otherwise. More... | |
template<typename T > | |
bool | IsFinite (T x) |
Tests whether a numeric value is finite. More... | |
template<typename T > | |
const T | Abs (const T &val) |
Returns the absolute value of a number in a type-safe way. More... | |
template<typename T > | |
const T | Square (const T &val) |
Squares a value. More... | |
template<typename T > | |
T | Sqrt (const T &val) |
Returns the square root of a value. More... | |
template<> | |
float | Sqrt (const float &val) |
template<typename T > | |
T | Cosine (T angle) |
Returns the cosine of the given value. More... | |
template<> | |
float | Cosine (float angle) |
float specialization of Cosine. More... | |
template<typename T > | |
T | Sine (T angle) |
Returns the sine of the given value. More... | |
template<> | |
float | Sine (float angle) |
float specialization of Sine. More... | |
template<typename T > | |
T | Tangent (T angle) |
Returns the tangent of the given value. More... | |
template<> | |
float | Tangent (float angle) |
float specialization of Tangent. More... | |
template<typename T > | |
T | Factorial (int x) |
Returns the factorial (!) of x. More... | |
template<typename T > | |
T | DoubleFactorial (int x) |
Returns the double factorial (!!) of x. More... | |
uint32 | NextPowerOf2 (uint32 n) |
Returns the next power of 2 greater than or equal to n. More... | |
uint64 | NextPowerOf2 (uint64 n) |
template<typename T > | |
T | Log2 (T n) |
Returns the base-2 logarithm of n. More... | |
template<> | |
uint32 | Log2 (uint32 n) |
Specialize for integer types. More... | |
template<> | |
int | Log2 (int n) |
template<> | |
uint64 | Log2 (uint64 n) |
template<> | |
int64 | Log2 (int64 n) |
template<typename T > | |
const T | Clamp (const T &val, const T &min_val, const T &max_val) |
Clamps a value to lie between a minimum and maximum, inclusive. More... | |
template<typename T , typename U > | |
const U | Lerp (const U &begin, const U &end, const T &t) |
Linearly interpolates between two values. More... | |
bool | IsPowerOfTwo (int value) |
Returns true if a value is a power of two. More... | |
template<int Dimension, typename T > | |
std::ostream & | operator<< (std::ostream &out, const Vector< Dimension, T > &v) |
Prints a Vector to a stream. More... | |
template<int Dimension, typename T > | |
std::istream & | operator>> (std::istream &in, Vector< Dimension, T > &v) |
Reads a Vector from a stream. More... | |
template<int Dimension, typename T > | |
std::ostream & | operator<< (std::ostream &out, const Point< Dimension, T > &p) |
Prints a Point to a stream. More... | |
template<int Dimension, typename T > | |
std::istream & | operator>> (std::istream &in, Point< Dimension, T > &v) |
Reads a Point from a stream. More... | |
ION_INSTANTIATE_VECTOR_TYPE (VectorBase) | |
ION_INSTANTIATE_VECTOR_TYPE (Vector) | |
ION_INSTANTIATE_VECTOR_TYPE (Point) | |
template<int Dimension, typename T > | |
T | Dot (const Vector< Dimension, T > &v0, const Vector< Dimension, T > &v1) |
Returns the dot (inner) product of two Vectors. More... | |
template<typename T > | |
Vector< 3, T > | Cross (const Vector< 3, T > &v0, const Vector< 3, T > &v1) |
Returns the 3-dimensional cross product of 2 Vectors. More... | |
template<typename T > | |
T | Cross (const Vector< 2, T > &v0, const Vector< 2, T > &v1) |
Returns the cross product of v0 and v1 aka the determinant of the 2x2 matrix described by |v0.x v0.y| |v1.x v1.y|. More... | |
template<int Dimension, typename T > | |
T | LengthSquared (const Vector< Dimension, T > &v) |
Returns the square of the length of a Vector. More... | |
template<int Dimension, typename T > | |
T | Length (const Vector< Dimension, T > &v) |
Returns the geometric length of a Vector. More... | |
template<int Dimension, typename T > | |
T | DistanceSquared (const Point< Dimension, T > &p0, const Point< Dimension, T > &p1) |
Returns the square of the distance between two Points. More... | |
template<int Dimension, typename T > | |
T | Distance (const Point< Dimension, T > &p0, const Point< Dimension, T > &p1) |
Returns the geometric distance between two Points. More... | |
template<int Dimension, typename T > | |
bool | Normalize (Vector< Dimension, T > *v) |
Normalizes a Vector to unit length. More... | |
template<int Dimension, typename T > | |
const Vector< Dimension, T > | Normalized (const Vector< Dimension, T > &v) |
Returns a unit-length version of a Vector. More... | |
template<typename T > | |
const Vector< 2, T > | Orthogonal (const Vector< 2, T > &v) |
Returns an unnormalized Vector2 that is orthonormal to the passed one. More... | |
template<typename T > | |
const Vector< 3, T > | Orthogonal (const Vector< 3, T > &v) |
Returns an unnormalized Vector3 that is orthonormal to the passed one. More... | |
template<int Dimension, typename T > | |
const Vector< Dimension, T > | Orthonormal (const Vector< Dimension, T > &v) |
Returns a normalized Vector that is orthonormal to the passed one. More... | |
template<int Dimension, typename T > | |
const Vector< Dimension, T > | Projection (const Vector< Dimension, T > &v, const Vector< Dimension, T > &onto_v) |
Returns the Vector resulting from projecting of one Vector onto another. More... | |
template<int Dimension, typename T > | |
const Vector< Dimension, T > | Rescale (const Vector< Dimension, T > &v, T length) |
Returns a Vector in the same direction as the passed vector but with the passed length. More... | |
template<int Dimension, typename T > | |
bool | VectorsAlmostEqual (const Vector< Dimension, T > &v0, const Vector< Dimension, T > &v1, T tolerance) |
Returns true if all elements of two Vectors are equal within a tolerance. More... | |
template<int Dimension, typename T > | |
const Point< Dimension, T > | MinBoundPoint (const Point< Dimension, T > &p0, const Point< Dimension, T > &p1) |
Returns a Point in which each element is the minimum of the corresponding elements of two Points. More... | |
template<int Dimension, typename T > | |
const Point< Dimension, T > | MaxBoundPoint (const Point< Dimension, T > &p0, const Point< Dimension, T > &p1) |
Returns a Point in which each element is the maximum of the corresponding elements of two Points. More... | |
template<int Dimension, typename T > | |
Point< Dimension, T > | ClosestPointOnSegment (const Point< Dimension, T > &p, const Point< Dimension, T > &start, const Point< Dimension, T > &end) |
Returns the closest point to p on the line segment defined by start and end. More... | |
template<int Dimension, typename T > | |
const T | DistanceSquaredToSegment (const Point< Dimension, T > &p, const Point< Dimension, T > &start, const Point< Dimension, T > &end) |
Returns the squared distance from a Point to a line segment described by two Points. More... | |
template<int Dimension, typename T > | |
const T | DistanceToSegment (const Point< Dimension, T > &p, const Point< Dimension, T > &start, const Point< Dimension, T > &end) |
Returns the distance from a Point to a line segment described by two Points. More... | |
template<int Dimension, typename T > | |
bool | PointsAlmostEqual (const Point< Dimension, T > &v0, const Point< Dimension, T > &v1, T tolerance) |
Returns true if all elements of two Points are equal within a tolerance. More... | |
template<int InDimension, int OutDimension, typename T > | |
bool | Swizzle (const VectorBase< InDimension, T > &input, const char *swizzle_string, VectorBase< OutDimension, T > *output) |
Computes the result of swizzling a Vector or Point (or anything else derived from VectorBase). More... | |
template<int Dimension, typename T > | |
bool | IsVectorFinite (const VectorBase< Dimension, T > &v) |
Returns true if all components of VectorBase v are finite, otherwise false. More... | |
typedef Angle<double> ion::math::Angled |
typedef Angle<float> ion::math::Anglef |
typedef FieldOfView<double> ion::math::FieldOfViewd |
Definition at line 180 of file fieldofview.h.
typedef FieldOfView<float> ion::math::FieldOfViewf |
Definition at line 179 of file fieldofview.h.
typedef Matrix<2, double> ion::math::Matrix2d |
typedef Matrix<2, float> ion::math::Matrix2f |
typedef Matrix<3, double> ion::math::Matrix3d |
typedef Matrix<3, float> ion::math::Matrix3f |
typedef Matrix<4, double> ion::math::Matrix4d |
typedef Matrix<4, float> ion::math::Matrix4f |
typedef Range<1, double> ion::math::Range1d |
typedef Range<1, float> ion::math::Range1f |
typedef Range<1, int32> ion::math::Range1i |
typedef Range<1, int16> ion::math::Range1i16 |
typedef Range<1, int8> ion::math::Range1i8 |
typedef Range<1, uint32> ion::math::Range1ui |
typedef Range<1, uint16> ion::math::Range1ui16 |
typedef Range<1, uint8> ion::math::Range1ui8 |
typedef Range<2, double> ion::math::Range2d |
typedef Range<2, float> ion::math::Range2f |
typedef Range<2, int32> ion::math::Range2i |
typedef Range<2, int16> ion::math::Range2i16 |
typedef Range<2, int8> ion::math::Range2i8 |
typedef Range<2, uint32> ion::math::Range2ui |
typedef Range<2, uint16> ion::math::Range2ui16 |
typedef Range<2, uint8> ion::math::Range2ui8 |
typedef Range<3, double> ion::math::Range3d |
typedef Range<3, float> ion::math::Range3f |
typedef Range<3, int32> ion::math::Range3i |
typedef Range<3, int16> ion::math::Range3i16 |
typedef Range<3, int8> ion::math::Range3i8 |
typedef Range<3, uint32> ion::math::Range3ui |
typedef Range<3, uint16> ion::math::Range3ui16 |
typedef Range<3, uint8> ion::math::Range3ui8 |
typedef Range<4, double> ion::math::Range4d |
typedef Range<4, float> ion::math::Range4f |
typedef Range<4, int32> ion::math::Range4i |
typedef Range<4, int16> ion::math::Range4i16 |
typedef Range<4, int8> ion::math::Range4i8 |
typedef Range<4, uint32> ion::math::Range4ui |
typedef Range<4, uint16> ion::math::Range4ui16 |
typedef Range<4, uint8> ion::math::Range4ui8 |
typedef Rotation<double> ion::math::Rotationd |
Definition at line 213 of file rotation.h.
typedef Rotation<float> ion::math::Rotationf |
Type-specific typedefs.
Definition at line 212 of file rotation.h.
Returns the absolute value of a number in a type-safe way.
Definition at line 42 of file utils.h.
Referenced by AngleBetween(), MatrixAlmostOrthogonal(), ion::analytics::OutputAccumulatedVariableAsJson(), PointsAlmostEqual(), RangesAlmostEqual(), ion::math::Rotation< T >::RotateInto(), and VectorsAlmostEqual().
Matrix<Dimension, T> ion::math::Adjugate | ( | const Matrix< Dimension, T > & | m | ) |
Returns the adjugate of the matrix, which is defined as the transpose of the cofactor matrix.
This function is defined for all the typedef'ed Matrix types.
Definition at line 134 of file matrixutils.h.
ION_API Matrix<Dimension, T> ion::math::AdjugateWithDeterminant | ( | const Matrix< Dimension, T > & | m, |
T * | determinant | ||
) |
Returns the adjugate of the matrix, which is defined as the transpose of the cofactor matrix.
This function is defined for all the typedef'ed Matrix types. The determinant of the matrix is computed as a side effect, so it is returned in the determinant parameter if it is not NULL.
Definition at line 237 of file matrixutils.cc.
References DCHECK.
Referenced by InverseWithDeterminant().
Matrix<Dimension, T> ion::math::AdjugateWithDeterminant | ( | const Matrix< Dimension, T > & | m, |
T * | determinant | ||
) |
Returns the adjugate of the matrix, which is defined as the transpose of the cofactor matrix.
This function is defined for all the typedef'ed Matrix types. The determinant of the matrix is computed as a side effect, so it is returned in the determinant parameter if it is not NULL.
Definition at line 237 of file matrixutils.cc.
References DCHECK.
Referenced by InverseWithDeterminant().
|
inline |
Returns the angle between two unit vectors.
Definition at line 98 of file angleutils.h.
References Abs(), ArcCosine(), Clamp(), DCHECK_LE, Dot(), and LengthSquared().
Returns the inverse cosine of the given value.
Definition at line 36 of file angleutils.h.
References ion::math::Angle< T >::FromRadians().
Referenced by AngleBetween(), ion::math::Rotation< T >::GetAxisAndAngle(), and ion::math::Rotation< T >::Slerp().
|
inline |
float specialization of ArcCosine.
Definition at line 41 of file angleutils.h.
References ion::math::Angle< T >::FromRadians().
Returns the inverse sine of the given value.
Definition at line 47 of file angleutils.h.
References ion::math::Angle< T >::FromRadians().
|
inline |
float specialization of ArcSine.
Definition at line 52 of file angleutils.h.
References ion::math::Angle< T >::FromRadians().
Returns the inverse tangent of the given value.
Definition at line 58 of file angleutils.h.
References ion::math::Angle< T >::FromRadians().
|
inline |
float specialization of ArcTan.
Definition at line 63 of file angleutils.h.
References ion::math::Angle< T >::FromRadians().
Returns the four-quadrant inverse tangent of the given values.
Definition at line 69 of file angleutils.h.
References ion::math::Angle< T >::FromRadians().
|
inline |
float specialization of ArcTangent2.
Definition at line 74 of file angleutils.h.
References ion::math::Angle< T >::FromRadians().
|
inline |
Clamps a value to lie between a minimum and maximum, inclusive.
This is supported for any type for which std::min() and std::max() are implemented.
Definition at line 204 of file utils.h.
Referenced by AngleBetween(), and ion::math::Rotation< T >::Slerp().
Point<Dimension, T> ion::math::ClosestPointOnSegment | ( | const Point< Dimension, T > & | p, |
const Point< Dimension, T > & | start, | ||
const Point< Dimension, T > & | end | ||
) |
Returns the closest point to p on the line segment defined by start and end.
Definition at line 197 of file vectorutils.h.
References Dot(), and LengthSquared().
Referenced by DistanceSquaredToSegment(), and DistanceToSegment().
ION_API Matrix<Dimension, T> ion::math::CofactorMatrix | ( | const Matrix< Dimension, T > & | m | ) |
Returns the signed cofactor matrix (adjunct) of the matrix.
This function is defined for all the typedef'ed Matrix types.
Definition at line 232 of file matrixutils.cc.
References DCHECK.
Matrix<Dimension, T> ion::math::CofactorMatrix | ( | const Matrix< Dimension, T > & | m | ) |
Returns the signed cofactor matrix (adjunct) of the matrix.
This function is defined for all the typedef'ed Matrix types.
Definition at line 232 of file matrixutils.cc.
References DCHECK.
Vector<Dimension, T> ion::math::Column | ( | const Matrix< Dimension, T > & | m, |
int | col | ||
) |
Returns a particular column of a matrix as a vector.
Definition at line 103 of file matrixutils.h.
Referenced by MatrixAlmostOrthogonal().
|
inline |
|
inline |
ion::math::Angle specialization of Cosine.
Definition at line 80 of file angleutils.h.
References ion::math::Angle< T >::Radians().
Referenced by ion::math::Rotation< T >::SetAxisAndAngle(), and ion::math::Rotation< T >::Slerp().
Vector<3, T> ion::math::Cross | ( | const Vector< 3, T > & | v0, |
const Vector< 3, T > & | v1 | ||
) |
Returns the 3-dimensional cross product of 2 Vectors.
Note that this is defined only for 3-dimensional Vectors.
Definition at line 48 of file vectorutils.h.
Referenced by LookAtMatrixFromDir(), Orthogonal(), and ion::math::Rotation< T >::RotateInto().
Returns the cross product of v0
and v1
aka the determinant of the 2x2 matrix described by |v0.x v0.y| |v1.x v1.y|.
Definition at line 58 of file vectorutils.h.
ION_API T ion::math::Determinant | ( | const Matrix< Dimension, T > & | m | ) |
Returns the determinant of the matrix.
This function is defined for all the typedef'ed Matrix types.
Returns the determinant of the matrix.
Partial specialization of template functions is not allowed in C++, so these functions are implemented using fully-specialized functions that invoke helper functions that operate on matrices of a specific size. The unspecialized versions should never be called.
Definition at line 227 of file matrixutils.cc.
References DCHECK.
Public functions.
Returns the determinant of the matrix.
Partial specialization of template functions is not allowed in C++, so these functions are implemented using fully-specialized functions that invoke helper functions that operate on matrices of a specific size. The unspecialized versions should never be called.
Definition at line 227 of file matrixutils.cc.
References DCHECK.
T ion::math::Distance | ( | const Point< Dimension, T > & | p0, |
const Point< Dimension, T > & | p1 | ||
) |
Returns the geometric distance between two Points.
Definition at line 83 of file vectorutils.h.
References Length().
Referenced by DistanceToSegment().
T ion::math::DistanceSquared | ( | const Point< Dimension, T > & | p0, |
const Point< Dimension, T > & | p1 | ||
) |
Returns the square of the distance between two Points.
Definition at line 76 of file vectorutils.h.
References LengthSquared().
Referenced by DistanceSquaredToSegment().
const T ion::math::DistanceSquaredToSegment | ( | const Point< Dimension, T > & | p, |
const Point< Dimension, T > & | start, | ||
const Point< Dimension, T > & | end | ||
) |
Returns the squared distance from a Point to a line segment described by two Points.
Definition at line 220 of file vectorutils.h.
References ClosestPointOnSegment(), and DistanceSquared().
const T ion::math::DistanceToSegment | ( | const Point< Dimension, T > & | p, |
const Point< Dimension, T > & | start, | ||
const Point< Dimension, T > & | end | ||
) |
Returns the distance from a Point to a line segment described by two Points.
Definition at line 228 of file vectorutils.h.
References ClosestPointOnSegment(), and Distance().
T ion::math::Dot | ( | const Vector< Dimension, T > & | v0, |
const Vector< Dimension, T > & | v1 | ||
) |
Returns the dot (inner) product of two Vectors.
Definition at line 38 of file vectorutils.h.
Referenced by AngleBetween(), ClosestPointOnSegment(), LengthSquared(), MatrixAlmostOrthogonal(), Projection(), ion::math::Rotation< T >::RotateInto(), and ion::math::Rotation< T >::Slerp().
|
inline |
|
inline |
|
inline |
Returns the inverse of the matrix.
This function is defined for all the typedef'ed Matrix types. If the determinant of the matrix is 0, the returned matrix has all zeroes.
Definition at line 150 of file matrixutils.h.
ION_API Matrix<Dimension, T> ion::math::InverseWithDeterminant | ( | const Matrix< Dimension, T > & | m, |
T * | determinant | ||
) |
Returns the inverse of the matrix.
This function is defined for all the typedef'ed Matrix types. The determinant of the matrix is computed as a side effect, so it is returned in the determinant parameter if it is not NULL. If the determinant is 0, the returned matrix has all zeroes.
Definition at line 243 of file matrixutils.cc.
References AdjugateWithDeterminant(), and ion::math::Matrix< Dimension, T >::Zero().
Matrix<Dimension, T> ion::math::InverseWithDeterminant | ( | const Matrix< Dimension, T > & | m, |
T * | determinant | ||
) |
Returns the inverse of the matrix.
This function is defined for all the typedef'ed Matrix types. The determinant of the matrix is computed as a side effect, so it is returned in the determinant parameter if it is not NULL. If the determinant is 0, the returned matrix has all zeroes.
Definition at line 243 of file matrixutils.cc.
References AdjugateWithDeterminant(), and ion::math::Matrix< Dimension, T >::Zero().
ion::math::ION_INSTANTIATE_FUNCTIONS | ( | double | ) |
ion::math::ION_INSTANTIATE_FUNCTIONS | ( | float | ) |
ion::math::ION_INSTANTIATE_ROTATION_FUNCTIONS | ( | double | ) |
ion::math::ION_INSTANTIATE_ROTATION_FUNCTIONS | ( | float | ) |
ion::math::ION_INSTANTIATE_VECTOR_TYPE | ( | VectorBase | ) |
ion::math::ION_INSTANTIATE_VECTOR_TYPE | ( | Vector | ) |
ion::math::ION_INSTANTIATE_VECTOR_TYPE | ( | Point | ) |
ion::math::ION_SPECIALIZE_MATRIX_FUNCS | ( | 2 | , |
float | |||
) |
ion::math::ION_SPECIALIZE_MATRIX_FUNCS | ( | 2 | , |
double | |||
) |
ion::math::ION_SPECIALIZE_MATRIX_FUNCS | ( | 3 | , |
float | |||
) |
ion::math::ION_SPECIALIZE_MATRIX_FUNCS | ( | 3 | , |
double | |||
) |
ion::math::ION_SPECIALIZE_MATRIX_FUNCS | ( | 4 | , |
float | |||
) |
ion::math::ION_SPECIALIZE_MATRIX_FUNCS | ( | 4 | , |
double | |||
) |
Tests whether a numeric value is finite.
Definition at line 34 of file utils.h.
Referenced by IsVectorFinite().
|
inline |
bool ion::math::IsVectorFinite | ( | const VectorBase< Dimension, T > & | v | ) |
Returns true if all components of VectorBase v are finite, otherwise false.
Definition at line 297 of file vectorutils.h.
References IsFinite().
Returns the geometric length of a Vector.
Definition at line 70 of file vectorutils.h.
References LengthSquared(), and Sqrt().
Referenced by Distance(), Normalize(), and Orthogonal().
Returns the square of the length of a Vector.
Definition at line 64 of file vectorutils.h.
References Dot().
Referenced by AngleBetween(), ClosestPointOnSegment(), DistanceSquared(), Length(), LookAtMatrixFromDir(), MatrixAlmostOrthogonal(), Projection(), and ion::math::Rotation< T >::RotateInto().
|
inline |
Returns the base-2 logarithm of n.
Definition at line 148 of file utils.h.
Referenced by ion::gfx::Texture::ExpectedDimensionsForMipmap(), and Log2().
|
inline |
Specialize for integer types.
See http://graphics.stanford.edu/~seander/bithacks.html#IntegerLogObvious for details. These implementations are in the public domain.
|
inline |
|
inline |
ION_API const Matrix< 4, T > ion::math::LookAtMatrixFromCenter | ( | const Point< 3, T > & | eye, |
const Point< 3, T > & | center, | ||
const Vector< 3, T > & | up | ||
) |
View matrices.
Returns a 4x4 viewing matrix based on the given camera parameters, which follow the conventions of the old gluLookAt() function (eye aka camera points at center aka look_at with camera roll defined by up). If the parameters cannot form an orthonormal basis then this returns an identity matrix.
Definition at line 138 of file transformutils.cc.
References LookAtMatrixFromDir().
ION_API const Matrix< 4, T > ion::math::LookAtMatrixFromDir | ( | const Point< 3, T > & | eye, |
const Vector< 3, T > & | dir, | ||
const Vector< 3, T > & | up | ||
) |
Returns a 4x4 viewing matrix based on the given camera parameters, which use a view direction rather than look at center point.
If the parameters cannot form an orthonormal basis then this returns an identity matrix.
Definition at line 146 of file transformutils.cc.
References Cross(), DCHECK, DCHECK_GE, LengthSquared(), Normalized(), and TranslationMatrix().
Referenced by LookAtMatrixFromCenter().
bool ion::math::MatrixAlmostOrthogonal | ( | const Matrix< Dimension, T > & | m, |
T | tolerance | ||
) |
Returns true if the dot product of all column vector pairs in the matrix is less than a provided tolerance, and if all column vectors have unit length.
Return false otherwise.
Definition at line 257 of file matrixutils.cc.
References Abs(), Column(), Dot(), and LengthSquared().
Referenced by OrthoInverseH().
const Point<Dimension, T> ion::math::MaxBoundPoint | ( | const Point< Dimension, T > & | p0, |
const Point< Dimension, T > & | p1 | ||
) |
Returns a Point in which each element is the maximum of the corresponding elements of two Points.
This is useful for computing bounding boxes.
Definition at line 187 of file vectorutils.h.
const Point<Dimension, T> ion::math::MinBoundPoint | ( | const Point< Dimension, T > & | p0, |
const Point< Dimension, T > & | p1 | ||
) |
Returns a Point in which each element is the minimum of the corresponding elements of two Points.
This is useful for computing bounding boxes.
Definition at line 176 of file vectorutils.h.
const Range<Dimension, T1> ion::math::ModulateRange | ( | const Range< Dimension, T1 > & | r, |
const Vector< Dimension, T2 > | modulation | ||
) |
Each dimension of the Range is modulated by the corresponding dimension in the Vector. The modulation is done using the multiplication operator defined for the Vector, in the space of the Vector's type. For example, if an integral Range is scaled by a floating point Vector, the modulation will occur using floating point multiply. If any factor is not positive, this returns an empty Range.
Definition at line 149 of file rangeutils.h.
References ion::math::Range< Dimension, T >::GetMaxPoint(), ion::math::Range< Dimension, T >::GetMinPoint(), and ion::math::Range< Dimension, T >::IsEmpty().
|
inline |
|
inline |
Homogeneous matrices.
Returns the upper left 3x3 matrix of a homogeneous 4x4 matrix.
Definition at line 118 of file transformutils.h.
Referenced by OrthoInverseH().
Normalizes a Vector to unit length.
If the vector has no length, this leaves the Vector untouched and returns false.
Definition at line 90 of file vectorutils.h.
References DCHECK, and Length().
Referenced by Normalized(), and ion::math::Rotation< T >::SetAxisAndAngle().
const Vector<Dimension, T> ion::math::Normalized | ( | const Vector< Dimension, T > & | v | ) |
Returns a unit-length version of a Vector.
If the given Vector has no length, this returns a Zero() Vector.
Definition at line 104 of file vectorutils.h.
References Normalize(), and ion::math::Vector< Dimension, T >::Zero().
Referenced by LookAtMatrixFromDir(), Orthonormal(), Rescale(), ion::math::Rotation< T >::SetQuaternion(), and ion::math::Rotation< T >::Slerp().
Returns the NVolume of a Range, which is the product of its sizes in all dimensions.
Returns 0 if the Range is empty.
Definition at line 69 of file rangeutils.h.
References ion::math::Range< Dimension, T >::GetSize(), and ion::math::Range< Dimension, T >::IsEmpty().
const Vector<Dimension, T> ion::math::operator* | ( | const Matrix< Dimension+1, T > & | m, |
const Vector< Dimension, T > & | v | ||
) |
Transforming vectors and points.
Multiplies a Matrix and a column Vector of one smaller Dimension (the template parameter) to produce another column Vector. This assumes the homogeneous coordinate of the Vector is 0, so any translation component of the Matrix is ignored.
Definition at line 60 of file transformutils.h.
References ion::math::Vector< Dimension, T >::Zero().
const Point<Dimension, T> ion::math::operator* | ( | const Matrix< Dimension+1, T > & | m, |
const Point< Dimension, T > & | p | ||
) |
Multiplies a Matrix and a Point of one smaller Dimension (the template parameter) to produce another Point.
This assumes the homogeneous coordinate of the Point is and stays 1 after the transformation. Thus this will include translation. but not divide by the homogeneous coordinate; use ProjectPoint(), below, for general projections.
Definition at line 76 of file transformutils.h.
References ion::math::Point< Dimension, T >::Zero().
|
inline |
Multiplies a Matrix and a column Vector of the same Dimension to produce another column Vector.
Definition at line 77 of file matrixutils.h.
References ion::math::internal::MultiplyMatrixAndVector().
|
inline |
Multiplies a Matrix and a Point of the same Dimension to produce another Point.
Definition at line 85 of file matrixutils.h.
References ion::math::internal::MultiplyMatrixAndVector().
std::ostream& ion::math::operator<< | ( | std::ostream & | out, |
const Angle< T > & | a | ||
) |
std::ostream& ion::math::operator<< | ( | std::ostream & | out, |
const Matrix< Dimension, T > & | m | ||
) |
std::ostream& ion::math::operator<< | ( | std::ostream & | out, |
const Rotation< T > & | a | ||
) |
Prints a Rotation to a stream.
Definition at line 185 of file rotation.h.
std::ostream& ion::math::operator<< | ( | std::ostream & | out, |
const Range< Dimension, T > & | r | ||
) |
std::ostream& ion::math::operator<< | ( | std::ostream & | out, |
const Vector< Dimension, T > & | v | ||
) |
Prints a Vector to a stream.
Definition at line 276 of file vector.h.
References ion::math::VectorBase< Dimension, T >::Print().
std::ostream& ion::math::operator<< | ( | std::ostream & | out, |
const Point< Dimension, T > & | p | ||
) |
|
inline |
Definition at line 464 of file fieldofview.h.
References ion::math::FieldOfView< T >::Print().
std::istream& ion::math::operator>> | ( | std::istream & | in, |
Range1TWrapper< T, 0 > & | w | ||
) |
Definition at line 61 of file range.h.
References ion::math::Range1TWrapper< T, N >::t.
std::istream& ion::math::operator>> | ( | std::istream & | in, |
Angle< T > & | a | ||
) |
Definition at line 135 of file angle.h.
References ion::math::Angle< T >::FromDegrees(), ion::math::Angle< T >::FromRadians(), and ion::base::GetExpectedString().
std::istream& ion::math::operator>> | ( | std::istream & | in, |
Matrix< Dimension, T > & | m | ||
) |
Reads a Matrix from a stream.
Definition at line 165 of file matrix.h.
References ion::base::GetExpectedChar(), and ion::base::GetExpectedString().
std::istream& ion::math::operator>> | ( | std::istream & | in, |
Rotation< T > & | a | ||
) |
Reads a Rotation from a stream.
Definition at line 194 of file rotation.h.
References ion::base::GetExpectedChar(), ion::base::GetExpectedString(), and ion::math::Rotation< T >::SetAxisAndAngle().
std::istream& ion::math::operator>> | ( | std::istream & | in, |
Range< Dimension, T > & | r | ||
) |
Reads a Range from a stream.
Definition at line 229 of file range.h.
References ion::base::GetExpectedChar(), ion::base::GetExpectedString(), and ion::math::Range< Dimension, T >::Set().
std::istream& ion::math::operator>> | ( | std::istream & | in, |
Vector< Dimension, T > & | v | ||
) |
std::istream& ion::math::operator>> | ( | std::istream & | in, |
Point< Dimension, T > & | v | ||
) |
|
inline |
Definition at line 471 of file fieldofview.h.
References ion::math::FieldOfView< T >::Read().
Returns an unnormalized Vector2 that is orthonormal to the passed one.
If the passed vector has length 0, then a zero-length vector is returned.
Definition at line 115 of file vectorutils.h.
Referenced by Orthonormal().
Returns an unnormalized Vector3 that is orthonormal to the passed one.
If the passed vector has length 0, then a zero-length vector is returned. The returned vector is not guaranteed to be in any particular direction, just that it is perpendicular to v.
Definition at line 124 of file vectorutils.h.
ION_API const Matrix< 4, T > ion::math::OrthographicMatrixFromFrustum | ( | T | x_left, |
T | x_right, | ||
T | y_bottom, | ||
T | y_top, | ||
T | z_near, | ||
T | z_far | ||
) |
Projection matrices.
Returns a 4x4 orthographic projection matrix based on the given parameters, which follow the conventions of the old glOrtho() function. If there are any problems with the parameters (such as 0 sizes in any dimension), this returns an identity matrix.
Definition at line 170 of file transformutils.cc.
References ion::math::Matrix< Dimension, T >::Identity().
Public functions.
Returns the inverse of m iff m is orthogonal.
Triggers a DCHECK otherwise. This function is much faster than the regular Inverse function as it only performs one matrix-vector multiplication and a few element permutations.
Definition at line 89 of file transformutils.cc.
References DCHECK, MatrixAlmostOrthogonal(), NonhomogeneousSubmatrixH(), Row(), translation, Transpose(), and VectorsAlmostEqual().
const Vector<Dimension, T> ion::math::Orthonormal | ( | const Vector< Dimension, T > & | v | ) |
Returns a normalized Vector that is orthonormal to the passed one.
If the passed vector has length 0, then a zero-length vector is returned. The returned vector is not guaranteed to be in any particular direction, just that it is perpendicular to v.
Definition at line 140 of file vectorutils.h.
References Normalized(), and Orthogonal().
ION_API const Matrix< 4, T > ion::math::PerspectiveMatrixFromFrustum | ( | T | x_left, |
T | x_right, | ||
T | y_bottom, | ||
T | y_top, | ||
T | z_near, | ||
T | z_far | ||
) |
Returns a 4x4 perspective projection matrix based on the given parameters, which follow the conventions of the old glFrustum() function.
If there are any problems with the parameters (such as 0 sizes in any dimension or non-positive near or far values), this returns an identity matrix.
Definition at line 190 of file transformutils.cc.
References ion::math::Matrix< Dimension, T >::Identity().
Referenced by ion::math::FieldOfView< T >::GetProjectionMatrix().
ION_API const Matrix< 4, T > ion::math::PerspectiveMatrixFromView | ( | const Angle< T > & | fovy, |
T | aspect, | ||
T | z_near, | ||
T | z_far | ||
) |
Returns a 4x4 perspective projection matrix based on the given parameters, which follow the conventions of the gluPerspective() function.
If there are any problems with the parameters (such as non-positive values or z_near equal to z_far), this returns an identity matrix.
Definition at line 212 of file transformutils.cc.
References ion::math::Matrix< Dimension, T >::Identity(), ion::math::Angle< T >::Radians(), and Tangent().
ION_API const Matrix<4, T> ion::math::PerspectiveMatrixInverse | ( | const Matrix< 4, T > & | m | ) |
Returns the inverse of m iff m is a perspective projection matrix, i.e., iff it has the following form:
Triggers a DCHECK otherwise.
This function is much faster than the regular Inverse function as it requires only three divisions and three multiplications.
Definition at line 230 of file transformutils.cc.
References DCHECK_LE.
const Matrix<4, T> ion::math::PerspectiveMatrixInverse | ( | const Matrix< 4, T > & | m | ) |
Returns the inverse of m iff m is a perspective projection matrix, i.e., iff it has the following form:
Triggers a DCHECK otherwise.
This function is much faster than the regular Inverse function as it requires only three divisions and three multiplications.
Definition at line 230 of file transformutils.cc.
References DCHECK_LE.
bool ion::math::PointsAlmostEqual | ( | const Point< Dimension, T > & | v0, |
const Point< Dimension, T > & | v1, | ||
T | tolerance | ||
) |
Returns true if all elements of two Points are equal within a tolerance.
Definition at line 236 of file vectorutils.h.
References Abs().
const Vector<Dimension, T> ion::math::Projection | ( | const Vector< Dimension, T > & | v, |
const Vector< Dimension, T > & | onto_v | ||
) |
Returns the Vector resulting from projecting of one Vector onto another.
This will return a Zero() Vector if onto_v has zero length.
Definition at line 147 of file vectorutils.h.
References Dot(), and LengthSquared().
const Point<Dimension, T> ion::math::ProjectPoint | ( | const Matrix< Dimension+1, T > & | m, |
const Point< Dimension, T > & | p | ||
) |
Multiplies a Matrix and a Point of one smaller Dimension (the template parameter) to produce another Point and projects it by dividing by the homogeneous coordinate.
This assumes that the input Point has a homogeneous coordinate of 1.
Definition at line 92 of file transformutils.h.
References ion::math::Point< Dimension, T >::Zero().
const Range<Dimension, T> ion::math::RangeIntersection | ( | const Range< Dimension, T > & | r0, |
const Range< Dimension, T > & | r1 | ||
) |
Returns the intersection of two Range instances.
If either Range is empty, this returns an empty range. Otherwise, it returns the largest Range contained by both.
Definition at line 48 of file rangeutils.h.
References ion::math::Range< Dimension, T >::GetMaxPoint(), ion::math::Range< Dimension, T >::GetMinPoint(), and ion::math::Range< Dimension, T >::IsEmpty().
bool ion::math::RangesAlmostEqual | ( | const Range< Dimension, T > & | r0, |
const Range< Dimension, T > & | r1, | ||
const T | threshold | ||
) |
Returns true if all dimensions of the two ranges are equal within the threshold.
Definition at line 85 of file rangeutils.h.
References Abs(), ion::math::Range< Dimension, T >::GetMaxPoint(), ion::math::Range< Dimension, T >::GetMinPoint(), and ion::math::Range< Dimension, T >::IsEmpty().
const Range<Dimension, T> ion::math::RangeUnion | ( | const Range< Dimension, T > & | r0, |
const Range< Dimension, T > & | r1 | ||
) |
Returns the union of two Range instances.
If either Range is empty, this returns the other range. Otherwise, it returns the smallest Range containing both.
Definition at line 37 of file rangeutils.h.
References ion::math::Range< Dimension, T >::ExtendByRange().
const Vector<Dimension, T> ion::math::Rescale | ( | const Vector< Dimension, T > & | v, |
T | length | ||
) |
Returns a Vector in the same direction as the passed vector but with the passed length.
If the input vector has zero length, however, then the returned vector also has zero length.
Definition at line 158 of file vectorutils.h.
References length, and Normalized().
const Matrix<4, T> ion::math::RotationMatrixAxisAngleH | ( | const Vector< 3, T > & | axis, |
const Angle< T > & | angle | ||
) |
Returns a 4x4 Matrix representing a 3D rotation specified as axis and angle.
This creates a Matrix that works with homogeneous coordinates, so the function name ends in "H".
Definition at line 196 of file transformutils.h.
References RotationMatrixH().
const Matrix<3, T> ion::math::RotationMatrixAxisAngleNH | ( | const Vector< 3, T > & | axis, |
const Angle< T > & | angle | ||
) |
Returns a 3x3 Matrix representing a 3D rotation specified as axis and angle.
This creates a Matrix that does not work with homogeneous coordinates, so the function name ends in "NH".
Definition at line 205 of file transformutils.h.
References RotationMatrixNH().
ION_API const Matrix< 4, T > ion::math::RotationMatrixH | ( | const Rotation< T > & | r | ) |
Returns a 4x4 Matrix representing a 3D rotation.
This creates a Matrix that works with homogeneous coordinates, so the function name ends in "H".
Definition at line 121 of file transformutils.cc.
Referenced by RotationMatrixAxisAngleH().
ION_API const Matrix< 3, T > ion::math::RotationMatrixNH | ( | const Rotation< T > & | r | ) |
Returns a 3x3 Matrix representing a 3D rotation.
This creates a Matrix that does not work with homogeneous coordinates, so the function name ends in "NH".
Definition at line 131 of file transformutils.cc.
Referenced by RotationMatrixAxisAngleNH().
Vector<Dimension, T> ion::math::Row | ( | const Matrix< Dimension, T > & | m, |
int | row | ||
) |
Returns a particular row of a matrix as a vector.
Definition at line 92 of file matrixutils.h.
Referenced by OrthoInverseH().
const Range<Dimension, T> ion::math::ScaleRange | ( | const Range< Dimension, T > & | r, |
T | scale_factor | ||
) |
Returns a Range that is the input Range scaled uniformly about its center by the given factor.
If the factor is not positive, this returns an empty Range.
Definition at line 107 of file rangeutils.h.
References ion::math::Range< Dimension, T >::GetCenter(), ion::math::Range< Dimension, T >::GetMaxPoint(), ion::math::Range< Dimension, T >::GetMinPoint(), and ion::math::Range< Dimension, T >::IsEmpty().
const Range<Dimension, T> ion::math::ScaleRangeNonUniformly | ( | const Range< Dimension, T > & | r, |
const Vector< Dimension, T > | scale_factors | ||
) |
Returns a Range that is the input Range scaled nonuniformly about its center by the given per-dimension factors.
If any factor is not positive, this returns an empty Range.
Definition at line 123 of file rangeutils.h.
References ion::math::Range< Dimension, T >::GetCenter(), ion::math::Range< Dimension, T >::GetMaxPoint(), ion::math::Range< Dimension, T >::GetMinPoint(), ion::math::Range< Dimension, T >::IsEmpty(), and ion::math::VectorBase< Dimension, T >::Set().
|
inline |
|
inline |
ion::math::Angle specialization of Sine.
Definition at line 86 of file angleutils.h.
References ion::math::Angle< T >::Radians().
Referenced by ion::math::Rotation< T >::SetAxisAndAngle(), and ion::math::Rotation< T >::Slerp().
Returns the square root of a value.
There is no standard version of sqrt() for integer types, resulting in ambiguity problems when an integer is passed to it. This is especially annoying in template functions. The Sqrt() function is specialized to avoid these problems.
Definition at line 59 of file utils.h.
Referenced by ion::math::Rotation< T >::FromRotationMatrix(), ion::analytics::Benchmark::VariableAccumulator::Get(), ion::math::Rotation< T >::GetAxisAndAngle(), Length(), and ion::math::Rotation< T >::RotateInto().
Squares a value.
Definition at line 48 of file utils.h.
Referenced by ion::math::Rotation< T >::GetAxisAndAngle().
bool ion::math::Swizzle | ( | const VectorBase< InDimension, T > & | input, |
const char * | swizzle_string, | ||
VectorBase< OutDimension, T > * | output | ||
) |
Computes the result of swizzling a Vector or Point (or anything else derived from VectorBase).
The swizzle_string determines the contents of the output vector. Each character in the string must be one of {x,y,z,w} or {r,g,b,a} or {s,t,p,q}, upper- or lower-case, specifying a component of the input vector. Extra components in the string are ignored; missing components in the string result in an error. This returns false on error.
For example: Vec3d v3(1.0, 2.0, 3.0); Vec2d v2; Vec4d v4; Swizzle(v3, "xz", &v2); ///< v2 is set to (1.0, 3.0). Swizzle(v3, "BBYX", &v4); ///< v4 is set to (3.0, 3.0, 2.0, 1.0). Swizzle(v3, "xyz", &v2); ///< v2 is set to (1.0, 2.0); 'z' is ignored. Swizzle(v3, "xw", &v2); ///< Returns false: v3 has no "w" component. Swizzle(v3, "x", &v2); ///< Returns false: string is missing a component.
Definition at line 262 of file vectorutils.h.
|
inline |
ion::math::Angle specialization of Tangent.
Definition at line 92 of file angleutils.h.
References ion::math::Angle< T >::Radians().
Referenced by PerspectiveMatrixFromView().
|
inline |
const Matrix<Dimension + 1, T> ion::math::TranslationMatrix | ( | const VectorBase< Dimension, T > & | t | ) |
Affine transformation matrices.
Returns a Matrix that represents a translation by a Vector or Point. The Dimension template parameter (which is the dimension of the Vector or Point) is one less than the dimension of the matrix, meaning the matrix has homogeneous coordinates.
Definition at line 141 of file transformutils.h.
Referenced by LookAtMatrixFromDir().
Matrix<Dimension, T> ion::math::Transpose | ( | const Matrix< Dimension, T > & | m | ) |
Public functions.
Returns the transpose of a matrix.
Definition at line 65 of file matrixutils.h.
Referenced by OrthoInverseH().
bool ion::math::VectorsAlmostEqual | ( | const Vector< Dimension, T > & | v0, |
const Vector< Dimension, T > & | v1, | ||
T | tolerance | ||
) |
Returns true if all elements of two Vectors are equal within a tolerance.
Definition at line 164 of file vectorutils.h.
References Abs().
Referenced by OrthoInverseH().