This documentation is automatically generated from the openFrameworks source code using doxygen and refers to the most recent release, version 0.12.0.
ofMatrix4x4.h
Go to the documentation of this file.
677 return std::isnan(_mat[0][0]) || std::isnan(_mat[0][1]) || std::isnan(_mat[0][2]) || std::isnan(_mat[0][3]) ||
678 std::isnan(_mat[1][0]) || std::isnan(_mat[1][1]) || std::isnan(_mat[1][2]) || std::isnan(_mat[1][3]) ||
679 std::isnan(_mat[2][0]) || std::isnan(_mat[2][1]) || std::isnan(_mat[2][2]) || std::isnan(_mat[2][3]) ||
680 std::isnan(_mat[3][0]) || std::isnan(_mat[3][1]) || std::isnan(_mat[3][2]) || std::isnan(_mat[3][3]);
837inline ofMatrix4x4 ofMatrix4x4::newLookAtMatrix(const ofVec3f& eye, const ofVec3f& center, const ofVec3f& up) {
The ofMatrix4x4 is the big class of the math part of openFrameworks.
Definition ofMatrix4x4.h:58
ofMatrix4x4 operator*(const ofMatrix4x4 &m) const
creates a new matrix from the product of two matrices.
Definition ofMatrix4x4.h:547
bool isValid() const
Checks if the matrix is valid by ensuring its items are numbers.
Definition ofMatrix4x4.h:365
void makeFromMultiplicationOf(const ofMatrix4x4 &, const ofMatrix4x4 &)
Matrix becomes the result of the multiplication of two other matrices.
Definition ofMatrix4x4.cpp:440
ofMatrix4x4 getInverse() const
Gets the inverse matrix.
Definition ofMatrix4x4.cpp:586
void makeTranslationMatrix(const ofVec3f &)
Definition ofMatrix4x4.cpp:382
ofMatrix4x4(float const *const ptr)
Construct with a pointer.
Definition ofMatrix4x4.h:90
void operator*=(const ofMatrix4x4 &other)
The *= operation for matrices.
Definition ofMatrix4x4.h:539
void glRotateRad(float angle, float x, float y, float z)
void set(double const *const ptr)
void makeOrtho2DMatrix(double left, double right, double bottom, double top)
Matrix becomes a 2D orthographic projection matrix.
void glTranslate(const ofVec3f &v)
ofVec3f getScale() const
void set(float const *const ptr)
ofMatrix4x4 & operator=(const ofMatrix4x4 &rhs)
Copy a matrix using = operator.
static ofMatrix4x4 newPerspectiveMatrix(double fovy, double aspectRatio, double zNear, double zFar)
bool getPerspective(double &fovy, double &aspectRatio, double &zNear, double &zFar) const
Get the frustum settings of a symmetric perspective projection matrix.
Definition ofMatrix4x4.cpp:902
ofVec4f _mat[4]
The values of the matrix, stored in row-major order.
Definition ofMatrix4x4.h:63
static ofMatrix4x4 newOrtho2DMatrix(double left, double right, double bottom, double top)
void scale(const ofVec3f &v)
Scales each axis by the corresponding x, y, z of the vector.
void makeRotationMatrix(const ofVec3f &from, const ofVec3f &to)
Definition ofMatrix4x4.cpp:394
void rotateRad(float angle, float x, float y, float z)
Rotates by angle (radians) around the given x, y, z axis.
void postMultTranslate(const ofVec3f &v)
Equivalent to postMult(newTranslationMatrix(v)).
ofMatrix4x4(const ofQuaternion &quat)
Rotation matrices can be constructed from a quaternion.
Definition ofMatrix4x4.h:95
void decompose(ofVec3f &translation, ofQuaternion &rotation, ofVec3f &scale, ofQuaternion &so) const
Decompose the matrix into translation, rotation, scale and scale orientation.
Definition ofMatrix4x4.cpp:1500
static ofMatrix4x4 getInverseOf(const ofMatrix4x4 &matrix)
Create new matrices as transformation of another.
static ofMatrix4x4 newOrthoMatrix(double left, double right, double bottom, double top, double zNear, double zFar)
bool makeInvertOf(const ofMatrix4x4 &rhs)
Matrix becomes the inverse of the provided matrix.
Definition ofMatrix4x4.cpp:581
void makeLookAtViewMatrix(const ofVec3f &eye, const ofVec3f ¢er, const ofVec3f &up)
Matrix becomes a combination of an inverse translation and rotation.
Definition ofMatrix4x4.cpp:918
void postMultRotate(const ofQuaternion &q)
Equivalent to postMult(newRotationMatrix(q)).
void glScale(const ofVec3f &v)
void getLookAt(ofVec3f &eye, ofVec3f ¢er, ofVec3f &up, float lookDistance=1.0f) const
Gets the lookAt determiners of the matrix.
Definition ofMatrix4x4.cpp:942
bool getFrustum(double &left, double &right, double &bottom, double &top, double &zNear, double &zFar) const
Gets the perspective components for a frustum projection matrix.
Definition ofMatrix4x4.cpp:870
ofVec3f getTranslation() const
static ofMatrix4x4 newTranslationMatrix(float x, float y, float z)
static ofMatrix4x4 newTranslationMatrix(const ofVec3f &dv)
static ofMatrix4x4 newRotationMatrix(float angle, const ofVec3f &axis)
void makeLookAtMatrix(const ofVec3f &eye, const ofVec3f ¢er, const ofVec3f &up)
Matrix becomes a combination of translation and rotation.
Definition ofMatrix4x4.cpp:930
void makePerspectiveMatrix(double fovy, double aspectRatio, double zNear, double zFar)
Matrix becomes a perspective projection matrix.
Definition ofMatrix4x4.cpp:890
ofVec4f postMult(const ofVec4f &v) const
static ofMatrix4x4 newRotationMatrix(float angle, float x, float y, float z)
void makeIdentityMatrix()
Matrix becomes the identity matrix.
Definition ofMatrix4x4.cpp:361
static ofMatrix4x4 newRotationMatrix(const ofVec3f &from, const ofVec3f &to)
static ofMatrix4x4 getOrthoNormalOf(const ofMatrix4x4 &matrix)
Makes a new matrix which is the given matrix, normalized.
void makeFrustumMatrix(double left, double right, double bottom, double top, double zNear, double zFar)
Matrix becomes a perspective projection matrix.
Definition ofMatrix4x4.cpp:855
void preMultScale(const ofVec3f &v)
Equivalent to preMult(newScaleMatrix(v)).
void postMultTranslate(float x, float y, float z)
ofVec3f getRowAsVec3f(std::size_t i) const
returns a copy of row i
Definition ofMatrix4x4.h:335
static ofMatrix4x4 newScaleMatrix(float sx, float sy, float sz)
static ofMatrix4x4 newLookAtMatrix(const ofVec3f &eye, const ofVec3f ¢er, const ofVec3f &up)
float & operator()(std::size_t row, std::size_t col)
Write data with matrix(row,col)=number
Definition ofMatrix4x4.h:325
void setTranslation(float tx, float ty, float tz)
Definition ofMatrix4x4.cpp:346
static ofMatrix4x4 newIdentityMatrix(void)
static ofMatrix4x4 getTransposedOf(const ofMatrix4x4 &matrix)
Makes a new matrix which is the transpose of the given matrix.
void makeOrthoNormalOf(const ofMatrix4x4 &rhs)
Matrix becomes an orthonormalized version of the provided matrix.
Definition ofMatrix4x4.cpp:515
static ofMatrix4x4 newScaleMatrix(const ofVec3f &sv)
static ofVec3f transform3x3(const ofMatrix4x4 &m, const ofVec3f &v)
Apply a 3x3 transform (no translation) of M * v.
void preMultTranslate(const ofVec3f &v)
Equivalent to preMult(newTranslationMatrix(v)).
void scale(float x, float y, float z)
Scales each axis by the corresponding x, y, z.
void makeOrthoMatrix(double left, double right, double bottom, double top, double zNear, double zFar)
Matrix becomes an orthographic projection matrix.
Definition ofMatrix4x4.cpp:822
void postMultScale(float x, float y, float z)
static ofMatrix4x4 newRotationMatrix(const ofQuaternion &quat)
void glRotate(float angle, float x, float y, float z)
void postMultRotate(float angle, float x, float y, float z)
void glScale(float x, float y, float z)
static ofMatrix4x4 newFrustumMatrix(double left, double right, double bottom, double top, double zNear, double zFar)
static ofMatrix4x4 newRotationMatrix(float angle1, const ofVec3f &axis1, float angle2, const ofVec3f &axis2, float angle3, const ofVec3f &axis3)
ofMatrix4x4()
The default constructor provides an identity matrix.
Definition ofMatrix4x4.h:72
void preMultRotate(const ofQuaternion &q)
Equivalent to preMult(newRotationMatrix(q)).
static ofVec3f transform3x3(const ofVec3f &v, const ofMatrix4x4 &m)
Apply a 3x3 transform (no translation) of v * M.
ofVec4f getRowAsVec4f(std::size_t i) const
returns a copy of row i
Definition ofMatrix4x4.h:340
float * getPtr()
Access the internal data in float* format useful for opengl matrix transformations.
Definition ofMatrix4x4.h:351
ofVec4f preMult(const ofVec4f &v) const
void glRotate(const ofQuaternion &q)
void rotate(float angle, float x, float y, float z)
Rotates by angle (degrees) around the given x, y, z axis.
float operator()(std::size_t row, std::size_t col) const
Read data with matrix(row, col)
Definition ofMatrix4x4.h:330
bool getOrtho(double &left, double &right, double &bottom, double &top, double &zNear, double &zFar) const
Get the perspective components from a matrix.
Definition ofMatrix4x4.cpp:836
void glTranslate(float tx, float ty, float tz)
Definition ofQuaternion.h:27
bool zeroRotation() const
return true if the Quat represents a zero rotation, and therefore can be ignored in computations.
Definition ofQuaternion.h:343
float * getPtr()
Returns a pointer to the memory position of the first element of the vector ('x'); the other elements...
Definition ofVec3f.h:156
Definition ofVec4f.h:11
std::ostream & operator<<(std::ostream &os, const ofMatrix3x3 &M)
Definition ofMatrix3x3.cpp:304
#define d
#define tx
#define ty
#define tz