Box2D 2.4.1
A 2D physics engine for games
Loading...
Searching...
No Matches
b2Mat22 Struct Reference

A 2-by-2 matrix. Stored in column-major order. More...

#include <b2_math.h>

Public Member Functions

 b2Mat22 ()=default
 The default constructor does nothing (for performance).
 
 b2Mat22 (const b2Vec2 &c1, const b2Vec2 &c2)
 Construct this matrix using columns.
 
 b2Mat22 (float a11, float a12, float a21, float a22)
 Construct this matrix using scalars.
 
void Set (const b2Vec2 &c1, const b2Vec2 &c2)
 Initialize this matrix using columns.
 
void SetIdentity ()
 Set this to the identity matrix.
 
void SetZero ()
 Set this matrix to all zeros.
 
b2Mat22 GetInverse () const
 
b2Vec2 Solve (const b2Vec2 &b) const
 

Public Attributes

b2Vec2 ex
 
b2Vec2 ey
 

Detailed Description

A 2-by-2 matrix. Stored in column-major order.

Member Function Documentation

◆ Solve()

b2Vec2 b2Mat22::Solve ( const b2Vec2 & b) const
inline

Solve A * x = b, where b is a column vector. This is more efficient than computing the inverse in one-shot cases.


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