Ion
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
vectorutils.h File Reference
#include <algorithm>
#include <limits>
#include "ion/base/logging.h"
#include "ion/math/utils.h"
#include "ion/math/vector.h"
Include dependency graph for vectorutils.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 ion
 Copyright 2016 Google Inc.
 
 ion::math
 

Functions

template<int Dimension, typename T >
T ion::math::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, Tion::math::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 ion::math::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 ion::math::LengthSquared (const Vector< Dimension, T > &v)
 Returns the square of the length of a Vector. More...
 
template<int Dimension, typename T >
T ion::math::Length (const Vector< Dimension, T > &v)
 Returns the geometric length of a Vector. More...
 
template<int Dimension, typename T >
T ion::math::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 ion::math::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 ion::math::Normalize (Vector< Dimension, T > *v)
 Normalizes a Vector to unit length. More...
 
template<int Dimension, typename T >
const Vector< Dimension, Tion::math::Normalized (const Vector< Dimension, T > &v)
 Returns a unit-length version of a Vector. More...
 
template<typename T >
const Vector< 2, Tion::math::Orthogonal (const Vector< 2, T > &v)
 Returns an unnormalized Vector2 that is orthonormal to the passed one. More...
 
template<typename T >
const Vector< 3, Tion::math::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, Tion::math::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, Tion::math::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, Tion::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. More...
 
template<int Dimension, typename T >
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. More...
 
template<int Dimension, typename T >
const Point< Dimension, Tion::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. More...
 
template<int Dimension, typename T >
const Point< Dimension, Tion::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. More...
 
template<int Dimension, typename T >
Point< Dimension, Tion::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. More...
 
template<int Dimension, typename T >
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. More...
 
template<int Dimension, typename T >
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. More...
 
template<int Dimension, typename T >
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. More...
 
template<int InDimension, int OutDimension, typename T >
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). More...
 
template<int Dimension, typename T >
bool ion::math::IsVectorFinite (const VectorBase< Dimension, T > &v)
 Returns true if all components of VectorBase v are finite, otherwise false. More...