Loading...
Searching...
No Matches
Matrix

#include <Ultralight/Matrix.h>

Overview

Transformation Matrix helper.

Public Types

typedef double Aligned4x4[4][4]
 

Public Member Functions

void SetIdentity ()
 Set to identity matrix.
 
void SetOrthographicProjection (double screen_width, double screen_height, bool flip_y)
 Set to an orthographic projection matrix suitable for use with our vertex shaders.
 
void Set (const Matrix &other)
 Set to another matrix.
 
void Set (const Matrix4x4 &other)
 Set to another matrix.
 
void Set (double a, double b, double c, double d, double e, double f)
 Set from raw affine members.
 
void Set (double m11, double m12, double m13, double m14, double m21, double m22, double m23, double m24, double m31, double m32, double m33, double m34, double m41, double m42, double m43, double m44)
 Set from raw 4x4 components.
 
double m11 () const
 
double m12 () const
 
double m13 () const
 
double m14 () const
 
double m21 () const
 
double m22 () const
 
double m23 () const
 
double m24 () const
 
double m31 () const
 
double m32 () const
 
double m33 () const
 
double m34 () const
 
double m41 () const
 
double m42 () const
 
double m43 () const
 
double m44 () const
 
double a () const
 
double b () const
 
double c () const
 
double d () const
 
double e () const
 
double f () const
 
bool IsIdentity () const
 Whether or not this is an identity matrix.
 
bool IsIdentityOrTranslation () const
 Whether or not this is an identity matrix or translation.
 
bool IsAffine () const
 Whether or not this matrix uses only affine transformations.
 
bool IsSimple () const
 Whether or not this is an identity, translation, or non-negative uniform scale.
 
void Translate (double x, double y)
 Translate by x and y.
 
void Scale (double x, double y)
 Scale by x and y.
 
void Rotate (double theta)
 Rotate matrix by theta (in degrees)
 
void Rotate (double x, double y)
 Rotate matrix by x and y.
 
void Transform (const Matrix &other)
 Transform (multiply) by another Matrix.
 
bool GetInverse (Matrix &result) const
 Get the inverse of this matrix.
 
Point Apply (const Point &p) const
 Transform point by this matrix and get the result.
 
Rect Apply (const Rect &r) const
 Transform rect by this matrix and get the result as an axis-aligned rect.
 
uint32_t Hash () const
 Get an integer hash of this matrix's members.
 
Matrix4x4 GetMatrix4x4 () const
 Get this matrix as unaligned 4x4 float components (for use passing to GPU driver APIs).
 

Public Attributes

Aligned4x4 data
 Raw matrix data in column-major order (eg, data[column][row])
 

Member Typedef Documentation

◆ Aligned4x4

typedef double Aligned4x4[4][4]

Member Function Documentation

◆ a()

double a ( ) const
inline

◆ Apply() [1/2]

Point Apply ( const Point & p) const

Transform point by this matrix and get the result.

◆ Apply() [2/2]

Rect Apply ( const Rect & r) const

Transform rect by this matrix and get the result as an axis-aligned rect.

◆ b()

double b ( ) const
inline

◆ c()

double c ( ) const
inline

◆ d()

double d ( ) const
inline

◆ e()

double e ( ) const
inline

◆ f()

double f ( ) const
inline

◆ GetInverse()

bool GetInverse ( Matrix & result) const

Get the inverse of this matrix.

May return false if not invertible.

◆ GetMatrix4x4()

Matrix4x4 GetMatrix4x4 ( ) const

Get this matrix as unaligned 4x4 float components (for use passing to GPU driver APIs).

◆ Hash()

uint32_t Hash ( ) const

Get an integer hash of this matrix's members.

◆ IsAffine()

bool IsAffine ( ) const

Whether or not this matrix uses only affine transformations.

◆ IsIdentity()

bool IsIdentity ( ) const

Whether or not this is an identity matrix.

◆ IsIdentityOrTranslation()

bool IsIdentityOrTranslation ( ) const

Whether or not this is an identity matrix or translation.

◆ IsSimple()

bool IsSimple ( ) const

Whether or not this is an identity, translation, or non-negative uniform scale.

◆ m11()

double m11 ( ) const
inline

◆ m12()

double m12 ( ) const
inline

◆ m13()

double m13 ( ) const
inline

◆ m14()

double m14 ( ) const
inline

◆ m21()

double m21 ( ) const
inline

◆ m22()

double m22 ( ) const
inline

◆ m23()

double m23 ( ) const
inline

◆ m24()

double m24 ( ) const
inline

◆ m31()

double m31 ( ) const
inline

◆ m32()

double m32 ( ) const
inline

◆ m33()

double m33 ( ) const
inline

◆ m34()

double m34 ( ) const
inline

◆ m41()

double m41 ( ) const
inline

◆ m42()

double m42 ( ) const
inline

◆ m43()

double m43 ( ) const
inline

◆ m44()

double m44 ( ) const
inline

◆ Rotate() [1/2]

void Rotate ( double theta)

Rotate matrix by theta (in degrees)

◆ Rotate() [2/2]

void Rotate ( double x,
double y )

Rotate matrix by x and y.

◆ Scale()

void Scale ( double x,
double y )

Scale by x and y.

◆ Set() [1/4]

void Set ( const Matrix & other)

Set to another matrix.

◆ Set() [2/4]

void Set ( const Matrix4x4 & other)

Set to another matrix.

◆ Set() [3/4]

void Set ( double a,
double b,
double c,
double d,
double e,
double f )

Set from raw affine members.

◆ Set() [4/4]

void Set ( double m11,
double m12,
double m13,
double m14,
double m21,
double m22,
double m23,
double m24,
double m31,
double m32,
double m33,
double m34,
double m41,
double m42,
double m43,
double m44 )

Set from raw 4x4 components.

◆ SetIdentity()

void SetIdentity ( )

Set to identity matrix.

◆ SetOrthographicProjection()

void SetOrthographicProjection ( double screen_width,
double screen_height,
bool flip_y )

Set to an orthographic projection matrix suitable for use with our vertex shaders.

Optionally flip the y-coordinate space (eg, for OpenGL).

◆ Transform()

void Transform ( const Matrix & other)

Transform (multiply) by another Matrix.

◆ Translate()

void Translate ( double x,
double y )

Translate by x and y.

Member Data Documentation

◆ data

Aligned4x4 data

Raw matrix data in column-major order (eg, data[column][row])


The documentation for this struct was generated from the following file: