linearly v0.32.0Docs


linearly v0.32.0 / mat4 / fromRotationTranslationScaleOrigin

Function: fromRotationTranslationScaleOrigin()

fromRotationTranslationScaleOrigin(rot, trans, scale, origin): number[]

Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the given origin This is equivalent to (but much faster than):

mat4.identity(dest);
mat4.translate(dest, vec);
mat4.translate(dest, origin);
const quatMat = mat4.create();
quat4.toMat4(quat, quatMat);
mat4.multiply(dest, quatMat);
mat4.scale(dest, scale)
mat4.translate(dest, negativeOrigin);

Parameters

rot: quat

Rotation quaternion

trans: vec3

Translation vector

scale: vec3 = vec3.one

Scaling vector

origin: vec3 = vec3.zero

The origin vector around which to scale and rotate

Returns

number[]

Defined in

src/mat4.ts:956open in new window