diff --git a/src/mol-math/linear-algebra/3d/mat3.ts b/src/mol-math/linear-algebra/3d/mat3.ts index 741a6fa72539586f191dae7bd4a935ddf1f7c1af..937403309d7dc9d94feb7cd60d102f1e23ddfb1d 100644 --- a/src/mol-math/linear-algebra/3d/mat3.ts +++ b/src/mol-math/linear-algebra/3d/mat3.ts @@ -26,6 +26,37 @@ namespace Mat3 { ret[0] = 0.0; return ret as any; } + + export function toArray(a: Mat3, out: Helpers.NumberArray, offset: number) { + out[offset + 0] = a[0]; + out[offset + 1] = a[1]; + out[offset + 2] = a[2]; + out[offset + 3] = a[3]; + out[offset + 4] = a[4]; + out[offset + 5] = a[5]; + out[offset + 6] = a[6]; + out[offset + 7] = a[7]; + out[offset + 8] = a[8]; + out[offset + 9] = a[9]; + out[offset + 10] = a[10]; + out[offset + 11] = a[11]; + } + + export function fromArray(a: Mat3, array: Helpers.NumberArray, offset: number) { + a[0] = array[offset + 0] + a[1] = array[offset + 1] + a[2] = array[offset + 2] + a[3] = array[offset + 3] + a[4] = array[offset + 4] + a[5] = array[offset + 5] + a[6] = array[offset + 6] + a[7] = array[offset + 7] + a[8] = array[offset + 8] + a[9] = array[offset + 9] + a[10] = array[offset + 10] + a[11] = array[offset + 11] + return a + } } export default Mat3 \ No newline at end of file diff --git a/src/mol-math/linear-algebra/3d/mat4.ts b/src/mol-math/linear-algebra/3d/mat4.ts index c1d75c8add79fdcdd1e575a6b366c69204b0f89f..d43158781865855521e1b9015f710cf35d93fbd4 100644 --- a/src/mol-math/linear-algebra/3d/mat4.ts +++ b/src/mol-math/linear-algebra/3d/mat4.ts @@ -142,6 +142,7 @@ namespace Mat4 { a[13] = array[offset + 13] a[14] = array[offset + 14] a[15] = array[offset + 15] + return a } export function copy(out: Mat4, a: Mat4) { diff --git a/src/mol-math/linear-algebra/3d/quat.ts b/src/mol-math/linear-algebra/3d/quat.ts index 69919f9d3d1dac450672a7a1d1a1edfcc6680c43..a8253363c29d9357fc27674f2fad27a828ef8f1e 100644 --- a/src/mol-math/linear-algebra/3d/quat.ts +++ b/src/mol-math/linear-algebra/3d/quat.ts @@ -267,6 +267,21 @@ namespace Quat { return out; } + export function toArray(a: Quat, out: Helpers.NumberArray, offset: number) { + out[offset + 0] = a[0]; + out[offset + 1] = a[1]; + out[offset + 2] = a[2]; + out[offset + 3] = a[3]; + } + + export function fromArray(a: Quat, array: Helpers.NumberArray, offset: number) { + a[0] = array[offset + 0] + a[1] = array[offset + 1] + a[2] = array[offset + 2] + a[3] = array[offset + 3] + return a + } + export function copy(out: Quat, a: Quat) { out[0] = a[0]; out[1] = a[1]; diff --git a/src/mol-math/linear-algebra/3d/vec3.ts b/src/mol-math/linear-algebra/3d/vec3.ts index aa8e27d4f98226fe14c747cdd4486533ad265636..bbf28f3acaebb6eba66a2831f2fe34871abf5504 100644 --- a/src/mol-math/linear-algebra/3d/vec3.ts +++ b/src/mol-math/linear-algebra/3d/vec3.ts @@ -54,6 +54,7 @@ namespace Vec3 { out[offset + 0] = v[0] out[offset + 1] = v[1] out[offset + 2] = v[2] + return v } export function create(x: number, y: number, z: number): Vec3 { diff --git a/src/mol-math/linear-algebra/3d/vec4.ts b/src/mol-math/linear-algebra/3d/vec4.ts index c6c568ec851480dcd883fa411403206530fab43c..582058a6af7ca77d78ebe719fb18e263b334b6a5 100644 --- a/src/mol-math/linear-algebra/3d/vec4.ts +++ b/src/mol-math/linear-algebra/3d/vec4.ts @@ -48,6 +48,21 @@ namespace Vec4 { return out; } + export function toArray(a: Vec4, out: Helpers.NumberArray, offset: number) { + out[offset + 0] = a[0]; + out[offset + 1] = a[1]; + out[offset + 2] = a[2]; + out[offset + 3] = a[3]; + } + + export function fromArray(a: Vec4, array: Helpers.NumberArray, offset: number) { + a[0] = array[offset + 0] + a[1] = array[offset + 1] + a[2] = array[offset + 2] + a[3] = array[offset + 3] + return a + } + export function copy(out: Vec4, a: Vec4) { out[0] = a[0]; out[1] = a[1];