Nimble library is a collection of C++ classes for 2D/3D graphics. More...
Namespaces | |
| namespace | Math |
| Math functions and constants for Nimble. | |
Classes | |
| class | ClipStack |
| This class provides an implementation of a clipping stack. More... | |
| class | Frame4f |
| Frame of four floats. More... | |
| class | Histogram |
| Histogram calculation. More... | |
| class | Interpolating |
| Catmull-Rom. More... | |
| class | KeyStone |
| Keystone class for transforming between different (skewed) 2D coordinate systems, while taking account possible radial (camera lens) distortion. More... | |
| class | LensCorrection |
| Camera distortion correction. More... | |
| class | LinearInterpolator |
| Performs linear interpolation of non-uniform samples. More... | |
| class | LineSegment2T |
| 2D line segment More... | |
| class | Matrix2T |
| 2x2 transformation matrix More... | |
| class | Matrix3T |
| 3x3 transformation matrix More... | |
| class | Matrix4T |
| 4x4 transformation matrix More... | |
| class | Path |
| Path provides some utility functions to manipulate series of points. More... | |
| class | Plane |
| Plane is represented by dot(N, X) = c, where N is a unit-length normal vector, c is the plane constant and X is any point on the plane. More... | |
| class | QuaternionT |
| A quaternion class. More... | |
| class | RampT |
| Linear interpolation. More... | |
| class | RandomGaussian |
| RandomGaussian generates pseudo-random numbers from a normal (gaussian) distribution. More... | |
| class | RandomUniform |
| Random number generator with uniform distribution. More... | |
| class | RangeT |
| Numeric range representation. More... | |
| class | Rectangle |
A rectangle is defined by origin (O), two unit-length axis vectors (U, V), and two non-negative extents (e1, e2). More... | |
| class | RectT |
| An axis-aligned rectangle. More... | |
| class | SizeT |
| This class defines the size of a two-dimensional object. More... | |
| class | SmoothingFilterT |
| This class uses simple first-order IIR filter to provide a smoothing of input samples. More... | |
| class | Vector2T |
| Two-dimensional vector class for 2D mathematics. More... | |
| class | Vector3T |
| Three-dimensional vector class for 3D mathematics. More... | |
| class | Vector4T |
| A four-dimensional homogenic vector class for 3D graphics. More... | |
Typedefs | |
| typedef Histogram< int, 256 > | Histogrami256 |
| Histogram of signed integers. | |
|
typedef Histogram< unsigned int, 1024 > | Histogramu1024 |
| Histogram of 1024 unsigned integers. | |
|
typedef Histogram< unsigned int, 256 > | Histogramu256 |
| Histogram of 256 unsigned integers. | |
|
typedef Histogram< unsigned int, 64 > | Histogramu64 |
| Histogram of 64 unsigned integers. | |
| typedef LineSegment2T< float > | LineSegment2 |
| Line segment of floats. | |
| typedef LineSegment2T< double > | LineSegment2d |
| Line segment of doubles. | |
| typedef LineSegment2T< float > | LineSegment2f |
| Line segment of floats. | |
| typedef Matrix2T< float > | Matrix2 |
| 2x2 matrix of floats | |
| typedef Matrix2T< double > | Matrix2d |
| 2x2 matrix of doubles | |
| typedef Matrix2T< float > | Matrix2f |
| 2x2 matrix of floats | |
| typedef Matrix3T< float > | Matrix3 |
| 3x3 matrix of floats | |
| typedef Matrix3T< double > | Matrix3d |
| 3x3 matrix of doubles | |
| typedef Matrix3T< float > | Matrix3f |
| 3x3 matrix of floats | |
| typedef Matrix4T< float > | Matrix4 |
| 4x4 matrix of floats | |
| typedef Matrix4T< double > | Matrix4d |
| 4x4 matrix of doubles | |
| typedef Matrix4T< float > | Matrix4f |
| 4x4 matrix of floats | |
| typedef QuaternionT< float > | Quaternion |
| Default (float) quaternion type. | |
| typedef QuaternionT< double > | Quaterniond |
| Quaternion of type double. | |
| typedef QuaternionT< float > | Quaternionf |
| Quaternion of type float. | |
| typedef RampT< double, unsigned > | Rampd |
| Ramp of doubles. | |
| typedef RampT< double, double > | Rampdd |
| Ramp of doubles. | |
| typedef RampT< float, unsigned > | Rampf |
| Ramp of floats. | |
| typedef RampT< float, float > | Rampff |
| Ramp of floats. | |
| typedef RangeT< double > | Ranged |
| RangeT for doubles. | |
| typedef RangeT< float > | Rangef |
| RangeT for float. | |
| typedef RangeT< int > | Rangei |
| RangeT for ints. | |
| typedef RangeT< long > | Rangel |
| RangeT for long ints. | |
| typedef RectT< float > | Rect |
| Rectangle of floats. | |
| typedef RectT< double > | Rectd |
| Rectangle of doubles. | |
| typedef RectT< float > | Rectf |
| Rectangle of floats. | |
| typedef RectT< int > | Recti |
| Rectangle of ints. | |
| typedef SizeT< int > | Size |
| Two-dimensional size using integer precision. | |
| typedef SizeT< float > | SizeF |
| Two-dimensional size using floating-point precision. | |
| typedef SizeT< int > | SizeI |
| Two-dimensional size using integer precision. | |
| typedef SmoothingFilterT< double > | SmoothingFilterDouble |
| Rolling average of doubles. | |
| typedef SmoothingFilterT< float > | SmoothingFilterFloat |
| Rolling average of floats. | |
| typedef SmoothingFilterT< Vector2 > | SmoothingFilterVector2 |
| Rolling average of Vector2s. | |
| typedef SmoothingFilterT< Vector3 > | SmoothingFilterVector3 |
| Rolling average of Vector3s. | |
| typedef SmoothingFilterT< Vector4 > | SmoothingFilterVector4 |
| Rolling average of Vector4s. | |
| typedef Vector2T< float > | Vector2 |
| Vector of two floats. | |
| typedef Vector2T< double > | Vector2d |
| Vector of two doubles. | |
| typedef Vector2T< float > | Vector2f |
| Vector of two floats. | |
| typedef Vector2T< int > | Vector2i |
| Vector of two ints. | |
| typedef Vector2T< unsigned int > | Vector2u |
| Vector of two unsigned ints. | |
| typedef Vector2T< unsigned char > | Vector2ub |
| Vector of two unsigned chars. | |
| typedef Vector3T< float > | Vector3 |
| Vector of three floats. | |
| typedef Vector3T< double > | Vector3d |
| Vector of three doubles. | |
| typedef Vector3T< float > | Vector3f |
| Vector of three floats. | |
| typedef Vector3T< int > | Vector3i |
| Vector of three ints. | |
| typedef Vector3T< unsigned int > | Vector3u |
| Vector of three unsigned ints. | |
| typedef Vector3T< unsigned char > | Vector3ub |
| Vector of three unsigned chars. | |
| typedef Vector4T< float > | Vector4 |
| Vector of four floats. | |
| typedef Vector4T< double > | Vector4d |
| Vector of four doubles. | |
| typedef Vector4T< float > | Vector4f |
| Vector of four floats. | |
| typedef Vector4T< int > | Vector4i |
| Vector of four ints. | |
| typedef Vector4T< unsigned int > | Vector4u |
| Vector of four unsigned ints. | |
| typedef Vector4T< unsigned char > | Vector4ub |
| Vector of four unsigned chars. | |
Enumerations | |
| enum | LineSlopeType { LS_VERTICAL, LS_SLOPING, LS_HORIZONTAL } |
Functions | |
| template<class T > | |
| T | abs (const Nimble::Vector2T< T > &t) |
| Return the length of the vector. More... | |
| template<class T > | |
| T | abs (const Nimble::Vector3T< T > &t) |
| Return the length of the vector. More... | |
| template<class T > | |
| T | abs (const Vector4T< T > &t) |
| Get the length of the vector. More... | |
| template<class T > | |
| T | cross (const Vector2T< T > &a, const Vector2T< T > &b) |
| Compute the cross product of two 2d vectors by assuming the z components are zero Returns the magnitude (z component) of the resulting vector. | |
| template<class T > | |
| Nimble::Vector3T< T > | cross (const Nimble::Vector3T< T > &a, const Nimble::Vector3T< T > &b) |
| Return the cross-product of two vectors. More... | |
| template<class T > | |
| T | dot (const Vector2T< T > &t1, const Vector2T< T > &t2) |
| Compute the dot product of two vectors. More... | |
| template<class K , class T > | |
| T | dot (const Nimble::Vector3T< K > &a, const Nimble::Vector3T< T > &b) |
| Compute the dot product of two vectors. More... | |
| template<class T > | |
| T | dot (const Vector4T< T > &a, const Vector4T< T > &b) |
| Returns 4D dot product of the two Vector4T objects. | |
| template<class T > | |
| T | evalCatmullRom (float t, const std::vector< T > &cp, size_t index=0) |
| Evaluate a cubic Catmull-Rom spline on an interval. More... | |
| template<class T > | |
| T | evalCatmullRomDerivate (float t, const std::vector< T > &cp, size_t index) |
| Evaluate the derivative of a Catmull-Rom spline at the given position. | |
| template<typename T > | |
| bool | linesIntersect (Vector2T< T > line1Start, Vector2T< T > line1End, Vector2T< T > line2Start, Vector2T< T > line2End, Vector2T< T > *interPoint=0) |
| Test for intersection of line segments. More... | |
| template<typename T > | |
| Decltype< T, float >::mul | lineSlope (const Nimble::Vector2T< T > &lineStart, const Nimble::Vector2T< T > &lineEnd, int &slopeType, Nimble::Vector2T< T > &delta) |
| Compute slope of line. More... | |
| template<class T > | |
| Matrix4T< T > | mul (const Matrix4T< T > &m1, const Matrix4T< T > &m2) |
| Multiply two matrices. More... | |
| template<class T > | |
| Matrix4T< T > | operator* (const Matrix4T< T > &, const Matrix4T< T > &) |
| Compute the product of two matrices. | |
| template<class T > | |
| Vector4T< T > | operator* (const Matrix4T< T > &, const Vector4T< T > &) |
| Compute the product of the given matrix and vector. | |
| template<typename T , typename U > | |
| SizeT< typename Decltype< T, U > ::mul > | operator* (const SizeT< T > &size, U scalar) |
| Scale size by given scalar. More... | |
| template<typename T , typename U > | |
| SizeT< typename Decltype< U, T > ::mul > | operator* (U scalar, const SizeT< T > &size) |
| Scale size by given scalar. More... | |
| template<class T > | |
| Matrix2T< T > | operator* (const Matrix2T< T > &m1, const Matrix2T< T > &m2) |
| Multiply two matrices together. | |
| template<class T > | |
| Vector2T< T > | operator* (const Matrix2T< T > &m1, const Vector2T< T > &m2) |
| Multiply a matrix and a vector. | |
| template<class T , class S , typename = typename std::enable_if<std::is_arithmetic<S>::value>::type> | |
| Vector3T< typename Decltype< T, S >::mul > | operator* (const Nimble::Vector3T< T > &v, S s) |
| Multiply vector with a scalar (v * s) More... | |
| template<class T , class S , typename = typename std::enable_if<std::is_arithmetic<S>::value>::type> | |
| Vector3T< typename Decltype< S, T >::mul > | operator* (S s, const Nimble::Vector3T< T > &v) |
| Multiply vector with a scalar (s * v) More... | |
| template<class T , class S , typename = typename std::enable_if<std::is_arithmetic<S>::value>::type> | |
| Vector4T< typename Decltype< T, S >::mul > | operator* (const Nimble::Vector4T< T > &v, S s) |
| Multiply vector with a scalar (v * s) More... | |
| template<class T , class S , typename = typename std::enable_if<std::is_arithmetic<S>::value>::type> | |
| Vector4T< typename Decltype< S, T >::mul > | operator* (S s, const Nimble::Vector4T< T > &v) |
| Multiply vector with a scalar (s * v) More... | |
| template<class T , class S , typename = typename std::enable_if<std::is_arithmetic<S>::value>::type> | |
| Vector2T< typename Decltype< T, S >::mul > | operator* (const Nimble::Vector2T< T > &v, S s) |
| Multiply vector with a scalar (v * s) More... | |
| template<class T , class S , typename = typename std::enable_if<std::is_arithmetic<S>::value>::type> | |
| Vector2T< typename Decltype< S, T >::mul > | operator* (S s, const Nimble::Vector2T< T > &v) |
| Multiply vector with a scalar (s * v) More... | |
| template<class T > | |
| Nimble::Matrix3T< T > | operator* (const Nimble::Matrix3T< T > &m1, const Nimble::Matrix3T< T > &m2) |
| Multiply two matrices together. | |
| template<class K , class T > | |
| Nimble::Vector3T< T > | operator* (const Nimble::Matrix3T< K > &m1, const Nimble::Vector3T< T > &m2) |
| Multiply a matrix and a vector. | |
| template<typename T , typename U > | |
| SizeT< T > & | operator*= (SizeT< T > &lhs, U s) |
| Scales the given size. More... | |
| template<class T > | |
| Vector2T< T > | operator+ (const Vector2T< T > &v1, const Vector2T< T > &v2) |
| Add two vectors. | |
| template<class T > | |
| Matrix2T< T > | operator+ (const Matrix2T< T > &m1, const Matrix2T< T > &m2) |
| Add two matrices together. | |
| template<class T > | |
| Vector4T< T > | operator+ (const Vector4T< T > &v1, const Vector4T< T > &v2) |
| Add two vectors. | |
| template<class T > | |
| Vector2T< T > | operator- (const Vector2T< T > &v1, const Vector2T< T > &v2) |
| Subract two vectors. | |
| template<class T > | |
| Vector4T< T > | operator- (const Vector4T< T > &v1, const Vector4T< T > &v2) |
| Subtract two vectors. | |
| template<class T > | |
| Matrix2T< T > | operator- (const Matrix2T< T > &m1, const Matrix2T< T > &m2) |
| Subtract a matrix from another. | |
| template<typename T , typename U > | |
| SizeT< typename Decltype< T, U > ::div > | operator/ (const SizeT< T > &size, U scalar) |
| Divide the size component-wise by the given scalar. More... | |
| template<typename T , typename U > | |
| SizeT< typename Decltype< U, T > ::div > | operator/ (U scalar, const SizeT< T > &size) |
| Divide the size component-wise by the given scalar. More... | |
| template<typename T , typename U > | |
| SizeT< T > & | operator/= (SizeT< T > &lhs, U s) |
| Divides the given size. More... | |
| template<class T > | |
| std::ostream & | operator<< (std::ostream &os, const Nimble::Matrix2T< T > &m) |
| Output the given matrix to a stream. More... | |
| template<class T > | |
| std::ostream & | operator<< (std::ostream &os, const Nimble::Vector2T< T > &t) |
| Write a vector into a stream. | |
| template<class T > | |
| std::ostream & | operator<< (std::ostream &os, const Nimble::Vector3T< T > &t) |
| Output the given vector to a stream. More... | |
| template<> | |
| std::ostream & | operator<< (std::ostream &os, const Nimble::Vector3T< uint8_t > &t) |
| Output the given vector to a stream. More... | |
| template<class T > | |
| std::ostream & | operator<< (std::ostream &os, const Nimble::Vector4T< T > &t) |
| Serialize a 4D vector into a stream. | |
| template<class K , class T > | |
| K & | operator<< (K &os, const Nimble::Vector2T< T > &t) |
| Output the given vector to a stream. More... | |
| template<typename T > | |
| std::ostream & | operator<< (std::ostream &s, const QuaternionT< T > &v) |
| Serialization operator for Quaternions. | |
| template<class T > | |
| std::ostream & | operator<< (std::ostream &os, const Nimble::SizeT< T > &t) |
| Write a size into a stream. | |
| template<class T > | |
| std::ostream & | operator<< (std::ostream &os, const Nimble::RectT< T > &t) |
| Write a rect into a stream. | |
| template<class T > | |
| std::ostream & | operator<< (std::ostream &os, const Matrix4T< T > &m) |
| Output the given matrix to a stream. More... | |
| template<class T > | |
| std::ostream & | operator<< (std::ostream &os, const Nimble::Matrix3T< T > &m) |
| Output the given matrix to a stream. More... | |
| template<class T > | |
| std::istream & | operator>> (std::istream &is, Nimble::Matrix2T< T > &m) |
| Read a matrix from a stream. More... | |
| template<class T > | |
| std::istream & | operator>> (std::istream &is, Nimble::Vector2T< T > &t) |
| Read a vector from a stream. | |
| template<class T > | |
| std::istream & | operator>> (std::istream &is, Nimble::Vector3T< T > &t) |
| Read the given vector from a stream. More... | |
| template<class T > | |
| std::istream & | operator>> (std::istream &is, Nimble::Vector4T< T > &t) |
| De-serialize a 4D vector from a stream. | |
| template<> | |
| std::istream & | operator>> (std::istream &is, Nimble::Vector3T< uint8_t > &t) |
| Read the given vector from a stream. More... | |
| template<class T > | |
| std::istream & | operator>> (std::istream &is, Nimble::SizeT< T > &t) |
| Read a size from a stream. | |
| template<class T > | |
| std::istream & | operator>> (std::istream &is, Nimble::RectT< T > &t) |
| Read a rect from a stream. | |
| template<class T > | |
| std::istream & | operator>> (std::istream &is, Matrix4T< T > &m) |
| Read a matrix from a stream. More... | |
| template<class T > | |
| std::istream & | operator>> (std::istream &is, Nimble::Matrix3T< T > &m) |
| Read a matrix from a stream. More... | |
| template<class T > | |
| Vector4T< T > | projection (const Vector4T< T > &u, const Vector4T< T > &v) |
| Compute the projection of v onto u. More... | |
Nimble library is a collection of C++ classes for 2D/3D graphics.
Nimble is used mostly for simple arithmetic/geometric calculations. The code is optimized for performance, thus there are a lot of inline functions. Also, the vector and matrix classes do not initialize any of their members.
The matrix and vector classes use right-handed coordinates.
|
inline |
Return the length of the vector.
| t | vector whose length to get |
|
inline |
Return the length of the vector.
| t | vector whose length to get |
|
inline |
Get the length of the vector.
| t | vector whose length to get |
|
inline |
Return the cross-product of two vectors.
| a | first vector |
| b | second vector |
|
inline |
Compute the dot product of two vectors.
| t1 | first dot product vector |
| t2 | second dot product vector |
|
inline |
Compute the dot product of two vectors.
| a | first vector |
| b | second vector |
| T Nimble::evalCatmullRom | ( | float | t, |
| const std::vector< T > & | cp, | ||
| size_t | index = 0 |
||
| ) |
Evaluate a cubic Catmull-Rom spline on an interval.
| t | interpolation parameter [0, 1] |
| cp | vector of control points (needs at least four) |
| index | to the first control point used in interpolation. Used control points will be from [index, index + 3] |
| bool Nimble::linesIntersect | ( | Vector2T< T > | line1Start, |
| Vector2T< T > | line1End, | ||
| Vector2T< T > | line2Start, | ||
| Vector2T< T > | line2End, | ||
| Vector2T< T > * | interPoint = 0 |
||
| ) |
Test for intersection of line segments.
| line1Start,line1End | first line. |
| line2Start,line2End | second line. |
| interPoint | optional pointer to vector to receive the intersection point. |
| Decltype<T, float>::mul Nimble::lineSlope | ( | const Nimble::Vector2T< T > & | lineStart, |
| const Nimble::Vector2T< T > & | lineEnd, | ||
| int & | slopeType, | ||
| Nimble::Vector2T< T > & | delta | ||
| ) |
Compute slope of line.
| lineStart | Line starting point |
| lineEnd | Line end point |
| slopeType | reference to int to receive slope type. |
| delta | reference to Nimble::Vector2f to receive delta. |
|
inline |
Multiply two matrices.
| m1 | first matrix |
| m2 | second matrix |
|
inline |
Scale size by given scalar.
| size | size to scale |
| scalar | value to scale with |
|
inline |
Scale size by given scalar.
| scalar | value to scale with |
| size | size to scale |
| Vector3T<typename Decltype<T, S>::mul> Nimble::operator* | ( | const Nimble::Vector3T< T > & | v, |
| S | s | ||
| ) |
Multiply vector with a scalar (v * s)
| v | vector to multiply |
| s | scalar to multiply with |
| Vector3T<typename Decltype<S, T>::mul> Nimble::operator* | ( | S | s, |
| const Nimble::Vector3T< T > & | v | ||
| ) |
Multiply vector with a scalar (s * v)
| v | vector to multiply |
| s | scalar to multiply with |
| Vector4T<typename Decltype<T, S>::mul> Nimble::operator* | ( | const Nimble::Vector4T< T > & | v, |
| S | s | ||
| ) |
Multiply vector with a scalar (v * s)
| v | vector to multiply |
| s | scalar to multiply with |
| Vector4T<typename Decltype<S, T>::mul> Nimble::operator* | ( | S | s, |
| const Nimble::Vector4T< T > & | v | ||
| ) |
Multiply vector with a scalar (s * v)
| v | vector to multiply |
| s | scalar to multiply with |
| Vector2T<typename Decltype<T, S>::mul> Nimble::operator* | ( | const Nimble::Vector2T< T > & | v, |
| S | s | ||
| ) |
Multiply vector with a scalar (v * s)
| v | vector to multiply |
| s | scalar to multiply with |
| Vector2T<typename Decltype<S, T>::mul> Nimble::operator* | ( | S | s, |
| const Nimble::Vector2T< T > & | v | ||
| ) |
Multiply vector with a scalar (s * v)
| v | vector to multiply |
| s | scalar to multiply with |
| SizeT<T>& Nimble::operator*= | ( | SizeT< T > & | lhs, |
| U | s | ||
| ) |
Scales the given size.
| lhs | size |
| s | scale factor |
|
inline |
Divide the size component-wise by the given scalar.
| size | size to scale |
| scalar | value to divide with |
|
inline |
Divide the size component-wise by the given scalar.
| size | size to scale |
| scalar | value to divide with |
| SizeT<T>& Nimble::operator/= | ( | SizeT< T > & | lhs, |
| U | s | ||
| ) |
Divides the given size.
| lhs | size |
| s | division factor |
|
inline |
Output the given matrix to a stream.
| os | stream to output to |
| m | matrix to output |
|
inline |
Output the given vector to a stream.
| os | stream to output to |
| t | vector to output |
|
inline |
Output the given vector to a stream.
| os | stream to output to |
| t | vector to output |
|
inline |
Output the given vector to a stream.
| os | stream to output to |
| t | vector to output |
|
inline |
Output the given matrix to a stream.
| os | stream to output to |
| m | matrix to output |
|
inline |
Output the given matrix to a stream.
| os | stream to output to |
| m | matrix to output |
|
inline |
Read a matrix from a stream.
| is | stream to read from |
| m | matrix to read to |
|
inline |
Read the given vector from a stream.
| is | stream to read from |
| t | vector to read |
|
inline |
Read the given vector from a stream.
| is | stream to read from |
| t | vector to read |
|
inline |
Read a matrix from a stream.
| is | stream to read from |
| m | matrix to read to |
|
inline |
Read a matrix from a stream.
| is | stream to read from |
| m | matrix to read to |
|
inline |
Compute the projection of v onto u.
| u | vector to project onto |
| v | vector to project |