[][src]Module box2d_rs::b2_math

Structs

B2Mat22

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

B2Mat33

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

B2Rot

Rotation

B2Sweep

This describes the motion of a body/shape for TOI computation. Shapes are defined with respect to the body origin, which may no coincide with the center of mass. However, to support dynamics we must interpolate the center of mass position.

B2Transform

A transform contains translation and rotation. It is used to represent the position and orientation of rigid frames.

B2Vec3

A 2D column vector with 3 elements.

B2vec2

A 2D column vector.

Functions

b2_abs
b2_abs_i32
b2_abs_mat22
b2_abs_vec2
b2_atan2
b2_clamp
b2_clamp_vec2
b2_cross

Perform the cross product on two vectors. In 2D this produces a scalar.

b2_cross_scalar_by_vec

Perform the cross product on a scalar and a vector. In 2D this produces a vector.

b2_cross_vec3

Perform the cross product on two vectors.

b2_cross_vec_by_scalar

Perform the cross product on a vector and a scalar. In 2D this produces a vector.

b2_distance_vec2
b2_distance_vec2_squared
b2_dot

Perform the dot product on two vectors.

b2_dot_vec3

Perform the dot product on two vectors.

b2_is_power_of_two
b2_is_valid
b2_max
b2_max_vec2
b2_min
b2_min_vec2
b2_mul

Multiply a matrix times a vector. If a rotation matrix is provided, then this transforms the vector from one frame to another.

b2_mul22

Multiply a matrix times a vector.

b2_mul_mat22
b2_mul_mat33

Multiply a matrix times a vector.

b2_mul_rot

Multiply two rotations: q * r

b2_mul_rot_by_vec2

Rotate a vector

b2_mul_t

Multiply a matrix transpose times a vector. If a rotation matrix is provided, then this transforms the vector from one frame to another (inverse transform).

b2_mul_t_mat22
b2_mul_t_rot

Transpose multiply two rotations: qT * r

b2_mul_t_rot_by_vec2

Inverse rotate a vector

b2_mul_t_transform
b2_mul_t_transform_by_vec2
b2_mul_transform
b2_mul_transform_by_vec2
b2_next_power_of_two

"Next Largest Power of 2 Given a binary integer value x, the next largest power of 2 can be computed by a SWAR algorithm that recursively "folds" the upper bits into the lower bits. This process yields a bit vector with the same most significant 1 as x, but all 1's below it. Adding 1 to that value yields the next largest power of 2. For a 32-bit value:"

b2_sqrt
b2_swap
b2_sweep_advance
b2_sweep_get_transform
b2_sweep_normalize

normalize an angle in radians to be between -pi and pi

is_equal
not_equal