Module: tsr

TSR (translation, scale, rotation} utility routines.

Summary

Methods

Detailed Description

Methods

copy(tsr, tsr2)

Copy one TSR vector to another.
Parameters:
Name Type Description
tsr TSR Source TSR vector
tsr2 TSR Destination TSR vector
Source:

create() → {TSR}

Create a new identity TSR vector.
Returns:
New TSR vector
Type
TSR
Source:

from_mat4(mat, dest) → {TSR}

Set TSR from mat4. Not optimized.
Parameters:
Name Type Description
mat Mat4 Matrix.
dest TSR Destination TSR vector.
Returns:
Destination TSR vector.
Type
TSR
Source:

from_values(x, y, z, s, qx, qy, qz, qw) → {TSR}

Create a new TSR vector from given values.
Parameters:
Name Type Description
x number X translation.
y number Y translation.
z number Z translation.
s number Scale.
qx number X quaternion rotation.
qy number Y quaternion rotation.
qz number Z quaternion rotation.
qw number W quaternion rotation.
Returns:
New TSR vector
Type
TSR
Source:

get_quat_view() → {Quat}

Get ArrayBufferView from quaternion part of TSR.
Returns:
Quaternion part of TSR
Type
Quat
Source:

get_scale() → {number}

Get TSR scale.
Returns:
Scale
Type
number
Source:

get_trans_view(tsr) → {Vec3}

Get ArrayBufferView from translation part of TSR.
Parameters:
Name Type Description
tsr TSR TSR vector
Returns:
Translation part of TSR
Type
Vec3
Source:

identity(tsr)

Set TSR to identity.
Parameters:
Name Type Description
tsr TSR TSR vector
Source:

interpolate(tsr, tsr2, factor, dest) → {TSR}

Perform interpolation between two TSR vectors.
Parameters:
Name Type Description
tsr TSR First TSR vector
tsr2 TSR Second TSR vector
factor number Interpolation factor
dest TSR Destination TSR vector
Returns:
Destination TSR vector
Type
TSR
Source:

invert(tsr, dest) → {TSR}

Calculates the inverse of TSR.
Parameters:
Name Type Description
tsr TSR TSR vector
dest TSR Destination TSR vector
Returns:
Destination TSR vector
Type
TSR
Source:

multiply(tsr, tsr2, dest) → {TSR}

Multiply two TSRs.
Parameters:
Name Type Description
tsr TSR First TSR vector
tsr2 TSR Second TSR vector
dest TSR Destination TSR vector
Returns:
Destination TSR vector
Type
TSR
Source:

set_quat(quat, dest)

Set TSR quaternion.
Parameters:
Name Type Description
quat Quat Rotation quaternion
dest TSR Destination TSR vector
Source:

set_scale(scale, dest)

Set TSR scale.
Parameters:
Name Type Description
scale number Scale
dest TSR Destination TSR vector
Source:

set_sep(trans, scale, quat, destopt) → {TSR}

Set TSR from separate trans, scale and quat.
Parameters:
Name Type Attributes Description
trans Vec3 Translation vector
scale number Scale
quat Quat Rotation quaternion
dest TSR <optional>
Destination TSR vector
Returns:
dest Destination TSR vector
Type
TSR
Source:

set_trans(trans, dest)

Set TSR translation.
Parameters:
Name Type Description
trans Vec3 Translation vector
dest TSR Destination TSR vector
Source:

set_transcale(transcale, dest)

Set TSR translation and scale from vec4.
Parameters:
Name Type Description
transcale Vec4 Translation+Scale vector
dest TSR Destination TSR vector
Source:

to_mat4(tsr, destopt, nullable) → {Mat4}

Create mat4 from TSR. Not optimized.
Parameters:
Name Type Attributes Default Description
tsr TSR TSR vector.
dest Mat4 <optional>
<nullable>
mat4.create() Destination matrix.
Returns:
Destination matrix.
Type
Mat4
Source:

transform_dir_vec3(trans, tsr, dest)

Transform directional vec3 by TSR.
Parameters:
Name Type Description
trans Vec3 Vector to transform
tsr TSR TSR vector
dest Vec3 Destination vector
Source:

transform_dir_vectors(vectors, tsr, new_vectors, dest_offsetopt) → {Float32Array}

Transform directional vec3 vectors by TSR. optional destination offset in values (not vectors, not bytes)
Parameters:
Name Type Attributes Default Description
vectors Float32Array Array of vectors to transform
tsr TSR TSR vector
new_vectors Float32Array Destination array of vectors
dest_offset number <optional>
0 Offset in new_vectors array
Returns:
Destination array of vectors
Type
Float32Array
Source:

transform_tangents(vectors, tsr, new_vectors, dest_offsetopt) → {Float32Array}

Transform 4 comp tangent vectors by matrix. optional destination offset in values (not vectors, not bytes)
Parameters:
Name Type Attributes Default Description
vectors Float32Array Array of vectors to transform
tsr TSR TSR vector
new_vectors Float32Array Destination array of vectors
dest_offset number <optional>
0 Offset in new_vectors array
Returns:
Destination array of vectors
Type
Float32Array
Source:

transform_vec3(trans, tsr, dest)

Transform vec3 by TSR.
Parameters:
Name Type Description
trans Vec3 Vector to transform
tsr TSR TSR vector
dest Vec3 Destination vector
Source:

transform_vec3_inv(trans, tsr, dest)

Transform vec3 by inverse TSR.
Parameters:
Name Type Description
trans Vec3 Vector to transform
tsr TSR TSR vector
dest Vec3 Destination vector
Source:

transform_vectors(vectors, tsr, new_vectors, dest_offsetopt) → {Float32Array}

Transform vec3 vectors by TSR. optional destination offset in values (not vectors, not bytes)
Parameters:
Name Type Attributes Default Description
vectors Float32Array Array of vectors to transform
tsr TSR TSR vector
new_vectors Float32Array Destination array of vectors
dest_offset number <optional>
0 Offset in new_vectors array
Returns:
Destination array of vectors
Type
Float32Array
Source:

translate(tsr, trans, dest) → {TSR}

Perform TSR translation by given vec3.
Parameters:
Name Type Description
tsr TSR TSR vector
trans Vec3 Translation vector
dest TSR Destination TSR vector
Returns:
Destination TSR vector
Type
TSR
Source: