From e021b3a9851587ed8d83c3d6edbd65a1c56de064 Mon Sep 17 00:00:00 2001 From: greggman Date: Sat, 1 Jun 2024 15:18:28 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20greggman?= =?UTF-8?q?/wgpu-matrix@55566ce4c064c7a1d977d43c202131cf05527ade=20?= =?UTF-8?q?=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 84 +- dist/2.x/mat3-impl.d.ts | 271 - dist/2.x/mat3.d.ts | 6 - dist/2.x/mat4-impl.d.ts | 507 -- dist/2.x/mat4.d.ts | 6 - dist/2.x/quat-impl.d.ts | 298 - dist/2.x/quat.d.ts | 44 - dist/2.x/vec2-impl.d.ts | 385 -- dist/2.x/vec2.d.ts | 63 - dist/2.x/vec3-impl.d.ts | 445 -- dist/2.x/vec3.d.ts | 43 - dist/2.x/vec4-impl.d.ts | 345 - dist/2.x/vec4.d.ts | 44 - dist/2.x/wgpu-matrix.d.ts | 20 - dist/2.x/wgpu-matrix.js.map | 1 - dist/2.x/wgpu-matrix.min.js | 2 - dist/2.x/wgpu-matrix.min.js.map | 1 - dist/2.x/wgpu-matrix.module.js | 5758 ----------------- dist/2.x/wgpu-matrix.module.js.map | 1 - dist/2.x/wgpu-matrix.module.min.js | 2 - dist/2.x/wgpu-matrix.module.min.js.map | 1 - dist/3.x/mat3-impl.d.ts | 36 + dist/3.x/mat3.d.ts | 9 + dist/3.x/mat4-impl.d.ts | 51 + dist/3.x/mat4.d.ts | 9 + dist/3.x/quat-impl.d.ts | 68 + dist/3.x/quat.d.ts | 9 + dist/3.x/types.d.ts | 19 + dist/{2.x => 3.x}/utils.d.ts | 0 dist/3.x/vec2-impl.d.ts | 55 + dist/3.x/vec2.d.ts | 9 + dist/3.x/vec3-impl.d.ts | 63 + dist/3.x/vec3.d.ts | 9 + dist/3.x/vec4-impl.d.ts | 73 + dist/3.x/vec4.d.ts | 9 + dist/3.x/wgpu-matrix.d.ts | 847 +++ dist/3.x/wgpu-matrix.js | 5620 ++++++++++++++++ dist/3.x/wgpu-matrix.js.map | 1 + dist/3.x/wgpu-matrix.min.js | 2 + dist/3.x/wgpu-matrix.min.js.map | 1 + .../wgpu-matrix.module.js} | 4989 +++++++------- dist/3.x/wgpu-matrix.module.js.map | 1 + dist/3.x/wgpu-matrix.module.min.js | 2 + dist/3.x/wgpu-matrix.module.min.js.map | 1 + docs/assets/highlight.css | 7 + docs/assets/icons.js | 2 +- docs/assets/icons.svg | 2 +- docs/assets/main.js | 8 +- docs/assets/navigation.js | 2 +- docs/assets/search.js | 2 +- docs/assets/style.css | 75 +- docs/functions/mat3.clone.html | 12 +- docs/functions/mat3.copy.html | 12 +- docs/functions/mat3.create.html | 16 +- docs/functions/mat3.determinant.html | 6 +- docs/functions/mat3.equals.html | 8 +- docs/functions/mat3.equalsApproximately.html | 8 +- docs/functions/mat3.fromMat4.html | 10 +- docs/functions/mat3.fromQuat.html | 10 +- docs/functions/mat3.getAxis.html | 8 +- docs/functions/mat3.getScaling.html | 5 +- docs/functions/mat3.getTranslation.html | 10 +- docs/functions/mat3.identity.html | 8 +- docs/functions/mat3.inverse.html | 10 +- docs/functions/mat3.invert.html | 10 +- docs/functions/mat3.mul.html | 12 +- docs/functions/mat3.multiply.html | 12 +- docs/functions/mat3.negate.html | 10 +- docs/functions/mat3.rotate.html | 10 +- docs/functions/mat3.rotation.html | 10 +- docs/functions/mat3.scale.html | 14 +- docs/functions/mat3.scaling.html | 12 +- docs/functions/mat3.set.html | 12 +- docs/functions/mat3.setAxis.html | 12 +- docs/functions/mat3.setDefaultType.html | 4 - docs/functions/mat3.setTranslation.html | 12 +- docs/functions/mat3.translate.html | 12 +- docs/functions/mat3.translation.html | 10 +- docs/functions/mat3.transpose.html | 10 +- docs/functions/mat3.uniformScale.html | 10 +- docs/functions/mat3.uniformScaling.html | 10 +- docs/functions/mat3d.clone.html | 6 + docs/functions/mat3d.copy.html | 6 + docs/functions/mat3d.create.html | 19 + docs/functions/mat3d.determinant.html | 4 + docs/functions/mat3d.equals.html | 5 + docs/functions/mat3d.equalsApproximately.html | 5 + docs/functions/mat3d.fromMat4.html | 5 + docs/functions/mat3d.fromQuat.html | 5 + docs/functions/mat3d.getAxis.html | 5 + docs/functions/mat3d.getScaling.html | 1 + docs/functions/mat3d.getTranslation.html | 6 + docs/functions/mat3d.identity.html | 4 + docs/functions/mat3d.inverse.html | 5 + docs/functions/mat3d.invert.html | 5 + docs/functions/mat3d.mul.html | 6 + docs/functions/mat3d.multiply.html | 6 + docs/functions/mat3d.negate.html | 5 + docs/functions/mat3d.rotate.html | 6 + docs/functions/mat3d.rotation.html | 5 + docs/functions/mat3d.scale.html | 9 + docs/functions/mat3d.scaling.html | 8 + docs/functions/mat3d.set.html | 14 + docs/functions/mat3d.setAxis.html | 7 + docs/functions/mat3d.setTranslation.html | 7 + docs/functions/mat3d.translate.html | 6 + docs/functions/mat3d.translation.html | 5 + docs/functions/mat3d.transpose.html | 5 + docs/functions/mat3d.uniformScale.html | 7 + docs/functions/mat3d.uniformScaling.html | 5 + docs/functions/mat3n.clone.html | 6 + docs/functions/mat3n.copy.html | 6 + docs/functions/mat3n.create.html | 19 + docs/functions/mat3n.determinant.html | 4 + docs/functions/mat3n.equals.html | 5 + docs/functions/mat3n.equalsApproximately.html | 5 + docs/functions/mat3n.fromMat4.html | 5 + docs/functions/mat3n.fromQuat.html | 5 + docs/functions/mat3n.getAxis.html | 5 + docs/functions/mat3n.getScaling.html | 1 + docs/functions/mat3n.getTranslation.html | 6 + docs/functions/mat3n.identity.html | 4 + docs/functions/mat3n.inverse.html | 5 + docs/functions/mat3n.invert.html | 5 + docs/functions/mat3n.mul.html | 6 + docs/functions/mat3n.multiply.html | 6 + docs/functions/mat3n.negate.html | 5 + docs/functions/mat3n.rotate.html | 6 + docs/functions/mat3n.rotation.html | 5 + docs/functions/mat3n.scale.html | 9 + docs/functions/mat3n.scaling.html | 8 + docs/functions/mat3n.set.html | 14 + docs/functions/mat3n.setAxis.html | 7 + docs/functions/mat3n.setTranslation.html | 7 + docs/functions/mat3n.translate.html | 6 + docs/functions/mat3n.translation.html | 5 + docs/functions/mat3n.transpose.html | 5 + docs/functions/mat3n.uniformScale.html | 7 + docs/functions/mat3n.uniformScaling.html | 5 + docs/functions/mat4.aim.html | 14 +- docs/functions/mat4.axisRotate.html | 14 +- docs/functions/mat4.axisRotation.html | 14 +- docs/functions/mat4.cameraAim.html | 14 +- docs/functions/mat4.clone.html | 12 +- docs/functions/mat4.copy.html | 12 +- docs/functions/mat4.create.html | 16 +- docs/functions/mat4.determinant.html | 6 +- docs/functions/mat4.equals.html | 8 +- docs/functions/mat4.equalsApproximately.html | 8 +- docs/functions/mat4.fromMat3.html | 10 +- docs/functions/mat4.fromQuat.html | 10 +- docs/functions/mat4.frustum.html | 10 +- docs/functions/mat4.frustumReverseZ.html | 10 +- docs/functions/mat4.getAxis.html | 8 +- docs/functions/mat4.getScaling.html | 5 +- docs/functions/mat4.getTranslation.html | 7 +- docs/functions/mat4.identity.html | 8 +- docs/functions/mat4.inverse.html | 10 +- docs/functions/mat4.invert.html | 10 +- docs/functions/mat4.lookAt.html | 14 +- docs/functions/mat4.mul.html | 12 +- docs/functions/mat4.multiply.html | 12 +- docs/functions/mat4.negate.html | 10 +- docs/functions/mat4.ortho.html | 14 +- docs/functions/mat4.perspective.html | 14 +- docs/functions/mat4.perspectiveReverseZ.html | 14 +- docs/functions/mat4.rotate.html | 16 +- docs/functions/mat4.rotateX.html | 10 +- docs/functions/mat4.rotateY.html | 10 +- docs/functions/mat4.rotateZ.html | 10 +- docs/functions/mat4.rotation.html | 16 +- docs/functions/mat4.rotationX.html | 10 +- docs/functions/mat4.rotationY.html | 10 +- docs/functions/mat4.rotationZ.html | 10 +- docs/functions/mat4.scale.html | 14 +- docs/functions/mat4.scaling.html | 12 +- docs/functions/mat4.set.html | 12 +- docs/functions/mat4.setAxis.html | 12 +- docs/functions/mat4.setDefaultType.html | 4 - docs/functions/mat4.setTranslation.html | 12 +- docs/functions/mat4.translate.html | 14 +- docs/functions/mat4.translation.html | 12 +- docs/functions/mat4.transpose.html | 10 +- docs/functions/mat4.uniformScale.html | 10 +- docs/functions/mat4.uniformScaling.html | 10 +- docs/functions/mat4d.aim.html | 10 + docs/functions/mat4d.axisRotate.html | 9 + docs/functions/mat4d.axisRotation.html | 9 + docs/functions/mat4d.cameraAim.html | 10 + docs/functions/mat4d.clone.html | 6 + docs/functions/mat4d.copy.html | 6 + docs/functions/mat4d.create.html | 26 + docs/functions/mat4d.determinant.html | 4 + docs/functions/mat4d.equals.html | 5 + docs/functions/mat4d.equalsApproximately.html | 5 + docs/functions/mat4d.fromMat3.html | 5 + docs/functions/mat4d.fromQuat.html | 5 + docs/functions/mat4d.frustum.html | 17 + docs/functions/mat4d.frustumReverseZ.html | 17 + docs/functions/mat4d.getAxis.html | 5 + docs/functions/mat4d.getScaling.html | 1 + docs/functions/mat4d.getTranslation.html | 1 + docs/functions/mat4d.identity.html | 4 + docs/functions/mat4d.inverse.html | 5 + docs/functions/mat4d.invert.html | 5 + docs/functions/mat4d.lookAt.html | 9 + docs/functions/mat4d.mul.html | 6 + docs/functions/mat4d.multiply.html | 6 + docs/functions/mat4d.negate.html | 5 + docs/functions/mat4d.ortho.html | 14 + docs/functions/mat4d.perspective.html | 22 + docs/functions/mat4d.perspectiveReverseZ.html | 19 + docs/functions/mat4d.rotate.html | 9 + docs/functions/mat4d.rotateX.html | 7 + docs/functions/mat4d.rotateY.html | 7 + docs/functions/mat4d.rotateZ.html | 7 + docs/functions/mat4d.rotation.html | 9 + docs/functions/mat4d.rotationX.html | 5 + docs/functions/mat4d.rotationY.html | 5 + docs/functions/mat4d.rotationZ.html | 5 + docs/functions/mat4d.scale.html | 9 + docs/functions/mat4d.scaling.html | 8 + docs/functions/mat4d.set.html | 21 + docs/functions/mat4d.setAxis.html | 7 + docs/functions/mat4d.setTranslation.html | 7 + docs/functions/mat4d.translate.html | 7 + docs/functions/mat4d.translation.html | 6 + docs/functions/mat4d.transpose.html | 5 + docs/functions/mat4d.uniformScale.html | 6 + docs/functions/mat4d.uniformScaling.html | 5 + docs/functions/mat4n.aim.html | 10 + docs/functions/mat4n.axisRotate.html | 9 + docs/functions/mat4n.axisRotation.html | 9 + docs/functions/mat4n.cameraAim.html | 10 + docs/functions/mat4n.clone.html | 6 + docs/functions/mat4n.copy.html | 6 + docs/functions/mat4n.create.html | 26 + docs/functions/mat4n.determinant.html | 4 + docs/functions/mat4n.equals.html | 5 + docs/functions/mat4n.equalsApproximately.html | 5 + docs/functions/mat4n.fromMat3.html | 5 + docs/functions/mat4n.fromQuat.html | 5 + docs/functions/mat4n.frustum.html | 17 + docs/functions/mat4n.frustumReverseZ.html | 17 + docs/functions/mat4n.getAxis.html | 5 + docs/functions/mat4n.getScaling.html | 1 + docs/functions/mat4n.getTranslation.html | 1 + docs/functions/mat4n.identity.html | 4 + docs/functions/mat4n.inverse.html | 5 + docs/functions/mat4n.invert.html | 5 + docs/functions/mat4n.lookAt.html | 9 + docs/functions/mat4n.mul.html | 6 + docs/functions/mat4n.multiply.html | 6 + docs/functions/mat4n.negate.html | 5 + docs/functions/mat4n.ortho.html | 14 + docs/functions/mat4n.perspective.html | 22 + docs/functions/mat4n.perspectiveReverseZ.html | 19 + docs/functions/mat4n.rotate.html | 9 + docs/functions/mat4n.rotateX.html | 7 + docs/functions/mat4n.rotateY.html | 7 + docs/functions/mat4n.rotateZ.html | 7 + docs/functions/mat4n.rotation.html | 9 + docs/functions/mat4n.rotationX.html | 5 + docs/functions/mat4n.rotationY.html | 5 + docs/functions/mat4n.rotationZ.html | 5 + docs/functions/mat4n.scale.html | 9 + docs/functions/mat4n.scaling.html | 8 + docs/functions/mat4n.set.html | 21 + docs/functions/mat4n.setAxis.html | 7 + docs/functions/mat4n.setTranslation.html | 7 + docs/functions/mat4n.translate.html | 7 + docs/functions/mat4n.translation.html | 6 + docs/functions/mat4n.transpose.html | 5 + docs/functions/mat4n.uniformScale.html | 6 + docs/functions/mat4n.uniformScaling.html | 5 + docs/functions/quat.add.html | 12 +- docs/functions/quat.angle.html | 8 +- docs/functions/quat.clone.html | 12 +- docs/functions/quat.conjugate.html | 10 +- docs/functions/quat.copy.html | 12 +- docs/functions/quat.create.html | 6 +- docs/functions/quat.divScalar.html | 10 +- docs/functions/quat.dot.html | 8 +- docs/functions/quat.equals.html | 8 +- docs/functions/quat.equalsApproximately.html | 8 +- docs/functions/quat.fromAxisAngle.html | 10 +- docs/functions/quat.fromEuler.html | 12 +- docs/functions/quat.fromMat.html | 10 +- docs/functions/quat.fromValues.html | 7 +- docs/functions/quat.identity.html | 8 +- docs/functions/quat.inverse.html | 8 +- docs/functions/quat.len.html | 6 +- docs/functions/quat.lenSq.html | 6 +- docs/functions/quat.length.html | 6 +- docs/functions/quat.lengthSq.html | 6 +- docs/functions/quat.lerp.html | 12 +- docs/functions/quat.mul.html | 12 +- docs/functions/quat.mulScalar.html | 10 +- docs/functions/quat.multiply.html | 12 +- docs/functions/quat.normalize.html | 10 +- docs/functions/quat.rotateX.html | 10 +- docs/functions/quat.rotateY.html | 10 +- docs/functions/quat.rotateZ.html | 10 +- docs/functions/quat.rotationTo.html | 12 +- docs/functions/quat.scale.html | 10 +- docs/functions/quat.set.html | 12 +- docs/functions/quat.setDefaultType.html | 17 - docs/functions/quat.slerp.html | 12 +- docs/functions/quat.sqlerp.html | 14 +- docs/functions/quat.sub.html | 12 +- docs/functions/quat.subtract.html | 12 +- docs/functions/quat.toAxisAngle.html | 10 +- docs/functions/quatd.add.html | 6 + docs/functions/quatd.angle.html | 5 + docs/functions/quatd.clone.html | 6 + docs/functions/quatd.conjugate.html | 7 + docs/functions/quatd.copy.html | 6 + docs/functions/quatd.create.html | 7 + docs/functions/quatd.divScalar.html | 6 + docs/functions/quatd.dot.html | 5 + docs/functions/quatd.equals.html | 5 + docs/functions/quatd.equalsApproximately.html | 5 + docs/functions/quatd.fromAxisAngle.html | 7 + docs/functions/quatd.fromEuler.html | 8 + docs/functions/quatd.fromMat.html | 6 + docs/functions/quatd.fromValues.html | 7 + docs/functions/quatd.identity.html | 4 + docs/functions/quatd.inverse.html | 4 + docs/functions/quatd.len.html | 4 + docs/functions/quatd.lenSq.html | 4 + docs/functions/quatd.length.html | 4 + docs/functions/quatd.lengthSq.html | 4 + docs/functions/quatd.lerp.html | 9 + docs/functions/quatd.mul.html | 6 + docs/functions/quatd.mulScalar.html | 6 + docs/functions/quatd.multiply.html | 6 + docs/functions/quatd.normalize.html | 5 + docs/functions/quatd.rotateX.html | 6 + docs/functions/quatd.rotateY.html | 6 + docs/functions/quatd.rotateZ.html | 6 + docs/functions/quatd.rotationTo.html | 6 + docs/functions/quatd.scale.html | 6 + docs/functions/quatd.set.html | 9 + docs/functions/quatd.slerp.html | 7 + docs/functions/quatd.sqlerp.html | 8 + docs/functions/quatd.sub.html | 6 + docs/functions/quatd.subtract.html | 6 + docs/functions/quatd.toAxisAngle.html | 5 + docs/functions/quatn.add.html | 6 + docs/functions/quatn.angle.html | 5 + docs/functions/quatn.clone.html | 6 + docs/functions/quatn.conjugate.html | 7 + docs/functions/quatn.copy.html | 6 + docs/functions/quatn.create.html | 7 + docs/functions/quatn.divScalar.html | 6 + docs/functions/quatn.dot.html | 5 + docs/functions/quatn.equals.html | 5 + docs/functions/quatn.equalsApproximately.html | 5 + docs/functions/quatn.fromAxisAngle.html | 7 + docs/functions/quatn.fromEuler.html | 8 + docs/functions/quatn.fromMat.html | 6 + docs/functions/quatn.fromValues.html | 7 + docs/functions/quatn.identity.html | 4 + docs/functions/quatn.inverse.html | 4 + docs/functions/quatn.len.html | 4 + docs/functions/quatn.lenSq.html | 4 + docs/functions/quatn.length.html | 4 + docs/functions/quatn.lengthSq.html | 4 + docs/functions/quatn.lerp.html | 9 + docs/functions/quatn.mul.html | 6 + docs/functions/quatn.mulScalar.html | 6 + docs/functions/quatn.multiply.html | 6 + docs/functions/quatn.normalize.html | 5 + docs/functions/quatn.rotateX.html | 6 + docs/functions/quatn.rotateY.html | 6 + docs/functions/quatn.rotateZ.html | 6 + docs/functions/quatn.rotationTo.html | 6 + docs/functions/quatn.scale.html | 6 + docs/functions/quatn.set.html | 9 + docs/functions/quatn.slerp.html | 7 + docs/functions/quatn.sqlerp.html | 8 + docs/functions/quatn.sub.html | 6 + docs/functions/quatn.subtract.html | 6 + docs/functions/quatn.toAxisAngle.html | 5 + docs/functions/setDefaultType.html | 6 - docs/functions/utils.degToRad.html | 4 +- docs/functions/utils.euclideanModulo.html | 5 +- docs/functions/utils.inverseLerp.html | 4 +- docs/functions/utils.lerp.html | 4 +- docs/functions/utils.radToDeg.html | 4 +- docs/functions/utils.setEpsilon.html | 4 +- docs/functions/vec2.add.html | 12 +- docs/functions/vec2.addScaled.html | 12 +- docs/functions/vec2.angle.html | 8 +- docs/functions/vec2.ceil.html | 10 +- docs/functions/vec2.clamp.html | 10 +- docs/functions/vec2.clone.html | 12 +- docs/functions/vec2.copy.html | 12 +- docs/functions/vec2.create.html | 16 +- docs/functions/vec2.cross.html | 12 +- docs/functions/vec2.dist.html | 8 +- docs/functions/vec2.distSq.html | 8 +- docs/functions/vec2.distance.html | 8 +- docs/functions/vec2.distanceSq.html | 8 +- docs/functions/vec2.div.html | 14 +- docs/functions/vec2.divScalar.html | 10 +- docs/functions/vec2.divide.html | 12 +- docs/functions/vec2.dot.html | 8 +- docs/functions/vec2.equals.html | 8 +- docs/functions/vec2.equalsApproximately.html | 8 +- docs/functions/vec2.floor.html | 10 +- docs/functions/vec2.fromValues.html | 13 +- docs/functions/vec2.inverse.html | 10 +- docs/functions/vec2.invert.html | 10 +- docs/functions/vec2.len.html | 6 +- docs/functions/vec2.lenSq.html | 6 +- docs/functions/vec2.length.html | 6 +- docs/functions/vec2.lengthSq.html | 6 +- docs/functions/vec2.lerp.html | 12 +- docs/functions/vec2.lerpV.html | 14 +- docs/functions/vec2.max.html | 12 +- docs/functions/vec2.midpoint.html | 10 +- docs/functions/vec2.min.html | 12 +- docs/functions/vec2.mul.html | 14 +- docs/functions/vec2.mulScalar.html | 10 +- docs/functions/vec2.multiply.html | 12 +- docs/functions/vec2.negate.html | 10 +- docs/functions/vec2.normalize.html | 10 +- docs/functions/vec2.random.html | 10 +- docs/functions/vec2.rotate.html | 10 +- docs/functions/vec2.round.html | 10 +- docs/functions/vec2.scale.html | 10 +- docs/functions/vec2.set.html | 12 +- docs/functions/vec2.setDefaultType.html | 17 - docs/functions/vec2.setLength.html | 8 +- docs/functions/vec2.sub.html | 12 +- docs/functions/vec2.subtract.html | 12 +- docs/functions/vec2.transformMat3.html | 12 +- docs/functions/vec2.transformMat4.html | 12 +- docs/functions/vec2.truncate.html | 8 +- docs/functions/vec2.zero.html | 8 +- docs/functions/vec2d.add.html | 6 + docs/functions/vec2d.addScaled.html | 7 + docs/functions/vec2d.angle.html | 5 + docs/functions/vec2d.ceil.html | 5 + docs/functions/vec2d.clamp.html | 7 + docs/functions/vec2d.clone.html | 6 + docs/functions/vec2d.copy.html | 6 + docs/functions/vec2d.create.html | 12 + docs/functions/vec2d.cross.html | 7 + docs/functions/vec2d.dist.html | 5 + docs/functions/vec2d.distSq.html | 5 + docs/functions/vec2d.distance.html | 5 + docs/functions/vec2d.distanceSq.html | 5 + docs/functions/vec2d.div.html | 7 + docs/functions/vec2d.divScalar.html | 6 + docs/functions/vec2d.divide.html | 7 + docs/functions/vec2d.dot.html | 6 + docs/functions/vec2d.equals.html | 5 + docs/functions/vec2d.equalsApproximately.html | 5 + docs/functions/vec2d.floor.html | 5 + docs/functions/vec2d.fromValues.html | 12 + docs/functions/vec2d.inverse.html | 5 + docs/functions/vec2d.invert.html | 5 + docs/functions/vec2d.len.html | 4 + docs/functions/vec2d.lenSq.html | 4 + docs/functions/vec2d.length.html | 4 + docs/functions/vec2d.lengthSq.html | 4 + docs/functions/vec2d.lerp.html | 9 + docs/functions/vec2d.lerpV.html | 9 + docs/functions/vec2d.max.html | 8 + docs/functions/vec2d.midpoint.html | 5 + docs/functions/vec2d.min.html | 8 + docs/functions/vec2d.mul.html | 7 + docs/functions/vec2d.mulScalar.html | 6 + docs/functions/vec2d.multiply.html | 7 + docs/functions/vec2d.negate.html | 5 + docs/functions/vec2d.normalize.html | 5 + docs/functions/vec2d.random.html | 5 + docs/functions/vec2d.rotate.html | 6 + docs/functions/vec2d.round.html | 5 + docs/functions/vec2d.scale.html | 6 + docs/functions/vec2d.set.html | 7 + docs/functions/vec2d.setLength.html | 5 + docs/functions/vec2d.sub.html | 6 + docs/functions/vec2d.subtract.html | 6 + docs/functions/vec2d.transformMat3.html | 6 + docs/functions/vec2d.transformMat4.html | 6 + docs/functions/vec2d.truncate.html | 5 + docs/functions/vec2d.zero.html | 4 + docs/functions/vec2n.add.html | 6 + docs/functions/vec2n.addScaled.html | 7 + docs/functions/vec2n.angle.html | 5 + docs/functions/vec2n.ceil.html | 5 + docs/functions/vec2n.clamp.html | 7 + docs/functions/vec2n.clone.html | 6 + docs/functions/vec2n.copy.html | 6 + docs/functions/vec2n.create.html | 12 + docs/functions/vec2n.cross.html | 7 + docs/functions/vec2n.dist.html | 5 + docs/functions/vec2n.distSq.html | 5 + docs/functions/vec2n.distance.html | 5 + docs/functions/vec2n.distanceSq.html | 5 + docs/functions/vec2n.div.html | 7 + docs/functions/vec2n.divScalar.html | 6 + docs/functions/vec2n.divide.html | 7 + docs/functions/vec2n.dot.html | 6 + docs/functions/vec2n.equals.html | 5 + docs/functions/vec2n.equalsApproximately.html | 5 + docs/functions/vec2n.floor.html | 5 + docs/functions/vec2n.fromValues.html | 12 + docs/functions/vec2n.inverse.html | 5 + docs/functions/vec2n.invert.html | 5 + docs/functions/vec2n.len.html | 4 + docs/functions/vec2n.lenSq.html | 4 + docs/functions/vec2n.length.html | 4 + docs/functions/vec2n.lengthSq.html | 4 + docs/functions/vec2n.lerp.html | 9 + docs/functions/vec2n.lerpV.html | 9 + docs/functions/vec2n.max.html | 8 + docs/functions/vec2n.midpoint.html | 5 + docs/functions/vec2n.min.html | 8 + docs/functions/vec2n.mul.html | 7 + docs/functions/vec2n.mulScalar.html | 6 + docs/functions/vec2n.multiply.html | 7 + docs/functions/vec2n.negate.html | 5 + docs/functions/vec2n.normalize.html | 5 + docs/functions/vec2n.random.html | 5 + docs/functions/vec2n.rotate.html | 6 + docs/functions/vec2n.round.html | 5 + docs/functions/vec2n.scale.html | 6 + docs/functions/vec2n.set.html | 7 + docs/functions/vec2n.setLength.html | 5 + docs/functions/vec2n.sub.html | 6 + docs/functions/vec2n.subtract.html | 6 + docs/functions/vec2n.transformMat3.html | 6 + docs/functions/vec2n.transformMat4.html | 6 + docs/functions/vec2n.truncate.html | 5 + docs/functions/vec2n.zero.html | 4 + docs/functions/vec3.add.html | 12 +- docs/functions/vec3.addScaled.html | 12 +- docs/functions/vec3.angle.html | 8 +- docs/functions/vec3.ceil.html | 10 +- docs/functions/vec3.clamp.html | 10 +- docs/functions/vec3.clone.html | 12 +- docs/functions/vec3.copy.html | 12 +- docs/functions/vec3.create.html | 6 +- docs/functions/vec3.cross.html | 12 +- docs/functions/vec3.dist.html | 8 +- docs/functions/vec3.distSq.html | 8 +- docs/functions/vec3.distance.html | 8 +- docs/functions/vec3.distanceSq.html | 8 +- docs/functions/vec3.div.html | 14 +- docs/functions/vec3.divScalar.html | 10 +- docs/functions/vec3.divide.html | 12 +- docs/functions/vec3.dot.html | 8 +- docs/functions/vec3.equals.html | 8 +- docs/functions/vec3.equalsApproximately.html | 8 +- docs/functions/vec3.floor.html | 10 +- docs/functions/vec3.fromValues.html | 6 +- docs/functions/vec3.getAxis.html | 8 +- docs/functions/vec3.getScaling.html | 8 +- docs/functions/vec3.getTranslation.html | 10 +- docs/functions/vec3.inverse.html | 10 +- docs/functions/vec3.invert.html | 10 +- docs/functions/vec3.len.html | 6 +- docs/functions/vec3.lenSq.html | 6 +- docs/functions/vec3.length.html | 6 +- docs/functions/vec3.lengthSq.html | 6 +- docs/functions/vec3.lerp.html | 12 +- docs/functions/vec3.lerpV.html | 14 +- docs/functions/vec3.max.html | 12 +- docs/functions/vec3.midpoint.html | 10 +- docs/functions/vec3.min.html | 12 +- docs/functions/vec3.mul.html | 14 +- docs/functions/vec3.mulScalar.html | 10 +- docs/functions/vec3.multiply.html | 12 +- docs/functions/vec3.negate.html | 10 +- docs/functions/vec3.normalize.html | 10 +- docs/functions/vec3.random.html | 10 +- docs/functions/vec3.rotateX.html | 12 +- docs/functions/vec3.rotateY.html | 12 +- docs/functions/vec3.rotateZ.html | 12 +- docs/functions/vec3.round.html | 10 +- docs/functions/vec3.scale.html | 10 +- docs/functions/vec3.set.html | 12 +- docs/functions/vec3.setDefaultType.html | 17 - docs/functions/vec3.setLength.html | 8 +- docs/functions/vec3.sub.html | 12 +- docs/functions/vec3.subtract.html | 12 +- docs/functions/vec3.transformMat3.html | 12 +- docs/functions/vec3.transformMat4.html | 12 +- .../functions/vec3.transformMat4Upper3x3.html | 12 +- docs/functions/vec3.transformQuat.html | 12 +- docs/functions/vec3.truncate.html | 8 +- docs/functions/vec3.zero.html | 8 +- docs/functions/vec3d.add.html | 6 + docs/functions/vec3d.addScaled.html | 7 + docs/functions/vec3d.angle.html | 5 + docs/functions/vec3d.ceil.html | 5 + docs/functions/vec3d.clamp.html | 7 + docs/functions/vec3d.clone.html | 6 + docs/functions/vec3d.copy.html | 6 + docs/functions/vec3d.create.html | 6 + docs/functions/vec3d.cross.html | 7 + docs/functions/vec3d.dist.html | 5 + docs/functions/vec3d.distSq.html | 5 + docs/functions/vec3d.distance.html | 5 + docs/functions/vec3d.distanceSq.html | 5 + docs/functions/vec3d.div.html | 7 + docs/functions/vec3d.divScalar.html | 6 + docs/functions/vec3d.divide.html | 7 + docs/functions/vec3d.dot.html | 6 + docs/functions/vec3d.equals.html | 5 + docs/functions/vec3d.equalsApproximately.html | 5 + docs/functions/vec3d.floor.html | 5 + docs/functions/vec3d.fromValues.html | 6 + docs/functions/vec3d.getAxis.html | 5 + docs/functions/vec3d.getScaling.html | 4 + docs/functions/vec3d.getTranslation.html | 6 + docs/functions/vec3d.inverse.html | 5 + docs/functions/vec3d.invert.html | 5 + docs/functions/vec3d.len.html | 4 + docs/functions/vec3d.lenSq.html | 4 + docs/functions/vec3d.length.html | 4 + docs/functions/vec3d.lengthSq.html | 4 + docs/functions/vec3d.lerp.html | 9 + docs/functions/vec3d.lerpV.html | 9 + docs/functions/vec3d.max.html | 8 + docs/functions/vec3d.midpoint.html | 5 + docs/functions/vec3d.min.html | 8 + docs/functions/vec3d.mul.html | 7 + docs/functions/vec3d.mulScalar.html | 6 + docs/functions/vec3d.multiply.html | 7 + docs/functions/vec3d.negate.html | 5 + docs/functions/vec3d.normalize.html | 5 + docs/functions/vec3d.random.html | 5 + docs/functions/vec3d.rotateX.html | 7 + docs/functions/vec3d.rotateY.html | 7 + docs/functions/vec3d.rotateZ.html | 7 + docs/functions/vec3d.round.html | 5 + docs/functions/vec3d.scale.html | 6 + docs/functions/vec3d.set.html | 8 + docs/functions/vec3d.setLength.html | 5 + docs/functions/vec3d.sub.html | 6 + docs/functions/vec3d.subtract.html | 6 + docs/functions/vec3d.transformMat3.html | 6 + docs/functions/vec3d.transformMat4.html | 6 + .../vec3d.transformMat4Upper3x3.html | 6 + docs/functions/vec3d.transformQuat.html | 6 + docs/functions/vec3d.truncate.html | 5 + docs/functions/vec3d.zero.html | 4 + docs/functions/vec3n.add.html | 6 + docs/functions/vec3n.addScaled.html | 7 + docs/functions/vec3n.angle.html | 5 + docs/functions/vec3n.ceil.html | 5 + docs/functions/vec3n.clamp.html | 7 + docs/functions/vec3n.clone.html | 6 + docs/functions/vec3n.copy.html | 6 + docs/functions/vec3n.create.html | 6 + docs/functions/vec3n.cross.html | 7 + docs/functions/vec3n.dist.html | 5 + docs/functions/vec3n.distSq.html | 5 + docs/functions/vec3n.distance.html | 5 + docs/functions/vec3n.distanceSq.html | 5 + docs/functions/vec3n.div.html | 7 + docs/functions/vec3n.divScalar.html | 6 + docs/functions/vec3n.divide.html | 7 + docs/functions/vec3n.dot.html | 6 + docs/functions/vec3n.equals.html | 5 + docs/functions/vec3n.equalsApproximately.html | 5 + docs/functions/vec3n.floor.html | 5 + docs/functions/vec3n.fromValues.html | 6 + docs/functions/vec3n.getAxis.html | 5 + docs/functions/vec3n.getScaling.html | 4 + docs/functions/vec3n.getTranslation.html | 6 + docs/functions/vec3n.inverse.html | 5 + docs/functions/vec3n.invert.html | 5 + docs/functions/vec3n.len.html | 4 + docs/functions/vec3n.lenSq.html | 4 + docs/functions/vec3n.length.html | 4 + docs/functions/vec3n.lengthSq.html | 4 + docs/functions/vec3n.lerp.html | 9 + docs/functions/vec3n.lerpV.html | 9 + docs/functions/vec3n.max.html | 8 + docs/functions/vec3n.midpoint.html | 5 + docs/functions/vec3n.min.html | 8 + docs/functions/vec3n.mul.html | 7 + docs/functions/vec3n.mulScalar.html | 6 + docs/functions/vec3n.multiply.html | 7 + docs/functions/vec3n.negate.html | 5 + docs/functions/vec3n.normalize.html | 5 + docs/functions/vec3n.random.html | 5 + docs/functions/vec3n.rotateX.html | 7 + docs/functions/vec3n.rotateY.html | 7 + docs/functions/vec3n.rotateZ.html | 7 + docs/functions/vec3n.round.html | 5 + docs/functions/vec3n.scale.html | 6 + docs/functions/vec3n.set.html | 8 + docs/functions/vec3n.setLength.html | 5 + docs/functions/vec3n.sub.html | 6 + docs/functions/vec3n.subtract.html | 6 + docs/functions/vec3n.transformMat3.html | 6 + docs/functions/vec3n.transformMat4.html | 6 + .../vec3n.transformMat4Upper3x3.html | 6 + docs/functions/vec3n.transformQuat.html | 6 + docs/functions/vec3n.truncate.html | 5 + docs/functions/vec3n.zero.html | 4 + docs/functions/vec4.add.html | 12 +- docs/functions/vec4.addScaled.html | 12 +- docs/functions/vec4.ceil.html | 10 +- docs/functions/vec4.clamp.html | 10 +- docs/functions/vec4.clone.html | 12 +- docs/functions/vec4.copy.html | 12 +- docs/functions/vec4.create.html | 6 +- docs/functions/vec4.dist.html | 8 +- docs/functions/vec4.distSq.html | 8 +- docs/functions/vec4.distance.html | 8 +- docs/functions/vec4.distanceSq.html | 8 +- docs/functions/vec4.div.html | 14 +- docs/functions/vec4.divScalar.html | 10 +- docs/functions/vec4.divide.html | 12 +- docs/functions/vec4.dot.html | 8 +- docs/functions/vec4.equals.html | 8 +- docs/functions/vec4.equalsApproximately.html | 8 +- docs/functions/vec4.floor.html | 10 +- docs/functions/vec4.fromValues.html | 7 +- docs/functions/vec4.inverse.html | 10 +- docs/functions/vec4.invert.html | 10 +- docs/functions/vec4.len.html | 6 +- docs/functions/vec4.lenSq.html | 6 +- docs/functions/vec4.length.html | 6 +- docs/functions/vec4.lengthSq.html | 6 +- docs/functions/vec4.lerp.html | 12 +- docs/functions/vec4.lerpV.html | 14 +- docs/functions/vec4.max.html | 12 +- docs/functions/vec4.midpoint.html | 10 +- docs/functions/vec4.min.html | 12 +- docs/functions/vec4.mul.html | 14 +- docs/functions/vec4.mulScalar.html | 10 +- docs/functions/vec4.multiply.html | 12 +- docs/functions/vec4.negate.html | 10 +- docs/functions/vec4.normalize.html | 10 +- docs/functions/vec4.round.html | 10 +- docs/functions/vec4.scale.html | 10 +- docs/functions/vec4.set.html | 12 +- docs/functions/vec4.setDefaultType.html | 17 - docs/functions/vec4.setLength.html | 8 +- docs/functions/vec4.sub.html | 12 +- docs/functions/vec4.subtract.html | 12 +- docs/functions/vec4.transformMat4.html | 12 +- docs/functions/vec4.truncate.html | 8 +- docs/functions/vec4.zero.html | 8 +- docs/functions/vec4d.add.html | 6 + docs/functions/vec4d.addScaled.html | 7 + docs/functions/vec4d.ceil.html | 5 + docs/functions/vec4d.clamp.html | 7 + docs/functions/vec4d.clone.html | 6 + docs/functions/vec4d.copy.html | 6 + docs/functions/vec4d.create.html | 7 + docs/functions/vec4d.dist.html | 5 + docs/functions/vec4d.distSq.html | 5 + docs/functions/vec4d.distance.html | 5 + docs/functions/vec4d.distanceSq.html | 5 + docs/functions/vec4d.div.html | 7 + docs/functions/vec4d.divScalar.html | 6 + docs/functions/vec4d.divide.html | 7 + docs/functions/vec4d.dot.html | 5 + docs/functions/vec4d.equals.html | 5 + docs/functions/vec4d.equalsApproximately.html | 5 + docs/functions/vec4d.floor.html | 5 + docs/functions/vec4d.fromValues.html | 7 + docs/functions/vec4d.inverse.html | 5 + docs/functions/vec4d.invert.html | 5 + docs/functions/vec4d.len.html | 4 + docs/functions/vec4d.lenSq.html | 4 + docs/functions/vec4d.length.html | 4 + docs/functions/vec4d.lengthSq.html | 4 + docs/functions/vec4d.lerp.html | 9 + docs/functions/vec4d.lerpV.html | 9 + docs/functions/vec4d.max.html | 8 + docs/functions/vec4d.midpoint.html | 5 + docs/functions/vec4d.min.html | 8 + docs/functions/vec4d.mul.html | 7 + docs/functions/vec4d.mulScalar.html | 6 + docs/functions/vec4d.multiply.html | 7 + docs/functions/vec4d.negate.html | 5 + docs/functions/vec4d.normalize.html | 5 + docs/functions/vec4d.round.html | 5 + docs/functions/vec4d.scale.html | 6 + docs/functions/vec4d.set.html | 9 + docs/functions/vec4d.setLength.html | 5 + docs/functions/vec4d.sub.html | 6 + docs/functions/vec4d.subtract.html | 6 + docs/functions/vec4d.transformMat4.html | 6 + docs/functions/vec4d.truncate.html | 5 + docs/functions/vec4d.zero.html | 4 + docs/functions/vec4n.add.html | 6 + docs/functions/vec4n.addScaled.html | 7 + docs/functions/vec4n.ceil.html | 5 + docs/functions/vec4n.clamp.html | 7 + docs/functions/vec4n.clone.html | 6 + docs/functions/vec4n.copy.html | 6 + docs/functions/vec4n.create.html | 7 + docs/functions/vec4n.dist.html | 5 + docs/functions/vec4n.distSq.html | 5 + docs/functions/vec4n.distance.html | 5 + docs/functions/vec4n.distanceSq.html | 5 + docs/functions/vec4n.div.html | 7 + docs/functions/vec4n.divScalar.html | 6 + docs/functions/vec4n.divide.html | 7 + docs/functions/vec4n.dot.html | 5 + docs/functions/vec4n.equals.html | 5 + docs/functions/vec4n.equalsApproximately.html | 5 + docs/functions/vec4n.floor.html | 5 + docs/functions/vec4n.fromValues.html | 7 + docs/functions/vec4n.inverse.html | 5 + docs/functions/vec4n.invert.html | 5 + docs/functions/vec4n.len.html | 4 + docs/functions/vec4n.lenSq.html | 4 + docs/functions/vec4n.length.html | 4 + docs/functions/vec4n.lengthSq.html | 4 + docs/functions/vec4n.lerp.html | 9 + docs/functions/vec4n.lerpV.html | 9 + docs/functions/vec4n.max.html | 8 + docs/functions/vec4n.midpoint.html | 5 + docs/functions/vec4n.min.html | 8 + docs/functions/vec4n.mul.html | 7 + docs/functions/vec4n.mulScalar.html | 6 + docs/functions/vec4n.multiply.html | 7 + docs/functions/vec4n.negate.html | 5 + docs/functions/vec4n.normalize.html | 5 + docs/functions/vec4n.round.html | 5 + docs/functions/vec4n.scale.html | 6 + docs/functions/vec4n.set.html | 9 + docs/functions/vec4n.setLength.html | 5 + docs/functions/vec4n.sub.html | 6 + docs/functions/vec4n.subtract.html | 6 + docs/functions/vec4n.transformMat4.html | 6 + docs/functions/vec4n.truncate.html | 5 + docs/functions/vec4n.zero.html | 4 + docs/index.html | 176 +- docs/media/LICENSE.md | 21 + docs/modules.html | 46 +- docs/modules/mat3.html | 7 +- docs/modules/mat3d.html | 30 + docs/modules/mat3n.html | 30 + docs/modules/mat4.html | 7 +- docs/modules/mat4d.html | 46 + docs/modules/mat4n.html | 46 + docs/modules/quat.html | 7 +- docs/modules/quatd.html | 37 + docs/modules/quatn.html | 37 + docs/modules/utils.html | 4 +- docs/modules/vec2.html | 6 +- docs/modules/vec2d.html | 50 + docs/modules/vec2n.html | 50 + docs/modules/vec3.html | 6 +- docs/modules/vec3d.html | 57 + docs/modules/vec3n.html | 57 + docs/modules/vec4.html | 6 +- docs/modules/vec4d.html | 45 + docs/modules/vec4n.html | 45 + docs/types/BaseArgType.html | 3 + docs/types/BaseCtor.html | 1 + docs/types/Mat3-1.html | 5 +- docs/types/Mat3Arg.html | 2 + docs/types/Mat3Type.html | 2 + docs/types/Mat3d-1.html | 1 + docs/types/Mat3n-1.html | 1 + docs/types/Mat4-1.html | 5 +- docs/types/Mat4Arg.html | 2 + docs/types/Mat4Type.html | 2 + docs/types/Mat4d-1.html | 1 + docs/types/Mat4n-1.html | 1 + docs/types/Quat-1.html | 5 +- docs/types/QuatArg.html | 2 + docs/types/QuatType.html | 2 + docs/types/Quatd-1.html | 1 + docs/types/Quatn-1.html | 1 + docs/types/RotationOrder.html | 1 + docs/types/Vec2-1.html | 5 +- docs/types/Vec2Arg.html | 2 + docs/types/Vec2Type.html | 2 + docs/types/Vec2d-1.html | 1 + docs/types/Vec2n-1.html | 1 + docs/types/Vec3-1.html | 5 +- docs/types/Vec3Arg.html | 2 + docs/types/Vec3Type.html | 2 + docs/types/Vec3d-1.html | 1 + docs/types/Vec3n-1.html | 1 + docs/types/Vec4-1.html | 5 +- docs/types/Vec4Arg.html | 2 + docs/types/Vec4Type.html | 2 + docs/types/Vec4d-1.html | 1 + docs/types/Vec4n-1.html | 1 + docs/types/mat3.Mat3LikeCtor.html | 1 - docs/types/mat4.Mat4LikeCtor.html | 1 - docs/types/quat.RotationOrder.html | 1 - docs/variables/utils.EPSILON.html | 2 +- package-lock.json | 574 +- package.json | 13 +- src/mat3-impl.ts | 538 +- src/mat3.ts | 12 +- src/mat4-impl.ts | 1162 ++-- src/mat4.ts | 11 +- src/quat-impl.ts | 554 +- src/quat.ts | 65 +- src/types.ts | 20 + src/vec2-impl.ts | 438 +- src/vec2.ts | 79 +- src/vec3-impl.ts | 580 +- src/vec3.ts | 62 +- src/vec4-impl.ts | 498 +- src/vec4.ts | 66 +- src/wgpu-matrix.ts | 158 +- test/tests/mat3-test.js | 122 +- test/tests/mat4-test.js | 216 +- test/tests/quat-test.js | 35 +- test/tests/utils-test.js | 2 +- test/tests/vec2-test.js | 367 +- test/tests/vec3-test.js | 407 +- test/tests/vec4-test.js | 287 +- test/tests/wgpu-matrix-test.js | 24 +- test/umd-test.html | 2 +- tsconfig.json | 2 +- 926 files changed, 17977 insertions(+), 15578 deletions(-) delete mode 100644 dist/2.x/mat3-impl.d.ts delete mode 100644 dist/2.x/mat3.d.ts delete mode 100644 dist/2.x/mat4-impl.d.ts delete mode 100644 dist/2.x/mat4.d.ts delete mode 100644 dist/2.x/quat-impl.d.ts delete mode 100644 dist/2.x/quat.d.ts delete mode 100644 dist/2.x/vec2-impl.d.ts delete mode 100644 dist/2.x/vec2.d.ts delete mode 100644 dist/2.x/vec3-impl.d.ts delete mode 100644 dist/2.x/vec3.d.ts delete mode 100644 dist/2.x/vec4-impl.d.ts delete mode 100644 dist/2.x/vec4.d.ts delete mode 100644 dist/2.x/wgpu-matrix.d.ts delete mode 100644 dist/2.x/wgpu-matrix.js.map delete mode 100644 dist/2.x/wgpu-matrix.min.js delete mode 100644 dist/2.x/wgpu-matrix.min.js.map delete mode 100644 dist/2.x/wgpu-matrix.module.js delete mode 100644 dist/2.x/wgpu-matrix.module.js.map delete mode 100644 dist/2.x/wgpu-matrix.module.min.js delete mode 100644 dist/2.x/wgpu-matrix.module.min.js.map create mode 100644 dist/3.x/mat3-impl.d.ts create mode 100644 dist/3.x/mat3.d.ts create mode 100644 dist/3.x/mat4-impl.d.ts create mode 100644 dist/3.x/mat4.d.ts create mode 100644 dist/3.x/quat-impl.d.ts create mode 100644 dist/3.x/quat.d.ts create mode 100644 dist/3.x/types.d.ts rename dist/{2.x => 3.x}/utils.d.ts (100%) create mode 100644 dist/3.x/vec2-impl.d.ts create mode 100644 dist/3.x/vec2.d.ts create mode 100644 dist/3.x/vec3-impl.d.ts create mode 100644 dist/3.x/vec3.d.ts create mode 100644 dist/3.x/vec4-impl.d.ts create mode 100644 dist/3.x/vec4.d.ts create mode 100644 dist/3.x/wgpu-matrix.d.ts create mode 100644 dist/3.x/wgpu-matrix.js create mode 100644 dist/3.x/wgpu-matrix.js.map create mode 100644 dist/3.x/wgpu-matrix.min.js create mode 100644 dist/3.x/wgpu-matrix.min.js.map rename dist/{2.x/wgpu-matrix.js => 3.x/wgpu-matrix.module.js} (56%) create mode 100644 dist/3.x/wgpu-matrix.module.js.map create mode 100644 dist/3.x/wgpu-matrix.module.min.js create mode 100644 dist/3.x/wgpu-matrix.module.min.js.map delete mode 100644 docs/functions/mat3.setDefaultType.html create mode 100644 docs/functions/mat3d.clone.html create mode 100644 docs/functions/mat3d.copy.html create mode 100644 docs/functions/mat3d.create.html create mode 100644 docs/functions/mat3d.determinant.html create mode 100644 docs/functions/mat3d.equals.html create mode 100644 docs/functions/mat3d.equalsApproximately.html create mode 100644 docs/functions/mat3d.fromMat4.html create mode 100644 docs/functions/mat3d.fromQuat.html create mode 100644 docs/functions/mat3d.getAxis.html create mode 100644 docs/functions/mat3d.getScaling.html create mode 100644 docs/functions/mat3d.getTranslation.html create mode 100644 docs/functions/mat3d.identity.html create mode 100644 docs/functions/mat3d.inverse.html create mode 100644 docs/functions/mat3d.invert.html create mode 100644 docs/functions/mat3d.mul.html create mode 100644 docs/functions/mat3d.multiply.html create mode 100644 docs/functions/mat3d.negate.html create mode 100644 docs/functions/mat3d.rotate.html create mode 100644 docs/functions/mat3d.rotation.html create mode 100644 docs/functions/mat3d.scale.html create mode 100644 docs/functions/mat3d.scaling.html create mode 100644 docs/functions/mat3d.set.html create mode 100644 docs/functions/mat3d.setAxis.html create mode 100644 docs/functions/mat3d.setTranslation.html create mode 100644 docs/functions/mat3d.translate.html create mode 100644 docs/functions/mat3d.translation.html create mode 100644 docs/functions/mat3d.transpose.html create mode 100644 docs/functions/mat3d.uniformScale.html create mode 100644 docs/functions/mat3d.uniformScaling.html create mode 100644 docs/functions/mat3n.clone.html create mode 100644 docs/functions/mat3n.copy.html create mode 100644 docs/functions/mat3n.create.html create mode 100644 docs/functions/mat3n.determinant.html create mode 100644 docs/functions/mat3n.equals.html create mode 100644 docs/functions/mat3n.equalsApproximately.html create mode 100644 docs/functions/mat3n.fromMat4.html create mode 100644 docs/functions/mat3n.fromQuat.html create mode 100644 docs/functions/mat3n.getAxis.html create mode 100644 docs/functions/mat3n.getScaling.html create mode 100644 docs/functions/mat3n.getTranslation.html create mode 100644 docs/functions/mat3n.identity.html create mode 100644 docs/functions/mat3n.inverse.html create mode 100644 docs/functions/mat3n.invert.html create mode 100644 docs/functions/mat3n.mul.html create mode 100644 docs/functions/mat3n.multiply.html create mode 100644 docs/functions/mat3n.negate.html create mode 100644 docs/functions/mat3n.rotate.html create mode 100644 docs/functions/mat3n.rotation.html create mode 100644 docs/functions/mat3n.scale.html create mode 100644 docs/functions/mat3n.scaling.html create mode 100644 docs/functions/mat3n.set.html create mode 100644 docs/functions/mat3n.setAxis.html create mode 100644 docs/functions/mat3n.setTranslation.html create mode 100644 docs/functions/mat3n.translate.html create mode 100644 docs/functions/mat3n.translation.html create mode 100644 docs/functions/mat3n.transpose.html create mode 100644 docs/functions/mat3n.uniformScale.html create mode 100644 docs/functions/mat3n.uniformScaling.html delete mode 100644 docs/functions/mat4.setDefaultType.html create mode 100644 docs/functions/mat4d.aim.html create mode 100644 docs/functions/mat4d.axisRotate.html create mode 100644 docs/functions/mat4d.axisRotation.html create mode 100644 docs/functions/mat4d.cameraAim.html create mode 100644 docs/functions/mat4d.clone.html create mode 100644 docs/functions/mat4d.copy.html create mode 100644 docs/functions/mat4d.create.html create mode 100644 docs/functions/mat4d.determinant.html create mode 100644 docs/functions/mat4d.equals.html create mode 100644 docs/functions/mat4d.equalsApproximately.html create mode 100644 docs/functions/mat4d.fromMat3.html create mode 100644 docs/functions/mat4d.fromQuat.html create mode 100644 docs/functions/mat4d.frustum.html create mode 100644 docs/functions/mat4d.frustumReverseZ.html create mode 100644 docs/functions/mat4d.getAxis.html create mode 100644 docs/functions/mat4d.getScaling.html create mode 100644 docs/functions/mat4d.getTranslation.html create mode 100644 docs/functions/mat4d.identity.html create mode 100644 docs/functions/mat4d.inverse.html create mode 100644 docs/functions/mat4d.invert.html create mode 100644 docs/functions/mat4d.lookAt.html create mode 100644 docs/functions/mat4d.mul.html create mode 100644 docs/functions/mat4d.multiply.html create mode 100644 docs/functions/mat4d.negate.html create mode 100644 docs/functions/mat4d.ortho.html create mode 100644 docs/functions/mat4d.perspective.html create mode 100644 docs/functions/mat4d.perspectiveReverseZ.html create mode 100644 docs/functions/mat4d.rotate.html create mode 100644 docs/functions/mat4d.rotateX.html create mode 100644 docs/functions/mat4d.rotateY.html create mode 100644 docs/functions/mat4d.rotateZ.html create mode 100644 docs/functions/mat4d.rotation.html create mode 100644 docs/functions/mat4d.rotationX.html create mode 100644 docs/functions/mat4d.rotationY.html create mode 100644 docs/functions/mat4d.rotationZ.html create mode 100644 docs/functions/mat4d.scale.html create mode 100644 docs/functions/mat4d.scaling.html create mode 100644 docs/functions/mat4d.set.html create mode 100644 docs/functions/mat4d.setAxis.html create mode 100644 docs/functions/mat4d.setTranslation.html create mode 100644 docs/functions/mat4d.translate.html create mode 100644 docs/functions/mat4d.translation.html create mode 100644 docs/functions/mat4d.transpose.html create mode 100644 docs/functions/mat4d.uniformScale.html create mode 100644 docs/functions/mat4d.uniformScaling.html create mode 100644 docs/functions/mat4n.aim.html create mode 100644 docs/functions/mat4n.axisRotate.html create mode 100644 docs/functions/mat4n.axisRotation.html create mode 100644 docs/functions/mat4n.cameraAim.html create mode 100644 docs/functions/mat4n.clone.html create mode 100644 docs/functions/mat4n.copy.html create mode 100644 docs/functions/mat4n.create.html create mode 100644 docs/functions/mat4n.determinant.html create mode 100644 docs/functions/mat4n.equals.html create mode 100644 docs/functions/mat4n.equalsApproximately.html create mode 100644 docs/functions/mat4n.fromMat3.html create mode 100644 docs/functions/mat4n.fromQuat.html create mode 100644 docs/functions/mat4n.frustum.html create mode 100644 docs/functions/mat4n.frustumReverseZ.html create mode 100644 docs/functions/mat4n.getAxis.html create mode 100644 docs/functions/mat4n.getScaling.html create mode 100644 docs/functions/mat4n.getTranslation.html create mode 100644 docs/functions/mat4n.identity.html create mode 100644 docs/functions/mat4n.inverse.html create mode 100644 docs/functions/mat4n.invert.html create mode 100644 docs/functions/mat4n.lookAt.html create mode 100644 docs/functions/mat4n.mul.html create mode 100644 docs/functions/mat4n.multiply.html create mode 100644 docs/functions/mat4n.negate.html create mode 100644 docs/functions/mat4n.ortho.html create mode 100644 docs/functions/mat4n.perspective.html create mode 100644 docs/functions/mat4n.perspectiveReverseZ.html create mode 100644 docs/functions/mat4n.rotate.html create mode 100644 docs/functions/mat4n.rotateX.html create mode 100644 docs/functions/mat4n.rotateY.html create mode 100644 docs/functions/mat4n.rotateZ.html create mode 100644 docs/functions/mat4n.rotation.html create mode 100644 docs/functions/mat4n.rotationX.html create mode 100644 docs/functions/mat4n.rotationY.html create mode 100644 docs/functions/mat4n.rotationZ.html create mode 100644 docs/functions/mat4n.scale.html create mode 100644 docs/functions/mat4n.scaling.html create mode 100644 docs/functions/mat4n.set.html create mode 100644 docs/functions/mat4n.setAxis.html create mode 100644 docs/functions/mat4n.setTranslation.html create mode 100644 docs/functions/mat4n.translate.html create mode 100644 docs/functions/mat4n.translation.html create mode 100644 docs/functions/mat4n.transpose.html create mode 100644 docs/functions/mat4n.uniformScale.html create mode 100644 docs/functions/mat4n.uniformScaling.html delete mode 100644 docs/functions/quat.setDefaultType.html create mode 100644 docs/functions/quatd.add.html create mode 100644 docs/functions/quatd.angle.html create mode 100644 docs/functions/quatd.clone.html create mode 100644 docs/functions/quatd.conjugate.html create mode 100644 docs/functions/quatd.copy.html create mode 100644 docs/functions/quatd.create.html create mode 100644 docs/functions/quatd.divScalar.html create mode 100644 docs/functions/quatd.dot.html create mode 100644 docs/functions/quatd.equals.html create mode 100644 docs/functions/quatd.equalsApproximately.html create mode 100644 docs/functions/quatd.fromAxisAngle.html create mode 100644 docs/functions/quatd.fromEuler.html create mode 100644 docs/functions/quatd.fromMat.html create mode 100644 docs/functions/quatd.fromValues.html create mode 100644 docs/functions/quatd.identity.html create mode 100644 docs/functions/quatd.inverse.html create mode 100644 docs/functions/quatd.len.html create mode 100644 docs/functions/quatd.lenSq.html create mode 100644 docs/functions/quatd.length.html create mode 100644 docs/functions/quatd.lengthSq.html create mode 100644 docs/functions/quatd.lerp.html create mode 100644 docs/functions/quatd.mul.html create mode 100644 docs/functions/quatd.mulScalar.html create mode 100644 docs/functions/quatd.multiply.html create mode 100644 docs/functions/quatd.normalize.html create mode 100644 docs/functions/quatd.rotateX.html create mode 100644 docs/functions/quatd.rotateY.html create mode 100644 docs/functions/quatd.rotateZ.html create mode 100644 docs/functions/quatd.rotationTo.html create mode 100644 docs/functions/quatd.scale.html create mode 100644 docs/functions/quatd.set.html create mode 100644 docs/functions/quatd.slerp.html create mode 100644 docs/functions/quatd.sqlerp.html create mode 100644 docs/functions/quatd.sub.html create mode 100644 docs/functions/quatd.subtract.html create mode 100644 docs/functions/quatd.toAxisAngle.html create mode 100644 docs/functions/quatn.add.html create mode 100644 docs/functions/quatn.angle.html create mode 100644 docs/functions/quatn.clone.html create mode 100644 docs/functions/quatn.conjugate.html create mode 100644 docs/functions/quatn.copy.html create mode 100644 docs/functions/quatn.create.html create mode 100644 docs/functions/quatn.divScalar.html create mode 100644 docs/functions/quatn.dot.html create mode 100644 docs/functions/quatn.equals.html create mode 100644 docs/functions/quatn.equalsApproximately.html create mode 100644 docs/functions/quatn.fromAxisAngle.html create mode 100644 docs/functions/quatn.fromEuler.html create mode 100644 docs/functions/quatn.fromMat.html create mode 100644 docs/functions/quatn.fromValues.html create mode 100644 docs/functions/quatn.identity.html create mode 100644 docs/functions/quatn.inverse.html create mode 100644 docs/functions/quatn.len.html create mode 100644 docs/functions/quatn.lenSq.html create mode 100644 docs/functions/quatn.length.html create mode 100644 docs/functions/quatn.lengthSq.html create mode 100644 docs/functions/quatn.lerp.html create mode 100644 docs/functions/quatn.mul.html create mode 100644 docs/functions/quatn.mulScalar.html create mode 100644 docs/functions/quatn.multiply.html create mode 100644 docs/functions/quatn.normalize.html create mode 100644 docs/functions/quatn.rotateX.html create mode 100644 docs/functions/quatn.rotateY.html create mode 100644 docs/functions/quatn.rotateZ.html create mode 100644 docs/functions/quatn.rotationTo.html create mode 100644 docs/functions/quatn.scale.html create mode 100644 docs/functions/quatn.set.html create mode 100644 docs/functions/quatn.slerp.html create mode 100644 docs/functions/quatn.sqlerp.html create mode 100644 docs/functions/quatn.sub.html create mode 100644 docs/functions/quatn.subtract.html create mode 100644 docs/functions/quatn.toAxisAngle.html delete mode 100644 docs/functions/setDefaultType.html delete mode 100644 docs/functions/vec2.setDefaultType.html create mode 100644 docs/functions/vec2d.add.html create mode 100644 docs/functions/vec2d.addScaled.html create mode 100644 docs/functions/vec2d.angle.html create mode 100644 docs/functions/vec2d.ceil.html create mode 100644 docs/functions/vec2d.clamp.html create mode 100644 docs/functions/vec2d.clone.html create mode 100644 docs/functions/vec2d.copy.html create mode 100644 docs/functions/vec2d.create.html create mode 100644 docs/functions/vec2d.cross.html create mode 100644 docs/functions/vec2d.dist.html create mode 100644 docs/functions/vec2d.distSq.html create mode 100644 docs/functions/vec2d.distance.html create mode 100644 docs/functions/vec2d.distanceSq.html create mode 100644 docs/functions/vec2d.div.html create mode 100644 docs/functions/vec2d.divScalar.html create mode 100644 docs/functions/vec2d.divide.html create mode 100644 docs/functions/vec2d.dot.html create mode 100644 docs/functions/vec2d.equals.html create mode 100644 docs/functions/vec2d.equalsApproximately.html create mode 100644 docs/functions/vec2d.floor.html create mode 100644 docs/functions/vec2d.fromValues.html create mode 100644 docs/functions/vec2d.inverse.html create mode 100644 docs/functions/vec2d.invert.html create mode 100644 docs/functions/vec2d.len.html create mode 100644 docs/functions/vec2d.lenSq.html create mode 100644 docs/functions/vec2d.length.html create mode 100644 docs/functions/vec2d.lengthSq.html create mode 100644 docs/functions/vec2d.lerp.html create mode 100644 docs/functions/vec2d.lerpV.html create mode 100644 docs/functions/vec2d.max.html create mode 100644 docs/functions/vec2d.midpoint.html create mode 100644 docs/functions/vec2d.min.html create mode 100644 docs/functions/vec2d.mul.html create mode 100644 docs/functions/vec2d.mulScalar.html create mode 100644 docs/functions/vec2d.multiply.html create mode 100644 docs/functions/vec2d.negate.html create mode 100644 docs/functions/vec2d.normalize.html create mode 100644 docs/functions/vec2d.random.html create mode 100644 docs/functions/vec2d.rotate.html create mode 100644 docs/functions/vec2d.round.html create mode 100644 docs/functions/vec2d.scale.html create mode 100644 docs/functions/vec2d.set.html create mode 100644 docs/functions/vec2d.setLength.html create mode 100644 docs/functions/vec2d.sub.html create mode 100644 docs/functions/vec2d.subtract.html create mode 100644 docs/functions/vec2d.transformMat3.html create mode 100644 docs/functions/vec2d.transformMat4.html create mode 100644 docs/functions/vec2d.truncate.html create mode 100644 docs/functions/vec2d.zero.html create mode 100644 docs/functions/vec2n.add.html create mode 100644 docs/functions/vec2n.addScaled.html create mode 100644 docs/functions/vec2n.angle.html create mode 100644 docs/functions/vec2n.ceil.html create mode 100644 docs/functions/vec2n.clamp.html create mode 100644 docs/functions/vec2n.clone.html create mode 100644 docs/functions/vec2n.copy.html create mode 100644 docs/functions/vec2n.create.html create mode 100644 docs/functions/vec2n.cross.html create mode 100644 docs/functions/vec2n.dist.html create mode 100644 docs/functions/vec2n.distSq.html create mode 100644 docs/functions/vec2n.distance.html create mode 100644 docs/functions/vec2n.distanceSq.html create mode 100644 docs/functions/vec2n.div.html create mode 100644 docs/functions/vec2n.divScalar.html create mode 100644 docs/functions/vec2n.divide.html create mode 100644 docs/functions/vec2n.dot.html create mode 100644 docs/functions/vec2n.equals.html create mode 100644 docs/functions/vec2n.equalsApproximately.html create mode 100644 docs/functions/vec2n.floor.html create mode 100644 docs/functions/vec2n.fromValues.html create mode 100644 docs/functions/vec2n.inverse.html create mode 100644 docs/functions/vec2n.invert.html create mode 100644 docs/functions/vec2n.len.html create mode 100644 docs/functions/vec2n.lenSq.html create mode 100644 docs/functions/vec2n.length.html create mode 100644 docs/functions/vec2n.lengthSq.html create mode 100644 docs/functions/vec2n.lerp.html create mode 100644 docs/functions/vec2n.lerpV.html create mode 100644 docs/functions/vec2n.max.html create mode 100644 docs/functions/vec2n.midpoint.html create mode 100644 docs/functions/vec2n.min.html create mode 100644 docs/functions/vec2n.mul.html create mode 100644 docs/functions/vec2n.mulScalar.html create mode 100644 docs/functions/vec2n.multiply.html create mode 100644 docs/functions/vec2n.negate.html create mode 100644 docs/functions/vec2n.normalize.html create mode 100644 docs/functions/vec2n.random.html create mode 100644 docs/functions/vec2n.rotate.html create mode 100644 docs/functions/vec2n.round.html create mode 100644 docs/functions/vec2n.scale.html create mode 100644 docs/functions/vec2n.set.html create mode 100644 docs/functions/vec2n.setLength.html create mode 100644 docs/functions/vec2n.sub.html create mode 100644 docs/functions/vec2n.subtract.html create mode 100644 docs/functions/vec2n.transformMat3.html create mode 100644 docs/functions/vec2n.transformMat4.html create mode 100644 docs/functions/vec2n.truncate.html create mode 100644 docs/functions/vec2n.zero.html delete mode 100644 docs/functions/vec3.setDefaultType.html create mode 100644 docs/functions/vec3d.add.html create mode 100644 docs/functions/vec3d.addScaled.html create mode 100644 docs/functions/vec3d.angle.html create mode 100644 docs/functions/vec3d.ceil.html create mode 100644 docs/functions/vec3d.clamp.html create mode 100644 docs/functions/vec3d.clone.html create mode 100644 docs/functions/vec3d.copy.html create mode 100644 docs/functions/vec3d.create.html create mode 100644 docs/functions/vec3d.cross.html create mode 100644 docs/functions/vec3d.dist.html create mode 100644 docs/functions/vec3d.distSq.html create mode 100644 docs/functions/vec3d.distance.html create mode 100644 docs/functions/vec3d.distanceSq.html create mode 100644 docs/functions/vec3d.div.html create mode 100644 docs/functions/vec3d.divScalar.html create mode 100644 docs/functions/vec3d.divide.html create mode 100644 docs/functions/vec3d.dot.html create mode 100644 docs/functions/vec3d.equals.html create mode 100644 docs/functions/vec3d.equalsApproximately.html create mode 100644 docs/functions/vec3d.floor.html create mode 100644 docs/functions/vec3d.fromValues.html create mode 100644 docs/functions/vec3d.getAxis.html create mode 100644 docs/functions/vec3d.getScaling.html create mode 100644 docs/functions/vec3d.getTranslation.html create mode 100644 docs/functions/vec3d.inverse.html create mode 100644 docs/functions/vec3d.invert.html create mode 100644 docs/functions/vec3d.len.html create mode 100644 docs/functions/vec3d.lenSq.html create mode 100644 docs/functions/vec3d.length.html create mode 100644 docs/functions/vec3d.lengthSq.html create mode 100644 docs/functions/vec3d.lerp.html create mode 100644 docs/functions/vec3d.lerpV.html create mode 100644 docs/functions/vec3d.max.html create mode 100644 docs/functions/vec3d.midpoint.html create mode 100644 docs/functions/vec3d.min.html create mode 100644 docs/functions/vec3d.mul.html create mode 100644 docs/functions/vec3d.mulScalar.html create mode 100644 docs/functions/vec3d.multiply.html create mode 100644 docs/functions/vec3d.negate.html create mode 100644 docs/functions/vec3d.normalize.html create mode 100644 docs/functions/vec3d.random.html create mode 100644 docs/functions/vec3d.rotateX.html create mode 100644 docs/functions/vec3d.rotateY.html create mode 100644 docs/functions/vec3d.rotateZ.html create mode 100644 docs/functions/vec3d.round.html create mode 100644 docs/functions/vec3d.scale.html create mode 100644 docs/functions/vec3d.set.html create mode 100644 docs/functions/vec3d.setLength.html create mode 100644 docs/functions/vec3d.sub.html create mode 100644 docs/functions/vec3d.subtract.html create mode 100644 docs/functions/vec3d.transformMat3.html create mode 100644 docs/functions/vec3d.transformMat4.html create mode 100644 docs/functions/vec3d.transformMat4Upper3x3.html create mode 100644 docs/functions/vec3d.transformQuat.html create mode 100644 docs/functions/vec3d.truncate.html create mode 100644 docs/functions/vec3d.zero.html create mode 100644 docs/functions/vec3n.add.html create mode 100644 docs/functions/vec3n.addScaled.html create mode 100644 docs/functions/vec3n.angle.html create mode 100644 docs/functions/vec3n.ceil.html create mode 100644 docs/functions/vec3n.clamp.html create mode 100644 docs/functions/vec3n.clone.html create mode 100644 docs/functions/vec3n.copy.html create mode 100644 docs/functions/vec3n.create.html create mode 100644 docs/functions/vec3n.cross.html create mode 100644 docs/functions/vec3n.dist.html create mode 100644 docs/functions/vec3n.distSq.html create mode 100644 docs/functions/vec3n.distance.html create mode 100644 docs/functions/vec3n.distanceSq.html create mode 100644 docs/functions/vec3n.div.html create mode 100644 docs/functions/vec3n.divScalar.html create mode 100644 docs/functions/vec3n.divide.html create mode 100644 docs/functions/vec3n.dot.html create mode 100644 docs/functions/vec3n.equals.html create mode 100644 docs/functions/vec3n.equalsApproximately.html create mode 100644 docs/functions/vec3n.floor.html create mode 100644 docs/functions/vec3n.fromValues.html create mode 100644 docs/functions/vec3n.getAxis.html create mode 100644 docs/functions/vec3n.getScaling.html create mode 100644 docs/functions/vec3n.getTranslation.html create mode 100644 docs/functions/vec3n.inverse.html create mode 100644 docs/functions/vec3n.invert.html create mode 100644 docs/functions/vec3n.len.html create mode 100644 docs/functions/vec3n.lenSq.html create mode 100644 docs/functions/vec3n.length.html create mode 100644 docs/functions/vec3n.lengthSq.html create mode 100644 docs/functions/vec3n.lerp.html create mode 100644 docs/functions/vec3n.lerpV.html create mode 100644 docs/functions/vec3n.max.html create mode 100644 docs/functions/vec3n.midpoint.html create mode 100644 docs/functions/vec3n.min.html create mode 100644 docs/functions/vec3n.mul.html create mode 100644 docs/functions/vec3n.mulScalar.html create mode 100644 docs/functions/vec3n.multiply.html create mode 100644 docs/functions/vec3n.negate.html create mode 100644 docs/functions/vec3n.normalize.html create mode 100644 docs/functions/vec3n.random.html create mode 100644 docs/functions/vec3n.rotateX.html create mode 100644 docs/functions/vec3n.rotateY.html create mode 100644 docs/functions/vec3n.rotateZ.html create mode 100644 docs/functions/vec3n.round.html create mode 100644 docs/functions/vec3n.scale.html create mode 100644 docs/functions/vec3n.set.html create mode 100644 docs/functions/vec3n.setLength.html create mode 100644 docs/functions/vec3n.sub.html create mode 100644 docs/functions/vec3n.subtract.html create mode 100644 docs/functions/vec3n.transformMat3.html create mode 100644 docs/functions/vec3n.transformMat4.html create mode 100644 docs/functions/vec3n.transformMat4Upper3x3.html create mode 100644 docs/functions/vec3n.transformQuat.html create mode 100644 docs/functions/vec3n.truncate.html create mode 100644 docs/functions/vec3n.zero.html delete mode 100644 docs/functions/vec4.setDefaultType.html create mode 100644 docs/functions/vec4d.add.html create mode 100644 docs/functions/vec4d.addScaled.html create mode 100644 docs/functions/vec4d.ceil.html create mode 100644 docs/functions/vec4d.clamp.html create mode 100644 docs/functions/vec4d.clone.html create mode 100644 docs/functions/vec4d.copy.html create mode 100644 docs/functions/vec4d.create.html create mode 100644 docs/functions/vec4d.dist.html create mode 100644 docs/functions/vec4d.distSq.html create mode 100644 docs/functions/vec4d.distance.html create mode 100644 docs/functions/vec4d.distanceSq.html create mode 100644 docs/functions/vec4d.div.html create mode 100644 docs/functions/vec4d.divScalar.html create mode 100644 docs/functions/vec4d.divide.html create mode 100644 docs/functions/vec4d.dot.html create mode 100644 docs/functions/vec4d.equals.html create mode 100644 docs/functions/vec4d.equalsApproximately.html create mode 100644 docs/functions/vec4d.floor.html create mode 100644 docs/functions/vec4d.fromValues.html create mode 100644 docs/functions/vec4d.inverse.html create mode 100644 docs/functions/vec4d.invert.html create mode 100644 docs/functions/vec4d.len.html create mode 100644 docs/functions/vec4d.lenSq.html create mode 100644 docs/functions/vec4d.length.html create mode 100644 docs/functions/vec4d.lengthSq.html create mode 100644 docs/functions/vec4d.lerp.html create mode 100644 docs/functions/vec4d.lerpV.html create mode 100644 docs/functions/vec4d.max.html create mode 100644 docs/functions/vec4d.midpoint.html create mode 100644 docs/functions/vec4d.min.html create mode 100644 docs/functions/vec4d.mul.html create mode 100644 docs/functions/vec4d.mulScalar.html create mode 100644 docs/functions/vec4d.multiply.html create mode 100644 docs/functions/vec4d.negate.html create mode 100644 docs/functions/vec4d.normalize.html create mode 100644 docs/functions/vec4d.round.html create mode 100644 docs/functions/vec4d.scale.html create mode 100644 docs/functions/vec4d.set.html create mode 100644 docs/functions/vec4d.setLength.html create mode 100644 docs/functions/vec4d.sub.html create mode 100644 docs/functions/vec4d.subtract.html create mode 100644 docs/functions/vec4d.transformMat4.html create mode 100644 docs/functions/vec4d.truncate.html create mode 100644 docs/functions/vec4d.zero.html create mode 100644 docs/functions/vec4n.add.html create mode 100644 docs/functions/vec4n.addScaled.html create mode 100644 docs/functions/vec4n.ceil.html create mode 100644 docs/functions/vec4n.clamp.html create mode 100644 docs/functions/vec4n.clone.html create mode 100644 docs/functions/vec4n.copy.html create mode 100644 docs/functions/vec4n.create.html create mode 100644 docs/functions/vec4n.dist.html create mode 100644 docs/functions/vec4n.distSq.html create mode 100644 docs/functions/vec4n.distance.html create mode 100644 docs/functions/vec4n.distanceSq.html create mode 100644 docs/functions/vec4n.div.html create mode 100644 docs/functions/vec4n.divScalar.html create mode 100644 docs/functions/vec4n.divide.html create mode 100644 docs/functions/vec4n.dot.html create mode 100644 docs/functions/vec4n.equals.html create mode 100644 docs/functions/vec4n.equalsApproximately.html create mode 100644 docs/functions/vec4n.floor.html create mode 100644 docs/functions/vec4n.fromValues.html create mode 100644 docs/functions/vec4n.inverse.html create mode 100644 docs/functions/vec4n.invert.html create mode 100644 docs/functions/vec4n.len.html create mode 100644 docs/functions/vec4n.lenSq.html create mode 100644 docs/functions/vec4n.length.html create mode 100644 docs/functions/vec4n.lengthSq.html create mode 100644 docs/functions/vec4n.lerp.html create mode 100644 docs/functions/vec4n.lerpV.html create mode 100644 docs/functions/vec4n.max.html create mode 100644 docs/functions/vec4n.midpoint.html create mode 100644 docs/functions/vec4n.min.html create mode 100644 docs/functions/vec4n.mul.html create mode 100644 docs/functions/vec4n.mulScalar.html create mode 100644 docs/functions/vec4n.multiply.html create mode 100644 docs/functions/vec4n.negate.html create mode 100644 docs/functions/vec4n.normalize.html create mode 100644 docs/functions/vec4n.round.html create mode 100644 docs/functions/vec4n.scale.html create mode 100644 docs/functions/vec4n.set.html create mode 100644 docs/functions/vec4n.setLength.html create mode 100644 docs/functions/vec4n.sub.html create mode 100644 docs/functions/vec4n.subtract.html create mode 100644 docs/functions/vec4n.transformMat4.html create mode 100644 docs/functions/vec4n.truncate.html create mode 100644 docs/functions/vec4n.zero.html create mode 100644 docs/media/LICENSE.md create mode 100644 docs/modules/mat3d.html create mode 100644 docs/modules/mat3n.html create mode 100644 docs/modules/mat4d.html create mode 100644 docs/modules/mat4n.html create mode 100644 docs/modules/quatd.html create mode 100644 docs/modules/quatn.html create mode 100644 docs/modules/vec2d.html create mode 100644 docs/modules/vec2n.html create mode 100644 docs/modules/vec3d.html create mode 100644 docs/modules/vec3n.html create mode 100644 docs/modules/vec4d.html create mode 100644 docs/modules/vec4n.html create mode 100644 docs/types/BaseArgType.html create mode 100644 docs/types/BaseCtor.html create mode 100644 docs/types/Mat3Arg.html create mode 100644 docs/types/Mat3Type.html create mode 100644 docs/types/Mat3d-1.html create mode 100644 docs/types/Mat3n-1.html create mode 100644 docs/types/Mat4Arg.html create mode 100644 docs/types/Mat4Type.html create mode 100644 docs/types/Mat4d-1.html create mode 100644 docs/types/Mat4n-1.html create mode 100644 docs/types/QuatArg.html create mode 100644 docs/types/QuatType.html create mode 100644 docs/types/Quatd-1.html create mode 100644 docs/types/Quatn-1.html create mode 100644 docs/types/RotationOrder.html create mode 100644 docs/types/Vec2Arg.html create mode 100644 docs/types/Vec2Type.html create mode 100644 docs/types/Vec2d-1.html create mode 100644 docs/types/Vec2n-1.html create mode 100644 docs/types/Vec3Arg.html create mode 100644 docs/types/Vec3Type.html create mode 100644 docs/types/Vec3d-1.html create mode 100644 docs/types/Vec3n-1.html create mode 100644 docs/types/Vec4Arg.html create mode 100644 docs/types/Vec4Type.html create mode 100644 docs/types/Vec4d-1.html create mode 100644 docs/types/Vec4n-1.html delete mode 100644 docs/types/mat3.Mat3LikeCtor.html delete mode 100644 docs/types/mat4.Mat4LikeCtor.html delete mode 100644 docs/types/quat.RotationOrder.html create mode 100644 src/types.ts diff --git a/README.md b/README.md index 30b2b9e..a94f534 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ Fast 3d math library for webgpu import { vec3, mat4, -} from 'https://wgpu-matrix.org/dist/2.x/wgpu-matrix.module.js'; +} from 'https://wgpu-matrix.org/dist/3.x/wgpu-matrix.module.js'; const fov = 60 * Math.PI / 180 const aspect = width / height; @@ -101,7 +101,7 @@ There is also the minified version import { vec3, mat4, -} from 'https://wgpu-matrix.org/dist/2.x/wgpu-matrix.module.min.js'; +} from 'https://wgpu-matrix.org/dist/3.x/wgpu-matrix.module.min.js'; // ... etc ... ``` @@ -109,7 +109,7 @@ import { and a UMD version ```html - + + ... ``` @@ -251,6 +251,82 @@ As the saying goes [*premature optimization is the root of all evil.*](https://s ## Migration +### 2.x -> 3.x + +In JavaScript there should be no difference in the API except for the removable of `setDefaultType`. + +In TypeScript, 3.x should mostly be type compatible with 2.x. +3.x is an attempt to fix the casting that was necessary in 2.x. + +```js +// 2.x +device.queue.writeData(buffer, 0, mat4.identity() as Float32Array); // sadness! 😭 + +// 3.x +device.queue.writeData(buffer, 0, mat4.identity()); // Yay! 🎉 +``` + +In TypeScript the differences are as follows + +#### Functions have a default type but return what is passed to them as the dst. + +In 3.x each function has a default type but if you pass it +a destination it returns the type of the destination + +```ts +mat4.identity() // returns Float32Array +mat4.identity(new Float32Array(16)); // returns Float32Array +mat4.identity(new Float64Array(16)); // returns Float32Array +mat4.identity(new Array(16)); // returns number[] +``` + +### Types are specific + +```ts +const a: Mat4 = ...; // a = Float32Array +const b: Mat4d = ...; // b = Float64Array +const c: Mat4n = ...; // c = number[] +``` + +This is means code like this + +```ts +const position: Mat4 = [10, 20, 30]; +``` + +No longer works because `Mat4` is a `Float32Array`. + +**BUT, functions take any of the normal types as an argument just like they used to** + +```js +const position = [10, 20, 30]; // number[] +const target = vec3.create(1, 2, 3); // Float32Array +const up = new Float64Array([0, 1, 0]); // Float64Array + +// Works fine, even those types are different, just like 2.x did +const view = mat4.lookAt(position, target, up); // Float32Array +``` + +If you really want types for each concrete type there's + +* `Float32Array` types: `Mat3`, `Mat4`, `Quat`, `Vec2`, `Vec3`, `Vec4` +* `Float64Array` types: `Mat3d`, `Mat4d`, `Quatd`, `Vec2d`, `Vec3d`, `Vec4d`, +* `number[]` types: `Mat3n`, `Mat4n`, `Quatn`, `Vec2n`, `Vec3n`, `Vec4n` + +### There are 3 sets of functions, each one returning a different default + +```ts +mat4.identity() // returns Float32Array +mat4d.identity() // returns Float64Array +mat4n.identity() // returns number[] +``` + +Similarly there's `mat3d`, `mat3n`, `quatd`, `quatn`, +`vec2d`, `vec2n`, `vec3d`, `vec3n`, `vec4d`, `vec4n`. + +**Note: that in general you're unlikely to need any of these. Just use the +same ones you were using in 2.x** + ### 1.x -> 2.x * [`mat4.lookAt`](https://wgpu-matrix.org/docs/functions/mat4.lookAt.html) diff --git a/dist/2.x/mat3-impl.d.ts b/dist/2.x/mat3-impl.d.ts deleted file mode 100644 index 23f3ebe..0000000 --- a/dist/2.x/mat3-impl.d.ts +++ /dev/null @@ -1,271 +0,0 @@ -import { Quat } from './quat'; -import { Mat3 } from './mat3'; -import { Mat4 } from './mat4'; -import Vec2 from './vec2-impl'; -export default Mat3; -export type Mat3LikeCtor = new (n: number) => Mat3; -/** - * Sets the type this library creates for a Mat3 - * @param ctor - the constructor for the type. Either `Float32Array`, `Float64Array`, or `Array` - * @returns previous constructor for Mat3 - */ -export declare function setDefaultType(ctor: new (n: number) => Mat3): Mat3LikeCtor; -/** - * Create a Mat3 from values - * - * Note: Since passing in a raw JavaScript array - * is valid in all circumstances, if you want to - * force a JavaScript array into a Mat3's specified type - * it would be faster to use - * - * ``` - * const m = mat3.clone(someJSArray); - * ``` - * - * Note: a consequence of the implementation is if your Mat3Type = `Array` - * instead of `Float32Array` or `Float64Array` then any values you - * don't pass in will be undefined. Usually this is not an issue since - * (a) using `Array` is rare and (b) using `mat3.create` is usually used - * to create a Mat3 to be filled out as in - * - * ``` - * const m = mat3.create(); - * mat3.perspective(fov, aspect, near, far, m); - * ``` - * - * @param v0 - value for element 0 - * @param v1 - value for element 1 - * @param v2 - value for element 2 - * @param v3 - value for element 3 - * @param v4 - value for element 4 - * @param v5 - value for element 5 - * @param v6 - value for element 6 - * @param v7 - value for element 7 - * @param v8 - value for element 8 - * @returns matrix created from values. - */ -export declare function create(v0?: number, v1?: number, v2?: number, v3?: number, v4?: number, v5?: number, v6?: number, v7?: number, v8?: number): Mat3; -/** - * Sets the values of a Mat3 - * Also see {@link mat3.create} and {@link mat3.copy} - * - * @param v0 - value for element 0 - * @param v1 - value for element 1 - * @param v2 - value for element 2 - * @param v3 - value for element 3 - * @param v4 - value for element 4 - * @param v5 - value for element 5 - * @param v6 - value for element 6 - * @param v7 - value for element 7 - * @param v8 - value for element 8 - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns Mat3 set from values. - */ -export declare function set(v0: number, v1: number, v2: number, v3: number, v4: number, v5: number, v6: number, v7: number, v8: number, dst?: Mat3): Mat3; -/** - * Creates a Mat3 from the upper left 3x3 part of a Mat4 - * @param m4 - source matrix - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns Mat3 made from m4 - */ -export declare function fromMat4(m4: Mat4, dst?: Mat3): Mat3; -/** - * Creates a Mat3 rotation matrix from a quaternion - * @param q - quaternion to create matrix from - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns Mat3 made from q - */ -export declare function fromQuat(q: Quat, dst?: Mat3): Mat3; -/** - * Negates a matrix. - * @param m - The matrix. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns -m. - */ -export declare function negate(m: Mat3, dst?: Mat3): Mat3; -/** - * Copies a matrix. (same as {@link mat3.clone}) - * Also see {@link mat3.create} and {@link mat3.set} - * @param m - The matrix. - * @param dst - The matrix. If not passed a new one is created. - * @returns A copy of m. - */ -export declare function copy(m: Mat3, dst?: Mat3): Mat3; -/** - * Copies a matrix (same as {@link mat3.copy}) - * Also see {@link mat3.create} and {@link mat3.set} - * @param m - The matrix. - * @param dst - The matrix. If not passed a new one is created. - * @returns A copy of m. - */ -export declare const clone: typeof copy; -/** - * Check if 2 matrices are approximately equal - * @param a Operand matrix. - * @param b Operand matrix. - * @returns true if matrices are approximately equal - */ -export declare function equalsApproximately(a: Mat3, b: Mat3): boolean; -/** - * Check if 2 matrices are exactly equal - * @param a Operand matrix. - * @param b Operand matrix. - * @returns true if matrices are exactly equal - */ -export declare function equals(a: Mat3, b: Mat3): boolean; -/** - * Creates a 3-by-3 identity matrix. - * - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns A 3-by-3 identity matrix. - */ -export declare function identity(dst?: Mat3): Mat3; -/** - * Takes the transpose of a matrix. - * @param m - The matrix. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The transpose of m. - */ -export declare function transpose(m: Mat3, dst?: Mat3): Mat3; -/** - * Computes the inverse of a 3-by-3 matrix. - * @param m - The matrix. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The inverse of m. - */ -export declare function inverse(m: Mat3, dst?: Mat3): Mat3; -/** - * Compute the determinant of a matrix - * @param m - the matrix - * @returns the determinant - */ -export declare function determinant(m: Mat3): number; -/** - * Computes the inverse of a 3-by-3 matrix. (same as inverse) - * @param m - The matrix. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The inverse of m. - */ -export declare const invert: typeof inverse; -/** - * Multiplies two 3-by-3 matrices with a on the left and b on the right - * @param a - The matrix on the left. - * @param b - The matrix on the right. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The matrix product of a and b. - */ -export declare function multiply(a: Mat3, b: Mat3, dst?: Mat3): Mat3; -/** - * Multiplies two 3-by-3 matrices with a on the left and b on the right (same as multiply) - * @param a - The matrix on the left. - * @param b - The matrix on the right. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The matrix product of a and b. - */ -export declare const mul: typeof multiply; -/** - * Sets the translation component of a 3-by-3 matrix to the given - * vector. - * @param a - The matrix. - * @param v - The vector. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The matrix with translation set. - */ -export declare function setTranslation(a: Mat3, v: Vec2, dst?: Mat3): Mat3; -/** - * Returns the translation component of a 3-by-3 matrix as a vector with 3 - * entries. - * @param m - The matrix. - * @param dst - vector to hold result. If not passed a new one is created. - * @returns The translation component of m. - */ -export declare function getTranslation(m: Mat3, dst?: Vec2): Vec2; -/** - * Returns an axis of a 3x3 matrix as a vector with 2 entries - * @param m - The matrix. - * @param axis - The axis 0 = x, 1 = y, - * @returns The axis component of m. - */ -export declare function getAxis(m: Mat3, axis: number, dst?: Vec2): Vec2; -/** - * Sets an axis of a 3x3 matrix as a vector with 2 entries - * @param m - The matrix. - * @param v - the axis vector - * @param axis - The axis 0 = x, 1 = y; - * @param dst - The matrix to set. If not passed a new one is created. - * @returns The matrix with axis set. - */ -export declare function setAxis(m: Mat3, v: Vec2, axis: number, dst?: Mat3): Mat3; -/** - * Returns the scaling component of the matrix - * @param m - The Matrix - * @param dst - The vector to set. If not passed a new one is created. - */ -export declare function getScaling(m: Mat3, dst?: Vec2): Vec2; -/** - * Creates a 3-by-3 matrix which translates by the given vector v. - * @param v - The vector by which to translate. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The translation matrix. - */ -export declare function translation(v: Vec2, dst?: Mat3): Mat3; -/** - * Translates the given 3-by-3 matrix by the given vector v. - * @param m - The matrix. - * @param v - The vector by which to translate. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The translated matrix. - */ -export declare function translate(m: Mat3, v: Vec2, dst?: Mat3): Mat3; -/** - * Creates a 3-by-3 matrix which rotates by the given angle. - * @param angleInRadians - The angle by which to rotate (in radians). - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The rotation matrix. - */ -export declare function rotation(angleInRadians: number, dst?: Mat3): Mat3; -/** - * Rotates the given 3-by-3 matrix by the given angle. - * @param m - The matrix. - * @param angleInRadians - The angle by which to rotate (in radians). - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The rotated matrix. - */ -export declare function rotate(m: Mat3, angleInRadians: number, dst?: Mat3): Mat3; -/** - * Creates a 3-by-3 matrix which scales in each dimension by an amount given by - * the corresponding entry in the given vector; assumes the vector has three - * entries. - * @param v - A vector of - * 2 entries specifying the factor by which to scale in each dimension. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The scaling matrix. - */ -export declare function scaling(v: Vec2, dst?: Mat3): Mat3; -/** - * Scales the given 3-by-3 matrix in each dimension by an amount - * given by the corresponding entry in the given vector; assumes the vector has - * three entries. - * @param m - The matrix to be modified. - * @param v - A vector of 2 entries specifying the - * factor by which to scale in each dimension. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The scaled matrix. - */ -export declare function scale(m: Mat3, v: Vec2, dst?: Mat3): Mat3; -/** - * Creates a 3-by-3 matrix which scales uniformly in each dimension - * @param s - Amount to scale - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The scaling matrix. - */ -export declare function uniformScaling(s: number, dst?: Mat3): Mat3; -/** - * Scales the given 3-by-3 matrix in each dimension by an amount - * given. - * @param m - The matrix to be modified. - * @param s - Amount to scale. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The scaled matrix. - */ -export declare function uniformScale(m: Mat3, s: number, dst?: Mat3): Mat3; diff --git a/dist/2.x/mat3.d.ts b/dist/2.x/mat3.d.ts deleted file mode 100644 index 691ff27..0000000 --- a/dist/2.x/mat3.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -/** - * A JavaScript array with 12 values, a Float32Array with 12 values, or a Float64Array with 12 values. - * When created by the library will create the default type which is `Float32Array` - * but can be set by calling {@link mat3.setDefaultType}. - */ -export type Mat3 = number[] | Float32Array | Float64Array; diff --git a/dist/2.x/mat4-impl.d.ts b/dist/2.x/mat4-impl.d.ts deleted file mode 100644 index 63d25fb..0000000 --- a/dist/2.x/mat4-impl.d.ts +++ /dev/null @@ -1,507 +0,0 @@ -import { Mat3 } from './mat3'; -import { Mat4 } from './mat4'; -import { Quat } from './quat'; -import Vec3 from './vec3-impl'; -export default Mat4; -export type Mat4LikeCtor = new (n: number) => Mat4; -/** - * Sets the type this library creates for a Mat4 - * @param ctor - the constructor for the type. Either `Float32Array`, `Float64Array`, or `Array` - * @returns previous constructor for Mat4 - */ -export declare function setDefaultType(ctor: new (n: number) => Mat4): Mat4LikeCtor; -/** - * Create a Mat4 from values - * - * Note: Since passing in a raw JavaScript array - * is valid in all circumstances, if you want to - * force a JavaScript array into a Mat4's specified type - * it would be faster to use - * - * ``` - * const m = mat4.clone(someJSArray); - * ``` - * - * Note: a consequence of the implementation is if your Mat4Type = `Array` - * instead of `Float32Array` or `Float64Array` then any values you - * don't pass in will be undefined. Usually this is not an issue since - * (a) using `Array` is rare and (b) using `mat4.create` is usually used - * to create a Mat4 to be filled out as in - * - * ``` - * const m = mat4.create(); - * mat4.perspective(fov, aspect, near, far, m); - * ``` - * - * @param v0 - value for element 0 - * @param v1 - value for element 1 - * @param v2 - value for element 2 - * @param v3 - value for element 3 - * @param v4 - value for element 4 - * @param v5 - value for element 5 - * @param v6 - value for element 6 - * @param v7 - value for element 7 - * @param v8 - value for element 8 - * @param v9 - value for element 9 - * @param v10 - value for element 10 - * @param v11 - value for element 11 - * @param v12 - value for element 12 - * @param v13 - value for element 13 - * @param v14 - value for element 14 - * @param v15 - value for element 15 - * @returns created from values. - */ -export declare function create(v0?: number, v1?: number, v2?: number, v3?: number, v4?: number, v5?: number, v6?: number, v7?: number, v8?: number, v9?: number, v10?: number, v11?: number, v12?: number, v13?: number, v14?: number, v15?: number): Mat4; -/** - * Sets the values of a Mat4 - * Also see {@link mat4.create} and {@link mat4.copy} - * - * @param v0 - value for element 0 - * @param v1 - value for element 1 - * @param v2 - value for element 2 - * @param v3 - value for element 3 - * @param v4 - value for element 4 - * @param v5 - value for element 5 - * @param v6 - value for element 6 - * @param v7 - value for element 7 - * @param v8 - value for element 8 - * @param v9 - value for element 9 - * @param v10 - value for element 10 - * @param v11 - value for element 11 - * @param v12 - value for element 12 - * @param v13 - value for element 13 - * @param v14 - value for element 14 - * @param v15 - value for element 15 - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns Mat4 created from values. - */ -export declare function set(v0: number, v1: number, v2: number, v3: number, v4: number, v5: number, v6: number, v7: number, v8: number, v9: number, v10: number, v11: number, v12: number, v13: number, v14: number, v15: number, dst?: Mat4): Mat4; -/** - * Creates a Mat4 from a Mat3 - * @param m3 - source matrix - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns Mat4 made from m3 - */ -export declare function fromMat3(m3: Mat3, dst?: Mat4): Mat4; -/** - * Creates a Mat4 rotation matrix from a quaternion - * @param q - quaternion to create matrix from - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns Mat4 made from q - */ -export declare function fromQuat(q: Quat, dst?: Mat4): Mat4; -/** - * Negates a matrix. - * @param m - The matrix. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns -m. - */ -export declare function negate(m: Mat4, dst?: Mat4): Mat4; -/** - * Copies a matrix. (same as {@link mat4.clone}) - * Also see {@link mat4.create} and {@link mat4.set} - * @param m - The matrix. - * @param dst - The matrix. If not passed a new one is created. - * @returns A copy of m. - */ -export declare function copy(m: Mat4, dst?: Mat4): Mat4; -/** - * Copies a matrix (same as {@link mat4.copy}) - * Also see {@link mat4.create} and {@link mat4.set} - * @param m - The matrix. - * @param dst - The matrix. If not passed a new one is created. - * @returns A copy of m. - */ -export declare const clone: typeof copy; -/** - * Check if 2 matrices are approximately equal - * @param a - Operand matrix. - * @param b - Operand matrix. - * @returns true if matrices are approximately equal - */ -export declare function equalsApproximately(a: Mat4, b: Mat4): boolean; -/** - * Check if 2 matrices are exactly equal - * @param a - Operand matrix. - * @param b - Operand matrix. - * @returns true if matrices are exactly equal - */ -export declare function equals(a: Mat4, b: Mat4): boolean; -/** - * Creates a 4-by-4 identity matrix. - * - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns A 4-by-4 identity matrix. - */ -export declare function identity(dst?: Mat4): Mat4; -/** - * Takes the transpose of a matrix. - * @param m - The matrix. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The transpose of m. - */ -export declare function transpose(m: Mat4, dst?: Mat4): Mat4; -/** - * Computes the inverse of a 4-by-4 matrix. - * @param m - The matrix. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The inverse of m. - */ -export declare function inverse(m: Mat4, dst?: Mat4): Mat4; -/** - * Compute the determinant of a matrix - * @param m - the matrix - * @returns the determinant - */ -export declare function determinant(m: Mat4): number; -/** - * Computes the inverse of a 4-by-4 matrix. (same as inverse) - * @param m - The matrix. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The inverse of m. - */ -export declare const invert: typeof inverse; -/** - * Multiplies two 4-by-4 matrices with a on the left and b on the right - * @param a - The matrix on the left. - * @param b - The matrix on the right. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The matrix product of a and b. - */ -export declare function multiply(a: Mat4, b: Mat4, dst?: Mat4): Mat4; -/** - * Multiplies two 4-by-4 matrices with a on the left and b on the right (same as multiply) - * @param a - The matrix on the left. - * @param b - The matrix on the right. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The matrix product of a and b. - */ -export declare const mul: typeof multiply; -/** - * Sets the translation component of a 4-by-4 matrix to the given - * vector. - * @param a - The matrix. - * @param v - The vector. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The matrix with translation set. - */ -export declare function setTranslation(a: Mat4, v: Vec3, dst?: Mat4): Mat4; -/** - * Returns the translation component of a 4-by-4 matrix as a vector with 3 - * entries. - * @param m - The matrix. - * @param dst - vector to hold result. If not passed a new one is created. - * @returns The translation component of m. - */ -export declare function getTranslation(m: Mat4, dst?: Vec3): Vec3; -/** - * Returns an axis of a 4x4 matrix as a vector with 3 entries - * @param m - The matrix. - * @param axis - The axis 0 = x, 1 = y, 2 = z; - * @returns The axis component of m. - */ -export declare function getAxis(m: Mat4, axis: number, dst?: Vec3): Vec3; -/** - * Sets an axis of a 4x4 matrix as a vector with 3 entries - * @param m - The matrix. - * @param v - the axis vector - * @param axis - The axis 0 = x, 1 = y, 2 = z; - * @param dst - The matrix to set. If not passed a new one is created. - * @returns The matrix with axis set. - */ -export declare function setAxis(m: Mat4, v: Vec3, axis: number, dst: Mat4): Mat4; -/** - * Returns the scaling component of the matrix - * @param m - The Matrix - * @param dst - The vector to set. If not passed a new one is created. - */ -export declare function getScaling(m: Mat4, dst?: Vec3): Vec3; -/** - * Computes a 4-by-4 perspective transformation matrix given the angular height - * of the frustum, the aspect ratio, and the near and far clipping planes. The - * arguments define a frustum extending in the negative z direction. The given - * angle is the vertical angle of the frustum, and the horizontal angle is - * determined to produce the given aspect ratio. The arguments near and far are - * the distances to the near and far clipping planes. Note that near and far - * are not z coordinates, but rather they are distances along the negative - * z-axis. The matrix generated sends the viewing frustum to the unit box. - * We assume a unit box extending from -1 to 1 in the x and y dimensions and - * from 0 to 1 in the z dimension. - * - * Note: If you pass `Infinity` for zFar then it will produce a projection matrix - * returns -Infinity for Z when transforming coordinates with Z <= 0 and +Infinity for Z - * otherwise. - * - * @param fieldOfViewYInRadians - The camera angle from top to bottom (in radians). - * @param aspect - The aspect ratio width / height. - * @param zNear - The depth (negative z coordinate) - * of the near clipping plane. - * @param zFar - The depth (negative z coordinate) - * of the far clipping plane. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The perspective matrix. - */ -export declare function perspective(fieldOfViewYInRadians: number, aspect: number, zNear: number, zFar: number, dst?: Mat4): Mat4; -/** - * Computes a 4-by-4 reverse-z perspective transformation matrix given the angular height - * of the frustum, the aspect ratio, and the near and far clipping planes. The - * arguments define a frustum extending in the negative z direction. The given - * angle is the vertical angle of the frustum, and the horizontal angle is - * determined to produce the given aspect ratio. The arguments near and far are - * the distances to the near and far clipping planes. Note that near and far - * are not z coordinates, but rather they are distances along the negative - * z-axis. The matrix generated sends the viewing frustum to the unit box. - * We assume a unit box extending from -1 to 1 in the x and y dimensions and - * from 1 (at -zNear) to 0 (at -zFar) in the z dimension. - * - * @param fieldOfViewYInRadians - The camera angle from top to bottom (in radians). - * @param aspect - The aspect ratio width / height. - * @param zNear - The depth (negative z coordinate) - * of the near clipping plane. - * @param zFar - The depth (negative z coordinate) - * of the far clipping plane. (default = Infinity) - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The perspective matrix. - */ export declare function perspectiveReverseZ(fieldOfViewYInRadians: number, aspect: number, zNear: number, zFar?: number, dst?: Mat4): Mat4; -/** - * Computes a 4-by-4 orthogonal transformation matrix that transforms from - * the given the left, right, bottom, and top dimensions to -1 +1 in x, and y - * and 0 to +1 in z. - * @param left - Left side of the near clipping plane viewport. - * @param right - Right side of the near clipping plane viewport. - * @param bottom - Bottom of the near clipping plane viewport. - * @param top - Top of the near clipping plane viewport. - * @param near - The depth (negative z coordinate) - * of the near clipping plane. - * @param far - The depth (negative z coordinate) - * of the far clipping plane. - * @param dst - Output matrix. If not passed a new one is created. - * @returns The orthographic projection matrix. - */ -export declare function ortho(left: number, right: number, bottom: number, top: number, near: number, far: number, dst?: Mat4): Mat4; -/** - * Computes a 4-by-4 perspective transformation matrix given the left, right, - * top, bottom, near and far clipping planes. The arguments define a frustum - * extending in the negative z direction. The arguments near and far are the - * distances to the near and far clipping planes. Note that near and far are not - * z coordinates, but rather they are distances along the negative z-axis. The - * matrix generated sends the viewing frustum to the unit box. We assume a unit - * box extending from -1 to 1 in the x and y dimensions and from 0 to 1 in the z - * dimension. - * @param left - The x coordinate of the left plane of the box. - * @param right - The x coordinate of the right plane of the box. - * @param bottom - The y coordinate of the bottom plane of the box. - * @param top - The y coordinate of the right plane of the box. - * @param near - The negative z coordinate of the near plane of the box. - * @param far - The negative z coordinate of the far plane of the box. - * @param dst - Output matrix. If not passed a new one is created. - * @returns The perspective projection matrix. - */ -export declare function frustum(left: number, right: number, bottom: number, top: number, near: number, far: number, dst?: Mat4): Mat4; -/** - * Computes a 4-by-4 reverse-z perspective transformation matrix given the left, right, - * top, bottom, near and far clipping planes. The arguments define a frustum - * extending in the negative z direction. The arguments near and far are the - * distances to the near and far clipping planes. Note that near and far are not - * z coordinates, but rather they are distances along the negative z-axis. The - * matrix generated sends the viewing frustum to the unit box. We assume a unit - * box extending from -1 to 1 in the x and y dimensions and from 1 (-near) to 0 (-far) in the z - * dimension. - * @param left - The x coordinate of the left plane of the box. - * @param right - The x coordinate of the right plane of the box. - * @param bottom - The y coordinate of the bottom plane of the box. - * @param top - The y coordinate of the right plane of the box. - * @param near - The negative z coordinate of the near plane of the box. - * @param far - The negative z coordinate of the far plane of the box. - * @param dst - Output matrix. If not passed a new one is created. - * @returns The perspective projection matrix. - */ -export declare function frustumReverseZ(left: number, right: number, bottom: number, top: number, near: number, far?: number, dst?: Mat4): Mat4; -/** - * Computes a 4-by-4 aim transformation. - * - * This is a matrix which positions an object aiming down positive Z. - * toward the target. - * - * Note: this is **NOT** the inverse of lookAt as lookAt looks at negative Z. - * - * @param position - The position of the object. - * @param target - The position meant to be aimed at. - * @param up - A vector pointing up. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The aim matrix. - */ -export declare function aim(position: Vec3, target: Vec3, up: Vec3, dst?: Mat4): Mat4; -/** - * Computes a 4-by-4 camera aim transformation. - * - * This is a matrix which positions an object aiming down negative Z. - * toward the target. - * - * Note: this is the inverse of `lookAt` - * - * @param eye - The position of the object. - * @param target - The position meant to be aimed at. - * @param up - A vector pointing up. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The aim matrix. - */ -export declare function cameraAim(eye: Vec3, target: Vec3, up: Vec3, dst?: Mat4): Mat4; -/** - * Computes a 4-by-4 view transformation. - * - * This is a view matrix which transforms all other objects - * to be in the space of the view defined by the parameters. - * - * @param eye - The position of the object. - * @param target - The position meant to be aimed at. - * @param up - A vector pointing up. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The look-at matrix. - */ -export declare function lookAt(eye: Vec3, target: Vec3, up: Vec3, dst?: Mat4): Mat4; -/** - * Creates a 4-by-4 matrix which translates by the given vector v. - * @param v - The vector by - * which to translate. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The translation matrix. - */ -export declare function translation(v: Vec3, dst?: Mat4): Mat4; -/** - * Translates the given 4-by-4 matrix by the given vector v. - * @param m - The matrix. - * @param v - The vector by - * which to translate. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The translated matrix. - */ -export declare function translate(m: Mat4, v: Vec3, dst?: Mat4): Mat4; -/** - * Creates a 4-by-4 matrix which rotates around the x-axis by the given angle. - * @param angleInRadians - The angle by which to rotate (in radians). - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The rotation matrix. - */ -export declare function rotationX(angleInRadians: number, dst?: Mat4): Mat4; -/** - * Rotates the given 4-by-4 matrix around the x-axis by the given - * angle. - * @param m - The matrix. - * @param angleInRadians - The angle by which to rotate (in radians). - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The rotated matrix. - */ -export declare function rotateX(m: Mat4, angleInRadians: number, dst?: Mat4): Mat4; -/** - * Creates a 4-by-4 matrix which rotates around the y-axis by the given angle. - * @param angleInRadians - The angle by which to rotate (in radians). - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The rotation matrix. - */ -export declare function rotationY(angleInRadians: number, dst?: Mat4): Mat4; -/** - * Rotates the given 4-by-4 matrix around the y-axis by the given - * angle. - * @param m - The matrix. - * @param angleInRadians - The angle by which to rotate (in radians). - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The rotated matrix. - */ -export declare function rotateY(m: Mat4, angleInRadians: number, dst?: Mat4): Mat4; -/** - * Creates a 4-by-4 matrix which rotates around the z-axis by the given angle. - * @param angleInRadians - The angle by which to rotate (in radians). - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The rotation matrix. - */ -export declare function rotationZ(angleInRadians: number, dst?: Mat4): Mat4; -/** - * Rotates the given 4-by-4 matrix around the z-axis by the given - * angle. - * @param m - The matrix. - * @param angleInRadians - The angle by which to rotate (in radians). - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The rotated matrix. - */ -export declare function rotateZ(m: Mat4, angleInRadians: number, dst?: Mat4): Mat4; -/** - * Creates a 4-by-4 matrix which rotates around the given axis by the given - * angle. - * @param axis - The axis - * about which to rotate. - * @param angleInRadians - The angle by which to rotate (in radians). - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns A matrix which rotates angle radians - * around the axis. - */ -export declare function axisRotation(axis: Vec3, angleInRadians: number, dst?: Mat4): Mat4; -/** - * Creates a 4-by-4 matrix which rotates around the given axis by the given - * angle. (same as axisRotation) - * @param axis - The axis - * about which to rotate. - * @param angleInRadians - The angle by which to rotate (in radians). - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns A matrix which rotates angle radians - * around the axis. - */ -export declare const rotation: typeof axisRotation; -/** - * Rotates the given 4-by-4 matrix around the given axis by the - * given angle. - * @param m - The matrix. - * @param axis - The axis - * about which to rotate. - * @param angleInRadians - The angle by which to rotate (in radians). - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The rotated matrix. - */ -export declare function axisRotate(m: Mat4, axis: Vec3, angleInRadians: number, dst?: Mat4): Mat4; -/** - * Rotates the given 4-by-4 matrix around the given axis by the - * given angle. (same as rotate) - * @param m - The matrix. - * @param axis - The axis - * about which to rotate. - * @param angleInRadians - The angle by which to rotate (in radians). - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The rotated matrix. - */ -export declare const rotate: typeof axisRotate; -/** - * Creates a 4-by-4 matrix which scales in each dimension by an amount given by - * the corresponding entry in the given vector; assumes the vector has three - * entries. - * @param v - A vector of - * three entries specifying the factor by which to scale in each dimension. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The scaling matrix. - */ -export declare function scaling(v: Vec3, dst?: Mat4): Mat4; -/** - * Scales the given 4-by-4 matrix in each dimension by an amount - * given by the corresponding entry in the given vector; assumes the vector has - * three entries. - * @param m - The matrix to be modified. - * @param v - A vector of three entries specifying the - * factor by which to scale in each dimension. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The scaled matrix. - */ -export declare function scale(m: Mat4, v: Vec3, dst?: Mat4): Mat4; -/** - * Creates a 4-by-4 matrix which scales a uniform amount in each dimension. - * @param s - the amount to scale - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The scaling matrix. - */ -export declare function uniformScaling(s: number, dst?: Mat4): Mat4; -/** - * Scales the given 4-by-4 matrix in each dimension by a uniform scale. - * @param m - The matrix to be modified. - * @param s - The amount to scale. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The scaled matrix. - */ -export declare function uniformScale(m: Mat4, s: number, dst?: Mat4): Mat4; diff --git a/dist/2.x/mat4.d.ts b/dist/2.x/mat4.d.ts deleted file mode 100644 index 90b1708..0000000 --- a/dist/2.x/mat4.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -/** - * A JavaScript array with 16 values, a Float32Array with 16 values, or a Float64Array with 16 values. - * When created by the library will create the default type which is `Float32Array` - * but can be set by calling {@link mat4.setDefaultType}. - */ -export type Mat4 = number[] | Float32Array | Float64Array; diff --git a/dist/2.x/quat-impl.d.ts b/dist/2.x/quat-impl.d.ts deleted file mode 100644 index 7153b02..0000000 --- a/dist/2.x/quat-impl.d.ts +++ /dev/null @@ -1,298 +0,0 @@ -import { Quat, create, setDefaultType } from './quat'; -import { Mat3 } from './mat3.js'; -import { Mat4 } from './mat4.js'; -import { Vec3 } from './vec3.js'; -export type RotationOrder = 'xyz' | 'xzy' | 'yxz' | 'yzx' | 'zxy' | 'zyx'; -export default Quat; -export { create, setDefaultType }; -/** - * Creates a Quat; may be called with x, y, z to set initial values. (same as create) - * @param x - Initial x value. - * @param y - Initial y value. - * @param z - Initial z value. - * @param z - Initial w value. - * @returns the created vector - */ -export declare const fromValues: typeof create; -/** - * Sets the values of a Quat - * Also see {@link quat.create} and {@link quat.copy} - * - * @param x first value - * @param y second value - * @param z third value - * @param w fourth value - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector with its elements set. - */ -export declare function set(x: number, y: number, z: number, w: number, dst?: Quat): Quat; -/** - * Sets a quaternion from the given angle and axis, - * then returns it. - * - * @param axis - the axis to rotate around - * @param angleInRadians - the angle - * @param dst - quaternion to hold result. If not passed in a new one is created. - * @returns The quaternion that represents the given axis and angle - **/ -export declare function fromAxisAngle(axis: Vec3, angleInRadians: number, dst?: Quat): Quat; -/** - * Gets the rotation axis and angle - * @param q - quaternion to compute from - * @param dst - Vec3 to hold result. If not passed in a new one is created. - * @return angle and axis - */ -export declare function toAxisAngle(q: Quat, dst?: Vec3): { - angle: number; - axis: Vec3; -}; -/** - * Returns the angle in degrees between two rotations a and b. - * @param a - quaternion a - * @param b - quaternion b - * @return angle in radians between the two quaternions - */ -export declare function angle(a: Quat, b: Quat): number; -/** - * Multiplies two quaternions - * - * @param a - the first quaternion - * @param b - the second quaternion - * @param dst - quaternion to hold result. If not passed in a new one is created. - * @returns A quaternion that is the result of a * b - */ -export declare function multiply(a: Quat, b: Quat, dst?: Quat): Quat; -/** - * Multiplies two quaternions - * - * @param a - the first quaternion - * @param b - the second quaternion - * @param dst - quaternion to hold result. If not passed in a new one is created. - * @returns A quaternion that is the result of a * b - */ -export declare const mul: typeof multiply; -/** - * Rotates the given quaternion around the X axis by the given angle. - * @param q - quaternion to rotate - * @param angleInRadians - The angle by which to rotate - * @param dst - quaternion to hold result. If not passed in a new one is created. - * @returns A quaternion that is the result of a * b - */ -export declare function rotateX(q: Quat, angleInRadians: number, dst?: Quat): Quat; -/** - * Rotates the given quaternion around the Y axis by the given angle. - * @param q - quaternion to rotate - * @param angleInRadians - The angle by which to rotate - * @param dst - quaternion to hold result. If not passed in a new one is created. - * @returns A quaternion that is the result of a * b - */ -export declare function rotateY(q: Quat, angleInRadians: number, dst?: Quat): Quat; -/** - * Rotates the given quaternion around the Z axis by the given angle. - * @param q - quaternion to rotate - * @param angleInRadians - The angle by which to rotate - * @param dst - quaternion to hold result. If not passed in a new one is created. - * @returns A quaternion that is the result of a * b - */ -export declare function rotateZ(q: Quat, angleInRadians: number, dst?: Quat): Quat; -/** - * Spherically linear interpolate between two quaternions - * - * @param a - starting value - * @param b - ending value - * @param t - value where 0 = a and 1 = b - * @param dst - quaternion to hold result. If not passed in a new one is created. - * @returns A quaternion that is the result of a * b - */ -export declare function slerp(a: Quat, b: Quat, t: number, dst?: Quat): Quat; -/** - * Compute the inverse of a quaternion - * - * @param q - quaternion to compute the inverse of - * @returns A quaternion that is the result of a * b - */ -export declare function inverse(q: Quat, dst?: Quat): Quat; -/** - * Compute the conjugate of a quaternion - * For quaternions with a magnitude of 1 (a unit quaternion) - * this returns the same as the inverse but is faster to calculate. - * - * @param q - quaternion to compute the conjugate of. - * @param dst - quaternion to hold result. If not passed in a new one is created. - * @returns The conjugate of q - */ -export declare function conjugate(q: Quat, dst?: Quat): Quat; -/** - * Creates a quaternion from the given rotation matrix. - * - * The created quaternion is not normalized. - * - * @param m - rotation matrix - * @param dst - quaternion to hold result. If not passed in a new one is created. - * @returns the result - */ -export declare function fromMat(m: Mat3 | Mat4, dst?: Quat): Quat; -/** - * Creates a quaternion from the given euler angle x, y, z using the provided intrinsic order for the conversion. - * - * @param xAngleInRadians - angle to rotate around X axis in radians. - * @param yAngleInRadians - angle to rotate around Y axis in radians. - * @param zAngleInRadians - angle to rotate around Z axis in radians. - * @param order - order to apply euler angles - * @param dst - quaternion to hold result. If not passed in a new one is created. - * @returns A quaternion representing the same rotation as the euler angles applied in the given order - */ -export declare function fromEuler(xAngleInRadians: number, yAngleInRadians: number, zAngleInRadians: number, order: RotationOrder, dst?: Quat): Quat; -/** - * Copies a quaternion. (same as {@link quat.clone}) - * Also see {@link quat.create} and {@link quat.set} - * @param q - The quaternion. - * @param dst - quaternion to hold result. If not passed in a new one is created. - * @returns A quaternion that is a copy of q - */ -export declare function copy(q: Quat, dst?: Quat): Quat; -/** - * Clones a quaternion. (same as {@link quat.copy}) - * Also see {@link quat.create} and {@link quat.set} - * @param q - The quaternion. - * @param dst - quaternion to hold result. If not passed in a new one is created. - * @returns A copy of q. - */ -export declare const clone: typeof copy; -/** - * Adds two quaternions; assumes a and b have the same dimension. - * @param a - Operand quaternion. - * @param b - Operand quaternion. - * @param dst - quaternion to hold result. If not passed in a new one is created. - * @returns A quaternion that is the sum of a and b. - */ -export declare function add(a: Quat, b: Quat, dst?: Quat): Quat; -/** - * Subtracts two quaternions. - * @param a - Operand quaternion. - * @param b - Operand quaternion. - * @param dst - quaternion to hold result. If not passed in a new one is created. - * @returns A quaternion that is the difference of a and b. - */ -export declare function subtract(a: Quat, b: Quat, dst?: Quat): Quat; -/** - * Subtracts two quaternions. - * @param a - Operand quaternion. - * @param b - Operand quaternion. - * @param dst - quaternion to hold result. If not passed in a new one is created. - * @returns A quaternion that is the difference of a and b. - */ -export declare const sub: typeof subtract; -/** - * Multiplies a quaternion by a scalar. - * @param v - The quaternion. - * @param k - The scalar. - * @param dst - quaternion to hold result. If not passed in a new one is created. - * @returns The scaled quaternion. - */ -export declare function mulScalar(v: Quat, k: number, dst?: Quat): Quat; -/** - * Multiplies a quaternion by a scalar. (same as mulScalar) - * @param v - The quaternion. - * @param k - The scalar. - * @param dst - quaternion to hold result. If not passed in a new one is created. - * @returns The scaled quaternion. - */ -export declare const scale: typeof mulScalar; -/** - * Divides a vector by a scalar. - * @param v - The vector. - * @param k - The scalar. - * @param dst - quaternion to hold result. If not passed in a new one is created. - * @returns The scaled quaternion. - */ -export declare function divScalar(v: Quat, k: number, dst?: Quat): Quat; -/** - * Computes the dot product of two quaternions - * @param a - Operand quaternion. - * @param b - Operand quaternion. - * @returns dot product - */ -export declare function dot(a: Quat, b: Quat): number; -/** - * Performs linear interpolation on two quaternions. - * Given quaternions a and b and interpolation coefficient t, returns - * a + t * (b - a). - * @param a - Operand quaternion. - * @param b - Operand quaternion. - * @param t - Interpolation coefficient. - * @param dst - quaternion to hold result. If not passed in a new one is created. - * @returns The linear interpolated result. - */ -export declare function lerp(a: Quat, b: Quat, t: number, dst?: Quat): Quat; -/** - * Computes the length of quaternion - * @param v - quaternion. - * @returns length of quaternion. - */ -export declare function length(v: Quat): number; -/** - * Computes the length of quaternion (same as length) - * @param v - quaternion. - * @returns length of quaternion. - */ -export declare const len: typeof length; -/** - * Computes the square of the length of quaternion - * @param v - quaternion. - * @returns square of the length of quaternion. - */ -export declare function lengthSq(v: Quat): number; -/** - * Computes the square of the length of quaternion (same as lengthSq) - * @param v - quaternion. - * @returns square of the length of quaternion. - */ -export declare const lenSq: typeof lengthSq; -/** - * Divides a quaternion by its Euclidean length and returns the quotient. - * @param v - The quaternion. - * @param dst - quaternion to hold result. If not passed in a new one is created. - * @returns The normalized quaternion. - */ -export declare function normalize(v: Quat, dst?: Quat): Quat; -/** - * Check if 2 quaternions are approximately equal - * @param a - Operand quaternion. - * @param b - Operand quaternion. - * @returns true if quaternions are approximately equal - */ -export declare function equalsApproximately(a: Quat, b: Quat): boolean; -/** - * Check if 2 quaternions are exactly equal - * @param a - Operand quaternion. - * @param b - Operand quaternion. - * @returns true if quaternions are exactly equal - */ -export declare function equals(a: Quat, b: Quat): boolean; -/** - * Creates an identity quaternion - * @param dst - quaternion to hold result. If not passed in a new one is created. - * @returns an identity quaternion - */ -export declare function identity(dst?: Quat): Quat; -/** - * Computes a quaternion to represent the shortest rotation from one vector to another. - * - * @param aUnit - the start vector - * @param bUnit - the end vector - * @param dst - quaternion to hold result. If not passed in a new one is created. - * @returns the result - */ -export declare function rotationTo(aUnit: Vec3, bUnit: Vec3, dst?: Quat): Quat; -/** - * Performs a spherical linear interpolation with two control points - * - * @param a - the first quaternion - * @param b - the second quaternion - * @param c - the third quaternion - * @param d - the fourth quaternion - * @param t - Interpolation coefficient 0 to 1 - * @returns result - */ -export declare function sqlerp(a: Quat, b: Quat, c: Quat, d: Quat, t: number, dst?: Quat): Quat; diff --git a/dist/2.x/quat.d.ts b/dist/2.x/quat.d.ts deleted file mode 100644 index 7a35408..0000000 --- a/dist/2.x/quat.d.ts +++ /dev/null @@ -1,44 +0,0 @@ -/** - * A JavaScript array with 4 values, Float32Array with 4 values, or a Float64Array with 4 values. - * When created by the library will create the default type which is `Float32Array` - * but can be set by calling {@link quat.setDefaultType}. - */ -export type Quat = number[] | Float32Array | Float64Array; -/** - * - * Quat4 math functions. - * - * Almost all functions take an optional `dst` argument. If it is not passed in the - * functions will create a new `Quat4`. In other words you can do this - * - * const v = quat4.cross(v1, v2); // Creates a new Quat4 with the cross product of v1 x v2. - * - * or - * - * const v = quat4.create(); - * quat4.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v - * - * The first style is often easier but depending on where it's used it generates garbage where - * as there is almost never allocation with the second style. - * - * It is always safe to pass any vector as the destination. So for example - * - * quat4.cross(v1, v2, v1); // Puts the cross product of v1 x v2 in v1 - * - */ -export declare let QuatType: new (n: number) => Quat; -/** - * Sets the type this library creates for a Quat4 - * @param ctor - the constructor for the type. Either `Float32Array`, `Float64Array`, or `Array` - * @returns previous constructor for Quat4 - */ -export declare function setDefaultType(ctor: new (n: number) => Quat): new (n: number) => Quat; -/** - * Creates a quat4; may be called with x, y, z to set initial values. - * @param x - Initial x value. - * @param y - Initial y value. - * @param z - Initial z value. - * @param w - Initial w value. - * @returns the created vector - */ -export declare function create(x?: number, y?: number, z?: number, w?: number): Quat; diff --git a/dist/2.x/vec2-impl.d.ts b/dist/2.x/vec2-impl.d.ts deleted file mode 100644 index ce1871f..0000000 --- a/dist/2.x/vec2-impl.d.ts +++ /dev/null @@ -1,385 +0,0 @@ -import { Mat3 } from './mat3'; -import { Mat4 } from './mat4'; -import { Vec2, create, setDefaultType } from './vec2'; -import { Vec3 } from './vec3'; -export default Vec2; -export { create, setDefaultType }; -/** - * Creates a Vec2; may be called with x, y, z to set initial values. (same as create) - * @param x - Initial x value. - * @param y - Initial y value. - * @returns the created vector - */ -export declare const fromValues: typeof create; -/** - * Sets the values of a Vec2 - * Also see {@link vec2.create} and {@link vec2.copy} - * - * @param x first value - * @param y second value - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector with its elements set. - */ -export declare function set(x: number, y: number, dst?: Vec2): Vec2; -/** - * Applies Math.ceil to each element of vector - * @param v - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector that is the ceil of each element of v. - */ -export declare function ceil(v: Vec2, dst?: Vec2): Vec2; -/** - * Applies Math.floor to each element of vector - * @param v - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector that is the floor of each element of v. - */ -export declare function floor(v: Vec2, dst?: Vec2): Vec2; -/** - * Applies Math.round to each element of vector - * @param v - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector that is the round of each element of v. - */ -export declare function round(v: Vec2, dst?: Vec2): Vec2; -/** - * Clamp each element of vector between min and max - * @param v - Operand vector. - * @param max - Min value, default 0 - * @param min - Max value, default 1 - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector that the clamped value of each element of v. - */ -export declare function clamp(v: Vec2, min?: number, max?: number, dst?: Vec2): Vec2; -/** - * Adds two vectors; assumes a and b have the same dimension. - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector that is the sum of a and b. - */ -export declare function add(a: Vec2, b: Vec2, dst?: Vec2): Vec2; -/** - * Adds two vectors, scaling the 2nd; assumes a and b have the same dimension. - * @param a - Operand vector. - * @param b - Operand vector. - * @param scale - Amount to scale b - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector that is the sum of a + b * scale. - */ -export declare function addScaled(a: Vec2, b: Vec2, scale: number, dst?: Vec2): Vec2; -/** - * Returns the angle in radians between two vectors. - * @param a - Operand vector. - * @param b - Operand vector. - * @returns The angle in radians between the 2 vectors. - */ -export declare function angle(a: Vec2, b: Vec2): number; -/** - * Subtracts two vectors. - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector that is the difference of a and b. - */ -export declare function subtract(a: Vec2, b: Vec2, dst?: Vec2): Vec2; -/** - * Subtracts two vectors. - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector that is the difference of a and b. - */ -export declare const sub: typeof subtract; -/** - * Check if 2 vectors are approximately equal - * @param a - Operand vector. - * @param b - Operand vector. - * @returns true if vectors are approximately equal - */ -export declare function equalsApproximately(a: Vec2, b: Vec2): boolean; -/** - * Check if 2 vectors are exactly equal - * @param a - Operand vector. - * @param b - Operand vector. - * @returns true if vectors are exactly equal - */ -export declare function equals(a: Vec2, b: Vec2): boolean; -/** - * Performs linear interpolation on two vectors. - * Given vectors a and b and interpolation coefficient t, returns - * a + t * (b - a). - * @param a - Operand vector. - * @param b - Operand vector. - * @param t - Interpolation coefficient. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The linear interpolated result. - */ -export declare function lerp(a: Vec2, b: Vec2, t: number, dst?: Vec2): Vec2; -/** - * Performs linear interpolation on two vectors. - * Given vectors a and b and interpolation coefficient vector t, returns - * a + t * (b - a). - * @param a - Operand vector. - * @param b - Operand vector. - * @param t - Interpolation coefficients vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns the linear interpolated result. - */ -export declare function lerpV(a: Vec2, b: Vec2, t: Vec2, dst?: Vec2): Vec2; -/** - * Return max values of two vectors. - * Given vectors a and b returns - * [max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])]. - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The max components vector. - */ -export declare function max(a: Vec2, b: Vec2, dst?: Vec2): Vec2; -/** - * Return min values of two vectors. - * Given vectors a and b returns - * [min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])]. - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The min components vector. - */ -export declare function min(a: Vec2, b: Vec2, dst?: Vec2): Vec2; -/** - * Multiplies a vector by a scalar. - * @param v - The vector. - * @param k - The scalar. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The scaled vector. - */ -export declare function mulScalar(v: Vec2, k: number, dst?: Vec2): Vec2; -/** - * Multiplies a vector by a scalar. (same as mulScalar) - * @param v - The vector. - * @param k - The scalar. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The scaled vector. - */ -export declare const scale: typeof mulScalar; -/** - * Divides a vector by a scalar. - * @param v - The vector. - * @param k - The scalar. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The scaled vector. - */ -export declare function divScalar(v: Vec2, k: number, dst?: Vec2): Vec2; -/** - * Inverse a vector. - * @param v - The vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The inverted vector. - */ -export declare function inverse(v: Vec2, dst?: Vec2): Vec2; -/** - * Invert a vector. (same as inverse) - * @param v - The vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The inverted vector. - */ -export declare const invert: typeof inverse; -/** - * Computes the cross product of two vectors; assumes both vectors have - * three entries. - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The vector of a cross b. - */ -export declare function cross(a: Vec2, b: Vec2, dst?: Vec3): Vec3; -/** - * Computes the dot product of two vectors; assumes both vectors have - * three entries. - * @param a - Operand vector. - * @param b - Operand vector. - * @returns dot product - */ -export declare function dot(a: Vec2, b: Vec2): number; -/** - * Computes the length of vector - * @param v - vector. - * @returns length of vector. - */ -export declare function length(v: Vec2): number; -/** - * Computes the length of vector (same as length) - * @param v - vector. - * @returns length of vector. - */ -export declare const len: typeof length; -/** - * Computes the square of the length of vector - * @param v - vector. - * @returns square of the length of vector. - */ -export declare function lengthSq(v: Vec2): number; -/** - * Computes the square of the length of vector (same as lengthSq) - * @param v - vector. - * @returns square of the length of vector. - */ -export declare const lenSq: typeof lengthSq; -/** - * Computes the distance between 2 points - * @param a - vector. - * @param b - vector. - * @returns distance between a and b - */ -export declare function distance(a: Vec2, b: Vec2): number; -/** - * Computes the distance between 2 points (same as distance) - * @param a - vector. - * @param b - vector. - * @returns distance between a and b - */ -export declare const dist: typeof distance; -/** - * Computes the square of the distance between 2 points - * @param a - vector. - * @param b - vector. - * @returns square of the distance between a and b - */ -export declare function distanceSq(a: Vec2, b: Vec2): number; -/** - * Computes the square of the distance between 2 points (same as distanceSq) - * @param a - vector. - * @param b - vector. - * @returns square of the distance between a and b - */ -export declare const distSq: typeof distanceSq; -/** - * Divides a vector by its Euclidean length and returns the quotient. - * @param v - The vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The normalized vector. - */ -export declare function normalize(v: Vec2, dst?: Vec2): Vec2; -/** - * Negates a vector. - * @param v - The vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns -v. - */ -export declare function negate(v: Vec2, dst?: Vec2): Vec2; -/** - * Copies a vector. (same as {@link vec2.clone}) - * Also see {@link vec2.create} and {@link vec2.set} - * @param v - The vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A copy of v. - */ -export declare function copy(v: Vec2, dst?: Vec2): Vec2; -/** - * Clones a vector. (same as {@link vec2.copy}) - * Also see {@link vec2.create} and {@link vec2.set} - * @param v - The vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A copy of v. - */ -export declare const clone: typeof copy; -/** - * Multiplies a vector by another vector (component-wise); assumes a and - * b have the same length. - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The vector of products of entries of a and b. - */ -export declare function multiply(a: Vec2, b: Vec2, dst?: Vec2): Vec2; -/** - * Multiplies a vector by another vector (component-wise); assumes a and - * b have the same length. (same as mul) - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The vector of products of entries of a and b. - */ -export declare const mul: typeof multiply; -/** - * Divides a vector by another vector (component-wise); assumes a and - * b have the same length. - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The vector of quotients of entries of a and b. - */ -export declare function divide(a: Vec2, b: Vec2, dst?: Vec2): Vec2; -/** - * Divides a vector by another vector (component-wise); assumes a and - * b have the same length. (same as divide) - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The vector of quotients of entries of a and b. - */ -export declare const div: typeof divide; -/** - * Creates a random unit vector * scale - * @param scale - Default 1 - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The random vector. - */ -export declare function random(scale?: number, dst?: Vec2): Vec2; -/** - * Zero's a vector - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The zeroed vector. - */ -export declare function zero(dst?: Vec2): Vec2; -/** - * transform Vec2 by 4x4 matrix - * @param v - the vector - * @param m - The matrix. - * @param dst - optional Vec2 to store result. If not passed a new one is created. - * @returns the transformed vector - */ -export declare function transformMat4(v: Vec2, m: Mat4, dst?: Vec2): Vec2; -/** - * Transforms vec4 by 3x3 matrix - * - * @param v - the vector - * @param m - The matrix. - * @param dst - optional Vec2 to store result. If not passed a new one is created. - * @returns the transformed vector - */ -export declare function transformMat3(v: Vec2, m: Mat3, dst?: Vec2): Vec2; -/** - * Rotate a 2D vector - * - * @param a The vec2 point to rotate - * @param b The origin of the rotation - * @param rad The angle of rotation in radians - * @returns the rotated vector - */ -export declare function rotate(a: Vec2, b: Vec2, rad: number, dst?: Vec2): Vec2; -/** - * Treat a 2D vector as a direction and set it's length - * - * @param a The vec2 to lengthen - * @param len The length of the resulting vector - * @returns The lengthened vector - */ -export declare function setLength(a: Vec2, len: number, dst?: Vec2): Vec2; -/** - * Ensure a vector is not longer than a max length - * - * @param a The vec2 to limit - * @param maxLen The longest length of the resulting vector - * @returns The vector, shortened to maxLen if it's too long - */ -export declare function truncate(a: Vec2, maxLen: number, dst?: Vec2): Vec2; -/** - * Return the vector exactly between 2 endpoint vectors - * - * @param a Endpoint 1 - * @param b Endpoint 2 - * @returns The vector exactly residing between endpoints 1 and 2 - */ -export declare function midpoint(a: Vec2, b: Vec2, dst?: Vec2): Vec2; diff --git a/dist/2.x/vec2.d.ts b/dist/2.x/vec2.d.ts deleted file mode 100644 index ab730b6..0000000 --- a/dist/2.x/vec2.d.ts +++ /dev/null @@ -1,63 +0,0 @@ -/** - * A JavaScript array with 2 values, Float32Array with 2 values, or a Float64Array with 2 values. - * When created by the library will create the default type which is `Float32Array` - * but can be set by calling {@link vec2.setDefaultType}. - */ -export type Vec2 = number[] | Float32Array | Float64Array; -/** - * - * Vec2 math functions. - * - * Almost all functions take an optional `dst` argument. If it is not passed in the - * functions will create a new Vec2. In other words you can do this - * - * const v = vec2.cross(v1, v2); // Creates a new Vec2 with the cross product of v1 x v2. - * - * or - * - * const v = vec2.create(); - * vec2.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v - * - * The first style is often easier but depending on where it's used it generates garbage where - * as there is almost never allocation with the second style. - * - * It is always safe to pass any vector as the destination. So for example - * - * vec2.cross(v1, v2, v1); // Puts the cross product of v1 x v2 in v1 - * - */ -export declare let VecType: new (n: number) => Vec2; -/** - * Sets the type this library creates for a Vec2 - * @param ctor - the constructor for the type. Either `Float32Array`, `Float64Array`, or `Array` - * @returns previous constructor for Vec2 - */ -export declare function setDefaultType(ctor: new (n: number) => Vec2): new (n: number) => Vec2; -/** - * Creates a Vec2; may be called with x, y, z to set initial values. - * - * Note: Since passing in a raw JavaScript array - * is valid in all circumstances, if you want to - * force a JavaScript array into a Vec2's specified type - * it would be faster to use - * - * ``` - * const v = vec2.clone(someJSArray); - * ``` - * - * Note: a consequence of the implementation is if your Vec2Type = `Array` - * instead of `Float32Array` or `Float64Array` then any values you - * don't pass in will be undefined. Usually this is not an issue since - * (a) using `Array` is rare and (b) using `vec2.create` is usually used - * to create a Vec2 to be filled out as in - * - * ``` - * const sum = vec2.create(); - * vec2.add(v1, v2, sum); - * ``` - * - * @param x - Initial x value. - * @param y - Initial y value. - * @returns the created vector - */ -export declare function create(x?: number, y?: number): Vec2; diff --git a/dist/2.x/vec3-impl.d.ts b/dist/2.x/vec3-impl.d.ts deleted file mode 100644 index 8455fd9..0000000 --- a/dist/2.x/vec3-impl.d.ts +++ /dev/null @@ -1,445 +0,0 @@ -import { Vec3, create, setDefaultType } from './vec3'; -import { Mat3 } from './mat3'; -import { Mat4 } from './mat4'; -import { Quat } from './quat'; -export default Vec3; -export { create, setDefaultType }; -/** - * Creates a vec3; may be called with x, y, z to set initial values. (same as create) - * @param x - Initial x value. - * @param y - Initial y value. - * @param z - Initial z value. - * @returns the created vector - */ -export declare const fromValues: typeof create; -/** - * Sets the values of a Vec3 - * Also see {@link vec3.create} and {@link vec3.copy} - * - * @param x first value - * @param y second value - * @param z third value - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector with its elements set. - */ -export declare function set(x: number, y: number, z: number, dst?: Vec3): Vec3; -/** - * Applies Math.ceil to each element of vector - * @param v - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector that is the ceil of each element of v. - */ -export declare function ceil(v: Vec3, dst?: Vec3): Vec3; -/** - * Applies Math.floor to each element of vector - * @param v - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector that is the floor of each element of v. - */ -export declare function floor(v: Vec3, dst?: Vec3): Vec3; -/** - * Applies Math.round to each element of vector - * @param v - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector that is the round of each element of v. - */ -export declare function round(v: Vec3, dst?: Vec3): Vec3; -/** - * Clamp each element of vector between min and max - * @param v - Operand vector. - * @param max - Min value, default 0 - * @param min - Max value, default 1 - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector that the clamped value of each element of v. - */ -export declare function clamp(v: Vec3, min?: number, max?: number, dst?: Vec3): Vec3; -/** - * Adds two vectors; assumes a and b have the same dimension. - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector that is the sum of a and b. - */ -export declare function add(a: Vec3, b: Vec3, dst?: Vec3): Vec3; -/** - * Adds two vectors, scaling the 2nd; assumes a and b have the same dimension. - * @param a - Operand vector. - * @param b - Operand vector. - * @param scale - Amount to scale b - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector that is the sum of a + b * scale. - */ -export declare function addScaled(a: Vec3, b: Vec3, scale: number, dst?: Vec3): Vec3; -/** - * Returns the angle in radians between two vectors. - * @param a - Operand vector. - * @param b - Operand vector. - * @returns The angle in radians between the 2 vectors. - */ -export declare function angle(a: Vec3, b: Vec3): number; -/** - * Subtracts two vectors. - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector that is the difference of a and b. - */ -export declare function subtract(a: Vec3, b: Vec3, dst?: Vec3): Vec3; -/** - * Subtracts two vectors. - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector that is the difference of a and b. - */ -export declare const sub: typeof subtract; -/** - * Check if 2 vectors are approximately equal - * @param a - Operand vector. - * @param b - Operand vector. - * @returns true if vectors are approximately equal - */ -export declare function equalsApproximately(a: Vec3, b: Vec3): boolean; -/** - * Check if 2 vectors are exactly equal - * @param a - Operand vector. - * @param b - Operand vector. - * @returns true if vectors are exactly equal - */ -export declare function equals(a: Vec3, b: Vec3): boolean; -/** - * Performs linear interpolation on two vectors. - * Given vectors a and b and interpolation coefficient t, returns - * a + t * (b - a). - * @param a - Operand vector. - * @param b - Operand vector. - * @param t - Interpolation coefficient. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The linear interpolated result. - */ -export declare function lerp(a: Vec3, b: Vec3, t: number, dst?: Vec3): Vec3; -/** - * Performs linear interpolation on two vectors. - * Given vectors a and b and interpolation coefficient vector t, returns - * a + t * (b - a). - * @param a - Operand vector. - * @param b - Operand vector. - * @param t - Interpolation coefficients vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns the linear interpolated result. - */ -export declare function lerpV(a: Vec3, b: Vec3, t: Vec3, dst?: Vec3): Vec3; -/** - * Return max values of two vectors. - * Given vectors a and b returns - * [max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])]. - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The max components vector. - */ -export declare function max(a: Vec3, b: Vec3, dst?: Vec3): Vec3; -/** - * Return min values of two vectors. - * Given vectors a and b returns - * [min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])]. - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The min components vector. - */ -export declare function min(a: Vec3, b: Vec3, dst?: Vec3): Vec3; -/** - * Multiplies a vector by a scalar. - * @param v - The vector. - * @param k - The scalar. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The scaled vector. - */ -export declare function mulScalar(v: Vec3, k: number, dst?: Vec3): Vec3; -/** - * Multiplies a vector by a scalar. (same as mulScalar) - * @param v - The vector. - * @param k - The scalar. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The scaled vector. - */ -export declare const scale: typeof mulScalar; -/** - * Divides a vector by a scalar. - * @param v - The vector. - * @param k - The scalar. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The scaled vector. - */ -export declare function divScalar(v: Vec3, k: number, dst?: Vec3): Vec3; -/** - * Inverse a vector. - * @param v - The vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The inverted vector. - */ -export declare function inverse(v: Vec3, dst?: Vec3): Vec3; -/** - * Invert a vector. (same as inverse) - * @param v - The vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The inverted vector. - */ -export declare const invert: typeof inverse; -/** - * Computes the cross product of two vectors; assumes both vectors have - * three entries. - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The vector of a cross b. - */ -export declare function cross(a: Vec3, b: Vec3, dst?: Vec3): Vec3; -/** - * Computes the dot product of two vectors; assumes both vectors have - * three entries. - * @param a - Operand vector. - * @param b - Operand vector. - * @returns dot product - */ -export declare function dot(a: Vec3, b: Vec3): number; -/** - * Computes the length of vector - * @param v - vector. - * @returns length of vector. - */ -export declare function length(v: Vec3): number; -/** - * Computes the length of vector (same as length) - * @param v - vector. - * @returns length of vector. - */ -export declare const len: typeof length; -/** - * Computes the square of the length of vector - * @param v - vector. - * @returns square of the length of vector. - */ -export declare function lengthSq(v: Vec3): number; -/** - * Computes the square of the length of vector (same as lengthSq) - * @param v - vector. - * @returns square of the length of vector. - */ -export declare const lenSq: typeof lengthSq; -/** - * Computes the distance between 2 points - * @param a - vector. - * @param b - vector. - * @returns distance between a and b - */ -export declare function distance(a: Vec3, b: Vec3): number; -/** - * Computes the distance between 2 points (same as distance) - * @param a - vector. - * @param b - vector. - * @returns distance between a and b - */ -export declare const dist: typeof distance; -/** - * Computes the square of the distance between 2 points - * @param a - vector. - * @param b - vector. - * @returns square of the distance between a and b - */ -export declare function distanceSq(a: Vec3, b: Vec3): number; -/** - * Computes the square of the distance between 2 points (same as distanceSq) - * @param a - vector. - * @param b - vector. - * @returns square of the distance between a and b - */ -export declare const distSq: typeof distanceSq; -/** - * Divides a vector by its Euclidean length and returns the quotient. - * @param v - The vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The normalized vector. - */ -export declare function normalize(v: Vec3, dst?: Vec3): Vec3; -/** - * Negates a vector. - * @param v - The vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns -v. - */ -export declare function negate(v: Vec3, dst?: Vec3): Vec3; -/** - * Copies a vector. (same as {@link vec3.clone}) - * Also see {@link vec3.create} and {@link vec3.set} - * @param v - The vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A copy of v. - */ -export declare function copy(v: Vec3, dst?: Vec3): Vec3; -/** - * Clones a vector. (same as {@link vec3.copy}) - * Also see {@link vec3.create} and {@link vec3.set} - * @param v - The vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A copy of v. - */ -export declare const clone: typeof copy; -/** - * Multiplies a vector by another vector (component-wise); assumes a and - * b have the same length. - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The vector of products of entries of a and b. - */ -export declare function multiply(a: Vec3, b: Vec3, dst?: Vec3): Vec3; -/** - * Multiplies a vector by another vector (component-wise); assumes a and - * b have the same length. (same as mul) - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The vector of products of entries of a and b. - */ -export declare const mul: typeof multiply; -/** - * Divides a vector by another vector (component-wise); assumes a and - * b have the same length. - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The vector of quotients of entries of a and b. - */ -export declare function divide(a: Vec3, b: Vec3, dst?: Vec3): Vec3; -/** - * Divides a vector by another vector (component-wise); assumes a and - * b have the same length. (same as divide) - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The vector of quotients of entries of a and b. - */ -export declare const div: typeof divide; -/** - * Creates a random vector - * @param scale - Default 1 - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The random vector. - */ -export declare function random(scale?: number, dst?: Vec3): Vec3; -/** - * Zero's a vector - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The zeroed vector. - */ -export declare function zero(dst?: Vec3): Vec3; -/** - * transform vec3 by 4x4 matrix - * @param v - the vector - * @param m - The matrix. - * @param dst - optional vec3 to store result. If not passed a new one is created. - * @returns the transformed vector - */ -export declare function transformMat4(v: Vec3, m: Mat4, dst?: Vec3): Vec3; -/** - * Transform vec4 by upper 3x3 matrix inside 4x4 matrix. - * @param v - The direction. - * @param m - The matrix. - * @param dst - optional Vec3 to store result. If not passed a new one is created. - * @returns The transformed vector. - */ -export declare function transformMat4Upper3x3(v: Vec3, m: Mat4, dst?: Vec3): Vec3; -/** - * Transforms vec3 by 3x3 matrix - * - * @param v - the vector - * @param m - The matrix. - * @param dst - optional vec3 to store result. If not passed a new one is created. - * @returns the transformed vector - */ -export declare function transformMat3(v: Vec3, m: Mat3, dst?: Vec3): Vec3; -/** - * Transforms vec3 by Quaternion - * @param v - the vector to transform - * @param q - the quaternion to transform by - * @param dst - optional vec3 to store result. If not passed a new one is created. - * @returns the transformed - */ -export declare function transformQuat(v: Vec3, q: Quat, dst?: Vec3): Vec3; -/** - * Returns the translation component of a 4-by-4 matrix as a vector with 3 - * entries. - * @param m - The matrix. - * @param dst - vector to hold result. If not passed a new one is created. - * @returns The translation component of m. - */ -export declare function getTranslation(m: Mat3, dst?: Vec3): Vec3; -/** - * Returns an axis of a 4x4 matrix as a vector with 3 entries - * @param m - The matrix. - * @param axis - The axis 0 = x, 1 = y, 2 = z; - * @returns The axis component of m. - */ -export declare function getAxis(m: Mat4, axis: number, dst?: Vec3): Vec3; -/** - * Returns the scaling component of the matrix - * @param m - The Matrix - * @param dst - The vector to set. If not passed a new one is created. - */ -export declare function getScaling(m: Mat4, dst: Vec3): Vec3; -/** - * Rotate a 3D vector around the x-axis - * - * @param {ReadonlyVec3} a The vec3 point to rotate - * @param {ReadonlyVec3} b The origin of the rotation - * @param {Number} rad The angle of rotation in radians - * @param dst - The vector to set. If not passed a new one is created. - * @returns the rotated vector - */ -export declare function rotateX(a: Vec3, b: Vec3, rad: number, dst?: Vec3): Vec3; -/** - * Rotate a 3D vector around the y-axis - * - * @param {ReadonlyVec3} a The vec3 point to rotate - * @param {ReadonlyVec3} b The origin of the rotation - * @param {Number} rad The angle of rotation in radians - * @param dst - The vector to set. If not passed a new one is created. - * @returns the rotated vector - */ -export declare function rotateY(a: Vec3, b: Vec3, rad: number, dst?: Vec3): Vec3; -/** - * Rotate a 3D vector around the z-axis - * - * @param {ReadonlyVec3} a The vec3 point to rotate - * @param {ReadonlyVec3} b The origin of the rotation - * @param {Number} rad The angle of rotation in radians - * @param dst - The vector to set. If not passed a new one is created. - * @returns {vec3} out - */ -export declare function rotateZ(a: Vec3, b: Vec3, rad: number, dst?: Vec3): Vec3; -/** - * Treat a 3D vector as a direction and set it's length - * - * @param a The vec3 to lengthen - * @param len The length of the resulting vector - * @returns The lengthened vector - */ -export declare function setLength(a: Vec3, len: number, dst?: Vec3): Vec3; -/** - * Ensure a vector is not longer than a max length - * - * @param a The vec3 to limit - * @param maxLen The longest length of the resulting vector - * @returns The vector, shortened to maxLen if it's too long - */ -export declare function truncate(a: Vec3, maxLen: number, dst?: Vec3): Vec3; -/** - * Return the vector exactly between 2 endpoint vectors - * - * @param a Endpoint 1 - * @param b Endpoint 2 - * @returns The vector exactly residing between endpoints 1 and 2 - */ -export declare function midpoint(a: Vec3, b: Vec3, dst?: Vec3): Vec3; diff --git a/dist/2.x/vec3.d.ts b/dist/2.x/vec3.d.ts deleted file mode 100644 index 7d21ca3..0000000 --- a/dist/2.x/vec3.d.ts +++ /dev/null @@ -1,43 +0,0 @@ -/** - * A JavaScript array with 3 values, Float32Array with 3 values, or a Float64Array with 3 values. - * When created by the library will create the default type which is `Float32Array` - * but can be set by calling {@link vec3.setDefaultType}. - */ -export type Vec3 = number[] | Float32Array | Float64Array; -/** - * - * Vec3 math functions. - * - * Almost all functions take an optional `dst` argument. If it is not passed in the - * functions will create a new `Vec3`. In other words you can do this - * - * const v = vec3.cross(v1, v2); // Creates a new Vec3 with the cross product of v1 x v2. - * - * or - * - * const v = vec3.create(); - * vec3.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v - * - * The first style is often easier but depending on where it's used it generates garbage where - * as there is almost never allocation with the second style. - * - * It is always safe to pass any vector as the destination. So for example - * - * vec3.cross(v1, v2, v1); // Puts the cross product of v1 x v2 in v1 - * - */ -export declare let VecType: new (n: number) => Vec3; -/** - * Sets the type this library creates for a Vec3 - * @param ctor - the constructor for the type. Either `Float32Array`, `Float64Array`, or `Array` - * @returns previous constructor for Vec3 - */ -export declare function setDefaultType(ctor: new (n: number) => Vec3): new (n: number) => Vec3; -/** - * Creates a vec3; may be called with x, y, z to set initial values. - * @param x - Initial x value. - * @param y - Initial y value. - * @param z - Initial z value. - * @returns the created vector - */ -export declare function create(x?: number, y?: number, z?: number): Vec3; diff --git a/dist/2.x/vec4-impl.d.ts b/dist/2.x/vec4-impl.d.ts deleted file mode 100644 index e6df561..0000000 --- a/dist/2.x/vec4-impl.d.ts +++ /dev/null @@ -1,345 +0,0 @@ -import { Vec4, create, setDefaultType } from './vec4'; -import { Mat4 } from './mat4'; -export default Vec4; -export { create, setDefaultType }; -/** - * Creates a vec4; may be called with x, y, z to set initial values. (same as create) - * @param x - Initial x value. - * @param y - Initial y value. - * @param z - Initial z value. - * @param z - Initial w value. - * @returns the created vector - */ -export declare const fromValues: typeof create; -/** - * Sets the values of a Vec4 - * Also see {@link vec4.create} and {@link vec4.copy} - * - * @param x first value - * @param y second value - * @param z third value - * @param w fourth value - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector with its elements set. - */ -export declare function set(x: number, y: number, z: number, w: number, dst?: Vec4): Vec4; -/** - * Applies Math.ceil to each element of vector - * @param v - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector that is the ceil of each element of v. - */ -export declare function ceil(v: Vec4, dst?: Vec4): Vec4; -/** - * Applies Math.floor to each element of vector - * @param v - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector that is the floor of each element of v. - */ -export declare function floor(v: Vec4, dst?: Vec4): Vec4; -/** - * Applies Math.round to each element of vector - * @param v - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector that is the round of each element of v. - */ -export declare function round(v: Vec4, dst?: Vec4): Vec4; -/** - * Clamp each element of vector between min and max - * @param v - Operand vector. - * @param max - Min value, default 0 - * @param min - Max value, default 1 - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector that the clamped value of each element of v. - */ -export declare function clamp(v: Vec4, min?: number, max?: number, dst?: Vec4): Vec4; -/** - * Adds two vectors; assumes a and b have the same dimension. - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector that is the sum of a and b. - */ -export declare function add(a: Vec4, b: Vec4, dst?: Vec4): Vec4; -/** - * Adds two vectors, scaling the 2nd; assumes a and b have the same dimension. - * @param a - Operand vector. - * @param b - Operand vector. - * @param scale - Amount to scale b - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector that is the sum of a + b * scale. - */ -export declare function addScaled(a: Vec4, b: Vec4, scale: number, dst?: Vec4): Vec4; -/** - * Subtracts two vectors. - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector that is the difference of a and b. - */ -export declare function subtract(a: Vec4, b: Vec4, dst?: Vec4): Vec4; -/** - * Subtracts two vectors. - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector that is the difference of a and b. - */ -export declare const sub: typeof subtract; -/** - * Check if 2 vectors are approximately equal - * @param a - Operand vector. - * @param b - Operand vector. - * @returns true if vectors are approximately equal - */ -export declare function equalsApproximately(a: Vec4, b: Vec4): boolean; -/** - * Check if 2 vectors are exactly equal - * @param a - Operand vector. - * @param b - Operand vector. - * @returns true if vectors are exactly equal - */ -export declare function equals(a: Vec4, b: Vec4): boolean; -/** - * Performs linear interpolation on two vectors. - * Given vectors a and b and interpolation coefficient t, returns - * a + t * (b - a). - * @param a - Operand vector. - * @param b - Operand vector. - * @param t - Interpolation coefficient. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The linear interpolated result. - */ -export declare function lerp(a: Vec4, b: Vec4, t: number, dst?: Vec4): Vec4; -/** - * Performs linear interpolation on two vectors. - * Given vectors a and b and interpolation coefficient vector t, returns - * a + t * (b - a). - * @param a - Operand vector. - * @param b - Operand vector. - * @param t - Interpolation coefficients vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns the linear interpolated result. - */ -export declare function lerpV(a: Vec4, b: Vec4, t: Vec4, dst?: Vec4): Vec4; -/** - * Return max values of two vectors. - * Given vectors a and b returns - * [max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])]. - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The max components vector. - */ -export declare function max(a: Vec4, b: Vec4, dst?: Vec4): Vec4; -/** - * Return min values of two vectors. - * Given vectors a and b returns - * [min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])]. - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The min components vector. - */ -export declare function min(a: Vec4, b: Vec4, dst?: Vec4): Vec4; -/** - * Multiplies a vector by a scalar. - * @param v - The vector. - * @param k - The scalar. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The scaled vector. - */ -export declare function mulScalar(v: Vec4, k: number, dst?: Vec4): Vec4; -/** - * Multiplies a vector by a scalar. (same as mulScalar) - * @param v - The vector. - * @param k - The scalar. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The scaled vector. - */ -export declare const scale: typeof mulScalar; -/** - * Divides a vector by a scalar. - * @param v - The vector. - * @param k - The scalar. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The scaled vector. - */ -export declare function divScalar(v: Vec4, k: number, dst?: Vec4): Vec4; -/** - * Inverse a vector. - * @param v - The vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The inverted vector. - */ -export declare function inverse(v: Vec4, dst?: Vec4): Vec4; -/** - * Invert a vector. (same as inverse) - * @param v - The vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The inverted vector. - */ -export declare const invert: typeof inverse; -/** - * Computes the dot product of two vectors - * @param a - Operand vector. - * @param b - Operand vector. - * @returns dot product - */ -export declare function dot(a: Vec4, b: Vec4): number; -/** - * Computes the length of vector - * @param v - vector. - * @returns length of vector. - */ -export declare function length(v: Vec4): number; -/** - * Computes the length of vector (same as length) - * @param v - vector. - * @returns length of vector. - */ -export declare const len: typeof length; -/** - * Computes the square of the length of vector - * @param v - vector. - * @returns square of the length of vector. - */ -export declare function lengthSq(v: Vec4): number; -/** - * Computes the square of the length of vector (same as lengthSq) - * @param v - vector. - * @returns square of the length of vector. - */ -export declare const lenSq: typeof lengthSq; -/** - * Computes the distance between 2 points - * @param a - vector. - * @param b - vector. - * @returns distance between a and b - */ -export declare function distance(a: Vec4, b: Vec4): number; -/** - * Computes the distance between 2 points (same as distance) - * @param a - vector. - * @param b - vector. - * @returns distance between a and b - */ -export declare const dist: typeof distance; -/** - * Computes the square of the distance between 2 points - * @param a - vector. - * @param b - vector. - * @returns square of the distance between a and b - */ -export declare function distanceSq(a: Vec4, b: Vec4): number; -/** - * Computes the square of the distance between 2 points (same as distanceSq) - * @param a - vector. - * @param b - vector. - * @returns square of the distance between a and b - */ -export declare const distSq: typeof distanceSq; -/** - * Divides a vector by its Euclidean length and returns the quotient. - * @param v - The vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The normalized vector. - */ -export declare function normalize(v: Vec4, dst?: Vec4): Vec4; -/** - * Negates a vector. - * @param v - The vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns -v. - */ -export declare function negate(v: Vec4, dst?: Vec4): Vec4; -/** - * Copies a vector. (same as {@link vec4.clone}) - * Also see {@link vec4.create} and {@link vec4.set} - * @param v - The vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A copy of v. - */ -export declare function copy(v: Vec4, dst?: Vec4): Vec4; -/** - * Clones a vector. (same as {@link vec4.copy}) - * Also see {@link vec4.create} and {@link vec4.set} - * @param v - The vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A copy of v. - */ -export declare const clone: typeof copy; -/** - * Multiplies a vector by another vector (component-wise); assumes a and - * b have the same length. - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The vector of products of entries of a and b. - */ -export declare function multiply(a: Vec4, b: Vec4, dst?: Vec4): Vec4; -/** - * Multiplies a vector by another vector (component-wise); assumes a and - * b have the same length. (same as mul) - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The vector of products of entries of a and b. - */ -export declare const mul: typeof multiply; -/** - * Divides a vector by another vector (component-wise); assumes a and - * b have the same length. - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The vector of quotients of entries of a and b. - */ -export declare function divide(a: Vec4, b: Vec4, dst?: Vec4): Vec4; -/** - * Divides a vector by another vector (component-wise); assumes a and - * b have the same length. (same as divide) - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The vector of quotients of entries of a and b. - */ -export declare const div: typeof divide; -/** - * Zero's a vector - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The zeroed vector. - */ -export declare function zero(dst?: Vec4): Vec4; -/** - * transform vec4 by 4x4 matrix - * @param v - the vector - * @param m - The matrix. - * @param dst - optional vec4 to store result. If not passed a new one is created. - * @returns the transformed vector - */ -export declare function transformMat4(v: Vec4, m: Mat4, dst?: Vec4): Vec4; -/** - * Treat a 4D vector as a direction and set it's length - * - * @param a The vec4 to lengthen - * @param len The length of the resulting vector - * @returns The lengthened vector - */ -export declare function setLength(a: Vec4, len: number, dst?: Vec4): Vec4; -/** - * Ensure a vector is not longer than a max length - * - * @param a The vec4 to limit - * @param maxLen The longest length of the resulting vector - * @returns The vector, shortened to maxLen if it's too long - */ -export declare function truncate(a: Vec4, maxLen: number, dst?: Vec4): Vec4; -/** - * Return the vector exactly between 2 endpoint vectors - * - * @param a Endpoint 1 - * @param b Endpoint 2 - * @returns The vector exactly residing between endpoints 1 and 2 - */ -export declare function midpoint(a: Vec4, b: Vec4, dst?: Vec4): Vec4; diff --git a/dist/2.x/vec4.d.ts b/dist/2.x/vec4.d.ts deleted file mode 100644 index 09a3f29..0000000 --- a/dist/2.x/vec4.d.ts +++ /dev/null @@ -1,44 +0,0 @@ -/** - * A JavaScript array with 4 values, Float32Array with 4 values, or a Float64Array with 4 values. - * When created by the library will create the default type which is `Float32Array` - * but can be set by calling {@link vec4.setDefaultType}. - */ -export type Vec4 = number[] | Float32Array | Float64Array; -/** - * - * Vec4 math functions. - * - * Almost all functions take an optional `dst` argument. If it is not passed in the - * functions will create a new `Vec4`. In other words you can do this - * - * const v = vec4.cross(v1, v2); // Creates a new Vec4 with the cross product of v1 x v2. - * - * or - * - * const v = vec4.create(); - * vec4.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v - * - * The first style is often easier but depending on where it's used it generates garbage where - * as there is almost never allocation with the second style. - * - * It is always safe to pass any vector as the destination. So for example - * - * vec4.cross(v1, v2, v1); // Puts the cross product of v1 x v2 in v1 - * - */ -export declare let VecType: new (n: number) => Vec4; -/** - * Sets the type this library creates for a Vec4 - * @param ctor - the constructor for the type. Either `Float32Array`, `Float64Array`, or `Array` - * @returns previous constructor for Vec4 - */ -export declare function setDefaultType(ctor: new (n: number) => Vec4): new (n: number) => Vec4; -/** - * Creates a vec4; may be called with x, y, z to set initial values. - * @param x - Initial x value. - * @param y - Initial y value. - * @param z - Initial z value. - * @param w - Initial w value. - * @returns the created vector - */ -export declare function create(x?: number, y?: number, z?: number, w?: number): Vec4; diff --git a/dist/2.x/wgpu-matrix.d.ts b/dist/2.x/wgpu-matrix.d.ts deleted file mode 100644 index 1eea4c0..0000000 --- a/dist/2.x/wgpu-matrix.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -import Mat3, * as mat3 from './mat3-impl'; -import Mat4, * as mat4 from './mat4-impl'; -import Quat, * as quat from './quat-impl'; -import Vec2, * as vec2 from './vec2-impl'; -import Vec3, * as vec3 from './vec3-impl'; -import Vec4, * as vec4 from './vec4-impl'; -import * as utils from './utils'; -/** - * Sets the type this library creates for all types - * - * example: - * - * ``` - * setDefaultType(Float64Array); - * ``` - * - * @param ctor - the constructor for the type. Either `Float32Array`, `Float64Array`, or `Array` - */ -export declare function setDefaultType(ctor: new (n: number) => Float32Array | Float64Array | number[]): void; -export { Mat3, mat3, Mat4, mat4, Quat, quat, utils, Vec2, vec2, Vec3, vec3, Vec4, vec4, }; diff --git a/dist/2.x/wgpu-matrix.js.map b/dist/2.x/wgpu-matrix.js.map deleted file mode 100644 index 3c9a94e..0000000 --- a/dist/2.x/wgpu-matrix.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"wgpu-matrix.js","sources":["../../../src/utils.ts","../../../src/vec2.ts","../../../src/vec3.ts","../../../src/vec2-impl.ts","../../../src/mat3-impl.ts","../../../src/vec3-impl.ts","../../../src/mat4-impl.ts","../../../src/quat.ts","../../../src/quat-impl.ts","../../../src/vec4.ts","../../../src/vec4-impl.ts","../../../src/wgpu-matrix.ts"],"sourcesContent":["/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\n\nexport let EPSILON = 0.000001;\n\n/**\n * Set the value for EPSILON for various checks\n * @param v - Value to use for EPSILON.\n * @returns previous value of EPSILON;\n */\nexport function setEpsilon(v: number): number {\n const old = EPSILON;\n EPSILON = v;\n return old;\n}\n\n/**\n * Convert degrees to radians\n * @param degrees - Angle in degrees\n * @returns angle converted to radians\n */\nexport function degToRad(degrees: number): number {\n return degrees * Math.PI / 180;\n}\n\n/**\n * Convert radians to degrees\n * @param radians - Angle in radians\n * @returns angle converted to degrees\n */\nexport function radToDeg(radians: number): number {\n return radians * 180 / Math.PI;\n}\n\n/**\n * Lerps between a and b via t\n * @param a - starting value\n * @param b - ending value\n * @param t - value where 0 = a and 1 = b\n * @returns a + (b - a) * t\n */\nexport function lerp(a: number, b: number, t: number): number {\n return a + (b - a) * t;\n}\n\n/**\n * Compute the opposite of lerp. Given a and b and a value between\n * a and b returns a value between 0 and 1. 0 if a, 1 if b.\n * Note: no clamping is done.\n * @param a - start value\n * @param b - end value\n * @param v - value between a and b\n * @returns (v - a) / (b - a)\n */\nexport function inverseLerp(a: number, b: number, v: number): number {\n const d = b - a;\n return (Math.abs(b - a) < EPSILON)\n ? a\n : (v - a) / d;\n}\n\n/**\n * Compute the euclidean modulo\n *\n * ```\n * // table for n / 3\n * -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5 <- n\n * ------------------------------------\n * -2 -1 -0 -2 -1 0, 1, 2, 0, 1, 2 <- n % 3\n * 1 2 0 1 2 0, 1, 2, 0, 1, 2 <- euclideanModule(n, 3)\n * ```\n *\n * @param n - dividend\n * @param m - divisor\n * @returns the euclidean modulo of n / m\n */\nexport function euclideanModulo(n: number, m: number) {\n return ((n % m) + m) % m;\n}","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\n\n/**\n * A JavaScript array with 2 values, Float32Array with 2 values, or a Float64Array with 2 values.\n * When created by the library will create the default type which is `Float32Array`\n * but can be set by calling {@link vec2.setDefaultType}.\n */\nexport type Vec2 = number[] | Float32Array | Float64Array;\n\n/**\n *\n * Vec2 math functions.\n *\n * Almost all functions take an optional `dst` argument. If it is not passed in the\n * functions will create a new Vec2. In other words you can do this\n *\n * const v = vec2.cross(v1, v2); // Creates a new Vec2 with the cross product of v1 x v2.\n *\n * or\n *\n * const v = vec2.create();\n * vec2.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v\n *\n * The first style is often easier but depending on where it's used it generates garbage where\n * as there is almost never allocation with the second style.\n *\n * It is always safe to pass any vector as the destination. So for example\n *\n * vec2.cross(v1, v2, v1); // Puts the cross product of v1 x v2 in v1\n *\n */\n\nexport let VecType: new (n: number) => Vec2 = Float32Array;\n\n/**\n * Sets the type this library creates for a Vec2\n * @param ctor - the constructor for the type. Either `Float32Array`, `Float64Array`, or `Array`\n * @returns previous constructor for Vec2\n */\nexport function setDefaultType(ctor: new (n: number) => Vec2) {\n const oldType = VecType;\n VecType = ctor;\n return oldType;\n}\n\n/**\n * Creates a Vec2; may be called with x, y, z to set initial values.\n *\n * Note: Since passing in a raw JavaScript array\n * is valid in all circumstances, if you want to\n * force a JavaScript array into a Vec2's specified type\n * it would be faster to use\n *\n * ```\n * const v = vec2.clone(someJSArray);\n * ```\n *\n * Note: a consequence of the implementation is if your Vec2Type = `Array`\n * instead of `Float32Array` or `Float64Array` then any values you\n * don't pass in will be undefined. Usually this is not an issue since\n * (a) using `Array` is rare and (b) using `vec2.create` is usually used\n * to create a Vec2 to be filled out as in\n *\n * ```\n * const sum = vec2.create();\n * vec2.add(v1, v2, sum);\n * ```\n *\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @returns the created vector\n */\nexport function create(x = 0, y = 0): Vec2 {\n const dst = new VecType(2);\n if (x !== undefined) {\n dst[0] = x;\n if (y !== undefined) {\n dst[1] = y;\n }\n }\n return dst;\n}\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\n\n/**\n * A JavaScript array with 3 values, Float32Array with 3 values, or a Float64Array with 3 values.\n * When created by the library will create the default type which is `Float32Array`\n * but can be set by calling {@link vec3.setDefaultType}.\n */\nexport type Vec3 = number[] | Float32Array | Float64Array;\n\n/**\n *\n * Vec3 math functions.\n *\n * Almost all functions take an optional `dst` argument. If it is not passed in the\n * functions will create a new `Vec3`. In other words you can do this\n *\n * const v = vec3.cross(v1, v2); // Creates a new Vec3 with the cross product of v1 x v2.\n *\n * or\n *\n * const v = vec3.create();\n * vec3.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v\n *\n * The first style is often easier but depending on where it's used it generates garbage where\n * as there is almost never allocation with the second style.\n *\n * It is always safe to pass any vector as the destination. So for example\n *\n * vec3.cross(v1, v2, v1); // Puts the cross product of v1 x v2 in v1\n *\n */\n\nexport let VecType: new (n: number) => Vec3 = Float32Array;\n\n/**\n * Sets the type this library creates for a Vec3\n * @param ctor - the constructor for the type. Either `Float32Array`, `Float64Array`, or `Array`\n * @returns previous constructor for Vec3\n */\nexport function setDefaultType(ctor: new (n: number) => Vec3) {\n const oldType = VecType;\n VecType = ctor;\n return oldType;\n}\n\n/**\n * Creates a vec3; may be called with x, y, z to set initial values.\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @returns the created vector\n */\nexport function create(x?: number, y?: number, z?: number): Vec3 {\n const dst = new VecType(3);\n if (x !== undefined) {\n dst[0] = x;\n if (y !== undefined) {\n dst[1] = y;\n if (z !== undefined) {\n dst[2] = z;\n }\n }\n }\n return dst;\n}","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport * as utils from './utils.js';\nimport { Mat3 } from './mat3';\nimport { Mat4 } from './mat4';\nimport { Vec2, create, setDefaultType, VecType } from './vec2';\nimport { Vec3, VecType as Vec3Type } from './vec3';\n\nexport default Vec2;\nexport { create, setDefaultType };\n\n/**\n * Creates a Vec2; may be called with x, y, z to set initial values. (same as create)\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @returns the created vector\n */\nexport const fromValues = create;\n\n/**\n * Sets the values of a Vec2\n * Also see {@link vec2.create} and {@link vec2.copy}\n *\n * @param x first value\n * @param y second value\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector with its elements set.\n */\nexport function set(x: number, y: number, dst?: Vec2) {\n dst = dst || new VecType(2);\n\n dst[0] = x;\n dst[1] = y;\n\n return dst;\n}\n\n/**\n * Applies Math.ceil to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the ceil of each element of v.\n */\nexport function ceil(v: Vec2, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = Math.ceil(v[0]);\n dst[1] = Math.ceil(v[1]);\n\n return dst;\n}\n\n/**\n * Applies Math.floor to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the floor of each element of v.\n */\nexport function floor(v: Vec2, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = Math.floor(v[0]);\n dst[1] = Math.floor(v[1]);\n\n return dst;\n}\n\n/**\n * Applies Math.round to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the round of each element of v.\n */\nexport function round(v: Vec2, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = Math.round(v[0]);\n dst[1] = Math.round(v[1]);\n\n return dst;\n}\n\n/**\n * Clamp each element of vector between min and max\n * @param v - Operand vector.\n * @param max - Min value, default 0\n * @param min - Max value, default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that the clamped value of each element of v.\n */\nexport function clamp(v: Vec2, min = 0, max = 1, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = Math.min(max, Math.max(min, v[0]));\n dst[1] = Math.min(max, Math.max(min, v[1]));\n\n return dst;\n}\n\n/**\n * Adds two vectors; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a and b.\n */\nexport function add(a: Vec2, b: Vec2, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = a[0] + b[0];\n dst[1] = a[1] + b[1];\n\n return dst;\n}\n\n/**\n * Adds two vectors, scaling the 2nd; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param scale - Amount to scale b\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a + b * scale.\n */\nexport function addScaled(a: Vec2, b: Vec2, scale: number, dst?: Vec2) {\n dst = dst || new VecType(2);\n\n dst[0] = a[0] + b[0] * scale;\n dst[1] = a[1] + b[1] * scale;\n\n return dst;\n}\n\n/**\n * Returns the angle in radians between two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns The angle in radians between the 2 vectors.\n */\nexport function angle(a: Vec2, b: Vec2): number {\n const ax = a[0];\n const ay = a[1];\n const bx = b[0];\n const by = b[1];\n const mag1 = Math.sqrt(ax * ax + ay * ay);\n const mag2 = Math.sqrt(bx * bx + by * by);\n const mag = mag1 * mag2;\n const cosine = mag && dot(a, b) / mag;\n return Math.acos(cosine);\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nexport function subtract(a: Vec2, b: Vec2, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = a[0] - b[0];\n dst[1] = a[1] - b[1];\n\n return dst;\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nexport const sub = subtract;\n\n/**\n * Check if 2 vectors are approximately equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are approximately equal\n */\nexport function equalsApproximately(a: Vec2, b: Vec2): boolean {\n return Math.abs(a[0] - b[0]) < utils.EPSILON &&\n Math.abs(a[1] - b[1]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 vectors are exactly equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are exactly equal\n */\nexport function equals(a: Vec2, b: Vec2): boolean {\n return a[0] === b[0] && a[1] === b[1];\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficient.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The linear interpolated result.\n */\nexport function lerp(a: Vec2, b: Vec2, t: number, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = a[0] + t * (b[0] - a[0]);\n dst[1] = a[1] + t * (b[1] - a[1]);\n\n return dst;\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient vector t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficients vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns the linear interpolated result.\n */\nexport function lerpV(a: Vec2, b: Vec2, t: Vec2, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = a[0] + t[0] * (b[0] - a[0]);\n dst[1] = a[1] + t[1] * (b[1] - a[1]);\n\n return dst;\n}\n\n/**\n * Return max values of two vectors.\n * Given vectors a and b returns\n * [max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The max components vector.\n */\nexport function max(a: Vec2, b: Vec2, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = Math.max(a[0], b[0]);\n dst[1] = Math.max(a[1], b[1]);\n\n return dst;\n}\n\n/**\n * Return min values of two vectors.\n * Given vectors a and b returns\n * [min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The min components vector.\n */\nexport function min(a: Vec2, b: Vec2, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = Math.min(a[0], b[0]);\n dst[1] = Math.min(a[1], b[1]);\n\n return dst;\n}\n\n/**\n * Multiplies a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nexport function mulScalar(v: Vec2, k: number, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = v[0] * k;\n dst[1] = v[1] * k;\n\n return dst;\n}\n\n/**\n * Multiplies a vector by a scalar. (same as mulScalar)\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nexport const scale = mulScalar;\n\n/**\n * Divides a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nexport function divScalar(v: Vec2, k: number, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = v[0] / k;\n dst[1] = v[1] / k;\n\n return dst;\n}\n\n/**\n * Inverse a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nexport function inverse(v: Vec2, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = 1 / v[0];\n dst[1] = 1 / v[1];\n\n return dst;\n}\n\n/**\n * Invert a vector. (same as inverse)\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nexport const invert = inverse;\n\n/**\n * Computes the cross product of two vectors; assumes both vectors have\n * three entries.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of a cross b.\n */\nexport function cross(a: Vec2, b: Vec2, dst?: Vec3): Vec3 {\n dst = dst || new Vec3Type(3);\n const z = a[0] * b[1] - a[1] * b[0];\n dst[0] = 0;\n dst[1] = 0;\n dst[2] = z;\n\n return dst;\n}\n\n/**\n * Computes the dot product of two vectors; assumes both vectors have\n * three entries.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns dot product\n */\nexport function dot(a: Vec2, b: Vec2): number {\n return a[0] * b[0] + a[1] * b[1];\n}\n\n/**\n * Computes the length of vector\n * @param v - vector.\n * @returns length of vector.\n */\nexport function length(v: Vec2): number {\n const v0 = v[0];\n const v1 = v[1];\n return Math.sqrt(v0 * v0 + v1 * v1);\n}\n\n/**\n * Computes the length of vector (same as length)\n * @param v - vector.\n * @returns length of vector.\n */\nexport const len = length;\n\n/**\n * Computes the square of the length of vector\n * @param v - vector.\n * @returns square of the length of vector.\n */\nexport function lengthSq(v: Vec2): number {\n const v0 = v[0];\n const v1 = v[1];\n return v0 * v0 + v1 * v1;\n}\n\n/**\n * Computes the square of the length of vector (same as lengthSq)\n * @param v - vector.\n * @returns square of the length of vector.\n */\nexport const lenSq = lengthSq;\n\n/**\n * Computes the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nexport function distance(a: Vec2, b: Vec2): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n return Math.sqrt(dx * dx + dy * dy);\n}\n\n/**\n * Computes the distance between 2 points (same as distance)\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nexport const dist = distance;\n\n/**\n * Computes the square of the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nexport function distanceSq(a: Vec2, b: Vec2): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n return dx * dx + dy * dy;\n}\n\n/**\n * Computes the square of the distance between 2 points (same as distanceSq)\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nexport const distSq = distanceSq;\n\n/**\n * Divides a vector by its Euclidean length and returns the quotient.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The normalized vector.\n */\nexport function normalize(v: Vec2, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n const v0 = v[0];\n const v1 = v[1];\n const len = Math.sqrt(v0 * v0 + v1 * v1);\n\n if (len > 0.00001) {\n dst[0] = v0 / len;\n dst[1] = v1 / len;\n } else {\n dst[0] = 0;\n dst[1] = 0;\n }\n\n return dst;\n}\n\n/**\n * Negates a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns -v.\n */\nexport function negate(v: Vec2, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = -v[0];\n dst[1] = -v[1];\n\n return dst;\n}\n\n/**\n * Copies a vector. (same as {@link vec2.clone})\n * Also see {@link vec2.create} and {@link vec2.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nexport function copy(v: Vec2, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = v[0];\n dst[1] = v[1];\n\n return dst;\n}\n\n/**\n * Clones a vector. (same as {@link vec2.copy})\n * Also see {@link vec2.create} and {@link vec2.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nexport const clone = copy;\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nexport function multiply(a: Vec2, b: Vec2, dst?: Vec2) {\n dst = dst || new VecType(2);\n\n dst[0] = a[0] * b[0];\n dst[1] = a[1] * b[1];\n\n return dst;\n}\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as mul)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nexport const mul = multiply;\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nexport function divide(a: Vec2, b: Vec2, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = a[0] / b[0];\n dst[1] = a[1] / b[1];\n\n return dst;\n}\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as divide)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nexport const div = divide;\n\n/**\n * Creates a random unit vector * scale\n * @param scale - Default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The random vector.\n */\nexport function random(scale = 1, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n const angle = Math.random() * 2 * Math.PI;\n dst[0] = Math.cos(angle) * scale;\n dst[1] = Math.sin(angle) * scale;\n\n return dst;\n}\n\n/**\n * Zero's a vector\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The zeroed vector.\n */\nexport function zero(dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = 0;\n dst[1] = 0;\n\n return dst;\n}\n\n\n/**\n * transform Vec2 by 4x4 matrix\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional Vec2 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nexport function transformMat4(v: Vec2, m: Mat4, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n const x = v[0];\n const y = v[1];\n\n dst[0] = x * m[0] + y * m[4] + m[12];\n dst[1] = x * m[1] + y * m[5] + m[13];\n\n return dst;\n}\n\n/**\n * Transforms vec4 by 3x3 matrix\n *\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional Vec2 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nexport function transformMat3(v: Vec2, m: Mat3, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n const x = v[0];\n const y = v[1];\n\n dst[0] = m[0] * x + m[4] * y + m[8];\n dst[1] = m[1] * x + m[5] * y + m[9];\n\n return dst;\n}\n\n/**\n * Rotate a 2D vector\n *\n * @param a The vec2 point to rotate\n * @param b The origin of the rotation\n * @param rad The angle of rotation in radians\n * @returns the rotated vector\n */\nexport function rotate(a: Vec2, b: Vec2, rad: number, dst?: Vec2) {\n dst = dst || new VecType(2);\n\n // Translate point to the origin\n const p0 = a[0] - b[0];\n const p1 = a[1] - b[1];\n const sinC = Math.sin(rad);\n const cosC = Math.cos(rad);\n\n //perform rotation and translate to correct position\n dst[0] = p0 * cosC - p1 * sinC + b[0];\n dst[1] = p0 * sinC + p1 * cosC + b[1];\n\n return dst;\n}\n\n/**\n * Treat a 2D vector as a direction and set it's length\n *\n * @param a The vec2 to lengthen\n * @param len The length of the resulting vector\n * @returns The lengthened vector\n */\nexport function setLength(a: Vec2, len: number, dst?: Vec2) {\n dst = dst || new VecType(2);\n normalize(a, dst);\n return mulScalar(dst, len, dst);\n}\n\n/**\n * Ensure a vector is not longer than a max length\n *\n * @param a The vec2 to limit\n * @param maxLen The longest length of the resulting vector\n * @returns The vector, shortened to maxLen if it's too long\n */\nexport function truncate(a: Vec2, maxLen: number, dst?: Vec2) {\n dst = dst || new VecType(2);\n\n if (length(a) > maxLen) {\n return setLength(a, maxLen, dst);\n }\n\n return copy(a, dst);\n}\n\n/**\n * Return the vector exactly between 2 endpoint vectors\n *\n * @param a Endpoint 1\n * @param b Endpoint 2\n * @returns The vector exactly residing between endpoints 1 and 2\n */\nexport function midpoint(a: Vec2, b: Vec2, dst?: Vec2) {\n dst = dst || new VecType(2);\n return lerp(a, b, 0.5, dst);\n}\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\n\nimport * as utils from './utils.js';\nimport { Quat } from './quat';\nimport { Mat3 } from './mat3';\nimport { Mat4 } from './mat4';\nimport Vec2, * as vec2 from './vec2-impl';\n\nexport default Mat3;\n\nexport type Mat3LikeCtor = new (n: number) => Mat3;\n\n/**\n * 3x3 Matrix math math functions.\n *\n * Almost all functions take an optional `dst` argument. If it is not passed in the\n * functions will create a new matrix. In other words you can do this\n *\n * const mat = mat3.translation([1, 2, 3]); // Creates a new translation matrix\n *\n * or\n *\n * const mat = mat3.create();\n * mat3.translation([1, 2, 3], mat); // Puts translation matrix in mat.\n *\n * The first style is often easier but depending on where it's used it generates garbage where\n * as there is almost never allocation with the second style.\n *\n * It is always save to pass any matrix as the destination. So for example\n *\n * const mat = mat3.identity();\n * const trans = mat3.translation([1, 2, 3]);\n * mat3.multiply(mat, trans, mat); // Multiplies mat * trans and puts result in mat.\n *\n */\nlet MatType: Mat3LikeCtor = Float32Array;\n\n// This mess is because with Mat3 we have 3 unused elements.\n// For Float32Array and Float64Array that's not an issue\n// but for Array it's troublesome\nconst ctorMap = new Map Mat3>([\n [Float32Array, () => new Float32Array(12)],\n [Float64Array, () => new Float64Array(12)],\n [Array, () => new Array(12).fill(0)],\n]);\nlet newMat3: () => Mat3 = ctorMap.get(Float32Array)!;\n\n/**\n * Sets the type this library creates for a Mat3\n * @param ctor - the constructor for the type. Either `Float32Array`, `Float64Array`, or `Array`\n * @returns previous constructor for Mat3\n */\nexport function setDefaultType(ctor: new (n: number) => Mat3) {\n const oldType = MatType;\n MatType = ctor;\n newMat3 = ctorMap.get(ctor)!;\n return oldType;\n}\n\n/**\n * Create a Mat3 from values\n *\n * Note: Since passing in a raw JavaScript array\n * is valid in all circumstances, if you want to\n * force a JavaScript array into a Mat3's specified type\n * it would be faster to use\n *\n * ```\n * const m = mat3.clone(someJSArray);\n * ```\n *\n * Note: a consequence of the implementation is if your Mat3Type = `Array`\n * instead of `Float32Array` or `Float64Array` then any values you\n * don't pass in will be undefined. Usually this is not an issue since\n * (a) using `Array` is rare and (b) using `mat3.create` is usually used\n * to create a Mat3 to be filled out as in\n *\n * ```\n * const m = mat3.create();\n * mat3.perspective(fov, aspect, near, far, m);\n * ```\n *\n * @param v0 - value for element 0\n * @param v1 - value for element 1\n * @param v2 - value for element 2\n * @param v3 - value for element 3\n * @param v4 - value for element 4\n * @param v5 - value for element 5\n * @param v6 - value for element 6\n * @param v7 - value for element 7\n * @param v8 - value for element 8\n * @returns matrix created from values.\n */\nexport function create(\n v0?: number, v1?: number, v2?: number,\n v3?: number, v4?: number, v5?: number,\n v6?: number, v7?: number, v8?: number): Mat3 {\n const dst = newMat3();\n // to make the array homogenous\n dst[3] = 0;\n dst[7] = 0;\n dst[11] = 0;\n\n if (v0 !== undefined) {\n dst[0] = v0;\n if (v1 !== undefined) {\n dst[1] = v1;\n if (v2 !== undefined) {\n dst[2] = v2;\n if (v3 !== undefined) {\n dst[4] = v3;\n if (v4 !== undefined) {\n dst[5] = v4;\n if (v5 !== undefined) {\n dst[6] = v5;\n if (v6 !== undefined) {\n dst[8] = v6;\n if (v7 !== undefined) {\n dst[9] = v7;\n if (v8 !== undefined) {\n dst[10] = v8;\n }\n }\n }\n }\n }\n }\n }\n }\n }\n\n return dst;\n}\n\n/**\n * Sets the values of a Mat3\n * Also see {@link mat3.create} and {@link mat3.copy}\n *\n * @param v0 - value for element 0\n * @param v1 - value for element 1\n * @param v2 - value for element 2\n * @param v3 - value for element 3\n * @param v4 - value for element 4\n * @param v5 - value for element 5\n * @param v6 - value for element 6\n * @param v7 - value for element 7\n * @param v8 - value for element 8\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat3 set from values.\n */\nexport function set(\n v0: number, v1: number, v2: number,\n v3: number, v4: number, v5: number,\n v6: number, v7: number, v8: number, dst?: Mat3) {\n dst = dst || newMat3();\n\n dst[0] = v0; dst[1] = v1; dst[ 2] = v2; dst[ 3] = 0;\n dst[4] = v3; dst[5] = v4; dst[ 6] = v5; dst[ 7] = 0;\n dst[8] = v6; dst[9] = v7; dst[10] = v8; dst[11] = 0;\n\n return dst;\n}\n\n/**\n * Creates a Mat3 from the upper left 3x3 part of a Mat4\n * @param m4 - source matrix\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat3 made from m4\n */\nexport function fromMat4(m4: Mat4, dst?: Mat3): Mat3 {\n dst = dst || newMat3();\n dst[0] = m4[0]; dst[1] = m4[1]; dst[ 2] = m4[ 2]; dst[ 3] = 0;\n dst[4] = m4[4]; dst[5] = m4[5]; dst[ 6] = m4[ 6]; dst[ 7] = 0;\n dst[8] = m4[8]; dst[9] = m4[9]; dst[10] = m4[10]; dst[11] = 0;\n return dst;\n}\n\n/**\n * Creates a Mat3 rotation matrix from a quaternion\n * @param q - quaternion to create matrix from\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat3 made from q\n */\nexport function fromQuat(q: Quat, dst?: Mat3): Mat3 {\n dst = dst || newMat3();\n\n const x = q[0]; const y = q[1]; const z = q[2]; const w = q[3];\n const x2 = x + x; const y2 = y + y; const z2 = z + z;\n\n const xx = x * x2;\n const yx = y * x2;\n const yy = y * y2;\n const zx = z * x2;\n const zy = z * y2;\n const zz = z * z2;\n const wx = w * x2;\n const wy = w * y2;\n const wz = w * z2;\n\n dst[ 0] = 1 - yy - zz; dst[ 1] = yx + wz; dst[ 2] = zx - wy; dst[ 3] = 0;\n dst[ 4] = yx - wz; dst[ 5] = 1 - xx - zz; dst[ 6] = zy + wx; dst[ 7] = 0;\n dst[ 8] = zx + wy; dst[ 9] = zy - wx; dst[10] = 1 - xx - yy; dst[11] = 0;\n\n return dst;\n}\n\n/**\n * Negates a matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns -m.\n */\nexport function negate(m: Mat3, dst?: Mat3): Mat3 {\n dst = dst || newMat3();\n\n dst[ 0] = -m[ 0]; dst[ 1] = -m[ 1]; dst[ 2] = -m[ 2];\n dst[ 4] = -m[ 4]; dst[ 5] = -m[ 5]; dst[ 6] = -m[ 6];\n dst[ 8] = -m[ 8]; dst[ 9] = -m[ 9]; dst[10] = -m[10];\n\n return dst;\n}\n\n/**\n * Copies a matrix. (same as {@link mat3.clone})\n * Also see {@link mat3.create} and {@link mat3.set}\n * @param m - The matrix.\n * @param dst - The matrix. If not passed a new one is created.\n * @returns A copy of m.\n */\nexport function copy(m: Mat3, dst?: Mat3): Mat3 {\n dst = dst || newMat3();\n\n dst[ 0] = m[ 0]; dst[ 1] = m[ 1]; dst[ 2] = m[ 2];\n dst[ 4] = m[ 4]; dst[ 5] = m[ 5]; dst[ 6] = m[ 6];\n dst[ 8] = m[ 8]; dst[ 9] = m[ 9]; dst[10] = m[10];\n\n return dst;\n}\n\n/**\n * Copies a matrix (same as {@link mat3.copy})\n * Also see {@link mat3.create} and {@link mat3.set}\n * @param m - The matrix.\n * @param dst - The matrix. If not passed a new one is created.\n * @returns A copy of m.\n */\nexport const clone = copy;\n\n/**\n * Check if 2 matrices are approximately equal\n * @param a Operand matrix.\n * @param b Operand matrix.\n * @returns true if matrices are approximately equal\n */\nexport function equalsApproximately(a: Mat3, b: Mat3): boolean {\n return Math.abs(a[ 0] - b[ 0]) < utils.EPSILON &&\n Math.abs(a[ 1] - b[ 1]) < utils.EPSILON &&\n Math.abs(a[ 2] - b[ 2]) < utils.EPSILON &&\n Math.abs(a[ 4] - b[ 4]) < utils.EPSILON &&\n Math.abs(a[ 5] - b[ 5]) < utils.EPSILON &&\n Math.abs(a[ 6] - b[ 6]) < utils.EPSILON &&\n Math.abs(a[ 8] - b[ 8]) < utils.EPSILON &&\n Math.abs(a[ 9] - b[ 9]) < utils.EPSILON &&\n Math.abs(a[10] - b[10]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 matrices are exactly equal\n * @param a Operand matrix.\n * @param b Operand matrix.\n * @returns true if matrices are exactly equal\n */\nexport function equals(a: Mat3, b: Mat3): boolean {\n return a[ 0] === b[ 0] &&\n a[ 1] === b[ 1] &&\n a[ 2] === b[ 2] &&\n a[ 4] === b[ 4] &&\n a[ 5] === b[ 5] &&\n a[ 6] === b[ 6] &&\n a[ 8] === b[ 8] &&\n a[ 9] === b[ 9] &&\n a[10] === b[10];\n}\n\n/**\n * Creates a 3-by-3 identity matrix.\n *\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns A 3-by-3 identity matrix.\n */\nexport function identity(dst?: Mat3): Mat3 {\n dst = dst || newMat3();\n\n dst[ 0] = 1; dst[ 1] = 0; dst[ 2] = 0;\n dst[ 4] = 0; dst[ 5] = 1; dst[ 6] = 0;\n dst[ 8] = 0; dst[ 9] = 0; dst[10] = 1;\n\n return dst;\n}\n\n/**\n * Takes the transpose of a matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The transpose of m.\n */\nexport function transpose(m: Mat3, dst?: Mat3): Mat3 {\n dst = dst || newMat3();\n if (dst === m) {\n let t: number;\n\n // 0 1 2\n // 4 5 6\n // 8 9 10\n\n t = m[1];\n m[1] = m[4];\n m[4] = t;\n\n t = m[2];\n m[2] = m[8];\n m[8] = t;\n\n t = m[6];\n m[6] = m[9];\n m[9] = t;\n\n return dst;\n }\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n\n dst[ 0] = m00; dst[ 1] = m10; dst[ 2] = m20;\n dst[ 4] = m01; dst[ 5] = m11; dst[ 6] = m21;\n dst[ 8] = m02; dst[ 9] = m12; dst[10] = m22;\n\n return dst;\n}\n\n/**\n * Computes the inverse of a 3-by-3 matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The inverse of m.\n */\nexport function inverse(m: Mat3, dst?: Mat3): Mat3 {\n dst = dst || newMat3();\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n\n const b01 = m22 * m11 - m12 * m21;\n const b11 = -m22 * m10 + m12 * m20;\n const b21 = m21 * m10 - m11 * m20;\n\n const invDet = 1 / (m00 * b01 + m01 * b11 + m02 * b21);\n\n dst[ 0] = b01 * invDet;\n dst[ 1] = (-m22 * m01 + m02 * m21) * invDet;\n dst[ 2] = ( m12 * m01 - m02 * m11) * invDet;\n dst[ 4] = b11 * invDet;\n dst[ 5] = ( m22 * m00 - m02 * m20) * invDet;\n dst[ 6] = (-m12 * m00 + m02 * m10) * invDet;\n dst[ 8] = b21 * invDet;\n dst[ 9] = (-m21 * m00 + m01 * m20) * invDet;\n dst[10] = ( m11 * m00 - m01 * m10) * invDet;\n\n return dst;\n}\n\n/**\n * Compute the determinant of a matrix\n * @param m - the matrix\n * @returns the determinant\n */\nexport function determinant(m: Mat3): number {\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n\n return m00 * (m11 * m22 - m21 * m12) -\n m10 * (m01 * m22 - m21 * m02) +\n m20 * (m01 * m12 - m11 * m02);\n}\n\n/**\n * Computes the inverse of a 3-by-3 matrix. (same as inverse)\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The inverse of m.\n */\nexport const invert = inverse;\n\n/**\n * Multiplies two 3-by-3 matrices with a on the left and b on the right\n * @param a - The matrix on the left.\n * @param b - The matrix on the right.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix product of a and b.\n */\nexport function multiply(a: Mat3, b: Mat3, dst?: Mat3): Mat3 {\n dst = dst || newMat3();\n\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a10 = a[ 4 + 0];\n const a11 = a[ 4 + 1];\n const a12 = a[ 4 + 2];\n const a20 = a[ 8 + 0];\n const a21 = a[ 8 + 1];\n const a22 = a[ 8 + 2];\n const b00 = b[0];\n const b01 = b[1];\n const b02 = b[2];\n const b10 = b[ 4 + 0];\n const b11 = b[ 4 + 1];\n const b12 = b[ 4 + 2];\n const b20 = b[ 8 + 0];\n const b21 = b[ 8 + 1];\n const b22 = b[ 8 + 2];\n\n dst[ 0] = a00 * b00 + a10 * b01 + a20 * b02;\n dst[ 1] = a01 * b00 + a11 * b01 + a21 * b02;\n dst[ 2] = a02 * b00 + a12 * b01 + a22 * b02;\n dst[ 4] = a00 * b10 + a10 * b11 + a20 * b12;\n dst[ 5] = a01 * b10 + a11 * b11 + a21 * b12;\n dst[ 6] = a02 * b10 + a12 * b11 + a22 * b12;\n dst[ 8] = a00 * b20 + a10 * b21 + a20 * b22;\n dst[ 9] = a01 * b20 + a11 * b21 + a21 * b22;\n dst[10] = a02 * b20 + a12 * b21 + a22 * b22;\n\n return dst;\n}\n\n/**\n * Multiplies two 3-by-3 matrices with a on the left and b on the right (same as multiply)\n * @param a - The matrix on the left.\n * @param b - The matrix on the right.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix product of a and b.\n */\nexport const mul = multiply;\n\n/**\n * Sets the translation component of a 3-by-3 matrix to the given\n * vector.\n * @param a - The matrix.\n * @param v - The vector.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix with translation set.\n */\nexport function setTranslation(a: Mat3, v: Vec2, dst?: Mat3): Mat3 {\n dst = dst || identity();\n if (a !== dst) {\n dst[ 0] = a[ 0];\n dst[ 1] = a[ 1];\n dst[ 2] = a[ 2];\n dst[ 4] = a[ 4];\n dst[ 5] = a[ 5];\n dst[ 6] = a[ 6];\n }\n dst[ 8] = v[0];\n dst[ 9] = v[1];\n dst[10] = 1;\n return dst;\n}\n\n/**\n * Returns the translation component of a 3-by-3 matrix as a vector with 3\n * entries.\n * @param m - The matrix.\n * @param dst - vector to hold result. If not passed a new one is created.\n * @returns The translation component of m.\n */\nexport function getTranslation(m: Mat3, dst?: Vec2): Vec2 {\n dst = dst || vec2.create();\n dst[0] = m[8];\n dst[1] = m[9];\n return dst;\n}\n\n/**\n * Returns an axis of a 3x3 matrix as a vector with 2 entries\n * @param m - The matrix.\n * @param axis - The axis 0 = x, 1 = y,\n * @returns The axis component of m.\n */\nexport function getAxis(m: Mat3, axis: number, dst?: Vec2): Vec2 {\n dst = dst || vec2.create();\n const off = axis * 4;\n dst[0] = m[off + 0];\n dst[1] = m[off + 1];\n return dst;\n}\n\n/**\n * Sets an axis of a 3x3 matrix as a vector with 2 entries\n * @param m - The matrix.\n * @param v - the axis vector\n * @param axis - The axis 0 = x, 1 = y;\n * @param dst - The matrix to set. If not passed a new one is created.\n * @returns The matrix with axis set.\n */\nexport function setAxis(m: Mat3, v: Vec2, axis: number, dst?: Mat3): Mat3 {\n if (dst !== m) {\n dst = copy(m, dst);\n }\n const off = axis * 4;\n dst[off + 0] = v[0];\n dst[off + 1] = v[1];\n return dst;\n}\n\n/**\n * Returns the scaling component of the matrix\n * @param m - The Matrix\n * @param dst - The vector to set. If not passed a new one is created.\n */\nexport function getScaling(m: Mat3, dst?: Vec2): Vec2 {\n dst = dst || vec2.create();\n\n const xx = m[0];\n const xy = m[1];\n const yx = m[4];\n const yy = m[5];\n\n dst[0] = Math.sqrt(xx * xx + xy * xy);\n dst[1] = Math.sqrt(yx * yx + yy * yy);\n\n return dst;\n}\n\n/**\n * Creates a 3-by-3 matrix which translates by the given vector v.\n * @param v - The vector by which to translate.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The translation matrix.\n */\nexport function translation(v: Vec2, dst?: Mat3): Mat3 {\n dst = dst || newMat3();\n\n dst[ 0] = 1; dst[ 1] = 0; dst[ 2] = 0;\n dst[ 4] = 0; dst[ 5] = 1; dst[ 6] = 0;\n dst[ 8] = v[0]; dst[ 9] = v[1]; dst[10] = 1;\n\n return dst;\n}\n\n/**\n * Translates the given 3-by-3 matrix by the given vector v.\n * @param m - The matrix.\n * @param v - The vector by which to translate.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The translated matrix.\n */\nexport function translate(m: Mat3, v: Vec2, dst?: Mat3): Mat3 {\n dst = dst || newMat3();\n\n const v0 = v[0];\n const v1 = v[1];\n\n const m00 = m[0];\n const m01 = m[1];\n const m02 = m[2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n\n if (m !== dst) {\n dst[ 0] = m00;\n dst[ 1] = m01;\n dst[ 2] = m02;\n dst[ 4] = m10;\n dst[ 5] = m11;\n dst[ 6] = m12;\n }\n\n dst[ 8] = m00 * v0 + m10 * v1 + m20;\n dst[ 9] = m01 * v0 + m11 * v1 + m21;\n dst[10] = m02 * v0 + m12 * v1 + m22;\n\n return dst;\n}\n\n/**\n * Creates a 3-by-3 matrix which rotates by the given angle.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotation matrix.\n */\nexport function rotation(angleInRadians: number, dst?: Mat3): Mat3 {\n dst = dst || newMat3();\n\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n dst[ 0] = c; dst[ 1] = s; dst[ 2] = 0;\n dst[ 4] = -s; dst[ 5] = c; dst[ 6] = 0;\n dst[ 8] = 0; dst[ 9] = 0; dst[10] = 1;\n\n return dst;\n}\n\n/**\n * Rotates the given 3-by-3 matrix by the given angle.\n * @param m - The matrix.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nexport function rotate(m: Mat3, angleInRadians: number, dst?: Mat3): Mat3 {\n dst = dst || newMat3();\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n dst[ 0] = c * m00 + s * m10;\n dst[ 1] = c * m01 + s * m11;\n dst[ 2] = c * m02 + s * m12;\n\n dst[ 4] = c * m10 - s * m00;\n dst[ 5] = c * m11 - s * m01;\n dst[ 6] = c * m12 - s * m02;\n\n\n if (m !== dst) {\n dst[ 8] = m[ 8];\n dst[ 9] = m[ 9];\n dst[10] = m[10];\n }\n\n return dst;\n}\n\n/**\n * Creates a 3-by-3 matrix which scales in each dimension by an amount given by\n * the corresponding entry in the given vector; assumes the vector has three\n * entries.\n * @param v - A vector of\n * 2 entries specifying the factor by which to scale in each dimension.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaling matrix.\n */\nexport function scaling(v: Vec2, dst?: Mat3): Mat3 {\n dst = dst || newMat3();\n\n dst[ 0] = v[0]; dst[ 1] = 0; dst[ 2] = 0;\n dst[ 4] = 0; dst[ 5] = v[1]; dst[ 6] = 0;\n dst[ 8] = 0; dst[ 9] = 0; dst[10] = 1;\n\n return dst;\n}\n\n/**\n * Scales the given 3-by-3 matrix in each dimension by an amount\n * given by the corresponding entry in the given vector; assumes the vector has\n * three entries.\n * @param m - The matrix to be modified.\n * @param v - A vector of 2 entries specifying the\n * factor by which to scale in each dimension.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaled matrix.\n */\nexport function scale(m: Mat3, v: Vec2, dst?: Mat3): Mat3 {\n dst = dst || newMat3();\n\n const v0 = v[0];\n const v1 = v[1];\n\n dst[ 0] = v0 * m[0 * 4 + 0];\n dst[ 1] = v0 * m[0 * 4 + 1];\n dst[ 2] = v0 * m[0 * 4 + 2];\n\n dst[ 4] = v1 * m[1 * 4 + 0];\n dst[ 5] = v1 * m[1 * 4 + 1];\n dst[ 6] = v1 * m[1 * 4 + 2];\n\n if (m !== dst) {\n dst[ 8] = m[ 8];\n dst[ 9] = m[ 9];\n dst[10] = m[10];\n }\n\n return dst;\n}\n\n/**\n * Creates a 3-by-3 matrix which scales uniformly in each dimension\n * @param s - Amount to scale\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaling matrix.\n */\nexport function uniformScaling(s: number, dst?: Mat3): Mat3 {\n dst = dst || newMat3();\n\n dst[ 0] = s; dst[ 1] = 0; dst[ 2] = 0;\n dst[ 4] = 0; dst[ 5] = s; dst[ 6] = 0;\n dst[ 8] = 0; dst[ 9] = 0; dst[10] = 1;\n\n return dst;\n}\n\n/**\n * Scales the given 3-by-3 matrix in each dimension by an amount\n * given.\n * @param m - The matrix to be modified.\n * @param s - Amount to scale.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaled matrix.\n */\nexport function uniformScale(m: Mat3, s: number, dst?: Mat3): Mat3 {\n dst = dst || newMat3();\n\n dst[ 0] = s * m[0 * 4 + 0];\n dst[ 1] = s * m[0 * 4 + 1];\n dst[ 2] = s * m[0 * 4 + 2];\n\n dst[ 4] = s * m[1 * 4 + 0];\n dst[ 5] = s * m[1 * 4 + 1];\n dst[ 6] = s * m[1 * 4 + 2];\n\n if (m !== dst) {\n dst[ 8] = m[ 8];\n dst[ 9] = m[ 9];\n dst[10] = m[10];\n }\n\n return dst;\n}\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport * as utils from './utils.js';\nimport { Vec3, create, setDefaultType, VecType } from './vec3';\nimport { Mat3 } from './mat3';\nimport { Mat4 } from './mat4';\nimport { Quat } from './quat';\n\nexport default Vec3;\nexport { create, setDefaultType };\n\n/**\n * Creates a vec3; may be called with x, y, z to set initial values. (same as create)\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @returns the created vector\n */\nexport const fromValues = create;\n\n/**\n * Sets the values of a Vec3\n * Also see {@link vec3.create} and {@link vec3.copy}\n *\n * @param x first value\n * @param y second value\n * @param z third value\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector with its elements set.\n */\nexport function set(x: number, y: number, z: number, dst?: Vec3) {\n dst = dst || new VecType(3);\n\n dst[0] = x;\n dst[1] = y;\n dst[2] = z;\n\n return dst;\n}\n\n/**\n * Applies Math.ceil to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the ceil of each element of v.\n */\nexport function ceil(v: Vec3, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = Math.ceil(v[0]);\n dst[1] = Math.ceil(v[1]);\n dst[2] = Math.ceil(v[2]);\n\n return dst;\n}\n\n/**\n * Applies Math.floor to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the floor of each element of v.\n */\nexport function floor(v: Vec3, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = Math.floor(v[0]);\n dst[1] = Math.floor(v[1]);\n dst[2] = Math.floor(v[2]);\n\n return dst;\n}\n\n/**\n * Applies Math.round to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the round of each element of v.\n */\nexport function round(v: Vec3, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = Math.round(v[0]);\n dst[1] = Math.round(v[1]);\n dst[2] = Math.round(v[2]);\n\n return dst;\n}\n\n/**\n * Clamp each element of vector between min and max\n * @param v - Operand vector.\n * @param max - Min value, default 0\n * @param min - Max value, default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that the clamped value of each element of v.\n */\nexport function clamp(v: Vec3, min = 0, max = 1, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = Math.min(max, Math.max(min, v[0]));\n dst[1] = Math.min(max, Math.max(min, v[1]));\n dst[2] = Math.min(max, Math.max(min, v[2]));\n\n return dst;\n}\n\n/**\n * Adds two vectors; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a and b.\n */\nexport function add(a: Vec3, b: Vec3, dst?: Vec3) {\n dst = dst || new VecType(3);\n\n dst[0] = a[0] + b[0];\n dst[1] = a[1] + b[1];\n dst[2] = a[2] + b[2];\n\n return dst;\n}\n\n/**\n * Adds two vectors, scaling the 2nd; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param scale - Amount to scale b\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a + b * scale.\n */\nexport function addScaled(a: Vec3, b: Vec3, scale: number, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = a[0] + b[0] * scale;\n dst[1] = a[1] + b[1] * scale;\n dst[2] = a[2] + b[2] * scale;\n\n return dst;\n}\n\n/**\n * Returns the angle in radians between two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns The angle in radians between the 2 vectors.\n */\nexport function angle(a: Vec3, b: Vec3): number {\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const bx = b[0];\n const by = b[1];\n const bz = b[2];\n const mag1 = Math.sqrt(ax * ax + ay * ay + az * az);\n const mag2 = Math.sqrt(bx * bx + by * by + bz * bz);\n const mag = mag1 * mag2;\n const cosine = mag && dot(a, b) / mag;\n return Math.acos(cosine);\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nexport function subtract(a: Vec3, b: Vec3, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = a[0] - b[0];\n dst[1] = a[1] - b[1];\n dst[2] = a[2] - b[2];\n\n return dst;\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nexport const sub = subtract;\n\n/**\n * Check if 2 vectors are approximately equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are approximately equal\n */\nexport function equalsApproximately(a: Vec3, b: Vec3): boolean {\n return Math.abs(a[0] - b[0]) < utils.EPSILON &&\n Math.abs(a[1] - b[1]) < utils.EPSILON &&\n Math.abs(a[2] - b[2]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 vectors are exactly equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are exactly equal\n */\nexport function equals(a: Vec3, b: Vec3): boolean {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2];\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficient.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The linear interpolated result.\n */\nexport function lerp(a: Vec3, b: Vec3, t: number, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = a[0] + t * (b[0] - a[0]);\n dst[1] = a[1] + t * (b[1] - a[1]);\n dst[2] = a[2] + t * (b[2] - a[2]);\n\n return dst;\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient vector t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficients vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns the linear interpolated result.\n */\nexport function lerpV(a: Vec3, b: Vec3, t: Vec3, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = a[0] + t[0] * (b[0] - a[0]);\n dst[1] = a[1] + t[1] * (b[1] - a[1]);\n dst[2] = a[2] + t[2] * (b[2] - a[2]);\n\n return dst;\n}\n\n/**\n * Return max values of two vectors.\n * Given vectors a and b returns\n * [max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The max components vector.\n */\nexport function max(a: Vec3, b: Vec3, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = Math.max(a[0], b[0]);\n dst[1] = Math.max(a[1], b[1]);\n dst[2] = Math.max(a[2], b[2]);\n\n return dst;\n}\n\n/**\n * Return min values of two vectors.\n * Given vectors a and b returns\n * [min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The min components vector.\n */\nexport function min(a: Vec3, b: Vec3, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = Math.min(a[0], b[0]);\n dst[1] = Math.min(a[1], b[1]);\n dst[2] = Math.min(a[2], b[2]);\n\n return dst;\n}\n\n/**\n * Multiplies a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nexport function mulScalar(v: Vec3, k: number, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = v[0] * k;\n dst[1] = v[1] * k;\n dst[2] = v[2] * k;\n\n return dst;\n}\n\n/**\n * Multiplies a vector by a scalar. (same as mulScalar)\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nexport const scale = mulScalar;\n\n/**\n * Divides a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nexport function divScalar(v: Vec3, k: number, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = v[0] / k;\n dst[1] = v[1] / k;\n dst[2] = v[2] / k;\n\n return dst;\n}\n\n/**\n * Inverse a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nexport function inverse(v: Vec3, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = 1 / v[0];\n dst[1] = 1 / v[1];\n dst[2] = 1 / v[2];\n\n return dst;\n}\n\n/**\n * Invert a vector. (same as inverse)\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nexport const invert = inverse;\n\n/**\n * Computes the cross product of two vectors; assumes both vectors have\n * three entries.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of a cross b.\n */\nexport function cross(a: Vec3, b: Vec3, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n const t1 = a[2] * b[0] - a[0] * b[2];\n const t2 = a[0] * b[1] - a[1] * b[0];\n dst[0] = a[1] * b[2] - a[2] * b[1];\n dst[1] = t1;\n dst[2] = t2;\n\n return dst;\n}\n\n/**\n * Computes the dot product of two vectors; assumes both vectors have\n * three entries.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns dot product\n */\nexport function dot(a: Vec3, b: Vec3): number {\n return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]);\n}\n\n/**\n * Computes the length of vector\n * @param v - vector.\n * @returns length of vector.\n */\nexport function length(v: Vec3): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n return Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2);\n}\n\n/**\n * Computes the length of vector (same as length)\n * @param v - vector.\n * @returns length of vector.\n */\nexport const len = length;\n\n/**\n * Computes the square of the length of vector\n * @param v - vector.\n * @returns square of the length of vector.\n */\nexport function lengthSq(v: Vec3): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n return v0 * v0 + v1 * v1 + v2 * v2;\n}\n\n/**\n * Computes the square of the length of vector (same as lengthSq)\n * @param v - vector.\n * @returns square of the length of vector.\n */\nexport const lenSq = lengthSq;\n\n/**\n * Computes the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nexport function distance(a: Vec3, b: Vec3): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n const dz = a[2] - b[2];\n return Math.sqrt(dx * dx + dy * dy + dz * dz);\n}\n\n/**\n * Computes the distance between 2 points (same as distance)\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nexport const dist = distance;\n\n/**\n * Computes the square of the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nexport function distanceSq(a: Vec3, b: Vec3): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n const dz = a[2] - b[2];\n return dx * dx + dy * dy + dz * dz;\n}\n\n/**\n * Computes the square of the distance between 2 points (same as distanceSq)\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nexport const distSq = distanceSq;\n\n/**\n * Divides a vector by its Euclidean length and returns the quotient.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The normalized vector.\n */\nexport function normalize(v: Vec3, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const len = Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2);\n\n if (len > 0.00001) {\n dst[0] = v0 / len;\n dst[1] = v1 / len;\n dst[2] = v2 / len;\n } else {\n dst[0] = 0;\n dst[1] = 0;\n dst[2] = 0;\n }\n\n\n return dst;\n}\n\n/**\n * Negates a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns -v.\n */\nexport function negate(v: Vec3, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = -v[0];\n dst[1] = -v[1];\n dst[2] = -v[2];\n\n return dst;\n}\n\n/**\n * Copies a vector. (same as {@link vec3.clone})\n * Also see {@link vec3.create} and {@link vec3.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nexport function copy(v: Vec3, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = v[0];\n dst[1] = v[1];\n dst[2] = v[2];\n\n return dst;\n}\n\n/**\n * Clones a vector. (same as {@link vec3.copy})\n * Also see {@link vec3.create} and {@link vec3.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nexport const clone = copy;\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nexport function multiply(a: Vec3, b: Vec3, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = a[0] * b[0];\n dst[1] = a[1] * b[1];\n dst[2] = a[2] * b[2];\n\n return dst;\n}\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as mul)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nexport const mul = multiply;\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nexport function divide(a: Vec3, b: Vec3, dst?: Vec3) {\n dst = dst || new VecType(3);\n\n dst[0] = a[0] / b[0];\n dst[1] = a[1] / b[1];\n dst[2] = a[2] / b[2];\n\n return dst;\n}\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as divide)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nexport const div = divide;\n\n/**\n * Creates a random vector\n * @param scale - Default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The random vector.\n */\nexport function random(scale = 1, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n const angle = Math.random() * 2 * Math.PI;\n const z = Math.random() * 2 - 1;\n const zScale = Math.sqrt(1 - z * z) * scale;\n dst[0] = Math.cos(angle) * zScale;\n dst[1] = Math.sin(angle) * zScale;\n dst[2] = z * scale;\n\n return dst;\n}\n\n/**\n * Zero's a vector\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The zeroed vector.\n */\nexport function zero(dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = 0;\n dst[1] = 0;\n dst[2] = 0;\n\n return dst;\n}\n\n\n/**\n * transform vec3 by 4x4 matrix\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional vec3 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nexport function transformMat4(v: Vec3, m: Mat4, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n const x = v[0];\n const y = v[1];\n const z = v[2];\n const w = (m[3] * x + m[7] * y + m[11] * z + m[15]) || 1;\n\n dst[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;\n dst[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;\n dst[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;\n\n return dst;\n}\n\n/**\n * Transform vec4 by upper 3x3 matrix inside 4x4 matrix.\n * @param v - The direction.\n * @param m - The matrix.\n * @param dst - optional Vec3 to store result. If not passed a new one is created.\n * @returns The transformed vector.\n */\nexport function transformMat4Upper3x3(v: Vec3, m: Mat4, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n\n dst[0] = v0 * m[0 * 4 + 0] + v1 * m[1 * 4 + 0] + v2 * m[2 * 4 + 0];\n dst[1] = v0 * m[0 * 4 + 1] + v1 * m[1 * 4 + 1] + v2 * m[2 * 4 + 1];\n dst[2] = v0 * m[0 * 4 + 2] + v1 * m[1 * 4 + 2] + v2 * m[2 * 4 + 2];\n\n return dst;\n}\n\n/**\n * Transforms vec3 by 3x3 matrix\n *\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional vec3 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nexport function transformMat3(v: Vec3, m: Mat3, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n const x = v[0];\n const y = v[1];\n const z = v[2];\n\n dst[0] = x * m[0] + y * m[4] + z * m[8];\n dst[1] = x * m[1] + y * m[5] + z * m[9];\n dst[2] = x * m[2] + y * m[6] + z * m[10];\n\n return dst;\n}\n\n/**\n * Transforms vec3 by Quaternion\n * @param v - the vector to transform\n * @param q - the quaternion to transform by\n * @param dst - optional vec3 to store result. If not passed a new one is created.\n * @returns the transformed\n */\nexport function transformQuat(v: Vec3, q: Quat, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const w2 = q[3] * 2;\n\n const x = v[0];\n const y = v[1];\n const z = v[2];\n\n const uvX = qy * z - qz * y;\n const uvY = qz * x - qx * z;\n const uvZ = qx * y - qy * x;\n\n dst[0] = x + uvX * w2 + (qy * uvZ - qz * uvY) * 2;\n dst[1] = y + uvY * w2 + (qz * uvX - qx * uvZ) * 2;\n dst[2] = z + uvZ * w2 + (qx * uvY - qy * uvX) * 2;\n\n return dst;\n}\n\n/**\n * Returns the translation component of a 4-by-4 matrix as a vector with 3\n * entries.\n * @param m - The matrix.\n * @param dst - vector to hold result. If not passed a new one is created.\n * @returns The translation component of m.\n */\nexport function getTranslation(m: Mat3, dst?: Vec3) {\n dst = dst || new VecType(3);\n dst[0] = m[12];\n dst[1] = m[13];\n dst[2] = m[14];\n return dst;\n}\n/**\n * Returns an axis of a 4x4 matrix as a vector with 3 entries\n * @param m - The matrix.\n * @param axis - The axis 0 = x, 1 = y, 2 = z;\n * @returns The axis component of m.\n */\nexport function getAxis(m: Mat4, axis: number, dst?: Vec3) {\n dst = dst || new VecType(3);\n const off = axis * 4;\n dst[0] = m[off + 0];\n dst[1] = m[off + 1];\n dst[2] = m[off + 2];\n return dst;\n}\n/**\n * Returns the scaling component of the matrix\n * @param m - The Matrix\n * @param dst - The vector to set. If not passed a new one is created.\n */\nexport function getScaling(m: Mat4, dst: Vec3) {\n dst = dst || new VecType(3);\n const xx = m[0];\n const xy = m[1];\n const xz = m[2];\n const yx = m[4];\n const yy = m[5];\n const yz = m[6];\n const zx = m[8];\n const zy = m[9];\n const zz = m[10];\n dst[0] = Math.sqrt(xx * xx + xy * xy + xz * xz);\n dst[1] = Math.sqrt(yx * yx + yy * yy + yz * yz);\n dst[2] = Math.sqrt(zx * zx + zy * zy + zz * zz);\n return dst;\n}\n\n/**\n * Rotate a 3D vector around the x-axis\n *\n * @param {ReadonlyVec3} a The vec3 point to rotate\n * @param {ReadonlyVec3} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @param dst - The vector to set. If not passed a new one is created.\n * @returns the rotated vector\n */\nexport function rotateX(a: Vec3, b: Vec3, rad: number, dst?: Vec3) {\n dst = dst || new VecType(3);\n const p = [];\n const r = [];\n\n //Translate point to the origin\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2];\n\n //perform rotation\n r[0] = p[0];\n r[1] = p[1] * Math.cos(rad) - p[2] * Math.sin(rad);\n r[2] = p[1] * Math.sin(rad) + p[2] * Math.cos(rad);\n\n //translate to correct position\n dst[0] = r[0] + b[0];\n dst[1] = r[1] + b[1];\n dst[2] = r[2] + b[2];\n\n return dst;\n}\n\n/**\n * Rotate a 3D vector around the y-axis\n *\n * @param {ReadonlyVec3} a The vec3 point to rotate\n * @param {ReadonlyVec3} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @param dst - The vector to set. If not passed a new one is created.\n * @returns the rotated vector\n */\nexport function rotateY(a: Vec3, b: Vec3, rad: number, dst?: Vec3) {\n dst = dst || new VecType(3);\n const p = [];\n const r = [];\n\n // translate point to the origin\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2];\n\n // perform rotation\n r[0] = p[2] * Math.sin(rad) + p[0] * Math.cos(rad);\n r[1] = p[1];\n r[2] = p[2] * Math.cos(rad) - p[0] * Math.sin(rad);\n\n // translate to correct position\n dst[0] = r[0] + b[0];\n dst[1] = r[1] + b[1];\n dst[2] = r[2] + b[2];\n\n return dst;\n}\n\n/**\n * Rotate a 3D vector around the z-axis\n *\n * @param {ReadonlyVec3} a The vec3 point to rotate\n * @param {ReadonlyVec3} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @param dst - The vector to set. If not passed a new one is created.\n * @returns {vec3} out\n */\nexport function rotateZ(a: Vec3, b: Vec3, rad: number, dst?: Vec3) {\n dst = dst || new VecType(3);\n const p = [];\n const r = [];\n\n // translate point to the origin\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2];\n\n // perform rotation\n r[0] = p[0] * Math.cos(rad) - p[1] * Math.sin(rad);\n r[1] = p[0] * Math.sin(rad) + p[1] * Math.cos(rad);\n r[2] = p[2];\n\n // translate to correct position\n dst[0] = r[0] + b[0];\n dst[1] = r[1] + b[1];\n dst[2] = r[2] + b[2];\n\n return dst;\n}\n\n/**\n * Treat a 3D vector as a direction and set it's length\n *\n * @param a The vec3 to lengthen\n * @param len The length of the resulting vector\n * @returns The lengthened vector\n */\nexport function setLength(a: Vec3, len: number, dst?: Vec3) {\n dst = dst || new VecType(3);\n normalize(a, dst);\n return mulScalar(dst, len, dst);\n}\n\n/**\n * Ensure a vector is not longer than a max length\n *\n * @param a The vec3 to limit\n * @param maxLen The longest length of the resulting vector\n * @returns The vector, shortened to maxLen if it's too long\n */\nexport function truncate(a: Vec3, maxLen: number, dst?: Vec3) {\n dst = dst || new VecType(3);\n\n if (length(a) > maxLen) {\n return setLength(a, maxLen, dst);\n }\n\n return copy(a, dst);\n}\n\n/**\n * Return the vector exactly between 2 endpoint vectors\n *\n * @param a Endpoint 1\n * @param b Endpoint 2\n * @returns The vector exactly residing between endpoints 1 and 2\n */\nexport function midpoint(a: Vec3, b: Vec3, dst?: Vec3) {\n dst = dst || new VecType(3);\n return lerp(a, b, 0.5, dst);\n}\n","\nimport { Mat3 } from './mat3';\nimport { Mat4 } from './mat4';\nimport { Quat } from './quat';\nimport Vec3, * as vec3 from './vec3-impl';\nimport * as utils from './utils';\n\nexport default Mat4;\n\nexport type Mat4LikeCtor = new (n: number) => Mat4;\n\n/**\n * 4x4 Matrix math math functions.\n *\n * Almost all functions take an optional `dst` argument. If it is not passed in the\n * functions will create a new matrix. In other words you can do this\n *\n * const mat = mat4.translation([1, 2, 3]); // Creates a new translation matrix\n *\n * or\n *\n * const mat = mat4.create();\n * mat4.translation([1, 2, 3], mat); // Puts translation matrix in mat.\n *\n * The first style is often easier but depending on where it's used it generates garbage where\n * as there is almost never allocation with the second style.\n *\n * It is always save to pass any matrix as the destination. So for example\n *\n * const mat = mat4.identity();\n * const trans = mat4.translation([1, 2, 3]);\n * mat4.multiply(mat, trans, mat); // Multiplies mat * trans and puts result in mat.\n *\n */\nlet MatType: Mat4LikeCtor = Float32Array;\n\n/**\n * Sets the type this library creates for a Mat4\n * @param ctor - the constructor for the type. Either `Float32Array`, `Float64Array`, or `Array`\n * @returns previous constructor for Mat4\n */\nexport function setDefaultType(ctor: new (n: number) => Mat4) {\n const oldType = MatType;\n MatType = ctor;\n return oldType;\n}\n\n/**\n * Create a Mat4 from values\n *\n * Note: Since passing in a raw JavaScript array\n * is valid in all circumstances, if you want to\n * force a JavaScript array into a Mat4's specified type\n * it would be faster to use\n *\n * ```\n * const m = mat4.clone(someJSArray);\n * ```\n *\n * Note: a consequence of the implementation is if your Mat4Type = `Array`\n * instead of `Float32Array` or `Float64Array` then any values you\n * don't pass in will be undefined. Usually this is not an issue since\n * (a) using `Array` is rare and (b) using `mat4.create` is usually used\n * to create a Mat4 to be filled out as in\n *\n * ```\n * const m = mat4.create();\n * mat4.perspective(fov, aspect, near, far, m);\n * ```\n *\n * @param v0 - value for element 0\n * @param v1 - value for element 1\n * @param v2 - value for element 2\n * @param v3 - value for element 3\n * @param v4 - value for element 4\n * @param v5 - value for element 5\n * @param v6 - value for element 6\n * @param v7 - value for element 7\n * @param v8 - value for element 8\n * @param v9 - value for element 9\n * @param v10 - value for element 10\n * @param v11 - value for element 11\n * @param v12 - value for element 12\n * @param v13 - value for element 13\n * @param v14 - value for element 14\n * @param v15 - value for element 15\n * @returns created from values.\n */\nexport function create(\n v0?: number, v1?: number, v2?: number, v3?: number,\n v4?: number, v5?: number, v6?: number, v7?: number,\n v8?: number, v9?: number, v10?: number, v11?: number,\n v12?: number, v13?: number, v14?: number, v15?: number): Mat4 {\n const dst = new MatType(16);\n if (v0 !== undefined) {\n dst[0] = v0;\n if (v1 !== undefined) {\n dst[1] = v1;\n if (v2 !== undefined) {\n dst[2] = v2;\n if (v3 !== undefined) {\n dst[3] = v3;\n if (v4 !== undefined) {\n dst[4] = v4;\n if (v5 !== undefined) {\n dst[5] = v5;\n if (v6 !== undefined) {\n dst[6] = v6;\n if (v7 !== undefined) {\n dst[7] = v7;\n if (v8 !== undefined) {\n dst[8] = v8;\n if (v9 !== undefined) {\n dst[9] = v9;\n if (v10 !== undefined) {\n dst[10] = v10;\n if (v11 !== undefined) {\n dst[11] = v11;\n if (v12 !== undefined) {\n dst[12] = v12;\n if (v13 !== undefined) {\n dst[13] = v13;\n if (v14 !== undefined) {\n dst[14] = v14;\n if (v15 !== undefined) {\n dst[15] = v15;\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n return dst;\n}\n\n/**\n * Sets the values of a Mat4\n * Also see {@link mat4.create} and {@link mat4.copy}\n *\n * @param v0 - value for element 0\n * @param v1 - value for element 1\n * @param v2 - value for element 2\n * @param v3 - value for element 3\n * @param v4 - value for element 4\n * @param v5 - value for element 5\n * @param v6 - value for element 6\n * @param v7 - value for element 7\n * @param v8 - value for element 8\n * @param v9 - value for element 9\n * @param v10 - value for element 10\n * @param v11 - value for element 11\n * @param v12 - value for element 12\n * @param v13 - value for element 13\n * @param v14 - value for element 14\n * @param v15 - value for element 15\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat4 created from values.\n */\nexport function set(\n v0: number, v1: number, v2: number, v3: number,\n v4: number, v5: number, v6: number, v7: number,\n v8: number, v9: number, v10: number, v11: number,\n v12: number, v13: number, v14: number, v15: number,\n dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n dst[ 0] = v0; dst[ 1] = v1; dst[ 2] = v2; dst[ 3] = v3;\n dst[ 4] = v4; dst[ 5] = v5; dst[ 6] = v6; dst[ 7] = v7;\n dst[ 8] = v8; dst[ 9] = v9; dst[10] = v10; dst[11] = v11;\n dst[12] = v12; dst[13] = v13; dst[14] = v14; dst[15] = v15;\n\n return dst;\n}\n\n/**\n * Creates a Mat4 from a Mat3\n * @param m3 - source matrix\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat4 made from m3\n */\nexport function fromMat3(m3: Mat3, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n dst[ 0] = m3[0]; dst[ 1] = m3[1]; dst[ 2] = m3[ 2]; dst[ 3] = 0;\n dst[ 4] = m3[4]; dst[ 5] = m3[5]; dst[ 6] = m3[ 6]; dst[ 7] = 0;\n dst[ 8] = m3[8]; dst[ 9] = m3[9]; dst[10] = m3[10]; dst[11] = 0;\n dst[12] = 0; dst[13] = 0; dst[14] = 0; dst[15] = 1;\n\n return dst;\n}\n\n/**\n * Creates a Mat4 rotation matrix from a quaternion\n * @param q - quaternion to create matrix from\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat4 made from q\n */\nexport function fromQuat(q: Quat, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n const x = q[0]; const y = q[1]; const z = q[2]; const w = q[3];\n const x2 = x + x; const y2 = y + y; const z2 = z + z;\n\n const xx = x * x2;\n const yx = y * x2;\n const yy = y * y2;\n const zx = z * x2;\n const zy = z * y2;\n const zz = z * z2;\n const wx = w * x2;\n const wy = w * y2;\n const wz = w * z2;\n\n dst[ 0] = 1 - yy - zz; dst[ 1] = yx + wz; dst[ 2] = zx - wy; dst[ 3] = 0;\n dst[ 4] = yx - wz; dst[ 5] = 1 - xx - zz; dst[ 6] = zy + wx; dst[ 7] = 0;\n dst[ 8] = zx + wy; dst[ 9] = zy - wx; dst[10] = 1 - xx - yy; dst[11] = 0;\n dst[12] = 0; dst[13] = 0; dst[14] = 0; dst[15] = 1;\n\n return dst;\n}\n\n/**\n * Negates a matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns -m.\n */\nexport function negate(m: Mat4, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n dst[ 0] = -m[ 0]; dst[ 1] = -m[ 1]; dst[ 2] = -m[ 2]; dst[ 3] = -m[ 3];\n dst[ 4] = -m[ 4]; dst[ 5] = -m[ 5]; dst[ 6] = -m[ 6]; dst[ 7] = -m[ 7];\n dst[ 8] = -m[ 8]; dst[ 9] = -m[ 9]; dst[10] = -m[10]; dst[11] = -m[11];\n dst[12] = -m[12]; dst[13] = -m[13]; dst[14] = -m[14]; dst[15] = -m[15];\n\n return dst;\n}\n\n/**\n * Copies a matrix. (same as {@link mat4.clone})\n * Also see {@link mat4.create} and {@link mat4.set}\n * @param m - The matrix.\n * @param dst - The matrix. If not passed a new one is created.\n * @returns A copy of m.\n */\nexport function copy(m: Mat4, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n dst[ 0] = m[ 0]; dst[ 1] = m[ 1]; dst[ 2] = m[ 2]; dst[ 3] = m[ 3];\n dst[ 4] = m[ 4]; dst[ 5] = m[ 5]; dst[ 6] = m[ 6]; dst[ 7] = m[ 7];\n dst[ 8] = m[ 8]; dst[ 9] = m[ 9]; dst[10] = m[10]; dst[11] = m[11];\n dst[12] = m[12]; dst[13] = m[13]; dst[14] = m[14]; dst[15] = m[15];\n\n return dst;\n}\n\n/**\n * Copies a matrix (same as {@link mat4.copy})\n * Also see {@link mat4.create} and {@link mat4.set}\n * @param m - The matrix.\n * @param dst - The matrix. If not passed a new one is created.\n * @returns A copy of m.\n */\nexport const clone = copy;\n\n/**\n * Check if 2 matrices are approximately equal\n * @param a - Operand matrix.\n * @param b - Operand matrix.\n * @returns true if matrices are approximately equal\n */\nexport function equalsApproximately(a: Mat4, b: Mat4): boolean {\n return Math.abs(a[ 0] - b[ 0]) < utils.EPSILON &&\n Math.abs(a[ 1] - b[ 1]) < utils.EPSILON &&\n Math.abs(a[ 2] - b[ 2]) < utils.EPSILON &&\n Math.abs(a[ 3] - b[ 3]) < utils.EPSILON &&\n Math.abs(a[ 4] - b[ 4]) < utils.EPSILON &&\n Math.abs(a[ 5] - b[ 5]) < utils.EPSILON &&\n Math.abs(a[ 6] - b[ 6]) < utils.EPSILON &&\n Math.abs(a[ 7] - b[ 7]) < utils.EPSILON &&\n Math.abs(a[ 8] - b[ 8]) < utils.EPSILON &&\n Math.abs(a[ 9] - b[ 9]) < utils.EPSILON &&\n Math.abs(a[10] - b[10]) < utils.EPSILON &&\n Math.abs(a[11] - b[11]) < utils.EPSILON &&\n Math.abs(a[12] - b[12]) < utils.EPSILON &&\n Math.abs(a[13] - b[13]) < utils.EPSILON &&\n Math.abs(a[14] - b[14]) < utils.EPSILON &&\n Math.abs(a[15] - b[15]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 matrices are exactly equal\n * @param a - Operand matrix.\n * @param b - Operand matrix.\n * @returns true if matrices are exactly equal\n */\nexport function equals(a: Mat4, b: Mat4): boolean {\n return a[ 0] === b[ 0] &&\n a[ 1] === b[ 1] &&\n a[ 2] === b[ 2] &&\n a[ 3] === b[ 3] &&\n a[ 4] === b[ 4] &&\n a[ 5] === b[ 5] &&\n a[ 6] === b[ 6] &&\n a[ 7] === b[ 7] &&\n a[ 8] === b[ 8] &&\n a[ 9] === b[ 9] &&\n a[10] === b[10] &&\n a[11] === b[11] &&\n a[12] === b[12] &&\n a[13] === b[13] &&\n a[14] === b[14] &&\n a[15] === b[15];\n}\n\n/**\n * Creates a 4-by-4 identity matrix.\n *\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns A 4-by-4 identity matrix.\n */\nexport function identity(dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n dst[ 0] = 1; dst[ 1] = 0; dst[ 2] = 0; dst[ 3] = 0;\n dst[ 4] = 0; dst[ 5] = 1; dst[ 6] = 0; dst[ 7] = 0;\n dst[ 8] = 0; dst[ 9] = 0; dst[10] = 1; dst[11] = 0;\n dst[12] = 0; dst[13] = 0; dst[14] = 0; dst[15] = 1;\n\n return dst;\n}\n\n/**\n * Takes the transpose of a matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The transpose of m.\n */\nexport function transpose(m: Mat4, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n if (dst === m) {\n let t;\n\n t = m[1];\n m[1] = m[4];\n m[4] = t;\n\n t = m[2];\n m[2] = m[8];\n m[8] = t;\n\n t = m[3];\n m[3] = m[12];\n m[12] = t;\n\n t = m[6];\n m[6] = m[9];\n m[9] = t;\n\n t = m[7];\n m[7] = m[13];\n m[13] = t;\n\n t = m[11];\n m[11] = m[14];\n m[14] = t;\n return dst;\n }\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const m30 = m[3 * 4 + 0];\n const m31 = m[3 * 4 + 1];\n const m32 = m[3 * 4 + 2];\n const m33 = m[3 * 4 + 3];\n\n dst[ 0] = m00; dst[ 1] = m10; dst[ 2] = m20; dst[ 3] = m30;\n dst[ 4] = m01; dst[ 5] = m11; dst[ 6] = m21; dst[ 7] = m31;\n dst[ 8] = m02; dst[ 9] = m12; dst[10] = m22; dst[11] = m32;\n dst[12] = m03; dst[13] = m13; dst[14] = m23; dst[15] = m33;\n\n return dst;\n}\n\n/**\n * Computes the inverse of a 4-by-4 matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The inverse of m.\n */\nexport function inverse(m: Mat4, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const m30 = m[3 * 4 + 0];\n const m31 = m[3 * 4 + 1];\n const m32 = m[3 * 4 + 2];\n const m33 = m[3 * 4 + 3];\n const tmp0 = m22 * m33;\n const tmp1 = m32 * m23;\n const tmp2 = m12 * m33;\n const tmp3 = m32 * m13;\n const tmp4 = m12 * m23;\n const tmp5 = m22 * m13;\n const tmp6 = m02 * m33;\n const tmp7 = m32 * m03;\n const tmp8 = m02 * m23;\n const tmp9 = m22 * m03;\n const tmp10 = m02 * m13;\n const tmp11 = m12 * m03;\n const tmp12 = m20 * m31;\n const tmp13 = m30 * m21;\n const tmp14 = m10 * m31;\n const tmp15 = m30 * m11;\n const tmp16 = m10 * m21;\n const tmp17 = m20 * m11;\n const tmp18 = m00 * m31;\n const tmp19 = m30 * m01;\n const tmp20 = m00 * m21;\n const tmp21 = m20 * m01;\n const tmp22 = m00 * m11;\n const tmp23 = m10 * m01;\n\n const t0 = (tmp0 * m11 + tmp3 * m21 + tmp4 * m31) -\n (tmp1 * m11 + tmp2 * m21 + tmp5 * m31);\n const t1 = (tmp1 * m01 + tmp6 * m21 + tmp9 * m31) -\n (tmp0 * m01 + tmp7 * m21 + tmp8 * m31);\n const t2 = (tmp2 * m01 + tmp7 * m11 + tmp10 * m31) -\n (tmp3 * m01 + tmp6 * m11 + tmp11 * m31);\n const t3 = (tmp5 * m01 + tmp8 * m11 + tmp11 * m21) -\n (tmp4 * m01 + tmp9 * m11 + tmp10 * m21);\n\n const d = 1 / (m00 * t0 + m10 * t1 + m20 * t2 + m30 * t3);\n\n dst[ 0] = d * t0;\n dst[ 1] = d * t1;\n dst[ 2] = d * t2;\n dst[ 3] = d * t3;\n dst[ 4] = d * ((tmp1 * m10 + tmp2 * m20 + tmp5 * m30) -\n (tmp0 * m10 + tmp3 * m20 + tmp4 * m30));\n dst[ 5] = d * ((tmp0 * m00 + tmp7 * m20 + tmp8 * m30) -\n (tmp1 * m00 + tmp6 * m20 + tmp9 * m30));\n dst[ 6] = d * ((tmp3 * m00 + tmp6 * m10 + tmp11 * m30) -\n (tmp2 * m00 + tmp7 * m10 + tmp10 * m30));\n dst[ 7] = d * ((tmp4 * m00 + tmp9 * m10 + tmp10 * m20) -\n (tmp5 * m00 + tmp8 * m10 + tmp11 * m20));\n dst[ 8] = d * ((tmp12 * m13 + tmp15 * m23 + tmp16 * m33) -\n (tmp13 * m13 + tmp14 * m23 + tmp17 * m33));\n dst[ 9] = d * ((tmp13 * m03 + tmp18 * m23 + tmp21 * m33) -\n (tmp12 * m03 + tmp19 * m23 + tmp20 * m33));\n dst[10] = d * ((tmp14 * m03 + tmp19 * m13 + tmp22 * m33) -\n (tmp15 * m03 + tmp18 * m13 + tmp23 * m33));\n dst[11] = d * ((tmp17 * m03 + tmp20 * m13 + tmp23 * m23) -\n (tmp16 * m03 + tmp21 * m13 + tmp22 * m23));\n dst[12] = d * ((tmp14 * m22 + tmp17 * m32 + tmp13 * m12) -\n (tmp16 * m32 + tmp12 * m12 + tmp15 * m22));\n dst[13] = d * ((tmp20 * m32 + tmp12 * m02 + tmp19 * m22) -\n (tmp18 * m22 + tmp21 * m32 + tmp13 * m02));\n dst[14] = d * ((tmp18 * m12 + tmp23 * m32 + tmp15 * m02) -\n (tmp22 * m32 + tmp14 * m02 + tmp19 * m12));\n dst[15] = d * ((tmp22 * m22 + tmp16 * m02 + tmp21 * m12) -\n (tmp20 * m12 + tmp23 * m22 + tmp17 * m02));\n\n return dst;\n}\n\n/**\n * Compute the determinant of a matrix\n * @param m - the matrix\n * @returns the determinant\n */\nexport function determinant(m: Mat4): number {\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const m30 = m[3 * 4 + 0];\n const m31 = m[3 * 4 + 1];\n const m32 = m[3 * 4 + 2];\n const m33 = m[3 * 4 + 3];\n\n const tmp0 = m22 * m33;\n const tmp1 = m32 * m23;\n const tmp2 = m12 * m33;\n const tmp3 = m32 * m13;\n const tmp4 = m12 * m23;\n const tmp5 = m22 * m13;\n const tmp6 = m02 * m33;\n const tmp7 = m32 * m03;\n const tmp8 = m02 * m23;\n const tmp9 = m22 * m03;\n const tmp10 = m02 * m13;\n const tmp11 = m12 * m03;\n\n const t0 = (tmp0 * m11 + tmp3 * m21 + tmp4 * m31) -\n (tmp1 * m11 + tmp2 * m21 + tmp5 * m31);\n const t1 = (tmp1 * m01 + tmp6 * m21 + tmp9 * m31) -\n (tmp0 * m01 + tmp7 * m21 + tmp8 * m31);\n const t2 = (tmp2 * m01 + tmp7 * m11 + tmp10 * m31) -\n (tmp3 * m01 + tmp6 * m11 + tmp11 * m31);\n const t3 = (tmp5 * m01 + tmp8 * m11 + tmp11 * m21) -\n (tmp4 * m01 + tmp9 * m11 + tmp10 * m21);\n\n return m00 * t0 + m10 * t1 + m20 * t2 + m30 * t3;\n}\n\n/**\n * Computes the inverse of a 4-by-4 matrix. (same as inverse)\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The inverse of m.\n */\nexport const invert = inverse;\n\n/**\n * Multiplies two 4-by-4 matrices with a on the left and b on the right\n * @param a - The matrix on the left.\n * @param b - The matrix on the right.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix product of a and b.\n */\nexport function multiply(a: Mat4, b: Mat4, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a03 = a[3];\n const a10 = a[ 4 + 0];\n const a11 = a[ 4 + 1];\n const a12 = a[ 4 + 2];\n const a13 = a[ 4 + 3];\n const a20 = a[ 8 + 0];\n const a21 = a[ 8 + 1];\n const a22 = a[ 8 + 2];\n const a23 = a[ 8 + 3];\n const a30 = a[12 + 0];\n const a31 = a[12 + 1];\n const a32 = a[12 + 2];\n const a33 = a[12 + 3];\n const b00 = b[0];\n const b01 = b[1];\n const b02 = b[2];\n const b03 = b[3];\n const b10 = b[ 4 + 0];\n const b11 = b[ 4 + 1];\n const b12 = b[ 4 + 2];\n const b13 = b[ 4 + 3];\n const b20 = b[ 8 + 0];\n const b21 = b[ 8 + 1];\n const b22 = b[ 8 + 2];\n const b23 = b[ 8 + 3];\n const b30 = b[12 + 0];\n const b31 = b[12 + 1];\n const b32 = b[12 + 2];\n const b33 = b[12 + 3];\n\n dst[ 0] = a00 * b00 + a10 * b01 + a20 * b02 + a30 * b03;\n dst[ 1] = a01 * b00 + a11 * b01 + a21 * b02 + a31 * b03;\n dst[ 2] = a02 * b00 + a12 * b01 + a22 * b02 + a32 * b03;\n dst[ 3] = a03 * b00 + a13 * b01 + a23 * b02 + a33 * b03;\n dst[ 4] = a00 * b10 + a10 * b11 + a20 * b12 + a30 * b13;\n dst[ 5] = a01 * b10 + a11 * b11 + a21 * b12 + a31 * b13;\n dst[ 6] = a02 * b10 + a12 * b11 + a22 * b12 + a32 * b13;\n dst[ 7] = a03 * b10 + a13 * b11 + a23 * b12 + a33 * b13;\n dst[ 8] = a00 * b20 + a10 * b21 + a20 * b22 + a30 * b23;\n dst[ 9] = a01 * b20 + a11 * b21 + a21 * b22 + a31 * b23;\n dst[10] = a02 * b20 + a12 * b21 + a22 * b22 + a32 * b23;\n dst[11] = a03 * b20 + a13 * b21 + a23 * b22 + a33 * b23;\n dst[12] = a00 * b30 + a10 * b31 + a20 * b32 + a30 * b33;\n dst[13] = a01 * b30 + a11 * b31 + a21 * b32 + a31 * b33;\n dst[14] = a02 * b30 + a12 * b31 + a22 * b32 + a32 * b33;\n dst[15] = a03 * b30 + a13 * b31 + a23 * b32 + a33 * b33;\n\n return dst;\n}\n\n/**\n * Multiplies two 4-by-4 matrices with a on the left and b on the right (same as multiply)\n * @param a - The matrix on the left.\n * @param b - The matrix on the right.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix product of a and b.\n */\nexport const mul = multiply;\n\n/**\n * Sets the translation component of a 4-by-4 matrix to the given\n * vector.\n * @param a - The matrix.\n * @param v - The vector.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix with translation set.\n */\nexport function setTranslation(a: Mat4, v: Vec3, dst?: Mat4): Mat4 {\n dst = dst || identity();\n if (a !== dst) {\n dst[ 0] = a[ 0];\n dst[ 1] = a[ 1];\n dst[ 2] = a[ 2];\n dst[ 3] = a[ 3];\n dst[ 4] = a[ 4];\n dst[ 5] = a[ 5];\n dst[ 6] = a[ 6];\n dst[ 7] = a[ 7];\n dst[ 8] = a[ 8];\n dst[ 9] = a[ 9];\n dst[10] = a[10];\n dst[11] = a[11];\n }\n dst[12] = v[0];\n dst[13] = v[1];\n dst[14] = v[2];\n dst[15] = 1;\n return dst;\n}\n\n/**\n * Returns the translation component of a 4-by-4 matrix as a vector with 3\n * entries.\n * @param m - The matrix.\n * @param dst - vector to hold result. If not passed a new one is created.\n * @returns The translation component of m.\n */\nexport function getTranslation(m: Mat4, dst?: Vec3): Vec3 {\n dst = dst || vec3.create();\n dst[0] = m[12];\n dst[1] = m[13];\n dst[2] = m[14];\n return dst;\n}\n\n/**\n * Returns an axis of a 4x4 matrix as a vector with 3 entries\n * @param m - The matrix.\n * @param axis - The axis 0 = x, 1 = y, 2 = z;\n * @returns The axis component of m.\n */\nexport function getAxis(m: Mat4, axis: number, dst?: Vec3): Vec3 {\n dst = dst || vec3.create();\n const off = axis * 4;\n dst[0] = m[off + 0];\n dst[1] = m[off + 1];\n dst[2] = m[off + 2];\n return dst;\n}\n\n/**\n * Sets an axis of a 4x4 matrix as a vector with 3 entries\n * @param m - The matrix.\n * @param v - the axis vector\n * @param axis - The axis 0 = x, 1 = y, 2 = z;\n * @param dst - The matrix to set. If not passed a new one is created.\n * @returns The matrix with axis set.\n */\nexport function setAxis(m: Mat4, v: Vec3, axis: number, dst: Mat4): Mat4 {\n if (dst !== m) {\n dst = copy(m, dst);\n }\n const off = axis * 4;\n dst[off + 0] = v[0];\n dst[off + 1] = v[1];\n dst[off + 2] = v[2];\n return dst;\n}\n\n/**\n * Returns the scaling component of the matrix\n * @param m - The Matrix\n * @param dst - The vector to set. If not passed a new one is created.\n */\nexport function getScaling(m: Mat4, dst?: Vec3): Vec3 {\n dst = dst || vec3.create();\n\n const xx = m[0];\n const xy = m[1];\n const xz = m[2];\n const yx = m[4];\n const yy = m[5];\n const yz = m[6];\n const zx = m[8];\n const zy = m[9];\n const zz = m[10];\n\n dst[0] = Math.sqrt(xx * xx + xy * xy + xz * xz);\n dst[1] = Math.sqrt(yx * yx + yy * yy + yz * yz);\n dst[2] = Math.sqrt(zx * zx + zy * zy + zz * zz);\n\n return dst;\n}\n\n/**\n * Computes a 4-by-4 perspective transformation matrix given the angular height\n * of the frustum, the aspect ratio, and the near and far clipping planes. The\n * arguments define a frustum extending in the negative z direction. The given\n * angle is the vertical angle of the frustum, and the horizontal angle is\n * determined to produce the given aspect ratio. The arguments near and far are\n * the distances to the near and far clipping planes. Note that near and far\n * are not z coordinates, but rather they are distances along the negative\n * z-axis. The matrix generated sends the viewing frustum to the unit box.\n * We assume a unit box extending from -1 to 1 in the x and y dimensions and\n * from 0 to 1 in the z dimension.\n *\n * Note: If you pass `Infinity` for zFar then it will produce a projection matrix\n * returns -Infinity for Z when transforming coordinates with Z <= 0 and +Infinity for Z\n * otherwise.\n *\n * @param fieldOfViewYInRadians - The camera angle from top to bottom (in radians).\n * @param aspect - The aspect ratio width / height.\n * @param zNear - The depth (negative z coordinate)\n * of the near clipping plane.\n * @param zFar - The depth (negative z coordinate)\n * of the far clipping plane.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The perspective matrix.\n */\nexport function perspective(fieldOfViewYInRadians: number, aspect: number, zNear: number, zFar: number, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n const f = Math.tan(Math.PI * 0.5 - 0.5 * fieldOfViewYInRadians);\n\n dst[0] = f / aspect;\n dst[1] = 0;\n dst[2] = 0;\n dst[3] = 0;\n\n dst[4] = 0;\n dst[5] = f;\n dst[6] = 0;\n dst[7] = 0;\n\n dst[8] = 0;\n dst[9] = 0;\n dst[11] = -1;\n\n dst[12] = 0;\n dst[13] = 0;\n dst[15] = 0;\n\n if (Number.isFinite(zFar)) {\n const rangeInv = 1 / (zNear - zFar);\n dst[10] = zFar * rangeInv;\n dst[14] = zFar * zNear * rangeInv;\n } else {\n dst[10] = -1;\n dst[14] = -zNear;\n }\n\n return dst;\n}\n\n/**\n * Computes a 4-by-4 reverse-z perspective transformation matrix given the angular height\n * of the frustum, the aspect ratio, and the near and far clipping planes. The\n * arguments define a frustum extending in the negative z direction. The given\n * angle is the vertical angle of the frustum, and the horizontal angle is\n * determined to produce the given aspect ratio. The arguments near and far are\n * the distances to the near and far clipping planes. Note that near and far\n * are not z coordinates, but rather they are distances along the negative\n * z-axis. The matrix generated sends the viewing frustum to the unit box.\n * We assume a unit box extending from -1 to 1 in the x and y dimensions and\n * from 1 (at -zNear) to 0 (at -zFar) in the z dimension.\n *\n * @param fieldOfViewYInRadians - The camera angle from top to bottom (in radians).\n * @param aspect - The aspect ratio width / height.\n * @param zNear - The depth (negative z coordinate)\n * of the near clipping plane.\n * @param zFar - The depth (negative z coordinate)\n * of the far clipping plane. (default = Infinity)\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The perspective matrix.\n */export function perspectiveReverseZ(fieldOfViewYInRadians: number, aspect: number, zNear: number, zFar = Infinity, dst?: Mat4) {\n dst = dst || new MatType(16);\n\n const f = 1 / Math.tan(fieldOfViewYInRadians * 0.5);\n\n dst[ 0] = f / aspect;\n dst[ 1] = 0;\n dst[ 2] = 0;\n dst[ 3] = 0;\n\n dst[ 4] = 0;\n dst[ 5] = f;\n dst[ 6] = 0;\n dst[ 7] = 0;\n\n dst[ 8] = 0;\n dst[ 9] = 0;\n dst[11] = -1;\n\n dst[12] = 0;\n dst[13] = 0;\n dst[15] = 0;\n\n if (zFar === Infinity) {\n dst[10] = 0;\n dst[14] = zNear;\n } else {\n const rangeInv = 1 / (zFar - zNear);\n dst[10] = zNear * rangeInv;\n dst[14] = zFar * zNear * rangeInv;\n }\n\n return dst;\n}\n\n/**\n * Computes a 4-by-4 orthogonal transformation matrix that transforms from\n * the given the left, right, bottom, and top dimensions to -1 +1 in x, and y\n * and 0 to +1 in z.\n * @param left - Left side of the near clipping plane viewport.\n * @param right - Right side of the near clipping plane viewport.\n * @param bottom - Bottom of the near clipping plane viewport.\n * @param top - Top of the near clipping plane viewport.\n * @param near - The depth (negative z coordinate)\n * of the near clipping plane.\n * @param far - The depth (negative z coordinate)\n * of the far clipping plane.\n * @param dst - Output matrix. If not passed a new one is created.\n * @returns The orthographic projection matrix.\n */\nexport function ortho(left: number, right: number, bottom: number, top: number, near: number, far: number, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n dst[0] = 2 / (right - left);\n dst[1] = 0;\n dst[2] = 0;\n dst[3] = 0;\n\n dst[4] = 0;\n dst[5] = 2 / (top - bottom);\n dst[6] = 0;\n dst[7] = 0;\n\n dst[8] = 0;\n dst[9] = 0;\n dst[10] = 1 / (near - far);\n dst[11] = 0;\n\n dst[12] = (right + left) / (left - right);\n dst[13] = (top + bottom) / (bottom - top);\n dst[14] = near / (near - far);\n dst[15] = 1;\n\n return dst;\n}\n\n/**\n * Computes a 4-by-4 perspective transformation matrix given the left, right,\n * top, bottom, near and far clipping planes. The arguments define a frustum\n * extending in the negative z direction. The arguments near and far are the\n * distances to the near and far clipping planes. Note that near and far are not\n * z coordinates, but rather they are distances along the negative z-axis. The\n * matrix generated sends the viewing frustum to the unit box. We assume a unit\n * box extending from -1 to 1 in the x and y dimensions and from 0 to 1 in the z\n * dimension.\n * @param left - The x coordinate of the left plane of the box.\n * @param right - The x coordinate of the right plane of the box.\n * @param bottom - The y coordinate of the bottom plane of the box.\n * @param top - The y coordinate of the right plane of the box.\n * @param near - The negative z coordinate of the near plane of the box.\n * @param far - The negative z coordinate of the far plane of the box.\n * @param dst - Output matrix. If not passed a new one is created.\n * @returns The perspective projection matrix.\n */\nexport function frustum(left: number, right: number, bottom: number, top: number, near: number, far: number, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n const dx = (right - left);\n const dy = (top - bottom);\n const dz = (near - far);\n\n dst[ 0] = 2 * near / dx;\n dst[ 1] = 0;\n dst[ 2] = 0;\n dst[ 3] = 0;\n dst[ 4] = 0;\n dst[ 5] = 2 * near / dy;\n dst[ 6] = 0;\n dst[ 7] = 0;\n dst[ 8] = (left + right) / dx;\n dst[ 9] = (top + bottom) / dy;\n dst[10] = far / dz;\n dst[11] = -1;\n dst[12] = 0;\n dst[13] = 0;\n dst[14] = near * far / dz;\n dst[15] = 0;\n\n return dst;\n}\n\n/**\n * Computes a 4-by-4 reverse-z perspective transformation matrix given the left, right,\n * top, bottom, near and far clipping planes. The arguments define a frustum\n * extending in the negative z direction. The arguments near and far are the\n * distances to the near and far clipping planes. Note that near and far are not\n * z coordinates, but rather they are distances along the negative z-axis. The\n * matrix generated sends the viewing frustum to the unit box. We assume a unit\n * box extending from -1 to 1 in the x and y dimensions and from 1 (-near) to 0 (-far) in the z\n * dimension.\n * @param left - The x coordinate of the left plane of the box.\n * @param right - The x coordinate of the right plane of the box.\n * @param bottom - The y coordinate of the bottom plane of the box.\n * @param top - The y coordinate of the right plane of the box.\n * @param near - The negative z coordinate of the near plane of the box.\n * @param far - The negative z coordinate of the far plane of the box.\n * @param dst - Output matrix. If not passed a new one is created.\n * @returns The perspective projection matrix.\n */\nexport function frustumReverseZ(left: number, right: number, bottom: number, top: number, near: number, far = Infinity, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n const dx = (right - left);\n const dy = (top - bottom);\n\n dst[ 0] = 2 * near / dx;\n dst[ 1] = 0;\n dst[ 2] = 0;\n dst[ 3] = 0;\n dst[ 4] = 0;\n dst[ 5] = 2 * near / dy;\n dst[ 6] = 0;\n dst[ 7] = 0;\n dst[ 8] = (left + right) / dx;\n dst[ 9] = (top + bottom) / dy;\n dst[11] = -1;\n dst[12] = 0;\n dst[13] = 0;\n dst[15] = 0;\n\n if (far === Infinity) {\n dst[10] = 0;\n dst[14] = near;\n } else {\n const rangeInv = 1 / (far - near);\n dst[10] = near * rangeInv;\n dst[14] = far * near * rangeInv;\n }\n\n return dst;\n}\n\nlet xAxis: Vec3;\nlet yAxis: Vec3;\nlet zAxis: Vec3;\n\n/**\n * Computes a 4-by-4 aim transformation.\n *\n * This is a matrix which positions an object aiming down positive Z.\n * toward the target.\n *\n * Note: this is **NOT** the inverse of lookAt as lookAt looks at negative Z.\n *\n * @param position - The position of the object.\n * @param target - The position meant to be aimed at.\n * @param up - A vector pointing up.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The aim matrix.\n */\nexport function aim(position: Vec3, target: Vec3, up: Vec3, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n xAxis = xAxis || vec3.create();\n yAxis = yAxis || vec3.create();\n zAxis = zAxis || vec3.create();\n\n vec3.normalize(vec3.subtract(target, position, zAxis), zAxis);\n vec3.normalize(vec3.cross(up, zAxis, xAxis), xAxis);\n vec3.normalize(vec3.cross(zAxis, xAxis, yAxis), yAxis);\n\n dst[ 0] = xAxis[0]; dst[ 1] = xAxis[1]; dst[ 2] = xAxis[2]; dst[ 3] = 0;\n dst[ 4] = yAxis[0]; dst[ 5] = yAxis[1]; dst[ 6] = yAxis[2]; dst[ 7] = 0;\n dst[ 8] = zAxis[0]; dst[ 9] = zAxis[1]; dst[10] = zAxis[2]; dst[11] = 0;\n dst[12] = position[0]; dst[13] = position[1]; dst[14] = position[2]; dst[15] = 1;\n\n return dst;\n}\n\n/**\n * Computes a 4-by-4 camera aim transformation.\n *\n * This is a matrix which positions an object aiming down negative Z.\n * toward the target.\n *\n * Note: this is the inverse of `lookAt`\n *\n * @param eye - The position of the object.\n * @param target - The position meant to be aimed at.\n * @param up - A vector pointing up.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The aim matrix.\n */\nexport function cameraAim(eye: Vec3, target: Vec3, up: Vec3, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n xAxis = xAxis || vec3.create();\n yAxis = yAxis || vec3.create();\n zAxis = zAxis || vec3.create();\n\n vec3.normalize(vec3.subtract(eye, target, zAxis), zAxis);\n vec3.normalize(vec3.cross(up, zAxis, xAxis), xAxis);\n vec3.normalize(vec3.cross(zAxis, xAxis, yAxis), yAxis);\n\n dst[ 0] = xAxis[0]; dst[ 1] = xAxis[1]; dst[ 2] = xAxis[2]; dst[ 3] = 0;\n dst[ 4] = yAxis[0]; dst[ 5] = yAxis[1]; dst[ 6] = yAxis[2]; dst[ 7] = 0;\n dst[ 8] = zAxis[0]; dst[ 9] = zAxis[1]; dst[10] = zAxis[2]; dst[11] = 0;\n dst[12] = eye[0]; dst[13] = eye[1]; dst[14] = eye[2]; dst[15] = 1;\n\n return dst;\n}\n\n/**\n * Computes a 4-by-4 view transformation.\n *\n * This is a view matrix which transforms all other objects\n * to be in the space of the view defined by the parameters.\n *\n * @param eye - The position of the object.\n * @param target - The position meant to be aimed at.\n * @param up - A vector pointing up.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The look-at matrix.\n */\nexport function lookAt(eye: Vec3, target: Vec3, up: Vec3, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n xAxis = xAxis || vec3.create();\n yAxis = yAxis || vec3.create();\n zAxis = zAxis || vec3.create();\n\n vec3.normalize(vec3.subtract(eye, target, zAxis), zAxis);\n vec3.normalize(vec3.cross(up, zAxis, xAxis), xAxis);\n vec3.normalize(vec3.cross(zAxis, xAxis, yAxis), yAxis);\n\n dst[ 0] = xAxis[0]; dst[ 1] = yAxis[0]; dst[ 2] = zAxis[0]; dst[ 3] = 0;\n dst[ 4] = xAxis[1]; dst[ 5] = yAxis[1]; dst[ 6] = zAxis[1]; dst[ 7] = 0;\n dst[ 8] = xAxis[2]; dst[ 9] = yAxis[2]; dst[10] = zAxis[2]; dst[11] = 0;\n\n dst[12] = -(xAxis[0] * eye[0] + xAxis[1] * eye[1] + xAxis[2] * eye[2]);\n dst[13] = -(yAxis[0] * eye[0] + yAxis[1] * eye[1] + yAxis[2] * eye[2]);\n dst[14] = -(zAxis[0] * eye[0] + zAxis[1] * eye[1] + zAxis[2] * eye[2]);\n dst[15] = 1;\n\n return dst;\n}\n\n/**\n * Creates a 4-by-4 matrix which translates by the given vector v.\n * @param v - The vector by\n * which to translate.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The translation matrix.\n */\nexport function translation(v: Vec3, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n dst[ 0] = 1; dst[ 1] = 0; dst[ 2] = 0; dst[ 3] = 0;\n dst[ 4] = 0; dst[ 5] = 1; dst[ 6] = 0; dst[ 7] = 0;\n dst[ 8] = 0; dst[ 9] = 0; dst[10] = 1; dst[11] = 0;\n dst[12] = v[0]; dst[13] = v[1]; dst[14] = v[2]; dst[15] = 1;\n\n return dst;\n}\n\n/**\n * Translates the given 4-by-4 matrix by the given vector v.\n * @param m - The matrix.\n * @param v - The vector by\n * which to translate.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The translated matrix.\n */\nexport function translate(m: Mat4, v: Vec3, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const m00 = m[0];\n const m01 = m[1];\n const m02 = m[2];\n const m03 = m[3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const m30 = m[3 * 4 + 0];\n const m31 = m[3 * 4 + 1];\n const m32 = m[3 * 4 + 2];\n const m33 = m[3 * 4 + 3];\n\n if (m !== dst) {\n dst[ 0] = m00;\n dst[ 1] = m01;\n dst[ 2] = m02;\n dst[ 3] = m03;\n dst[ 4] = m10;\n dst[ 5] = m11;\n dst[ 6] = m12;\n dst[ 7] = m13;\n dst[ 8] = m20;\n dst[ 9] = m21;\n dst[10] = m22;\n dst[11] = m23;\n }\n\n dst[12] = m00 * v0 + m10 * v1 + m20 * v2 + m30;\n dst[13] = m01 * v0 + m11 * v1 + m21 * v2 + m31;\n dst[14] = m02 * v0 + m12 * v1 + m22 * v2 + m32;\n dst[15] = m03 * v0 + m13 * v1 + m23 * v2 + m33;\n\n return dst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the x-axis by the given angle.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotation matrix.\n */\nexport function rotationX(angleInRadians: number, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n dst[ 0] = 1; dst[ 1] = 0; dst[ 2] = 0; dst[ 3] = 0;\n dst[ 4] = 0; dst[ 5] = c; dst[ 6] = s; dst[ 7] = 0;\n dst[ 8] = 0; dst[ 9] = -s; dst[10] = c; dst[11] = 0;\n dst[12] = 0; dst[13] = 0; dst[14] = 0; dst[15] = 1;\n\n return dst;\n}\n\n/**\n * Rotates the given 4-by-4 matrix around the x-axis by the given\n * angle.\n * @param m - The matrix.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nexport function rotateX(m: Mat4, angleInRadians: number, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n const m10 = m[4];\n const m11 = m[5];\n const m12 = m[6];\n const m13 = m[7];\n const m20 = m[8];\n const m21 = m[9];\n const m22 = m[10];\n const m23 = m[11];\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n dst[4] = c * m10 + s * m20;\n dst[5] = c * m11 + s * m21;\n dst[6] = c * m12 + s * m22;\n dst[7] = c * m13 + s * m23;\n dst[8] = c * m20 - s * m10;\n dst[9] = c * m21 - s * m11;\n dst[10] = c * m22 - s * m12;\n dst[11] = c * m23 - s * m13;\n\n if (m !== dst) {\n dst[ 0] = m[ 0];\n dst[ 1] = m[ 1];\n dst[ 2] = m[ 2];\n dst[ 3] = m[ 3];\n dst[12] = m[12];\n dst[13] = m[13];\n dst[14] = m[14];\n dst[15] = m[15];\n }\n\n return dst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the y-axis by the given angle.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotation matrix.\n */\nexport function rotationY(angleInRadians: number, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n dst[ 0] = c; dst[ 1] = 0; dst[ 2] = -s; dst[ 3] = 0;\n dst[ 4] = 0; dst[ 5] = 1; dst[ 6] = 0; dst[ 7] = 0;\n dst[ 8] = s; dst[ 9] = 0; dst[10] = c; dst[11] = 0;\n dst[12] = 0; dst[13] = 0; dst[14] = 0; dst[15] = 1;\n\n return dst;\n}\n\n/**\n * Rotates the given 4-by-4 matrix around the y-axis by the given\n * angle.\n * @param m - The matrix.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nexport function rotateY(m: Mat4, angleInRadians: number, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n dst[ 0] = c * m00 - s * m20;\n dst[ 1] = c * m01 - s * m21;\n dst[ 2] = c * m02 - s * m22;\n dst[ 3] = c * m03 - s * m23;\n dst[ 8] = c * m20 + s * m00;\n dst[ 9] = c * m21 + s * m01;\n dst[10] = c * m22 + s * m02;\n dst[11] = c * m23 + s * m03;\n\n if (m !== dst) {\n dst[ 4] = m[ 4];\n dst[ 5] = m[ 5];\n dst[ 6] = m[ 6];\n dst[ 7] = m[ 7];\n dst[12] = m[12];\n dst[13] = m[13];\n dst[14] = m[14];\n dst[15] = m[15];\n }\n\n return dst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the z-axis by the given angle.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotation matrix.\n */\nexport function rotationZ(angleInRadians: number, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n dst[ 0] = c; dst[ 1] = s; dst[ 2] = 0; dst[ 3] = 0;\n dst[ 4] = -s; dst[ 5] = c; dst[ 6] = 0; dst[ 7] = 0;\n dst[ 8] = 0; dst[ 9] = 0; dst[10] = 1; dst[11] = 0;\n dst[12] = 0; dst[13] = 0; dst[14] = 0; dst[15] = 1;\n\n return dst;\n}\n\n/**\n * Rotates the given 4-by-4 matrix around the z-axis by the given\n * angle.\n * @param m - The matrix.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nexport function rotateZ(m: Mat4, angleInRadians: number, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n dst[ 0] = c * m00 + s * m10;\n dst[ 1] = c * m01 + s * m11;\n dst[ 2] = c * m02 + s * m12;\n dst[ 3] = c * m03 + s * m13;\n dst[ 4] = c * m10 - s * m00;\n dst[ 5] = c * m11 - s * m01;\n dst[ 6] = c * m12 - s * m02;\n dst[ 7] = c * m13 - s * m03;\n\n if (m !== dst) {\n dst[ 8] = m[ 8];\n dst[ 9] = m[ 9];\n dst[10] = m[10];\n dst[11] = m[11];\n dst[12] = m[12];\n dst[13] = m[13];\n dst[14] = m[14];\n dst[15] = m[15];\n }\n\n return dst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the given axis by the given\n * angle.\n * @param axis - The axis\n * about which to rotate.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns A matrix which rotates angle radians\n * around the axis.\n */\nexport function axisRotation(axis: Vec3, angleInRadians: number, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n let x = axis[0];\n let y = axis[1];\n let z = axis[2];\n const n = Math.sqrt(x * x + y * y + z * z);\n x /= n;\n y /= n;\n z /= n;\n const xx = x * x;\n const yy = y * y;\n const zz = z * z;\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n const oneMinusCosine = 1 - c;\n\n dst[ 0] = xx + (1 - xx) * c;\n dst[ 1] = x * y * oneMinusCosine + z * s;\n dst[ 2] = x * z * oneMinusCosine - y * s;\n dst[ 3] = 0;\n dst[ 4] = x * y * oneMinusCosine - z * s;\n dst[ 5] = yy + (1 - yy) * c;\n dst[ 6] = y * z * oneMinusCosine + x * s;\n dst[ 7] = 0;\n dst[ 8] = x * z * oneMinusCosine + y * s;\n dst[ 9] = y * z * oneMinusCosine - x * s;\n dst[10] = zz + (1 - zz) * c;\n dst[11] = 0;\n dst[12] = 0;\n dst[13] = 0;\n dst[14] = 0;\n dst[15] = 1;\n\n return dst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the given axis by the given\n * angle. (same as axisRotation)\n * @param axis - The axis\n * about which to rotate.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns A matrix which rotates angle radians\n * around the axis.\n */\nexport const rotation = axisRotation;\n\n/**\n * Rotates the given 4-by-4 matrix around the given axis by the\n * given angle.\n * @param m - The matrix.\n * @param axis - The axis\n * about which to rotate.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nexport function axisRotate(m: Mat4, axis: Vec3, angleInRadians: number, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n let x = axis[0];\n let y = axis[1];\n let z = axis[2];\n const n = Math.sqrt(x * x + y * y + z * z);\n x /= n;\n y /= n;\n z /= n;\n const xx = x * x;\n const yy = y * y;\n const zz = z * z;\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n const oneMinusCosine = 1 - c;\n\n const r00 = xx + (1 - xx) * c;\n const r01 = x * y * oneMinusCosine + z * s;\n const r02 = x * z * oneMinusCosine - y * s;\n const r10 = x * y * oneMinusCosine - z * s;\n const r11 = yy + (1 - yy) * c;\n const r12 = y * z * oneMinusCosine + x * s;\n const r20 = x * z * oneMinusCosine + y * s;\n const r21 = y * z * oneMinusCosine - x * s;\n const r22 = zz + (1 - zz) * c;\n\n const m00 = m[0];\n const m01 = m[1];\n const m02 = m[2];\n const m03 = m[3];\n const m10 = m[4];\n const m11 = m[5];\n const m12 = m[6];\n const m13 = m[7];\n const m20 = m[8];\n const m21 = m[9];\n const m22 = m[10];\n const m23 = m[11];\n\n dst[ 0] = r00 * m00 + r01 * m10 + r02 * m20;\n dst[ 1] = r00 * m01 + r01 * m11 + r02 * m21;\n dst[ 2] = r00 * m02 + r01 * m12 + r02 * m22;\n dst[ 3] = r00 * m03 + r01 * m13 + r02 * m23;\n dst[ 4] = r10 * m00 + r11 * m10 + r12 * m20;\n dst[ 5] = r10 * m01 + r11 * m11 + r12 * m21;\n dst[ 6] = r10 * m02 + r11 * m12 + r12 * m22;\n dst[ 7] = r10 * m03 + r11 * m13 + r12 * m23;\n dst[ 8] = r20 * m00 + r21 * m10 + r22 * m20;\n dst[ 9] = r20 * m01 + r21 * m11 + r22 * m21;\n dst[10] = r20 * m02 + r21 * m12 + r22 * m22;\n dst[11] = r20 * m03 + r21 * m13 + r22 * m23;\n\n if (m !== dst) {\n dst[12] = m[12];\n dst[13] = m[13];\n dst[14] = m[14];\n dst[15] = m[15];\n }\n\n return dst;\n}\n\n/**\n * Rotates the given 4-by-4 matrix around the given axis by the\n * given angle. (same as rotate)\n * @param m - The matrix.\n * @param axis - The axis\n * about which to rotate.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nexport const rotate = axisRotate;\n\n/**\n * Creates a 4-by-4 matrix which scales in each dimension by an amount given by\n * the corresponding entry in the given vector; assumes the vector has three\n * entries.\n * @param v - A vector of\n * three entries specifying the factor by which to scale in each dimension.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaling matrix.\n */\nexport function scaling(v: Vec3, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n dst[ 0] = v[0]; dst[ 1] = 0; dst[ 2] = 0; dst[ 3] = 0;\n dst[ 4] = 0; dst[ 5] = v[1]; dst[ 6] = 0; dst[ 7] = 0;\n dst[ 8] = 0; dst[ 9] = 0; dst[10] = v[2]; dst[11] = 0;\n dst[12] = 0; dst[13] = 0; dst[14] = 0; dst[15] = 1;\n\n return dst;\n}\n\n/**\n * Scales the given 4-by-4 matrix in each dimension by an amount\n * given by the corresponding entry in the given vector; assumes the vector has\n * three entries.\n * @param m - The matrix to be modified.\n * @param v - A vector of three entries specifying the\n * factor by which to scale in each dimension.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaled matrix.\n */\nexport function scale(m: Mat4, v: Vec3, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n\n dst[ 0] = v0 * m[0 * 4 + 0];\n dst[ 1] = v0 * m[0 * 4 + 1];\n dst[ 2] = v0 * m[0 * 4 + 2];\n dst[ 3] = v0 * m[0 * 4 + 3];\n dst[ 4] = v1 * m[1 * 4 + 0];\n dst[ 5] = v1 * m[1 * 4 + 1];\n dst[ 6] = v1 * m[1 * 4 + 2];\n dst[ 7] = v1 * m[1 * 4 + 3];\n dst[ 8] = v2 * m[2 * 4 + 0];\n dst[ 9] = v2 * m[2 * 4 + 1];\n dst[10] = v2 * m[2 * 4 + 2];\n dst[11] = v2 * m[2 * 4 + 3];\n\n if (m !== dst) {\n dst[12] = m[12];\n dst[13] = m[13];\n dst[14] = m[14];\n dst[15] = m[15];\n }\n\n return dst;\n}\n\n/**\n * Creates a 4-by-4 matrix which scales a uniform amount in each dimension.\n * @param s - the amount to scale\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaling matrix.\n */\nexport function uniformScaling(s: number, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n dst[ 0] = s; dst[ 1] = 0; dst[ 2] = 0; dst[ 3] = 0;\n dst[ 4] = 0; dst[ 5] = s; dst[ 6] = 0; dst[ 7] = 0;\n dst[ 8] = 0; dst[ 9] = 0; dst[10] = s; dst[11] = 0;\n dst[12] = 0; dst[13] = 0; dst[14] = 0; dst[15] = 1;\n\n return dst;\n}\n\n/**\n * Scales the given 4-by-4 matrix in each dimension by a uniform scale.\n * @param m - The matrix to be modified.\n * @param s - The amount to scale.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaled matrix.\n */\nexport function uniformScale(m: Mat4, s: number, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n dst[ 0] = s * m[0 * 4 + 0];\n dst[ 1] = s * m[0 * 4 + 1];\n dst[ 2] = s * m[0 * 4 + 2];\n dst[ 3] = s * m[0 * 4 + 3];\n dst[ 4] = s * m[1 * 4 + 0];\n dst[ 5] = s * m[1 * 4 + 1];\n dst[ 6] = s * m[1 * 4 + 2];\n dst[ 7] = s * m[1 * 4 + 3];\n dst[ 8] = s * m[2 * 4 + 0];\n dst[ 9] = s * m[2 * 4 + 1];\n dst[10] = s * m[2 * 4 + 2];\n dst[11] = s * m[2 * 4 + 3];\n\n if (m !== dst) {\n dst[12] = m[12];\n dst[13] = m[13];\n dst[14] = m[14];\n dst[15] = m[15];\n }\n\n return dst;\n}","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\n\n/**\n * A JavaScript array with 4 values, Float32Array with 4 values, or a Float64Array with 4 values.\n * When created by the library will create the default type which is `Float32Array`\n * but can be set by calling {@link quat.setDefaultType}.\n */\nexport type Quat = number[] | Float32Array | Float64Array;\n\n/**\n *\n * Quat4 math functions.\n *\n * Almost all functions take an optional `dst` argument. If it is not passed in the\n * functions will create a new `Quat4`. In other words you can do this\n *\n * const v = quat4.cross(v1, v2); // Creates a new Quat4 with the cross product of v1 x v2.\n *\n * or\n *\n * const v = quat4.create();\n * quat4.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v\n *\n * The first style is often easier but depending on where it's used it generates garbage where\n * as there is almost never allocation with the second style.\n *\n * It is always safe to pass any vector as the destination. So for example\n *\n * quat4.cross(v1, v2, v1); // Puts the cross product of v1 x v2 in v1\n *\n */\n\nexport let QuatType: new (n: number) => Quat = Float32Array;\n\n/**\n * Sets the type this library creates for a Quat4\n * @param ctor - the constructor for the type. Either `Float32Array`, `Float64Array`, or `Array`\n * @returns previous constructor for Quat4\n */\nexport function setDefaultType(ctor: new (n: number) => Quat) {\n const oldType = QuatType;\n QuatType = ctor;\n return oldType;\n}\n\n/**\n * Creates a quat4; may be called with x, y, z to set initial values.\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @param w - Initial w value.\n * @returns the created vector\n */\nexport function create(x?: number, y?: number, z?: number, w?: number): Quat {\n const dst = new QuatType(4);\n if (x !== undefined) {\n dst[0] = x;\n if (y !== undefined) {\n dst[1] = y;\n if (z !== undefined) {\n dst[2] = z;\n if (w !== undefined) {\n dst[3] = w;\n }\n }\n }\n }\n return dst;\n}","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport * as utils from './utils.js';\nimport { Quat, create, setDefaultType, QuatType } from './quat';\nimport { Mat3 } from './mat3.js';\nimport { Mat4 } from './mat4.js';\nimport { Vec3 } from './vec3.js';\nimport * as vec3 from './vec3-impl.js';\n\nexport type RotationOrder = 'xyz' | 'xzy' | 'yxz' | 'yzx' | 'zxy' | 'zyx';\n\nexport default Quat;\nexport { create, setDefaultType };\n\n/**\n * Creates a Quat; may be called with x, y, z to set initial values. (same as create)\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @param z - Initial w value.\n * @returns the created vector\n */\nexport const fromValues = create;\n\n/**\n * Sets the values of a Quat\n * Also see {@link quat.create} and {@link quat.copy}\n *\n * @param x first value\n * @param y second value\n * @param z third value\n * @param w fourth value\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector with its elements set.\n */\nexport function set(x: number, y: number, z: number, w: number, dst?: Quat) {\n dst = dst || new QuatType(4);\n\n dst[0] = x;\n dst[1] = y;\n dst[2] = z;\n dst[3] = w;\n\n return dst;\n}\n\n/**\n * Sets a quaternion from the given angle and axis,\n * then returns it.\n *\n * @param axis - the axis to rotate around\n * @param angleInRadians - the angle\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The quaternion that represents the given axis and angle\n **/\nexport function fromAxisAngle(axis: Vec3, angleInRadians: number, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n const halfAngle = angleInRadians * 0.5;\n const s = Math.sin(halfAngle);\n\n dst[0] = s * axis[0];\n dst[1] = s * axis[1];\n dst[2] = s * axis[2];\n dst[3] = Math.cos(halfAngle);\n\n return dst;\n}\n\n/**\n * Gets the rotation axis and angle\n * @param q - quaternion to compute from\n * @param dst - Vec3 to hold result. If not passed in a new one is created.\n * @return angle and axis\n */\nexport function toAxisAngle(q: Quat, dst?: Vec3): { angle: number, axis: Vec3 } {\n dst = dst || vec3.create(4);\n\n const angle = Math.acos(q[3]) * 2;\n const s = Math.sin(angle * 0.5);\n if (s > utils.EPSILON) {\n dst[0] = q[0] / s;\n dst[1] = q[1] / s;\n dst[2] = q[2] / s;\n } else {\n dst[0] = 1;\n dst[1] = 0;\n dst[2] = 0;\n }\n\n return { angle, axis: dst };\n}\n\n/**\n * Returns the angle in degrees between two rotations a and b.\n * @param a - quaternion a\n * @param b - quaternion b\n * @return angle in radians between the two quaternions\n */\nexport function angle(a: Quat, b: Quat) {\n const d = dot(a, b);\n return Math.acos(2 * d * d - 1);\n}\n\n/**\n * Multiplies two quaternions\n *\n * @param a - the first quaternion\n * @param b - the second quaternion\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nexport function multiply(a: Quat, b: Quat, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const aw = a[3];\n\n const bx = b[0];\n const by = b[1];\n const bz = b[2];\n const bw = b[3];\n\n dst[0] = ax * bw + aw * bx + ay * bz - az * by;\n dst[1] = ay * bw + aw * by + az * bx - ax * bz;\n dst[2] = az * bw + aw * bz + ax * by - ay * bx;\n dst[3] = aw * bw - ax * bx - ay * by - az * bz;\n\n return dst;\n}\n\n/**\n * Multiplies two quaternions\n *\n * @param a - the first quaternion\n * @param b - the second quaternion\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nexport const mul = multiply;\n\n/**\n * Rotates the given quaternion around the X axis by the given angle.\n * @param q - quaternion to rotate\n * @param angleInRadians - The angle by which to rotate\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nexport function rotateX(q: Quat, angleInRadians: number, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n const halfAngle = angleInRadians * 0.5;\n\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const qw = q[3];\n\n const bx = Math.sin(halfAngle);\n const bw = Math.cos(halfAngle);\n\n dst[0] = qx * bw + qw * bx;\n dst[1] = qy * bw + qz * bx;\n dst[2] = qz * bw - qy * bx;\n dst[3] = qw * bw - qx * bx;\n\n return dst;\n}\n\n/**\n * Rotates the given quaternion around the Y axis by the given angle.\n * @param q - quaternion to rotate\n * @param angleInRadians - The angle by which to rotate\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nexport function rotateY(q: Quat, angleInRadians: number, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n const halfAngle = angleInRadians * 0.5;\n\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const qw = q[3];\n\n const by = Math.sin(halfAngle);\n const bw = Math.cos(halfAngle);\n\n dst[0] = qx * bw - qz * by;\n dst[1] = qy * bw + qw * by;\n dst[2] = qz * bw + qx * by;\n dst[3] = qw * bw - qy * by;\n\n return dst;\n}\n\n/**\n * Rotates the given quaternion around the Z axis by the given angle.\n * @param q - quaternion to rotate\n * @param angleInRadians - The angle by which to rotate\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nexport function rotateZ(q: Quat, angleInRadians: number, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n const halfAngle = angleInRadians * 0.5;\n\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const qw = q[3];\n\n const bz = Math.sin(halfAngle);\n const bw = Math.cos(halfAngle);\n\n dst[0] = qx * bw + qy * bz;\n dst[1] = qy * bw - qx * bz;\n dst[2] = qz * bw + qw * bz;\n dst[3] = qw * bw - qz * bz;\n\n return dst;\n}\n\n/**\n * Spherically linear interpolate between two quaternions\n *\n * @param a - starting value\n * @param b - ending value\n * @param t - value where 0 = a and 1 = b\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nexport function slerp(a: Quat, b: Quat, t: number, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const aw = a[3];\n\n let bx = b[0];\n let by = b[1];\n let bz = b[2];\n let bw = b[3];\n\n let cosOmega = ax * bx + ay * by + az * bz + aw * bw;\n\n if (cosOmega < 0) {\n cosOmega = -cosOmega;\n bx = -bx;\n by = -by;\n bz = -bz;\n bw = -bw;\n }\n\n let scale0;\n let scale1;\n\n if (1.0 - cosOmega > utils.EPSILON) {\n const omega = Math.acos(cosOmega);\n const sinOmega = Math.sin(omega);\n scale0 = Math.sin((1 - t) * omega) / sinOmega;\n scale1 = Math.sin(t * omega) / sinOmega;\n } else {\n scale0 = 1.0 - t;\n scale1 = t;\n }\n\n dst[0] = scale0 * ax + scale1 * bx;\n dst[1] = scale0 * ay + scale1 * by;\n dst[2] = scale0 * az + scale1 * bz;\n dst[3] = scale0 * aw + scale1 * bw;\n\n return dst;\n}\n\n/**\n * Compute the inverse of a quaternion\n *\n * @param q - quaternion to compute the inverse of\n * @returns A quaternion that is the result of a * b\n */\nexport function inverse(q: Quat, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n const a0 = q[0];\n const a1 = q[1];\n const a2 = q[2];\n const a3 = q[3];\n\n const dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3;\n const invDot = dot ? 1 / dot : 0;\n\n dst[0] = -a0 * invDot;\n dst[1] = -a1 * invDot;\n dst[2] = -a2 * invDot;\n dst[3] = a3 * invDot;\n\n return dst;\n}\n\n/**\n * Compute the conjugate of a quaternion\n * For quaternions with a magnitude of 1 (a unit quaternion)\n * this returns the same as the inverse but is faster to calculate.\n *\n * @param q - quaternion to compute the conjugate of.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The conjugate of q\n */\nexport function conjugate(q: Quat, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n dst[0] = -q[0];\n dst[1] = -q[1];\n dst[2] = -q[2];\n dst[3] = q[3];\n\n return dst;\n}\n\n/**\n * Creates a quaternion from the given rotation matrix.\n *\n * The created quaternion is not normalized.\n *\n * @param m - rotation matrix\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns the result\n */\nexport function fromMat(m: Mat3 | Mat4, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n /*\n 0 1 2\n 3 4 5\n 6 7 8\n\n 0 1 2\n 4 5 6\n 8 9 10\n */\n\n // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes\n // article \"Quaternion Calculus and Fast Animation\".\n const trace = m[0] + m[5] + m[10];\n\n if (trace > 0.0) {\n // |w| > 1/2, may as well choose w > 1/2\n const root = Math.sqrt(trace + 1); // 2w\n dst[3] = 0.5 * root;\n const invRoot = 0.5 / root; // 1/(4w)\n\n dst[0] = (m[6] - m[9]) * invRoot;\n dst[1] = (m[8] - m[2]) * invRoot;\n dst[2] = (m[1] - m[4]) * invRoot;\n } else {\n // |w| <= 1/2\n let i = 0;\n\n if (m[5] > m[0]) {\n i = 1;\n }\n if (m[10] > m[i * 4 + i]) {\n i = 2;\n }\n\n const j = (i + 1) % 3;\n const k = (i + 2) % 3;\n\n const root = Math.sqrt(m[i * 4 + i] - m[j * 4 + j] - m[k * 4 + k] + 1.0);\n dst[i] = 0.5 * root;\n\n const invRoot = 0.5 / root;\n\n dst[3] = (m[j * 4 + k] - m[k * 4 + j]) * invRoot;\n dst[j] = (m[j * 4 + i] + m[i * 4 + j]) * invRoot;\n dst[k] = (m[k * 4 + i] + m[i * 4 + k]) * invRoot;\n }\n\n return dst;\n}\n\n/**\n * Creates a quaternion from the given euler angle x, y, z using the provided intrinsic order for the conversion.\n *\n * @param xAngleInRadians - angle to rotate around X axis in radians.\n * @param yAngleInRadians - angle to rotate around Y axis in radians.\n * @param zAngleInRadians - angle to rotate around Z axis in radians.\n * @param order - order to apply euler angles\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion representing the same rotation as the euler angles applied in the given order\n */\nexport function fromEuler(\n xAngleInRadians: number,\n yAngleInRadians: number,\n zAngleInRadians: number,\n order: RotationOrder,\n dst?: Quat) {\n dst = dst || new QuatType(4);\n\n const xHalfAngle = xAngleInRadians * 0.5;\n const yHalfAngle = yAngleInRadians * 0.5;\n const zHalfAngle = zAngleInRadians * 0.5;\n\n const sx = Math.sin(xHalfAngle);\n const cx = Math.cos(xHalfAngle);\n const sy = Math.sin(yHalfAngle);\n const cy = Math.cos(yHalfAngle);\n const sz = Math.sin(zHalfAngle);\n const cz = Math.cos(zHalfAngle);\n\n switch (order) {\n case 'xyz':\n dst[0] = sx * cy * cz + cx * sy * sz;\n dst[1] = cx * sy * cz - sx * cy * sz;\n dst[2] = cx * cy * sz + sx * sy * cz;\n dst[3] = cx * cy * cz - sx * sy * sz;\n break;\n\n case 'xzy':\n dst[0] = sx * cy * cz - cx * sy * sz;\n dst[1] = cx * sy * cz - sx * cy * sz;\n dst[2] = cx * cy * sz + sx * sy * cz;\n dst[3] = cx * cy * cz + sx * sy * sz;\n break;\n\n case 'yxz':\n dst[0] = sx * cy * cz + cx * sy * sz;\n dst[1] = cx * sy * cz - sx * cy * sz;\n dst[2] = cx * cy * sz - sx * sy * cz;\n dst[3] = cx * cy * cz + sx * sy * sz;\n break;\n\n case 'yzx':\n dst[0] = sx * cy * cz + cx * sy * sz;\n dst[1] = cx * sy * cz + sx * cy * sz;\n dst[2] = cx * cy * sz - sx * sy * cz;\n dst[3] = cx * cy * cz - sx * sy * sz;\n break;\n\n case 'zxy':\n dst[0] = sx * cy * cz - cx * sy * sz;\n dst[1] = cx * sy * cz + sx * cy * sz;\n dst[2] = cx * cy * sz + sx * sy * cz;\n dst[3] = cx * cy * cz - sx * sy * sz;\n break;\n\n case 'zyx':\n dst[0] = sx * cy * cz - cx * sy * sz;\n dst[1] = cx * sy * cz + sx * cy * sz;\n dst[2] = cx * cy * sz - sx * sy * cz;\n dst[3] = cx * cy * cz + sx * sy * sz;\n break;\n\n default:\n throw new Error(`Unknown rotation order: ${order}`);\n }\n\n return dst;\n}\n\n/**\n * Copies a quaternion. (same as {@link quat.clone})\n * Also see {@link quat.create} and {@link quat.set}\n * @param q - The quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is a copy of q\n */\nexport function copy(q: Quat, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n dst[0] = q[0];\n dst[1] = q[1];\n dst[2] = q[2];\n dst[3] = q[3];\n\n return dst;\n}\n\n/**\n * Clones a quaternion. (same as {@link quat.copy})\n * Also see {@link quat.create} and {@link quat.set}\n * @param q - The quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A copy of q.\n */\nexport const clone = copy;\n\n/**\n * Adds two quaternions; assumes a and b have the same dimension.\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the sum of a and b.\n */\nexport function add(a: Quat, b: Quat, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n dst[0] = a[0] + b[0];\n dst[1] = a[1] + b[1];\n dst[2] = a[2] + b[2];\n dst[3] = a[3] + b[3];\n\n return dst;\n}\n\n/**\n * Subtracts two quaternions.\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the difference of a and b.\n */\nexport function subtract(a: Quat, b: Quat, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n dst[0] = a[0] - b[0];\n dst[1] = a[1] - b[1];\n dst[2] = a[2] - b[2];\n dst[3] = a[3] - b[3];\n\n return dst;\n}\n\n/**\n * Subtracts two quaternions.\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the difference of a and b.\n */\nexport const sub = subtract;\n\n/**\n * Multiplies a quaternion by a scalar.\n * @param v - The quaternion.\n * @param k - The scalar.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The scaled quaternion.\n */\nexport function mulScalar(v: Quat, k: number, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n dst[0] = v[0] * k;\n dst[1] = v[1] * k;\n dst[2] = v[2] * k;\n dst[3] = v[3] * k;\n\n return dst;\n}\n\n/**\n * Multiplies a quaternion by a scalar. (same as mulScalar)\n * @param v - The quaternion.\n * @param k - The scalar.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The scaled quaternion.\n */\nexport const scale = mulScalar;\n\n/**\n * Divides a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The scaled quaternion.\n */\nexport function divScalar(v: Quat, k: number, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n dst[0] = v[0] / k;\n dst[1] = v[1] / k;\n dst[2] = v[2] / k;\n dst[3] = v[3] / k;\n\n return dst;\n}\n\n/**\n * Computes the dot product of two quaternions\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @returns dot product\n */\nexport function dot(a: Quat, b: Quat): number {\n return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]) + (a[3] * b[3]);\n}\n\n/**\n * Performs linear interpolation on two quaternions.\n * Given quaternions a and b and interpolation coefficient t, returns\n * a + t * (b - a).\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @param t - Interpolation coefficient.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The linear interpolated result.\n */\nexport function lerp(a: Quat, b: Quat, t: number, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n dst[0] = a[0] + t * (b[0] - a[0]);\n dst[1] = a[1] + t * (b[1] - a[1]);\n dst[2] = a[2] + t * (b[2] - a[2]);\n dst[3] = a[3] + t * (b[3] - a[3]);\n\n return dst;\n}\n\n/**\n * Computes the length of quaternion\n * @param v - quaternion.\n * @returns length of quaternion.\n */\nexport function length(v: Quat): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n return Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3);\n}\n\n/**\n * Computes the length of quaternion (same as length)\n * @param v - quaternion.\n * @returns length of quaternion.\n */\nexport const len = length;\n\n/**\n * Computes the square of the length of quaternion\n * @param v - quaternion.\n * @returns square of the length of quaternion.\n */\nexport function lengthSq(v: Quat): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n return v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3;\n}\n\n/**\n * Computes the square of the length of quaternion (same as lengthSq)\n * @param v - quaternion.\n * @returns square of the length of quaternion.\n */\nexport const lenSq = lengthSq;\n\n/**\n * Divides a quaternion by its Euclidean length and returns the quotient.\n * @param v - The quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The normalized quaternion.\n */\nexport function normalize(v: Quat, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n const len = Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3);\n\n if (len > 0.00001) {\n dst[0] = v0 / len;\n dst[1] = v1 / len;\n dst[2] = v2 / len;\n dst[3] = v3 / len;\n } else {\n dst[0] = 0;\n dst[1] = 0;\n dst[2] = 0;\n dst[3] = 0;\n }\n\n return dst;\n}\n\n/**\n * Check if 2 quaternions are approximately equal\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @returns true if quaternions are approximately equal\n */\nexport function equalsApproximately(a: Quat, b: Quat): boolean {\n return Math.abs(a[0] - b[0]) < utils.EPSILON &&\n Math.abs(a[1] - b[1]) < utils.EPSILON &&\n Math.abs(a[2] - b[2]) < utils.EPSILON &&\n Math.abs(a[3] - b[3]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 quaternions are exactly equal\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @returns true if quaternions are exactly equal\n */\nexport function equals(a: Quat, b: Quat): boolean {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];\n}\n\n/**\n * Creates an identity quaternion\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns an identity quaternion\n */\nexport function identity(dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n dst[0] = 0;\n dst[1] = 0;\n dst[2] = 0;\n dst[3] = 1;\n\n return dst;\n}\n\nlet tempVec3: Vec3;\nlet xUnitVec3: Vec3;\nlet yUnitVec3: Vec3;\n\n/**\n * Computes a quaternion to represent the shortest rotation from one vector to another.\n *\n * @param aUnit - the start vector\n * @param bUnit - the end vector\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns the result\n */\nexport function rotationTo(aUnit: Vec3, bUnit: Vec3, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n tempVec3 = tempVec3 || vec3.create();\n xUnitVec3 = xUnitVec3 || vec3.create(1, 0, 0);\n yUnitVec3 = yUnitVec3 || vec3.create(0, 1, 0);\n\n const dot = vec3.dot(aUnit, bUnit);\n if (dot < -0.999999) {\n vec3.cross(xUnitVec3, aUnit, tempVec3);\n if (vec3.len(tempVec3) < 0.000001) {\n vec3.cross(yUnitVec3, aUnit, tempVec3);\n }\n\n vec3.normalize(tempVec3, tempVec3);\n fromAxisAngle(tempVec3, Math.PI, dst);\n\n return dst;\n } else if (dot > 0.999999) {\n dst[0] = 0;\n dst[1] = 0;\n dst[2] = 0;\n dst[3] = 1;\n\n return dst;\n } else {\n vec3.cross(aUnit, bUnit, tempVec3);\n\n dst[0] = tempVec3[0];\n dst[1] = tempVec3[1];\n dst[2] = tempVec3[2];\n dst[3] = 1 + dot;\n\n return normalize(dst, dst);\n }\n}\n\nlet tempQuat1: Quat;\nlet tempQuat2: Quat;\n\n/**\n * Performs a spherical linear interpolation with two control points\n *\n * @param a - the first quaternion\n * @param b - the second quaternion\n * @param c - the third quaternion\n * @param d - the fourth quaternion\n * @param t - Interpolation coefficient 0 to 1\n * @returns result\n */\nexport function sqlerp(\n a: Quat,\n b: Quat,\n c: Quat,\n d: Quat,\n t: number,\n dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n tempQuat1 = tempQuat1 || new QuatType(4);\n tempQuat2 = tempQuat2 || new QuatType(4);\n\n slerp(a, d, t, tempQuat1);\n slerp(b, c, t, tempQuat2);\n slerp(tempQuat1, tempQuat2, 2 * t * (1 - t), dst);\n\n return dst;\n}\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\n\n/**\n * A JavaScript array with 4 values, Float32Array with 4 values, or a Float64Array with 4 values.\n * When created by the library will create the default type which is `Float32Array`\n * but can be set by calling {@link vec4.setDefaultType}.\n */\nexport type Vec4 = number[] | Float32Array | Float64Array;\n\n/**\n *\n * Vec4 math functions.\n *\n * Almost all functions take an optional `dst` argument. If it is not passed in the\n * functions will create a new `Vec4`. In other words you can do this\n *\n * const v = vec4.cross(v1, v2); // Creates a new Vec4 with the cross product of v1 x v2.\n *\n * or\n *\n * const v = vec4.create();\n * vec4.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v\n *\n * The first style is often easier but depending on where it's used it generates garbage where\n * as there is almost never allocation with the second style.\n *\n * It is always safe to pass any vector as the destination. So for example\n *\n * vec4.cross(v1, v2, v1); // Puts the cross product of v1 x v2 in v1\n *\n */\n\nexport let VecType: new (n: number) => Vec4 = Float32Array;\n\n/**\n * Sets the type this library creates for a Vec4\n * @param ctor - the constructor for the type. Either `Float32Array`, `Float64Array`, or `Array`\n * @returns previous constructor for Vec4\n */\nexport function setDefaultType(ctor: new (n: number) => Vec4) {\n const oldType = VecType;\n VecType = ctor;\n return oldType;\n}\n\n/**\n * Creates a vec4; may be called with x, y, z to set initial values.\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @param w - Initial w value.\n * @returns the created vector\n */\nexport function create(x?: number, y?: number, z?: number, w?: number): Vec4 {\n const dst = new VecType(4);\n if (x !== undefined) {\n dst[0] = x;\n if (y !== undefined) {\n dst[1] = y;\n if (z !== undefined) {\n dst[2] = z;\n if (w !== undefined) {\n dst[3] = w;\n }\n }\n }\n }\n return dst;\n}","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport * as utils from './utils.js';\nimport { Vec4, create, setDefaultType, VecType } from './vec4';\nimport { Mat4 } from './mat4';\n\nexport default Vec4;\nexport { create, setDefaultType };\n\n/**\n * Creates a vec4; may be called with x, y, z to set initial values. (same as create)\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @param z - Initial w value.\n * @returns the created vector\n */\nexport const fromValues = create;\n\n/**\n * Sets the values of a Vec4\n * Also see {@link vec4.create} and {@link vec4.copy}\n *\n * @param x first value\n * @param y second value\n * @param z third value\n * @param w fourth value\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector with its elements set.\n */\nexport function set(x: number, y: number, z: number, w: number, dst?: Vec4) {\n dst = dst || new VecType(4);\n\n dst[0] = x;\n dst[1] = y;\n dst[2] = z;\n dst[3] = w;\n\n return dst;\n}\n\n/**\n * Applies Math.ceil to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the ceil of each element of v.\n */\nexport function ceil(v: Vec4, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = Math.ceil(v[0]);\n dst[1] = Math.ceil(v[1]);\n dst[2] = Math.ceil(v[2]);\n dst[3] = Math.ceil(v[3]);\n\n return dst;\n}\n\n/**\n * Applies Math.floor to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the floor of each element of v.\n */\nexport function floor(v: Vec4, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = Math.floor(v[0]);\n dst[1] = Math.floor(v[1]);\n dst[2] = Math.floor(v[2]);\n dst[3] = Math.floor(v[3]);\n\n return dst;\n}\n\n/**\n * Applies Math.round to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the round of each element of v.\n */\nexport function round(v: Vec4, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = Math.round(v[0]);\n dst[1] = Math.round(v[1]);\n dst[2] = Math.round(v[2]);\n dst[3] = Math.round(v[3]);\n\n return dst;\n}\n\n/**\n * Clamp each element of vector between min and max\n * @param v - Operand vector.\n * @param max - Min value, default 0\n * @param min - Max value, default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that the clamped value of each element of v.\n */\nexport function clamp(v: Vec4, min = 0, max = 1, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = Math.min(max, Math.max(min, v[0]));\n dst[1] = Math.min(max, Math.max(min, v[1]));\n dst[2] = Math.min(max, Math.max(min, v[2]));\n dst[3] = Math.min(max, Math.max(min, v[3]));\n\n return dst;\n}\n\n/**\n * Adds two vectors; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a and b.\n */\nexport function add(a: Vec4, b: Vec4, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = a[0] + b[0];\n dst[1] = a[1] + b[1];\n dst[2] = a[2] + b[2];\n dst[3] = a[3] + b[3];\n\n return dst;\n}\n\n/**\n * Adds two vectors, scaling the 2nd; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param scale - Amount to scale b\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a + b * scale.\n */\nexport function addScaled(a: Vec4, b: Vec4, scale: number, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = a[0] + b[0] * scale;\n dst[1] = a[1] + b[1] * scale;\n dst[2] = a[2] + b[2] * scale;\n dst[3] = a[3] + b[3] * scale;\n\n return dst;\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nexport function subtract(a: Vec4, b: Vec4, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = a[0] - b[0];\n dst[1] = a[1] - b[1];\n dst[2] = a[2] - b[2];\n dst[3] = a[3] - b[3];\n\n return dst;\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nexport const sub = subtract;\n\n/**\n * Check if 2 vectors are approximately equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are approximately equal\n */\nexport function equalsApproximately(a: Vec4, b: Vec4): boolean {\n return Math.abs(a[0] - b[0]) < utils.EPSILON &&\n Math.abs(a[1] - b[1]) < utils.EPSILON &&\n Math.abs(a[2] - b[2]) < utils.EPSILON &&\n Math.abs(a[3] - b[3]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 vectors are exactly equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are exactly equal\n */\nexport function equals(a: Vec4, b: Vec4): boolean {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficient.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The linear interpolated result.\n */\nexport function lerp(a: Vec4, b: Vec4, t: number, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = a[0] + t * (b[0] - a[0]);\n dst[1] = a[1] + t * (b[1] - a[1]);\n dst[2] = a[2] + t * (b[2] - a[2]);\n dst[3] = a[3] + t * (b[3] - a[3]);\n\n return dst;\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient vector t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficients vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns the linear interpolated result.\n */\nexport function lerpV(a: Vec4, b: Vec4, t: Vec4, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = a[0] + t[0] * (b[0] - a[0]);\n dst[1] = a[1] + t[1] * (b[1] - a[1]);\n dst[2] = a[2] + t[2] * (b[2] - a[2]);\n dst[3] = a[3] + t[3] * (b[3] - a[3]);\n\n return dst;\n}\n\n/**\n * Return max values of two vectors.\n * Given vectors a and b returns\n * [max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The max components vector.\n */\nexport function max(a: Vec4, b: Vec4, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = Math.max(a[0], b[0]);\n dst[1] = Math.max(a[1], b[1]);\n dst[2] = Math.max(a[2], b[2]);\n dst[3] = Math.max(a[3], b[3]);\n\n return dst;\n}\n\n/**\n * Return min values of two vectors.\n * Given vectors a and b returns\n * [min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The min components vector.\n */\nexport function min(a: Vec4, b: Vec4, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = Math.min(a[0], b[0]);\n dst[1] = Math.min(a[1], b[1]);\n dst[2] = Math.min(a[2], b[2]);\n dst[3] = Math.min(a[3], b[3]);\n\n return dst;\n}\n\n/**\n * Multiplies a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nexport function mulScalar(v: Vec4, k: number, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = v[0] * k;\n dst[1] = v[1] * k;\n dst[2] = v[2] * k;\n dst[3] = v[3] * k;\n\n return dst;\n}\n\n/**\n * Multiplies a vector by a scalar. (same as mulScalar)\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nexport const scale = mulScalar;\n\n/**\n * Divides a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nexport function divScalar(v: Vec4, k: number, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = v[0] / k;\n dst[1] = v[1] / k;\n dst[2] = v[2] / k;\n dst[3] = v[3] / k;\n\n return dst;\n}\n\n/**\n * Inverse a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nexport function inverse(v: Vec4, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = 1 / v[0];\n dst[1] = 1 / v[1];\n dst[2] = 1 / v[2];\n dst[3] = 1 / v[3];\n\n return dst;\n}\n\n/**\n * Invert a vector. (same as inverse)\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nexport const invert = inverse;\n\n/**\n * Computes the dot product of two vectors\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns dot product\n */\nexport function dot(a: Vec4, b: Vec4): number {\n return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]) + (a[3] * b[3]);\n}\n\n/**\n * Computes the length of vector\n * @param v - vector.\n * @returns length of vector.\n */\nexport function length(v: Vec4): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n return Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3);\n}\n\n/**\n * Computes the length of vector (same as length)\n * @param v - vector.\n * @returns length of vector.\n */\nexport const len = length;\n\n/**\n * Computes the square of the length of vector\n * @param v - vector.\n * @returns square of the length of vector.\n */\nexport function lengthSq(v: Vec4): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n return v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3;\n}\n\n/**\n * Computes the square of the length of vector (same as lengthSq)\n * @param v - vector.\n * @returns square of the length of vector.\n */\nexport const lenSq = lengthSq;\n\n/**\n * Computes the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nexport function distance(a: Vec4, b: Vec4): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n const dz = a[2] - b[2];\n const dw = a[3] - b[3];\n return Math.sqrt(dx * dx + dy * dy + dz * dz + dw * dw);\n}\n\n/**\n * Computes the distance between 2 points (same as distance)\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nexport const dist = distance;\n\n/**\n * Computes the square of the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nexport function distanceSq(a: Vec4, b: Vec4): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n const dz = a[2] - b[2];\n const dw = a[3] - b[3];\n return dx * dx + dy * dy + dz * dz + dw * dw;\n}\n\n/**\n * Computes the square of the distance between 2 points (same as distanceSq)\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nexport const distSq = distanceSq;\n\n/**\n * Divides a vector by its Euclidean length and returns the quotient.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The normalized vector.\n */\nexport function normalize(v: Vec4, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n const len = Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3);\n\n if (len > 0.00001) {\n dst[0] = v0 / len;\n dst[1] = v1 / len;\n dst[2] = v2 / len;\n dst[3] = v3 / len;\n } else {\n dst[0] = 0;\n dst[1] = 0;\n dst[2] = 0;\n dst[3] = 0;\n }\n\n return dst;\n}\n\n/**\n * Negates a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns -v.\n */\nexport function negate(v: Vec4, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = -v[0];\n dst[1] = -v[1];\n dst[2] = -v[2];\n dst[3] = -v[3];\n\n return dst;\n}\n\n/**\n * Copies a vector. (same as {@link vec4.clone})\n * Also see {@link vec4.create} and {@link vec4.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nexport function copy(v: Vec4, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = v[0];\n dst[1] = v[1];\n dst[2] = v[2];\n dst[3] = v[3];\n\n return dst;\n}\n\n/**\n * Clones a vector. (same as {@link vec4.copy})\n * Also see {@link vec4.create} and {@link vec4.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nexport const clone = copy;\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nexport function multiply(a: Vec4, b: Vec4, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = a[0] * b[0];\n dst[1] = a[1] * b[1];\n dst[2] = a[2] * b[2];\n dst[3] = a[3] * b[3];\n\n return dst;\n}\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as mul)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nexport const mul = multiply;\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nexport function divide(a: Vec4, b: Vec4, dst?: Vec4) {\n dst = dst || new VecType(4);\n\n dst[0] = a[0] / b[0];\n dst[1] = a[1] / b[1];\n dst[2] = a[2] / b[2];\n dst[3] = a[3] / b[3];\n\n return dst;\n}\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as divide)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nexport const div = divide;\n\n/**\n * Zero's a vector\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The zeroed vector.\n */\nexport function zero(dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = 0;\n dst[1] = 0;\n dst[2] = 0;\n dst[3] = 0;\n\n return dst;\n}\n\n\n/**\n * transform vec4 by 4x4 matrix\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional vec4 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nexport function transformMat4(v: Vec4, m: Mat4, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n const x = v[0];\n const y = v[1];\n const z = v[2];\n const w = v[3];\n\n dst[0] = m[0] * x + m[4] * y + m[ 8] * z + m[12] * w;\n dst[1] = m[1] * x + m[5] * y + m[ 9] * z + m[13] * w;\n dst[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;\n dst[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;\n\n return dst;\n}\n\n\n/**\n * Treat a 4D vector as a direction and set it's length\n *\n * @param a The vec4 to lengthen\n * @param len The length of the resulting vector\n * @returns The lengthened vector\n */\nexport function setLength(a: Vec4, len: number, dst?: Vec4) {\n dst = dst || new VecType(4);\n normalize(a, dst);\n return mulScalar(dst, len, dst);\n}\n\n/**\n * Ensure a vector is not longer than a max length\n *\n * @param a The vec4 to limit\n * @param maxLen The longest length of the resulting vector\n * @returns The vector, shortened to maxLen if it's too long\n */\nexport function truncate(a: Vec4, maxLen: number, dst?: Vec4) {\n dst = dst || new VecType(4);\n\n if (length(a) > maxLen) {\n return setLength(a, maxLen, dst);\n }\n\n return copy(a, dst);\n}\n\n/**\n * Return the vector exactly between 2 endpoint vectors\n *\n * @param a Endpoint 1\n * @param b Endpoint 2\n * @returns The vector exactly residing between endpoints 1 and 2\n */\nexport function midpoint(a: Vec4, b: Vec4, dst?: Vec4) {\n dst = dst || new VecType(4);\n return lerp(a, b, 0.5, dst);\n}\n","import Mat3, * as mat3 from './mat3-impl';\nimport Mat4, * as mat4 from './mat4-impl';\nimport Quat, * as quat from './quat-impl';\nimport Vec2, * as vec2 from './vec2-impl';\nimport Vec3, * as vec3 from './vec3-impl';\nimport Vec4, * as vec4 from './vec4-impl';\nimport * as utils from './utils';\n\n/**\n * Sets the type this library creates for all types\n *\n * example:\n *\n * ```\n * setDefaultType(Float64Array);\n * ```\n *\n * @param ctor - the constructor for the type. Either `Float32Array`, `Float64Array`, or `Array`\n */\nexport function setDefaultType(ctor: new (n: number) => Float32Array | Float64Array | number[]) {\n mat3.setDefaultType(ctor);\n mat4.setDefaultType(ctor);\n quat.setDefaultType(ctor);\n vec2.setDefaultType(ctor);\n vec3.setDefaultType(ctor);\n vec4.setDefaultType(ctor);\n}\n\nexport {\n Mat3,\n mat3,\n Mat4,\n mat4,\n Quat,\n quat,\n utils,\n Vec2,\n vec2,\n Vec3,\n vec3,\n Vec4,\n vec4,\n};"],"names":["lerp","VecType","setDefaultType","create","fromValues","set","ceil","floor","round","clamp","add","addScaled","angle","dot","subtract","sub","equalsApproximately","utils.EPSILON","equals","lerpV","max","min","mulScalar","scale","divScalar","inverse","invert","cross","Vec3Type","length","len","lengthSq","lenSq","distance","dist","distanceSq","distSq","normalize","negate","copy","clone","multiply","mul","divide","div","random","zero","transformMat4","transformMat3","rotate","setLength","truncate","midpoint","MatType","fromQuat","identity","transpose","determinant","setTranslation","getTranslation","vec2.create","getAxis","setAxis","getScaling","translation","translate","rotation","scaling","uniformScaling","uniformScale","rotateX","rotateY","rotateZ","vec3.create","vec3.normalize","vec3.subtract","vec3.cross","vec3.dot","vec3.len","mat3.setDefaultType","mat4.setDefaultType","quat.setDefaultType","vec2.setDefaultType","vec3.setDefaultType","vec4.setDefaultType"],"mappings":";;;;;;;IAAA;;;;;;;;;;;;;;;;;;;;IAoBG;IAEI,IAAI,OAAO,GAAG,QAAQ,CAAC;IAE9B;;;;IAIG;IACG,SAAU,UAAU,CAAC,CAAS,EAAA;QAClC,MAAM,GAAG,GAAG,OAAO,CAAC;QACpB,OAAO,GAAG,CAAC,CAAC;IACZ,IAAA,OAAO,GAAG,CAAC;IACb,CAAC;IAED;;;;IAIG;IACG,SAAU,QAAQ,CAAC,OAAe,EAAA;IACtC,IAAA,OAAO,O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AAmB,CAAC,IAAI,CAAC,CAAC;IAC1B,IAAAC,gBAAmB,CAAC,IAAI,CAAC,CAAC;IAC1B,IAAAC,gBAAmB,CAAC,IAAI,CAAC,CAAC;IAC5B;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/2.x/wgpu-matrix.min.js b/dist/2.x/wgpu-matrix.min.js deleted file mode 100644 index 27518d3..0000000 --- a/dist/2.x/wgpu-matrix.min.js +++ /dev/null @@ -1,2 +0,0 @@ -!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((n="undefined"!=typeof globalThis?globalThis:n||self).wgpuMatrix={})}(this,(function(n){"use strict";let t=1e-6;var r={__proto__:null,get EPSILON(){return t},degToRad:function(n){return n*Math.PI/180},euclideanModulo:function(n,t){return(n%t+t)%t},inverseLerp:function(n,r,e){const o=r-n;return Math.abs(r-n)1e-5?(t[0]=r/u,t[1]=o/u):(t[0]=0,t[1]=0),t}function b(n,t){return(t=t||new e(2))[0]=n[0],t[1]=n[1],t}function q(n,t,r){return(r=r||new e(2))[0]=n[0]*t[0],r[1]=n[1]*t[1],r}function y(n,t,r){return(r=r||new e(2))[0]=n[0]/t[0],r[1]=n[1]/t[1],r}function x(n,t,r){return p(n,r=r||new e(2)),h(r,t,r)}var g={__proto__:null,add:function(n,t,r){return(r=r||new e(2))[0]=n[0]+t[0],r[1]=n[1]+t[1],r},addScaled:function(n,t,r,o){return(o=o||new e(2))[0]=n[0]+t[0]*r,o[1]=n[1]+t[1]*r,o},angle:function(n,t){const r=n[0],e=n[1],o=t[0],u=t[1],a=Math.sqrt(r*r+e*e)*Math.sqrt(o*o+u*u),i=a&&M(n,t)/a;return Math.acos(i)},ceil:function(n,t){return(t=t||new e(2))[0]=Math.ceil(n[0]),t[1]=Math.ceil(n[1]),t},clamp:function(n,t=0,r=1,o){return(o=o||new e(2))[0]=Math.min(r,Math.max(t,n[0])),o[1]=Math.min(r,Math.max(t,n[1])),o},clone:b,copy:b,create:u,cross:function(n,t,r){r=r||new a(3);const e=n[0]*t[1]-n[1]*t[0];return r[0]=0,r[1]=0,r[2]=e,r},dist:m,distSq:v,distance:m,distanceSq:v,div:y,divScalar:function(n,t,r){return(r=r||new e(2))[0]=n[0]/t,r[1]=n[1]/t,r},divide:y,dot:M,equals:function(n,t){return n[0]===t[0]&&n[1]===t[1]},equalsApproximately:function(n,r){return Math.abs(n[0]-r[0])t?x(n,t,r):b(n,r)},zero:function(n){return(n=n||new e(2))[0]=0,n[1]=0,n}};let S=Float32Array;const A=new Map([[Float32Array,()=>new Float32Array(12)],[Float64Array,()=>new Float64Array(12)],[Array,()=>new Array(12).fill(0)]]);let _=A.get(Float32Array);function T(n){const t=S;return S=n,_=A.get(n),t}function z(n,t){return(t=t||_())[0]=n[0],t[1]=n[1],t[2]=n[2],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[8]=n[8],t[9]=n[9],t[10]=n[10],t}function F(n){return(n=n||_())[0]=1,n[1]=0,n[2]=0,n[4]=0,n[5]=1,n[6]=0,n[8]=0,n[9]=0,n[10]=1,n}function k(n,t){t=t||_();const r=n[0],e=n[1],o=n[2],u=n[4],a=n[5],i=n[6],c=n[8],s=n[9],f=n[10],h=f*a-i*s,l=-f*u+i*c,M=s*u-a*c,w=1/(r*h+e*l+o*M);return t[0]=h*w,t[1]=(-f*e+o*s)*w,t[2]=(i*e-o*a)*w,t[4]=l*w,t[5]=(f*r-o*c)*w,t[6]=(-i*r+o*u)*w,t[8]=M*w,t[9]=(-s*r+e*c)*w,t[10]=(a*r-e*u)*w,t}function D(n,t,r){r=r||_();const e=n[0],o=n[1],u=n[2],a=n[4],i=n[5],c=n[6],s=n[8],f=n[9],h=n[10],l=t[0],M=t[1],w=t[2],d=t[4],m=t[5],v=t[6],p=t[8],b=t[9],q=t[10];return r[0]=e*l+a*M+s*w,r[1]=o*l+i*M+f*w,r[2]=u*l+c*M+h*w,r[4]=e*d+a*m+s*v,r[5]=o*d+i*m+f*v,r[6]=u*d+c*m+h*v,r[8]=e*p+a*b+s*q,r[9]=o*p+i*b+f*q,r[10]=u*p+c*b+h*q,r}var I={__proto__:null,clone:z,copy:z,create:function(n,t,r,e,o,u,a,i,c){const s=_();return s[3]=0,s[7]=0,s[11]=0,void 0!==n&&(s[0]=n,void 0!==t&&(s[1]=t,void 0!==r&&(s[2]=r,void 0!==e&&(s[4]=e,void 0!==o&&(s[5]=o,void 0!==u&&(s[6]=u,void 0!==a&&(s[8]=a,void 0!==i&&(s[9]=i,void 0!==c&&(s[10]=c))))))))),s},determinant:function(n){const t=n[0],r=n[1],e=n[2],o=n[4],u=n[5],a=n[6],i=n[8],c=n[9],s=n[10];return t*(u*s-c*a)-o*(r*s-c*e)+i*(r*a-u*e)},equals:function(n,t){return n[0]===t[0]&&n[1]===t[1]&&n[2]===t[2]&&n[4]===t[4]&&n[5]===t[5]&&n[6]===t[6]&&n[8]===t[8]&&n[9]===t[9]&&n[10]===t[10]},equalsApproximately:function(n,r){return Math.abs(n[0]-r[0])1e-5?(t[0]=r/u,t[1]=e/u,t[2]=o/u):(t[0]=0,t[1]=0,t[2]=0),t}function O(n,t){return(t=t||new a(3))[0]=n[0],t[1]=n[1],t[2]=n[2],t}function $(n,t,r){return(r=r||new a(3))[0]=n[0]*t[0],r[1]=n[1]*t[1],r[2]=n[2]*t[2],r}function B(n,t,r){return(r=r||new a(3))[0]=n[0]/t[0],r[1]=n[1]/t[1],r[2]=n[2]/t[2],r}function C(n,t,r){return U(n,r=r||new a(3)),Z(r,t,r)}var G={__proto__:null,add:function(n,t,r){return(r=r||new a(3))[0]=n[0]+t[0],r[1]=n[1]+t[1],r[2]=n[2]+t[2],r},addScaled:function(n,t,r,e){return(e=e||new a(3))[0]=n[0]+t[0]*r,e[1]=n[1]+t[1]*r,e[2]=n[2]+t[2]*r,e},angle:function(n,t){const r=n[0],e=n[1],o=n[2],u=t[0],a=t[1],i=t[2],c=Math.sqrt(r*r+e*e+o*o)*Math.sqrt(u*u+a*a+i*i),s=c&&E(n,t)/c;return Math.acos(s)},ceil:function(n,t){return(t=t||new a(3))[0]=Math.ceil(n[0]),t[1]=Math.ceil(n[1]),t[2]=Math.ceil(n[2]),t},clamp:function(n,t=0,r=1,e){return(e=e||new a(3))[0]=Math.min(r,Math.max(t,n[0])),e[1]=Math.min(r,Math.max(t,n[1])),e[2]=Math.min(r,Math.max(t,n[2])),e},clone:O,copy:O,create:c,cross:R,dist:j,distSq:N,distance:j,distanceSq:N,div:B,divScalar:function(n,t,r){return(r=r||new a(3))[0]=n[0]/t,r[1]=n[1]/t,r[2]=n[2]/t,r},divide:B,dot:E,equals:function(n,t){return n[0]===t[0]&&n[1]===t[1]&&n[2]===t[2]},equalsApproximately:function(n,r){return Math.abs(n[0]-r[0])t?C(n,t,r):O(n,r)},zero:function(n){return(n=n||new a(3))[0]=0,n[1]=0,n[2]=0,n}};let H=Float32Array;function J(n){const t=H;return H=n,t}function K(n,t){return(t=t||new H(16))[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],t}function W(n){return(n=n||new H(16))[0]=1,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=1,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=1,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,n}function nn(n,t){t=t||new H(16);const r=n[0],e=n[1],o=n[2],u=n[3],a=n[4],i=n[5],c=n[6],s=n[7],f=n[8],h=n[9],l=n[10],M=n[11],w=n[12],d=n[13],m=n[14],v=n[15],p=l*v,b=m*M,q=c*v,y=m*s,x=c*M,g=l*s,S=o*v,A=m*u,_=o*M,T=l*u,z=o*s,F=c*u,k=f*d,D=w*h,I=a*d,P=w*i,V=a*h,Z=f*i,L=r*d,R=w*e,E=r*h,X=f*e,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r[10]=u*T+s*z+M*F+v*k,r[11]=a*T+f*z+w*F+p*k,r[12]=e*D+i*I+h*P+d*V,r[13]=o*D+c*I+l*P+m*V,r[14]=u*D+s*I+M*P+v*V,r[15]=a*D+f*I+w*P+p*V,r}let rn,en,on;function un(n,t,r){r=r||new H(16);let e=n[0],o=n[1],u=n[2];const a=Math.sqrt(e*e+o*o+u*u);e/=a,o/=a,u/=a;const i=e*e,c=o*o,s=u*u,f=Math.cos(t),h=Math.sin(t),l=1-f;return r[0]=i+(1-i)*f,r[1]=e*o*l+u*h,r[2]=e*u*l-o*h,r[3]=0,r[4]=e*o*l-u*h,r[5]=c+(1-c)*f,r[6]=o*u*l+e*h,r[7]=0,r[8]=e*u*l+o*h,r[9]=o*u*l-e*h,r[10]=s+(1-s)*f,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function an(n,t,r,e){e=e||new H(16);let o=t[0],u=t[1],a=t[2];const i=Math.sqrt(o*o+u*u+a*a);o/=i,u/=i,a/=i;const c=o*o,s=u*u,f=a*a,h=Math.cos(r),l=Math.sin(r),M=1-h,w=c+(1-c)*h,d=o*u*M+a*l,m=o*a*M-u*l,v=o*u*M-a*l,p=s+(1-s)*h,b=u*a*M+o*l,q=o*a*M+u*l,y=u*a*M-o*l,x=f+(1-f)*h,g=n[0],S=n[1],A=n[2],_=n[3],T=n[4],z=n[5],F=n[6],k=n[7],D=n[8],I=n[9],P=n[10],V=n[11];return e[0]=w*g+d*T+m*D,e[1]=w*S+d*z+m*I,e[2]=w*A+d*F+m*P,e[3]=w*_+d*k+m*V,e[4]=v*g+p*T+b*D,e[5]=v*S+p*z+b*I,e[6]=v*A+p*F+b*P,e[7]=v*_+p*k+b*V,e[8]=q*g+y*T+x*D,e[9]=q*S+y*z+x*I,e[10]=q*A+y*F+x*P,e[11]=q*_+y*k+x*V,n!==e&&(e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15]),e}var cn={__proto__:null,aim:function(n,t,r,e){return e=e||new H(16),rn=rn||c(),en=en||c(),on=on||c(),U(P(t,n,on),on),U(R(r,on,rn),rn),U(R(on,rn,en),en),e[0]=rn[0],e[1]=rn[1],e[2]=rn[2],e[3]=0,e[4]=en[0],e[5]=en[1],e[6]=en[2],e[7]=0,e[8]=on[0],e[9]=on[1],e[10]=on[2],e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e},axisRotate:an,axisRotation:un,cameraAim:function(n,t,r,e){return e=e||new H(16),rn=rn||c(),en=en||c(),on=on||c(),U(P(n,t,on),on),U(R(r,on,rn),rn),U(R(on,rn,en),en),e[0]=rn[0],e[1]=rn[1],e[2]=rn[2],e[3]=0,e[4]=en[0],e[5]=en[1],e[6]=en[2],e[7]=0,e[8]=on[0],e[9]=on[1],e[10]=on[2],e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e},clone:K,copy:K,create:function(n,t,r,e,o,u,a,i,c,s,f,h,l,M,w,d){const m=new H(16);return void 0!==n&&(m[0]=n,void 0!==t&&(m[1]=t,void 0!==r&&(m[2]=r,void 0!==e&&(m[3]=e,void 0!==o&&(m[4]=o,void 0!==u&&(m[5]=u,void 0!==a&&(m[6]=a,void 0!==i&&(m[7]=i,void 0!==c&&(m[8]=c,void 0!==s&&(m[9]=s,void 0!==f&&(m[10]=f,void 0!==h&&(m[11]=h,void 0!==l&&(m[12]=l,void 0!==M&&(m[13]=M,void 0!==w&&(m[14]=w,void 0!==d&&(m[15]=d)))))))))))))))),m},determinant:function(n){const t=n[0],r=n[1],e=n[2],o=n[3],u=n[4],a=n[5],i=n[6],c=n[7],s=n[8],f=n[9],h=n[10],l=n[11],M=n[12],w=n[13],d=n[14],m=n[15],v=h*m,p=d*l,b=i*m,q=d*c,y=i*l,x=h*c,g=e*m,S=d*o,A=e*l,_=h*o,T=e*c,z=i*o;return t*(v*a+q*f+y*w-(p*a+b*f+x*w))+u*(p*r+g*f+_*w-(v*r+S*f+A*w))+s*(b*r+S*a+T*w-(q*r+g*a+z*w))+M*(x*r+A*a+z*f-(y*r+_*a+T*f))},equals:function(n,t){return n[0]===t[0]&&n[1]===t[1]&&n[2]===t[2]&&n[3]===t[3]&&n[4]===t[4]&&n[5]===t[5]&&n[6]===t[6]&&n[7]===t[7]&&n[8]===t[8]&&n[9]===t[9]&&n[10]===t[10]&&n[11]===t[11]&&n[12]===t[12]&&n[13]===t[13]&&n[14]===t[14]&&n[15]===t[15]},equalsApproximately:function(n,r){return Math.abs(n[0]-r[0])t){const n=Math.acos(d),t=Math.sin(n);s=Math.sin((1-e)*n)/t,f=Math.sin(e*n)/t}else s=1-e,f=e;return o[0]=s*u+f*h,o[1]=s*a+f*l,o[2]=s*i+f*M,o[3]=s*c+f*w,o}function dn(n,t){return(t=t||new sn(4))[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t}function mn(n,t,r){return(r=r||new sn(4))[0]=n[0]-t[0],r[1]=n[1]-t[1],r[2]=n[2]-t[2],r[3]=n[3]-t[3],r}function vn(n,t,r){return(r=r||new sn(4))[0]=n[0]*t,r[1]=n[1]*t,r[2]=n[2]*t,r[3]=n[3]*t,r}function pn(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]+n[3]*t[3]}function bn(n){const t=n[0],r=n[1],e=n[2],o=n[3];return Math.sqrt(t*t+r*r+e*e+o*o)}function qn(n){const t=n[0],r=n[1],e=n[2],o=n[3];return t*t+r*r+e*e+o*o}function yn(n,t){t=t||new sn(4);const r=n[0],e=n[1],o=n[2],u=n[3],a=Math.sqrt(r*r+e*e+o*o+u*u);return a>1e-5?(t[0]=r/a,t[1]=e/a,t[2]=o/a,t[3]=u/a):(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}let xn,gn,Sn,An,_n;var Tn={__proto__:null,add:function(n,t,r){return(r=r||new sn(4))[0]=n[0]+t[0],r[1]=n[1]+t[1],r[2]=n[2]+t[2],r[3]=n[3]+t[3],r},angle:function(n,t){const r=pn(n,t);return Math.acos(2*r*r-1)},clone:dn,conjugate:function(n,t){return(t=t||new sn(4))[0]=-n[0],t[1]=-n[1],t[2]=-n[2],t[3]=n[3],t},copy:dn,create:hn,divScalar:function(n,t,r){return(r=r||new sn(4))[0]=n[0]/t,r[1]=n[1]/t,r[2]=n[2]/t,r[3]=n[3]/t,r},dot:pn,equals:function(n,t){return n[0]===t[0]&&n[1]===t[1]&&n[2]===t[2]&&n[3]===t[3]},equalsApproximately:function(n,r){return Math.abs(n[0]-r[0])0){const e=Math.sqrt(r+1);t[3]=.5*e;const o=.5/e;t[0]=(n[6]-n[9])*o,t[1]=(n[8]-n[2])*o,t[2]=(n[1]-n[4])*o}else{let r=0;n[5]>n[0]&&(r=1),n[10]>n[4*r+r]&&(r=2);const e=(r+1)%3,o=(r+2)%3,u=Math.sqrt(n[4*r+r]-n[4*e+e]-n[4*o+o]+1);t[r]=.5*u;const a=.5/u;t[3]=(n[4*e+o]-n[4*o+e])*a,t[e]=(n[4*e+r]+n[4*r+e])*a,t[o]=(n[4*o+r]+n[4*r+o])*a}return t},fromValues:hn,identity:function(n){return(n=n||new sn(4))[0]=0,n[1]=0,n[2]=0,n[3]=1,n},inverse:function(n,t){t=t||new sn(4);const r=n[0],e=n[1],o=n[2],u=n[3],a=r*r+e*e+o*o+u*u,i=a?1/a:0;return t[0]=-r*i,t[1]=-e*i,t[2]=-o*i,t[3]=u*i,t},len:bn,lenSq:qn,length:bn,lengthSq:qn,lerp:function(n,t,r,e){return(e=e||new sn(4))[0]=n[0]+r*(t[0]-n[0]),e[1]=n[1]+r*(t[1]-n[1]),e[2]=n[2]+r*(t[2]-n[2]),e[3]=n[3]+r*(t[3]-n[3]),e},mul:Mn,mulScalar:vn,multiply:Mn,normalize:yn,rotateX:function(n,t,r){r=r||new sn(4);const e=.5*t,o=n[0],u=n[1],a=n[2],i=n[3],c=Math.sin(e),s=Math.cos(e);return r[0]=o*s+i*c,r[1]=u*s+a*c,r[2]=a*s-u*c,r[3]=i*s-o*c,r},rotateY:function(n,t,r){r=r||new sn(4);const e=.5*t,o=n[0],u=n[1],a=n[2],i=n[3],c=Math.sin(e),s=Math.cos(e);return r[0]=o*s-a*c,r[1]=u*s+i*c,r[2]=a*s+o*c,r[3]=i*s-u*c,r},rotateZ:function(n,t,r){r=r||new sn(4);const e=.5*t,o=n[0],u=n[1],a=n[2],i=n[3],c=Math.sin(e),s=Math.cos(e);return r[0]=o*s+u*c,r[1]=u*s-o*c,r[2]=a*s+i*c,r[3]=i*s-a*c,r},rotationTo:function(n,t,r){r=r||new sn(4),xn=xn||c(),gn=gn||c(1,0,0),Sn=Sn||c(0,1,0);const e=E(n,t);return e<-.999999?(R(gn,n,xn),Y(xn)<1e-6&&R(Sn,n,xn),U(xn,xn),ln(xn,Math.PI,r),r):e>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(R(n,t,xn),r[0]=xn[0],r[1]=xn[1],r[2]=xn[2],r[3]=1+e,yn(r,r))},scale:vn,set:function(n,t,r,e,o){return(o=o||new sn(4))[0]=n,o[1]=t,o[2]=r,o[3]=e,o},setDefaultType:fn,slerp:wn,sqlerp:function(n,t,r,e,o,u){return u=u||new sn(4),An=An||new sn(4),_n=_n||new sn(4),wn(n,e,o,An),wn(t,r,o,_n),wn(An,_n,2*o*(1-o),u),u},sub:mn,subtract:mn,toAxisAngle:function(n,r){r=r||c(4);const e=2*Math.acos(n[3]),o=Math.sin(.5*e);return o>t?(r[0]=n[0]/o,r[1]=n[1]/o,r[2]=n[2]/o):(r[0]=1,r[1]=0,r[2]=0),{angle:e,axis:r}}};let zn=Float32Array;function Fn(n){const t=zn;return zn=n,t}function kn(n,t,r,e){const o=new zn(4);return void 0!==n&&(o[0]=n,void 0!==t&&(o[1]=t,void 0!==r&&(o[2]=r,void 0!==e&&(o[3]=e)))),o}function Dn(n,t,r){return(r=r||new zn(4))[0]=n[0]-t[0],r[1]=n[1]-t[1],r[2]=n[2]-t[2],r[3]=n[3]-t[3],r}function In(n,t,r,e){return(e=e||new zn(4))[0]=n[0]+r*(t[0]-n[0]),e[1]=n[1]+r*(t[1]-n[1]),e[2]=n[2]+r*(t[2]-n[2]),e[3]=n[3]+r*(t[3]-n[3]),e}function Pn(n,t,r){return(r=r||new zn(4))[0]=n[0]*t,r[1]=n[1]*t,r[2]=n[2]*t,r[3]=n[3]*t,r}function Vn(n,t){return(t=t||new zn(4))[0]=1/n[0],t[1]=1/n[1],t[2]=1/n[2],t[3]=1/n[3],t}function Zn(n){const t=n[0],r=n[1],e=n[2],o=n[3];return Math.sqrt(t*t+r*r+e*e+o*o)}function Ln(n){const t=n[0],r=n[1],e=n[2],o=n[3];return t*t+r*r+e*e+o*o}function Rn(n,t){const r=n[0]-t[0],e=n[1]-t[1],o=n[2]-t[2],u=n[3]-t[3];return Math.sqrt(r*r+e*e+o*o+u*u)}function En(n,t){const r=n[0]-t[0],e=n[1]-t[1],o=n[2]-t[2],u=n[3]-t[3];return r*r+e*e+o*o+u*u}function Xn(n,t){t=t||new zn(4);const r=n[0],e=n[1],o=n[2],u=n[3],a=Math.sqrt(r*r+e*e+o*o+u*u);return a>1e-5?(t[0]=r/a,t[1]=e/a,t[2]=o/a,t[3]=u/a):(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function Yn(n,t){return(t=t||new zn(4))[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t}function Qn(n,t,r){return(r=r||new zn(4))[0]=n[0]*t[0],r[1]=n[1]*t[1],r[2]=n[2]*t[2],r[3]=n[3]*t[3],r}function jn(n,t,r){return(r=r||new zn(4))[0]=n[0]/t[0],r[1]=n[1]/t[1],r[2]=n[2]/t[2],r[3]=n[3]/t[3],r}function Nn(n,t,r){return Xn(n,r=r||new zn(4)),Pn(r,t,r)}var Un={__proto__:null,add:function(n,t,r){return(r=r||new zn(4))[0]=n[0]+t[0],r[1]=n[1]+t[1],r[2]=n[2]+t[2],r[3]=n[3]+t[3],r},addScaled:function(n,t,r,e){return(e=e||new zn(4))[0]=n[0]+t[0]*r,e[1]=n[1]+t[1]*r,e[2]=n[2]+t[2]*r,e[3]=n[3]+t[3]*r,e},ceil:function(n,t){return(t=t||new zn(4))[0]=Math.ceil(n[0]),t[1]=Math.ceil(n[1]),t[2]=Math.ceil(n[2]),t[3]=Math.ceil(n[3]),t},clamp:function(n,t=0,r=1,e){return(e=e||new zn(4))[0]=Math.min(r,Math.max(t,n[0])),e[1]=Math.min(r,Math.max(t,n[1])),e[2]=Math.min(r,Math.max(t,n[2])),e[3]=Math.min(r,Math.max(t,n[3])),e},clone:Yn,copy:Yn,create:kn,dist:Rn,distSq:En,distance:Rn,distanceSq:En,div:jn,divScalar:function(n,t,r){return(r=r||new zn(4))[0]=n[0]/t,r[1]=n[1]/t,r[2]=n[2]/t,r[3]=n[3]/t,r},divide:jn,dot:function(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]+n[3]*t[3]},equals:function(n,t){return n[0]===t[0]&&n[1]===t[1]&&n[2]===t[2]&&n[3]===t[3]},equalsApproximately:function(n,r){return Math.abs(n[0]-r[0])t?Nn(n,t,r):Yn(n,r)},zero:function(n){return(n=n||new zn(4))[0]=0,n[1]=0,n[2]=0,n[3]=0,n}};n.mat3=I,n.mat4=cn,n.quat=Tn,n.setDefaultType=function(n){T(n),J(n),fn(n),o(n),i(n),Fn(n)},n.utils=r,n.vec2=g,n.vec3=G,n.vec4=Un})); -//# sourceMappingURL=wgpu-matrix.min.js.map diff --git a/dist/2.x/wgpu-matrix.min.js.map b/dist/2.x/wgpu-matrix.min.js.map deleted file mode 100644 index 6ef0d74..0000000 --- a/dist/2.x/wgpu-matrix.min.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"wgpu-matrix.min.js","sources":["../../../src/utils.ts","../../../src/vec2.ts","../../../src/vec3.ts","../../../src/vec2-impl.ts","../../../src/mat3-impl.ts","../../../src/vec3-impl.ts","../../../src/mat4-impl.ts","../../../src/quat.ts","../../../src/quat-impl.ts","../../../src/vec4.ts","../../../src/vec4-impl.ts","../../../src/wgpu-matrix.ts"],"sourcesContent":["/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\n\nexport let EPSILON = 0.000001;\n\n/**\n * Set the value for EPSILON for various checks\n * @param v - Value to use for EPSILON.\n * @returns previous value of EPSILON;\n */\nexport function setEpsilon(v: number): number {\n const old = EPSILON;\n EPSILON = v;\n return old;\n}\n\n/**\n * Convert degrees to radians\n * @param degrees - Angle in degrees\n * @returns angle converted to radians\n */\nexport function degToRad(degrees: number): number {\n return degrees * Math.PI / 180;\n}\n\n/**\n * Convert radians to degrees\n * @param radians - Angle in radians\n * @returns angle converted to degrees\n */\nexport function radToDeg(radians: number): number {\n return radians * 180 / Math.PI;\n}\n\n/**\n * Lerps between a and b via t\n * @param a - starting value\n * @param b - ending value\n * @param t - value where 0 = a and 1 = b\n * @returns a + (b - a) * t\n */\nexport function lerp(a: number, b: number, t: number): number {\n return a + (b - a) * t;\n}\n\n/**\n * Compute the opposite of lerp. Given a and b and a value between\n * a and b returns a value between 0 and 1. 0 if a, 1 if b.\n * Note: no clamping is done.\n * @param a - start value\n * @param b - end value\n * @param v - value between a and b\n * @returns (v - a) / (b - a)\n */\nexport function inverseLerp(a: number, b: number, v: number): number {\n const d = b - a;\n return (Math.abs(b - a) < EPSILON)\n ? a\n : (v - a) / d;\n}\n\n/**\n * Compute the euclidean modulo\n *\n * ```\n * // table for n / 3\n * -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5 <- n\n * ------------------------------------\n * -2 -1 -0 -2 -1 0, 1, 2, 0, 1, 2 <- n % 3\n * 1 2 0 1 2 0, 1, 2, 0, 1, 2 <- euclideanModule(n, 3)\n * ```\n *\n * @param n - dividend\n * @param m - divisor\n * @returns the euclidean modulo of n / m\n */\nexport function euclideanModulo(n: number, m: number) {\n return ((n % m) + m) % m;\n}","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\n\n/**\n * A JavaScript array with 2 values, Float32Array with 2 values, or a Float64Array with 2 values.\n * When created by the library will create the default type which is `Float32Array`\n * but can be set by calling {@link vec2.setDefaultType}.\n */\nexport type Vec2 = number[] | Float32Array | Float64Array;\n\n/**\n *\n * Vec2 math functions.\n *\n * Almost all functions take an optional `dst` argument. If it is not passed in the\n * functions will create a new Vec2. In other words you can do this\n *\n * const v = vec2.cross(v1, v2); // Creates a new Vec2 with the cross product of v1 x v2.\n *\n * or\n *\n * const v = vec2.create();\n * vec2.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v\n *\n * The first style is often easier but depending on where it's used it generates garbage where\n * as there is almost never allocation with the second style.\n *\n * It is always safe to pass any vector as the destination. So for example\n *\n * vec2.cross(v1, v2, v1); // Puts the cross product of v1 x v2 in v1\n *\n */\n\nexport let VecType: new (n: number) => Vec2 = Float32Array;\n\n/**\n * Sets the type this library creates for a Vec2\n * @param ctor - the constructor for the type. Either `Float32Array`, `Float64Array`, or `Array`\n * @returns previous constructor for Vec2\n */\nexport function setDefaultType(ctor: new (n: number) => Vec2) {\n const oldType = VecType;\n VecType = ctor;\n return oldType;\n}\n\n/**\n * Creates a Vec2; may be called with x, y, z to set initial values.\n *\n * Note: Since passing in a raw JavaScript array\n * is valid in all circumstances, if you want to\n * force a JavaScript array into a Vec2's specified type\n * it would be faster to use\n *\n * ```\n * const v = vec2.clone(someJSArray);\n * ```\n *\n * Note: a consequence of the implementation is if your Vec2Type = `Array`\n * instead of `Float32Array` or `Float64Array` then any values you\n * don't pass in will be undefined. Usually this is not an issue since\n * (a) using `Array` is rare and (b) using `vec2.create` is usually used\n * to create a Vec2 to be filled out as in\n *\n * ```\n * const sum = vec2.create();\n * vec2.add(v1, v2, sum);\n * ```\n *\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @returns the created vector\n */\nexport function create(x = 0, y = 0): Vec2 {\n const dst = new VecType(2);\n if (x !== undefined) {\n dst[0] = x;\n if (y !== undefined) {\n dst[1] = y;\n }\n }\n return dst;\n}\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\n\n/**\n * A JavaScript array with 3 values, Float32Array with 3 values, or a Float64Array with 3 values.\n * When created by the library will create the default type which is `Float32Array`\n * but can be set by calling {@link vec3.setDefaultType}.\n */\nexport type Vec3 = number[] | Float32Array | Float64Array;\n\n/**\n *\n * Vec3 math functions.\n *\n * Almost all functions take an optional `dst` argument. If it is not passed in the\n * functions will create a new `Vec3`. In other words you can do this\n *\n * const v = vec3.cross(v1, v2); // Creates a new Vec3 with the cross product of v1 x v2.\n *\n * or\n *\n * const v = vec3.create();\n * vec3.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v\n *\n * The first style is often easier but depending on where it's used it generates garbage where\n * as there is almost never allocation with the second style.\n *\n * It is always safe to pass any vector as the destination. So for example\n *\n * vec3.cross(v1, v2, v1); // Puts the cross product of v1 x v2 in v1\n *\n */\n\nexport let VecType: new (n: number) => Vec3 = Float32Array;\n\n/**\n * Sets the type this library creates for a Vec3\n * @param ctor - the constructor for the type. Either `Float32Array`, `Float64Array`, or `Array`\n * @returns previous constructor for Vec3\n */\nexport function setDefaultType(ctor: new (n: number) => Vec3) {\n const oldType = VecType;\n VecType = ctor;\n return oldType;\n}\n\n/**\n * Creates a vec3; may be called with x, y, z to set initial values.\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @returns the created vector\n */\nexport function create(x?: number, y?: number, z?: number): Vec3 {\n const dst = new VecType(3);\n if (x !== undefined) {\n dst[0] = x;\n if (y !== undefined) {\n dst[1] = y;\n if (z !== undefined) {\n dst[2] = z;\n }\n }\n }\n return dst;\n}","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport * as utils from './utils.js';\nimport { Mat3 } from './mat3';\nimport { Mat4 } from './mat4';\nimport { Vec2, create, setDefaultType, VecType } from './vec2';\nimport { Vec3, VecType as Vec3Type } from './vec3';\n\nexport default Vec2;\nexport { create, setDefaultType };\n\n/**\n * Creates a Vec2; may be called with x, y, z to set initial values. (same as create)\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @returns the created vector\n */\nexport const fromValues = create;\n\n/**\n * Sets the values of a Vec2\n * Also see {@link vec2.create} and {@link vec2.copy}\n *\n * @param x first value\n * @param y second value\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector with its elements set.\n */\nexport function set(x: number, y: number, dst?: Vec2) {\n dst = dst || new VecType(2);\n\n dst[0] = x;\n dst[1] = y;\n\n return dst;\n}\n\n/**\n * Applies Math.ceil to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the ceil of each element of v.\n */\nexport function ceil(v: Vec2, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = Math.ceil(v[0]);\n dst[1] = Math.ceil(v[1]);\n\n return dst;\n}\n\n/**\n * Applies Math.floor to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the floor of each element of v.\n */\nexport function floor(v: Vec2, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = Math.floor(v[0]);\n dst[1] = Math.floor(v[1]);\n\n return dst;\n}\n\n/**\n * Applies Math.round to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the round of each element of v.\n */\nexport function round(v: Vec2, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = Math.round(v[0]);\n dst[1] = Math.round(v[1]);\n\n return dst;\n}\n\n/**\n * Clamp each element of vector between min and max\n * @param v - Operand vector.\n * @param max - Min value, default 0\n * @param min - Max value, default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that the clamped value of each element of v.\n */\nexport function clamp(v: Vec2, min = 0, max = 1, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = Math.min(max, Math.max(min, v[0]));\n dst[1] = Math.min(max, Math.max(min, v[1]));\n\n return dst;\n}\n\n/**\n * Adds two vectors; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a and b.\n */\nexport function add(a: Vec2, b: Vec2, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = a[0] + b[0];\n dst[1] = a[1] + b[1];\n\n return dst;\n}\n\n/**\n * Adds two vectors, scaling the 2nd; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param scale - Amount to scale b\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a + b * scale.\n */\nexport function addScaled(a: Vec2, b: Vec2, scale: number, dst?: Vec2) {\n dst = dst || new VecType(2);\n\n dst[0] = a[0] + b[0] * scale;\n dst[1] = a[1] + b[1] * scale;\n\n return dst;\n}\n\n/**\n * Returns the angle in radians between two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns The angle in radians between the 2 vectors.\n */\nexport function angle(a: Vec2, b: Vec2): number {\n const ax = a[0];\n const ay = a[1];\n const bx = b[0];\n const by = b[1];\n const mag1 = Math.sqrt(ax * ax + ay * ay);\n const mag2 = Math.sqrt(bx * bx + by * by);\n const mag = mag1 * mag2;\n const cosine = mag && dot(a, b) / mag;\n return Math.acos(cosine);\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nexport function subtract(a: Vec2, b: Vec2, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = a[0] - b[0];\n dst[1] = a[1] - b[1];\n\n return dst;\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nexport const sub = subtract;\n\n/**\n * Check if 2 vectors are approximately equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are approximately equal\n */\nexport function equalsApproximately(a: Vec2, b: Vec2): boolean {\n return Math.abs(a[0] - b[0]) < utils.EPSILON &&\n Math.abs(a[1] - b[1]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 vectors are exactly equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are exactly equal\n */\nexport function equals(a: Vec2, b: Vec2): boolean {\n return a[0] === b[0] && a[1] === b[1];\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficient.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The linear interpolated result.\n */\nexport function lerp(a: Vec2, b: Vec2, t: number, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = a[0] + t * (b[0] - a[0]);\n dst[1] = a[1] + t * (b[1] - a[1]);\n\n return dst;\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient vector t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficients vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns the linear interpolated result.\n */\nexport function lerpV(a: Vec2, b: Vec2, t: Vec2, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = a[0] + t[0] * (b[0] - a[0]);\n dst[1] = a[1] + t[1] * (b[1] - a[1]);\n\n return dst;\n}\n\n/**\n * Return max values of two vectors.\n * Given vectors a and b returns\n * [max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The max components vector.\n */\nexport function max(a: Vec2, b: Vec2, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = Math.max(a[0], b[0]);\n dst[1] = Math.max(a[1], b[1]);\n\n return dst;\n}\n\n/**\n * Return min values of two vectors.\n * Given vectors a and b returns\n * [min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The min components vector.\n */\nexport function min(a: Vec2, b: Vec2, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = Math.min(a[0], b[0]);\n dst[1] = Math.min(a[1], b[1]);\n\n return dst;\n}\n\n/**\n * Multiplies a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nexport function mulScalar(v: Vec2, k: number, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = v[0] * k;\n dst[1] = v[1] * k;\n\n return dst;\n}\n\n/**\n * Multiplies a vector by a scalar. (same as mulScalar)\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nexport const scale = mulScalar;\n\n/**\n * Divides a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nexport function divScalar(v: Vec2, k: number, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = v[0] / k;\n dst[1] = v[1] / k;\n\n return dst;\n}\n\n/**\n * Inverse a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nexport function inverse(v: Vec2, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = 1 / v[0];\n dst[1] = 1 / v[1];\n\n return dst;\n}\n\n/**\n * Invert a vector. (same as inverse)\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nexport const invert = inverse;\n\n/**\n * Computes the cross product of two vectors; assumes both vectors have\n * three entries.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of a cross b.\n */\nexport function cross(a: Vec2, b: Vec2, dst?: Vec3): Vec3 {\n dst = dst || new Vec3Type(3);\n const z = a[0] * b[1] - a[1] * b[0];\n dst[0] = 0;\n dst[1] = 0;\n dst[2] = z;\n\n return dst;\n}\n\n/**\n * Computes the dot product of two vectors; assumes both vectors have\n * three entries.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns dot product\n */\nexport function dot(a: Vec2, b: Vec2): number {\n return a[0] * b[0] + a[1] * b[1];\n}\n\n/**\n * Computes the length of vector\n * @param v - vector.\n * @returns length of vector.\n */\nexport function length(v: Vec2): number {\n const v0 = v[0];\n const v1 = v[1];\n return Math.sqrt(v0 * v0 + v1 * v1);\n}\n\n/**\n * Computes the length of vector (same as length)\n * @param v - vector.\n * @returns length of vector.\n */\nexport const len = length;\n\n/**\n * Computes the square of the length of vector\n * @param v - vector.\n * @returns square of the length of vector.\n */\nexport function lengthSq(v: Vec2): number {\n const v0 = v[0];\n const v1 = v[1];\n return v0 * v0 + v1 * v1;\n}\n\n/**\n * Computes the square of the length of vector (same as lengthSq)\n * @param v - vector.\n * @returns square of the length of vector.\n */\nexport const lenSq = lengthSq;\n\n/**\n * Computes the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nexport function distance(a: Vec2, b: Vec2): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n return Math.sqrt(dx * dx + dy * dy);\n}\n\n/**\n * Computes the distance between 2 points (same as distance)\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nexport const dist = distance;\n\n/**\n * Computes the square of the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nexport function distanceSq(a: Vec2, b: Vec2): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n return dx * dx + dy * dy;\n}\n\n/**\n * Computes the square of the distance between 2 points (same as distanceSq)\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nexport const distSq = distanceSq;\n\n/**\n * Divides a vector by its Euclidean length and returns the quotient.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The normalized vector.\n */\nexport function normalize(v: Vec2, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n const v0 = v[0];\n const v1 = v[1];\n const len = Math.sqrt(v0 * v0 + v1 * v1);\n\n if (len > 0.00001) {\n dst[0] = v0 / len;\n dst[1] = v1 / len;\n } else {\n dst[0] = 0;\n dst[1] = 0;\n }\n\n return dst;\n}\n\n/**\n * Negates a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns -v.\n */\nexport function negate(v: Vec2, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = -v[0];\n dst[1] = -v[1];\n\n return dst;\n}\n\n/**\n * Copies a vector. (same as {@link vec2.clone})\n * Also see {@link vec2.create} and {@link vec2.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nexport function copy(v: Vec2, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = v[0];\n dst[1] = v[1];\n\n return dst;\n}\n\n/**\n * Clones a vector. (same as {@link vec2.copy})\n * Also see {@link vec2.create} and {@link vec2.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nexport const clone = copy;\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nexport function multiply(a: Vec2, b: Vec2, dst?: Vec2) {\n dst = dst || new VecType(2);\n\n dst[0] = a[0] * b[0];\n dst[1] = a[1] * b[1];\n\n return dst;\n}\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as mul)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nexport const mul = multiply;\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nexport function divide(a: Vec2, b: Vec2, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = a[0] / b[0];\n dst[1] = a[1] / b[1];\n\n return dst;\n}\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as divide)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nexport const div = divide;\n\n/**\n * Creates a random unit vector * scale\n * @param scale - Default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The random vector.\n */\nexport function random(scale = 1, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n const angle = Math.random() * 2 * Math.PI;\n dst[0] = Math.cos(angle) * scale;\n dst[1] = Math.sin(angle) * scale;\n\n return dst;\n}\n\n/**\n * Zero's a vector\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The zeroed vector.\n */\nexport function zero(dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = 0;\n dst[1] = 0;\n\n return dst;\n}\n\n\n/**\n * transform Vec2 by 4x4 matrix\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional Vec2 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nexport function transformMat4(v: Vec2, m: Mat4, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n const x = v[0];\n const y = v[1];\n\n dst[0] = x * m[0] + y * m[4] + m[12];\n dst[1] = x * m[1] + y * m[5] + m[13];\n\n return dst;\n}\n\n/**\n * Transforms vec4 by 3x3 matrix\n *\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional Vec2 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nexport function transformMat3(v: Vec2, m: Mat3, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n const x = v[0];\n const y = v[1];\n\n dst[0] = m[0] * x + m[4] * y + m[8];\n dst[1] = m[1] * x + m[5] * y + m[9];\n\n return dst;\n}\n\n/**\n * Rotate a 2D vector\n *\n * @param a The vec2 point to rotate\n * @param b The origin of the rotation\n * @param rad The angle of rotation in radians\n * @returns the rotated vector\n */\nexport function rotate(a: Vec2, b: Vec2, rad: number, dst?: Vec2) {\n dst = dst || new VecType(2);\n\n // Translate point to the origin\n const p0 = a[0] - b[0];\n const p1 = a[1] - b[1];\n const sinC = Math.sin(rad);\n const cosC = Math.cos(rad);\n\n //perform rotation and translate to correct position\n dst[0] = p0 * cosC - p1 * sinC + b[0];\n dst[1] = p0 * sinC + p1 * cosC + b[1];\n\n return dst;\n}\n\n/**\n * Treat a 2D vector as a direction and set it's length\n *\n * @param a The vec2 to lengthen\n * @param len The length of the resulting vector\n * @returns The lengthened vector\n */\nexport function setLength(a: Vec2, len: number, dst?: Vec2) {\n dst = dst || new VecType(2);\n normalize(a, dst);\n return mulScalar(dst, len, dst);\n}\n\n/**\n * Ensure a vector is not longer than a max length\n *\n * @param a The vec2 to limit\n * @param maxLen The longest length of the resulting vector\n * @returns The vector, shortened to maxLen if it's too long\n */\nexport function truncate(a: Vec2, maxLen: number, dst?: Vec2) {\n dst = dst || new VecType(2);\n\n if (length(a) > maxLen) {\n return setLength(a, maxLen, dst);\n }\n\n return copy(a, dst);\n}\n\n/**\n * Return the vector exactly between 2 endpoint vectors\n *\n * @param a Endpoint 1\n * @param b Endpoint 2\n * @returns The vector exactly residing between endpoints 1 and 2\n */\nexport function midpoint(a: Vec2, b: Vec2, dst?: Vec2) {\n dst = dst || new VecType(2);\n return lerp(a, b, 0.5, dst);\n}\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\n\nimport * as utils from './utils.js';\nimport { Quat } from './quat';\nimport { Mat3 } from './mat3';\nimport { Mat4 } from './mat4';\nimport Vec2, * as vec2 from './vec2-impl';\n\nexport default Mat3;\n\nexport type Mat3LikeCtor = new (n: number) => Mat3;\n\n/**\n * 3x3 Matrix math math functions.\n *\n * Almost all functions take an optional `dst` argument. If it is not passed in the\n * functions will create a new matrix. In other words you can do this\n *\n * const mat = mat3.translation([1, 2, 3]); // Creates a new translation matrix\n *\n * or\n *\n * const mat = mat3.create();\n * mat3.translation([1, 2, 3], mat); // Puts translation matrix in mat.\n *\n * The first style is often easier but depending on where it's used it generates garbage where\n * as there is almost never allocation with the second style.\n *\n * It is always save to pass any matrix as the destination. So for example\n *\n * const mat = mat3.identity();\n * const trans = mat3.translation([1, 2, 3]);\n * mat3.multiply(mat, trans, mat); // Multiplies mat * trans and puts result in mat.\n *\n */\nlet MatType: Mat3LikeCtor = Float32Array;\n\n// This mess is because with Mat3 we have 3 unused elements.\n// For Float32Array and Float64Array that's not an issue\n// but for Array it's troublesome\nconst ctorMap = new Map Mat3>([\n [Float32Array, () => new Float32Array(12)],\n [Float64Array, () => new Float64Array(12)],\n [Array, () => new Array(12).fill(0)],\n]);\nlet newMat3: () => Mat3 = ctorMap.get(Float32Array)!;\n\n/**\n * Sets the type this library creates for a Mat3\n * @param ctor - the constructor for the type. Either `Float32Array`, `Float64Array`, or `Array`\n * @returns previous constructor for Mat3\n */\nexport function setDefaultType(ctor: new (n: number) => Mat3) {\n const oldType = MatType;\n MatType = ctor;\n newMat3 = ctorMap.get(ctor)!;\n return oldType;\n}\n\n/**\n * Create a Mat3 from values\n *\n * Note: Since passing in a raw JavaScript array\n * is valid in all circumstances, if you want to\n * force a JavaScript array into a Mat3's specified type\n * it would be faster to use\n *\n * ```\n * const m = mat3.clone(someJSArray);\n * ```\n *\n * Note: a consequence of the implementation is if your Mat3Type = `Array`\n * instead of `Float32Array` or `Float64Array` then any values you\n * don't pass in will be undefined. Usually this is not an issue since\n * (a) using `Array` is rare and (b) using `mat3.create` is usually used\n * to create a Mat3 to be filled out as in\n *\n * ```\n * const m = mat3.create();\n * mat3.perspective(fov, aspect, near, far, m);\n * ```\n *\n * @param v0 - value for element 0\n * @param v1 - value for element 1\n * @param v2 - value for element 2\n * @param v3 - value for element 3\n * @param v4 - value for element 4\n * @param v5 - value for element 5\n * @param v6 - value for element 6\n * @param v7 - value for element 7\n * @param v8 - value for element 8\n * @returns matrix created from values.\n */\nexport function create(\n v0?: number, v1?: number, v2?: number,\n v3?: number, v4?: number, v5?: number,\n v6?: number, v7?: number, v8?: number): Mat3 {\n const dst = newMat3();\n // to make the array homogenous\n dst[3] = 0;\n dst[7] = 0;\n dst[11] = 0;\n\n if (v0 !== undefined) {\n dst[0] = v0;\n if (v1 !== undefined) {\n dst[1] = v1;\n if (v2 !== undefined) {\n dst[2] = v2;\n if (v3 !== undefined) {\n dst[4] = v3;\n if (v4 !== undefined) {\n dst[5] = v4;\n if (v5 !== undefined) {\n dst[6] = v5;\n if (v6 !== undefined) {\n dst[8] = v6;\n if (v7 !== undefined) {\n dst[9] = v7;\n if (v8 !== undefined) {\n dst[10] = v8;\n }\n }\n }\n }\n }\n }\n }\n }\n }\n\n return dst;\n}\n\n/**\n * Sets the values of a Mat3\n * Also see {@link mat3.create} and {@link mat3.copy}\n *\n * @param v0 - value for element 0\n * @param v1 - value for element 1\n * @param v2 - value for element 2\n * @param v3 - value for element 3\n * @param v4 - value for element 4\n * @param v5 - value for element 5\n * @param v6 - value for element 6\n * @param v7 - value for element 7\n * @param v8 - value for element 8\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat3 set from values.\n */\nexport function set(\n v0: number, v1: number, v2: number,\n v3: number, v4: number, v5: number,\n v6: number, v7: number, v8: number, dst?: Mat3) {\n dst = dst || newMat3();\n\n dst[0] = v0; dst[1] = v1; dst[ 2] = v2; dst[ 3] = 0;\n dst[4] = v3; dst[5] = v4; dst[ 6] = v5; dst[ 7] = 0;\n dst[8] = v6; dst[9] = v7; dst[10] = v8; dst[11] = 0;\n\n return dst;\n}\n\n/**\n * Creates a Mat3 from the upper left 3x3 part of a Mat4\n * @param m4 - source matrix\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat3 made from m4\n */\nexport function fromMat4(m4: Mat4, dst?: Mat3): Mat3 {\n dst = dst || newMat3();\n dst[0] = m4[0]; dst[1] = m4[1]; dst[ 2] = m4[ 2]; dst[ 3] = 0;\n dst[4] = m4[4]; dst[5] = m4[5]; dst[ 6] = m4[ 6]; dst[ 7] = 0;\n dst[8] = m4[8]; dst[9] = m4[9]; dst[10] = m4[10]; dst[11] = 0;\n return dst;\n}\n\n/**\n * Creates a Mat3 rotation matrix from a quaternion\n * @param q - quaternion to create matrix from\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat3 made from q\n */\nexport function fromQuat(q: Quat, dst?: Mat3): Mat3 {\n dst = dst || newMat3();\n\n const x = q[0]; const y = q[1]; const z = q[2]; const w = q[3];\n const x2 = x + x; const y2 = y + y; const z2 = z + z;\n\n const xx = x * x2;\n const yx = y * x2;\n const yy = y * y2;\n const zx = z * x2;\n const zy = z * y2;\n const zz = z * z2;\n const wx = w * x2;\n const wy = w * y2;\n const wz = w * z2;\n\n dst[ 0] = 1 - yy - zz; dst[ 1] = yx + wz; dst[ 2] = zx - wy; dst[ 3] = 0;\n dst[ 4] = yx - wz; dst[ 5] = 1 - xx - zz; dst[ 6] = zy + wx; dst[ 7] = 0;\n dst[ 8] = zx + wy; dst[ 9] = zy - wx; dst[10] = 1 - xx - yy; dst[11] = 0;\n\n return dst;\n}\n\n/**\n * Negates a matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns -m.\n */\nexport function negate(m: Mat3, dst?: Mat3): Mat3 {\n dst = dst || newMat3();\n\n dst[ 0] = -m[ 0]; dst[ 1] = -m[ 1]; dst[ 2] = -m[ 2];\n dst[ 4] = -m[ 4]; dst[ 5] = -m[ 5]; dst[ 6] = -m[ 6];\n dst[ 8] = -m[ 8]; dst[ 9] = -m[ 9]; dst[10] = -m[10];\n\n return dst;\n}\n\n/**\n * Copies a matrix. (same as {@link mat3.clone})\n * Also see {@link mat3.create} and {@link mat3.set}\n * @param m - The matrix.\n * @param dst - The matrix. If not passed a new one is created.\n * @returns A copy of m.\n */\nexport function copy(m: Mat3, dst?: Mat3): Mat3 {\n dst = dst || newMat3();\n\n dst[ 0] = m[ 0]; dst[ 1] = m[ 1]; dst[ 2] = m[ 2];\n dst[ 4] = m[ 4]; dst[ 5] = m[ 5]; dst[ 6] = m[ 6];\n dst[ 8] = m[ 8]; dst[ 9] = m[ 9]; dst[10] = m[10];\n\n return dst;\n}\n\n/**\n * Copies a matrix (same as {@link mat3.copy})\n * Also see {@link mat3.create} and {@link mat3.set}\n * @param m - The matrix.\n * @param dst - The matrix. If not passed a new one is created.\n * @returns A copy of m.\n */\nexport const clone = copy;\n\n/**\n * Check if 2 matrices are approximately equal\n * @param a Operand matrix.\n * @param b Operand matrix.\n * @returns true if matrices are approximately equal\n */\nexport function equalsApproximately(a: Mat3, b: Mat3): boolean {\n return Math.abs(a[ 0] - b[ 0]) < utils.EPSILON &&\n Math.abs(a[ 1] - b[ 1]) < utils.EPSILON &&\n Math.abs(a[ 2] - b[ 2]) < utils.EPSILON &&\n Math.abs(a[ 4] - b[ 4]) < utils.EPSILON &&\n Math.abs(a[ 5] - b[ 5]) < utils.EPSILON &&\n Math.abs(a[ 6] - b[ 6]) < utils.EPSILON &&\n Math.abs(a[ 8] - b[ 8]) < utils.EPSILON &&\n Math.abs(a[ 9] - b[ 9]) < utils.EPSILON &&\n Math.abs(a[10] - b[10]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 matrices are exactly equal\n * @param a Operand matrix.\n * @param b Operand matrix.\n * @returns true if matrices are exactly equal\n */\nexport function equals(a: Mat3, b: Mat3): boolean {\n return a[ 0] === b[ 0] &&\n a[ 1] === b[ 1] &&\n a[ 2] === b[ 2] &&\n a[ 4] === b[ 4] &&\n a[ 5] === b[ 5] &&\n a[ 6] === b[ 6] &&\n a[ 8] === b[ 8] &&\n a[ 9] === b[ 9] &&\n a[10] === b[10];\n}\n\n/**\n * Creates a 3-by-3 identity matrix.\n *\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns A 3-by-3 identity matrix.\n */\nexport function identity(dst?: Mat3): Mat3 {\n dst = dst || newMat3();\n\n dst[ 0] = 1; dst[ 1] = 0; dst[ 2] = 0;\n dst[ 4] = 0; dst[ 5] = 1; dst[ 6] = 0;\n dst[ 8] = 0; dst[ 9] = 0; dst[10] = 1;\n\n return dst;\n}\n\n/**\n * Takes the transpose of a matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The transpose of m.\n */\nexport function transpose(m: Mat3, dst?: Mat3): Mat3 {\n dst = dst || newMat3();\n if (dst === m) {\n let t: number;\n\n // 0 1 2\n // 4 5 6\n // 8 9 10\n\n t = m[1];\n m[1] = m[4];\n m[4] = t;\n\n t = m[2];\n m[2] = m[8];\n m[8] = t;\n\n t = m[6];\n m[6] = m[9];\n m[9] = t;\n\n return dst;\n }\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n\n dst[ 0] = m00; dst[ 1] = m10; dst[ 2] = m20;\n dst[ 4] = m01; dst[ 5] = m11; dst[ 6] = m21;\n dst[ 8] = m02; dst[ 9] = m12; dst[10] = m22;\n\n return dst;\n}\n\n/**\n * Computes the inverse of a 3-by-3 matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The inverse of m.\n */\nexport function inverse(m: Mat3, dst?: Mat3): Mat3 {\n dst = dst || newMat3();\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n\n const b01 = m22 * m11 - m12 * m21;\n const b11 = -m22 * m10 + m12 * m20;\n const b21 = m21 * m10 - m11 * m20;\n\n const invDet = 1 / (m00 * b01 + m01 * b11 + m02 * b21);\n\n dst[ 0] = b01 * invDet;\n dst[ 1] = (-m22 * m01 + m02 * m21) * invDet;\n dst[ 2] = ( m12 * m01 - m02 * m11) * invDet;\n dst[ 4] = b11 * invDet;\n dst[ 5] = ( m22 * m00 - m02 * m20) * invDet;\n dst[ 6] = (-m12 * m00 + m02 * m10) * invDet;\n dst[ 8] = b21 * invDet;\n dst[ 9] = (-m21 * m00 + m01 * m20) * invDet;\n dst[10] = ( m11 * m00 - m01 * m10) * invDet;\n\n return dst;\n}\n\n/**\n * Compute the determinant of a matrix\n * @param m - the matrix\n * @returns the determinant\n */\nexport function determinant(m: Mat3): number {\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n\n return m00 * (m11 * m22 - m21 * m12) -\n m10 * (m01 * m22 - m21 * m02) +\n m20 * (m01 * m12 - m11 * m02);\n}\n\n/**\n * Computes the inverse of a 3-by-3 matrix. (same as inverse)\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The inverse of m.\n */\nexport const invert = inverse;\n\n/**\n * Multiplies two 3-by-3 matrices with a on the left and b on the right\n * @param a - The matrix on the left.\n * @param b - The matrix on the right.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix product of a and b.\n */\nexport function multiply(a: Mat3, b: Mat3, dst?: Mat3): Mat3 {\n dst = dst || newMat3();\n\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a10 = a[ 4 + 0];\n const a11 = a[ 4 + 1];\n const a12 = a[ 4 + 2];\n const a20 = a[ 8 + 0];\n const a21 = a[ 8 + 1];\n const a22 = a[ 8 + 2];\n const b00 = b[0];\n const b01 = b[1];\n const b02 = b[2];\n const b10 = b[ 4 + 0];\n const b11 = b[ 4 + 1];\n const b12 = b[ 4 + 2];\n const b20 = b[ 8 + 0];\n const b21 = b[ 8 + 1];\n const b22 = b[ 8 + 2];\n\n dst[ 0] = a00 * b00 + a10 * b01 + a20 * b02;\n dst[ 1] = a01 * b00 + a11 * b01 + a21 * b02;\n dst[ 2] = a02 * b00 + a12 * b01 + a22 * b02;\n dst[ 4] = a00 * b10 + a10 * b11 + a20 * b12;\n dst[ 5] = a01 * b10 + a11 * b11 + a21 * b12;\n dst[ 6] = a02 * b10 + a12 * b11 + a22 * b12;\n dst[ 8] = a00 * b20 + a10 * b21 + a20 * b22;\n dst[ 9] = a01 * b20 + a11 * b21 + a21 * b22;\n dst[10] = a02 * b20 + a12 * b21 + a22 * b22;\n\n return dst;\n}\n\n/**\n * Multiplies two 3-by-3 matrices with a on the left and b on the right (same as multiply)\n * @param a - The matrix on the left.\n * @param b - The matrix on the right.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix product of a and b.\n */\nexport const mul = multiply;\n\n/**\n * Sets the translation component of a 3-by-3 matrix to the given\n * vector.\n * @param a - The matrix.\n * @param v - The vector.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix with translation set.\n */\nexport function setTranslation(a: Mat3, v: Vec2, dst?: Mat3): Mat3 {\n dst = dst || identity();\n if (a !== dst) {\n dst[ 0] = a[ 0];\n dst[ 1] = a[ 1];\n dst[ 2] = a[ 2];\n dst[ 4] = a[ 4];\n dst[ 5] = a[ 5];\n dst[ 6] = a[ 6];\n }\n dst[ 8] = v[0];\n dst[ 9] = v[1];\n dst[10] = 1;\n return dst;\n}\n\n/**\n * Returns the translation component of a 3-by-3 matrix as a vector with 3\n * entries.\n * @param m - The matrix.\n * @param dst - vector to hold result. If not passed a new one is created.\n * @returns The translation component of m.\n */\nexport function getTranslation(m: Mat3, dst?: Vec2): Vec2 {\n dst = dst || vec2.create();\n dst[0] = m[8];\n dst[1] = m[9];\n return dst;\n}\n\n/**\n * Returns an axis of a 3x3 matrix as a vector with 2 entries\n * @param m - The matrix.\n * @param axis - The axis 0 = x, 1 = y,\n * @returns The axis component of m.\n */\nexport function getAxis(m: Mat3, axis: number, dst?: Vec2): Vec2 {\n dst = dst || vec2.create();\n const off = axis * 4;\n dst[0] = m[off + 0];\n dst[1] = m[off + 1];\n return dst;\n}\n\n/**\n * Sets an axis of a 3x3 matrix as a vector with 2 entries\n * @param m - The matrix.\n * @param v - the axis vector\n * @param axis - The axis 0 = x, 1 = y;\n * @param dst - The matrix to set. If not passed a new one is created.\n * @returns The matrix with axis set.\n */\nexport function setAxis(m: Mat3, v: Vec2, axis: number, dst?: Mat3): Mat3 {\n if (dst !== m) {\n dst = copy(m, dst);\n }\n const off = axis * 4;\n dst[off + 0] = v[0];\n dst[off + 1] = v[1];\n return dst;\n}\n\n/**\n * Returns the scaling component of the matrix\n * @param m - The Matrix\n * @param dst - The vector to set. If not passed a new one is created.\n */\nexport function getScaling(m: Mat3, dst?: Vec2): Vec2 {\n dst = dst || vec2.create();\n\n const xx = m[0];\n const xy = m[1];\n const yx = m[4];\n const yy = m[5];\n\n dst[0] = Math.sqrt(xx * xx + xy * xy);\n dst[1] = Math.sqrt(yx * yx + yy * yy);\n\n return dst;\n}\n\n/**\n * Creates a 3-by-3 matrix which translates by the given vector v.\n * @param v - The vector by which to translate.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The translation matrix.\n */\nexport function translation(v: Vec2, dst?: Mat3): Mat3 {\n dst = dst || newMat3();\n\n dst[ 0] = 1; dst[ 1] = 0; dst[ 2] = 0;\n dst[ 4] = 0; dst[ 5] = 1; dst[ 6] = 0;\n dst[ 8] = v[0]; dst[ 9] = v[1]; dst[10] = 1;\n\n return dst;\n}\n\n/**\n * Translates the given 3-by-3 matrix by the given vector v.\n * @param m - The matrix.\n * @param v - The vector by which to translate.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The translated matrix.\n */\nexport function translate(m: Mat3, v: Vec2, dst?: Mat3): Mat3 {\n dst = dst || newMat3();\n\n const v0 = v[0];\n const v1 = v[1];\n\n const m00 = m[0];\n const m01 = m[1];\n const m02 = m[2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n\n if (m !== dst) {\n dst[ 0] = m00;\n dst[ 1] = m01;\n dst[ 2] = m02;\n dst[ 4] = m10;\n dst[ 5] = m11;\n dst[ 6] = m12;\n }\n\n dst[ 8] = m00 * v0 + m10 * v1 + m20;\n dst[ 9] = m01 * v0 + m11 * v1 + m21;\n dst[10] = m02 * v0 + m12 * v1 + m22;\n\n return dst;\n}\n\n/**\n * Creates a 3-by-3 matrix which rotates by the given angle.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotation matrix.\n */\nexport function rotation(angleInRadians: number, dst?: Mat3): Mat3 {\n dst = dst || newMat3();\n\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n dst[ 0] = c; dst[ 1] = s; dst[ 2] = 0;\n dst[ 4] = -s; dst[ 5] = c; dst[ 6] = 0;\n dst[ 8] = 0; dst[ 9] = 0; dst[10] = 1;\n\n return dst;\n}\n\n/**\n * Rotates the given 3-by-3 matrix by the given angle.\n * @param m - The matrix.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nexport function rotate(m: Mat3, angleInRadians: number, dst?: Mat3): Mat3 {\n dst = dst || newMat3();\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n dst[ 0] = c * m00 + s * m10;\n dst[ 1] = c * m01 + s * m11;\n dst[ 2] = c * m02 + s * m12;\n\n dst[ 4] = c * m10 - s * m00;\n dst[ 5] = c * m11 - s * m01;\n dst[ 6] = c * m12 - s * m02;\n\n\n if (m !== dst) {\n dst[ 8] = m[ 8];\n dst[ 9] = m[ 9];\n dst[10] = m[10];\n }\n\n return dst;\n}\n\n/**\n * Creates a 3-by-3 matrix which scales in each dimension by an amount given by\n * the corresponding entry in the given vector; assumes the vector has three\n * entries.\n * @param v - A vector of\n * 2 entries specifying the factor by which to scale in each dimension.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaling matrix.\n */\nexport function scaling(v: Vec2, dst?: Mat3): Mat3 {\n dst = dst || newMat3();\n\n dst[ 0] = v[0]; dst[ 1] = 0; dst[ 2] = 0;\n dst[ 4] = 0; dst[ 5] = v[1]; dst[ 6] = 0;\n dst[ 8] = 0; dst[ 9] = 0; dst[10] = 1;\n\n return dst;\n}\n\n/**\n * Scales the given 3-by-3 matrix in each dimension by an amount\n * given by the corresponding entry in the given vector; assumes the vector has\n * three entries.\n * @param m - The matrix to be modified.\n * @param v - A vector of 2 entries specifying the\n * factor by which to scale in each dimension.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaled matrix.\n */\nexport function scale(m: Mat3, v: Vec2, dst?: Mat3): Mat3 {\n dst = dst || newMat3();\n\n const v0 = v[0];\n const v1 = v[1];\n\n dst[ 0] = v0 * m[0 * 4 + 0];\n dst[ 1] = v0 * m[0 * 4 + 1];\n dst[ 2] = v0 * m[0 * 4 + 2];\n\n dst[ 4] = v1 * m[1 * 4 + 0];\n dst[ 5] = v1 * m[1 * 4 + 1];\n dst[ 6] = v1 * m[1 * 4 + 2];\n\n if (m !== dst) {\n dst[ 8] = m[ 8];\n dst[ 9] = m[ 9];\n dst[10] = m[10];\n }\n\n return dst;\n}\n\n/**\n * Creates a 3-by-3 matrix which scales uniformly in each dimension\n * @param s - Amount to scale\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaling matrix.\n */\nexport function uniformScaling(s: number, dst?: Mat3): Mat3 {\n dst = dst || newMat3();\n\n dst[ 0] = s; dst[ 1] = 0; dst[ 2] = 0;\n dst[ 4] = 0; dst[ 5] = s; dst[ 6] = 0;\n dst[ 8] = 0; dst[ 9] = 0; dst[10] = 1;\n\n return dst;\n}\n\n/**\n * Scales the given 3-by-3 matrix in each dimension by an amount\n * given.\n * @param m - The matrix to be modified.\n * @param s - Amount to scale.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaled matrix.\n */\nexport function uniformScale(m: Mat3, s: number, dst?: Mat3): Mat3 {\n dst = dst || newMat3();\n\n dst[ 0] = s * m[0 * 4 + 0];\n dst[ 1] = s * m[0 * 4 + 1];\n dst[ 2] = s * m[0 * 4 + 2];\n\n dst[ 4] = s * m[1 * 4 + 0];\n dst[ 5] = s * m[1 * 4 + 1];\n dst[ 6] = s * m[1 * 4 + 2];\n\n if (m !== dst) {\n dst[ 8] = m[ 8];\n dst[ 9] = m[ 9];\n dst[10] = m[10];\n }\n\n return dst;\n}\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport * as utils from './utils.js';\nimport { Vec3, create, setDefaultType, VecType } from './vec3';\nimport { Mat3 } from './mat3';\nimport { Mat4 } from './mat4';\nimport { Quat } from './quat';\n\nexport default Vec3;\nexport { create, setDefaultType };\n\n/**\n * Creates a vec3; may be called with x, y, z to set initial values. (same as create)\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @returns the created vector\n */\nexport const fromValues = create;\n\n/**\n * Sets the values of a Vec3\n * Also see {@link vec3.create} and {@link vec3.copy}\n *\n * @param x first value\n * @param y second value\n * @param z third value\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector with its elements set.\n */\nexport function set(x: number, y: number, z: number, dst?: Vec3) {\n dst = dst || new VecType(3);\n\n dst[0] = x;\n dst[1] = y;\n dst[2] = z;\n\n return dst;\n}\n\n/**\n * Applies Math.ceil to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the ceil of each element of v.\n */\nexport function ceil(v: Vec3, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = Math.ceil(v[0]);\n dst[1] = Math.ceil(v[1]);\n dst[2] = Math.ceil(v[2]);\n\n return dst;\n}\n\n/**\n * Applies Math.floor to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the floor of each element of v.\n */\nexport function floor(v: Vec3, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = Math.floor(v[0]);\n dst[1] = Math.floor(v[1]);\n dst[2] = Math.floor(v[2]);\n\n return dst;\n}\n\n/**\n * Applies Math.round to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the round of each element of v.\n */\nexport function round(v: Vec3, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = Math.round(v[0]);\n dst[1] = Math.round(v[1]);\n dst[2] = Math.round(v[2]);\n\n return dst;\n}\n\n/**\n * Clamp each element of vector between min and max\n * @param v - Operand vector.\n * @param max - Min value, default 0\n * @param min - Max value, default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that the clamped value of each element of v.\n */\nexport function clamp(v: Vec3, min = 0, max = 1, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = Math.min(max, Math.max(min, v[0]));\n dst[1] = Math.min(max, Math.max(min, v[1]));\n dst[2] = Math.min(max, Math.max(min, v[2]));\n\n return dst;\n}\n\n/**\n * Adds two vectors; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a and b.\n */\nexport function add(a: Vec3, b: Vec3, dst?: Vec3) {\n dst = dst || new VecType(3);\n\n dst[0] = a[0] + b[0];\n dst[1] = a[1] + b[1];\n dst[2] = a[2] + b[2];\n\n return dst;\n}\n\n/**\n * Adds two vectors, scaling the 2nd; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param scale - Amount to scale b\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a + b * scale.\n */\nexport function addScaled(a: Vec3, b: Vec3, scale: number, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = a[0] + b[0] * scale;\n dst[1] = a[1] + b[1] * scale;\n dst[2] = a[2] + b[2] * scale;\n\n return dst;\n}\n\n/**\n * Returns the angle in radians between two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns The angle in radians between the 2 vectors.\n */\nexport function angle(a: Vec3, b: Vec3): number {\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const bx = b[0];\n const by = b[1];\n const bz = b[2];\n const mag1 = Math.sqrt(ax * ax + ay * ay + az * az);\n const mag2 = Math.sqrt(bx * bx + by * by + bz * bz);\n const mag = mag1 * mag2;\n const cosine = mag && dot(a, b) / mag;\n return Math.acos(cosine);\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nexport function subtract(a: Vec3, b: Vec3, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = a[0] - b[0];\n dst[1] = a[1] - b[1];\n dst[2] = a[2] - b[2];\n\n return dst;\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nexport const sub = subtract;\n\n/**\n * Check if 2 vectors are approximately equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are approximately equal\n */\nexport function equalsApproximately(a: Vec3, b: Vec3): boolean {\n return Math.abs(a[0] - b[0]) < utils.EPSILON &&\n Math.abs(a[1] - b[1]) < utils.EPSILON &&\n Math.abs(a[2] - b[2]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 vectors are exactly equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are exactly equal\n */\nexport function equals(a: Vec3, b: Vec3): boolean {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2];\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficient.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The linear interpolated result.\n */\nexport function lerp(a: Vec3, b: Vec3, t: number, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = a[0] + t * (b[0] - a[0]);\n dst[1] = a[1] + t * (b[1] - a[1]);\n dst[2] = a[2] + t * (b[2] - a[2]);\n\n return dst;\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient vector t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficients vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns the linear interpolated result.\n */\nexport function lerpV(a: Vec3, b: Vec3, t: Vec3, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = a[0] + t[0] * (b[0] - a[0]);\n dst[1] = a[1] + t[1] * (b[1] - a[1]);\n dst[2] = a[2] + t[2] * (b[2] - a[2]);\n\n return dst;\n}\n\n/**\n * Return max values of two vectors.\n * Given vectors a and b returns\n * [max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The max components vector.\n */\nexport function max(a: Vec3, b: Vec3, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = Math.max(a[0], b[0]);\n dst[1] = Math.max(a[1], b[1]);\n dst[2] = Math.max(a[2], b[2]);\n\n return dst;\n}\n\n/**\n * Return min values of two vectors.\n * Given vectors a and b returns\n * [min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The min components vector.\n */\nexport function min(a: Vec3, b: Vec3, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = Math.min(a[0], b[0]);\n dst[1] = Math.min(a[1], b[1]);\n dst[2] = Math.min(a[2], b[2]);\n\n return dst;\n}\n\n/**\n * Multiplies a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nexport function mulScalar(v: Vec3, k: number, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = v[0] * k;\n dst[1] = v[1] * k;\n dst[2] = v[2] * k;\n\n return dst;\n}\n\n/**\n * Multiplies a vector by a scalar. (same as mulScalar)\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nexport const scale = mulScalar;\n\n/**\n * Divides a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nexport function divScalar(v: Vec3, k: number, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = v[0] / k;\n dst[1] = v[1] / k;\n dst[2] = v[2] / k;\n\n return dst;\n}\n\n/**\n * Inverse a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nexport function inverse(v: Vec3, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = 1 / v[0];\n dst[1] = 1 / v[1];\n dst[2] = 1 / v[2];\n\n return dst;\n}\n\n/**\n * Invert a vector. (same as inverse)\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nexport const invert = inverse;\n\n/**\n * Computes the cross product of two vectors; assumes both vectors have\n * three entries.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of a cross b.\n */\nexport function cross(a: Vec3, b: Vec3, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n const t1 = a[2] * b[0] - a[0] * b[2];\n const t2 = a[0] * b[1] - a[1] * b[0];\n dst[0] = a[1] * b[2] - a[2] * b[1];\n dst[1] = t1;\n dst[2] = t2;\n\n return dst;\n}\n\n/**\n * Computes the dot product of two vectors; assumes both vectors have\n * three entries.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns dot product\n */\nexport function dot(a: Vec3, b: Vec3): number {\n return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]);\n}\n\n/**\n * Computes the length of vector\n * @param v - vector.\n * @returns length of vector.\n */\nexport function length(v: Vec3): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n return Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2);\n}\n\n/**\n * Computes the length of vector (same as length)\n * @param v - vector.\n * @returns length of vector.\n */\nexport const len = length;\n\n/**\n * Computes the square of the length of vector\n * @param v - vector.\n * @returns square of the length of vector.\n */\nexport function lengthSq(v: Vec3): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n return v0 * v0 + v1 * v1 + v2 * v2;\n}\n\n/**\n * Computes the square of the length of vector (same as lengthSq)\n * @param v - vector.\n * @returns square of the length of vector.\n */\nexport const lenSq = lengthSq;\n\n/**\n * Computes the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nexport function distance(a: Vec3, b: Vec3): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n const dz = a[2] - b[2];\n return Math.sqrt(dx * dx + dy * dy + dz * dz);\n}\n\n/**\n * Computes the distance between 2 points (same as distance)\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nexport const dist = distance;\n\n/**\n * Computes the square of the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nexport function distanceSq(a: Vec3, b: Vec3): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n const dz = a[2] - b[2];\n return dx * dx + dy * dy + dz * dz;\n}\n\n/**\n * Computes the square of the distance between 2 points (same as distanceSq)\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nexport const distSq = distanceSq;\n\n/**\n * Divides a vector by its Euclidean length and returns the quotient.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The normalized vector.\n */\nexport function normalize(v: Vec3, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const len = Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2);\n\n if (len > 0.00001) {\n dst[0] = v0 / len;\n dst[1] = v1 / len;\n dst[2] = v2 / len;\n } else {\n dst[0] = 0;\n dst[1] = 0;\n dst[2] = 0;\n }\n\n\n return dst;\n}\n\n/**\n * Negates a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns -v.\n */\nexport function negate(v: Vec3, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = -v[0];\n dst[1] = -v[1];\n dst[2] = -v[2];\n\n return dst;\n}\n\n/**\n * Copies a vector. (same as {@link vec3.clone})\n * Also see {@link vec3.create} and {@link vec3.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nexport function copy(v: Vec3, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = v[0];\n dst[1] = v[1];\n dst[2] = v[2];\n\n return dst;\n}\n\n/**\n * Clones a vector. (same as {@link vec3.copy})\n * Also see {@link vec3.create} and {@link vec3.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nexport const clone = copy;\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nexport function multiply(a: Vec3, b: Vec3, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = a[0] * b[0];\n dst[1] = a[1] * b[1];\n dst[2] = a[2] * b[2];\n\n return dst;\n}\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as mul)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nexport const mul = multiply;\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nexport function divide(a: Vec3, b: Vec3, dst?: Vec3) {\n dst = dst || new VecType(3);\n\n dst[0] = a[0] / b[0];\n dst[1] = a[1] / b[1];\n dst[2] = a[2] / b[2];\n\n return dst;\n}\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as divide)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nexport const div = divide;\n\n/**\n * Creates a random vector\n * @param scale - Default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The random vector.\n */\nexport function random(scale = 1, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n const angle = Math.random() * 2 * Math.PI;\n const z = Math.random() * 2 - 1;\n const zScale = Math.sqrt(1 - z * z) * scale;\n dst[0] = Math.cos(angle) * zScale;\n dst[1] = Math.sin(angle) * zScale;\n dst[2] = z * scale;\n\n return dst;\n}\n\n/**\n * Zero's a vector\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The zeroed vector.\n */\nexport function zero(dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = 0;\n dst[1] = 0;\n dst[2] = 0;\n\n return dst;\n}\n\n\n/**\n * transform vec3 by 4x4 matrix\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional vec3 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nexport function transformMat4(v: Vec3, m: Mat4, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n const x = v[0];\n const y = v[1];\n const z = v[2];\n const w = (m[3] * x + m[7] * y + m[11] * z + m[15]) || 1;\n\n dst[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;\n dst[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;\n dst[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;\n\n return dst;\n}\n\n/**\n * Transform vec4 by upper 3x3 matrix inside 4x4 matrix.\n * @param v - The direction.\n * @param m - The matrix.\n * @param dst - optional Vec3 to store result. If not passed a new one is created.\n * @returns The transformed vector.\n */\nexport function transformMat4Upper3x3(v: Vec3, m: Mat4, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n\n dst[0] = v0 * m[0 * 4 + 0] + v1 * m[1 * 4 + 0] + v2 * m[2 * 4 + 0];\n dst[1] = v0 * m[0 * 4 + 1] + v1 * m[1 * 4 + 1] + v2 * m[2 * 4 + 1];\n dst[2] = v0 * m[0 * 4 + 2] + v1 * m[1 * 4 + 2] + v2 * m[2 * 4 + 2];\n\n return dst;\n}\n\n/**\n * Transforms vec3 by 3x3 matrix\n *\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional vec3 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nexport function transformMat3(v: Vec3, m: Mat3, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n const x = v[0];\n const y = v[1];\n const z = v[2];\n\n dst[0] = x * m[0] + y * m[4] + z * m[8];\n dst[1] = x * m[1] + y * m[5] + z * m[9];\n dst[2] = x * m[2] + y * m[6] + z * m[10];\n\n return dst;\n}\n\n/**\n * Transforms vec3 by Quaternion\n * @param v - the vector to transform\n * @param q - the quaternion to transform by\n * @param dst - optional vec3 to store result. If not passed a new one is created.\n * @returns the transformed\n */\nexport function transformQuat(v: Vec3, q: Quat, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const w2 = q[3] * 2;\n\n const x = v[0];\n const y = v[1];\n const z = v[2];\n\n const uvX = qy * z - qz * y;\n const uvY = qz * x - qx * z;\n const uvZ = qx * y - qy * x;\n\n dst[0] = x + uvX * w2 + (qy * uvZ - qz * uvY) * 2;\n dst[1] = y + uvY * w2 + (qz * uvX - qx * uvZ) * 2;\n dst[2] = z + uvZ * w2 + (qx * uvY - qy * uvX) * 2;\n\n return dst;\n}\n\n/**\n * Returns the translation component of a 4-by-4 matrix as a vector with 3\n * entries.\n * @param m - The matrix.\n * @param dst - vector to hold result. If not passed a new one is created.\n * @returns The translation component of m.\n */\nexport function getTranslation(m: Mat3, dst?: Vec3) {\n dst = dst || new VecType(3);\n dst[0] = m[12];\n dst[1] = m[13];\n dst[2] = m[14];\n return dst;\n}\n/**\n * Returns an axis of a 4x4 matrix as a vector with 3 entries\n * @param m - The matrix.\n * @param axis - The axis 0 = x, 1 = y, 2 = z;\n * @returns The axis component of m.\n */\nexport function getAxis(m: Mat4, axis: number, dst?: Vec3) {\n dst = dst || new VecType(3);\n const off = axis * 4;\n dst[0] = m[off + 0];\n dst[1] = m[off + 1];\n dst[2] = m[off + 2];\n return dst;\n}\n/**\n * Returns the scaling component of the matrix\n * @param m - The Matrix\n * @param dst - The vector to set. If not passed a new one is created.\n */\nexport function getScaling(m: Mat4, dst: Vec3) {\n dst = dst || new VecType(3);\n const xx = m[0];\n const xy = m[1];\n const xz = m[2];\n const yx = m[4];\n const yy = m[5];\n const yz = m[6];\n const zx = m[8];\n const zy = m[9];\n const zz = m[10];\n dst[0] = Math.sqrt(xx * xx + xy * xy + xz * xz);\n dst[1] = Math.sqrt(yx * yx + yy * yy + yz * yz);\n dst[2] = Math.sqrt(zx * zx + zy * zy + zz * zz);\n return dst;\n}\n\n/**\n * Rotate a 3D vector around the x-axis\n *\n * @param {ReadonlyVec3} a The vec3 point to rotate\n * @param {ReadonlyVec3} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @param dst - The vector to set. If not passed a new one is created.\n * @returns the rotated vector\n */\nexport function rotateX(a: Vec3, b: Vec3, rad: number, dst?: Vec3) {\n dst = dst || new VecType(3);\n const p = [];\n const r = [];\n\n //Translate point to the origin\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2];\n\n //perform rotation\n r[0] = p[0];\n r[1] = p[1] * Math.cos(rad) - p[2] * Math.sin(rad);\n r[2] = p[1] * Math.sin(rad) + p[2] * Math.cos(rad);\n\n //translate to correct position\n dst[0] = r[0] + b[0];\n dst[1] = r[1] + b[1];\n dst[2] = r[2] + b[2];\n\n return dst;\n}\n\n/**\n * Rotate a 3D vector around the y-axis\n *\n * @param {ReadonlyVec3} a The vec3 point to rotate\n * @param {ReadonlyVec3} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @param dst - The vector to set. If not passed a new one is created.\n * @returns the rotated vector\n */\nexport function rotateY(a: Vec3, b: Vec3, rad: number, dst?: Vec3) {\n dst = dst || new VecType(3);\n const p = [];\n const r = [];\n\n // translate point to the origin\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2];\n\n // perform rotation\n r[0] = p[2] * Math.sin(rad) + p[0] * Math.cos(rad);\n r[1] = p[1];\n r[2] = p[2] * Math.cos(rad) - p[0] * Math.sin(rad);\n\n // translate to correct position\n dst[0] = r[0] + b[0];\n dst[1] = r[1] + b[1];\n dst[2] = r[2] + b[2];\n\n return dst;\n}\n\n/**\n * Rotate a 3D vector around the z-axis\n *\n * @param {ReadonlyVec3} a The vec3 point to rotate\n * @param {ReadonlyVec3} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @param dst - The vector to set. If not passed a new one is created.\n * @returns {vec3} out\n */\nexport function rotateZ(a: Vec3, b: Vec3, rad: number, dst?: Vec3) {\n dst = dst || new VecType(3);\n const p = [];\n const r = [];\n\n // translate point to the origin\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2];\n\n // perform rotation\n r[0] = p[0] * Math.cos(rad) - p[1] * Math.sin(rad);\n r[1] = p[0] * Math.sin(rad) + p[1] * Math.cos(rad);\n r[2] = p[2];\n\n // translate to correct position\n dst[0] = r[0] + b[0];\n dst[1] = r[1] + b[1];\n dst[2] = r[2] + b[2];\n\n return dst;\n}\n\n/**\n * Treat a 3D vector as a direction and set it's length\n *\n * @param a The vec3 to lengthen\n * @param len The length of the resulting vector\n * @returns The lengthened vector\n */\nexport function setLength(a: Vec3, len: number, dst?: Vec3) {\n dst = dst || new VecType(3);\n normalize(a, dst);\n return mulScalar(dst, len, dst);\n}\n\n/**\n * Ensure a vector is not longer than a max length\n *\n * @param a The vec3 to limit\n * @param maxLen The longest length of the resulting vector\n * @returns The vector, shortened to maxLen if it's too long\n */\nexport function truncate(a: Vec3, maxLen: number, dst?: Vec3) {\n dst = dst || new VecType(3);\n\n if (length(a) > maxLen) {\n return setLength(a, maxLen, dst);\n }\n\n return copy(a, dst);\n}\n\n/**\n * Return the vector exactly between 2 endpoint vectors\n *\n * @param a Endpoint 1\n * @param b Endpoint 2\n * @returns The vector exactly residing between endpoints 1 and 2\n */\nexport function midpoint(a: Vec3, b: Vec3, dst?: Vec3) {\n dst = dst || new VecType(3);\n return lerp(a, b, 0.5, dst);\n}\n","\nimport { Mat3 } from './mat3';\nimport { Mat4 } from './mat4';\nimport { Quat } from './quat';\nimport Vec3, * as vec3 from './vec3-impl';\nimport * as utils from './utils';\n\nexport default Mat4;\n\nexport type Mat4LikeCtor = new (n: number) => Mat4;\n\n/**\n * 4x4 Matrix math math functions.\n *\n * Almost all functions take an optional `dst` argument. If it is not passed in the\n * functions will create a new matrix. In other words you can do this\n *\n * const mat = mat4.translation([1, 2, 3]); // Creates a new translation matrix\n *\n * or\n *\n * const mat = mat4.create();\n * mat4.translation([1, 2, 3], mat); // Puts translation matrix in mat.\n *\n * The first style is often easier but depending on where it's used it generates garbage where\n * as there is almost never allocation with the second style.\n *\n * It is always save to pass any matrix as the destination. So for example\n *\n * const mat = mat4.identity();\n * const trans = mat4.translation([1, 2, 3]);\n * mat4.multiply(mat, trans, mat); // Multiplies mat * trans and puts result in mat.\n *\n */\nlet MatType: Mat4LikeCtor = Float32Array;\n\n/**\n * Sets the type this library creates for a Mat4\n * @param ctor - the constructor for the type. Either `Float32Array`, `Float64Array`, or `Array`\n * @returns previous constructor for Mat4\n */\nexport function setDefaultType(ctor: new (n: number) => Mat4) {\n const oldType = MatType;\n MatType = ctor;\n return oldType;\n}\n\n/**\n * Create a Mat4 from values\n *\n * Note: Since passing in a raw JavaScript array\n * is valid in all circumstances, if you want to\n * force a JavaScript array into a Mat4's specified type\n * it would be faster to use\n *\n * ```\n * const m = mat4.clone(someJSArray);\n * ```\n *\n * Note: a consequence of the implementation is if your Mat4Type = `Array`\n * instead of `Float32Array` or `Float64Array` then any values you\n * don't pass in will be undefined. Usually this is not an issue since\n * (a) using `Array` is rare and (b) using `mat4.create` is usually used\n * to create a Mat4 to be filled out as in\n *\n * ```\n * const m = mat4.create();\n * mat4.perspective(fov, aspect, near, far, m);\n * ```\n *\n * @param v0 - value for element 0\n * @param v1 - value for element 1\n * @param v2 - value for element 2\n * @param v3 - value for element 3\n * @param v4 - value for element 4\n * @param v5 - value for element 5\n * @param v6 - value for element 6\n * @param v7 - value for element 7\n * @param v8 - value for element 8\n * @param v9 - value for element 9\n * @param v10 - value for element 10\n * @param v11 - value for element 11\n * @param v12 - value for element 12\n * @param v13 - value for element 13\n * @param v14 - value for element 14\n * @param v15 - value for element 15\n * @returns created from values.\n */\nexport function create(\n v0?: number, v1?: number, v2?: number, v3?: number,\n v4?: number, v5?: number, v6?: number, v7?: number,\n v8?: number, v9?: number, v10?: number, v11?: number,\n v12?: number, v13?: number, v14?: number, v15?: number): Mat4 {\n const dst = new MatType(16);\n if (v0 !== undefined) {\n dst[0] = v0;\n if (v1 !== undefined) {\n dst[1] = v1;\n if (v2 !== undefined) {\n dst[2] = v2;\n if (v3 !== undefined) {\n dst[3] = v3;\n if (v4 !== undefined) {\n dst[4] = v4;\n if (v5 !== undefined) {\n dst[5] = v5;\n if (v6 !== undefined) {\n dst[6] = v6;\n if (v7 !== undefined) {\n dst[7] = v7;\n if (v8 !== undefined) {\n dst[8] = v8;\n if (v9 !== undefined) {\n dst[9] = v9;\n if (v10 !== undefined) {\n dst[10] = v10;\n if (v11 !== undefined) {\n dst[11] = v11;\n if (v12 !== undefined) {\n dst[12] = v12;\n if (v13 !== undefined) {\n dst[13] = v13;\n if (v14 !== undefined) {\n dst[14] = v14;\n if (v15 !== undefined) {\n dst[15] = v15;\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n return dst;\n}\n\n/**\n * Sets the values of a Mat4\n * Also see {@link mat4.create} and {@link mat4.copy}\n *\n * @param v0 - value for element 0\n * @param v1 - value for element 1\n * @param v2 - value for element 2\n * @param v3 - value for element 3\n * @param v4 - value for element 4\n * @param v5 - value for element 5\n * @param v6 - value for element 6\n * @param v7 - value for element 7\n * @param v8 - value for element 8\n * @param v9 - value for element 9\n * @param v10 - value for element 10\n * @param v11 - value for element 11\n * @param v12 - value for element 12\n * @param v13 - value for element 13\n * @param v14 - value for element 14\n * @param v15 - value for element 15\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat4 created from values.\n */\nexport function set(\n v0: number, v1: number, v2: number, v3: number,\n v4: number, v5: number, v6: number, v7: number,\n v8: number, v9: number, v10: number, v11: number,\n v12: number, v13: number, v14: number, v15: number,\n dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n dst[ 0] = v0; dst[ 1] = v1; dst[ 2] = v2; dst[ 3] = v3;\n dst[ 4] = v4; dst[ 5] = v5; dst[ 6] = v6; dst[ 7] = v7;\n dst[ 8] = v8; dst[ 9] = v9; dst[10] = v10; dst[11] = v11;\n dst[12] = v12; dst[13] = v13; dst[14] = v14; dst[15] = v15;\n\n return dst;\n}\n\n/**\n * Creates a Mat4 from a Mat3\n * @param m3 - source matrix\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat4 made from m3\n */\nexport function fromMat3(m3: Mat3, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n dst[ 0] = m3[0]; dst[ 1] = m3[1]; dst[ 2] = m3[ 2]; dst[ 3] = 0;\n dst[ 4] = m3[4]; dst[ 5] = m3[5]; dst[ 6] = m3[ 6]; dst[ 7] = 0;\n dst[ 8] = m3[8]; dst[ 9] = m3[9]; dst[10] = m3[10]; dst[11] = 0;\n dst[12] = 0; dst[13] = 0; dst[14] = 0; dst[15] = 1;\n\n return dst;\n}\n\n/**\n * Creates a Mat4 rotation matrix from a quaternion\n * @param q - quaternion to create matrix from\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat4 made from q\n */\nexport function fromQuat(q: Quat, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n const x = q[0]; const y = q[1]; const z = q[2]; const w = q[3];\n const x2 = x + x; const y2 = y + y; const z2 = z + z;\n\n const xx = x * x2;\n const yx = y * x2;\n const yy = y * y2;\n const zx = z * x2;\n const zy = z * y2;\n const zz = z * z2;\n const wx = w * x2;\n const wy = w * y2;\n const wz = w * z2;\n\n dst[ 0] = 1 - yy - zz; dst[ 1] = yx + wz; dst[ 2] = zx - wy; dst[ 3] = 0;\n dst[ 4] = yx - wz; dst[ 5] = 1 - xx - zz; dst[ 6] = zy + wx; dst[ 7] = 0;\n dst[ 8] = zx + wy; dst[ 9] = zy - wx; dst[10] = 1 - xx - yy; dst[11] = 0;\n dst[12] = 0; dst[13] = 0; dst[14] = 0; dst[15] = 1;\n\n return dst;\n}\n\n/**\n * Negates a matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns -m.\n */\nexport function negate(m: Mat4, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n dst[ 0] = -m[ 0]; dst[ 1] = -m[ 1]; dst[ 2] = -m[ 2]; dst[ 3] = -m[ 3];\n dst[ 4] = -m[ 4]; dst[ 5] = -m[ 5]; dst[ 6] = -m[ 6]; dst[ 7] = -m[ 7];\n dst[ 8] = -m[ 8]; dst[ 9] = -m[ 9]; dst[10] = -m[10]; dst[11] = -m[11];\n dst[12] = -m[12]; dst[13] = -m[13]; dst[14] = -m[14]; dst[15] = -m[15];\n\n return dst;\n}\n\n/**\n * Copies a matrix. (same as {@link mat4.clone})\n * Also see {@link mat4.create} and {@link mat4.set}\n * @param m - The matrix.\n * @param dst - The matrix. If not passed a new one is created.\n * @returns A copy of m.\n */\nexport function copy(m: Mat4, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n dst[ 0] = m[ 0]; dst[ 1] = m[ 1]; dst[ 2] = m[ 2]; dst[ 3] = m[ 3];\n dst[ 4] = m[ 4]; dst[ 5] = m[ 5]; dst[ 6] = m[ 6]; dst[ 7] = m[ 7];\n dst[ 8] = m[ 8]; dst[ 9] = m[ 9]; dst[10] = m[10]; dst[11] = m[11];\n dst[12] = m[12]; dst[13] = m[13]; dst[14] = m[14]; dst[15] = m[15];\n\n return dst;\n}\n\n/**\n * Copies a matrix (same as {@link mat4.copy})\n * Also see {@link mat4.create} and {@link mat4.set}\n * @param m - The matrix.\n * @param dst - The matrix. If not passed a new one is created.\n * @returns A copy of m.\n */\nexport const clone = copy;\n\n/**\n * Check if 2 matrices are approximately equal\n * @param a - Operand matrix.\n * @param b - Operand matrix.\n * @returns true if matrices are approximately equal\n */\nexport function equalsApproximately(a: Mat4, b: Mat4): boolean {\n return Math.abs(a[ 0] - b[ 0]) < utils.EPSILON &&\n Math.abs(a[ 1] - b[ 1]) < utils.EPSILON &&\n Math.abs(a[ 2] - b[ 2]) < utils.EPSILON &&\n Math.abs(a[ 3] - b[ 3]) < utils.EPSILON &&\n Math.abs(a[ 4] - b[ 4]) < utils.EPSILON &&\n Math.abs(a[ 5] - b[ 5]) < utils.EPSILON &&\n Math.abs(a[ 6] - b[ 6]) < utils.EPSILON &&\n Math.abs(a[ 7] - b[ 7]) < utils.EPSILON &&\n Math.abs(a[ 8] - b[ 8]) < utils.EPSILON &&\n Math.abs(a[ 9] - b[ 9]) < utils.EPSILON &&\n Math.abs(a[10] - b[10]) < utils.EPSILON &&\n Math.abs(a[11] - b[11]) < utils.EPSILON &&\n Math.abs(a[12] - b[12]) < utils.EPSILON &&\n Math.abs(a[13] - b[13]) < utils.EPSILON &&\n Math.abs(a[14] - b[14]) < utils.EPSILON &&\n Math.abs(a[15] - b[15]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 matrices are exactly equal\n * @param a - Operand matrix.\n * @param b - Operand matrix.\n * @returns true if matrices are exactly equal\n */\nexport function equals(a: Mat4, b: Mat4): boolean {\n return a[ 0] === b[ 0] &&\n a[ 1] === b[ 1] &&\n a[ 2] === b[ 2] &&\n a[ 3] === b[ 3] &&\n a[ 4] === b[ 4] &&\n a[ 5] === b[ 5] &&\n a[ 6] === b[ 6] &&\n a[ 7] === b[ 7] &&\n a[ 8] === b[ 8] &&\n a[ 9] === b[ 9] &&\n a[10] === b[10] &&\n a[11] === b[11] &&\n a[12] === b[12] &&\n a[13] === b[13] &&\n a[14] === b[14] &&\n a[15] === b[15];\n}\n\n/**\n * Creates a 4-by-4 identity matrix.\n *\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns A 4-by-4 identity matrix.\n */\nexport function identity(dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n dst[ 0] = 1; dst[ 1] = 0; dst[ 2] = 0; dst[ 3] = 0;\n dst[ 4] = 0; dst[ 5] = 1; dst[ 6] = 0; dst[ 7] = 0;\n dst[ 8] = 0; dst[ 9] = 0; dst[10] = 1; dst[11] = 0;\n dst[12] = 0; dst[13] = 0; dst[14] = 0; dst[15] = 1;\n\n return dst;\n}\n\n/**\n * Takes the transpose of a matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The transpose of m.\n */\nexport function transpose(m: Mat4, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n if (dst === m) {\n let t;\n\n t = m[1];\n m[1] = m[4];\n m[4] = t;\n\n t = m[2];\n m[2] = m[8];\n m[8] = t;\n\n t = m[3];\n m[3] = m[12];\n m[12] = t;\n\n t = m[6];\n m[6] = m[9];\n m[9] = t;\n\n t = m[7];\n m[7] = m[13];\n m[13] = t;\n\n t = m[11];\n m[11] = m[14];\n m[14] = t;\n return dst;\n }\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const m30 = m[3 * 4 + 0];\n const m31 = m[3 * 4 + 1];\n const m32 = m[3 * 4 + 2];\n const m33 = m[3 * 4 + 3];\n\n dst[ 0] = m00; dst[ 1] = m10; dst[ 2] = m20; dst[ 3] = m30;\n dst[ 4] = m01; dst[ 5] = m11; dst[ 6] = m21; dst[ 7] = m31;\n dst[ 8] = m02; dst[ 9] = m12; dst[10] = m22; dst[11] = m32;\n dst[12] = m03; dst[13] = m13; dst[14] = m23; dst[15] = m33;\n\n return dst;\n}\n\n/**\n * Computes the inverse of a 4-by-4 matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The inverse of m.\n */\nexport function inverse(m: Mat4, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const m30 = m[3 * 4 + 0];\n const m31 = m[3 * 4 + 1];\n const m32 = m[3 * 4 + 2];\n const m33 = m[3 * 4 + 3];\n const tmp0 = m22 * m33;\n const tmp1 = m32 * m23;\n const tmp2 = m12 * m33;\n const tmp3 = m32 * m13;\n const tmp4 = m12 * m23;\n const tmp5 = m22 * m13;\n const tmp6 = m02 * m33;\n const tmp7 = m32 * m03;\n const tmp8 = m02 * m23;\n const tmp9 = m22 * m03;\n const tmp10 = m02 * m13;\n const tmp11 = m12 * m03;\n const tmp12 = m20 * m31;\n const tmp13 = m30 * m21;\n const tmp14 = m10 * m31;\n const tmp15 = m30 * m11;\n const tmp16 = m10 * m21;\n const tmp17 = m20 * m11;\n const tmp18 = m00 * m31;\n const tmp19 = m30 * m01;\n const tmp20 = m00 * m21;\n const tmp21 = m20 * m01;\n const tmp22 = m00 * m11;\n const tmp23 = m10 * m01;\n\n const t0 = (tmp0 * m11 + tmp3 * m21 + tmp4 * m31) -\n (tmp1 * m11 + tmp2 * m21 + tmp5 * m31);\n const t1 = (tmp1 * m01 + tmp6 * m21 + tmp9 * m31) -\n (tmp0 * m01 + tmp7 * m21 + tmp8 * m31);\n const t2 = (tmp2 * m01 + tmp7 * m11 + tmp10 * m31) -\n (tmp3 * m01 + tmp6 * m11 + tmp11 * m31);\n const t3 = (tmp5 * m01 + tmp8 * m11 + tmp11 * m21) -\n (tmp4 * m01 + tmp9 * m11 + tmp10 * m21);\n\n const d = 1 / (m00 * t0 + m10 * t1 + m20 * t2 + m30 * t3);\n\n dst[ 0] = d * t0;\n dst[ 1] = d * t1;\n dst[ 2] = d * t2;\n dst[ 3] = d * t3;\n dst[ 4] = d * ((tmp1 * m10 + tmp2 * m20 + tmp5 * m30) -\n (tmp0 * m10 + tmp3 * m20 + tmp4 * m30));\n dst[ 5] = d * ((tmp0 * m00 + tmp7 * m20 + tmp8 * m30) -\n (tmp1 * m00 + tmp6 * m20 + tmp9 * m30));\n dst[ 6] = d * ((tmp3 * m00 + tmp6 * m10 + tmp11 * m30) -\n (tmp2 * m00 + tmp7 * m10 + tmp10 * m30));\n dst[ 7] = d * ((tmp4 * m00 + tmp9 * m10 + tmp10 * m20) -\n (tmp5 * m00 + tmp8 * m10 + tmp11 * m20));\n dst[ 8] = d * ((tmp12 * m13 + tmp15 * m23 + tmp16 * m33) -\n (tmp13 * m13 + tmp14 * m23 + tmp17 * m33));\n dst[ 9] = d * ((tmp13 * m03 + tmp18 * m23 + tmp21 * m33) -\n (tmp12 * m03 + tmp19 * m23 + tmp20 * m33));\n dst[10] = d * ((tmp14 * m03 + tmp19 * m13 + tmp22 * m33) -\n (tmp15 * m03 + tmp18 * m13 + tmp23 * m33));\n dst[11] = d * ((tmp17 * m03 + tmp20 * m13 + tmp23 * m23) -\n (tmp16 * m03 + tmp21 * m13 + tmp22 * m23));\n dst[12] = d * ((tmp14 * m22 + tmp17 * m32 + tmp13 * m12) -\n (tmp16 * m32 + tmp12 * m12 + tmp15 * m22));\n dst[13] = d * ((tmp20 * m32 + tmp12 * m02 + tmp19 * m22) -\n (tmp18 * m22 + tmp21 * m32 + tmp13 * m02));\n dst[14] = d * ((tmp18 * m12 + tmp23 * m32 + tmp15 * m02) -\n (tmp22 * m32 + tmp14 * m02 + tmp19 * m12));\n dst[15] = d * ((tmp22 * m22 + tmp16 * m02 + tmp21 * m12) -\n (tmp20 * m12 + tmp23 * m22 + tmp17 * m02));\n\n return dst;\n}\n\n/**\n * Compute the determinant of a matrix\n * @param m - the matrix\n * @returns the determinant\n */\nexport function determinant(m: Mat4): number {\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const m30 = m[3 * 4 + 0];\n const m31 = m[3 * 4 + 1];\n const m32 = m[3 * 4 + 2];\n const m33 = m[3 * 4 + 3];\n\n const tmp0 = m22 * m33;\n const tmp1 = m32 * m23;\n const tmp2 = m12 * m33;\n const tmp3 = m32 * m13;\n const tmp4 = m12 * m23;\n const tmp5 = m22 * m13;\n const tmp6 = m02 * m33;\n const tmp7 = m32 * m03;\n const tmp8 = m02 * m23;\n const tmp9 = m22 * m03;\n const tmp10 = m02 * m13;\n const tmp11 = m12 * m03;\n\n const t0 = (tmp0 * m11 + tmp3 * m21 + tmp4 * m31) -\n (tmp1 * m11 + tmp2 * m21 + tmp5 * m31);\n const t1 = (tmp1 * m01 + tmp6 * m21 + tmp9 * m31) -\n (tmp0 * m01 + tmp7 * m21 + tmp8 * m31);\n const t2 = (tmp2 * m01 + tmp7 * m11 + tmp10 * m31) -\n (tmp3 * m01 + tmp6 * m11 + tmp11 * m31);\n const t3 = (tmp5 * m01 + tmp8 * m11 + tmp11 * m21) -\n (tmp4 * m01 + tmp9 * m11 + tmp10 * m21);\n\n return m00 * t0 + m10 * t1 + m20 * t2 + m30 * t3;\n}\n\n/**\n * Computes the inverse of a 4-by-4 matrix. (same as inverse)\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The inverse of m.\n */\nexport const invert = inverse;\n\n/**\n * Multiplies two 4-by-4 matrices with a on the left and b on the right\n * @param a - The matrix on the left.\n * @param b - The matrix on the right.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix product of a and b.\n */\nexport function multiply(a: Mat4, b: Mat4, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a03 = a[3];\n const a10 = a[ 4 + 0];\n const a11 = a[ 4 + 1];\n const a12 = a[ 4 + 2];\n const a13 = a[ 4 + 3];\n const a20 = a[ 8 + 0];\n const a21 = a[ 8 + 1];\n const a22 = a[ 8 + 2];\n const a23 = a[ 8 + 3];\n const a30 = a[12 + 0];\n const a31 = a[12 + 1];\n const a32 = a[12 + 2];\n const a33 = a[12 + 3];\n const b00 = b[0];\n const b01 = b[1];\n const b02 = b[2];\n const b03 = b[3];\n const b10 = b[ 4 + 0];\n const b11 = b[ 4 + 1];\n const b12 = b[ 4 + 2];\n const b13 = b[ 4 + 3];\n const b20 = b[ 8 + 0];\n const b21 = b[ 8 + 1];\n const b22 = b[ 8 + 2];\n const b23 = b[ 8 + 3];\n const b30 = b[12 + 0];\n const b31 = b[12 + 1];\n const b32 = b[12 + 2];\n const b33 = b[12 + 3];\n\n dst[ 0] = a00 * b00 + a10 * b01 + a20 * b02 + a30 * b03;\n dst[ 1] = a01 * b00 + a11 * b01 + a21 * b02 + a31 * b03;\n dst[ 2] = a02 * b00 + a12 * b01 + a22 * b02 + a32 * b03;\n dst[ 3] = a03 * b00 + a13 * b01 + a23 * b02 + a33 * b03;\n dst[ 4] = a00 * b10 + a10 * b11 + a20 * b12 + a30 * b13;\n dst[ 5] = a01 * b10 + a11 * b11 + a21 * b12 + a31 * b13;\n dst[ 6] = a02 * b10 + a12 * b11 + a22 * b12 + a32 * b13;\n dst[ 7] = a03 * b10 + a13 * b11 + a23 * b12 + a33 * b13;\n dst[ 8] = a00 * b20 + a10 * b21 + a20 * b22 + a30 * b23;\n dst[ 9] = a01 * b20 + a11 * b21 + a21 * b22 + a31 * b23;\n dst[10] = a02 * b20 + a12 * b21 + a22 * b22 + a32 * b23;\n dst[11] = a03 * b20 + a13 * b21 + a23 * b22 + a33 * b23;\n dst[12] = a00 * b30 + a10 * b31 + a20 * b32 + a30 * b33;\n dst[13] = a01 * b30 + a11 * b31 + a21 * b32 + a31 * b33;\n dst[14] = a02 * b30 + a12 * b31 + a22 * b32 + a32 * b33;\n dst[15] = a03 * b30 + a13 * b31 + a23 * b32 + a33 * b33;\n\n return dst;\n}\n\n/**\n * Multiplies two 4-by-4 matrices with a on the left and b on the right (same as multiply)\n * @param a - The matrix on the left.\n * @param b - The matrix on the right.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix product of a and b.\n */\nexport const mul = multiply;\n\n/**\n * Sets the translation component of a 4-by-4 matrix to the given\n * vector.\n * @param a - The matrix.\n * @param v - The vector.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix with translation set.\n */\nexport function setTranslation(a: Mat4, v: Vec3, dst?: Mat4): Mat4 {\n dst = dst || identity();\n if (a !== dst) {\n dst[ 0] = a[ 0];\n dst[ 1] = a[ 1];\n dst[ 2] = a[ 2];\n dst[ 3] = a[ 3];\n dst[ 4] = a[ 4];\n dst[ 5] = a[ 5];\n dst[ 6] = a[ 6];\n dst[ 7] = a[ 7];\n dst[ 8] = a[ 8];\n dst[ 9] = a[ 9];\n dst[10] = a[10];\n dst[11] = a[11];\n }\n dst[12] = v[0];\n dst[13] = v[1];\n dst[14] = v[2];\n dst[15] = 1;\n return dst;\n}\n\n/**\n * Returns the translation component of a 4-by-4 matrix as a vector with 3\n * entries.\n * @param m - The matrix.\n * @param dst - vector to hold result. If not passed a new one is created.\n * @returns The translation component of m.\n */\nexport function getTranslation(m: Mat4, dst?: Vec3): Vec3 {\n dst = dst || vec3.create();\n dst[0] = m[12];\n dst[1] = m[13];\n dst[2] = m[14];\n return dst;\n}\n\n/**\n * Returns an axis of a 4x4 matrix as a vector with 3 entries\n * @param m - The matrix.\n * @param axis - The axis 0 = x, 1 = y, 2 = z;\n * @returns The axis component of m.\n */\nexport function getAxis(m: Mat4, axis: number, dst?: Vec3): Vec3 {\n dst = dst || vec3.create();\n const off = axis * 4;\n dst[0] = m[off + 0];\n dst[1] = m[off + 1];\n dst[2] = m[off + 2];\n return dst;\n}\n\n/**\n * Sets an axis of a 4x4 matrix as a vector with 3 entries\n * @param m - The matrix.\n * @param v - the axis vector\n * @param axis - The axis 0 = x, 1 = y, 2 = z;\n * @param dst - The matrix to set. If not passed a new one is created.\n * @returns The matrix with axis set.\n */\nexport function setAxis(m: Mat4, v: Vec3, axis: number, dst: Mat4): Mat4 {\n if (dst !== m) {\n dst = copy(m, dst);\n }\n const off = axis * 4;\n dst[off + 0] = v[0];\n dst[off + 1] = v[1];\n dst[off + 2] = v[2];\n return dst;\n}\n\n/**\n * Returns the scaling component of the matrix\n * @param m - The Matrix\n * @param dst - The vector to set. If not passed a new one is created.\n */\nexport function getScaling(m: Mat4, dst?: Vec3): Vec3 {\n dst = dst || vec3.create();\n\n const xx = m[0];\n const xy = m[1];\n const xz = m[2];\n const yx = m[4];\n const yy = m[5];\n const yz = m[6];\n const zx = m[8];\n const zy = m[9];\n const zz = m[10];\n\n dst[0] = Math.sqrt(xx * xx + xy * xy + xz * xz);\n dst[1] = Math.sqrt(yx * yx + yy * yy + yz * yz);\n dst[2] = Math.sqrt(zx * zx + zy * zy + zz * zz);\n\n return dst;\n}\n\n/**\n * Computes a 4-by-4 perspective transformation matrix given the angular height\n * of the frustum, the aspect ratio, and the near and far clipping planes. The\n * arguments define a frustum extending in the negative z direction. The given\n * angle is the vertical angle of the frustum, and the horizontal angle is\n * determined to produce the given aspect ratio. The arguments near and far are\n * the distances to the near and far clipping planes. Note that near and far\n * are not z coordinates, but rather they are distances along the negative\n * z-axis. The matrix generated sends the viewing frustum to the unit box.\n * We assume a unit box extending from -1 to 1 in the x and y dimensions and\n * from 0 to 1 in the z dimension.\n *\n * Note: If you pass `Infinity` for zFar then it will produce a projection matrix\n * returns -Infinity for Z when transforming coordinates with Z <= 0 and +Infinity for Z\n * otherwise.\n *\n * @param fieldOfViewYInRadians - The camera angle from top to bottom (in radians).\n * @param aspect - The aspect ratio width / height.\n * @param zNear - The depth (negative z coordinate)\n * of the near clipping plane.\n * @param zFar - The depth (negative z coordinate)\n * of the far clipping plane.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The perspective matrix.\n */\nexport function perspective(fieldOfViewYInRadians: number, aspect: number, zNear: number, zFar: number, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n const f = Math.tan(Math.PI * 0.5 - 0.5 * fieldOfViewYInRadians);\n\n dst[0] = f / aspect;\n dst[1] = 0;\n dst[2] = 0;\n dst[3] = 0;\n\n dst[4] = 0;\n dst[5] = f;\n dst[6] = 0;\n dst[7] = 0;\n\n dst[8] = 0;\n dst[9] = 0;\n dst[11] = -1;\n\n dst[12] = 0;\n dst[13] = 0;\n dst[15] = 0;\n\n if (Number.isFinite(zFar)) {\n const rangeInv = 1 / (zNear - zFar);\n dst[10] = zFar * rangeInv;\n dst[14] = zFar * zNear * rangeInv;\n } else {\n dst[10] = -1;\n dst[14] = -zNear;\n }\n\n return dst;\n}\n\n/**\n * Computes a 4-by-4 reverse-z perspective transformation matrix given the angular height\n * of the frustum, the aspect ratio, and the near and far clipping planes. The\n * arguments define a frustum extending in the negative z direction. The given\n * angle is the vertical angle of the frustum, and the horizontal angle is\n * determined to produce the given aspect ratio. The arguments near and far are\n * the distances to the near and far clipping planes. Note that near and far\n * are not z coordinates, but rather they are distances along the negative\n * z-axis. The matrix generated sends the viewing frustum to the unit box.\n * We assume a unit box extending from -1 to 1 in the x and y dimensions and\n * from 1 (at -zNear) to 0 (at -zFar) in the z dimension.\n *\n * @param fieldOfViewYInRadians - The camera angle from top to bottom (in radians).\n * @param aspect - The aspect ratio width / height.\n * @param zNear - The depth (negative z coordinate)\n * of the near clipping plane.\n * @param zFar - The depth (negative z coordinate)\n * of the far clipping plane. (default = Infinity)\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The perspective matrix.\n */export function perspectiveReverseZ(fieldOfViewYInRadians: number, aspect: number, zNear: number, zFar = Infinity, dst?: Mat4) {\n dst = dst || new MatType(16);\n\n const f = 1 / Math.tan(fieldOfViewYInRadians * 0.5);\n\n dst[ 0] = f / aspect;\n dst[ 1] = 0;\n dst[ 2] = 0;\n dst[ 3] = 0;\n\n dst[ 4] = 0;\n dst[ 5] = f;\n dst[ 6] = 0;\n dst[ 7] = 0;\n\n dst[ 8] = 0;\n dst[ 9] = 0;\n dst[11] = -1;\n\n dst[12] = 0;\n dst[13] = 0;\n dst[15] = 0;\n\n if (zFar === Infinity) {\n dst[10] = 0;\n dst[14] = zNear;\n } else {\n const rangeInv = 1 / (zFar - zNear);\n dst[10] = zNear * rangeInv;\n dst[14] = zFar * zNear * rangeInv;\n }\n\n return dst;\n}\n\n/**\n * Computes a 4-by-4 orthogonal transformation matrix that transforms from\n * the given the left, right, bottom, and top dimensions to -1 +1 in x, and y\n * and 0 to +1 in z.\n * @param left - Left side of the near clipping plane viewport.\n * @param right - Right side of the near clipping plane viewport.\n * @param bottom - Bottom of the near clipping plane viewport.\n * @param top - Top of the near clipping plane viewport.\n * @param near - The depth (negative z coordinate)\n * of the near clipping plane.\n * @param far - The depth (negative z coordinate)\n * of the far clipping plane.\n * @param dst - Output matrix. If not passed a new one is created.\n * @returns The orthographic projection matrix.\n */\nexport function ortho(left: number, right: number, bottom: number, top: number, near: number, far: number, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n dst[0] = 2 / (right - left);\n dst[1] = 0;\n dst[2] = 0;\n dst[3] = 0;\n\n dst[4] = 0;\n dst[5] = 2 / (top - bottom);\n dst[6] = 0;\n dst[7] = 0;\n\n dst[8] = 0;\n dst[9] = 0;\n dst[10] = 1 / (near - far);\n dst[11] = 0;\n\n dst[12] = (right + left) / (left - right);\n dst[13] = (top + bottom) / (bottom - top);\n dst[14] = near / (near - far);\n dst[15] = 1;\n\n return dst;\n}\n\n/**\n * Computes a 4-by-4 perspective transformation matrix given the left, right,\n * top, bottom, near and far clipping planes. The arguments define a frustum\n * extending in the negative z direction. The arguments near and far are the\n * distances to the near and far clipping planes. Note that near and far are not\n * z coordinates, but rather they are distances along the negative z-axis. The\n * matrix generated sends the viewing frustum to the unit box. We assume a unit\n * box extending from -1 to 1 in the x and y dimensions and from 0 to 1 in the z\n * dimension.\n * @param left - The x coordinate of the left plane of the box.\n * @param right - The x coordinate of the right plane of the box.\n * @param bottom - The y coordinate of the bottom plane of the box.\n * @param top - The y coordinate of the right plane of the box.\n * @param near - The negative z coordinate of the near plane of the box.\n * @param far - The negative z coordinate of the far plane of the box.\n * @param dst - Output matrix. If not passed a new one is created.\n * @returns The perspective projection matrix.\n */\nexport function frustum(left: number, right: number, bottom: number, top: number, near: number, far: number, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n const dx = (right - left);\n const dy = (top - bottom);\n const dz = (near - far);\n\n dst[ 0] = 2 * near / dx;\n dst[ 1] = 0;\n dst[ 2] = 0;\n dst[ 3] = 0;\n dst[ 4] = 0;\n dst[ 5] = 2 * near / dy;\n dst[ 6] = 0;\n dst[ 7] = 0;\n dst[ 8] = (left + right) / dx;\n dst[ 9] = (top + bottom) / dy;\n dst[10] = far / dz;\n dst[11] = -1;\n dst[12] = 0;\n dst[13] = 0;\n dst[14] = near * far / dz;\n dst[15] = 0;\n\n return dst;\n}\n\n/**\n * Computes a 4-by-4 reverse-z perspective transformation matrix given the left, right,\n * top, bottom, near and far clipping planes. The arguments define a frustum\n * extending in the negative z direction. The arguments near and far are the\n * distances to the near and far clipping planes. Note that near and far are not\n * z coordinates, but rather they are distances along the negative z-axis. The\n * matrix generated sends the viewing frustum to the unit box. We assume a unit\n * box extending from -1 to 1 in the x and y dimensions and from 1 (-near) to 0 (-far) in the z\n * dimension.\n * @param left - The x coordinate of the left plane of the box.\n * @param right - The x coordinate of the right plane of the box.\n * @param bottom - The y coordinate of the bottom plane of the box.\n * @param top - The y coordinate of the right plane of the box.\n * @param near - The negative z coordinate of the near plane of the box.\n * @param far - The negative z coordinate of the far plane of the box.\n * @param dst - Output matrix. If not passed a new one is created.\n * @returns The perspective projection matrix.\n */\nexport function frustumReverseZ(left: number, right: number, bottom: number, top: number, near: number, far = Infinity, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n const dx = (right - left);\n const dy = (top - bottom);\n\n dst[ 0] = 2 * near / dx;\n dst[ 1] = 0;\n dst[ 2] = 0;\n dst[ 3] = 0;\n dst[ 4] = 0;\n dst[ 5] = 2 * near / dy;\n dst[ 6] = 0;\n dst[ 7] = 0;\n dst[ 8] = (left + right) / dx;\n dst[ 9] = (top + bottom) / dy;\n dst[11] = -1;\n dst[12] = 0;\n dst[13] = 0;\n dst[15] = 0;\n\n if (far === Infinity) {\n dst[10] = 0;\n dst[14] = near;\n } else {\n const rangeInv = 1 / (far - near);\n dst[10] = near * rangeInv;\n dst[14] = far * near * rangeInv;\n }\n\n return dst;\n}\n\nlet xAxis: Vec3;\nlet yAxis: Vec3;\nlet zAxis: Vec3;\n\n/**\n * Computes a 4-by-4 aim transformation.\n *\n * This is a matrix which positions an object aiming down positive Z.\n * toward the target.\n *\n * Note: this is **NOT** the inverse of lookAt as lookAt looks at negative Z.\n *\n * @param position - The position of the object.\n * @param target - The position meant to be aimed at.\n * @param up - A vector pointing up.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The aim matrix.\n */\nexport function aim(position: Vec3, target: Vec3, up: Vec3, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n xAxis = xAxis || vec3.create();\n yAxis = yAxis || vec3.create();\n zAxis = zAxis || vec3.create();\n\n vec3.normalize(vec3.subtract(target, position, zAxis), zAxis);\n vec3.normalize(vec3.cross(up, zAxis, xAxis), xAxis);\n vec3.normalize(vec3.cross(zAxis, xAxis, yAxis), yAxis);\n\n dst[ 0] = xAxis[0]; dst[ 1] = xAxis[1]; dst[ 2] = xAxis[2]; dst[ 3] = 0;\n dst[ 4] = yAxis[0]; dst[ 5] = yAxis[1]; dst[ 6] = yAxis[2]; dst[ 7] = 0;\n dst[ 8] = zAxis[0]; dst[ 9] = zAxis[1]; dst[10] = zAxis[2]; dst[11] = 0;\n dst[12] = position[0]; dst[13] = position[1]; dst[14] = position[2]; dst[15] = 1;\n\n return dst;\n}\n\n/**\n * Computes a 4-by-4 camera aim transformation.\n *\n * This is a matrix which positions an object aiming down negative Z.\n * toward the target.\n *\n * Note: this is the inverse of `lookAt`\n *\n * @param eye - The position of the object.\n * @param target - The position meant to be aimed at.\n * @param up - A vector pointing up.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The aim matrix.\n */\nexport function cameraAim(eye: Vec3, target: Vec3, up: Vec3, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n xAxis = xAxis || vec3.create();\n yAxis = yAxis || vec3.create();\n zAxis = zAxis || vec3.create();\n\n vec3.normalize(vec3.subtract(eye, target, zAxis), zAxis);\n vec3.normalize(vec3.cross(up, zAxis, xAxis), xAxis);\n vec3.normalize(vec3.cross(zAxis, xAxis, yAxis), yAxis);\n\n dst[ 0] = xAxis[0]; dst[ 1] = xAxis[1]; dst[ 2] = xAxis[2]; dst[ 3] = 0;\n dst[ 4] = yAxis[0]; dst[ 5] = yAxis[1]; dst[ 6] = yAxis[2]; dst[ 7] = 0;\n dst[ 8] = zAxis[0]; dst[ 9] = zAxis[1]; dst[10] = zAxis[2]; dst[11] = 0;\n dst[12] = eye[0]; dst[13] = eye[1]; dst[14] = eye[2]; dst[15] = 1;\n\n return dst;\n}\n\n/**\n * Computes a 4-by-4 view transformation.\n *\n * This is a view matrix which transforms all other objects\n * to be in the space of the view defined by the parameters.\n *\n * @param eye - The position of the object.\n * @param target - The position meant to be aimed at.\n * @param up - A vector pointing up.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The look-at matrix.\n */\nexport function lookAt(eye: Vec3, target: Vec3, up: Vec3, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n xAxis = xAxis || vec3.create();\n yAxis = yAxis || vec3.create();\n zAxis = zAxis || vec3.create();\n\n vec3.normalize(vec3.subtract(eye, target, zAxis), zAxis);\n vec3.normalize(vec3.cross(up, zAxis, xAxis), xAxis);\n vec3.normalize(vec3.cross(zAxis, xAxis, yAxis), yAxis);\n\n dst[ 0] = xAxis[0]; dst[ 1] = yAxis[0]; dst[ 2] = zAxis[0]; dst[ 3] = 0;\n dst[ 4] = xAxis[1]; dst[ 5] = yAxis[1]; dst[ 6] = zAxis[1]; dst[ 7] = 0;\n dst[ 8] = xAxis[2]; dst[ 9] = yAxis[2]; dst[10] = zAxis[2]; dst[11] = 0;\n\n dst[12] = -(xAxis[0] * eye[0] + xAxis[1] * eye[1] + xAxis[2] * eye[2]);\n dst[13] = -(yAxis[0] * eye[0] + yAxis[1] * eye[1] + yAxis[2] * eye[2]);\n dst[14] = -(zAxis[0] * eye[0] + zAxis[1] * eye[1] + zAxis[2] * eye[2]);\n dst[15] = 1;\n\n return dst;\n}\n\n/**\n * Creates a 4-by-4 matrix which translates by the given vector v.\n * @param v - The vector by\n * which to translate.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The translation matrix.\n */\nexport function translation(v: Vec3, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n dst[ 0] = 1; dst[ 1] = 0; dst[ 2] = 0; dst[ 3] = 0;\n dst[ 4] = 0; dst[ 5] = 1; dst[ 6] = 0; dst[ 7] = 0;\n dst[ 8] = 0; dst[ 9] = 0; dst[10] = 1; dst[11] = 0;\n dst[12] = v[0]; dst[13] = v[1]; dst[14] = v[2]; dst[15] = 1;\n\n return dst;\n}\n\n/**\n * Translates the given 4-by-4 matrix by the given vector v.\n * @param m - The matrix.\n * @param v - The vector by\n * which to translate.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The translated matrix.\n */\nexport function translate(m: Mat4, v: Vec3, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const m00 = m[0];\n const m01 = m[1];\n const m02 = m[2];\n const m03 = m[3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const m30 = m[3 * 4 + 0];\n const m31 = m[3 * 4 + 1];\n const m32 = m[3 * 4 + 2];\n const m33 = m[3 * 4 + 3];\n\n if (m !== dst) {\n dst[ 0] = m00;\n dst[ 1] = m01;\n dst[ 2] = m02;\n dst[ 3] = m03;\n dst[ 4] = m10;\n dst[ 5] = m11;\n dst[ 6] = m12;\n dst[ 7] = m13;\n dst[ 8] = m20;\n dst[ 9] = m21;\n dst[10] = m22;\n dst[11] = m23;\n }\n\n dst[12] = m00 * v0 + m10 * v1 + m20 * v2 + m30;\n dst[13] = m01 * v0 + m11 * v1 + m21 * v2 + m31;\n dst[14] = m02 * v0 + m12 * v1 + m22 * v2 + m32;\n dst[15] = m03 * v0 + m13 * v1 + m23 * v2 + m33;\n\n return dst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the x-axis by the given angle.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotation matrix.\n */\nexport function rotationX(angleInRadians: number, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n dst[ 0] = 1; dst[ 1] = 0; dst[ 2] = 0; dst[ 3] = 0;\n dst[ 4] = 0; dst[ 5] = c; dst[ 6] = s; dst[ 7] = 0;\n dst[ 8] = 0; dst[ 9] = -s; dst[10] = c; dst[11] = 0;\n dst[12] = 0; dst[13] = 0; dst[14] = 0; dst[15] = 1;\n\n return dst;\n}\n\n/**\n * Rotates the given 4-by-4 matrix around the x-axis by the given\n * angle.\n * @param m - The matrix.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nexport function rotateX(m: Mat4, angleInRadians: number, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n const m10 = m[4];\n const m11 = m[5];\n const m12 = m[6];\n const m13 = m[7];\n const m20 = m[8];\n const m21 = m[9];\n const m22 = m[10];\n const m23 = m[11];\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n dst[4] = c * m10 + s * m20;\n dst[5] = c * m11 + s * m21;\n dst[6] = c * m12 + s * m22;\n dst[7] = c * m13 + s * m23;\n dst[8] = c * m20 - s * m10;\n dst[9] = c * m21 - s * m11;\n dst[10] = c * m22 - s * m12;\n dst[11] = c * m23 - s * m13;\n\n if (m !== dst) {\n dst[ 0] = m[ 0];\n dst[ 1] = m[ 1];\n dst[ 2] = m[ 2];\n dst[ 3] = m[ 3];\n dst[12] = m[12];\n dst[13] = m[13];\n dst[14] = m[14];\n dst[15] = m[15];\n }\n\n return dst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the y-axis by the given angle.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotation matrix.\n */\nexport function rotationY(angleInRadians: number, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n dst[ 0] = c; dst[ 1] = 0; dst[ 2] = -s; dst[ 3] = 0;\n dst[ 4] = 0; dst[ 5] = 1; dst[ 6] = 0; dst[ 7] = 0;\n dst[ 8] = s; dst[ 9] = 0; dst[10] = c; dst[11] = 0;\n dst[12] = 0; dst[13] = 0; dst[14] = 0; dst[15] = 1;\n\n return dst;\n}\n\n/**\n * Rotates the given 4-by-4 matrix around the y-axis by the given\n * angle.\n * @param m - The matrix.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nexport function rotateY(m: Mat4, angleInRadians: number, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n dst[ 0] = c * m00 - s * m20;\n dst[ 1] = c * m01 - s * m21;\n dst[ 2] = c * m02 - s * m22;\n dst[ 3] = c * m03 - s * m23;\n dst[ 8] = c * m20 + s * m00;\n dst[ 9] = c * m21 + s * m01;\n dst[10] = c * m22 + s * m02;\n dst[11] = c * m23 + s * m03;\n\n if (m !== dst) {\n dst[ 4] = m[ 4];\n dst[ 5] = m[ 5];\n dst[ 6] = m[ 6];\n dst[ 7] = m[ 7];\n dst[12] = m[12];\n dst[13] = m[13];\n dst[14] = m[14];\n dst[15] = m[15];\n }\n\n return dst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the z-axis by the given angle.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotation matrix.\n */\nexport function rotationZ(angleInRadians: number, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n dst[ 0] = c; dst[ 1] = s; dst[ 2] = 0; dst[ 3] = 0;\n dst[ 4] = -s; dst[ 5] = c; dst[ 6] = 0; dst[ 7] = 0;\n dst[ 8] = 0; dst[ 9] = 0; dst[10] = 1; dst[11] = 0;\n dst[12] = 0; dst[13] = 0; dst[14] = 0; dst[15] = 1;\n\n return dst;\n}\n\n/**\n * Rotates the given 4-by-4 matrix around the z-axis by the given\n * angle.\n * @param m - The matrix.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nexport function rotateZ(m: Mat4, angleInRadians: number, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n dst[ 0] = c * m00 + s * m10;\n dst[ 1] = c * m01 + s * m11;\n dst[ 2] = c * m02 + s * m12;\n dst[ 3] = c * m03 + s * m13;\n dst[ 4] = c * m10 - s * m00;\n dst[ 5] = c * m11 - s * m01;\n dst[ 6] = c * m12 - s * m02;\n dst[ 7] = c * m13 - s * m03;\n\n if (m !== dst) {\n dst[ 8] = m[ 8];\n dst[ 9] = m[ 9];\n dst[10] = m[10];\n dst[11] = m[11];\n dst[12] = m[12];\n dst[13] = m[13];\n dst[14] = m[14];\n dst[15] = m[15];\n }\n\n return dst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the given axis by the given\n * angle.\n * @param axis - The axis\n * about which to rotate.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns A matrix which rotates angle radians\n * around the axis.\n */\nexport function axisRotation(axis: Vec3, angleInRadians: number, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n let x = axis[0];\n let y = axis[1];\n let z = axis[2];\n const n = Math.sqrt(x * x + y * y + z * z);\n x /= n;\n y /= n;\n z /= n;\n const xx = x * x;\n const yy = y * y;\n const zz = z * z;\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n const oneMinusCosine = 1 - c;\n\n dst[ 0] = xx + (1 - xx) * c;\n dst[ 1] = x * y * oneMinusCosine + z * s;\n dst[ 2] = x * z * oneMinusCosine - y * s;\n dst[ 3] = 0;\n dst[ 4] = x * y * oneMinusCosine - z * s;\n dst[ 5] = yy + (1 - yy) * c;\n dst[ 6] = y * z * oneMinusCosine + x * s;\n dst[ 7] = 0;\n dst[ 8] = x * z * oneMinusCosine + y * s;\n dst[ 9] = y * z * oneMinusCosine - x * s;\n dst[10] = zz + (1 - zz) * c;\n dst[11] = 0;\n dst[12] = 0;\n dst[13] = 0;\n dst[14] = 0;\n dst[15] = 1;\n\n return dst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the given axis by the given\n * angle. (same as axisRotation)\n * @param axis - The axis\n * about which to rotate.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns A matrix which rotates angle radians\n * around the axis.\n */\nexport const rotation = axisRotation;\n\n/**\n * Rotates the given 4-by-4 matrix around the given axis by the\n * given angle.\n * @param m - The matrix.\n * @param axis - The axis\n * about which to rotate.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nexport function axisRotate(m: Mat4, axis: Vec3, angleInRadians: number, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n let x = axis[0];\n let y = axis[1];\n let z = axis[2];\n const n = Math.sqrt(x * x + y * y + z * z);\n x /= n;\n y /= n;\n z /= n;\n const xx = x * x;\n const yy = y * y;\n const zz = z * z;\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n const oneMinusCosine = 1 - c;\n\n const r00 = xx + (1 - xx) * c;\n const r01 = x * y * oneMinusCosine + z * s;\n const r02 = x * z * oneMinusCosine - y * s;\n const r10 = x * y * oneMinusCosine - z * s;\n const r11 = yy + (1 - yy) * c;\n const r12 = y * z * oneMinusCosine + x * s;\n const r20 = x * z * oneMinusCosine + y * s;\n const r21 = y * z * oneMinusCosine - x * s;\n const r22 = zz + (1 - zz) * c;\n\n const m00 = m[0];\n const m01 = m[1];\n const m02 = m[2];\n const m03 = m[3];\n const m10 = m[4];\n const m11 = m[5];\n const m12 = m[6];\n const m13 = m[7];\n const m20 = m[8];\n const m21 = m[9];\n const m22 = m[10];\n const m23 = m[11];\n\n dst[ 0] = r00 * m00 + r01 * m10 + r02 * m20;\n dst[ 1] = r00 * m01 + r01 * m11 + r02 * m21;\n dst[ 2] = r00 * m02 + r01 * m12 + r02 * m22;\n dst[ 3] = r00 * m03 + r01 * m13 + r02 * m23;\n dst[ 4] = r10 * m00 + r11 * m10 + r12 * m20;\n dst[ 5] = r10 * m01 + r11 * m11 + r12 * m21;\n dst[ 6] = r10 * m02 + r11 * m12 + r12 * m22;\n dst[ 7] = r10 * m03 + r11 * m13 + r12 * m23;\n dst[ 8] = r20 * m00 + r21 * m10 + r22 * m20;\n dst[ 9] = r20 * m01 + r21 * m11 + r22 * m21;\n dst[10] = r20 * m02 + r21 * m12 + r22 * m22;\n dst[11] = r20 * m03 + r21 * m13 + r22 * m23;\n\n if (m !== dst) {\n dst[12] = m[12];\n dst[13] = m[13];\n dst[14] = m[14];\n dst[15] = m[15];\n }\n\n return dst;\n}\n\n/**\n * Rotates the given 4-by-4 matrix around the given axis by the\n * given angle. (same as rotate)\n * @param m - The matrix.\n * @param axis - The axis\n * about which to rotate.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nexport const rotate = axisRotate;\n\n/**\n * Creates a 4-by-4 matrix which scales in each dimension by an amount given by\n * the corresponding entry in the given vector; assumes the vector has three\n * entries.\n * @param v - A vector of\n * three entries specifying the factor by which to scale in each dimension.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaling matrix.\n */\nexport function scaling(v: Vec3, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n dst[ 0] = v[0]; dst[ 1] = 0; dst[ 2] = 0; dst[ 3] = 0;\n dst[ 4] = 0; dst[ 5] = v[1]; dst[ 6] = 0; dst[ 7] = 0;\n dst[ 8] = 0; dst[ 9] = 0; dst[10] = v[2]; dst[11] = 0;\n dst[12] = 0; dst[13] = 0; dst[14] = 0; dst[15] = 1;\n\n return dst;\n}\n\n/**\n * Scales the given 4-by-4 matrix in each dimension by an amount\n * given by the corresponding entry in the given vector; assumes the vector has\n * three entries.\n * @param m - The matrix to be modified.\n * @param v - A vector of three entries specifying the\n * factor by which to scale in each dimension.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaled matrix.\n */\nexport function scale(m: Mat4, v: Vec3, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n\n dst[ 0] = v0 * m[0 * 4 + 0];\n dst[ 1] = v0 * m[0 * 4 + 1];\n dst[ 2] = v0 * m[0 * 4 + 2];\n dst[ 3] = v0 * m[0 * 4 + 3];\n dst[ 4] = v1 * m[1 * 4 + 0];\n dst[ 5] = v1 * m[1 * 4 + 1];\n dst[ 6] = v1 * m[1 * 4 + 2];\n dst[ 7] = v1 * m[1 * 4 + 3];\n dst[ 8] = v2 * m[2 * 4 + 0];\n dst[ 9] = v2 * m[2 * 4 + 1];\n dst[10] = v2 * m[2 * 4 + 2];\n dst[11] = v2 * m[2 * 4 + 3];\n\n if (m !== dst) {\n dst[12] = m[12];\n dst[13] = m[13];\n dst[14] = m[14];\n dst[15] = m[15];\n }\n\n return dst;\n}\n\n/**\n * Creates a 4-by-4 matrix which scales a uniform amount in each dimension.\n * @param s - the amount to scale\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaling matrix.\n */\nexport function uniformScaling(s: number, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n dst[ 0] = s; dst[ 1] = 0; dst[ 2] = 0; dst[ 3] = 0;\n dst[ 4] = 0; dst[ 5] = s; dst[ 6] = 0; dst[ 7] = 0;\n dst[ 8] = 0; dst[ 9] = 0; dst[10] = s; dst[11] = 0;\n dst[12] = 0; dst[13] = 0; dst[14] = 0; dst[15] = 1;\n\n return dst;\n}\n\n/**\n * Scales the given 4-by-4 matrix in each dimension by a uniform scale.\n * @param m - The matrix to be modified.\n * @param s - The amount to scale.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaled matrix.\n */\nexport function uniformScale(m: Mat4, s: number, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n dst[ 0] = s * m[0 * 4 + 0];\n dst[ 1] = s * m[0 * 4 + 1];\n dst[ 2] = s * m[0 * 4 + 2];\n dst[ 3] = s * m[0 * 4 + 3];\n dst[ 4] = s * m[1 * 4 + 0];\n dst[ 5] = s * m[1 * 4 + 1];\n dst[ 6] = s * m[1 * 4 + 2];\n dst[ 7] = s * m[1 * 4 + 3];\n dst[ 8] = s * m[2 * 4 + 0];\n dst[ 9] = s * m[2 * 4 + 1];\n dst[10] = s * m[2 * 4 + 2];\n dst[11] = s * m[2 * 4 + 3];\n\n if (m !== dst) {\n dst[12] = m[12];\n dst[13] = m[13];\n dst[14] = m[14];\n dst[15] = m[15];\n }\n\n return dst;\n}","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\n\n/**\n * A JavaScript array with 4 values, Float32Array with 4 values, or a Float64Array with 4 values.\n * When created by the library will create the default type which is `Float32Array`\n * but can be set by calling {@link quat.setDefaultType}.\n */\nexport type Quat = number[] | Float32Array | Float64Array;\n\n/**\n *\n * Quat4 math functions.\n *\n * Almost all functions take an optional `dst` argument. If it is not passed in the\n * functions will create a new `Quat4`. In other words you can do this\n *\n * const v = quat4.cross(v1, v2); // Creates a new Quat4 with the cross product of v1 x v2.\n *\n * or\n *\n * const v = quat4.create();\n * quat4.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v\n *\n * The first style is often easier but depending on where it's used it generates garbage where\n * as there is almost never allocation with the second style.\n *\n * It is always safe to pass any vector as the destination. So for example\n *\n * quat4.cross(v1, v2, v1); // Puts the cross product of v1 x v2 in v1\n *\n */\n\nexport let QuatType: new (n: number) => Quat = Float32Array;\n\n/**\n * Sets the type this library creates for a Quat4\n * @param ctor - the constructor for the type. Either `Float32Array`, `Float64Array`, or `Array`\n * @returns previous constructor for Quat4\n */\nexport function setDefaultType(ctor: new (n: number) => Quat) {\n const oldType = QuatType;\n QuatType = ctor;\n return oldType;\n}\n\n/**\n * Creates a quat4; may be called with x, y, z to set initial values.\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @param w - Initial w value.\n * @returns the created vector\n */\nexport function create(x?: number, y?: number, z?: number, w?: number): Quat {\n const dst = new QuatType(4);\n if (x !== undefined) {\n dst[0] = x;\n if (y !== undefined) {\n dst[1] = y;\n if (z !== undefined) {\n dst[2] = z;\n if (w !== undefined) {\n dst[3] = w;\n }\n }\n }\n }\n return dst;\n}","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport * as utils from './utils.js';\nimport { Quat, create, setDefaultType, QuatType } from './quat';\nimport { Mat3 } from './mat3.js';\nimport { Mat4 } from './mat4.js';\nimport { Vec3 } from './vec3.js';\nimport * as vec3 from './vec3-impl.js';\n\nexport type RotationOrder = 'xyz' | 'xzy' | 'yxz' | 'yzx' | 'zxy' | 'zyx';\n\nexport default Quat;\nexport { create, setDefaultType };\n\n/**\n * Creates a Quat; may be called with x, y, z to set initial values. (same as create)\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @param z - Initial w value.\n * @returns the created vector\n */\nexport const fromValues = create;\n\n/**\n * Sets the values of a Quat\n * Also see {@link quat.create} and {@link quat.copy}\n *\n * @param x first value\n * @param y second value\n * @param z third value\n * @param w fourth value\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector with its elements set.\n */\nexport function set(x: number, y: number, z: number, w: number, dst?: Quat) {\n dst = dst || new QuatType(4);\n\n dst[0] = x;\n dst[1] = y;\n dst[2] = z;\n dst[3] = w;\n\n return dst;\n}\n\n/**\n * Sets a quaternion from the given angle and axis,\n * then returns it.\n *\n * @param axis - the axis to rotate around\n * @param angleInRadians - the angle\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The quaternion that represents the given axis and angle\n **/\nexport function fromAxisAngle(axis: Vec3, angleInRadians: number, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n const halfAngle = angleInRadians * 0.5;\n const s = Math.sin(halfAngle);\n\n dst[0] = s * axis[0];\n dst[1] = s * axis[1];\n dst[2] = s * axis[2];\n dst[3] = Math.cos(halfAngle);\n\n return dst;\n}\n\n/**\n * Gets the rotation axis and angle\n * @param q - quaternion to compute from\n * @param dst - Vec3 to hold result. If not passed in a new one is created.\n * @return angle and axis\n */\nexport function toAxisAngle(q: Quat, dst?: Vec3): { angle: number, axis: Vec3 } {\n dst = dst || vec3.create(4);\n\n const angle = Math.acos(q[3]) * 2;\n const s = Math.sin(angle * 0.5);\n if (s > utils.EPSILON) {\n dst[0] = q[0] / s;\n dst[1] = q[1] / s;\n dst[2] = q[2] / s;\n } else {\n dst[0] = 1;\n dst[1] = 0;\n dst[2] = 0;\n }\n\n return { angle, axis: dst };\n}\n\n/**\n * Returns the angle in degrees between two rotations a and b.\n * @param a - quaternion a\n * @param b - quaternion b\n * @return angle in radians between the two quaternions\n */\nexport function angle(a: Quat, b: Quat) {\n const d = dot(a, b);\n return Math.acos(2 * d * d - 1);\n}\n\n/**\n * Multiplies two quaternions\n *\n * @param a - the first quaternion\n * @param b - the second quaternion\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nexport function multiply(a: Quat, b: Quat, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const aw = a[3];\n\n const bx = b[0];\n const by = b[1];\n const bz = b[2];\n const bw = b[3];\n\n dst[0] = ax * bw + aw * bx + ay * bz - az * by;\n dst[1] = ay * bw + aw * by + az * bx - ax * bz;\n dst[2] = az * bw + aw * bz + ax * by - ay * bx;\n dst[3] = aw * bw - ax * bx - ay * by - az * bz;\n\n return dst;\n}\n\n/**\n * Multiplies two quaternions\n *\n * @param a - the first quaternion\n * @param b - the second quaternion\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nexport const mul = multiply;\n\n/**\n * Rotates the given quaternion around the X axis by the given angle.\n * @param q - quaternion to rotate\n * @param angleInRadians - The angle by which to rotate\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nexport function rotateX(q: Quat, angleInRadians: number, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n const halfAngle = angleInRadians * 0.5;\n\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const qw = q[3];\n\n const bx = Math.sin(halfAngle);\n const bw = Math.cos(halfAngle);\n\n dst[0] = qx * bw + qw * bx;\n dst[1] = qy * bw + qz * bx;\n dst[2] = qz * bw - qy * bx;\n dst[3] = qw * bw - qx * bx;\n\n return dst;\n}\n\n/**\n * Rotates the given quaternion around the Y axis by the given angle.\n * @param q - quaternion to rotate\n * @param angleInRadians - The angle by which to rotate\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nexport function rotateY(q: Quat, angleInRadians: number, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n const halfAngle = angleInRadians * 0.5;\n\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const qw = q[3];\n\n const by = Math.sin(halfAngle);\n const bw = Math.cos(halfAngle);\n\n dst[0] = qx * bw - qz * by;\n dst[1] = qy * bw + qw * by;\n dst[2] = qz * bw + qx * by;\n dst[3] = qw * bw - qy * by;\n\n return dst;\n}\n\n/**\n * Rotates the given quaternion around the Z axis by the given angle.\n * @param q - quaternion to rotate\n * @param angleInRadians - The angle by which to rotate\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nexport function rotateZ(q: Quat, angleInRadians: number, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n const halfAngle = angleInRadians * 0.5;\n\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const qw = q[3];\n\n const bz = Math.sin(halfAngle);\n const bw = Math.cos(halfAngle);\n\n dst[0] = qx * bw + qy * bz;\n dst[1] = qy * bw - qx * bz;\n dst[2] = qz * bw + qw * bz;\n dst[3] = qw * bw - qz * bz;\n\n return dst;\n}\n\n/**\n * Spherically linear interpolate between two quaternions\n *\n * @param a - starting value\n * @param b - ending value\n * @param t - value where 0 = a and 1 = b\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nexport function slerp(a: Quat, b: Quat, t: number, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const aw = a[3];\n\n let bx = b[0];\n let by = b[1];\n let bz = b[2];\n let bw = b[3];\n\n let cosOmega = ax * bx + ay * by + az * bz + aw * bw;\n\n if (cosOmega < 0) {\n cosOmega = -cosOmega;\n bx = -bx;\n by = -by;\n bz = -bz;\n bw = -bw;\n }\n\n let scale0;\n let scale1;\n\n if (1.0 - cosOmega > utils.EPSILON) {\n const omega = Math.acos(cosOmega);\n const sinOmega = Math.sin(omega);\n scale0 = Math.sin((1 - t) * omega) / sinOmega;\n scale1 = Math.sin(t * omega) / sinOmega;\n } else {\n scale0 = 1.0 - t;\n scale1 = t;\n }\n\n dst[0] = scale0 * ax + scale1 * bx;\n dst[1] = scale0 * ay + scale1 * by;\n dst[2] = scale0 * az + scale1 * bz;\n dst[3] = scale0 * aw + scale1 * bw;\n\n return dst;\n}\n\n/**\n * Compute the inverse of a quaternion\n *\n * @param q - quaternion to compute the inverse of\n * @returns A quaternion that is the result of a * b\n */\nexport function inverse(q: Quat, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n const a0 = q[0];\n const a1 = q[1];\n const a2 = q[2];\n const a3 = q[3];\n\n const dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3;\n const invDot = dot ? 1 / dot : 0;\n\n dst[0] = -a0 * invDot;\n dst[1] = -a1 * invDot;\n dst[2] = -a2 * invDot;\n dst[3] = a3 * invDot;\n\n return dst;\n}\n\n/**\n * Compute the conjugate of a quaternion\n * For quaternions with a magnitude of 1 (a unit quaternion)\n * this returns the same as the inverse but is faster to calculate.\n *\n * @param q - quaternion to compute the conjugate of.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The conjugate of q\n */\nexport function conjugate(q: Quat, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n dst[0] = -q[0];\n dst[1] = -q[1];\n dst[2] = -q[2];\n dst[3] = q[3];\n\n return dst;\n}\n\n/**\n * Creates a quaternion from the given rotation matrix.\n *\n * The created quaternion is not normalized.\n *\n * @param m - rotation matrix\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns the result\n */\nexport function fromMat(m: Mat3 | Mat4, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n /*\n 0 1 2\n 3 4 5\n 6 7 8\n\n 0 1 2\n 4 5 6\n 8 9 10\n */\n\n // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes\n // article \"Quaternion Calculus and Fast Animation\".\n const trace = m[0] + m[5] + m[10];\n\n if (trace > 0.0) {\n // |w| > 1/2, may as well choose w > 1/2\n const root = Math.sqrt(trace + 1); // 2w\n dst[3] = 0.5 * root;\n const invRoot = 0.5 / root; // 1/(4w)\n\n dst[0] = (m[6] - m[9]) * invRoot;\n dst[1] = (m[8] - m[2]) * invRoot;\n dst[2] = (m[1] - m[4]) * invRoot;\n } else {\n // |w| <= 1/2\n let i = 0;\n\n if (m[5] > m[0]) {\n i = 1;\n }\n if (m[10] > m[i * 4 + i]) {\n i = 2;\n }\n\n const j = (i + 1) % 3;\n const k = (i + 2) % 3;\n\n const root = Math.sqrt(m[i * 4 + i] - m[j * 4 + j] - m[k * 4 + k] + 1.0);\n dst[i] = 0.5 * root;\n\n const invRoot = 0.5 / root;\n\n dst[3] = (m[j * 4 + k] - m[k * 4 + j]) * invRoot;\n dst[j] = (m[j * 4 + i] + m[i * 4 + j]) * invRoot;\n dst[k] = (m[k * 4 + i] + m[i * 4 + k]) * invRoot;\n }\n\n return dst;\n}\n\n/**\n * Creates a quaternion from the given euler angle x, y, z using the provided intrinsic order for the conversion.\n *\n * @param xAngleInRadians - angle to rotate around X axis in radians.\n * @param yAngleInRadians - angle to rotate around Y axis in radians.\n * @param zAngleInRadians - angle to rotate around Z axis in radians.\n * @param order - order to apply euler angles\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion representing the same rotation as the euler angles applied in the given order\n */\nexport function fromEuler(\n xAngleInRadians: number,\n yAngleInRadians: number,\n zAngleInRadians: number,\n order: RotationOrder,\n dst?: Quat) {\n dst = dst || new QuatType(4);\n\n const xHalfAngle = xAngleInRadians * 0.5;\n const yHalfAngle = yAngleInRadians * 0.5;\n const zHalfAngle = zAngleInRadians * 0.5;\n\n const sx = Math.sin(xHalfAngle);\n const cx = Math.cos(xHalfAngle);\n const sy = Math.sin(yHalfAngle);\n const cy = Math.cos(yHalfAngle);\n const sz = Math.sin(zHalfAngle);\n const cz = Math.cos(zHalfAngle);\n\n switch (order) {\n case 'xyz':\n dst[0] = sx * cy * cz + cx * sy * sz;\n dst[1] = cx * sy * cz - sx * cy * sz;\n dst[2] = cx * cy * sz + sx * sy * cz;\n dst[3] = cx * cy * cz - sx * sy * sz;\n break;\n\n case 'xzy':\n dst[0] = sx * cy * cz - cx * sy * sz;\n dst[1] = cx * sy * cz - sx * cy * sz;\n dst[2] = cx * cy * sz + sx * sy * cz;\n dst[3] = cx * cy * cz + sx * sy * sz;\n break;\n\n case 'yxz':\n dst[0] = sx * cy * cz + cx * sy * sz;\n dst[1] = cx * sy * cz - sx * cy * sz;\n dst[2] = cx * cy * sz - sx * sy * cz;\n dst[3] = cx * cy * cz + sx * sy * sz;\n break;\n\n case 'yzx':\n dst[0] = sx * cy * cz + cx * sy * sz;\n dst[1] = cx * sy * cz + sx * cy * sz;\n dst[2] = cx * cy * sz - sx * sy * cz;\n dst[3] = cx * cy * cz - sx * sy * sz;\n break;\n\n case 'zxy':\n dst[0] = sx * cy * cz - cx * sy * sz;\n dst[1] = cx * sy * cz + sx * cy * sz;\n dst[2] = cx * cy * sz + sx * sy * cz;\n dst[3] = cx * cy * cz - sx * sy * sz;\n break;\n\n case 'zyx':\n dst[0] = sx * cy * cz - cx * sy * sz;\n dst[1] = cx * sy * cz + sx * cy * sz;\n dst[2] = cx * cy * sz - sx * sy * cz;\n dst[3] = cx * cy * cz + sx * sy * sz;\n break;\n\n default:\n throw new Error(`Unknown rotation order: ${order}`);\n }\n\n return dst;\n}\n\n/**\n * Copies a quaternion. (same as {@link quat.clone})\n * Also see {@link quat.create} and {@link quat.set}\n * @param q - The quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is a copy of q\n */\nexport function copy(q: Quat, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n dst[0] = q[0];\n dst[1] = q[1];\n dst[2] = q[2];\n dst[3] = q[3];\n\n return dst;\n}\n\n/**\n * Clones a quaternion. (same as {@link quat.copy})\n * Also see {@link quat.create} and {@link quat.set}\n * @param q - The quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A copy of q.\n */\nexport const clone = copy;\n\n/**\n * Adds two quaternions; assumes a and b have the same dimension.\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the sum of a and b.\n */\nexport function add(a: Quat, b: Quat, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n dst[0] = a[0] + b[0];\n dst[1] = a[1] + b[1];\n dst[2] = a[2] + b[2];\n dst[3] = a[3] + b[3];\n\n return dst;\n}\n\n/**\n * Subtracts two quaternions.\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the difference of a and b.\n */\nexport function subtract(a: Quat, b: Quat, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n dst[0] = a[0] - b[0];\n dst[1] = a[1] - b[1];\n dst[2] = a[2] - b[2];\n dst[3] = a[3] - b[3];\n\n return dst;\n}\n\n/**\n * Subtracts two quaternions.\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the difference of a and b.\n */\nexport const sub = subtract;\n\n/**\n * Multiplies a quaternion by a scalar.\n * @param v - The quaternion.\n * @param k - The scalar.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The scaled quaternion.\n */\nexport function mulScalar(v: Quat, k: number, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n dst[0] = v[0] * k;\n dst[1] = v[1] * k;\n dst[2] = v[2] * k;\n dst[3] = v[3] * k;\n\n return dst;\n}\n\n/**\n * Multiplies a quaternion by a scalar. (same as mulScalar)\n * @param v - The quaternion.\n * @param k - The scalar.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The scaled quaternion.\n */\nexport const scale = mulScalar;\n\n/**\n * Divides a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The scaled quaternion.\n */\nexport function divScalar(v: Quat, k: number, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n dst[0] = v[0] / k;\n dst[1] = v[1] / k;\n dst[2] = v[2] / k;\n dst[3] = v[3] / k;\n\n return dst;\n}\n\n/**\n * Computes the dot product of two quaternions\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @returns dot product\n */\nexport function dot(a: Quat, b: Quat): number {\n return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]) + (a[3] * b[3]);\n}\n\n/**\n * Performs linear interpolation on two quaternions.\n * Given quaternions a and b and interpolation coefficient t, returns\n * a + t * (b - a).\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @param t - Interpolation coefficient.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The linear interpolated result.\n */\nexport function lerp(a: Quat, b: Quat, t: number, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n dst[0] = a[0] + t * (b[0] - a[0]);\n dst[1] = a[1] + t * (b[1] - a[1]);\n dst[2] = a[2] + t * (b[2] - a[2]);\n dst[3] = a[3] + t * (b[3] - a[3]);\n\n return dst;\n}\n\n/**\n * Computes the length of quaternion\n * @param v - quaternion.\n * @returns length of quaternion.\n */\nexport function length(v: Quat): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n return Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3);\n}\n\n/**\n * Computes the length of quaternion (same as length)\n * @param v - quaternion.\n * @returns length of quaternion.\n */\nexport const len = length;\n\n/**\n * Computes the square of the length of quaternion\n * @param v - quaternion.\n * @returns square of the length of quaternion.\n */\nexport function lengthSq(v: Quat): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n return v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3;\n}\n\n/**\n * Computes the square of the length of quaternion (same as lengthSq)\n * @param v - quaternion.\n * @returns square of the length of quaternion.\n */\nexport const lenSq = lengthSq;\n\n/**\n * Divides a quaternion by its Euclidean length and returns the quotient.\n * @param v - The quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The normalized quaternion.\n */\nexport function normalize(v: Quat, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n const len = Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3);\n\n if (len > 0.00001) {\n dst[0] = v0 / len;\n dst[1] = v1 / len;\n dst[2] = v2 / len;\n dst[3] = v3 / len;\n } else {\n dst[0] = 0;\n dst[1] = 0;\n dst[2] = 0;\n dst[3] = 0;\n }\n\n return dst;\n}\n\n/**\n * Check if 2 quaternions are approximately equal\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @returns true if quaternions are approximately equal\n */\nexport function equalsApproximately(a: Quat, b: Quat): boolean {\n return Math.abs(a[0] - b[0]) < utils.EPSILON &&\n Math.abs(a[1] - b[1]) < utils.EPSILON &&\n Math.abs(a[2] - b[2]) < utils.EPSILON &&\n Math.abs(a[3] - b[3]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 quaternions are exactly equal\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @returns true if quaternions are exactly equal\n */\nexport function equals(a: Quat, b: Quat): boolean {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];\n}\n\n/**\n * Creates an identity quaternion\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns an identity quaternion\n */\nexport function identity(dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n dst[0] = 0;\n dst[1] = 0;\n dst[2] = 0;\n dst[3] = 1;\n\n return dst;\n}\n\nlet tempVec3: Vec3;\nlet xUnitVec3: Vec3;\nlet yUnitVec3: Vec3;\n\n/**\n * Computes a quaternion to represent the shortest rotation from one vector to another.\n *\n * @param aUnit - the start vector\n * @param bUnit - the end vector\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns the result\n */\nexport function rotationTo(aUnit: Vec3, bUnit: Vec3, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n tempVec3 = tempVec3 || vec3.create();\n xUnitVec3 = xUnitVec3 || vec3.create(1, 0, 0);\n yUnitVec3 = yUnitVec3 || vec3.create(0, 1, 0);\n\n const dot = vec3.dot(aUnit, bUnit);\n if (dot < -0.999999) {\n vec3.cross(xUnitVec3, aUnit, tempVec3);\n if (vec3.len(tempVec3) < 0.000001) {\n vec3.cross(yUnitVec3, aUnit, tempVec3);\n }\n\n vec3.normalize(tempVec3, tempVec3);\n fromAxisAngle(tempVec3, Math.PI, dst);\n\n return dst;\n } else if (dot > 0.999999) {\n dst[0] = 0;\n dst[1] = 0;\n dst[2] = 0;\n dst[3] = 1;\n\n return dst;\n } else {\n vec3.cross(aUnit, bUnit, tempVec3);\n\n dst[0] = tempVec3[0];\n dst[1] = tempVec3[1];\n dst[2] = tempVec3[2];\n dst[3] = 1 + dot;\n\n return normalize(dst, dst);\n }\n}\n\nlet tempQuat1: Quat;\nlet tempQuat2: Quat;\n\n/**\n * Performs a spherical linear interpolation with two control points\n *\n * @param a - the first quaternion\n * @param b - the second quaternion\n * @param c - the third quaternion\n * @param d - the fourth quaternion\n * @param t - Interpolation coefficient 0 to 1\n * @returns result\n */\nexport function sqlerp(\n a: Quat,\n b: Quat,\n c: Quat,\n d: Quat,\n t: number,\n dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n tempQuat1 = tempQuat1 || new QuatType(4);\n tempQuat2 = tempQuat2 || new QuatType(4);\n\n slerp(a, d, t, tempQuat1);\n slerp(b, c, t, tempQuat2);\n slerp(tempQuat1, tempQuat2, 2 * t * (1 - t), dst);\n\n return dst;\n}\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\n\n/**\n * A JavaScript array with 4 values, Float32Array with 4 values, or a Float64Array with 4 values.\n * When created by the library will create the default type which is `Float32Array`\n * but can be set by calling {@link vec4.setDefaultType}.\n */\nexport type Vec4 = number[] | Float32Array | Float64Array;\n\n/**\n *\n * Vec4 math functions.\n *\n * Almost all functions take an optional `dst` argument. If it is not passed in the\n * functions will create a new `Vec4`. In other words you can do this\n *\n * const v = vec4.cross(v1, v2); // Creates a new Vec4 with the cross product of v1 x v2.\n *\n * or\n *\n * const v = vec4.create();\n * vec4.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v\n *\n * The first style is often easier but depending on where it's used it generates garbage where\n * as there is almost never allocation with the second style.\n *\n * It is always safe to pass any vector as the destination. So for example\n *\n * vec4.cross(v1, v2, v1); // Puts the cross product of v1 x v2 in v1\n *\n */\n\nexport let VecType: new (n: number) => Vec4 = Float32Array;\n\n/**\n * Sets the type this library creates for a Vec4\n * @param ctor - the constructor for the type. Either `Float32Array`, `Float64Array`, or `Array`\n * @returns previous constructor for Vec4\n */\nexport function setDefaultType(ctor: new (n: number) => Vec4) {\n const oldType = VecType;\n VecType = ctor;\n return oldType;\n}\n\n/**\n * Creates a vec4; may be called with x, y, z to set initial values.\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @param w - Initial w value.\n * @returns the created vector\n */\nexport function create(x?: number, y?: number, z?: number, w?: number): Vec4 {\n const dst = new VecType(4);\n if (x !== undefined) {\n dst[0] = x;\n if (y !== undefined) {\n dst[1] = y;\n if (z !== undefined) {\n dst[2] = z;\n if (w !== undefined) {\n dst[3] = w;\n }\n }\n }\n }\n return dst;\n}","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport * as utils from './utils.js';\nimport { Vec4, create, setDefaultType, VecType } from './vec4';\nimport { Mat4 } from './mat4';\n\nexport default Vec4;\nexport { create, setDefaultType };\n\n/**\n * Creates a vec4; may be called with x, y, z to set initial values. (same as create)\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @param z - Initial w value.\n * @returns the created vector\n */\nexport const fromValues = create;\n\n/**\n * Sets the values of a Vec4\n * Also see {@link vec4.create} and {@link vec4.copy}\n *\n * @param x first value\n * @param y second value\n * @param z third value\n * @param w fourth value\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector with its elements set.\n */\nexport function set(x: number, y: number, z: number, w: number, dst?: Vec4) {\n dst = dst || new VecType(4);\n\n dst[0] = x;\n dst[1] = y;\n dst[2] = z;\n dst[3] = w;\n\n return dst;\n}\n\n/**\n * Applies Math.ceil to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the ceil of each element of v.\n */\nexport function ceil(v: Vec4, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = Math.ceil(v[0]);\n dst[1] = Math.ceil(v[1]);\n dst[2] = Math.ceil(v[2]);\n dst[3] = Math.ceil(v[3]);\n\n return dst;\n}\n\n/**\n * Applies Math.floor to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the floor of each element of v.\n */\nexport function floor(v: Vec4, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = Math.floor(v[0]);\n dst[1] = Math.floor(v[1]);\n dst[2] = Math.floor(v[2]);\n dst[3] = Math.floor(v[3]);\n\n return dst;\n}\n\n/**\n * Applies Math.round to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the round of each element of v.\n */\nexport function round(v: Vec4, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = Math.round(v[0]);\n dst[1] = Math.round(v[1]);\n dst[2] = Math.round(v[2]);\n dst[3] = Math.round(v[3]);\n\n return dst;\n}\n\n/**\n * Clamp each element of vector between min and max\n * @param v - Operand vector.\n * @param max - Min value, default 0\n * @param min - Max value, default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that the clamped value of each element of v.\n */\nexport function clamp(v: Vec4, min = 0, max = 1, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = Math.min(max, Math.max(min, v[0]));\n dst[1] = Math.min(max, Math.max(min, v[1]));\n dst[2] = Math.min(max, Math.max(min, v[2]));\n dst[3] = Math.min(max, Math.max(min, v[3]));\n\n return dst;\n}\n\n/**\n * Adds two vectors; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a and b.\n */\nexport function add(a: Vec4, b: Vec4, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = a[0] + b[0];\n dst[1] = a[1] + b[1];\n dst[2] = a[2] + b[2];\n dst[3] = a[3] + b[3];\n\n return dst;\n}\n\n/**\n * Adds two vectors, scaling the 2nd; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param scale - Amount to scale b\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a + b * scale.\n */\nexport function addScaled(a: Vec4, b: Vec4, scale: number, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = a[0] + b[0] * scale;\n dst[1] = a[1] + b[1] * scale;\n dst[2] = a[2] + b[2] * scale;\n dst[3] = a[3] + b[3] * scale;\n\n return dst;\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nexport function subtract(a: Vec4, b: Vec4, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = a[0] - b[0];\n dst[1] = a[1] - b[1];\n dst[2] = a[2] - b[2];\n dst[3] = a[3] - b[3];\n\n return dst;\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nexport const sub = subtract;\n\n/**\n * Check if 2 vectors are approximately equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are approximately equal\n */\nexport function equalsApproximately(a: Vec4, b: Vec4): boolean {\n return Math.abs(a[0] - b[0]) < utils.EPSILON &&\n Math.abs(a[1] - b[1]) < utils.EPSILON &&\n Math.abs(a[2] - b[2]) < utils.EPSILON &&\n Math.abs(a[3] - b[3]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 vectors are exactly equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are exactly equal\n */\nexport function equals(a: Vec4, b: Vec4): boolean {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficient.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The linear interpolated result.\n */\nexport function lerp(a: Vec4, b: Vec4, t: number, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = a[0] + t * (b[0] - a[0]);\n dst[1] = a[1] + t * (b[1] - a[1]);\n dst[2] = a[2] + t * (b[2] - a[2]);\n dst[3] = a[3] + t * (b[3] - a[3]);\n\n return dst;\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient vector t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficients vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns the linear interpolated result.\n */\nexport function lerpV(a: Vec4, b: Vec4, t: Vec4, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = a[0] + t[0] * (b[0] - a[0]);\n dst[1] = a[1] + t[1] * (b[1] - a[1]);\n dst[2] = a[2] + t[2] * (b[2] - a[2]);\n dst[3] = a[3] + t[3] * (b[3] - a[3]);\n\n return dst;\n}\n\n/**\n * Return max values of two vectors.\n * Given vectors a and b returns\n * [max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The max components vector.\n */\nexport function max(a: Vec4, b: Vec4, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = Math.max(a[0], b[0]);\n dst[1] = Math.max(a[1], b[1]);\n dst[2] = Math.max(a[2], b[2]);\n dst[3] = Math.max(a[3], b[3]);\n\n return dst;\n}\n\n/**\n * Return min values of two vectors.\n * Given vectors a and b returns\n * [min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The min components vector.\n */\nexport function min(a: Vec4, b: Vec4, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = Math.min(a[0], b[0]);\n dst[1] = Math.min(a[1], b[1]);\n dst[2] = Math.min(a[2], b[2]);\n dst[3] = Math.min(a[3], b[3]);\n\n return dst;\n}\n\n/**\n * Multiplies a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nexport function mulScalar(v: Vec4, k: number, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = v[0] * k;\n dst[1] = v[1] * k;\n dst[2] = v[2] * k;\n dst[3] = v[3] * k;\n\n return dst;\n}\n\n/**\n * Multiplies a vector by a scalar. (same as mulScalar)\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nexport const scale = mulScalar;\n\n/**\n * Divides a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nexport function divScalar(v: Vec4, k: number, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = v[0] / k;\n dst[1] = v[1] / k;\n dst[2] = v[2] / k;\n dst[3] = v[3] / k;\n\n return dst;\n}\n\n/**\n * Inverse a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nexport function inverse(v: Vec4, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = 1 / v[0];\n dst[1] = 1 / v[1];\n dst[2] = 1 / v[2];\n dst[3] = 1 / v[3];\n\n return dst;\n}\n\n/**\n * Invert a vector. (same as inverse)\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nexport const invert = inverse;\n\n/**\n * Computes the dot product of two vectors\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns dot product\n */\nexport function dot(a: Vec4, b: Vec4): number {\n return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]) + (a[3] * b[3]);\n}\n\n/**\n * Computes the length of vector\n * @param v - vector.\n * @returns length of vector.\n */\nexport function length(v: Vec4): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n return Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3);\n}\n\n/**\n * Computes the length of vector (same as length)\n * @param v - vector.\n * @returns length of vector.\n */\nexport const len = length;\n\n/**\n * Computes the square of the length of vector\n * @param v - vector.\n * @returns square of the length of vector.\n */\nexport function lengthSq(v: Vec4): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n return v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3;\n}\n\n/**\n * Computes the square of the length of vector (same as lengthSq)\n * @param v - vector.\n * @returns square of the length of vector.\n */\nexport const lenSq = lengthSq;\n\n/**\n * Computes the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nexport function distance(a: Vec4, b: Vec4): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n const dz = a[2] - b[2];\n const dw = a[3] - b[3];\n return Math.sqrt(dx * dx + dy * dy + dz * dz + dw * dw);\n}\n\n/**\n * Computes the distance between 2 points (same as distance)\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nexport const dist = distance;\n\n/**\n * Computes the square of the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nexport function distanceSq(a: Vec4, b: Vec4): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n const dz = a[2] - b[2];\n const dw = a[3] - b[3];\n return dx * dx + dy * dy + dz * dz + dw * dw;\n}\n\n/**\n * Computes the square of the distance between 2 points (same as distanceSq)\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nexport const distSq = distanceSq;\n\n/**\n * Divides a vector by its Euclidean length and returns the quotient.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The normalized vector.\n */\nexport function normalize(v: Vec4, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n const len = Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3);\n\n if (len > 0.00001) {\n dst[0] = v0 / len;\n dst[1] = v1 / len;\n dst[2] = v2 / len;\n dst[3] = v3 / len;\n } else {\n dst[0] = 0;\n dst[1] = 0;\n dst[2] = 0;\n dst[3] = 0;\n }\n\n return dst;\n}\n\n/**\n * Negates a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns -v.\n */\nexport function negate(v: Vec4, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = -v[0];\n dst[1] = -v[1];\n dst[2] = -v[2];\n dst[3] = -v[3];\n\n return dst;\n}\n\n/**\n * Copies a vector. (same as {@link vec4.clone})\n * Also see {@link vec4.create} and {@link vec4.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nexport function copy(v: Vec4, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = v[0];\n dst[1] = v[1];\n dst[2] = v[2];\n dst[3] = v[3];\n\n return dst;\n}\n\n/**\n * Clones a vector. (same as {@link vec4.copy})\n * Also see {@link vec4.create} and {@link vec4.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nexport const clone = copy;\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nexport function multiply(a: Vec4, b: Vec4, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = a[0] * b[0];\n dst[1] = a[1] * b[1];\n dst[2] = a[2] * b[2];\n dst[3] = a[3] * b[3];\n\n return dst;\n}\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as mul)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nexport const mul = multiply;\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nexport function divide(a: Vec4, b: Vec4, dst?: Vec4) {\n dst = dst || new VecType(4);\n\n dst[0] = a[0] / b[0];\n dst[1] = a[1] / b[1];\n dst[2] = a[2] / b[2];\n dst[3] = a[3] / b[3];\n\n return dst;\n}\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as divide)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nexport const div = divide;\n\n/**\n * Zero's a vector\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The zeroed vector.\n */\nexport function zero(dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = 0;\n dst[1] = 0;\n dst[2] = 0;\n dst[3] = 0;\n\n return dst;\n}\n\n\n/**\n * transform vec4 by 4x4 matrix\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional vec4 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nexport function transformMat4(v: Vec4, m: Mat4, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n const x = v[0];\n const y = v[1];\n const z = v[2];\n const w = v[3];\n\n dst[0] = m[0] * x + m[4] * y + m[ 8] * z + m[12] * w;\n dst[1] = m[1] * x + m[5] * y + m[ 9] * z + m[13] * w;\n dst[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;\n dst[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;\n\n return dst;\n}\n\n\n/**\n * Treat a 4D vector as a direction and set it's length\n *\n * @param a The vec4 to lengthen\n * @param len The length of the resulting vector\n * @returns The lengthened vector\n */\nexport function setLength(a: Vec4, len: number, dst?: Vec4) {\n dst = dst || new VecType(4);\n normalize(a, dst);\n return mulScalar(dst, len, dst);\n}\n\n/**\n * Ensure a vector is not longer than a max length\n *\n * @param a The vec4 to limit\n * @param maxLen The longest length of the resulting vector\n * @returns The vector, shortened to maxLen if it's too long\n */\nexport function truncate(a: Vec4, maxLen: number, dst?: Vec4) {\n dst = dst || new VecType(4);\n\n if (length(a) > maxLen) {\n return setLength(a, maxLen, dst);\n }\n\n return copy(a, dst);\n}\n\n/**\n * Return the vector exactly between 2 endpoint vectors\n *\n * @param a Endpoint 1\n * @param b Endpoint 2\n * @returns The vector exactly residing between endpoints 1 and 2\n */\nexport function midpoint(a: Vec4, b: Vec4, dst?: Vec4) {\n dst = dst || new VecType(4);\n return lerp(a, b, 0.5, dst);\n}\n","import Mat3, * as mat3 from './mat3-impl';\nimport Mat4, * as mat4 from './mat4-impl';\nimport Quat, * as quat from './quat-impl';\nimport Vec2, * as vec2 from './vec2-impl';\nimport Vec3, * as vec3 from './vec3-impl';\nimport Vec4, * as vec4 from './vec4-impl';\nimport * as utils from './utils';\n\n/**\n * Sets the type this library creates for all types\n *\n * example:\n *\n * ```\n * setDefaultType(Float64Array);\n * ```\n *\n * @param ctor - the constructor for the type. Either `Float32Array`, `Float64Array`, or `Array`\n */\nexport function setDefaultType(ctor: new (n: number) => Float32Array | Float64Array | number[]) {\n mat3.setDefaultType(ctor);\n mat4.setDefaultType(ctor);\n quat.setDefaultType(ctor);\n vec2.setDefaultType(ctor);\n vec3.setDefaultType(ctor);\n vec4.setDefaultType(ctor);\n}\n\nexport {\n Mat3,\n mat3,\n Mat4,\n mat4,\n Quat,\n quat,\n utils,\n Vec2,\n vec2,\n Vec3,\n vec3,\n Vec4,\n vec4,\n};"],"names":["EPSILON","degrees","Math","PI","n","m","a","b","v","d","abs","t","radians","old","VecType","Float32Array","setDefaultType","ctor","oldType","create","x","y","dst","undefined","z","subtract","lerp","mulScalar","k","inverse","dot","length","v0","v1","sqrt","lengthSq","distance","dx","dy","distanceSq","normalize","len","copy","multiply","divide","setLength","scale","ax","ay","bx","by","mag","cosine","acos","ceil","min","max","Vec3Type","utils.EPSILON","floor","angle","random","cos","sin","rad","p0","p1","sinC","cosC","round","maxLen","MatType","ctorMap","Map","Float64Array","Array","fill","newMat3","get","identity","m00","m01","m02","m10","m11","m12","m20","m21","m22","b01","b11","b21","invDet","a00","a01","a02","a10","a11","a12","a20","a21","a22","b00","b02","b10","b12","b20","b22","v2","v3","v4","v5","v6","v7","v8","m4","q","w","x2","y2","z2","xx","yx","yy","zx","zy","zz","wx","wy","wz","axis","off","vec2.create","xy","angleInRadians","c","s","cross","t1","t2","dz","az","bz","xz","yz","zScale","p","r","qx","qy","qz","w2","uvX","uvY","uvZ","m03","m13","m23","m30","m31","m32","m33","tmp0","tmp1","tmp2","tmp3","tmp4","tmp5","tmp6","tmp7","tmp8","tmp9","tmp10","tmp11","tmp12","tmp13","tmp14","tmp15","tmp16","tmp17","tmp18","tmp19","tmp20","tmp21","tmp22","tmp23","t0","t3","a03","a13","a23","a30","a31","a32","a33","b03","b13","b23","b30","b31","b32","b33","xAxis","yAxis","zAxis","axisRotation","oneMinusCosine","axisRotate","r00","r01","r02","r10","r11","r12","r20","r21","r22","position","target","up","vec3.create","vec3.normalize","vec3.subtract","vec3.cross","eye","v9","v10","v11","v12","v13","v14","v15","m3","left","right","bottom","top","near","far","Infinity","rangeInv","fieldOfViewYInRadians","aspect","zNear","zFar","f","tan","Number","isFinite","QuatType","fromAxisAngle","halfAngle","aw","bw","slerp","scale0","scale1","cosOmega","omega","sinOmega","tempVec3","xUnitVec3","yUnitVec3","tempQuat1","tempQuat2","xAngleInRadians","yAngleInRadians","zAngleInRadians","order","xHalfAngle","yHalfAngle","zHalfAngle","sx","cx","sy","cy","sz","cz","Error","trace","root","invRoot","i","j","a0","a1","a2","a3","invDot","qw","aUnit","bUnit","vec3.dot","vec3.len","dw","mat3.setDefaultType","mat4.setDefaultType","quat.setDefaultType","vec2.setDefaultType","vec3.setDefaultType","vec4.setDefaultType"],"mappings":"kPAsBO,IAAIA,EAAU,4DAkBf,SAAmBC,GACvB,OAAOA,EAAUC,KAAKC,GAAK,GAC7B,kBAqDgB,SAAgBC,EAAWC,GACzC,OAASD,EAAIC,EAAKA,GAAKA,CACzB,uBAxB4BC,EAAWC,EAAWC,GAChD,MAAMC,EAAIF,EAAID,EACd,OAAQJ,KAAKQ,IAAIH,EAAID,GAAKN,EACrBM,GACCE,EAAIF,GAAKG,CACjB,gBAlBqBH,EAAWC,EAAWI,GACzC,OAAOL,GAAKC,EAAID,GAAKK,CACvB,WAbM,SAAmBC,GACvB,OAAiB,IAAVA,EAAgBV,KAAKC,EAC9B,aAtBM,SAAqBK,GACzB,MAAMK,EAAMb,EAEZ,OADAA,EAAUQ,EACHK,CACT,GCmBO,IAAIC,EAAmCC,aAOx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sR,EAAoBtR,GACpBuR,EAAoBvR,GACpBwR,GAAoBxR,GACpByR,EAAoBzR,GACpB0R,EAAoB1R,GACpB2R,GAAoB3R,EACtB"} \ No newline at end of file diff --git a/dist/2.x/wgpu-matrix.module.js b/dist/2.x/wgpu-matrix.module.js deleted file mode 100644 index 4b5d5c9..0000000 --- a/dist/2.x/wgpu-matrix.module.js +++ /dev/null @@ -1,5758 +0,0 @@ -/* wgpu-matrix@2.9.1, license MIT */ -/* - * Copyright 2022 Gregg Tavares - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ -let EPSILON = 0.000001; -/** - * Set the value for EPSILON for various checks - * @param v - Value to use for EPSILON. - * @returns previous value of EPSILON; - */ -function setEpsilon(v) { - const old = EPSILON; - EPSILON = v; - return old; -} -/** - * Convert degrees to radians - * @param degrees - Angle in degrees - * @returns angle converted to radians - */ -function degToRad(degrees) { - return degrees * Math.PI / 180; -} -/** - * Convert radians to degrees - * @param radians - Angle in radians - * @returns angle converted to degrees - */ -function radToDeg(radians) { - return radians * 180 / Math.PI; -} -/** - * Lerps between a and b via t - * @param a - starting value - * @param b - ending value - * @param t - value where 0 = a and 1 = b - * @returns a + (b - a) * t - */ -function lerp$4(a, b, t) { - return a + (b - a) * t; -} -/** - * Compute the opposite of lerp. Given a and b and a value between - * a and b returns a value between 0 and 1. 0 if a, 1 if b. - * Note: no clamping is done. - * @param a - start value - * @param b - end value - * @param v - value between a and b - * @returns (v - a) / (b - a) - */ -function inverseLerp(a, b, v) { - const d = b - a; - return (Math.abs(b - a) < EPSILON) - ? a - : (v - a) / d; -} -/** - * Compute the euclidean modulo - * - * ``` - * // table for n / 3 - * -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5 <- n - * ------------------------------------ - * -2 -1 -0 -2 -1 0, 1, 2, 0, 1, 2 <- n % 3 - * 1 2 0 1 2 0, 1, 2, 0, 1, 2 <- euclideanModule(n, 3) - * ``` - * - * @param n - dividend - * @param m - divisor - * @returns the euclidean modulo of n / m - */ -function euclideanModulo(n, m) { - return ((n % m) + m) % m; -} - -var utils = { - __proto__: null, - get EPSILON () { return EPSILON; }, - degToRad: degToRad, - euclideanModulo: euclideanModulo, - inverseLerp: inverseLerp, - lerp: lerp$4, - radToDeg: radToDeg, - setEpsilon: setEpsilon -}; - -/* - * Copyright 2022 Gregg Tavares - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ -/** - * - * Vec2 math functions. - * - * Almost all functions take an optional `dst` argument. If it is not passed in the - * functions will create a new Vec2. In other words you can do this - * - * const v = vec2.cross(v1, v2); // Creates a new Vec2 with the cross product of v1 x v2. - * - * or - * - * const v = vec2.create(); - * vec2.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v - * - * The first style is often easier but depending on where it's used it generates garbage where - * as there is almost never allocation with the second style. - * - * It is always safe to pass any vector as the destination. So for example - * - * vec2.cross(v1, v2, v1); // Puts the cross product of v1 x v2 in v1 - * - */ -let VecType$2 = Float32Array; -/** - * Sets the type this library creates for a Vec2 - * @param ctor - the constructor for the type. Either `Float32Array`, `Float64Array`, or `Array` - * @returns previous constructor for Vec2 - */ -function setDefaultType$6(ctor) { - const oldType = VecType$2; - VecType$2 = ctor; - return oldType; -} -/** - * Creates a Vec2; may be called with x, y, z to set initial values. - * - * Note: Since passing in a raw JavaScript array - * is valid in all circumstances, if you want to - * force a JavaScript array into a Vec2's specified type - * it would be faster to use - * - * ``` - * const v = vec2.clone(someJSArray); - * ``` - * - * Note: a consequence of the implementation is if your Vec2Type = `Array` - * instead of `Float32Array` or `Float64Array` then any values you - * don't pass in will be undefined. Usually this is not an issue since - * (a) using `Array` is rare and (b) using `vec2.create` is usually used - * to create a Vec2 to be filled out as in - * - * ``` - * const sum = vec2.create(); - * vec2.add(v1, v2, sum); - * ``` - * - * @param x - Initial x value. - * @param y - Initial y value. - * @returns the created vector - */ -function create$5(x = 0, y = 0) { - const dst = new VecType$2(2); - if (x !== undefined) { - dst[0] = x; - if (y !== undefined) { - dst[1] = y; - } - } - return dst; -} - -/* - * Copyright 2022 Gregg Tavares - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ -/** - * - * Vec3 math functions. - * - * Almost all functions take an optional `dst` argument. If it is not passed in the - * functions will create a new `Vec3`. In other words you can do this - * - * const v = vec3.cross(v1, v2); // Creates a new Vec3 with the cross product of v1 x v2. - * - * or - * - * const v = vec3.create(); - * vec3.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v - * - * The first style is often easier but depending on where it's used it generates garbage where - * as there is almost never allocation with the second style. - * - * It is always safe to pass any vector as the destination. So for example - * - * vec3.cross(v1, v2, v1); // Puts the cross product of v1 x v2 in v1 - * - */ -let VecType$1 = Float32Array; -/** - * Sets the type this library creates for a Vec3 - * @param ctor - the constructor for the type. Either `Float32Array`, `Float64Array`, or `Array` - * @returns previous constructor for Vec3 - */ -function setDefaultType$5(ctor) { - const oldType = VecType$1; - VecType$1 = ctor; - return oldType; -} -/** - * Creates a vec3; may be called with x, y, z to set initial values. - * @param x - Initial x value. - * @param y - Initial y value. - * @param z - Initial z value. - * @returns the created vector - */ -function create$4(x, y, z) { - const dst = new VecType$1(3); - if (x !== undefined) { - dst[0] = x; - if (y !== undefined) { - dst[1] = y; - if (z !== undefined) { - dst[2] = z; - } - } - } - return dst; -} - -/* - * Copyright 2022 Gregg Tavares - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ -/** - * Creates a Vec2; may be called with x, y, z to set initial values. (same as create) - * @param x - Initial x value. - * @param y - Initial y value. - * @returns the created vector - */ -const fromValues$3 = create$5; -/** - * Sets the values of a Vec2 - * Also see {@link vec2.create} and {@link vec2.copy} - * - * @param x first value - * @param y second value - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector with its elements set. - */ -function set$5(x, y, dst) { - dst = dst || new VecType$2(2); - dst[0] = x; - dst[1] = y; - return dst; -} -/** - * Applies Math.ceil to each element of vector - * @param v - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector that is the ceil of each element of v. - */ -function ceil$2(v, dst) { - dst = dst || new VecType$2(2); - dst[0] = Math.ceil(v[0]); - dst[1] = Math.ceil(v[1]); - return dst; -} -/** - * Applies Math.floor to each element of vector - * @param v - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector that is the floor of each element of v. - */ -function floor$2(v, dst) { - dst = dst || new VecType$2(2); - dst[0] = Math.floor(v[0]); - dst[1] = Math.floor(v[1]); - return dst; -} -/** - * Applies Math.round to each element of vector - * @param v - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector that is the round of each element of v. - */ -function round$2(v, dst) { - dst = dst || new VecType$2(2); - dst[0] = Math.round(v[0]); - dst[1] = Math.round(v[1]); - return dst; -} -/** - * Clamp each element of vector between min and max - * @param v - Operand vector. - * @param max - Min value, default 0 - * @param min - Max value, default 1 - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector that the clamped value of each element of v. - */ -function clamp$2(v, min = 0, max = 1, dst) { - dst = dst || new VecType$2(2); - dst[0] = Math.min(max, Math.max(min, v[0])); - dst[1] = Math.min(max, Math.max(min, v[1])); - return dst; -} -/** - * Adds two vectors; assumes a and b have the same dimension. - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector that is the sum of a and b. - */ -function add$3(a, b, dst) { - dst = dst || new VecType$2(2); - dst[0] = a[0] + b[0]; - dst[1] = a[1] + b[1]; - return dst; -} -/** - * Adds two vectors, scaling the 2nd; assumes a and b have the same dimension. - * @param a - Operand vector. - * @param b - Operand vector. - * @param scale - Amount to scale b - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector that is the sum of a + b * scale. - */ -function addScaled$2(a, b, scale, dst) { - dst = dst || new VecType$2(2); - dst[0] = a[0] + b[0] * scale; - dst[1] = a[1] + b[1] * scale; - return dst; -} -/** - * Returns the angle in radians between two vectors. - * @param a - Operand vector. - * @param b - Operand vector. - * @returns The angle in radians between the 2 vectors. - */ -function angle$2(a, b) { - const ax = a[0]; - const ay = a[1]; - const bx = b[0]; - const by = b[1]; - const mag1 = Math.sqrt(ax * ax + ay * ay); - const mag2 = Math.sqrt(bx * bx + by * by); - const mag = mag1 * mag2; - const cosine = mag && dot$3(a, b) / mag; - return Math.acos(cosine); -} -/** - * Subtracts two vectors. - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector that is the difference of a and b. - */ -function subtract$3(a, b, dst) { - dst = dst || new VecType$2(2); - dst[0] = a[0] - b[0]; - dst[1] = a[1] - b[1]; - return dst; -} -/** - * Subtracts two vectors. - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector that is the difference of a and b. - */ -const sub$3 = subtract$3; -/** - * Check if 2 vectors are approximately equal - * @param a - Operand vector. - * @param b - Operand vector. - * @returns true if vectors are approximately equal - */ -function equalsApproximately$5(a, b) { - return Math.abs(a[0] - b[0]) < EPSILON && - Math.abs(a[1] - b[1]) < EPSILON; -} -/** - * Check if 2 vectors are exactly equal - * @param a - Operand vector. - * @param b - Operand vector. - * @returns true if vectors are exactly equal - */ -function equals$5(a, b) { - return a[0] === b[0] && a[1] === b[1]; -} -/** - * Performs linear interpolation on two vectors. - * Given vectors a and b and interpolation coefficient t, returns - * a + t * (b - a). - * @param a - Operand vector. - * @param b - Operand vector. - * @param t - Interpolation coefficient. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The linear interpolated result. - */ -function lerp$3(a, b, t, dst) { - dst = dst || new VecType$2(2); - dst[0] = a[0] + t * (b[0] - a[0]); - dst[1] = a[1] + t * (b[1] - a[1]); - return dst; -} -/** - * Performs linear interpolation on two vectors. - * Given vectors a and b and interpolation coefficient vector t, returns - * a + t * (b - a). - * @param a - Operand vector. - * @param b - Operand vector. - * @param t - Interpolation coefficients vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns the linear interpolated result. - */ -function lerpV$2(a, b, t, dst) { - dst = dst || new VecType$2(2); - dst[0] = a[0] + t[0] * (b[0] - a[0]); - dst[1] = a[1] + t[1] * (b[1] - a[1]); - return dst; -} -/** - * Return max values of two vectors. - * Given vectors a and b returns - * [max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])]. - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The max components vector. - */ -function max$2(a, b, dst) { - dst = dst || new VecType$2(2); - dst[0] = Math.max(a[0], b[0]); - dst[1] = Math.max(a[1], b[1]); - return dst; -} -/** - * Return min values of two vectors. - * Given vectors a and b returns - * [min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])]. - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The min components vector. - */ -function min$2(a, b, dst) { - dst = dst || new VecType$2(2); - dst[0] = Math.min(a[0], b[0]); - dst[1] = Math.min(a[1], b[1]); - return dst; -} -/** - * Multiplies a vector by a scalar. - * @param v - The vector. - * @param k - The scalar. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The scaled vector. - */ -function mulScalar$3(v, k, dst) { - dst = dst || new VecType$2(2); - dst[0] = v[0] * k; - dst[1] = v[1] * k; - return dst; -} -/** - * Multiplies a vector by a scalar. (same as mulScalar) - * @param v - The vector. - * @param k - The scalar. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The scaled vector. - */ -const scale$5 = mulScalar$3; -/** - * Divides a vector by a scalar. - * @param v - The vector. - * @param k - The scalar. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The scaled vector. - */ -function divScalar$3(v, k, dst) { - dst = dst || new VecType$2(2); - dst[0] = v[0] / k; - dst[1] = v[1] / k; - return dst; -} -/** - * Inverse a vector. - * @param v - The vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The inverted vector. - */ -function inverse$5(v, dst) { - dst = dst || new VecType$2(2); - dst[0] = 1 / v[0]; - dst[1] = 1 / v[1]; - return dst; -} -/** - * Invert a vector. (same as inverse) - * @param v - The vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The inverted vector. - */ -const invert$4 = inverse$5; -/** - * Computes the cross product of two vectors; assumes both vectors have - * three entries. - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The vector of a cross b. - */ -function cross$1(a, b, dst) { - dst = dst || new VecType$1(3); - const z = a[0] * b[1] - a[1] * b[0]; - dst[0] = 0; - dst[1] = 0; - dst[2] = z; - return dst; -} -/** - * Computes the dot product of two vectors; assumes both vectors have - * three entries. - * @param a - Operand vector. - * @param b - Operand vector. - * @returns dot product - */ -function dot$3(a, b) { - return a[0] * b[0] + a[1] * b[1]; -} -/** - * Computes the length of vector - * @param v - vector. - * @returns length of vector. - */ -function length$3(v) { - const v0 = v[0]; - const v1 = v[1]; - return Math.sqrt(v0 * v0 + v1 * v1); -} -/** - * Computes the length of vector (same as length) - * @param v - vector. - * @returns length of vector. - */ -const len$3 = length$3; -/** - * Computes the square of the length of vector - * @param v - vector. - * @returns square of the length of vector. - */ -function lengthSq$3(v) { - const v0 = v[0]; - const v1 = v[1]; - return v0 * v0 + v1 * v1; -} -/** - * Computes the square of the length of vector (same as lengthSq) - * @param v - vector. - * @returns square of the length of vector. - */ -const lenSq$3 = lengthSq$3; -/** - * Computes the distance between 2 points - * @param a - vector. - * @param b - vector. - * @returns distance between a and b - */ -function distance$2(a, b) { - const dx = a[0] - b[0]; - const dy = a[1] - b[1]; - return Math.sqrt(dx * dx + dy * dy); -} -/** - * Computes the distance between 2 points (same as distance) - * @param a - vector. - * @param b - vector. - * @returns distance between a and b - */ -const dist$2 = distance$2; -/** - * Computes the square of the distance between 2 points - * @param a - vector. - * @param b - vector. - * @returns square of the distance between a and b - */ -function distanceSq$2(a, b) { - const dx = a[0] - b[0]; - const dy = a[1] - b[1]; - return dx * dx + dy * dy; -} -/** - * Computes the square of the distance between 2 points (same as distanceSq) - * @param a - vector. - * @param b - vector. - * @returns square of the distance between a and b - */ -const distSq$2 = distanceSq$2; -/** - * Divides a vector by its Euclidean length and returns the quotient. - * @param v - The vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The normalized vector. - */ -function normalize$3(v, dst) { - dst = dst || new VecType$2(2); - const v0 = v[0]; - const v1 = v[1]; - const len = Math.sqrt(v0 * v0 + v1 * v1); - if (len > 0.00001) { - dst[0] = v0 / len; - dst[1] = v1 / len; - } - else { - dst[0] = 0; - dst[1] = 0; - } - return dst; -} -/** - * Negates a vector. - * @param v - The vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns -v. - */ -function negate$4(v, dst) { - dst = dst || new VecType$2(2); - dst[0] = -v[0]; - dst[1] = -v[1]; - return dst; -} -/** - * Copies a vector. (same as {@link vec2.clone}) - * Also see {@link vec2.create} and {@link vec2.set} - * @param v - The vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A copy of v. - */ -function copy$5(v, dst) { - dst = dst || new VecType$2(2); - dst[0] = v[0]; - dst[1] = v[1]; - return dst; -} -/** - * Clones a vector. (same as {@link vec2.copy}) - * Also see {@link vec2.create} and {@link vec2.set} - * @param v - The vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A copy of v. - */ -const clone$5 = copy$5; -/** - * Multiplies a vector by another vector (component-wise); assumes a and - * b have the same length. - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The vector of products of entries of a and b. - */ -function multiply$5(a, b, dst) { - dst = dst || new VecType$2(2); - dst[0] = a[0] * b[0]; - dst[1] = a[1] * b[1]; - return dst; -} -/** - * Multiplies a vector by another vector (component-wise); assumes a and - * b have the same length. (same as mul) - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The vector of products of entries of a and b. - */ -const mul$5 = multiply$5; -/** - * Divides a vector by another vector (component-wise); assumes a and - * b have the same length. - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The vector of quotients of entries of a and b. - */ -function divide$2(a, b, dst) { - dst = dst || new VecType$2(2); - dst[0] = a[0] / b[0]; - dst[1] = a[1] / b[1]; - return dst; -} -/** - * Divides a vector by another vector (component-wise); assumes a and - * b have the same length. (same as divide) - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The vector of quotients of entries of a and b. - */ -const div$2 = divide$2; -/** - * Creates a random unit vector * scale - * @param scale - Default 1 - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The random vector. - */ -function random$1(scale = 1, dst) { - dst = dst || new VecType$2(2); - const angle = Math.random() * 2 * Math.PI; - dst[0] = Math.cos(angle) * scale; - dst[1] = Math.sin(angle) * scale; - return dst; -} -/** - * Zero's a vector - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The zeroed vector. - */ -function zero$2(dst) { - dst = dst || new VecType$2(2); - dst[0] = 0; - dst[1] = 0; - return dst; -} -/** - * transform Vec2 by 4x4 matrix - * @param v - the vector - * @param m - The matrix. - * @param dst - optional Vec2 to store result. If not passed a new one is created. - * @returns the transformed vector - */ -function transformMat4$2(v, m, dst) { - dst = dst || new VecType$2(2); - const x = v[0]; - const y = v[1]; - dst[0] = x * m[0] + y * m[4] + m[12]; - dst[1] = x * m[1] + y * m[5] + m[13]; - return dst; -} -/** - * Transforms vec4 by 3x3 matrix - * - * @param v - the vector - * @param m - The matrix. - * @param dst - optional Vec2 to store result. If not passed a new one is created. - * @returns the transformed vector - */ -function transformMat3$1(v, m, dst) { - dst = dst || new VecType$2(2); - const x = v[0]; - const y = v[1]; - dst[0] = m[0] * x + m[4] * y + m[8]; - dst[1] = m[1] * x + m[5] * y + m[9]; - return dst; -} -/** - * Rotate a 2D vector - * - * @param a The vec2 point to rotate - * @param b The origin of the rotation - * @param rad The angle of rotation in radians - * @returns the rotated vector - */ -function rotate$2(a, b, rad, dst) { - dst = dst || new VecType$2(2); - // Translate point to the origin - const p0 = a[0] - b[0]; - const p1 = a[1] - b[1]; - const sinC = Math.sin(rad); - const cosC = Math.cos(rad); - //perform rotation and translate to correct position - dst[0] = p0 * cosC - p1 * sinC + b[0]; - dst[1] = p0 * sinC + p1 * cosC + b[1]; - return dst; -} -/** - * Treat a 2D vector as a direction and set it's length - * - * @param a The vec2 to lengthen - * @param len The length of the resulting vector - * @returns The lengthened vector - */ -function setLength$2(a, len, dst) { - dst = dst || new VecType$2(2); - normalize$3(a, dst); - return mulScalar$3(dst, len, dst); -} -/** - * Ensure a vector is not longer than a max length - * - * @param a The vec2 to limit - * @param maxLen The longest length of the resulting vector - * @returns The vector, shortened to maxLen if it's too long - */ -function truncate$2(a, maxLen, dst) { - dst = dst || new VecType$2(2); - if (length$3(a) > maxLen) { - return setLength$2(a, maxLen, dst); - } - return copy$5(a, dst); -} -/** - * Return the vector exactly between 2 endpoint vectors - * - * @param a Endpoint 1 - * @param b Endpoint 2 - * @returns The vector exactly residing between endpoints 1 and 2 - */ -function midpoint$2(a, b, dst) { - dst = dst || new VecType$2(2); - return lerp$3(a, b, 0.5, dst); -} - -var vec2Impl = { - __proto__: null, - add: add$3, - addScaled: addScaled$2, - angle: angle$2, - ceil: ceil$2, - clamp: clamp$2, - clone: clone$5, - copy: copy$5, - create: create$5, - cross: cross$1, - dist: dist$2, - distSq: distSq$2, - distance: distance$2, - distanceSq: distanceSq$2, - div: div$2, - divScalar: divScalar$3, - divide: divide$2, - dot: dot$3, - equals: equals$5, - equalsApproximately: equalsApproximately$5, - floor: floor$2, - fromValues: fromValues$3, - inverse: inverse$5, - invert: invert$4, - len: len$3, - lenSq: lenSq$3, - length: length$3, - lengthSq: lengthSq$3, - lerp: lerp$3, - lerpV: lerpV$2, - max: max$2, - midpoint: midpoint$2, - min: min$2, - mul: mul$5, - mulScalar: mulScalar$3, - multiply: multiply$5, - negate: negate$4, - normalize: normalize$3, - random: random$1, - rotate: rotate$2, - round: round$2, - scale: scale$5, - set: set$5, - setDefaultType: setDefaultType$6, - setLength: setLength$2, - sub: sub$3, - subtract: subtract$3, - transformMat3: transformMat3$1, - transformMat4: transformMat4$2, - truncate: truncate$2, - zero: zero$2 -}; - -/* - * Copyright 2022 Gregg Tavares - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ -/** - * 3x3 Matrix math math functions. - * - * Almost all functions take an optional `dst` argument. If it is not passed in the - * functions will create a new matrix. In other words you can do this - * - * const mat = mat3.translation([1, 2, 3]); // Creates a new translation matrix - * - * or - * - * const mat = mat3.create(); - * mat3.translation([1, 2, 3], mat); // Puts translation matrix in mat. - * - * The first style is often easier but depending on where it's used it generates garbage where - * as there is almost never allocation with the second style. - * - * It is always save to pass any matrix as the destination. So for example - * - * const mat = mat3.identity(); - * const trans = mat3.translation([1, 2, 3]); - * mat3.multiply(mat, trans, mat); // Multiplies mat * trans and puts result in mat. - * - */ -let MatType$1 = Float32Array; -// This mess is because with Mat3 we have 3 unused elements. -// For Float32Array and Float64Array that's not an issue -// but for Array it's troublesome -const ctorMap = new Map([ - [Float32Array, () => new Float32Array(12)], - [Float64Array, () => new Float64Array(12)], - [Array, () => new Array(12).fill(0)], -]); -let newMat3 = ctorMap.get(Float32Array); -/** - * Sets the type this library creates for a Mat3 - * @param ctor - the constructor for the type. Either `Float32Array`, `Float64Array`, or `Array` - * @returns previous constructor for Mat3 - */ -function setDefaultType$4(ctor) { - const oldType = MatType$1; - MatType$1 = ctor; - newMat3 = ctorMap.get(ctor); - return oldType; -} -/** - * Create a Mat3 from values - * - * Note: Since passing in a raw JavaScript array - * is valid in all circumstances, if you want to - * force a JavaScript array into a Mat3's specified type - * it would be faster to use - * - * ``` - * const m = mat3.clone(someJSArray); - * ``` - * - * Note: a consequence of the implementation is if your Mat3Type = `Array` - * instead of `Float32Array` or `Float64Array` then any values you - * don't pass in will be undefined. Usually this is not an issue since - * (a) using `Array` is rare and (b) using `mat3.create` is usually used - * to create a Mat3 to be filled out as in - * - * ``` - * const m = mat3.create(); - * mat3.perspective(fov, aspect, near, far, m); - * ``` - * - * @param v0 - value for element 0 - * @param v1 - value for element 1 - * @param v2 - value for element 2 - * @param v3 - value for element 3 - * @param v4 - value for element 4 - * @param v5 - value for element 5 - * @param v6 - value for element 6 - * @param v7 - value for element 7 - * @param v8 - value for element 8 - * @returns matrix created from values. - */ -function create$3(v0, v1, v2, v3, v4, v5, v6, v7, v8) { - const dst = newMat3(); - // to make the array homogenous - dst[3] = 0; - dst[7] = 0; - dst[11] = 0; - if (v0 !== undefined) { - dst[0] = v0; - if (v1 !== undefined) { - dst[1] = v1; - if (v2 !== undefined) { - dst[2] = v2; - if (v3 !== undefined) { - dst[4] = v3; - if (v4 !== undefined) { - dst[5] = v4; - if (v5 !== undefined) { - dst[6] = v5; - if (v6 !== undefined) { - dst[8] = v6; - if (v7 !== undefined) { - dst[9] = v7; - if (v8 !== undefined) { - dst[10] = v8; - } - } - } - } - } - } - } - } - } - return dst; -} -/** - * Sets the values of a Mat3 - * Also see {@link mat3.create} and {@link mat3.copy} - * - * @param v0 - value for element 0 - * @param v1 - value for element 1 - * @param v2 - value for element 2 - * @param v3 - value for element 3 - * @param v4 - value for element 4 - * @param v5 - value for element 5 - * @param v6 - value for element 6 - * @param v7 - value for element 7 - * @param v8 - value for element 8 - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns Mat3 set from values. - */ -function set$4(v0, v1, v2, v3, v4, v5, v6, v7, v8, dst) { - dst = dst || newMat3(); - dst[0] = v0; - dst[1] = v1; - dst[2] = v2; - dst[3] = 0; - dst[4] = v3; - dst[5] = v4; - dst[6] = v5; - dst[7] = 0; - dst[8] = v6; - dst[9] = v7; - dst[10] = v8; - dst[11] = 0; - return dst; -} -/** - * Creates a Mat3 from the upper left 3x3 part of a Mat4 - * @param m4 - source matrix - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns Mat3 made from m4 - */ -function fromMat4(m4, dst) { - dst = dst || newMat3(); - dst[0] = m4[0]; - dst[1] = m4[1]; - dst[2] = m4[2]; - dst[3] = 0; - dst[4] = m4[4]; - dst[5] = m4[5]; - dst[6] = m4[6]; - dst[7] = 0; - dst[8] = m4[8]; - dst[9] = m4[9]; - dst[10] = m4[10]; - dst[11] = 0; - return dst; -} -/** - * Creates a Mat3 rotation matrix from a quaternion - * @param q - quaternion to create matrix from - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns Mat3 made from q - */ -function fromQuat$1(q, dst) { - dst = dst || newMat3(); - const x = q[0]; - const y = q[1]; - const z = q[2]; - const w = q[3]; - const x2 = x + x; - const y2 = y + y; - const z2 = z + z; - const xx = x * x2; - const yx = y * x2; - const yy = y * y2; - const zx = z * x2; - const zy = z * y2; - const zz = z * z2; - const wx = w * x2; - const wy = w * y2; - const wz = w * z2; - dst[0] = 1 - yy - zz; - dst[1] = yx + wz; - dst[2] = zx - wy; - dst[3] = 0; - dst[4] = yx - wz; - dst[5] = 1 - xx - zz; - dst[6] = zy + wx; - dst[7] = 0; - dst[8] = zx + wy; - dst[9] = zy - wx; - dst[10] = 1 - xx - yy; - dst[11] = 0; - return dst; -} -/** - * Negates a matrix. - * @param m - The matrix. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns -m. - */ -function negate$3(m, dst) { - dst = dst || newMat3(); - dst[0] = -m[0]; - dst[1] = -m[1]; - dst[2] = -m[2]; - dst[4] = -m[4]; - dst[5] = -m[5]; - dst[6] = -m[6]; - dst[8] = -m[8]; - dst[9] = -m[9]; - dst[10] = -m[10]; - return dst; -} -/** - * Copies a matrix. (same as {@link mat3.clone}) - * Also see {@link mat3.create} and {@link mat3.set} - * @param m - The matrix. - * @param dst - The matrix. If not passed a new one is created. - * @returns A copy of m. - */ -function copy$4(m, dst) { - dst = dst || newMat3(); - dst[0] = m[0]; - dst[1] = m[1]; - dst[2] = m[2]; - dst[4] = m[4]; - dst[5] = m[5]; - dst[6] = m[6]; - dst[8] = m[8]; - dst[9] = m[9]; - dst[10] = m[10]; - return dst; -} -/** - * Copies a matrix (same as {@link mat3.copy}) - * Also see {@link mat3.create} and {@link mat3.set} - * @param m - The matrix. - * @param dst - The matrix. If not passed a new one is created. - * @returns A copy of m. - */ -const clone$4 = copy$4; -/** - * Check if 2 matrices are approximately equal - * @param a Operand matrix. - * @param b Operand matrix. - * @returns true if matrices are approximately equal - */ -function equalsApproximately$4(a, b) { - return Math.abs(a[0] - b[0]) < EPSILON && - Math.abs(a[1] - b[1]) < EPSILON && - Math.abs(a[2] - b[2]) < EPSILON && - Math.abs(a[4] - b[4]) < EPSILON && - Math.abs(a[5] - b[5]) < EPSILON && - Math.abs(a[6] - b[6]) < EPSILON && - Math.abs(a[8] - b[8]) < EPSILON && - Math.abs(a[9] - b[9]) < EPSILON && - Math.abs(a[10] - b[10]) < EPSILON; -} -/** - * Check if 2 matrices are exactly equal - * @param a Operand matrix. - * @param b Operand matrix. - * @returns true if matrices are exactly equal - */ -function equals$4(a, b) { - return a[0] === b[0] && - a[1] === b[1] && - a[2] === b[2] && - a[4] === b[4] && - a[5] === b[5] && - a[6] === b[6] && - a[8] === b[8] && - a[9] === b[9] && - a[10] === b[10]; -} -/** - * Creates a 3-by-3 identity matrix. - * - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns A 3-by-3 identity matrix. - */ -function identity$2(dst) { - dst = dst || newMat3(); - dst[0] = 1; - dst[1] = 0; - dst[2] = 0; - dst[4] = 0; - dst[5] = 1; - dst[6] = 0; - dst[8] = 0; - dst[9] = 0; - dst[10] = 1; - return dst; -} -/** - * Takes the transpose of a matrix. - * @param m - The matrix. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The transpose of m. - */ -function transpose$1(m, dst) { - dst = dst || newMat3(); - if (dst === m) { - let t; - // 0 1 2 - // 4 5 6 - // 8 9 10 - t = m[1]; - m[1] = m[4]; - m[4] = t; - t = m[2]; - m[2] = m[8]; - m[8] = t; - t = m[6]; - m[6] = m[9]; - m[9] = t; - return dst; - } - const m00 = m[0 * 4 + 0]; - const m01 = m[0 * 4 + 1]; - const m02 = m[0 * 4 + 2]; - const m10 = m[1 * 4 + 0]; - const m11 = m[1 * 4 + 1]; - const m12 = m[1 * 4 + 2]; - const m20 = m[2 * 4 + 0]; - const m21 = m[2 * 4 + 1]; - const m22 = m[2 * 4 + 2]; - dst[0] = m00; - dst[1] = m10; - dst[2] = m20; - dst[4] = m01; - dst[5] = m11; - dst[6] = m21; - dst[8] = m02; - dst[9] = m12; - dst[10] = m22; - return dst; -} -/** - * Computes the inverse of a 3-by-3 matrix. - * @param m - The matrix. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The inverse of m. - */ -function inverse$4(m, dst) { - dst = dst || newMat3(); - const m00 = m[0 * 4 + 0]; - const m01 = m[0 * 4 + 1]; - const m02 = m[0 * 4 + 2]; - const m10 = m[1 * 4 + 0]; - const m11 = m[1 * 4 + 1]; - const m12 = m[1 * 4 + 2]; - const m20 = m[2 * 4 + 0]; - const m21 = m[2 * 4 + 1]; - const m22 = m[2 * 4 + 2]; - const b01 = m22 * m11 - m12 * m21; - const b11 = -m22 * m10 + m12 * m20; - const b21 = m21 * m10 - m11 * m20; - const invDet = 1 / (m00 * b01 + m01 * b11 + m02 * b21); - dst[0] = b01 * invDet; - dst[1] = (-m22 * m01 + m02 * m21) * invDet; - dst[2] = (m12 * m01 - m02 * m11) * invDet; - dst[4] = b11 * invDet; - dst[5] = (m22 * m00 - m02 * m20) * invDet; - dst[6] = (-m12 * m00 + m02 * m10) * invDet; - dst[8] = b21 * invDet; - dst[9] = (-m21 * m00 + m01 * m20) * invDet; - dst[10] = (m11 * m00 - m01 * m10) * invDet; - return dst; -} -/** - * Compute the determinant of a matrix - * @param m - the matrix - * @returns the determinant - */ -function determinant$1(m) { - const m00 = m[0 * 4 + 0]; - const m01 = m[0 * 4 + 1]; - const m02 = m[0 * 4 + 2]; - const m10 = m[1 * 4 + 0]; - const m11 = m[1 * 4 + 1]; - const m12 = m[1 * 4 + 2]; - const m20 = m[2 * 4 + 0]; - const m21 = m[2 * 4 + 1]; - const m22 = m[2 * 4 + 2]; - return m00 * (m11 * m22 - m21 * m12) - - m10 * (m01 * m22 - m21 * m02) + - m20 * (m01 * m12 - m11 * m02); -} -/** - * Computes the inverse of a 3-by-3 matrix. (same as inverse) - * @param m - The matrix. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The inverse of m. - */ -const invert$3 = inverse$4; -/** - * Multiplies two 3-by-3 matrices with a on the left and b on the right - * @param a - The matrix on the left. - * @param b - The matrix on the right. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The matrix product of a and b. - */ -function multiply$4(a, b, dst) { - dst = dst || newMat3(); - const a00 = a[0]; - const a01 = a[1]; - const a02 = a[2]; - const a10 = a[4 + 0]; - const a11 = a[4 + 1]; - const a12 = a[4 + 2]; - const a20 = a[8 + 0]; - const a21 = a[8 + 1]; - const a22 = a[8 + 2]; - const b00 = b[0]; - const b01 = b[1]; - const b02 = b[2]; - const b10 = b[4 + 0]; - const b11 = b[4 + 1]; - const b12 = b[4 + 2]; - const b20 = b[8 + 0]; - const b21 = b[8 + 1]; - const b22 = b[8 + 2]; - dst[0] = a00 * b00 + a10 * b01 + a20 * b02; - dst[1] = a01 * b00 + a11 * b01 + a21 * b02; - dst[2] = a02 * b00 + a12 * b01 + a22 * b02; - dst[4] = a00 * b10 + a10 * b11 + a20 * b12; - dst[5] = a01 * b10 + a11 * b11 + a21 * b12; - dst[6] = a02 * b10 + a12 * b11 + a22 * b12; - dst[8] = a00 * b20 + a10 * b21 + a20 * b22; - dst[9] = a01 * b20 + a11 * b21 + a21 * b22; - dst[10] = a02 * b20 + a12 * b21 + a22 * b22; - return dst; -} -/** - * Multiplies two 3-by-3 matrices with a on the left and b on the right (same as multiply) - * @param a - The matrix on the left. - * @param b - The matrix on the right. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The matrix product of a and b. - */ -const mul$4 = multiply$4; -/** - * Sets the translation component of a 3-by-3 matrix to the given - * vector. - * @param a - The matrix. - * @param v - The vector. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The matrix with translation set. - */ -function setTranslation$1(a, v, dst) { - dst = dst || identity$2(); - if (a !== dst) { - dst[0] = a[0]; - dst[1] = a[1]; - dst[2] = a[2]; - dst[4] = a[4]; - dst[5] = a[5]; - dst[6] = a[6]; - } - dst[8] = v[0]; - dst[9] = v[1]; - dst[10] = 1; - return dst; -} -/** - * Returns the translation component of a 3-by-3 matrix as a vector with 3 - * entries. - * @param m - The matrix. - * @param dst - vector to hold result. If not passed a new one is created. - * @returns The translation component of m. - */ -function getTranslation$2(m, dst) { - dst = dst || create$5(); - dst[0] = m[8]; - dst[1] = m[9]; - return dst; -} -/** - * Returns an axis of a 3x3 matrix as a vector with 2 entries - * @param m - The matrix. - * @param axis - The axis 0 = x, 1 = y, - * @returns The axis component of m. - */ -function getAxis$2(m, axis, dst) { - dst = dst || create$5(); - const off = axis * 4; - dst[0] = m[off + 0]; - dst[1] = m[off + 1]; - return dst; -} -/** - * Sets an axis of a 3x3 matrix as a vector with 2 entries - * @param m - The matrix. - * @param v - the axis vector - * @param axis - The axis 0 = x, 1 = y; - * @param dst - The matrix to set. If not passed a new one is created. - * @returns The matrix with axis set. - */ -function setAxis$1(m, v, axis, dst) { - if (dst !== m) { - dst = copy$4(m, dst); - } - const off = axis * 4; - dst[off + 0] = v[0]; - dst[off + 1] = v[1]; - return dst; -} -/** - * Returns the scaling component of the matrix - * @param m - The Matrix - * @param dst - The vector to set. If not passed a new one is created. - */ -function getScaling$2(m, dst) { - dst = dst || create$5(); - const xx = m[0]; - const xy = m[1]; - const yx = m[4]; - const yy = m[5]; - dst[0] = Math.sqrt(xx * xx + xy * xy); - dst[1] = Math.sqrt(yx * yx + yy * yy); - return dst; -} -/** - * Creates a 3-by-3 matrix which translates by the given vector v. - * @param v - The vector by which to translate. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The translation matrix. - */ -function translation$1(v, dst) { - dst = dst || newMat3(); - dst[0] = 1; - dst[1] = 0; - dst[2] = 0; - dst[4] = 0; - dst[5] = 1; - dst[6] = 0; - dst[8] = v[0]; - dst[9] = v[1]; - dst[10] = 1; - return dst; -} -/** - * Translates the given 3-by-3 matrix by the given vector v. - * @param m - The matrix. - * @param v - The vector by which to translate. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The translated matrix. - */ -function translate$1(m, v, dst) { - dst = dst || newMat3(); - const v0 = v[0]; - const v1 = v[1]; - const m00 = m[0]; - const m01 = m[1]; - const m02 = m[2]; - const m10 = m[1 * 4 + 0]; - const m11 = m[1 * 4 + 1]; - const m12 = m[1 * 4 + 2]; - const m20 = m[2 * 4 + 0]; - const m21 = m[2 * 4 + 1]; - const m22 = m[2 * 4 + 2]; - if (m !== dst) { - dst[0] = m00; - dst[1] = m01; - dst[2] = m02; - dst[4] = m10; - dst[5] = m11; - dst[6] = m12; - } - dst[8] = m00 * v0 + m10 * v1 + m20; - dst[9] = m01 * v0 + m11 * v1 + m21; - dst[10] = m02 * v0 + m12 * v1 + m22; - return dst; -} -/** - * Creates a 3-by-3 matrix which rotates by the given angle. - * @param angleInRadians - The angle by which to rotate (in radians). - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The rotation matrix. - */ -function rotation$1(angleInRadians, dst) { - dst = dst || newMat3(); - const c = Math.cos(angleInRadians); - const s = Math.sin(angleInRadians); - dst[0] = c; - dst[1] = s; - dst[2] = 0; - dst[4] = -s; - dst[5] = c; - dst[6] = 0; - dst[8] = 0; - dst[9] = 0; - dst[10] = 1; - return dst; -} -/** - * Rotates the given 3-by-3 matrix by the given angle. - * @param m - The matrix. - * @param angleInRadians - The angle by which to rotate (in radians). - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The rotated matrix. - */ -function rotate$1(m, angleInRadians, dst) { - dst = dst || newMat3(); - const m00 = m[0 * 4 + 0]; - const m01 = m[0 * 4 + 1]; - const m02 = m[0 * 4 + 2]; - const m10 = m[1 * 4 + 0]; - const m11 = m[1 * 4 + 1]; - const m12 = m[1 * 4 + 2]; - const c = Math.cos(angleInRadians); - const s = Math.sin(angleInRadians); - dst[0] = c * m00 + s * m10; - dst[1] = c * m01 + s * m11; - dst[2] = c * m02 + s * m12; - dst[4] = c * m10 - s * m00; - dst[5] = c * m11 - s * m01; - dst[6] = c * m12 - s * m02; - if (m !== dst) { - dst[8] = m[8]; - dst[9] = m[9]; - dst[10] = m[10]; - } - return dst; -} -/** - * Creates a 3-by-3 matrix which scales in each dimension by an amount given by - * the corresponding entry in the given vector; assumes the vector has three - * entries. - * @param v - A vector of - * 2 entries specifying the factor by which to scale in each dimension. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The scaling matrix. - */ -function scaling$1(v, dst) { - dst = dst || newMat3(); - dst[0] = v[0]; - dst[1] = 0; - dst[2] = 0; - dst[4] = 0; - dst[5] = v[1]; - dst[6] = 0; - dst[8] = 0; - dst[9] = 0; - dst[10] = 1; - return dst; -} -/** - * Scales the given 3-by-3 matrix in each dimension by an amount - * given by the corresponding entry in the given vector; assumes the vector has - * three entries. - * @param m - The matrix to be modified. - * @param v - A vector of 2 entries specifying the - * factor by which to scale in each dimension. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The scaled matrix. - */ -function scale$4(m, v, dst) { - dst = dst || newMat3(); - const v0 = v[0]; - const v1 = v[1]; - dst[0] = v0 * m[0 * 4 + 0]; - dst[1] = v0 * m[0 * 4 + 1]; - dst[2] = v0 * m[0 * 4 + 2]; - dst[4] = v1 * m[1 * 4 + 0]; - dst[5] = v1 * m[1 * 4 + 1]; - dst[6] = v1 * m[1 * 4 + 2]; - if (m !== dst) { - dst[8] = m[8]; - dst[9] = m[9]; - dst[10] = m[10]; - } - return dst; -} -/** - * Creates a 3-by-3 matrix which scales uniformly in each dimension - * @param s - Amount to scale - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The scaling matrix. - */ -function uniformScaling$1(s, dst) { - dst = dst || newMat3(); - dst[0] = s; - dst[1] = 0; - dst[2] = 0; - dst[4] = 0; - dst[5] = s; - dst[6] = 0; - dst[8] = 0; - dst[9] = 0; - dst[10] = 1; - return dst; -} -/** - * Scales the given 3-by-3 matrix in each dimension by an amount - * given. - * @param m - The matrix to be modified. - * @param s - Amount to scale. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The scaled matrix. - */ -function uniformScale$1(m, s, dst) { - dst = dst || newMat3(); - dst[0] = s * m[0 * 4 + 0]; - dst[1] = s * m[0 * 4 + 1]; - dst[2] = s * m[0 * 4 + 2]; - dst[4] = s * m[1 * 4 + 0]; - dst[5] = s * m[1 * 4 + 1]; - dst[6] = s * m[1 * 4 + 2]; - if (m !== dst) { - dst[8] = m[8]; - dst[9] = m[9]; - dst[10] = m[10]; - } - return dst; -} - -var mat3Impl = { - __proto__: null, - clone: clone$4, - copy: copy$4, - create: create$3, - determinant: determinant$1, - equals: equals$4, - equalsApproximately: equalsApproximately$4, - fromMat4: fromMat4, - fromQuat: fromQuat$1, - getAxis: getAxis$2, - getScaling: getScaling$2, - getTranslation: getTranslation$2, - identity: identity$2, - inverse: inverse$4, - invert: invert$3, - mul: mul$4, - multiply: multiply$4, - negate: negate$3, - rotate: rotate$1, - rotation: rotation$1, - scale: scale$4, - scaling: scaling$1, - set: set$4, - setAxis: setAxis$1, - setDefaultType: setDefaultType$4, - setTranslation: setTranslation$1, - translate: translate$1, - translation: translation$1, - transpose: transpose$1, - uniformScale: uniformScale$1, - uniformScaling: uniformScaling$1 -}; - -/* - * Copyright 2022 Gregg Tavares - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ -/** - * Creates a vec3; may be called with x, y, z to set initial values. (same as create) - * @param x - Initial x value. - * @param y - Initial y value. - * @param z - Initial z value. - * @returns the created vector - */ -const fromValues$2 = create$4; -/** - * Sets the values of a Vec3 - * Also see {@link vec3.create} and {@link vec3.copy} - * - * @param x first value - * @param y second value - * @param z third value - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector with its elements set. - */ -function set$3(x, y, z, dst) { - dst = dst || new VecType$1(3); - dst[0] = x; - dst[1] = y; - dst[2] = z; - return dst; -} -/** - * Applies Math.ceil to each element of vector - * @param v - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector that is the ceil of each element of v. - */ -function ceil$1(v, dst) { - dst = dst || new VecType$1(3); - dst[0] = Math.ceil(v[0]); - dst[1] = Math.ceil(v[1]); - dst[2] = Math.ceil(v[2]); - return dst; -} -/** - * Applies Math.floor to each element of vector - * @param v - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector that is the floor of each element of v. - */ -function floor$1(v, dst) { - dst = dst || new VecType$1(3); - dst[0] = Math.floor(v[0]); - dst[1] = Math.floor(v[1]); - dst[2] = Math.floor(v[2]); - return dst; -} -/** - * Applies Math.round to each element of vector - * @param v - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector that is the round of each element of v. - */ -function round$1(v, dst) { - dst = dst || new VecType$1(3); - dst[0] = Math.round(v[0]); - dst[1] = Math.round(v[1]); - dst[2] = Math.round(v[2]); - return dst; -} -/** - * Clamp each element of vector between min and max - * @param v - Operand vector. - * @param max - Min value, default 0 - * @param min - Max value, default 1 - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector that the clamped value of each element of v. - */ -function clamp$1(v, min = 0, max = 1, dst) { - dst = dst || new VecType$1(3); - dst[0] = Math.min(max, Math.max(min, v[0])); - dst[1] = Math.min(max, Math.max(min, v[1])); - dst[2] = Math.min(max, Math.max(min, v[2])); - return dst; -} -/** - * Adds two vectors; assumes a and b have the same dimension. - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector that is the sum of a and b. - */ -function add$2(a, b, dst) { - dst = dst || new VecType$1(3); - dst[0] = a[0] + b[0]; - dst[1] = a[1] + b[1]; - dst[2] = a[2] + b[2]; - return dst; -} -/** - * Adds two vectors, scaling the 2nd; assumes a and b have the same dimension. - * @param a - Operand vector. - * @param b - Operand vector. - * @param scale - Amount to scale b - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector that is the sum of a + b * scale. - */ -function addScaled$1(a, b, scale, dst) { - dst = dst || new VecType$1(3); - dst[0] = a[0] + b[0] * scale; - dst[1] = a[1] + b[1] * scale; - dst[2] = a[2] + b[2] * scale; - return dst; -} -/** - * Returns the angle in radians between two vectors. - * @param a - Operand vector. - * @param b - Operand vector. - * @returns The angle in radians between the 2 vectors. - */ -function angle$1(a, b) { - const ax = a[0]; - const ay = a[1]; - const az = a[2]; - const bx = b[0]; - const by = b[1]; - const bz = b[2]; - const mag1 = Math.sqrt(ax * ax + ay * ay + az * az); - const mag2 = Math.sqrt(bx * bx + by * by + bz * bz); - const mag = mag1 * mag2; - const cosine = mag && dot$2(a, b) / mag; - return Math.acos(cosine); -} -/** - * Subtracts two vectors. - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector that is the difference of a and b. - */ -function subtract$2(a, b, dst) { - dst = dst || new VecType$1(3); - dst[0] = a[0] - b[0]; - dst[1] = a[1] - b[1]; - dst[2] = a[2] - b[2]; - return dst; -} -/** - * Subtracts two vectors. - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector that is the difference of a and b. - */ -const sub$2 = subtract$2; -/** - * Check if 2 vectors are approximately equal - * @param a - Operand vector. - * @param b - Operand vector. - * @returns true if vectors are approximately equal - */ -function equalsApproximately$3(a, b) { - return Math.abs(a[0] - b[0]) < EPSILON && - Math.abs(a[1] - b[1]) < EPSILON && - Math.abs(a[2] - b[2]) < EPSILON; -} -/** - * Check if 2 vectors are exactly equal - * @param a - Operand vector. - * @param b - Operand vector. - * @returns true if vectors are exactly equal - */ -function equals$3(a, b) { - return a[0] === b[0] && a[1] === b[1] && a[2] === b[2]; -} -/** - * Performs linear interpolation on two vectors. - * Given vectors a and b and interpolation coefficient t, returns - * a + t * (b - a). - * @param a - Operand vector. - * @param b - Operand vector. - * @param t - Interpolation coefficient. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The linear interpolated result. - */ -function lerp$2(a, b, t, dst) { - dst = dst || new VecType$1(3); - dst[0] = a[0] + t * (b[0] - a[0]); - dst[1] = a[1] + t * (b[1] - a[1]); - dst[2] = a[2] + t * (b[2] - a[2]); - return dst; -} -/** - * Performs linear interpolation on two vectors. - * Given vectors a and b and interpolation coefficient vector t, returns - * a + t * (b - a). - * @param a - Operand vector. - * @param b - Operand vector. - * @param t - Interpolation coefficients vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns the linear interpolated result. - */ -function lerpV$1(a, b, t, dst) { - dst = dst || new VecType$1(3); - dst[0] = a[0] + t[0] * (b[0] - a[0]); - dst[1] = a[1] + t[1] * (b[1] - a[1]); - dst[2] = a[2] + t[2] * (b[2] - a[2]); - return dst; -} -/** - * Return max values of two vectors. - * Given vectors a and b returns - * [max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])]. - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The max components vector. - */ -function max$1(a, b, dst) { - dst = dst || new VecType$1(3); - dst[0] = Math.max(a[0], b[0]); - dst[1] = Math.max(a[1], b[1]); - dst[2] = Math.max(a[2], b[2]); - return dst; -} -/** - * Return min values of two vectors. - * Given vectors a and b returns - * [min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])]. - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The min components vector. - */ -function min$1(a, b, dst) { - dst = dst || new VecType$1(3); - dst[0] = Math.min(a[0], b[0]); - dst[1] = Math.min(a[1], b[1]); - dst[2] = Math.min(a[2], b[2]); - return dst; -} -/** - * Multiplies a vector by a scalar. - * @param v - The vector. - * @param k - The scalar. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The scaled vector. - */ -function mulScalar$2(v, k, dst) { - dst = dst || new VecType$1(3); - dst[0] = v[0] * k; - dst[1] = v[1] * k; - dst[2] = v[2] * k; - return dst; -} -/** - * Multiplies a vector by a scalar. (same as mulScalar) - * @param v - The vector. - * @param k - The scalar. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The scaled vector. - */ -const scale$3 = mulScalar$2; -/** - * Divides a vector by a scalar. - * @param v - The vector. - * @param k - The scalar. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The scaled vector. - */ -function divScalar$2(v, k, dst) { - dst = dst || new VecType$1(3); - dst[0] = v[0] / k; - dst[1] = v[1] / k; - dst[2] = v[2] / k; - return dst; -} -/** - * Inverse a vector. - * @param v - The vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The inverted vector. - */ -function inverse$3(v, dst) { - dst = dst || new VecType$1(3); - dst[0] = 1 / v[0]; - dst[1] = 1 / v[1]; - dst[2] = 1 / v[2]; - return dst; -} -/** - * Invert a vector. (same as inverse) - * @param v - The vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The inverted vector. - */ -const invert$2 = inverse$3; -/** - * Computes the cross product of two vectors; assumes both vectors have - * three entries. - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The vector of a cross b. - */ -function cross(a, b, dst) { - dst = dst || new VecType$1(3); - const t1 = a[2] * b[0] - a[0] * b[2]; - const t2 = a[0] * b[1] - a[1] * b[0]; - dst[0] = a[1] * b[2] - a[2] * b[1]; - dst[1] = t1; - dst[2] = t2; - return dst; -} -/** - * Computes the dot product of two vectors; assumes both vectors have - * three entries. - * @param a - Operand vector. - * @param b - Operand vector. - * @returns dot product - */ -function dot$2(a, b) { - return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]); -} -/** - * Computes the length of vector - * @param v - vector. - * @returns length of vector. - */ -function length$2(v) { - const v0 = v[0]; - const v1 = v[1]; - const v2 = v[2]; - return Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2); -} -/** - * Computes the length of vector (same as length) - * @param v - vector. - * @returns length of vector. - */ -const len$2 = length$2; -/** - * Computes the square of the length of vector - * @param v - vector. - * @returns square of the length of vector. - */ -function lengthSq$2(v) { - const v0 = v[0]; - const v1 = v[1]; - const v2 = v[2]; - return v0 * v0 + v1 * v1 + v2 * v2; -} -/** - * Computes the square of the length of vector (same as lengthSq) - * @param v - vector. - * @returns square of the length of vector. - */ -const lenSq$2 = lengthSq$2; -/** - * Computes the distance between 2 points - * @param a - vector. - * @param b - vector. - * @returns distance between a and b - */ -function distance$1(a, b) { - const dx = a[0] - b[0]; - const dy = a[1] - b[1]; - const dz = a[2] - b[2]; - return Math.sqrt(dx * dx + dy * dy + dz * dz); -} -/** - * Computes the distance between 2 points (same as distance) - * @param a - vector. - * @param b - vector. - * @returns distance between a and b - */ -const dist$1 = distance$1; -/** - * Computes the square of the distance between 2 points - * @param a - vector. - * @param b - vector. - * @returns square of the distance between a and b - */ -function distanceSq$1(a, b) { - const dx = a[0] - b[0]; - const dy = a[1] - b[1]; - const dz = a[2] - b[2]; - return dx * dx + dy * dy + dz * dz; -} -/** - * Computes the square of the distance between 2 points (same as distanceSq) - * @param a - vector. - * @param b - vector. - * @returns square of the distance between a and b - */ -const distSq$1 = distanceSq$1; -/** - * Divides a vector by its Euclidean length and returns the quotient. - * @param v - The vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The normalized vector. - */ -function normalize$2(v, dst) { - dst = dst || new VecType$1(3); - const v0 = v[0]; - const v1 = v[1]; - const v2 = v[2]; - const len = Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2); - if (len > 0.00001) { - dst[0] = v0 / len; - dst[1] = v1 / len; - dst[2] = v2 / len; - } - else { - dst[0] = 0; - dst[1] = 0; - dst[2] = 0; - } - return dst; -} -/** - * Negates a vector. - * @param v - The vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns -v. - */ -function negate$2(v, dst) { - dst = dst || new VecType$1(3); - dst[0] = -v[0]; - dst[1] = -v[1]; - dst[2] = -v[2]; - return dst; -} -/** - * Copies a vector. (same as {@link vec3.clone}) - * Also see {@link vec3.create} and {@link vec3.set} - * @param v - The vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A copy of v. - */ -function copy$3(v, dst) { - dst = dst || new VecType$1(3); - dst[0] = v[0]; - dst[1] = v[1]; - dst[2] = v[2]; - return dst; -} -/** - * Clones a vector. (same as {@link vec3.copy}) - * Also see {@link vec3.create} and {@link vec3.set} - * @param v - The vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A copy of v. - */ -const clone$3 = copy$3; -/** - * Multiplies a vector by another vector (component-wise); assumes a and - * b have the same length. - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The vector of products of entries of a and b. - */ -function multiply$3(a, b, dst) { - dst = dst || new VecType$1(3); - dst[0] = a[0] * b[0]; - dst[1] = a[1] * b[1]; - dst[2] = a[2] * b[2]; - return dst; -} -/** - * Multiplies a vector by another vector (component-wise); assumes a and - * b have the same length. (same as mul) - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The vector of products of entries of a and b. - */ -const mul$3 = multiply$3; -/** - * Divides a vector by another vector (component-wise); assumes a and - * b have the same length. - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The vector of quotients of entries of a and b. - */ -function divide$1(a, b, dst) { - dst = dst || new VecType$1(3); - dst[0] = a[0] / b[0]; - dst[1] = a[1] / b[1]; - dst[2] = a[2] / b[2]; - return dst; -} -/** - * Divides a vector by another vector (component-wise); assumes a and - * b have the same length. (same as divide) - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The vector of quotients of entries of a and b. - */ -const div$1 = divide$1; -/** - * Creates a random vector - * @param scale - Default 1 - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The random vector. - */ -function random(scale = 1, dst) { - dst = dst || new VecType$1(3); - const angle = Math.random() * 2 * Math.PI; - const z = Math.random() * 2 - 1; - const zScale = Math.sqrt(1 - z * z) * scale; - dst[0] = Math.cos(angle) * zScale; - dst[1] = Math.sin(angle) * zScale; - dst[2] = z * scale; - return dst; -} -/** - * Zero's a vector - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The zeroed vector. - */ -function zero$1(dst) { - dst = dst || new VecType$1(3); - dst[0] = 0; - dst[1] = 0; - dst[2] = 0; - return dst; -} -/** - * transform vec3 by 4x4 matrix - * @param v - the vector - * @param m - The matrix. - * @param dst - optional vec3 to store result. If not passed a new one is created. - * @returns the transformed vector - */ -function transformMat4$1(v, m, dst) { - dst = dst || new VecType$1(3); - const x = v[0]; - const y = v[1]; - const z = v[2]; - const w = (m[3] * x + m[7] * y + m[11] * z + m[15]) || 1; - dst[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w; - dst[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w; - dst[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w; - return dst; -} -/** - * Transform vec4 by upper 3x3 matrix inside 4x4 matrix. - * @param v - The direction. - * @param m - The matrix. - * @param dst - optional Vec3 to store result. If not passed a new one is created. - * @returns The transformed vector. - */ -function transformMat4Upper3x3(v, m, dst) { - dst = dst || new VecType$1(3); - const v0 = v[0]; - const v1 = v[1]; - const v2 = v[2]; - dst[0] = v0 * m[0 * 4 + 0] + v1 * m[1 * 4 + 0] + v2 * m[2 * 4 + 0]; - dst[1] = v0 * m[0 * 4 + 1] + v1 * m[1 * 4 + 1] + v2 * m[2 * 4 + 1]; - dst[2] = v0 * m[0 * 4 + 2] + v1 * m[1 * 4 + 2] + v2 * m[2 * 4 + 2]; - return dst; -} -/** - * Transforms vec3 by 3x3 matrix - * - * @param v - the vector - * @param m - The matrix. - * @param dst - optional vec3 to store result. If not passed a new one is created. - * @returns the transformed vector - */ -function transformMat3(v, m, dst) { - dst = dst || new VecType$1(3); - const x = v[0]; - const y = v[1]; - const z = v[2]; - dst[0] = x * m[0] + y * m[4] + z * m[8]; - dst[1] = x * m[1] + y * m[5] + z * m[9]; - dst[2] = x * m[2] + y * m[6] + z * m[10]; - return dst; -} -/** - * Transforms vec3 by Quaternion - * @param v - the vector to transform - * @param q - the quaternion to transform by - * @param dst - optional vec3 to store result. If not passed a new one is created. - * @returns the transformed - */ -function transformQuat(v, q, dst) { - dst = dst || new VecType$1(3); - const qx = q[0]; - const qy = q[1]; - const qz = q[2]; - const w2 = q[3] * 2; - const x = v[0]; - const y = v[1]; - const z = v[2]; - const uvX = qy * z - qz * y; - const uvY = qz * x - qx * z; - const uvZ = qx * y - qy * x; - dst[0] = x + uvX * w2 + (qy * uvZ - qz * uvY) * 2; - dst[1] = y + uvY * w2 + (qz * uvX - qx * uvZ) * 2; - dst[2] = z + uvZ * w2 + (qx * uvY - qy * uvX) * 2; - return dst; -} -/** - * Returns the translation component of a 4-by-4 matrix as a vector with 3 - * entries. - * @param m - The matrix. - * @param dst - vector to hold result. If not passed a new one is created. - * @returns The translation component of m. - */ -function getTranslation$1(m, dst) { - dst = dst || new VecType$1(3); - dst[0] = m[12]; - dst[1] = m[13]; - dst[2] = m[14]; - return dst; -} -/** - * Returns an axis of a 4x4 matrix as a vector with 3 entries - * @param m - The matrix. - * @param axis - The axis 0 = x, 1 = y, 2 = z; - * @returns The axis component of m. - */ -function getAxis$1(m, axis, dst) { - dst = dst || new VecType$1(3); - const off = axis * 4; - dst[0] = m[off + 0]; - dst[1] = m[off + 1]; - dst[2] = m[off + 2]; - return dst; -} -/** - * Returns the scaling component of the matrix - * @param m - The Matrix - * @param dst - The vector to set. If not passed a new one is created. - */ -function getScaling$1(m, dst) { - dst = dst || new VecType$1(3); - const xx = m[0]; - const xy = m[1]; - const xz = m[2]; - const yx = m[4]; - const yy = m[5]; - const yz = m[6]; - const zx = m[8]; - const zy = m[9]; - const zz = m[10]; - dst[0] = Math.sqrt(xx * xx + xy * xy + xz * xz); - dst[1] = Math.sqrt(yx * yx + yy * yy + yz * yz); - dst[2] = Math.sqrt(zx * zx + zy * zy + zz * zz); - return dst; -} -/** - * Rotate a 3D vector around the x-axis - * - * @param {ReadonlyVec3} a The vec3 point to rotate - * @param {ReadonlyVec3} b The origin of the rotation - * @param {Number} rad The angle of rotation in radians - * @param dst - The vector to set. If not passed a new one is created. - * @returns the rotated vector - */ -function rotateX$2(a, b, rad, dst) { - dst = dst || new VecType$1(3); - const p = []; - const r = []; - //Translate point to the origin - p[0] = a[0] - b[0]; - p[1] = a[1] - b[1]; - p[2] = a[2] - b[2]; - //perform rotation - r[0] = p[0]; - r[1] = p[1] * Math.cos(rad) - p[2] * Math.sin(rad); - r[2] = p[1] * Math.sin(rad) + p[2] * Math.cos(rad); - //translate to correct position - dst[0] = r[0] + b[0]; - dst[1] = r[1] + b[1]; - dst[2] = r[2] + b[2]; - return dst; -} -/** - * Rotate a 3D vector around the y-axis - * - * @param {ReadonlyVec3} a The vec3 point to rotate - * @param {ReadonlyVec3} b The origin of the rotation - * @param {Number} rad The angle of rotation in radians - * @param dst - The vector to set. If not passed a new one is created. - * @returns the rotated vector - */ -function rotateY$2(a, b, rad, dst) { - dst = dst || new VecType$1(3); - const p = []; - const r = []; - // translate point to the origin - p[0] = a[0] - b[0]; - p[1] = a[1] - b[1]; - p[2] = a[2] - b[2]; - // perform rotation - r[0] = p[2] * Math.sin(rad) + p[0] * Math.cos(rad); - r[1] = p[1]; - r[2] = p[2] * Math.cos(rad) - p[0] * Math.sin(rad); - // translate to correct position - dst[0] = r[0] + b[0]; - dst[1] = r[1] + b[1]; - dst[2] = r[2] + b[2]; - return dst; -} -/** - * Rotate a 3D vector around the z-axis - * - * @param {ReadonlyVec3} a The vec3 point to rotate - * @param {ReadonlyVec3} b The origin of the rotation - * @param {Number} rad The angle of rotation in radians - * @param dst - The vector to set. If not passed a new one is created. - * @returns {vec3} out - */ -function rotateZ$2(a, b, rad, dst) { - dst = dst || new VecType$1(3); - const p = []; - const r = []; - // translate point to the origin - p[0] = a[0] - b[0]; - p[1] = a[1] - b[1]; - p[2] = a[2] - b[2]; - // perform rotation - r[0] = p[0] * Math.cos(rad) - p[1] * Math.sin(rad); - r[1] = p[0] * Math.sin(rad) + p[1] * Math.cos(rad); - r[2] = p[2]; - // translate to correct position - dst[0] = r[0] + b[0]; - dst[1] = r[1] + b[1]; - dst[2] = r[2] + b[2]; - return dst; -} -/** - * Treat a 3D vector as a direction and set it's length - * - * @param a The vec3 to lengthen - * @param len The length of the resulting vector - * @returns The lengthened vector - */ -function setLength$1(a, len, dst) { - dst = dst || new VecType$1(3); - normalize$2(a, dst); - return mulScalar$2(dst, len, dst); -} -/** - * Ensure a vector is not longer than a max length - * - * @param a The vec3 to limit - * @param maxLen The longest length of the resulting vector - * @returns The vector, shortened to maxLen if it's too long - */ -function truncate$1(a, maxLen, dst) { - dst = dst || new VecType$1(3); - if (length$2(a) > maxLen) { - return setLength$1(a, maxLen, dst); - } - return copy$3(a, dst); -} -/** - * Return the vector exactly between 2 endpoint vectors - * - * @param a Endpoint 1 - * @param b Endpoint 2 - * @returns The vector exactly residing between endpoints 1 and 2 - */ -function midpoint$1(a, b, dst) { - dst = dst || new VecType$1(3); - return lerp$2(a, b, 0.5, dst); -} - -var vec3Impl = { - __proto__: null, - add: add$2, - addScaled: addScaled$1, - angle: angle$1, - ceil: ceil$1, - clamp: clamp$1, - clone: clone$3, - copy: copy$3, - create: create$4, - cross: cross, - dist: dist$1, - distSq: distSq$1, - distance: distance$1, - distanceSq: distanceSq$1, - div: div$1, - divScalar: divScalar$2, - divide: divide$1, - dot: dot$2, - equals: equals$3, - equalsApproximately: equalsApproximately$3, - floor: floor$1, - fromValues: fromValues$2, - getAxis: getAxis$1, - getScaling: getScaling$1, - getTranslation: getTranslation$1, - inverse: inverse$3, - invert: invert$2, - len: len$2, - lenSq: lenSq$2, - length: length$2, - lengthSq: lengthSq$2, - lerp: lerp$2, - lerpV: lerpV$1, - max: max$1, - midpoint: midpoint$1, - min: min$1, - mul: mul$3, - mulScalar: mulScalar$2, - multiply: multiply$3, - negate: negate$2, - normalize: normalize$2, - random: random, - rotateX: rotateX$2, - rotateY: rotateY$2, - rotateZ: rotateZ$2, - round: round$1, - scale: scale$3, - set: set$3, - setDefaultType: setDefaultType$5, - setLength: setLength$1, - sub: sub$2, - subtract: subtract$2, - transformMat3: transformMat3, - transformMat4: transformMat4$1, - transformMat4Upper3x3: transformMat4Upper3x3, - transformQuat: transformQuat, - truncate: truncate$1, - zero: zero$1 -}; - -/** - * 4x4 Matrix math math functions. - * - * Almost all functions take an optional `dst` argument. If it is not passed in the - * functions will create a new matrix. In other words you can do this - * - * const mat = mat4.translation([1, 2, 3]); // Creates a new translation matrix - * - * or - * - * const mat = mat4.create(); - * mat4.translation([1, 2, 3], mat); // Puts translation matrix in mat. - * - * The first style is often easier but depending on where it's used it generates garbage where - * as there is almost never allocation with the second style. - * - * It is always save to pass any matrix as the destination. So for example - * - * const mat = mat4.identity(); - * const trans = mat4.translation([1, 2, 3]); - * mat4.multiply(mat, trans, mat); // Multiplies mat * trans and puts result in mat. - * - */ -let MatType = Float32Array; -/** - * Sets the type this library creates for a Mat4 - * @param ctor - the constructor for the type. Either `Float32Array`, `Float64Array`, or `Array` - * @returns previous constructor for Mat4 - */ -function setDefaultType$3(ctor) { - const oldType = MatType; - MatType = ctor; - return oldType; -} -/** - * Create a Mat4 from values - * - * Note: Since passing in a raw JavaScript array - * is valid in all circumstances, if you want to - * force a JavaScript array into a Mat4's specified type - * it would be faster to use - * - * ``` - * const m = mat4.clone(someJSArray); - * ``` - * - * Note: a consequence of the implementation is if your Mat4Type = `Array` - * instead of `Float32Array` or `Float64Array` then any values you - * don't pass in will be undefined. Usually this is not an issue since - * (a) using `Array` is rare and (b) using `mat4.create` is usually used - * to create a Mat4 to be filled out as in - * - * ``` - * const m = mat4.create(); - * mat4.perspective(fov, aspect, near, far, m); - * ``` - * - * @param v0 - value for element 0 - * @param v1 - value for element 1 - * @param v2 - value for element 2 - * @param v3 - value for element 3 - * @param v4 - value for element 4 - * @param v5 - value for element 5 - * @param v6 - value for element 6 - * @param v7 - value for element 7 - * @param v8 - value for element 8 - * @param v9 - value for element 9 - * @param v10 - value for element 10 - * @param v11 - value for element 11 - * @param v12 - value for element 12 - * @param v13 - value for element 13 - * @param v14 - value for element 14 - * @param v15 - value for element 15 - * @returns created from values. - */ -function create$2(v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15) { - const dst = new MatType(16); - if (v0 !== undefined) { - dst[0] = v0; - if (v1 !== undefined) { - dst[1] = v1; - if (v2 !== undefined) { - dst[2] = v2; - if (v3 !== undefined) { - dst[3] = v3; - if (v4 !== undefined) { - dst[4] = v4; - if (v5 !== undefined) { - dst[5] = v5; - if (v6 !== undefined) { - dst[6] = v6; - if (v7 !== undefined) { - dst[7] = v7; - if (v8 !== undefined) { - dst[8] = v8; - if (v9 !== undefined) { - dst[9] = v9; - if (v10 !== undefined) { - dst[10] = v10; - if (v11 !== undefined) { - dst[11] = v11; - if (v12 !== undefined) { - dst[12] = v12; - if (v13 !== undefined) { - dst[13] = v13; - if (v14 !== undefined) { - dst[14] = v14; - if (v15 !== undefined) { - dst[15] = v15; - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - return dst; -} -/** - * Sets the values of a Mat4 - * Also see {@link mat4.create} and {@link mat4.copy} - * - * @param v0 - value for element 0 - * @param v1 - value for element 1 - * @param v2 - value for element 2 - * @param v3 - value for element 3 - * @param v4 - value for element 4 - * @param v5 - value for element 5 - * @param v6 - value for element 6 - * @param v7 - value for element 7 - * @param v8 - value for element 8 - * @param v9 - value for element 9 - * @param v10 - value for element 10 - * @param v11 - value for element 11 - * @param v12 - value for element 12 - * @param v13 - value for element 13 - * @param v14 - value for element 14 - * @param v15 - value for element 15 - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns Mat4 created from values. - */ -function set$2(v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, dst) { - dst = dst || new MatType(16); - dst[0] = v0; - dst[1] = v1; - dst[2] = v2; - dst[3] = v3; - dst[4] = v4; - dst[5] = v5; - dst[6] = v6; - dst[7] = v7; - dst[8] = v8; - dst[9] = v9; - dst[10] = v10; - dst[11] = v11; - dst[12] = v12; - dst[13] = v13; - dst[14] = v14; - dst[15] = v15; - return dst; -} -/** - * Creates a Mat4 from a Mat3 - * @param m3 - source matrix - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns Mat4 made from m3 - */ -function fromMat3(m3, dst) { - dst = dst || new MatType(16); - dst[0] = m3[0]; - dst[1] = m3[1]; - dst[2] = m3[2]; - dst[3] = 0; - dst[4] = m3[4]; - dst[5] = m3[5]; - dst[6] = m3[6]; - dst[7] = 0; - dst[8] = m3[8]; - dst[9] = m3[9]; - dst[10] = m3[10]; - dst[11] = 0; - dst[12] = 0; - dst[13] = 0; - dst[14] = 0; - dst[15] = 1; - return dst; -} -/** - * Creates a Mat4 rotation matrix from a quaternion - * @param q - quaternion to create matrix from - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns Mat4 made from q - */ -function fromQuat(q, dst) { - dst = dst || new MatType(16); - const x = q[0]; - const y = q[1]; - const z = q[2]; - const w = q[3]; - const x2 = x + x; - const y2 = y + y; - const z2 = z + z; - const xx = x * x2; - const yx = y * x2; - const yy = y * y2; - const zx = z * x2; - const zy = z * y2; - const zz = z * z2; - const wx = w * x2; - const wy = w * y2; - const wz = w * z2; - dst[0] = 1 - yy - zz; - dst[1] = yx + wz; - dst[2] = zx - wy; - dst[3] = 0; - dst[4] = yx - wz; - dst[5] = 1 - xx - zz; - dst[6] = zy + wx; - dst[7] = 0; - dst[8] = zx + wy; - dst[9] = zy - wx; - dst[10] = 1 - xx - yy; - dst[11] = 0; - dst[12] = 0; - dst[13] = 0; - dst[14] = 0; - dst[15] = 1; - return dst; -} -/** - * Negates a matrix. - * @param m - The matrix. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns -m. - */ -function negate$1(m, dst) { - dst = dst || new MatType(16); - dst[0] = -m[0]; - dst[1] = -m[1]; - dst[2] = -m[2]; - dst[3] = -m[3]; - dst[4] = -m[4]; - dst[5] = -m[5]; - dst[6] = -m[6]; - dst[7] = -m[7]; - dst[8] = -m[8]; - dst[9] = -m[9]; - dst[10] = -m[10]; - dst[11] = -m[11]; - dst[12] = -m[12]; - dst[13] = -m[13]; - dst[14] = -m[14]; - dst[15] = -m[15]; - return dst; -} -/** - * Copies a matrix. (same as {@link mat4.clone}) - * Also see {@link mat4.create} and {@link mat4.set} - * @param m - The matrix. - * @param dst - The matrix. If not passed a new one is created. - * @returns A copy of m. - */ -function copy$2(m, dst) { - dst = dst || new MatType(16); - dst[0] = m[0]; - dst[1] = m[1]; - dst[2] = m[2]; - dst[3] = m[3]; - dst[4] = m[4]; - dst[5] = m[5]; - dst[6] = m[6]; - dst[7] = m[7]; - dst[8] = m[8]; - dst[9] = m[9]; - dst[10] = m[10]; - dst[11] = m[11]; - dst[12] = m[12]; - dst[13] = m[13]; - dst[14] = m[14]; - dst[15] = m[15]; - return dst; -} -/** - * Copies a matrix (same as {@link mat4.copy}) - * Also see {@link mat4.create} and {@link mat4.set} - * @param m - The matrix. - * @param dst - The matrix. If not passed a new one is created. - * @returns A copy of m. - */ -const clone$2 = copy$2; -/** - * Check if 2 matrices are approximately equal - * @param a - Operand matrix. - * @param b - Operand matrix. - * @returns true if matrices are approximately equal - */ -function equalsApproximately$2(a, b) { - return Math.abs(a[0] - b[0]) < EPSILON && - Math.abs(a[1] - b[1]) < EPSILON && - Math.abs(a[2] - b[2]) < EPSILON && - Math.abs(a[3] - b[3]) < EPSILON && - Math.abs(a[4] - b[4]) < EPSILON && - Math.abs(a[5] - b[5]) < EPSILON && - Math.abs(a[6] - b[6]) < EPSILON && - Math.abs(a[7] - b[7]) < EPSILON && - Math.abs(a[8] - b[8]) < EPSILON && - Math.abs(a[9] - b[9]) < EPSILON && - Math.abs(a[10] - b[10]) < EPSILON && - Math.abs(a[11] - b[11]) < EPSILON && - Math.abs(a[12] - b[12]) < EPSILON && - Math.abs(a[13] - b[13]) < EPSILON && - Math.abs(a[14] - b[14]) < EPSILON && - Math.abs(a[15] - b[15]) < EPSILON; -} -/** - * Check if 2 matrices are exactly equal - * @param a - Operand matrix. - * @param b - Operand matrix. - * @returns true if matrices are exactly equal - */ -function equals$2(a, b) { - return a[0] === b[0] && - a[1] === b[1] && - a[2] === b[2] && - a[3] === b[3] && - a[4] === b[4] && - a[5] === b[5] && - a[6] === b[6] && - a[7] === b[7] && - a[8] === b[8] && - a[9] === b[9] && - a[10] === b[10] && - a[11] === b[11] && - a[12] === b[12] && - a[13] === b[13] && - a[14] === b[14] && - a[15] === b[15]; -} -/** - * Creates a 4-by-4 identity matrix. - * - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns A 4-by-4 identity matrix. - */ -function identity$1(dst) { - dst = dst || new MatType(16); - dst[0] = 1; - dst[1] = 0; - dst[2] = 0; - dst[3] = 0; - dst[4] = 0; - dst[5] = 1; - dst[6] = 0; - dst[7] = 0; - dst[8] = 0; - dst[9] = 0; - dst[10] = 1; - dst[11] = 0; - dst[12] = 0; - dst[13] = 0; - dst[14] = 0; - dst[15] = 1; - return dst; -} -/** - * Takes the transpose of a matrix. - * @param m - The matrix. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The transpose of m. - */ -function transpose(m, dst) { - dst = dst || new MatType(16); - if (dst === m) { - let t; - t = m[1]; - m[1] = m[4]; - m[4] = t; - t = m[2]; - m[2] = m[8]; - m[8] = t; - t = m[3]; - m[3] = m[12]; - m[12] = t; - t = m[6]; - m[6] = m[9]; - m[9] = t; - t = m[7]; - m[7] = m[13]; - m[13] = t; - t = m[11]; - m[11] = m[14]; - m[14] = t; - return dst; - } - const m00 = m[0 * 4 + 0]; - const m01 = m[0 * 4 + 1]; - const m02 = m[0 * 4 + 2]; - const m03 = m[0 * 4 + 3]; - const m10 = m[1 * 4 + 0]; - const m11 = m[1 * 4 + 1]; - const m12 = m[1 * 4 + 2]; - const m13 = m[1 * 4 + 3]; - const m20 = m[2 * 4 + 0]; - const m21 = m[2 * 4 + 1]; - const m22 = m[2 * 4 + 2]; - const m23 = m[2 * 4 + 3]; - const m30 = m[3 * 4 + 0]; - const m31 = m[3 * 4 + 1]; - const m32 = m[3 * 4 + 2]; - const m33 = m[3 * 4 + 3]; - dst[0] = m00; - dst[1] = m10; - dst[2] = m20; - dst[3] = m30; - dst[4] = m01; - dst[5] = m11; - dst[6] = m21; - dst[7] = m31; - dst[8] = m02; - dst[9] = m12; - dst[10] = m22; - dst[11] = m32; - dst[12] = m03; - dst[13] = m13; - dst[14] = m23; - dst[15] = m33; - return dst; -} -/** - * Computes the inverse of a 4-by-4 matrix. - * @param m - The matrix. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The inverse of m. - */ -function inverse$2(m, dst) { - dst = dst || new MatType(16); - const m00 = m[0 * 4 + 0]; - const m01 = m[0 * 4 + 1]; - const m02 = m[0 * 4 + 2]; - const m03 = m[0 * 4 + 3]; - const m10 = m[1 * 4 + 0]; - const m11 = m[1 * 4 + 1]; - const m12 = m[1 * 4 + 2]; - const m13 = m[1 * 4 + 3]; - const m20 = m[2 * 4 + 0]; - const m21 = m[2 * 4 + 1]; - const m22 = m[2 * 4 + 2]; - const m23 = m[2 * 4 + 3]; - const m30 = m[3 * 4 + 0]; - const m31 = m[3 * 4 + 1]; - const m32 = m[3 * 4 + 2]; - const m33 = m[3 * 4 + 3]; - const tmp0 = m22 * m33; - const tmp1 = m32 * m23; - const tmp2 = m12 * m33; - const tmp3 = m32 * m13; - const tmp4 = m12 * m23; - const tmp5 = m22 * m13; - const tmp6 = m02 * m33; - const tmp7 = m32 * m03; - const tmp8 = m02 * m23; - const tmp9 = m22 * m03; - const tmp10 = m02 * m13; - const tmp11 = m12 * m03; - const tmp12 = m20 * m31; - const tmp13 = m30 * m21; - const tmp14 = m10 * m31; - const tmp15 = m30 * m11; - const tmp16 = m10 * m21; - const tmp17 = m20 * m11; - const tmp18 = m00 * m31; - const tmp19 = m30 * m01; - const tmp20 = m00 * m21; - const tmp21 = m20 * m01; - const tmp22 = m00 * m11; - const tmp23 = m10 * m01; - const t0 = (tmp0 * m11 + tmp3 * m21 + tmp4 * m31) - - (tmp1 * m11 + tmp2 * m21 + tmp5 * m31); - const t1 = (tmp1 * m01 + tmp6 * m21 + tmp9 * m31) - - (tmp0 * m01 + tmp7 * m21 + tmp8 * m31); - const t2 = (tmp2 * m01 + tmp7 * m11 + tmp10 * m31) - - (tmp3 * m01 + tmp6 * m11 + tmp11 * m31); - const t3 = (tmp5 * m01 + tmp8 * m11 + tmp11 * m21) - - (tmp4 * m01 + tmp9 * m11 + tmp10 * m21); - const d = 1 / (m00 * t0 + m10 * t1 + m20 * t2 + m30 * t3); - dst[0] = d * t0; - dst[1] = d * t1; - dst[2] = d * t2; - dst[3] = d * t3; - dst[4] = d * ((tmp1 * m10 + tmp2 * m20 + tmp5 * m30) - - (tmp0 * m10 + tmp3 * m20 + tmp4 * m30)); - dst[5] = d * ((tmp0 * m00 + tmp7 * m20 + tmp8 * m30) - - (tmp1 * m00 + tmp6 * m20 + tmp9 * m30)); - dst[6] = d * ((tmp3 * m00 + tmp6 * m10 + tmp11 * m30) - - (tmp2 * m00 + tmp7 * m10 + tmp10 * m30)); - dst[7] = d * ((tmp4 * m00 + tmp9 * m10 + tmp10 * m20) - - (tmp5 * m00 + tmp8 * m10 + tmp11 * m20)); - dst[8] = d * ((tmp12 * m13 + tmp15 * m23 + tmp16 * m33) - - (tmp13 * m13 + tmp14 * m23 + tmp17 * m33)); - dst[9] = d * ((tmp13 * m03 + tmp18 * m23 + tmp21 * m33) - - (tmp12 * m03 + tmp19 * m23 + tmp20 * m33)); - dst[10] = d * ((tmp14 * m03 + tmp19 * m13 + tmp22 * m33) - - (tmp15 * m03 + tmp18 * m13 + tmp23 * m33)); - dst[11] = d * ((tmp17 * m03 + tmp20 * m13 + tmp23 * m23) - - (tmp16 * m03 + tmp21 * m13 + tmp22 * m23)); - dst[12] = d * ((tmp14 * m22 + tmp17 * m32 + tmp13 * m12) - - (tmp16 * m32 + tmp12 * m12 + tmp15 * m22)); - dst[13] = d * ((tmp20 * m32 + tmp12 * m02 + tmp19 * m22) - - (tmp18 * m22 + tmp21 * m32 + tmp13 * m02)); - dst[14] = d * ((tmp18 * m12 + tmp23 * m32 + tmp15 * m02) - - (tmp22 * m32 + tmp14 * m02 + tmp19 * m12)); - dst[15] = d * ((tmp22 * m22 + tmp16 * m02 + tmp21 * m12) - - (tmp20 * m12 + tmp23 * m22 + tmp17 * m02)); - return dst; -} -/** - * Compute the determinant of a matrix - * @param m - the matrix - * @returns the determinant - */ -function determinant(m) { - const m00 = m[0 * 4 + 0]; - const m01 = m[0 * 4 + 1]; - const m02 = m[0 * 4 + 2]; - const m03 = m[0 * 4 + 3]; - const m10 = m[1 * 4 + 0]; - const m11 = m[1 * 4 + 1]; - const m12 = m[1 * 4 + 2]; - const m13 = m[1 * 4 + 3]; - const m20 = m[2 * 4 + 0]; - const m21 = m[2 * 4 + 1]; - const m22 = m[2 * 4 + 2]; - const m23 = m[2 * 4 + 3]; - const m30 = m[3 * 4 + 0]; - const m31 = m[3 * 4 + 1]; - const m32 = m[3 * 4 + 2]; - const m33 = m[3 * 4 + 3]; - const tmp0 = m22 * m33; - const tmp1 = m32 * m23; - const tmp2 = m12 * m33; - const tmp3 = m32 * m13; - const tmp4 = m12 * m23; - const tmp5 = m22 * m13; - const tmp6 = m02 * m33; - const tmp7 = m32 * m03; - const tmp8 = m02 * m23; - const tmp9 = m22 * m03; - const tmp10 = m02 * m13; - const tmp11 = m12 * m03; - const t0 = (tmp0 * m11 + tmp3 * m21 + tmp4 * m31) - - (tmp1 * m11 + tmp2 * m21 + tmp5 * m31); - const t1 = (tmp1 * m01 + tmp6 * m21 + tmp9 * m31) - - (tmp0 * m01 + tmp7 * m21 + tmp8 * m31); - const t2 = (tmp2 * m01 + tmp7 * m11 + tmp10 * m31) - - (tmp3 * m01 + tmp6 * m11 + tmp11 * m31); - const t3 = (tmp5 * m01 + tmp8 * m11 + tmp11 * m21) - - (tmp4 * m01 + tmp9 * m11 + tmp10 * m21); - return m00 * t0 + m10 * t1 + m20 * t2 + m30 * t3; -} -/** - * Computes the inverse of a 4-by-4 matrix. (same as inverse) - * @param m - The matrix. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The inverse of m. - */ -const invert$1 = inverse$2; -/** - * Multiplies two 4-by-4 matrices with a on the left and b on the right - * @param a - The matrix on the left. - * @param b - The matrix on the right. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The matrix product of a and b. - */ -function multiply$2(a, b, dst) { - dst = dst || new MatType(16); - const a00 = a[0]; - const a01 = a[1]; - const a02 = a[2]; - const a03 = a[3]; - const a10 = a[4 + 0]; - const a11 = a[4 + 1]; - const a12 = a[4 + 2]; - const a13 = a[4 + 3]; - const a20 = a[8 + 0]; - const a21 = a[8 + 1]; - const a22 = a[8 + 2]; - const a23 = a[8 + 3]; - const a30 = a[12 + 0]; - const a31 = a[12 + 1]; - const a32 = a[12 + 2]; - const a33 = a[12 + 3]; - const b00 = b[0]; - const b01 = b[1]; - const b02 = b[2]; - const b03 = b[3]; - const b10 = b[4 + 0]; - const b11 = b[4 + 1]; - const b12 = b[4 + 2]; - const b13 = b[4 + 3]; - const b20 = b[8 + 0]; - const b21 = b[8 + 1]; - const b22 = b[8 + 2]; - const b23 = b[8 + 3]; - const b30 = b[12 + 0]; - const b31 = b[12 + 1]; - const b32 = b[12 + 2]; - const b33 = b[12 + 3]; - dst[0] = a00 * b00 + a10 * b01 + a20 * b02 + a30 * b03; - dst[1] = a01 * b00 + a11 * b01 + a21 * b02 + a31 * b03; - dst[2] = a02 * b00 + a12 * b01 + a22 * b02 + a32 * b03; - dst[3] = a03 * b00 + a13 * b01 + a23 * b02 + a33 * b03; - dst[4] = a00 * b10 + a10 * b11 + a20 * b12 + a30 * b13; - dst[5] = a01 * b10 + a11 * b11 + a21 * b12 + a31 * b13; - dst[6] = a02 * b10 + a12 * b11 + a22 * b12 + a32 * b13; - dst[7] = a03 * b10 + a13 * b11 + a23 * b12 + a33 * b13; - dst[8] = a00 * b20 + a10 * b21 + a20 * b22 + a30 * b23; - dst[9] = a01 * b20 + a11 * b21 + a21 * b22 + a31 * b23; - dst[10] = a02 * b20 + a12 * b21 + a22 * b22 + a32 * b23; - dst[11] = a03 * b20 + a13 * b21 + a23 * b22 + a33 * b23; - dst[12] = a00 * b30 + a10 * b31 + a20 * b32 + a30 * b33; - dst[13] = a01 * b30 + a11 * b31 + a21 * b32 + a31 * b33; - dst[14] = a02 * b30 + a12 * b31 + a22 * b32 + a32 * b33; - dst[15] = a03 * b30 + a13 * b31 + a23 * b32 + a33 * b33; - return dst; -} -/** - * Multiplies two 4-by-4 matrices with a on the left and b on the right (same as multiply) - * @param a - The matrix on the left. - * @param b - The matrix on the right. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The matrix product of a and b. - */ -const mul$2 = multiply$2; -/** - * Sets the translation component of a 4-by-4 matrix to the given - * vector. - * @param a - The matrix. - * @param v - The vector. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The matrix with translation set. - */ -function setTranslation(a, v, dst) { - dst = dst || identity$1(); - if (a !== dst) { - dst[0] = a[0]; - dst[1] = a[1]; - dst[2] = a[2]; - dst[3] = a[3]; - dst[4] = a[4]; - dst[5] = a[5]; - dst[6] = a[6]; - dst[7] = a[7]; - dst[8] = a[8]; - dst[9] = a[9]; - dst[10] = a[10]; - dst[11] = a[11]; - } - dst[12] = v[0]; - dst[13] = v[1]; - dst[14] = v[2]; - dst[15] = 1; - return dst; -} -/** - * Returns the translation component of a 4-by-4 matrix as a vector with 3 - * entries. - * @param m - The matrix. - * @param dst - vector to hold result. If not passed a new one is created. - * @returns The translation component of m. - */ -function getTranslation(m, dst) { - dst = dst || create$4(); - dst[0] = m[12]; - dst[1] = m[13]; - dst[2] = m[14]; - return dst; -} -/** - * Returns an axis of a 4x4 matrix as a vector with 3 entries - * @param m - The matrix. - * @param axis - The axis 0 = x, 1 = y, 2 = z; - * @returns The axis component of m. - */ -function getAxis(m, axis, dst) { - dst = dst || create$4(); - const off = axis * 4; - dst[0] = m[off + 0]; - dst[1] = m[off + 1]; - dst[2] = m[off + 2]; - return dst; -} -/** - * Sets an axis of a 4x4 matrix as a vector with 3 entries - * @param m - The matrix. - * @param v - the axis vector - * @param axis - The axis 0 = x, 1 = y, 2 = z; - * @param dst - The matrix to set. If not passed a new one is created. - * @returns The matrix with axis set. - */ -function setAxis(m, v, axis, dst) { - if (dst !== m) { - dst = copy$2(m, dst); - } - const off = axis * 4; - dst[off + 0] = v[0]; - dst[off + 1] = v[1]; - dst[off + 2] = v[2]; - return dst; -} -/** - * Returns the scaling component of the matrix - * @param m - The Matrix - * @param dst - The vector to set. If not passed a new one is created. - */ -function getScaling(m, dst) { - dst = dst || create$4(); - const xx = m[0]; - const xy = m[1]; - const xz = m[2]; - const yx = m[4]; - const yy = m[5]; - const yz = m[6]; - const zx = m[8]; - const zy = m[9]; - const zz = m[10]; - dst[0] = Math.sqrt(xx * xx + xy * xy + xz * xz); - dst[1] = Math.sqrt(yx * yx + yy * yy + yz * yz); - dst[2] = Math.sqrt(zx * zx + zy * zy + zz * zz); - return dst; -} -/** - * Computes a 4-by-4 perspective transformation matrix given the angular height - * of the frustum, the aspect ratio, and the near and far clipping planes. The - * arguments define a frustum extending in the negative z direction. The given - * angle is the vertical angle of the frustum, and the horizontal angle is - * determined to produce the given aspect ratio. The arguments near and far are - * the distances to the near and far clipping planes. Note that near and far - * are not z coordinates, but rather they are distances along the negative - * z-axis. The matrix generated sends the viewing frustum to the unit box. - * We assume a unit box extending from -1 to 1 in the x and y dimensions and - * from 0 to 1 in the z dimension. - * - * Note: If you pass `Infinity` for zFar then it will produce a projection matrix - * returns -Infinity for Z when transforming coordinates with Z <= 0 and +Infinity for Z - * otherwise. - * - * @param fieldOfViewYInRadians - The camera angle from top to bottom (in radians). - * @param aspect - The aspect ratio width / height. - * @param zNear - The depth (negative z coordinate) - * of the near clipping plane. - * @param zFar - The depth (negative z coordinate) - * of the far clipping plane. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The perspective matrix. - */ -function perspective(fieldOfViewYInRadians, aspect, zNear, zFar, dst) { - dst = dst || new MatType(16); - const f = Math.tan(Math.PI * 0.5 - 0.5 * fieldOfViewYInRadians); - dst[0] = f / aspect; - dst[1] = 0; - dst[2] = 0; - dst[3] = 0; - dst[4] = 0; - dst[5] = f; - dst[6] = 0; - dst[7] = 0; - dst[8] = 0; - dst[9] = 0; - dst[11] = -1; - dst[12] = 0; - dst[13] = 0; - dst[15] = 0; - if (Number.isFinite(zFar)) { - const rangeInv = 1 / (zNear - zFar); - dst[10] = zFar * rangeInv; - dst[14] = zFar * zNear * rangeInv; - } - else { - dst[10] = -1; - dst[14] = -zNear; - } - return dst; -} -/** - * Computes a 4-by-4 reverse-z perspective transformation matrix given the angular height - * of the frustum, the aspect ratio, and the near and far clipping planes. The - * arguments define a frustum extending in the negative z direction. The given - * angle is the vertical angle of the frustum, and the horizontal angle is - * determined to produce the given aspect ratio. The arguments near and far are - * the distances to the near and far clipping planes. Note that near and far - * are not z coordinates, but rather they are distances along the negative - * z-axis. The matrix generated sends the viewing frustum to the unit box. - * We assume a unit box extending from -1 to 1 in the x and y dimensions and - * from 1 (at -zNear) to 0 (at -zFar) in the z dimension. - * - * @param fieldOfViewYInRadians - The camera angle from top to bottom (in radians). - * @param aspect - The aspect ratio width / height. - * @param zNear - The depth (negative z coordinate) - * of the near clipping plane. - * @param zFar - The depth (negative z coordinate) - * of the far clipping plane. (default = Infinity) - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The perspective matrix. - */ function perspectiveReverseZ(fieldOfViewYInRadians, aspect, zNear, zFar = Infinity, dst) { - dst = dst || new MatType(16); - const f = 1 / Math.tan(fieldOfViewYInRadians * 0.5); - dst[0] = f / aspect; - dst[1] = 0; - dst[2] = 0; - dst[3] = 0; - dst[4] = 0; - dst[5] = f; - dst[6] = 0; - dst[7] = 0; - dst[8] = 0; - dst[9] = 0; - dst[11] = -1; - dst[12] = 0; - dst[13] = 0; - dst[15] = 0; - if (zFar === Infinity) { - dst[10] = 0; - dst[14] = zNear; - } - else { - const rangeInv = 1 / (zFar - zNear); - dst[10] = zNear * rangeInv; - dst[14] = zFar * zNear * rangeInv; - } - return dst; -} -/** - * Computes a 4-by-4 orthogonal transformation matrix that transforms from - * the given the left, right, bottom, and top dimensions to -1 +1 in x, and y - * and 0 to +1 in z. - * @param left - Left side of the near clipping plane viewport. - * @param right - Right side of the near clipping plane viewport. - * @param bottom - Bottom of the near clipping plane viewport. - * @param top - Top of the near clipping plane viewport. - * @param near - The depth (negative z coordinate) - * of the near clipping plane. - * @param far - The depth (negative z coordinate) - * of the far clipping plane. - * @param dst - Output matrix. If not passed a new one is created. - * @returns The orthographic projection matrix. - */ -function ortho(left, right, bottom, top, near, far, dst) { - dst = dst || new MatType(16); - dst[0] = 2 / (right - left); - dst[1] = 0; - dst[2] = 0; - dst[3] = 0; - dst[4] = 0; - dst[5] = 2 / (top - bottom); - dst[6] = 0; - dst[7] = 0; - dst[8] = 0; - dst[9] = 0; - dst[10] = 1 / (near - far); - dst[11] = 0; - dst[12] = (right + left) / (left - right); - dst[13] = (top + bottom) / (bottom - top); - dst[14] = near / (near - far); - dst[15] = 1; - return dst; -} -/** - * Computes a 4-by-4 perspective transformation matrix given the left, right, - * top, bottom, near and far clipping planes. The arguments define a frustum - * extending in the negative z direction. The arguments near and far are the - * distances to the near and far clipping planes. Note that near and far are not - * z coordinates, but rather they are distances along the negative z-axis. The - * matrix generated sends the viewing frustum to the unit box. We assume a unit - * box extending from -1 to 1 in the x and y dimensions and from 0 to 1 in the z - * dimension. - * @param left - The x coordinate of the left plane of the box. - * @param right - The x coordinate of the right plane of the box. - * @param bottom - The y coordinate of the bottom plane of the box. - * @param top - The y coordinate of the right plane of the box. - * @param near - The negative z coordinate of the near plane of the box. - * @param far - The negative z coordinate of the far plane of the box. - * @param dst - Output matrix. If not passed a new one is created. - * @returns The perspective projection matrix. - */ -function frustum(left, right, bottom, top, near, far, dst) { - dst = dst || new MatType(16); - const dx = (right - left); - const dy = (top - bottom); - const dz = (near - far); - dst[0] = 2 * near / dx; - dst[1] = 0; - dst[2] = 0; - dst[3] = 0; - dst[4] = 0; - dst[5] = 2 * near / dy; - dst[6] = 0; - dst[7] = 0; - dst[8] = (left + right) / dx; - dst[9] = (top + bottom) / dy; - dst[10] = far / dz; - dst[11] = -1; - dst[12] = 0; - dst[13] = 0; - dst[14] = near * far / dz; - dst[15] = 0; - return dst; -} -/** - * Computes a 4-by-4 reverse-z perspective transformation matrix given the left, right, - * top, bottom, near and far clipping planes. The arguments define a frustum - * extending in the negative z direction. The arguments near and far are the - * distances to the near and far clipping planes. Note that near and far are not - * z coordinates, but rather they are distances along the negative z-axis. The - * matrix generated sends the viewing frustum to the unit box. We assume a unit - * box extending from -1 to 1 in the x and y dimensions and from 1 (-near) to 0 (-far) in the z - * dimension. - * @param left - The x coordinate of the left plane of the box. - * @param right - The x coordinate of the right plane of the box. - * @param bottom - The y coordinate of the bottom plane of the box. - * @param top - The y coordinate of the right plane of the box. - * @param near - The negative z coordinate of the near plane of the box. - * @param far - The negative z coordinate of the far plane of the box. - * @param dst - Output matrix. If not passed a new one is created. - * @returns The perspective projection matrix. - */ -function frustumReverseZ(left, right, bottom, top, near, far = Infinity, dst) { - dst = dst || new MatType(16); - const dx = (right - left); - const dy = (top - bottom); - dst[0] = 2 * near / dx; - dst[1] = 0; - dst[2] = 0; - dst[3] = 0; - dst[4] = 0; - dst[5] = 2 * near / dy; - dst[6] = 0; - dst[7] = 0; - dst[8] = (left + right) / dx; - dst[9] = (top + bottom) / dy; - dst[11] = -1; - dst[12] = 0; - dst[13] = 0; - dst[15] = 0; - if (far === Infinity) { - dst[10] = 0; - dst[14] = near; - } - else { - const rangeInv = 1 / (far - near); - dst[10] = near * rangeInv; - dst[14] = far * near * rangeInv; - } - return dst; -} -let xAxis; -let yAxis; -let zAxis; -/** - * Computes a 4-by-4 aim transformation. - * - * This is a matrix which positions an object aiming down positive Z. - * toward the target. - * - * Note: this is **NOT** the inverse of lookAt as lookAt looks at negative Z. - * - * @param position - The position of the object. - * @param target - The position meant to be aimed at. - * @param up - A vector pointing up. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The aim matrix. - */ -function aim(position, target, up, dst) { - dst = dst || new MatType(16); - xAxis = xAxis || create$4(); - yAxis = yAxis || create$4(); - zAxis = zAxis || create$4(); - normalize$2(subtract$2(target, position, zAxis), zAxis); - normalize$2(cross(up, zAxis, xAxis), xAxis); - normalize$2(cross(zAxis, xAxis, yAxis), yAxis); - dst[0] = xAxis[0]; - dst[1] = xAxis[1]; - dst[2] = xAxis[2]; - dst[3] = 0; - dst[4] = yAxis[0]; - dst[5] = yAxis[1]; - dst[6] = yAxis[2]; - dst[7] = 0; - dst[8] = zAxis[0]; - dst[9] = zAxis[1]; - dst[10] = zAxis[2]; - dst[11] = 0; - dst[12] = position[0]; - dst[13] = position[1]; - dst[14] = position[2]; - dst[15] = 1; - return dst; -} -/** - * Computes a 4-by-4 camera aim transformation. - * - * This is a matrix which positions an object aiming down negative Z. - * toward the target. - * - * Note: this is the inverse of `lookAt` - * - * @param eye - The position of the object. - * @param target - The position meant to be aimed at. - * @param up - A vector pointing up. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The aim matrix. - */ -function cameraAim(eye, target, up, dst) { - dst = dst || new MatType(16); - xAxis = xAxis || create$4(); - yAxis = yAxis || create$4(); - zAxis = zAxis || create$4(); - normalize$2(subtract$2(eye, target, zAxis), zAxis); - normalize$2(cross(up, zAxis, xAxis), xAxis); - normalize$2(cross(zAxis, xAxis, yAxis), yAxis); - dst[0] = xAxis[0]; - dst[1] = xAxis[1]; - dst[2] = xAxis[2]; - dst[3] = 0; - dst[4] = yAxis[0]; - dst[5] = yAxis[1]; - dst[6] = yAxis[2]; - dst[7] = 0; - dst[8] = zAxis[0]; - dst[9] = zAxis[1]; - dst[10] = zAxis[2]; - dst[11] = 0; - dst[12] = eye[0]; - dst[13] = eye[1]; - dst[14] = eye[2]; - dst[15] = 1; - return dst; -} -/** - * Computes a 4-by-4 view transformation. - * - * This is a view matrix which transforms all other objects - * to be in the space of the view defined by the parameters. - * - * @param eye - The position of the object. - * @param target - The position meant to be aimed at. - * @param up - A vector pointing up. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The look-at matrix. - */ -function lookAt(eye, target, up, dst) { - dst = dst || new MatType(16); - xAxis = xAxis || create$4(); - yAxis = yAxis || create$4(); - zAxis = zAxis || create$4(); - normalize$2(subtract$2(eye, target, zAxis), zAxis); - normalize$2(cross(up, zAxis, xAxis), xAxis); - normalize$2(cross(zAxis, xAxis, yAxis), yAxis); - dst[0] = xAxis[0]; - dst[1] = yAxis[0]; - dst[2] = zAxis[0]; - dst[3] = 0; - dst[4] = xAxis[1]; - dst[5] = yAxis[1]; - dst[6] = zAxis[1]; - dst[7] = 0; - dst[8] = xAxis[2]; - dst[9] = yAxis[2]; - dst[10] = zAxis[2]; - dst[11] = 0; - dst[12] = -(xAxis[0] * eye[0] + xAxis[1] * eye[1] + xAxis[2] * eye[2]); - dst[13] = -(yAxis[0] * eye[0] + yAxis[1] * eye[1] + yAxis[2] * eye[2]); - dst[14] = -(zAxis[0] * eye[0] + zAxis[1] * eye[1] + zAxis[2] * eye[2]); - dst[15] = 1; - return dst; -} -/** - * Creates a 4-by-4 matrix which translates by the given vector v. - * @param v - The vector by - * which to translate. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The translation matrix. - */ -function translation(v, dst) { - dst = dst || new MatType(16); - dst[0] = 1; - dst[1] = 0; - dst[2] = 0; - dst[3] = 0; - dst[4] = 0; - dst[5] = 1; - dst[6] = 0; - dst[7] = 0; - dst[8] = 0; - dst[9] = 0; - dst[10] = 1; - dst[11] = 0; - dst[12] = v[0]; - dst[13] = v[1]; - dst[14] = v[2]; - dst[15] = 1; - return dst; -} -/** - * Translates the given 4-by-4 matrix by the given vector v. - * @param m - The matrix. - * @param v - The vector by - * which to translate. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The translated matrix. - */ -function translate(m, v, dst) { - dst = dst || new MatType(16); - const v0 = v[0]; - const v1 = v[1]; - const v2 = v[2]; - const m00 = m[0]; - const m01 = m[1]; - const m02 = m[2]; - const m03 = m[3]; - const m10 = m[1 * 4 + 0]; - const m11 = m[1 * 4 + 1]; - const m12 = m[1 * 4 + 2]; - const m13 = m[1 * 4 + 3]; - const m20 = m[2 * 4 + 0]; - const m21 = m[2 * 4 + 1]; - const m22 = m[2 * 4 + 2]; - const m23 = m[2 * 4 + 3]; - const m30 = m[3 * 4 + 0]; - const m31 = m[3 * 4 + 1]; - const m32 = m[3 * 4 + 2]; - const m33 = m[3 * 4 + 3]; - if (m !== dst) { - dst[0] = m00; - dst[1] = m01; - dst[2] = m02; - dst[3] = m03; - dst[4] = m10; - dst[5] = m11; - dst[6] = m12; - dst[7] = m13; - dst[8] = m20; - dst[9] = m21; - dst[10] = m22; - dst[11] = m23; - } - dst[12] = m00 * v0 + m10 * v1 + m20 * v2 + m30; - dst[13] = m01 * v0 + m11 * v1 + m21 * v2 + m31; - dst[14] = m02 * v0 + m12 * v1 + m22 * v2 + m32; - dst[15] = m03 * v0 + m13 * v1 + m23 * v2 + m33; - return dst; -} -/** - * Creates a 4-by-4 matrix which rotates around the x-axis by the given angle. - * @param angleInRadians - The angle by which to rotate (in radians). - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The rotation matrix. - */ -function rotationX(angleInRadians, dst) { - dst = dst || new MatType(16); - const c = Math.cos(angleInRadians); - const s = Math.sin(angleInRadians); - dst[0] = 1; - dst[1] = 0; - dst[2] = 0; - dst[3] = 0; - dst[4] = 0; - dst[5] = c; - dst[6] = s; - dst[7] = 0; - dst[8] = 0; - dst[9] = -s; - dst[10] = c; - dst[11] = 0; - dst[12] = 0; - dst[13] = 0; - dst[14] = 0; - dst[15] = 1; - return dst; -} -/** - * Rotates the given 4-by-4 matrix around the x-axis by the given - * angle. - * @param m - The matrix. - * @param angleInRadians - The angle by which to rotate (in radians). - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The rotated matrix. - */ -function rotateX$1(m, angleInRadians, dst) { - dst = dst || new MatType(16); - const m10 = m[4]; - const m11 = m[5]; - const m12 = m[6]; - const m13 = m[7]; - const m20 = m[8]; - const m21 = m[9]; - const m22 = m[10]; - const m23 = m[11]; - const c = Math.cos(angleInRadians); - const s = Math.sin(angleInRadians); - dst[4] = c * m10 + s * m20; - dst[5] = c * m11 + s * m21; - dst[6] = c * m12 + s * m22; - dst[7] = c * m13 + s * m23; - dst[8] = c * m20 - s * m10; - dst[9] = c * m21 - s * m11; - dst[10] = c * m22 - s * m12; - dst[11] = c * m23 - s * m13; - if (m !== dst) { - dst[0] = m[0]; - dst[1] = m[1]; - dst[2] = m[2]; - dst[3] = m[3]; - dst[12] = m[12]; - dst[13] = m[13]; - dst[14] = m[14]; - dst[15] = m[15]; - } - return dst; -} -/** - * Creates a 4-by-4 matrix which rotates around the y-axis by the given angle. - * @param angleInRadians - The angle by which to rotate (in radians). - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The rotation matrix. - */ -function rotationY(angleInRadians, dst) { - dst = dst || new MatType(16); - const c = Math.cos(angleInRadians); - const s = Math.sin(angleInRadians); - dst[0] = c; - dst[1] = 0; - dst[2] = -s; - dst[3] = 0; - dst[4] = 0; - dst[5] = 1; - dst[6] = 0; - dst[7] = 0; - dst[8] = s; - dst[9] = 0; - dst[10] = c; - dst[11] = 0; - dst[12] = 0; - dst[13] = 0; - dst[14] = 0; - dst[15] = 1; - return dst; -} -/** - * Rotates the given 4-by-4 matrix around the y-axis by the given - * angle. - * @param m - The matrix. - * @param angleInRadians - The angle by which to rotate (in radians). - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The rotated matrix. - */ -function rotateY$1(m, angleInRadians, dst) { - dst = dst || new MatType(16); - const m00 = m[0 * 4 + 0]; - const m01 = m[0 * 4 + 1]; - const m02 = m[0 * 4 + 2]; - const m03 = m[0 * 4 + 3]; - const m20 = m[2 * 4 + 0]; - const m21 = m[2 * 4 + 1]; - const m22 = m[2 * 4 + 2]; - const m23 = m[2 * 4 + 3]; - const c = Math.cos(angleInRadians); - const s = Math.sin(angleInRadians); - dst[0] = c * m00 - s * m20; - dst[1] = c * m01 - s * m21; - dst[2] = c * m02 - s * m22; - dst[3] = c * m03 - s * m23; - dst[8] = c * m20 + s * m00; - dst[9] = c * m21 + s * m01; - dst[10] = c * m22 + s * m02; - dst[11] = c * m23 + s * m03; - if (m !== dst) { - dst[4] = m[4]; - dst[5] = m[5]; - dst[6] = m[6]; - dst[7] = m[7]; - dst[12] = m[12]; - dst[13] = m[13]; - dst[14] = m[14]; - dst[15] = m[15]; - } - return dst; -} -/** - * Creates a 4-by-4 matrix which rotates around the z-axis by the given angle. - * @param angleInRadians - The angle by which to rotate (in radians). - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The rotation matrix. - */ -function rotationZ(angleInRadians, dst) { - dst = dst || new MatType(16); - const c = Math.cos(angleInRadians); - const s = Math.sin(angleInRadians); - dst[0] = c; - dst[1] = s; - dst[2] = 0; - dst[3] = 0; - dst[4] = -s; - dst[5] = c; - dst[6] = 0; - dst[7] = 0; - dst[8] = 0; - dst[9] = 0; - dst[10] = 1; - dst[11] = 0; - dst[12] = 0; - dst[13] = 0; - dst[14] = 0; - dst[15] = 1; - return dst; -} -/** - * Rotates the given 4-by-4 matrix around the z-axis by the given - * angle. - * @param m - The matrix. - * @param angleInRadians - The angle by which to rotate (in radians). - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The rotated matrix. - */ -function rotateZ$1(m, angleInRadians, dst) { - dst = dst || new MatType(16); - const m00 = m[0 * 4 + 0]; - const m01 = m[0 * 4 + 1]; - const m02 = m[0 * 4 + 2]; - const m03 = m[0 * 4 + 3]; - const m10 = m[1 * 4 + 0]; - const m11 = m[1 * 4 + 1]; - const m12 = m[1 * 4 + 2]; - const m13 = m[1 * 4 + 3]; - const c = Math.cos(angleInRadians); - const s = Math.sin(angleInRadians); - dst[0] = c * m00 + s * m10; - dst[1] = c * m01 + s * m11; - dst[2] = c * m02 + s * m12; - dst[3] = c * m03 + s * m13; - dst[4] = c * m10 - s * m00; - dst[5] = c * m11 - s * m01; - dst[6] = c * m12 - s * m02; - dst[7] = c * m13 - s * m03; - if (m !== dst) { - dst[8] = m[8]; - dst[9] = m[9]; - dst[10] = m[10]; - dst[11] = m[11]; - dst[12] = m[12]; - dst[13] = m[13]; - dst[14] = m[14]; - dst[15] = m[15]; - } - return dst; -} -/** - * Creates a 4-by-4 matrix which rotates around the given axis by the given - * angle. - * @param axis - The axis - * about which to rotate. - * @param angleInRadians - The angle by which to rotate (in radians). - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns A matrix which rotates angle radians - * around the axis. - */ -function axisRotation(axis, angleInRadians, dst) { - dst = dst || new MatType(16); - let x = axis[0]; - let y = axis[1]; - let z = axis[2]; - const n = Math.sqrt(x * x + y * y + z * z); - x /= n; - y /= n; - z /= n; - const xx = x * x; - const yy = y * y; - const zz = z * z; - const c = Math.cos(angleInRadians); - const s = Math.sin(angleInRadians); - const oneMinusCosine = 1 - c; - dst[0] = xx + (1 - xx) * c; - dst[1] = x * y * oneMinusCosine + z * s; - dst[2] = x * z * oneMinusCosine - y * s; - dst[3] = 0; - dst[4] = x * y * oneMinusCosine - z * s; - dst[5] = yy + (1 - yy) * c; - dst[6] = y * z * oneMinusCosine + x * s; - dst[7] = 0; - dst[8] = x * z * oneMinusCosine + y * s; - dst[9] = y * z * oneMinusCosine - x * s; - dst[10] = zz + (1 - zz) * c; - dst[11] = 0; - dst[12] = 0; - dst[13] = 0; - dst[14] = 0; - dst[15] = 1; - return dst; -} -/** - * Creates a 4-by-4 matrix which rotates around the given axis by the given - * angle. (same as axisRotation) - * @param axis - The axis - * about which to rotate. - * @param angleInRadians - The angle by which to rotate (in radians). - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns A matrix which rotates angle radians - * around the axis. - */ -const rotation = axisRotation; -/** - * Rotates the given 4-by-4 matrix around the given axis by the - * given angle. - * @param m - The matrix. - * @param axis - The axis - * about which to rotate. - * @param angleInRadians - The angle by which to rotate (in radians). - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The rotated matrix. - */ -function axisRotate(m, axis, angleInRadians, dst) { - dst = dst || new MatType(16); - let x = axis[0]; - let y = axis[1]; - let z = axis[2]; - const n = Math.sqrt(x * x + y * y + z * z); - x /= n; - y /= n; - z /= n; - const xx = x * x; - const yy = y * y; - const zz = z * z; - const c = Math.cos(angleInRadians); - const s = Math.sin(angleInRadians); - const oneMinusCosine = 1 - c; - const r00 = xx + (1 - xx) * c; - const r01 = x * y * oneMinusCosine + z * s; - const r02 = x * z * oneMinusCosine - y * s; - const r10 = x * y * oneMinusCosine - z * s; - const r11 = yy + (1 - yy) * c; - const r12 = y * z * oneMinusCosine + x * s; - const r20 = x * z * oneMinusCosine + y * s; - const r21 = y * z * oneMinusCosine - x * s; - const r22 = zz + (1 - zz) * c; - const m00 = m[0]; - const m01 = m[1]; - const m02 = m[2]; - const m03 = m[3]; - const m10 = m[4]; - const m11 = m[5]; - const m12 = m[6]; - const m13 = m[7]; - const m20 = m[8]; - const m21 = m[9]; - const m22 = m[10]; - const m23 = m[11]; - dst[0] = r00 * m00 + r01 * m10 + r02 * m20; - dst[1] = r00 * m01 + r01 * m11 + r02 * m21; - dst[2] = r00 * m02 + r01 * m12 + r02 * m22; - dst[3] = r00 * m03 + r01 * m13 + r02 * m23; - dst[4] = r10 * m00 + r11 * m10 + r12 * m20; - dst[5] = r10 * m01 + r11 * m11 + r12 * m21; - dst[6] = r10 * m02 + r11 * m12 + r12 * m22; - dst[7] = r10 * m03 + r11 * m13 + r12 * m23; - dst[8] = r20 * m00 + r21 * m10 + r22 * m20; - dst[9] = r20 * m01 + r21 * m11 + r22 * m21; - dst[10] = r20 * m02 + r21 * m12 + r22 * m22; - dst[11] = r20 * m03 + r21 * m13 + r22 * m23; - if (m !== dst) { - dst[12] = m[12]; - dst[13] = m[13]; - dst[14] = m[14]; - dst[15] = m[15]; - } - return dst; -} -/** - * Rotates the given 4-by-4 matrix around the given axis by the - * given angle. (same as rotate) - * @param m - The matrix. - * @param axis - The axis - * about which to rotate. - * @param angleInRadians - The angle by which to rotate (in radians). - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The rotated matrix. - */ -const rotate = axisRotate; -/** - * Creates a 4-by-4 matrix which scales in each dimension by an amount given by - * the corresponding entry in the given vector; assumes the vector has three - * entries. - * @param v - A vector of - * three entries specifying the factor by which to scale in each dimension. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The scaling matrix. - */ -function scaling(v, dst) { - dst = dst || new MatType(16); - dst[0] = v[0]; - dst[1] = 0; - dst[2] = 0; - dst[3] = 0; - dst[4] = 0; - dst[5] = v[1]; - dst[6] = 0; - dst[7] = 0; - dst[8] = 0; - dst[9] = 0; - dst[10] = v[2]; - dst[11] = 0; - dst[12] = 0; - dst[13] = 0; - dst[14] = 0; - dst[15] = 1; - return dst; -} -/** - * Scales the given 4-by-4 matrix in each dimension by an amount - * given by the corresponding entry in the given vector; assumes the vector has - * three entries. - * @param m - The matrix to be modified. - * @param v - A vector of three entries specifying the - * factor by which to scale in each dimension. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The scaled matrix. - */ -function scale$2(m, v, dst) { - dst = dst || new MatType(16); - const v0 = v[0]; - const v1 = v[1]; - const v2 = v[2]; - dst[0] = v0 * m[0 * 4 + 0]; - dst[1] = v0 * m[0 * 4 + 1]; - dst[2] = v0 * m[0 * 4 + 2]; - dst[3] = v0 * m[0 * 4 + 3]; - dst[4] = v1 * m[1 * 4 + 0]; - dst[5] = v1 * m[1 * 4 + 1]; - dst[6] = v1 * m[1 * 4 + 2]; - dst[7] = v1 * m[1 * 4 + 3]; - dst[8] = v2 * m[2 * 4 + 0]; - dst[9] = v2 * m[2 * 4 + 1]; - dst[10] = v2 * m[2 * 4 + 2]; - dst[11] = v2 * m[2 * 4 + 3]; - if (m !== dst) { - dst[12] = m[12]; - dst[13] = m[13]; - dst[14] = m[14]; - dst[15] = m[15]; - } - return dst; -} -/** - * Creates a 4-by-4 matrix which scales a uniform amount in each dimension. - * @param s - the amount to scale - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The scaling matrix. - */ -function uniformScaling(s, dst) { - dst = dst || new MatType(16); - dst[0] = s; - dst[1] = 0; - dst[2] = 0; - dst[3] = 0; - dst[4] = 0; - dst[5] = s; - dst[6] = 0; - dst[7] = 0; - dst[8] = 0; - dst[9] = 0; - dst[10] = s; - dst[11] = 0; - dst[12] = 0; - dst[13] = 0; - dst[14] = 0; - dst[15] = 1; - return dst; -} -/** - * Scales the given 4-by-4 matrix in each dimension by a uniform scale. - * @param m - The matrix to be modified. - * @param s - The amount to scale. - * @param dst - matrix to hold result. If not passed a new one is created. - * @returns The scaled matrix. - */ -function uniformScale(m, s, dst) { - dst = dst || new MatType(16); - dst[0] = s * m[0 * 4 + 0]; - dst[1] = s * m[0 * 4 + 1]; - dst[2] = s * m[0 * 4 + 2]; - dst[3] = s * m[0 * 4 + 3]; - dst[4] = s * m[1 * 4 + 0]; - dst[5] = s * m[1 * 4 + 1]; - dst[6] = s * m[1 * 4 + 2]; - dst[7] = s * m[1 * 4 + 3]; - dst[8] = s * m[2 * 4 + 0]; - dst[9] = s * m[2 * 4 + 1]; - dst[10] = s * m[2 * 4 + 2]; - dst[11] = s * m[2 * 4 + 3]; - if (m !== dst) { - dst[12] = m[12]; - dst[13] = m[13]; - dst[14] = m[14]; - dst[15] = m[15]; - } - return dst; -} - -var mat4Impl = { - __proto__: null, - aim: aim, - axisRotate: axisRotate, - axisRotation: axisRotation, - cameraAim: cameraAim, - clone: clone$2, - copy: copy$2, - create: create$2, - determinant: determinant, - equals: equals$2, - equalsApproximately: equalsApproximately$2, - fromMat3: fromMat3, - fromQuat: fromQuat, - frustum: frustum, - frustumReverseZ: frustumReverseZ, - getAxis: getAxis, - getScaling: getScaling, - getTranslation: getTranslation, - identity: identity$1, - inverse: inverse$2, - invert: invert$1, - lookAt: lookAt, - mul: mul$2, - multiply: multiply$2, - negate: negate$1, - ortho: ortho, - perspective: perspective, - perspectiveReverseZ: perspectiveReverseZ, - rotate: rotate, - rotateX: rotateX$1, - rotateY: rotateY$1, - rotateZ: rotateZ$1, - rotation: rotation, - rotationX: rotationX, - rotationY: rotationY, - rotationZ: rotationZ, - scale: scale$2, - scaling: scaling, - set: set$2, - setAxis: setAxis, - setDefaultType: setDefaultType$3, - setTranslation: setTranslation, - translate: translate, - translation: translation, - transpose: transpose, - uniformScale: uniformScale, - uniformScaling: uniformScaling -}; - -/* - * Copyright 2022 Gregg Tavares - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ -/** - * - * Quat4 math functions. - * - * Almost all functions take an optional `dst` argument. If it is not passed in the - * functions will create a new `Quat4`. In other words you can do this - * - * const v = quat4.cross(v1, v2); // Creates a new Quat4 with the cross product of v1 x v2. - * - * or - * - * const v = quat4.create(); - * quat4.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v - * - * The first style is often easier but depending on where it's used it generates garbage where - * as there is almost never allocation with the second style. - * - * It is always safe to pass any vector as the destination. So for example - * - * quat4.cross(v1, v2, v1); // Puts the cross product of v1 x v2 in v1 - * - */ -let QuatType = Float32Array; -/** - * Sets the type this library creates for a Quat4 - * @param ctor - the constructor for the type. Either `Float32Array`, `Float64Array`, or `Array` - * @returns previous constructor for Quat4 - */ -function setDefaultType$2(ctor) { - const oldType = QuatType; - QuatType = ctor; - return oldType; -} -/** - * Creates a quat4; may be called with x, y, z to set initial values. - * @param x - Initial x value. - * @param y - Initial y value. - * @param z - Initial z value. - * @param w - Initial w value. - * @returns the created vector - */ -function create$1(x, y, z, w) { - const dst = new QuatType(4); - if (x !== undefined) { - dst[0] = x; - if (y !== undefined) { - dst[1] = y; - if (z !== undefined) { - dst[2] = z; - if (w !== undefined) { - dst[3] = w; - } - } - } - } - return dst; -} - -/* - * Copyright 2022 Gregg Tavares - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ -/** - * Creates a Quat; may be called with x, y, z to set initial values. (same as create) - * @param x - Initial x value. - * @param y - Initial y value. - * @param z - Initial z value. - * @param z - Initial w value. - * @returns the created vector - */ -const fromValues$1 = create$1; -/** - * Sets the values of a Quat - * Also see {@link quat.create} and {@link quat.copy} - * - * @param x first value - * @param y second value - * @param z third value - * @param w fourth value - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector with its elements set. - */ -function set$1(x, y, z, w, dst) { - dst = dst || new QuatType(4); - dst[0] = x; - dst[1] = y; - dst[2] = z; - dst[3] = w; - return dst; -} -/** - * Sets a quaternion from the given angle and axis, - * then returns it. - * - * @param axis - the axis to rotate around - * @param angleInRadians - the angle - * @param dst - quaternion to hold result. If not passed in a new one is created. - * @returns The quaternion that represents the given axis and angle - **/ -function fromAxisAngle(axis, angleInRadians, dst) { - dst = dst || new QuatType(4); - const halfAngle = angleInRadians * 0.5; - const s = Math.sin(halfAngle); - dst[0] = s * axis[0]; - dst[1] = s * axis[1]; - dst[2] = s * axis[2]; - dst[3] = Math.cos(halfAngle); - return dst; -} -/** - * Gets the rotation axis and angle - * @param q - quaternion to compute from - * @param dst - Vec3 to hold result. If not passed in a new one is created. - * @return angle and axis - */ -function toAxisAngle(q, dst) { - dst = dst || create$4(4); - const angle = Math.acos(q[3]) * 2; - const s = Math.sin(angle * 0.5); - if (s > EPSILON) { - dst[0] = q[0] / s; - dst[1] = q[1] / s; - dst[2] = q[2] / s; - } - else { - dst[0] = 1; - dst[1] = 0; - dst[2] = 0; - } - return { angle, axis: dst }; -} -/** - * Returns the angle in degrees between two rotations a and b. - * @param a - quaternion a - * @param b - quaternion b - * @return angle in radians between the two quaternions - */ -function angle(a, b) { - const d = dot$1(a, b); - return Math.acos(2 * d * d - 1); -} -/** - * Multiplies two quaternions - * - * @param a - the first quaternion - * @param b - the second quaternion - * @param dst - quaternion to hold result. If not passed in a new one is created. - * @returns A quaternion that is the result of a * b - */ -function multiply$1(a, b, dst) { - dst = dst || new QuatType(4); - const ax = a[0]; - const ay = a[1]; - const az = a[2]; - const aw = a[3]; - const bx = b[0]; - const by = b[1]; - const bz = b[2]; - const bw = b[3]; - dst[0] = ax * bw + aw * bx + ay * bz - az * by; - dst[1] = ay * bw + aw * by + az * bx - ax * bz; - dst[2] = az * bw + aw * bz + ax * by - ay * bx; - dst[3] = aw * bw - ax * bx - ay * by - az * bz; - return dst; -} -/** - * Multiplies two quaternions - * - * @param a - the first quaternion - * @param b - the second quaternion - * @param dst - quaternion to hold result. If not passed in a new one is created. - * @returns A quaternion that is the result of a * b - */ -const mul$1 = multiply$1; -/** - * Rotates the given quaternion around the X axis by the given angle. - * @param q - quaternion to rotate - * @param angleInRadians - The angle by which to rotate - * @param dst - quaternion to hold result. If not passed in a new one is created. - * @returns A quaternion that is the result of a * b - */ -function rotateX(q, angleInRadians, dst) { - dst = dst || new QuatType(4); - const halfAngle = angleInRadians * 0.5; - const qx = q[0]; - const qy = q[1]; - const qz = q[2]; - const qw = q[3]; - const bx = Math.sin(halfAngle); - const bw = Math.cos(halfAngle); - dst[0] = qx * bw + qw * bx; - dst[1] = qy * bw + qz * bx; - dst[2] = qz * bw - qy * bx; - dst[3] = qw * bw - qx * bx; - return dst; -} -/** - * Rotates the given quaternion around the Y axis by the given angle. - * @param q - quaternion to rotate - * @param angleInRadians - The angle by which to rotate - * @param dst - quaternion to hold result. If not passed in a new one is created. - * @returns A quaternion that is the result of a * b - */ -function rotateY(q, angleInRadians, dst) { - dst = dst || new QuatType(4); - const halfAngle = angleInRadians * 0.5; - const qx = q[0]; - const qy = q[1]; - const qz = q[2]; - const qw = q[3]; - const by = Math.sin(halfAngle); - const bw = Math.cos(halfAngle); - dst[0] = qx * bw - qz * by; - dst[1] = qy * bw + qw * by; - dst[2] = qz * bw + qx * by; - dst[3] = qw * bw - qy * by; - return dst; -} -/** - * Rotates the given quaternion around the Z axis by the given angle. - * @param q - quaternion to rotate - * @param angleInRadians - The angle by which to rotate - * @param dst - quaternion to hold result. If not passed in a new one is created. - * @returns A quaternion that is the result of a * b - */ -function rotateZ(q, angleInRadians, dst) { - dst = dst || new QuatType(4); - const halfAngle = angleInRadians * 0.5; - const qx = q[0]; - const qy = q[1]; - const qz = q[2]; - const qw = q[3]; - const bz = Math.sin(halfAngle); - const bw = Math.cos(halfAngle); - dst[0] = qx * bw + qy * bz; - dst[1] = qy * bw - qx * bz; - dst[2] = qz * bw + qw * bz; - dst[3] = qw * bw - qz * bz; - return dst; -} -/** - * Spherically linear interpolate between two quaternions - * - * @param a - starting value - * @param b - ending value - * @param t - value where 0 = a and 1 = b - * @param dst - quaternion to hold result. If not passed in a new one is created. - * @returns A quaternion that is the result of a * b - */ -function slerp(a, b, t, dst) { - dst = dst || new QuatType(4); - const ax = a[0]; - const ay = a[1]; - const az = a[2]; - const aw = a[3]; - let bx = b[0]; - let by = b[1]; - let bz = b[2]; - let bw = b[3]; - let cosOmega = ax * bx + ay * by + az * bz + aw * bw; - if (cosOmega < 0) { - cosOmega = -cosOmega; - bx = -bx; - by = -by; - bz = -bz; - bw = -bw; - } - let scale0; - let scale1; - if (1.0 - cosOmega > EPSILON) { - const omega = Math.acos(cosOmega); - const sinOmega = Math.sin(omega); - scale0 = Math.sin((1 - t) * omega) / sinOmega; - scale1 = Math.sin(t * omega) / sinOmega; - } - else { - scale0 = 1.0 - t; - scale1 = t; - } - dst[0] = scale0 * ax + scale1 * bx; - dst[1] = scale0 * ay + scale1 * by; - dst[2] = scale0 * az + scale1 * bz; - dst[3] = scale0 * aw + scale1 * bw; - return dst; -} -/** - * Compute the inverse of a quaternion - * - * @param q - quaternion to compute the inverse of - * @returns A quaternion that is the result of a * b - */ -function inverse$1(q, dst) { - dst = dst || new QuatType(4); - const a0 = q[0]; - const a1 = q[1]; - const a2 = q[2]; - const a3 = q[3]; - const dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3; - const invDot = dot ? 1 / dot : 0; - dst[0] = -a0 * invDot; - dst[1] = -a1 * invDot; - dst[2] = -a2 * invDot; - dst[3] = a3 * invDot; - return dst; -} -/** - * Compute the conjugate of a quaternion - * For quaternions with a magnitude of 1 (a unit quaternion) - * this returns the same as the inverse but is faster to calculate. - * - * @param q - quaternion to compute the conjugate of. - * @param dst - quaternion to hold result. If not passed in a new one is created. - * @returns The conjugate of q - */ -function conjugate(q, dst) { - dst = dst || new QuatType(4); - dst[0] = -q[0]; - dst[1] = -q[1]; - dst[2] = -q[2]; - dst[3] = q[3]; - return dst; -} -/** - * Creates a quaternion from the given rotation matrix. - * - * The created quaternion is not normalized. - * - * @param m - rotation matrix - * @param dst - quaternion to hold result. If not passed in a new one is created. - * @returns the result - */ -function fromMat(m, dst) { - dst = dst || new QuatType(4); - /* - 0 1 2 - 3 4 5 - 6 7 8 - - 0 1 2 - 4 5 6 - 8 9 10 - */ - // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes - // article "Quaternion Calculus and Fast Animation". - const trace = m[0] + m[5] + m[10]; - if (trace > 0.0) { - // |w| > 1/2, may as well choose w > 1/2 - const root = Math.sqrt(trace + 1); // 2w - dst[3] = 0.5 * root; - const invRoot = 0.5 / root; // 1/(4w) - dst[0] = (m[6] - m[9]) * invRoot; - dst[1] = (m[8] - m[2]) * invRoot; - dst[2] = (m[1] - m[4]) * invRoot; - } - else { - // |w| <= 1/2 - let i = 0; - if (m[5] > m[0]) { - i = 1; - } - if (m[10] > m[i * 4 + i]) { - i = 2; - } - const j = (i + 1) % 3; - const k = (i + 2) % 3; - const root = Math.sqrt(m[i * 4 + i] - m[j * 4 + j] - m[k * 4 + k] + 1.0); - dst[i] = 0.5 * root; - const invRoot = 0.5 / root; - dst[3] = (m[j * 4 + k] - m[k * 4 + j]) * invRoot; - dst[j] = (m[j * 4 + i] + m[i * 4 + j]) * invRoot; - dst[k] = (m[k * 4 + i] + m[i * 4 + k]) * invRoot; - } - return dst; -} -/** - * Creates a quaternion from the given euler angle x, y, z using the provided intrinsic order for the conversion. - * - * @param xAngleInRadians - angle to rotate around X axis in radians. - * @param yAngleInRadians - angle to rotate around Y axis in radians. - * @param zAngleInRadians - angle to rotate around Z axis in radians. - * @param order - order to apply euler angles - * @param dst - quaternion to hold result. If not passed in a new one is created. - * @returns A quaternion representing the same rotation as the euler angles applied in the given order - */ -function fromEuler(xAngleInRadians, yAngleInRadians, zAngleInRadians, order, dst) { - dst = dst || new QuatType(4); - const xHalfAngle = xAngleInRadians * 0.5; - const yHalfAngle = yAngleInRadians * 0.5; - const zHalfAngle = zAngleInRadians * 0.5; - const sx = Math.sin(xHalfAngle); - const cx = Math.cos(xHalfAngle); - const sy = Math.sin(yHalfAngle); - const cy = Math.cos(yHalfAngle); - const sz = Math.sin(zHalfAngle); - const cz = Math.cos(zHalfAngle); - switch (order) { - case 'xyz': - dst[0] = sx * cy * cz + cx * sy * sz; - dst[1] = cx * sy * cz - sx * cy * sz; - dst[2] = cx * cy * sz + sx * sy * cz; - dst[3] = cx * cy * cz - sx * sy * sz; - break; - case 'xzy': - dst[0] = sx * cy * cz - cx * sy * sz; - dst[1] = cx * sy * cz - sx * cy * sz; - dst[2] = cx * cy * sz + sx * sy * cz; - dst[3] = cx * cy * cz + sx * sy * sz; - break; - case 'yxz': - dst[0] = sx * cy * cz + cx * sy * sz; - dst[1] = cx * sy * cz - sx * cy * sz; - dst[2] = cx * cy * sz - sx * sy * cz; - dst[3] = cx * cy * cz + sx * sy * sz; - break; - case 'yzx': - dst[0] = sx * cy * cz + cx * sy * sz; - dst[1] = cx * sy * cz + sx * cy * sz; - dst[2] = cx * cy * sz - sx * sy * cz; - dst[3] = cx * cy * cz - sx * sy * sz; - break; - case 'zxy': - dst[0] = sx * cy * cz - cx * sy * sz; - dst[1] = cx * sy * cz + sx * cy * sz; - dst[2] = cx * cy * sz + sx * sy * cz; - dst[3] = cx * cy * cz - sx * sy * sz; - break; - case 'zyx': - dst[0] = sx * cy * cz - cx * sy * sz; - dst[1] = cx * sy * cz + sx * cy * sz; - dst[2] = cx * cy * sz - sx * sy * cz; - dst[3] = cx * cy * cz + sx * sy * sz; - break; - default: - throw new Error(`Unknown rotation order: ${order}`); - } - return dst; -} -/** - * Copies a quaternion. (same as {@link quat.clone}) - * Also see {@link quat.create} and {@link quat.set} - * @param q - The quaternion. - * @param dst - quaternion to hold result. If not passed in a new one is created. - * @returns A quaternion that is a copy of q - */ -function copy$1(q, dst) { - dst = dst || new QuatType(4); - dst[0] = q[0]; - dst[1] = q[1]; - dst[2] = q[2]; - dst[3] = q[3]; - return dst; -} -/** - * Clones a quaternion. (same as {@link quat.copy}) - * Also see {@link quat.create} and {@link quat.set} - * @param q - The quaternion. - * @param dst - quaternion to hold result. If not passed in a new one is created. - * @returns A copy of q. - */ -const clone$1 = copy$1; -/** - * Adds two quaternions; assumes a and b have the same dimension. - * @param a - Operand quaternion. - * @param b - Operand quaternion. - * @param dst - quaternion to hold result. If not passed in a new one is created. - * @returns A quaternion that is the sum of a and b. - */ -function add$1(a, b, dst) { - dst = dst || new QuatType(4); - dst[0] = a[0] + b[0]; - dst[1] = a[1] + b[1]; - dst[2] = a[2] + b[2]; - dst[3] = a[3] + b[3]; - return dst; -} -/** - * Subtracts two quaternions. - * @param a - Operand quaternion. - * @param b - Operand quaternion. - * @param dst - quaternion to hold result. If not passed in a new one is created. - * @returns A quaternion that is the difference of a and b. - */ -function subtract$1(a, b, dst) { - dst = dst || new QuatType(4); - dst[0] = a[0] - b[0]; - dst[1] = a[1] - b[1]; - dst[2] = a[2] - b[2]; - dst[3] = a[3] - b[3]; - return dst; -} -/** - * Subtracts two quaternions. - * @param a - Operand quaternion. - * @param b - Operand quaternion. - * @param dst - quaternion to hold result. If not passed in a new one is created. - * @returns A quaternion that is the difference of a and b. - */ -const sub$1 = subtract$1; -/** - * Multiplies a quaternion by a scalar. - * @param v - The quaternion. - * @param k - The scalar. - * @param dst - quaternion to hold result. If not passed in a new one is created. - * @returns The scaled quaternion. - */ -function mulScalar$1(v, k, dst) { - dst = dst || new QuatType(4); - dst[0] = v[0] * k; - dst[1] = v[1] * k; - dst[2] = v[2] * k; - dst[3] = v[3] * k; - return dst; -} -/** - * Multiplies a quaternion by a scalar. (same as mulScalar) - * @param v - The quaternion. - * @param k - The scalar. - * @param dst - quaternion to hold result. If not passed in a new one is created. - * @returns The scaled quaternion. - */ -const scale$1 = mulScalar$1; -/** - * Divides a vector by a scalar. - * @param v - The vector. - * @param k - The scalar. - * @param dst - quaternion to hold result. If not passed in a new one is created. - * @returns The scaled quaternion. - */ -function divScalar$1(v, k, dst) { - dst = dst || new QuatType(4); - dst[0] = v[0] / k; - dst[1] = v[1] / k; - dst[2] = v[2] / k; - dst[3] = v[3] / k; - return dst; -} -/** - * Computes the dot product of two quaternions - * @param a - Operand quaternion. - * @param b - Operand quaternion. - * @returns dot product - */ -function dot$1(a, b) { - return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]) + (a[3] * b[3]); -} -/** - * Performs linear interpolation on two quaternions. - * Given quaternions a and b and interpolation coefficient t, returns - * a + t * (b - a). - * @param a - Operand quaternion. - * @param b - Operand quaternion. - * @param t - Interpolation coefficient. - * @param dst - quaternion to hold result. If not passed in a new one is created. - * @returns The linear interpolated result. - */ -function lerp$1(a, b, t, dst) { - dst = dst || new QuatType(4); - dst[0] = a[0] + t * (b[0] - a[0]); - dst[1] = a[1] + t * (b[1] - a[1]); - dst[2] = a[2] + t * (b[2] - a[2]); - dst[3] = a[3] + t * (b[3] - a[3]); - return dst; -} -/** - * Computes the length of quaternion - * @param v - quaternion. - * @returns length of quaternion. - */ -function length$1(v) { - const v0 = v[0]; - const v1 = v[1]; - const v2 = v[2]; - const v3 = v[3]; - return Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3); -} -/** - * Computes the length of quaternion (same as length) - * @param v - quaternion. - * @returns length of quaternion. - */ -const len$1 = length$1; -/** - * Computes the square of the length of quaternion - * @param v - quaternion. - * @returns square of the length of quaternion. - */ -function lengthSq$1(v) { - const v0 = v[0]; - const v1 = v[1]; - const v2 = v[2]; - const v3 = v[3]; - return v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3; -} -/** - * Computes the square of the length of quaternion (same as lengthSq) - * @param v - quaternion. - * @returns square of the length of quaternion. - */ -const lenSq$1 = lengthSq$1; -/** - * Divides a quaternion by its Euclidean length and returns the quotient. - * @param v - The quaternion. - * @param dst - quaternion to hold result. If not passed in a new one is created. - * @returns The normalized quaternion. - */ -function normalize$1(v, dst) { - dst = dst || new QuatType(4); - const v0 = v[0]; - const v1 = v[1]; - const v2 = v[2]; - const v3 = v[3]; - const len = Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3); - if (len > 0.00001) { - dst[0] = v0 / len; - dst[1] = v1 / len; - dst[2] = v2 / len; - dst[3] = v3 / len; - } - else { - dst[0] = 0; - dst[1] = 0; - dst[2] = 0; - dst[3] = 0; - } - return dst; -} -/** - * Check if 2 quaternions are approximately equal - * @param a - Operand quaternion. - * @param b - Operand quaternion. - * @returns true if quaternions are approximately equal - */ -function equalsApproximately$1(a, b) { - return Math.abs(a[0] - b[0]) < EPSILON && - Math.abs(a[1] - b[1]) < EPSILON && - Math.abs(a[2] - b[2]) < EPSILON && - Math.abs(a[3] - b[3]) < EPSILON; -} -/** - * Check if 2 quaternions are exactly equal - * @param a - Operand quaternion. - * @param b - Operand quaternion. - * @returns true if quaternions are exactly equal - */ -function equals$1(a, b) { - return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3]; -} -/** - * Creates an identity quaternion - * @param dst - quaternion to hold result. If not passed in a new one is created. - * @returns an identity quaternion - */ -function identity(dst) { - dst = dst || new QuatType(4); - dst[0] = 0; - dst[1] = 0; - dst[2] = 0; - dst[3] = 1; - return dst; -} -let tempVec3; -let xUnitVec3; -let yUnitVec3; -/** - * Computes a quaternion to represent the shortest rotation from one vector to another. - * - * @param aUnit - the start vector - * @param bUnit - the end vector - * @param dst - quaternion to hold result. If not passed in a new one is created. - * @returns the result - */ -function rotationTo(aUnit, bUnit, dst) { - dst = dst || new QuatType(4); - tempVec3 = tempVec3 || create$4(); - xUnitVec3 = xUnitVec3 || create$4(1, 0, 0); - yUnitVec3 = yUnitVec3 || create$4(0, 1, 0); - const dot = dot$2(aUnit, bUnit); - if (dot < -0.999999) { - cross(xUnitVec3, aUnit, tempVec3); - if (len$2(tempVec3) < 0.000001) { - cross(yUnitVec3, aUnit, tempVec3); - } - normalize$2(tempVec3, tempVec3); - fromAxisAngle(tempVec3, Math.PI, dst); - return dst; - } - else if (dot > 0.999999) { - dst[0] = 0; - dst[1] = 0; - dst[2] = 0; - dst[3] = 1; - return dst; - } - else { - cross(aUnit, bUnit, tempVec3); - dst[0] = tempVec3[0]; - dst[1] = tempVec3[1]; - dst[2] = tempVec3[2]; - dst[3] = 1 + dot; - return normalize$1(dst, dst); - } -} -let tempQuat1; -let tempQuat2; -/** - * Performs a spherical linear interpolation with two control points - * - * @param a - the first quaternion - * @param b - the second quaternion - * @param c - the third quaternion - * @param d - the fourth quaternion - * @param t - Interpolation coefficient 0 to 1 - * @returns result - */ -function sqlerp(a, b, c, d, t, dst) { - dst = dst || new QuatType(4); - tempQuat1 = tempQuat1 || new QuatType(4); - tempQuat2 = tempQuat2 || new QuatType(4); - slerp(a, d, t, tempQuat1); - slerp(b, c, t, tempQuat2); - slerp(tempQuat1, tempQuat2, 2 * t * (1 - t), dst); - return dst; -} - -var quatImpl = { - __proto__: null, - add: add$1, - angle: angle, - clone: clone$1, - conjugate: conjugate, - copy: copy$1, - create: create$1, - divScalar: divScalar$1, - dot: dot$1, - equals: equals$1, - equalsApproximately: equalsApproximately$1, - fromAxisAngle: fromAxisAngle, - fromEuler: fromEuler, - fromMat: fromMat, - fromValues: fromValues$1, - identity: identity, - inverse: inverse$1, - len: len$1, - lenSq: lenSq$1, - length: length$1, - lengthSq: lengthSq$1, - lerp: lerp$1, - mul: mul$1, - mulScalar: mulScalar$1, - multiply: multiply$1, - normalize: normalize$1, - rotateX: rotateX, - rotateY: rotateY, - rotateZ: rotateZ, - rotationTo: rotationTo, - scale: scale$1, - set: set$1, - setDefaultType: setDefaultType$2, - slerp: slerp, - sqlerp: sqlerp, - sub: sub$1, - subtract: subtract$1, - toAxisAngle: toAxisAngle -}; - -/* - * Copyright 2022 Gregg Tavares - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ -/** - * - * Vec4 math functions. - * - * Almost all functions take an optional `dst` argument. If it is not passed in the - * functions will create a new `Vec4`. In other words you can do this - * - * const v = vec4.cross(v1, v2); // Creates a new Vec4 with the cross product of v1 x v2. - * - * or - * - * const v = vec4.create(); - * vec4.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v - * - * The first style is often easier but depending on where it's used it generates garbage where - * as there is almost never allocation with the second style. - * - * It is always safe to pass any vector as the destination. So for example - * - * vec4.cross(v1, v2, v1); // Puts the cross product of v1 x v2 in v1 - * - */ -let VecType = Float32Array; -/** - * Sets the type this library creates for a Vec4 - * @param ctor - the constructor for the type. Either `Float32Array`, `Float64Array`, or `Array` - * @returns previous constructor for Vec4 - */ -function setDefaultType$1(ctor) { - const oldType = VecType; - VecType = ctor; - return oldType; -} -/** - * Creates a vec4; may be called with x, y, z to set initial values. - * @param x - Initial x value. - * @param y - Initial y value. - * @param z - Initial z value. - * @param w - Initial w value. - * @returns the created vector - */ -function create(x, y, z, w) { - const dst = new VecType(4); - if (x !== undefined) { - dst[0] = x; - if (y !== undefined) { - dst[1] = y; - if (z !== undefined) { - dst[2] = z; - if (w !== undefined) { - dst[3] = w; - } - } - } - } - return dst; -} - -/* - * Copyright 2022 Gregg Tavares - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ -/** - * Creates a vec4; may be called with x, y, z to set initial values. (same as create) - * @param x - Initial x value. - * @param y - Initial y value. - * @param z - Initial z value. - * @param z - Initial w value. - * @returns the created vector - */ -const fromValues = create; -/** - * Sets the values of a Vec4 - * Also see {@link vec4.create} and {@link vec4.copy} - * - * @param x first value - * @param y second value - * @param z third value - * @param w fourth value - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector with its elements set. - */ -function set(x, y, z, w, dst) { - dst = dst || new VecType(4); - dst[0] = x; - dst[1] = y; - dst[2] = z; - dst[3] = w; - return dst; -} -/** - * Applies Math.ceil to each element of vector - * @param v - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector that is the ceil of each element of v. - */ -function ceil(v, dst) { - dst = dst || new VecType(4); - dst[0] = Math.ceil(v[0]); - dst[1] = Math.ceil(v[1]); - dst[2] = Math.ceil(v[2]); - dst[3] = Math.ceil(v[3]); - return dst; -} -/** - * Applies Math.floor to each element of vector - * @param v - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector that is the floor of each element of v. - */ -function floor(v, dst) { - dst = dst || new VecType(4); - dst[0] = Math.floor(v[0]); - dst[1] = Math.floor(v[1]); - dst[2] = Math.floor(v[2]); - dst[3] = Math.floor(v[3]); - return dst; -} -/** - * Applies Math.round to each element of vector - * @param v - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector that is the round of each element of v. - */ -function round(v, dst) { - dst = dst || new VecType(4); - dst[0] = Math.round(v[0]); - dst[1] = Math.round(v[1]); - dst[2] = Math.round(v[2]); - dst[3] = Math.round(v[3]); - return dst; -} -/** - * Clamp each element of vector between min and max - * @param v - Operand vector. - * @param max - Min value, default 0 - * @param min - Max value, default 1 - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector that the clamped value of each element of v. - */ -function clamp(v, min = 0, max = 1, dst) { - dst = dst || new VecType(4); - dst[0] = Math.min(max, Math.max(min, v[0])); - dst[1] = Math.min(max, Math.max(min, v[1])); - dst[2] = Math.min(max, Math.max(min, v[2])); - dst[3] = Math.min(max, Math.max(min, v[3])); - return dst; -} -/** - * Adds two vectors; assumes a and b have the same dimension. - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector that is the sum of a and b. - */ -function add(a, b, dst) { - dst = dst || new VecType(4); - dst[0] = a[0] + b[0]; - dst[1] = a[1] + b[1]; - dst[2] = a[2] + b[2]; - dst[3] = a[3] + b[3]; - return dst; -} -/** - * Adds two vectors, scaling the 2nd; assumes a and b have the same dimension. - * @param a - Operand vector. - * @param b - Operand vector. - * @param scale - Amount to scale b - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector that is the sum of a + b * scale. - */ -function addScaled(a, b, scale, dst) { - dst = dst || new VecType(4); - dst[0] = a[0] + b[0] * scale; - dst[1] = a[1] + b[1] * scale; - dst[2] = a[2] + b[2] * scale; - dst[3] = a[3] + b[3] * scale; - return dst; -} -/** - * Subtracts two vectors. - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector that is the difference of a and b. - */ -function subtract(a, b, dst) { - dst = dst || new VecType(4); - dst[0] = a[0] - b[0]; - dst[1] = a[1] - b[1]; - dst[2] = a[2] - b[2]; - dst[3] = a[3] - b[3]; - return dst; -} -/** - * Subtracts two vectors. - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A vector that is the difference of a and b. - */ -const sub = subtract; -/** - * Check if 2 vectors are approximately equal - * @param a - Operand vector. - * @param b - Operand vector. - * @returns true if vectors are approximately equal - */ -function equalsApproximately(a, b) { - return Math.abs(a[0] - b[0]) < EPSILON && - Math.abs(a[1] - b[1]) < EPSILON && - Math.abs(a[2] - b[2]) < EPSILON && - Math.abs(a[3] - b[3]) < EPSILON; -} -/** - * Check if 2 vectors are exactly equal - * @param a - Operand vector. - * @param b - Operand vector. - * @returns true if vectors are exactly equal - */ -function equals(a, b) { - return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3]; -} -/** - * Performs linear interpolation on two vectors. - * Given vectors a and b and interpolation coefficient t, returns - * a + t * (b - a). - * @param a - Operand vector. - * @param b - Operand vector. - * @param t - Interpolation coefficient. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The linear interpolated result. - */ -function lerp(a, b, t, dst) { - dst = dst || new VecType(4); - dst[0] = a[0] + t * (b[0] - a[0]); - dst[1] = a[1] + t * (b[1] - a[1]); - dst[2] = a[2] + t * (b[2] - a[2]); - dst[3] = a[3] + t * (b[3] - a[3]); - return dst; -} -/** - * Performs linear interpolation on two vectors. - * Given vectors a and b and interpolation coefficient vector t, returns - * a + t * (b - a). - * @param a - Operand vector. - * @param b - Operand vector. - * @param t - Interpolation coefficients vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns the linear interpolated result. - */ -function lerpV(a, b, t, dst) { - dst = dst || new VecType(4); - dst[0] = a[0] + t[0] * (b[0] - a[0]); - dst[1] = a[1] + t[1] * (b[1] - a[1]); - dst[2] = a[2] + t[2] * (b[2] - a[2]); - dst[3] = a[3] + t[3] * (b[3] - a[3]); - return dst; -} -/** - * Return max values of two vectors. - * Given vectors a and b returns - * [max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])]. - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The max components vector. - */ -function max(a, b, dst) { - dst = dst || new VecType(4); - dst[0] = Math.max(a[0], b[0]); - dst[1] = Math.max(a[1], b[1]); - dst[2] = Math.max(a[2], b[2]); - dst[3] = Math.max(a[3], b[3]); - return dst; -} -/** - * Return min values of two vectors. - * Given vectors a and b returns - * [min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])]. - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The min components vector. - */ -function min(a, b, dst) { - dst = dst || new VecType(4); - dst[0] = Math.min(a[0], b[0]); - dst[1] = Math.min(a[1], b[1]); - dst[2] = Math.min(a[2], b[2]); - dst[3] = Math.min(a[3], b[3]); - return dst; -} -/** - * Multiplies a vector by a scalar. - * @param v - The vector. - * @param k - The scalar. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The scaled vector. - */ -function mulScalar(v, k, dst) { - dst = dst || new VecType(4); - dst[0] = v[0] * k; - dst[1] = v[1] * k; - dst[2] = v[2] * k; - dst[3] = v[3] * k; - return dst; -} -/** - * Multiplies a vector by a scalar. (same as mulScalar) - * @param v - The vector. - * @param k - The scalar. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The scaled vector. - */ -const scale = mulScalar; -/** - * Divides a vector by a scalar. - * @param v - The vector. - * @param k - The scalar. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The scaled vector. - */ -function divScalar(v, k, dst) { - dst = dst || new VecType(4); - dst[0] = v[0] / k; - dst[1] = v[1] / k; - dst[2] = v[2] / k; - dst[3] = v[3] / k; - return dst; -} -/** - * Inverse a vector. - * @param v - The vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The inverted vector. - */ -function inverse(v, dst) { - dst = dst || new VecType(4); - dst[0] = 1 / v[0]; - dst[1] = 1 / v[1]; - dst[2] = 1 / v[2]; - dst[3] = 1 / v[3]; - return dst; -} -/** - * Invert a vector. (same as inverse) - * @param v - The vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The inverted vector. - */ -const invert = inverse; -/** - * Computes the dot product of two vectors - * @param a - Operand vector. - * @param b - Operand vector. - * @returns dot product - */ -function dot(a, b) { - return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]) + (a[3] * b[3]); -} -/** - * Computes the length of vector - * @param v - vector. - * @returns length of vector. - */ -function length(v) { - const v0 = v[0]; - const v1 = v[1]; - const v2 = v[2]; - const v3 = v[3]; - return Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3); -} -/** - * Computes the length of vector (same as length) - * @param v - vector. - * @returns length of vector. - */ -const len = length; -/** - * Computes the square of the length of vector - * @param v - vector. - * @returns square of the length of vector. - */ -function lengthSq(v) { - const v0 = v[0]; - const v1 = v[1]; - const v2 = v[2]; - const v3 = v[3]; - return v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3; -} -/** - * Computes the square of the length of vector (same as lengthSq) - * @param v - vector. - * @returns square of the length of vector. - */ -const lenSq = lengthSq; -/** - * Computes the distance between 2 points - * @param a - vector. - * @param b - vector. - * @returns distance between a and b - */ -function distance(a, b) { - const dx = a[0] - b[0]; - const dy = a[1] - b[1]; - const dz = a[2] - b[2]; - const dw = a[3] - b[3]; - return Math.sqrt(dx * dx + dy * dy + dz * dz + dw * dw); -} -/** - * Computes the distance between 2 points (same as distance) - * @param a - vector. - * @param b - vector. - * @returns distance between a and b - */ -const dist = distance; -/** - * Computes the square of the distance between 2 points - * @param a - vector. - * @param b - vector. - * @returns square of the distance between a and b - */ -function distanceSq(a, b) { - const dx = a[0] - b[0]; - const dy = a[1] - b[1]; - const dz = a[2] - b[2]; - const dw = a[3] - b[3]; - return dx * dx + dy * dy + dz * dz + dw * dw; -} -/** - * Computes the square of the distance between 2 points (same as distanceSq) - * @param a - vector. - * @param b - vector. - * @returns square of the distance between a and b - */ -const distSq = distanceSq; -/** - * Divides a vector by its Euclidean length and returns the quotient. - * @param v - The vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The normalized vector. - */ -function normalize(v, dst) { - dst = dst || new VecType(4); - const v0 = v[0]; - const v1 = v[1]; - const v2 = v[2]; - const v3 = v[3]; - const len = Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3); - if (len > 0.00001) { - dst[0] = v0 / len; - dst[1] = v1 / len; - dst[2] = v2 / len; - dst[3] = v3 / len; - } - else { - dst[0] = 0; - dst[1] = 0; - dst[2] = 0; - dst[3] = 0; - } - return dst; -} -/** - * Negates a vector. - * @param v - The vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns -v. - */ -function negate(v, dst) { - dst = dst || new VecType(4); - dst[0] = -v[0]; - dst[1] = -v[1]; - dst[2] = -v[2]; - dst[3] = -v[3]; - return dst; -} -/** - * Copies a vector. (same as {@link vec4.clone}) - * Also see {@link vec4.create} and {@link vec4.set} - * @param v - The vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A copy of v. - */ -function copy(v, dst) { - dst = dst || new VecType(4); - dst[0] = v[0]; - dst[1] = v[1]; - dst[2] = v[2]; - dst[3] = v[3]; - return dst; -} -/** - * Clones a vector. (same as {@link vec4.copy}) - * Also see {@link vec4.create} and {@link vec4.set} - * @param v - The vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns A copy of v. - */ -const clone = copy; -/** - * Multiplies a vector by another vector (component-wise); assumes a and - * b have the same length. - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The vector of products of entries of a and b. - */ -function multiply(a, b, dst) { - dst = dst || new VecType(4); - dst[0] = a[0] * b[0]; - dst[1] = a[1] * b[1]; - dst[2] = a[2] * b[2]; - dst[3] = a[3] * b[3]; - return dst; -} -/** - * Multiplies a vector by another vector (component-wise); assumes a and - * b have the same length. (same as mul) - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The vector of products of entries of a and b. - */ -const mul = multiply; -/** - * Divides a vector by another vector (component-wise); assumes a and - * b have the same length. - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The vector of quotients of entries of a and b. - */ -function divide(a, b, dst) { - dst = dst || new VecType(4); - dst[0] = a[0] / b[0]; - dst[1] = a[1] / b[1]; - dst[2] = a[2] / b[2]; - dst[3] = a[3] / b[3]; - return dst; -} -/** - * Divides a vector by another vector (component-wise); assumes a and - * b have the same length. (same as divide) - * @param a - Operand vector. - * @param b - Operand vector. - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The vector of quotients of entries of a and b. - */ -const div = divide; -/** - * Zero's a vector - * @param dst - vector to hold result. If not passed in a new one is created. - * @returns The zeroed vector. - */ -function zero(dst) { - dst = dst || new VecType(4); - dst[0] = 0; - dst[1] = 0; - dst[2] = 0; - dst[3] = 0; - return dst; -} -/** - * transform vec4 by 4x4 matrix - * @param v - the vector - * @param m - The matrix. - * @param dst - optional vec4 to store result. If not passed a new one is created. - * @returns the transformed vector - */ -function transformMat4(v, m, dst) { - dst = dst || new VecType(4); - const x = v[0]; - const y = v[1]; - const z = v[2]; - const w = v[3]; - dst[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w; - dst[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w; - dst[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w; - dst[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w; - return dst; -} -/** - * Treat a 4D vector as a direction and set it's length - * - * @param a The vec4 to lengthen - * @param len The length of the resulting vector - * @returns The lengthened vector - */ -function setLength(a, len, dst) { - dst = dst || new VecType(4); - normalize(a, dst); - return mulScalar(dst, len, dst); -} -/** - * Ensure a vector is not longer than a max length - * - * @param a The vec4 to limit - * @param maxLen The longest length of the resulting vector - * @returns The vector, shortened to maxLen if it's too long - */ -function truncate(a, maxLen, dst) { - dst = dst || new VecType(4); - if (length(a) > maxLen) { - return setLength(a, maxLen, dst); - } - return copy(a, dst); -} -/** - * Return the vector exactly between 2 endpoint vectors - * - * @param a Endpoint 1 - * @param b Endpoint 2 - * @returns The vector exactly residing between endpoints 1 and 2 - */ -function midpoint(a, b, dst) { - dst = dst || new VecType(4); - return lerp(a, b, 0.5, dst); -} - -var vec4Impl = { - __proto__: null, - add: add, - addScaled: addScaled, - ceil: ceil, - clamp: clamp, - clone: clone, - copy: copy, - create: create, - dist: dist, - distSq: distSq, - distance: distance, - distanceSq: distanceSq, - div: div, - divScalar: divScalar, - divide: divide, - dot: dot, - equals: equals, - equalsApproximately: equalsApproximately, - floor: floor, - fromValues: fromValues, - inverse: inverse, - invert: invert, - len: len, - lenSq: lenSq, - length: length, - lengthSq: lengthSq, - lerp: lerp, - lerpV: lerpV, - max: max, - midpoint: midpoint, - min: min, - mul: mul, - mulScalar: mulScalar, - multiply: multiply, - negate: negate, - normalize: normalize, - round: round, - scale: scale, - set: set, - setDefaultType: setDefaultType$1, - setLength: setLength, - sub: sub, - subtract: subtract, - transformMat4: transformMat4, - truncate: truncate, - zero: zero -}; - -/** - * Sets the type this library creates for all types - * - * example: - * - * ``` - * setDefaultType(Float64Array); - * ``` - * - * @param ctor - the constructor for the type. Either `Float32Array`, `Float64Array`, or `Array` - */ -function setDefaultType(ctor) { - setDefaultType$4(ctor); - setDefaultType$3(ctor); - setDefaultType$2(ctor); - setDefaultType$6(ctor); - setDefaultType$5(ctor); - setDefaultType$1(ctor); -} - -export { mat3Impl as mat3, mat4Impl as mat4, quatImpl as quat, setDefaultType, utils, vec2Impl as vec2, vec3Impl as vec3, vec4Impl as vec4 }; -//# sourceMappingURL=wgpu-matrix.module.js.map diff --git a/dist/2.x/wgpu-matrix.module.js.map b/dist/2.x/wgpu-matrix.module.js.map deleted file mode 100644 index ead4068..0000000 --- a/dist/2.x/wgpu-matrix.module.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"wgpu-matrix.module.js","sources":["../../../src/utils.ts","../../../src/vec2.ts","../../../src/vec3.ts","../../../src/vec2-impl.ts","../../../src/mat3-impl.ts","../../../src/vec3-impl.ts","../../../src/mat4-impl.ts","../../../src/quat.ts","../../../src/quat-impl.ts","../../../src/vec4.ts","../../../src/vec4-impl.ts","../../../src/wgpu-matrix.ts"],"sourcesContent":["/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\n\nexport let EPSILON = 0.000001;\n\n/**\n * Set the value for EPSILON for various checks\n * @param v - Value to use for EPSILON.\n * @returns previous value of EPSILON;\n */\nexport function setEpsilon(v: number): number {\n const old = EPSILON;\n EPSILON = v;\n return old;\n}\n\n/**\n * Convert degrees to radians\n * @param degrees - Angle in degrees\n * @returns angle converted to radians\n */\nexport function degToRad(degrees: number): number {\n return degrees * Math.PI / 180;\n}\n\n/**\n * Convert radians to degrees\n * @param radians - Angle in radians\n * @returns angle converted to degrees\n */\nexport function radToDeg(radians: number): number {\n return radians * 180 / Math.PI;\n}\n\n/**\n * Lerps between a and b via t\n * @param a - starting value\n * @param b - ending value\n * @param t - value where 0 = a and 1 = b\n * @returns a + (b - a) * t\n */\nexport function lerp(a: number, b: number, t: number): number {\n return a + (b - a) * t;\n}\n\n/**\n * Compute the opposite of lerp. Given a and b and a value between\n * a and b returns a value between 0 and 1. 0 if a, 1 if b.\n * Note: no clamping is done.\n * @param a - start value\n * @param b - end value\n * @param v - value between a and b\n * @returns (v - a) / (b - a)\n */\nexport function inverseLerp(a: number, b: number, v: number): number {\n const d = b - a;\n return (Math.abs(b - a) < EPSILON)\n ? a\n : (v - a) / d;\n}\n\n/**\n * Compute the euclidean modulo\n *\n * ```\n * // table for n / 3\n * -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5 <- n\n * ------------------------------------\n * -2 -1 -0 -2 -1 0, 1, 2, 0, 1, 2 <- n % 3\n * 1 2 0 1 2 0, 1, 2, 0, 1, 2 <- euclideanModule(n, 3)\n * ```\n *\n * @param n - dividend\n * @param m - divisor\n * @returns the euclidean modulo of n / m\n */\nexport function euclideanModulo(n: number, m: number) {\n return ((n % m) + m) % m;\n}","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\n\n/**\n * A JavaScript array with 2 values, Float32Array with 2 values, or a Float64Array with 2 values.\n * When created by the library will create the default type which is `Float32Array`\n * but can be set by calling {@link vec2.setDefaultType}.\n */\nexport type Vec2 = number[] | Float32Array | Float64Array;\n\n/**\n *\n * Vec2 math functions.\n *\n * Almost all functions take an optional `dst` argument. If it is not passed in the\n * functions will create a new Vec2. In other words you can do this\n *\n * const v = vec2.cross(v1, v2); // Creates a new Vec2 with the cross product of v1 x v2.\n *\n * or\n *\n * const v = vec2.create();\n * vec2.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v\n *\n * The first style is often easier but depending on where it's used it generates garbage where\n * as there is almost never allocation with the second style.\n *\n * It is always safe to pass any vector as the destination. So for example\n *\n * vec2.cross(v1, v2, v1); // Puts the cross product of v1 x v2 in v1\n *\n */\n\nexport let VecType: new (n: number) => Vec2 = Float32Array;\n\n/**\n * Sets the type this library creates for a Vec2\n * @param ctor - the constructor for the type. Either `Float32Array`, `Float64Array`, or `Array`\n * @returns previous constructor for Vec2\n */\nexport function setDefaultType(ctor: new (n: number) => Vec2) {\n const oldType = VecType;\n VecType = ctor;\n return oldType;\n}\n\n/**\n * Creates a Vec2; may be called with x, y, z to set initial values.\n *\n * Note: Since passing in a raw JavaScript array\n * is valid in all circumstances, if you want to\n * force a JavaScript array into a Vec2's specified type\n * it would be faster to use\n *\n * ```\n * const v = vec2.clone(someJSArray);\n * ```\n *\n * Note: a consequence of the implementation is if your Vec2Type = `Array`\n * instead of `Float32Array` or `Float64Array` then any values you\n * don't pass in will be undefined. Usually this is not an issue since\n * (a) using `Array` is rare and (b) using `vec2.create` is usually used\n * to create a Vec2 to be filled out as in\n *\n * ```\n * const sum = vec2.create();\n * vec2.add(v1, v2, sum);\n * ```\n *\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @returns the created vector\n */\nexport function create(x = 0, y = 0): Vec2 {\n const dst = new VecType(2);\n if (x !== undefined) {\n dst[0] = x;\n if (y !== undefined) {\n dst[1] = y;\n }\n }\n return dst;\n}\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\n\n/**\n * A JavaScript array with 3 values, Float32Array with 3 values, or a Float64Array with 3 values.\n * When created by the library will create the default type which is `Float32Array`\n * but can be set by calling {@link vec3.setDefaultType}.\n */\nexport type Vec3 = number[] | Float32Array | Float64Array;\n\n/**\n *\n * Vec3 math functions.\n *\n * Almost all functions take an optional `dst` argument. If it is not passed in the\n * functions will create a new `Vec3`. In other words you can do this\n *\n * const v = vec3.cross(v1, v2); // Creates a new Vec3 with the cross product of v1 x v2.\n *\n * or\n *\n * const v = vec3.create();\n * vec3.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v\n *\n * The first style is often easier but depending on where it's used it generates garbage where\n * as there is almost never allocation with the second style.\n *\n * It is always safe to pass any vector as the destination. So for example\n *\n * vec3.cross(v1, v2, v1); // Puts the cross product of v1 x v2 in v1\n *\n */\n\nexport let VecType: new (n: number) => Vec3 = Float32Array;\n\n/**\n * Sets the type this library creates for a Vec3\n * @param ctor - the constructor for the type. Either `Float32Array`, `Float64Array`, or `Array`\n * @returns previous constructor for Vec3\n */\nexport function setDefaultType(ctor: new (n: number) => Vec3) {\n const oldType = VecType;\n VecType = ctor;\n return oldType;\n}\n\n/**\n * Creates a vec3; may be called with x, y, z to set initial values.\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @returns the created vector\n */\nexport function create(x?: number, y?: number, z?: number): Vec3 {\n const dst = new VecType(3);\n if (x !== undefined) {\n dst[0] = x;\n if (y !== undefined) {\n dst[1] = y;\n if (z !== undefined) {\n dst[2] = z;\n }\n }\n }\n return dst;\n}","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport * as utils from './utils.js';\nimport { Mat3 } from './mat3';\nimport { Mat4 } from './mat4';\nimport { Vec2, create, setDefaultType, VecType } from './vec2';\nimport { Vec3, VecType as Vec3Type } from './vec3';\n\nexport default Vec2;\nexport { create, setDefaultType };\n\n/**\n * Creates a Vec2; may be called with x, y, z to set initial values. (same as create)\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @returns the created vector\n */\nexport const fromValues = create;\n\n/**\n * Sets the values of a Vec2\n * Also see {@link vec2.create} and {@link vec2.copy}\n *\n * @param x first value\n * @param y second value\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector with its elements set.\n */\nexport function set(x: number, y: number, dst?: Vec2) {\n dst = dst || new VecType(2);\n\n dst[0] = x;\n dst[1] = y;\n\n return dst;\n}\n\n/**\n * Applies Math.ceil to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the ceil of each element of v.\n */\nexport function ceil(v: Vec2, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = Math.ceil(v[0]);\n dst[1] = Math.ceil(v[1]);\n\n return dst;\n}\n\n/**\n * Applies Math.floor to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the floor of each element of v.\n */\nexport function floor(v: Vec2, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = Math.floor(v[0]);\n dst[1] = Math.floor(v[1]);\n\n return dst;\n}\n\n/**\n * Applies Math.round to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the round of each element of v.\n */\nexport function round(v: Vec2, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = Math.round(v[0]);\n dst[1] = Math.round(v[1]);\n\n return dst;\n}\n\n/**\n * Clamp each element of vector between min and max\n * @param v - Operand vector.\n * @param max - Min value, default 0\n * @param min - Max value, default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that the clamped value of each element of v.\n */\nexport function clamp(v: Vec2, min = 0, max = 1, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = Math.min(max, Math.max(min, v[0]));\n dst[1] = Math.min(max, Math.max(min, v[1]));\n\n return dst;\n}\n\n/**\n * Adds two vectors; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a and b.\n */\nexport function add(a: Vec2, b: Vec2, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = a[0] + b[0];\n dst[1] = a[1] + b[1];\n\n return dst;\n}\n\n/**\n * Adds two vectors, scaling the 2nd; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param scale - Amount to scale b\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a + b * scale.\n */\nexport function addScaled(a: Vec2, b: Vec2, scale: number, dst?: Vec2) {\n dst = dst || new VecType(2);\n\n dst[0] = a[0] + b[0] * scale;\n dst[1] = a[1] + b[1] * scale;\n\n return dst;\n}\n\n/**\n * Returns the angle in radians between two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns The angle in radians between the 2 vectors.\n */\nexport function angle(a: Vec2, b: Vec2): number {\n const ax = a[0];\n const ay = a[1];\n const bx = b[0];\n const by = b[1];\n const mag1 = Math.sqrt(ax * ax + ay * ay);\n const mag2 = Math.sqrt(bx * bx + by * by);\n const mag = mag1 * mag2;\n const cosine = mag && dot(a, b) / mag;\n return Math.acos(cosine);\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nexport function subtract(a: Vec2, b: Vec2, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = a[0] - b[0];\n dst[1] = a[1] - b[1];\n\n return dst;\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nexport const sub = subtract;\n\n/**\n * Check if 2 vectors are approximately equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are approximately equal\n */\nexport function equalsApproximately(a: Vec2, b: Vec2): boolean {\n return Math.abs(a[0] - b[0]) < utils.EPSILON &&\n Math.abs(a[1] - b[1]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 vectors are exactly equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are exactly equal\n */\nexport function equals(a: Vec2, b: Vec2): boolean {\n return a[0] === b[0] && a[1] === b[1];\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficient.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The linear interpolated result.\n */\nexport function lerp(a: Vec2, b: Vec2, t: number, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = a[0] + t * (b[0] - a[0]);\n dst[1] = a[1] + t * (b[1] - a[1]);\n\n return dst;\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient vector t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficients vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns the linear interpolated result.\n */\nexport function lerpV(a: Vec2, b: Vec2, t: Vec2, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = a[0] + t[0] * (b[0] - a[0]);\n dst[1] = a[1] + t[1] * (b[1] - a[1]);\n\n return dst;\n}\n\n/**\n * Return max values of two vectors.\n * Given vectors a and b returns\n * [max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The max components vector.\n */\nexport function max(a: Vec2, b: Vec2, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = Math.max(a[0], b[0]);\n dst[1] = Math.max(a[1], b[1]);\n\n return dst;\n}\n\n/**\n * Return min values of two vectors.\n * Given vectors a and b returns\n * [min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The min components vector.\n */\nexport function min(a: Vec2, b: Vec2, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = Math.min(a[0], b[0]);\n dst[1] = Math.min(a[1], b[1]);\n\n return dst;\n}\n\n/**\n * Multiplies a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nexport function mulScalar(v: Vec2, k: number, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = v[0] * k;\n dst[1] = v[1] * k;\n\n return dst;\n}\n\n/**\n * Multiplies a vector by a scalar. (same as mulScalar)\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nexport const scale = mulScalar;\n\n/**\n * Divides a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nexport function divScalar(v: Vec2, k: number, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = v[0] / k;\n dst[1] = v[1] / k;\n\n return dst;\n}\n\n/**\n * Inverse a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nexport function inverse(v: Vec2, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = 1 / v[0];\n dst[1] = 1 / v[1];\n\n return dst;\n}\n\n/**\n * Invert a vector. (same as inverse)\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nexport const invert = inverse;\n\n/**\n * Computes the cross product of two vectors; assumes both vectors have\n * three entries.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of a cross b.\n */\nexport function cross(a: Vec2, b: Vec2, dst?: Vec3): Vec3 {\n dst = dst || new Vec3Type(3);\n const z = a[0] * b[1] - a[1] * b[0];\n dst[0] = 0;\n dst[1] = 0;\n dst[2] = z;\n\n return dst;\n}\n\n/**\n * Computes the dot product of two vectors; assumes both vectors have\n * three entries.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns dot product\n */\nexport function dot(a: Vec2, b: Vec2): number {\n return a[0] * b[0] + a[1] * b[1];\n}\n\n/**\n * Computes the length of vector\n * @param v - vector.\n * @returns length of vector.\n */\nexport function length(v: Vec2): number {\n const v0 = v[0];\n const v1 = v[1];\n return Math.sqrt(v0 * v0 + v1 * v1);\n}\n\n/**\n * Computes the length of vector (same as length)\n * @param v - vector.\n * @returns length of vector.\n */\nexport const len = length;\n\n/**\n * Computes the square of the length of vector\n * @param v - vector.\n * @returns square of the length of vector.\n */\nexport function lengthSq(v: Vec2): number {\n const v0 = v[0];\n const v1 = v[1];\n return v0 * v0 + v1 * v1;\n}\n\n/**\n * Computes the square of the length of vector (same as lengthSq)\n * @param v - vector.\n * @returns square of the length of vector.\n */\nexport const lenSq = lengthSq;\n\n/**\n * Computes the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nexport function distance(a: Vec2, b: Vec2): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n return Math.sqrt(dx * dx + dy * dy);\n}\n\n/**\n * Computes the distance between 2 points (same as distance)\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nexport const dist = distance;\n\n/**\n * Computes the square of the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nexport function distanceSq(a: Vec2, b: Vec2): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n return dx * dx + dy * dy;\n}\n\n/**\n * Computes the square of the distance between 2 points (same as distanceSq)\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nexport const distSq = distanceSq;\n\n/**\n * Divides a vector by its Euclidean length and returns the quotient.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The normalized vector.\n */\nexport function normalize(v: Vec2, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n const v0 = v[0];\n const v1 = v[1];\n const len = Math.sqrt(v0 * v0 + v1 * v1);\n\n if (len > 0.00001) {\n dst[0] = v0 / len;\n dst[1] = v1 / len;\n } else {\n dst[0] = 0;\n dst[1] = 0;\n }\n\n return dst;\n}\n\n/**\n * Negates a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns -v.\n */\nexport function negate(v: Vec2, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = -v[0];\n dst[1] = -v[1];\n\n return dst;\n}\n\n/**\n * Copies a vector. (same as {@link vec2.clone})\n * Also see {@link vec2.create} and {@link vec2.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nexport function copy(v: Vec2, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = v[0];\n dst[1] = v[1];\n\n return dst;\n}\n\n/**\n * Clones a vector. (same as {@link vec2.copy})\n * Also see {@link vec2.create} and {@link vec2.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nexport const clone = copy;\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nexport function multiply(a: Vec2, b: Vec2, dst?: Vec2) {\n dst = dst || new VecType(2);\n\n dst[0] = a[0] * b[0];\n dst[1] = a[1] * b[1];\n\n return dst;\n}\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as mul)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nexport const mul = multiply;\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nexport function divide(a: Vec2, b: Vec2, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = a[0] / b[0];\n dst[1] = a[1] / b[1];\n\n return dst;\n}\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as divide)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nexport const div = divide;\n\n/**\n * Creates a random unit vector * scale\n * @param scale - Default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The random vector.\n */\nexport function random(scale = 1, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n const angle = Math.random() * 2 * Math.PI;\n dst[0] = Math.cos(angle) * scale;\n dst[1] = Math.sin(angle) * scale;\n\n return dst;\n}\n\n/**\n * Zero's a vector\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The zeroed vector.\n */\nexport function zero(dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = 0;\n dst[1] = 0;\n\n return dst;\n}\n\n\n/**\n * transform Vec2 by 4x4 matrix\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional Vec2 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nexport function transformMat4(v: Vec2, m: Mat4, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n const x = v[0];\n const y = v[1];\n\n dst[0] = x * m[0] + y * m[4] + m[12];\n dst[1] = x * m[1] + y * m[5] + m[13];\n\n return dst;\n}\n\n/**\n * Transforms vec4 by 3x3 matrix\n *\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional Vec2 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nexport function transformMat3(v: Vec2, m: Mat3, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n const x = v[0];\n const y = v[1];\n\n dst[0] = m[0] * x + m[4] * y + m[8];\n dst[1] = m[1] * x + m[5] * y + m[9];\n\n return dst;\n}\n\n/**\n * Rotate a 2D vector\n *\n * @param a The vec2 point to rotate\n * @param b The origin of the rotation\n * @param rad The angle of rotation in radians\n * @returns the rotated vector\n */\nexport function rotate(a: Vec2, b: Vec2, rad: number, dst?: Vec2) {\n dst = dst || new VecType(2);\n\n // Translate point to the origin\n const p0 = a[0] - b[0];\n const p1 = a[1] - b[1];\n const sinC = Math.sin(rad);\n const cosC = Math.cos(rad);\n\n //perform rotation and translate to correct position\n dst[0] = p0 * cosC - p1 * sinC + b[0];\n dst[1] = p0 * sinC + p1 * cosC + b[1];\n\n return dst;\n}\n\n/**\n * Treat a 2D vector as a direction and set it's length\n *\n * @param a The vec2 to lengthen\n * @param len The length of the resulting vector\n * @returns The lengthened vector\n */\nexport function setLength(a: Vec2, len: number, dst?: Vec2) {\n dst = dst || new VecType(2);\n normalize(a, dst);\n return mulScalar(dst, len, dst);\n}\n\n/**\n * Ensure a vector is not longer than a max length\n *\n * @param a The vec2 to limit\n * @param maxLen The longest length of the resulting vector\n * @returns The vector, shortened to maxLen if it's too long\n */\nexport function truncate(a: Vec2, maxLen: number, dst?: Vec2) {\n dst = dst || new VecType(2);\n\n if (length(a) > maxLen) {\n return setLength(a, maxLen, dst);\n }\n\n return copy(a, dst);\n}\n\n/**\n * Return the vector exactly between 2 endpoint vectors\n *\n * @param a Endpoint 1\n * @param b Endpoint 2\n * @returns The vector exactly residing between endpoints 1 and 2\n */\nexport function midpoint(a: Vec2, b: Vec2, dst?: Vec2) {\n dst = dst || new VecType(2);\n return lerp(a, b, 0.5, dst);\n}\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\n\nimport * as utils from './utils.js';\nimport { Quat } from './quat';\nimport { Mat3 } from './mat3';\nimport { Mat4 } from './mat4';\nimport Vec2, * as vec2 from './vec2-impl';\n\nexport default Mat3;\n\nexport type Mat3LikeCtor = new (n: number) => Mat3;\n\n/**\n * 3x3 Matrix math math functions.\n *\n * Almost all functions take an optional `dst` argument. If it is not passed in the\n * functions will create a new matrix. In other words you can do this\n *\n * const mat = mat3.translation([1, 2, 3]); // Creates a new translation matrix\n *\n * or\n *\n * const mat = mat3.create();\n * mat3.translation([1, 2, 3], mat); // Puts translation matrix in mat.\n *\n * The first style is often easier but depending on where it's used it generates garbage where\n * as there is almost never allocation with the second style.\n *\n * It is always save to pass any matrix as the destination. So for example\n *\n * const mat = mat3.identity();\n * const trans = mat3.translation([1, 2, 3]);\n * mat3.multiply(mat, trans, mat); // Multiplies mat * trans and puts result in mat.\n *\n */\nlet MatType: Mat3LikeCtor = Float32Array;\n\n// This mess is because with Mat3 we have 3 unused elements.\n// For Float32Array and Float64Array that's not an issue\n// but for Array it's troublesome\nconst ctorMap = new Map Mat3>([\n [Float32Array, () => new Float32Array(12)],\n [Float64Array, () => new Float64Array(12)],\n [Array, () => new Array(12).fill(0)],\n]);\nlet newMat3: () => Mat3 = ctorMap.get(Float32Array)!;\n\n/**\n * Sets the type this library creates for a Mat3\n * @param ctor - the constructor for the type. Either `Float32Array`, `Float64Array`, or `Array`\n * @returns previous constructor for Mat3\n */\nexport function setDefaultType(ctor: new (n: number) => Mat3) {\n const oldType = MatType;\n MatType = ctor;\n newMat3 = ctorMap.get(ctor)!;\n return oldType;\n}\n\n/**\n * Create a Mat3 from values\n *\n * Note: Since passing in a raw JavaScript array\n * is valid in all circumstances, if you want to\n * force a JavaScript array into a Mat3's specified type\n * it would be faster to use\n *\n * ```\n * const m = mat3.clone(someJSArray);\n * ```\n *\n * Note: a consequence of the implementation is if your Mat3Type = `Array`\n * instead of `Float32Array` or `Float64Array` then any values you\n * don't pass in will be undefined. Usually this is not an issue since\n * (a) using `Array` is rare and (b) using `mat3.create` is usually used\n * to create a Mat3 to be filled out as in\n *\n * ```\n * const m = mat3.create();\n * mat3.perspective(fov, aspect, near, far, m);\n * ```\n *\n * @param v0 - value for element 0\n * @param v1 - value for element 1\n * @param v2 - value for element 2\n * @param v3 - value for element 3\n * @param v4 - value for element 4\n * @param v5 - value for element 5\n * @param v6 - value for element 6\n * @param v7 - value for element 7\n * @param v8 - value for element 8\n * @returns matrix created from values.\n */\nexport function create(\n v0?: number, v1?: number, v2?: number,\n v3?: number, v4?: number, v5?: number,\n v6?: number, v7?: number, v8?: number): Mat3 {\n const dst = newMat3();\n // to make the array homogenous\n dst[3] = 0;\n dst[7] = 0;\n dst[11] = 0;\n\n if (v0 !== undefined) {\n dst[0] = v0;\n if (v1 !== undefined) {\n dst[1] = v1;\n if (v2 !== undefined) {\n dst[2] = v2;\n if (v3 !== undefined) {\n dst[4] = v3;\n if (v4 !== undefined) {\n dst[5] = v4;\n if (v5 !== undefined) {\n dst[6] = v5;\n if (v6 !== undefined) {\n dst[8] = v6;\n if (v7 !== undefined) {\n dst[9] = v7;\n if (v8 !== undefined) {\n dst[10] = v8;\n }\n }\n }\n }\n }\n }\n }\n }\n }\n\n return dst;\n}\n\n/**\n * Sets the values of a Mat3\n * Also see {@link mat3.create} and {@link mat3.copy}\n *\n * @param v0 - value for element 0\n * @param v1 - value for element 1\n * @param v2 - value for element 2\n * @param v3 - value for element 3\n * @param v4 - value for element 4\n * @param v5 - value for element 5\n * @param v6 - value for element 6\n * @param v7 - value for element 7\n * @param v8 - value for element 8\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat3 set from values.\n */\nexport function set(\n v0: number, v1: number, v2: number,\n v3: number, v4: number, v5: number,\n v6: number, v7: number, v8: number, dst?: Mat3) {\n dst = dst || newMat3();\n\n dst[0] = v0; dst[1] = v1; dst[ 2] = v2; dst[ 3] = 0;\n dst[4] = v3; dst[5] = v4; dst[ 6] = v5; dst[ 7] = 0;\n dst[8] = v6; dst[9] = v7; dst[10] = v8; dst[11] = 0;\n\n return dst;\n}\n\n/**\n * Creates a Mat3 from the upper left 3x3 part of a Mat4\n * @param m4 - source matrix\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat3 made from m4\n */\nexport function fromMat4(m4: Mat4, dst?: Mat3): Mat3 {\n dst = dst || newMat3();\n dst[0] = m4[0]; dst[1] = m4[1]; dst[ 2] = m4[ 2]; dst[ 3] = 0;\n dst[4] = m4[4]; dst[5] = m4[5]; dst[ 6] = m4[ 6]; dst[ 7] = 0;\n dst[8] = m4[8]; dst[9] = m4[9]; dst[10] = m4[10]; dst[11] = 0;\n return dst;\n}\n\n/**\n * Creates a Mat3 rotation matrix from a quaternion\n * @param q - quaternion to create matrix from\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat3 made from q\n */\nexport function fromQuat(q: Quat, dst?: Mat3): Mat3 {\n dst = dst || newMat3();\n\n const x = q[0]; const y = q[1]; const z = q[2]; const w = q[3];\n const x2 = x + x; const y2 = y + y; const z2 = z + z;\n\n const xx = x * x2;\n const yx = y * x2;\n const yy = y * y2;\n const zx = z * x2;\n const zy = z * y2;\n const zz = z * z2;\n const wx = w * x2;\n const wy = w * y2;\n const wz = w * z2;\n\n dst[ 0] = 1 - yy - zz; dst[ 1] = yx + wz; dst[ 2] = zx - wy; dst[ 3] = 0;\n dst[ 4] = yx - wz; dst[ 5] = 1 - xx - zz; dst[ 6] = zy + wx; dst[ 7] = 0;\n dst[ 8] = zx + wy; dst[ 9] = zy - wx; dst[10] = 1 - xx - yy; dst[11] = 0;\n\n return dst;\n}\n\n/**\n * Negates a matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns -m.\n */\nexport function negate(m: Mat3, dst?: Mat3): Mat3 {\n dst = dst || newMat3();\n\n dst[ 0] = -m[ 0]; dst[ 1] = -m[ 1]; dst[ 2] = -m[ 2];\n dst[ 4] = -m[ 4]; dst[ 5] = -m[ 5]; dst[ 6] = -m[ 6];\n dst[ 8] = -m[ 8]; dst[ 9] = -m[ 9]; dst[10] = -m[10];\n\n return dst;\n}\n\n/**\n * Copies a matrix. (same as {@link mat3.clone})\n * Also see {@link mat3.create} and {@link mat3.set}\n * @param m - The matrix.\n * @param dst - The matrix. If not passed a new one is created.\n * @returns A copy of m.\n */\nexport function copy(m: Mat3, dst?: Mat3): Mat3 {\n dst = dst || newMat3();\n\n dst[ 0] = m[ 0]; dst[ 1] = m[ 1]; dst[ 2] = m[ 2];\n dst[ 4] = m[ 4]; dst[ 5] = m[ 5]; dst[ 6] = m[ 6];\n dst[ 8] = m[ 8]; dst[ 9] = m[ 9]; dst[10] = m[10];\n\n return dst;\n}\n\n/**\n * Copies a matrix (same as {@link mat3.copy})\n * Also see {@link mat3.create} and {@link mat3.set}\n * @param m - The matrix.\n * @param dst - The matrix. If not passed a new one is created.\n * @returns A copy of m.\n */\nexport const clone = copy;\n\n/**\n * Check if 2 matrices are approximately equal\n * @param a Operand matrix.\n * @param b Operand matrix.\n * @returns true if matrices are approximately equal\n */\nexport function equalsApproximately(a: Mat3, b: Mat3): boolean {\n return Math.abs(a[ 0] - b[ 0]) < utils.EPSILON &&\n Math.abs(a[ 1] - b[ 1]) < utils.EPSILON &&\n Math.abs(a[ 2] - b[ 2]) < utils.EPSILON &&\n Math.abs(a[ 4] - b[ 4]) < utils.EPSILON &&\n Math.abs(a[ 5] - b[ 5]) < utils.EPSILON &&\n Math.abs(a[ 6] - b[ 6]) < utils.EPSILON &&\n Math.abs(a[ 8] - b[ 8]) < utils.EPSILON &&\n Math.abs(a[ 9] - b[ 9]) < utils.EPSILON &&\n Math.abs(a[10] - b[10]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 matrices are exactly equal\n * @param a Operand matrix.\n * @param b Operand matrix.\n * @returns true if matrices are exactly equal\n */\nexport function equals(a: Mat3, b: Mat3): boolean {\n return a[ 0] === b[ 0] &&\n a[ 1] === b[ 1] &&\n a[ 2] === b[ 2] &&\n a[ 4] === b[ 4] &&\n a[ 5] === b[ 5] &&\n a[ 6] === b[ 6] &&\n a[ 8] === b[ 8] &&\n a[ 9] === b[ 9] &&\n a[10] === b[10];\n}\n\n/**\n * Creates a 3-by-3 identity matrix.\n *\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns A 3-by-3 identity matrix.\n */\nexport function identity(dst?: Mat3): Mat3 {\n dst = dst || newMat3();\n\n dst[ 0] = 1; dst[ 1] = 0; dst[ 2] = 0;\n dst[ 4] = 0; dst[ 5] = 1; dst[ 6] = 0;\n dst[ 8] = 0; dst[ 9] = 0; dst[10] = 1;\n\n return dst;\n}\n\n/**\n * Takes the transpose of a matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The transpose of m.\n */\nexport function transpose(m: Mat3, dst?: Mat3): Mat3 {\n dst = dst || newMat3();\n if (dst === m) {\n let t: number;\n\n // 0 1 2\n // 4 5 6\n // 8 9 10\n\n t = m[1];\n m[1] = m[4];\n m[4] = t;\n\n t = m[2];\n m[2] = m[8];\n m[8] = t;\n\n t = m[6];\n m[6] = m[9];\n m[9] = t;\n\n return dst;\n }\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n\n dst[ 0] = m00; dst[ 1] = m10; dst[ 2] = m20;\n dst[ 4] = m01; dst[ 5] = m11; dst[ 6] = m21;\n dst[ 8] = m02; dst[ 9] = m12; dst[10] = m22;\n\n return dst;\n}\n\n/**\n * Computes the inverse of a 3-by-3 matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The inverse of m.\n */\nexport function inverse(m: Mat3, dst?: Mat3): Mat3 {\n dst = dst || newMat3();\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n\n const b01 = m22 * m11 - m12 * m21;\n const b11 = -m22 * m10 + m12 * m20;\n const b21 = m21 * m10 - m11 * m20;\n\n const invDet = 1 / (m00 * b01 + m01 * b11 + m02 * b21);\n\n dst[ 0] = b01 * invDet;\n dst[ 1] = (-m22 * m01 + m02 * m21) * invDet;\n dst[ 2] = ( m12 * m01 - m02 * m11) * invDet;\n dst[ 4] = b11 * invDet;\n dst[ 5] = ( m22 * m00 - m02 * m20) * invDet;\n dst[ 6] = (-m12 * m00 + m02 * m10) * invDet;\n dst[ 8] = b21 * invDet;\n dst[ 9] = (-m21 * m00 + m01 * m20) * invDet;\n dst[10] = ( m11 * m00 - m01 * m10) * invDet;\n\n return dst;\n}\n\n/**\n * Compute the determinant of a matrix\n * @param m - the matrix\n * @returns the determinant\n */\nexport function determinant(m: Mat3): number {\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n\n return m00 * (m11 * m22 - m21 * m12) -\n m10 * (m01 * m22 - m21 * m02) +\n m20 * (m01 * m12 - m11 * m02);\n}\n\n/**\n * Computes the inverse of a 3-by-3 matrix. (same as inverse)\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The inverse of m.\n */\nexport const invert = inverse;\n\n/**\n * Multiplies two 3-by-3 matrices with a on the left and b on the right\n * @param a - The matrix on the left.\n * @param b - The matrix on the right.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix product of a and b.\n */\nexport function multiply(a: Mat3, b: Mat3, dst?: Mat3): Mat3 {\n dst = dst || newMat3();\n\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a10 = a[ 4 + 0];\n const a11 = a[ 4 + 1];\n const a12 = a[ 4 + 2];\n const a20 = a[ 8 + 0];\n const a21 = a[ 8 + 1];\n const a22 = a[ 8 + 2];\n const b00 = b[0];\n const b01 = b[1];\n const b02 = b[2];\n const b10 = b[ 4 + 0];\n const b11 = b[ 4 + 1];\n const b12 = b[ 4 + 2];\n const b20 = b[ 8 + 0];\n const b21 = b[ 8 + 1];\n const b22 = b[ 8 + 2];\n\n dst[ 0] = a00 * b00 + a10 * b01 + a20 * b02;\n dst[ 1] = a01 * b00 + a11 * b01 + a21 * b02;\n dst[ 2] = a02 * b00 + a12 * b01 + a22 * b02;\n dst[ 4] = a00 * b10 + a10 * b11 + a20 * b12;\n dst[ 5] = a01 * b10 + a11 * b11 + a21 * b12;\n dst[ 6] = a02 * b10 + a12 * b11 + a22 * b12;\n dst[ 8] = a00 * b20 + a10 * b21 + a20 * b22;\n dst[ 9] = a01 * b20 + a11 * b21 + a21 * b22;\n dst[10] = a02 * b20 + a12 * b21 + a22 * b22;\n\n return dst;\n}\n\n/**\n * Multiplies two 3-by-3 matrices with a on the left and b on the right (same as multiply)\n * @param a - The matrix on the left.\n * @param b - The matrix on the right.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix product of a and b.\n */\nexport const mul = multiply;\n\n/**\n * Sets the translation component of a 3-by-3 matrix to the given\n * vector.\n * @param a - The matrix.\n * @param v - The vector.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix with translation set.\n */\nexport function setTranslation(a: Mat3, v: Vec2, dst?: Mat3): Mat3 {\n dst = dst || identity();\n if (a !== dst) {\n dst[ 0] = a[ 0];\n dst[ 1] = a[ 1];\n dst[ 2] = a[ 2];\n dst[ 4] = a[ 4];\n dst[ 5] = a[ 5];\n dst[ 6] = a[ 6];\n }\n dst[ 8] = v[0];\n dst[ 9] = v[1];\n dst[10] = 1;\n return dst;\n}\n\n/**\n * Returns the translation component of a 3-by-3 matrix as a vector with 3\n * entries.\n * @param m - The matrix.\n * @param dst - vector to hold result. If not passed a new one is created.\n * @returns The translation component of m.\n */\nexport function getTranslation(m: Mat3, dst?: Vec2): Vec2 {\n dst = dst || vec2.create();\n dst[0] = m[8];\n dst[1] = m[9];\n return dst;\n}\n\n/**\n * Returns an axis of a 3x3 matrix as a vector with 2 entries\n * @param m - The matrix.\n * @param axis - The axis 0 = x, 1 = y,\n * @returns The axis component of m.\n */\nexport function getAxis(m: Mat3, axis: number, dst?: Vec2): Vec2 {\n dst = dst || vec2.create();\n const off = axis * 4;\n dst[0] = m[off + 0];\n dst[1] = m[off + 1];\n return dst;\n}\n\n/**\n * Sets an axis of a 3x3 matrix as a vector with 2 entries\n * @param m - The matrix.\n * @param v - the axis vector\n * @param axis - The axis 0 = x, 1 = y;\n * @param dst - The matrix to set. If not passed a new one is created.\n * @returns The matrix with axis set.\n */\nexport function setAxis(m: Mat3, v: Vec2, axis: number, dst?: Mat3): Mat3 {\n if (dst !== m) {\n dst = copy(m, dst);\n }\n const off = axis * 4;\n dst[off + 0] = v[0];\n dst[off + 1] = v[1];\n return dst;\n}\n\n/**\n * Returns the scaling component of the matrix\n * @param m - The Matrix\n * @param dst - The vector to set. If not passed a new one is created.\n */\nexport function getScaling(m: Mat3, dst?: Vec2): Vec2 {\n dst = dst || vec2.create();\n\n const xx = m[0];\n const xy = m[1];\n const yx = m[4];\n const yy = m[5];\n\n dst[0] = Math.sqrt(xx * xx + xy * xy);\n dst[1] = Math.sqrt(yx * yx + yy * yy);\n\n return dst;\n}\n\n/**\n * Creates a 3-by-3 matrix which translates by the given vector v.\n * @param v - The vector by which to translate.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The translation matrix.\n */\nexport function translation(v: Vec2, dst?: Mat3): Mat3 {\n dst = dst || newMat3();\n\n dst[ 0] = 1; dst[ 1] = 0; dst[ 2] = 0;\n dst[ 4] = 0; dst[ 5] = 1; dst[ 6] = 0;\n dst[ 8] = v[0]; dst[ 9] = v[1]; dst[10] = 1;\n\n return dst;\n}\n\n/**\n * Translates the given 3-by-3 matrix by the given vector v.\n * @param m - The matrix.\n * @param v - The vector by which to translate.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The translated matrix.\n */\nexport function translate(m: Mat3, v: Vec2, dst?: Mat3): Mat3 {\n dst = dst || newMat3();\n\n const v0 = v[0];\n const v1 = v[1];\n\n const m00 = m[0];\n const m01 = m[1];\n const m02 = m[2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n\n if (m !== dst) {\n dst[ 0] = m00;\n dst[ 1] = m01;\n dst[ 2] = m02;\n dst[ 4] = m10;\n dst[ 5] = m11;\n dst[ 6] = m12;\n }\n\n dst[ 8] = m00 * v0 + m10 * v1 + m20;\n dst[ 9] = m01 * v0 + m11 * v1 + m21;\n dst[10] = m02 * v0 + m12 * v1 + m22;\n\n return dst;\n}\n\n/**\n * Creates a 3-by-3 matrix which rotates by the given angle.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotation matrix.\n */\nexport function rotation(angleInRadians: number, dst?: Mat3): Mat3 {\n dst = dst || newMat3();\n\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n dst[ 0] = c; dst[ 1] = s; dst[ 2] = 0;\n dst[ 4] = -s; dst[ 5] = c; dst[ 6] = 0;\n dst[ 8] = 0; dst[ 9] = 0; dst[10] = 1;\n\n return dst;\n}\n\n/**\n * Rotates the given 3-by-3 matrix by the given angle.\n * @param m - The matrix.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nexport function rotate(m: Mat3, angleInRadians: number, dst?: Mat3): Mat3 {\n dst = dst || newMat3();\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n dst[ 0] = c * m00 + s * m10;\n dst[ 1] = c * m01 + s * m11;\n dst[ 2] = c * m02 + s * m12;\n\n dst[ 4] = c * m10 - s * m00;\n dst[ 5] = c * m11 - s * m01;\n dst[ 6] = c * m12 - s * m02;\n\n\n if (m !== dst) {\n dst[ 8] = m[ 8];\n dst[ 9] = m[ 9];\n dst[10] = m[10];\n }\n\n return dst;\n}\n\n/**\n * Creates a 3-by-3 matrix which scales in each dimension by an amount given by\n * the corresponding entry in the given vector; assumes the vector has three\n * entries.\n * @param v - A vector of\n * 2 entries specifying the factor by which to scale in each dimension.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaling matrix.\n */\nexport function scaling(v: Vec2, dst?: Mat3): Mat3 {\n dst = dst || newMat3();\n\n dst[ 0] = v[0]; dst[ 1] = 0; dst[ 2] = 0;\n dst[ 4] = 0; dst[ 5] = v[1]; dst[ 6] = 0;\n dst[ 8] = 0; dst[ 9] = 0; dst[10] = 1;\n\n return dst;\n}\n\n/**\n * Scales the given 3-by-3 matrix in each dimension by an amount\n * given by the corresponding entry in the given vector; assumes the vector has\n * three entries.\n * @param m - The matrix to be modified.\n * @param v - A vector of 2 entries specifying the\n * factor by which to scale in each dimension.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaled matrix.\n */\nexport function scale(m: Mat3, v: Vec2, dst?: Mat3): Mat3 {\n dst = dst || newMat3();\n\n const v0 = v[0];\n const v1 = v[1];\n\n dst[ 0] = v0 * m[0 * 4 + 0];\n dst[ 1] = v0 * m[0 * 4 + 1];\n dst[ 2] = v0 * m[0 * 4 + 2];\n\n dst[ 4] = v1 * m[1 * 4 + 0];\n dst[ 5] = v1 * m[1 * 4 + 1];\n dst[ 6] = v1 * m[1 * 4 + 2];\n\n if (m !== dst) {\n dst[ 8] = m[ 8];\n dst[ 9] = m[ 9];\n dst[10] = m[10];\n }\n\n return dst;\n}\n\n/**\n * Creates a 3-by-3 matrix which scales uniformly in each dimension\n * @param s - Amount to scale\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaling matrix.\n */\nexport function uniformScaling(s: number, dst?: Mat3): Mat3 {\n dst = dst || newMat3();\n\n dst[ 0] = s; dst[ 1] = 0; dst[ 2] = 0;\n dst[ 4] = 0; dst[ 5] = s; dst[ 6] = 0;\n dst[ 8] = 0; dst[ 9] = 0; dst[10] = 1;\n\n return dst;\n}\n\n/**\n * Scales the given 3-by-3 matrix in each dimension by an amount\n * given.\n * @param m - The matrix to be modified.\n * @param s - Amount to scale.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaled matrix.\n */\nexport function uniformScale(m: Mat3, s: number, dst?: Mat3): Mat3 {\n dst = dst || newMat3();\n\n dst[ 0] = s * m[0 * 4 + 0];\n dst[ 1] = s * m[0 * 4 + 1];\n dst[ 2] = s * m[0 * 4 + 2];\n\n dst[ 4] = s * m[1 * 4 + 0];\n dst[ 5] = s * m[1 * 4 + 1];\n dst[ 6] = s * m[1 * 4 + 2];\n\n if (m !== dst) {\n dst[ 8] = m[ 8];\n dst[ 9] = m[ 9];\n dst[10] = m[10];\n }\n\n return dst;\n}\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport * as utils from './utils.js';\nimport { Vec3, create, setDefaultType, VecType } from './vec3';\nimport { Mat3 } from './mat3';\nimport { Mat4 } from './mat4';\nimport { Quat } from './quat';\n\nexport default Vec3;\nexport { create, setDefaultType };\n\n/**\n * Creates a vec3; may be called with x, y, z to set initial values. (same as create)\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @returns the created vector\n */\nexport const fromValues = create;\n\n/**\n * Sets the values of a Vec3\n * Also see {@link vec3.create} and {@link vec3.copy}\n *\n * @param x first value\n * @param y second value\n * @param z third value\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector with its elements set.\n */\nexport function set(x: number, y: number, z: number, dst?: Vec3) {\n dst = dst || new VecType(3);\n\n dst[0] = x;\n dst[1] = y;\n dst[2] = z;\n\n return dst;\n}\n\n/**\n * Applies Math.ceil to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the ceil of each element of v.\n */\nexport function ceil(v: Vec3, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = Math.ceil(v[0]);\n dst[1] = Math.ceil(v[1]);\n dst[2] = Math.ceil(v[2]);\n\n return dst;\n}\n\n/**\n * Applies Math.floor to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the floor of each element of v.\n */\nexport function floor(v: Vec3, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = Math.floor(v[0]);\n dst[1] = Math.floor(v[1]);\n dst[2] = Math.floor(v[2]);\n\n return dst;\n}\n\n/**\n * Applies Math.round to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the round of each element of v.\n */\nexport function round(v: Vec3, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = Math.round(v[0]);\n dst[1] = Math.round(v[1]);\n dst[2] = Math.round(v[2]);\n\n return dst;\n}\n\n/**\n * Clamp each element of vector between min and max\n * @param v - Operand vector.\n * @param max - Min value, default 0\n * @param min - Max value, default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that the clamped value of each element of v.\n */\nexport function clamp(v: Vec3, min = 0, max = 1, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = Math.min(max, Math.max(min, v[0]));\n dst[1] = Math.min(max, Math.max(min, v[1]));\n dst[2] = Math.min(max, Math.max(min, v[2]));\n\n return dst;\n}\n\n/**\n * Adds two vectors; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a and b.\n */\nexport function add(a: Vec3, b: Vec3, dst?: Vec3) {\n dst = dst || new VecType(3);\n\n dst[0] = a[0] + b[0];\n dst[1] = a[1] + b[1];\n dst[2] = a[2] + b[2];\n\n return dst;\n}\n\n/**\n * Adds two vectors, scaling the 2nd; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param scale - Amount to scale b\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a + b * scale.\n */\nexport function addScaled(a: Vec3, b: Vec3, scale: number, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = a[0] + b[0] * scale;\n dst[1] = a[1] + b[1] * scale;\n dst[2] = a[2] + b[2] * scale;\n\n return dst;\n}\n\n/**\n * Returns the angle in radians between two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns The angle in radians between the 2 vectors.\n */\nexport function angle(a: Vec3, b: Vec3): number {\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const bx = b[0];\n const by = b[1];\n const bz = b[2];\n const mag1 = Math.sqrt(ax * ax + ay * ay + az * az);\n const mag2 = Math.sqrt(bx * bx + by * by + bz * bz);\n const mag = mag1 * mag2;\n const cosine = mag && dot(a, b) / mag;\n return Math.acos(cosine);\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nexport function subtract(a: Vec3, b: Vec3, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = a[0] - b[0];\n dst[1] = a[1] - b[1];\n dst[2] = a[2] - b[2];\n\n return dst;\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nexport const sub = subtract;\n\n/**\n * Check if 2 vectors are approximately equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are approximately equal\n */\nexport function equalsApproximately(a: Vec3, b: Vec3): boolean {\n return Math.abs(a[0] - b[0]) < utils.EPSILON &&\n Math.abs(a[1] - b[1]) < utils.EPSILON &&\n Math.abs(a[2] - b[2]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 vectors are exactly equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are exactly equal\n */\nexport function equals(a: Vec3, b: Vec3): boolean {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2];\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficient.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The linear interpolated result.\n */\nexport function lerp(a: Vec3, b: Vec3, t: number, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = a[0] + t * (b[0] - a[0]);\n dst[1] = a[1] + t * (b[1] - a[1]);\n dst[2] = a[2] + t * (b[2] - a[2]);\n\n return dst;\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient vector t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficients vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns the linear interpolated result.\n */\nexport function lerpV(a: Vec3, b: Vec3, t: Vec3, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = a[0] + t[0] * (b[0] - a[0]);\n dst[1] = a[1] + t[1] * (b[1] - a[1]);\n dst[2] = a[2] + t[2] * (b[2] - a[2]);\n\n return dst;\n}\n\n/**\n * Return max values of two vectors.\n * Given vectors a and b returns\n * [max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The max components vector.\n */\nexport function max(a: Vec3, b: Vec3, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = Math.max(a[0], b[0]);\n dst[1] = Math.max(a[1], b[1]);\n dst[2] = Math.max(a[2], b[2]);\n\n return dst;\n}\n\n/**\n * Return min values of two vectors.\n * Given vectors a and b returns\n * [min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The min components vector.\n */\nexport function min(a: Vec3, b: Vec3, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = Math.min(a[0], b[0]);\n dst[1] = Math.min(a[1], b[1]);\n dst[2] = Math.min(a[2], b[2]);\n\n return dst;\n}\n\n/**\n * Multiplies a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nexport function mulScalar(v: Vec3, k: number, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = v[0] * k;\n dst[1] = v[1] * k;\n dst[2] = v[2] * k;\n\n return dst;\n}\n\n/**\n * Multiplies a vector by a scalar. (same as mulScalar)\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nexport const scale = mulScalar;\n\n/**\n * Divides a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nexport function divScalar(v: Vec3, k: number, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = v[0] / k;\n dst[1] = v[1] / k;\n dst[2] = v[2] / k;\n\n return dst;\n}\n\n/**\n * Inverse a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nexport function inverse(v: Vec3, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = 1 / v[0];\n dst[1] = 1 / v[1];\n dst[2] = 1 / v[2];\n\n return dst;\n}\n\n/**\n * Invert a vector. (same as inverse)\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nexport const invert = inverse;\n\n/**\n * Computes the cross product of two vectors; assumes both vectors have\n * three entries.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of a cross b.\n */\nexport function cross(a: Vec3, b: Vec3, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n const t1 = a[2] * b[0] - a[0] * b[2];\n const t2 = a[0] * b[1] - a[1] * b[0];\n dst[0] = a[1] * b[2] - a[2] * b[1];\n dst[1] = t1;\n dst[2] = t2;\n\n return dst;\n}\n\n/**\n * Computes the dot product of two vectors; assumes both vectors have\n * three entries.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns dot product\n */\nexport function dot(a: Vec3, b: Vec3): number {\n return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]);\n}\n\n/**\n * Computes the length of vector\n * @param v - vector.\n * @returns length of vector.\n */\nexport function length(v: Vec3): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n return Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2);\n}\n\n/**\n * Computes the length of vector (same as length)\n * @param v - vector.\n * @returns length of vector.\n */\nexport const len = length;\n\n/**\n * Computes the square of the length of vector\n * @param v - vector.\n * @returns square of the length of vector.\n */\nexport function lengthSq(v: Vec3): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n return v0 * v0 + v1 * v1 + v2 * v2;\n}\n\n/**\n * Computes the square of the length of vector (same as lengthSq)\n * @param v - vector.\n * @returns square of the length of vector.\n */\nexport const lenSq = lengthSq;\n\n/**\n * Computes the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nexport function distance(a: Vec3, b: Vec3): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n const dz = a[2] - b[2];\n return Math.sqrt(dx * dx + dy * dy + dz * dz);\n}\n\n/**\n * Computes the distance between 2 points (same as distance)\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nexport const dist = distance;\n\n/**\n * Computes the square of the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nexport function distanceSq(a: Vec3, b: Vec3): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n const dz = a[2] - b[2];\n return dx * dx + dy * dy + dz * dz;\n}\n\n/**\n * Computes the square of the distance between 2 points (same as distanceSq)\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nexport const distSq = distanceSq;\n\n/**\n * Divides a vector by its Euclidean length and returns the quotient.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The normalized vector.\n */\nexport function normalize(v: Vec3, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const len = Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2);\n\n if (len > 0.00001) {\n dst[0] = v0 / len;\n dst[1] = v1 / len;\n dst[2] = v2 / len;\n } else {\n dst[0] = 0;\n dst[1] = 0;\n dst[2] = 0;\n }\n\n\n return dst;\n}\n\n/**\n * Negates a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns -v.\n */\nexport function negate(v: Vec3, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = -v[0];\n dst[1] = -v[1];\n dst[2] = -v[2];\n\n return dst;\n}\n\n/**\n * Copies a vector. (same as {@link vec3.clone})\n * Also see {@link vec3.create} and {@link vec3.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nexport function copy(v: Vec3, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = v[0];\n dst[1] = v[1];\n dst[2] = v[2];\n\n return dst;\n}\n\n/**\n * Clones a vector. (same as {@link vec3.copy})\n * Also see {@link vec3.create} and {@link vec3.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nexport const clone = copy;\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nexport function multiply(a: Vec3, b: Vec3, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = a[0] * b[0];\n dst[1] = a[1] * b[1];\n dst[2] = a[2] * b[2];\n\n return dst;\n}\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as mul)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nexport const mul = multiply;\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nexport function divide(a: Vec3, b: Vec3, dst?: Vec3) {\n dst = dst || new VecType(3);\n\n dst[0] = a[0] / b[0];\n dst[1] = a[1] / b[1];\n dst[2] = a[2] / b[2];\n\n return dst;\n}\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as divide)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nexport const div = divide;\n\n/**\n * Creates a random vector\n * @param scale - Default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The random vector.\n */\nexport function random(scale = 1, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n const angle = Math.random() * 2 * Math.PI;\n const z = Math.random() * 2 - 1;\n const zScale = Math.sqrt(1 - z * z) * scale;\n dst[0] = Math.cos(angle) * zScale;\n dst[1] = Math.sin(angle) * zScale;\n dst[2] = z * scale;\n\n return dst;\n}\n\n/**\n * Zero's a vector\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The zeroed vector.\n */\nexport function zero(dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = 0;\n dst[1] = 0;\n dst[2] = 0;\n\n return dst;\n}\n\n\n/**\n * transform vec3 by 4x4 matrix\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional vec3 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nexport function transformMat4(v: Vec3, m: Mat4, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n const x = v[0];\n const y = v[1];\n const z = v[2];\n const w = (m[3] * x + m[7] * y + m[11] * z + m[15]) || 1;\n\n dst[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;\n dst[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;\n dst[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;\n\n return dst;\n}\n\n/**\n * Transform vec4 by upper 3x3 matrix inside 4x4 matrix.\n * @param v - The direction.\n * @param m - The matrix.\n * @param dst - optional Vec3 to store result. If not passed a new one is created.\n * @returns The transformed vector.\n */\nexport function transformMat4Upper3x3(v: Vec3, m: Mat4, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n\n dst[0] = v0 * m[0 * 4 + 0] + v1 * m[1 * 4 + 0] + v2 * m[2 * 4 + 0];\n dst[1] = v0 * m[0 * 4 + 1] + v1 * m[1 * 4 + 1] + v2 * m[2 * 4 + 1];\n dst[2] = v0 * m[0 * 4 + 2] + v1 * m[1 * 4 + 2] + v2 * m[2 * 4 + 2];\n\n return dst;\n}\n\n/**\n * Transforms vec3 by 3x3 matrix\n *\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional vec3 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nexport function transformMat3(v: Vec3, m: Mat3, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n const x = v[0];\n const y = v[1];\n const z = v[2];\n\n dst[0] = x * m[0] + y * m[4] + z * m[8];\n dst[1] = x * m[1] + y * m[5] + z * m[9];\n dst[2] = x * m[2] + y * m[6] + z * m[10];\n\n return dst;\n}\n\n/**\n * Transforms vec3 by Quaternion\n * @param v - the vector to transform\n * @param q - the quaternion to transform by\n * @param dst - optional vec3 to store result. If not passed a new one is created.\n * @returns the transformed\n */\nexport function transformQuat(v: Vec3, q: Quat, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const w2 = q[3] * 2;\n\n const x = v[0];\n const y = v[1];\n const z = v[2];\n\n const uvX = qy * z - qz * y;\n const uvY = qz * x - qx * z;\n const uvZ = qx * y - qy * x;\n\n dst[0] = x + uvX * w2 + (qy * uvZ - qz * uvY) * 2;\n dst[1] = y + uvY * w2 + (qz * uvX - qx * uvZ) * 2;\n dst[2] = z + uvZ * w2 + (qx * uvY - qy * uvX) * 2;\n\n return dst;\n}\n\n/**\n * Returns the translation component of a 4-by-4 matrix as a vector with 3\n * entries.\n * @param m - The matrix.\n * @param dst - vector to hold result. If not passed a new one is created.\n * @returns The translation component of m.\n */\nexport function getTranslation(m: Mat3, dst?: Vec3) {\n dst = dst || new VecType(3);\n dst[0] = m[12];\n dst[1] = m[13];\n dst[2] = m[14];\n return dst;\n}\n/**\n * Returns an axis of a 4x4 matrix as a vector with 3 entries\n * @param m - The matrix.\n * @param axis - The axis 0 = x, 1 = y, 2 = z;\n * @returns The axis component of m.\n */\nexport function getAxis(m: Mat4, axis: number, dst?: Vec3) {\n dst = dst || new VecType(3);\n const off = axis * 4;\n dst[0] = m[off + 0];\n dst[1] = m[off + 1];\n dst[2] = m[off + 2];\n return dst;\n}\n/**\n * Returns the scaling component of the matrix\n * @param m - The Matrix\n * @param dst - The vector to set. If not passed a new one is created.\n */\nexport function getScaling(m: Mat4, dst: Vec3) {\n dst = dst || new VecType(3);\n const xx = m[0];\n const xy = m[1];\n const xz = m[2];\n const yx = m[4];\n const yy = m[5];\n const yz = m[6];\n const zx = m[8];\n const zy = m[9];\n const zz = m[10];\n dst[0] = Math.sqrt(xx * xx + xy * xy + xz * xz);\n dst[1] = Math.sqrt(yx * yx + yy * yy + yz * yz);\n dst[2] = Math.sqrt(zx * zx + zy * zy + zz * zz);\n return dst;\n}\n\n/**\n * Rotate a 3D vector around the x-axis\n *\n * @param {ReadonlyVec3} a The vec3 point to rotate\n * @param {ReadonlyVec3} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @param dst - The vector to set. If not passed a new one is created.\n * @returns the rotated vector\n */\nexport function rotateX(a: Vec3, b: Vec3, rad: number, dst?: Vec3) {\n dst = dst || new VecType(3);\n const p = [];\n const r = [];\n\n //Translate point to the origin\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2];\n\n //perform rotation\n r[0] = p[0];\n r[1] = p[1] * Math.cos(rad) - p[2] * Math.sin(rad);\n r[2] = p[1] * Math.sin(rad) + p[2] * Math.cos(rad);\n\n //translate to correct position\n dst[0] = r[0] + b[0];\n dst[1] = r[1] + b[1];\n dst[2] = r[2] + b[2];\n\n return dst;\n}\n\n/**\n * Rotate a 3D vector around the y-axis\n *\n * @param {ReadonlyVec3} a The vec3 point to rotate\n * @param {ReadonlyVec3} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @param dst - The vector to set. If not passed a new one is created.\n * @returns the rotated vector\n */\nexport function rotateY(a: Vec3, b: Vec3, rad: number, dst?: Vec3) {\n dst = dst || new VecType(3);\n const p = [];\n const r = [];\n\n // translate point to the origin\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2];\n\n // perform rotation\n r[0] = p[2] * Math.sin(rad) + p[0] * Math.cos(rad);\n r[1] = p[1];\n r[2] = p[2] * Math.cos(rad) - p[0] * Math.sin(rad);\n\n // translate to correct position\n dst[0] = r[0] + b[0];\n dst[1] = r[1] + b[1];\n dst[2] = r[2] + b[2];\n\n return dst;\n}\n\n/**\n * Rotate a 3D vector around the z-axis\n *\n * @param {ReadonlyVec3} a The vec3 point to rotate\n * @param {ReadonlyVec3} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @param dst - The vector to set. If not passed a new one is created.\n * @returns {vec3} out\n */\nexport function rotateZ(a: Vec3, b: Vec3, rad: number, dst?: Vec3) {\n dst = dst || new VecType(3);\n const p = [];\n const r = [];\n\n // translate point to the origin\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2];\n\n // perform rotation\n r[0] = p[0] * Math.cos(rad) - p[1] * Math.sin(rad);\n r[1] = p[0] * Math.sin(rad) + p[1] * Math.cos(rad);\n r[2] = p[2];\n\n // translate to correct position\n dst[0] = r[0] + b[0];\n dst[1] = r[1] + b[1];\n dst[2] = r[2] + b[2];\n\n return dst;\n}\n\n/**\n * Treat a 3D vector as a direction and set it's length\n *\n * @param a The vec3 to lengthen\n * @param len The length of the resulting vector\n * @returns The lengthened vector\n */\nexport function setLength(a: Vec3, len: number, dst?: Vec3) {\n dst = dst || new VecType(3);\n normalize(a, dst);\n return mulScalar(dst, len, dst);\n}\n\n/**\n * Ensure a vector is not longer than a max length\n *\n * @param a The vec3 to limit\n * @param maxLen The longest length of the resulting vector\n * @returns The vector, shortened to maxLen if it's too long\n */\nexport function truncate(a: Vec3, maxLen: number, dst?: Vec3) {\n dst = dst || new VecType(3);\n\n if (length(a) > maxLen) {\n return setLength(a, maxLen, dst);\n }\n\n return copy(a, dst);\n}\n\n/**\n * Return the vector exactly between 2 endpoint vectors\n *\n * @param a Endpoint 1\n * @param b Endpoint 2\n * @returns The vector exactly residing between endpoints 1 and 2\n */\nexport function midpoint(a: Vec3, b: Vec3, dst?: Vec3) {\n dst = dst || new VecType(3);\n return lerp(a, b, 0.5, dst);\n}\n","\nimport { Mat3 } from './mat3';\nimport { Mat4 } from './mat4';\nimport { Quat } from './quat';\nimport Vec3, * as vec3 from './vec3-impl';\nimport * as utils from './utils';\n\nexport default Mat4;\n\nexport type Mat4LikeCtor = new (n: number) => Mat4;\n\n/**\n * 4x4 Matrix math math functions.\n *\n * Almost all functions take an optional `dst` argument. If it is not passed in the\n * functions will create a new matrix. In other words you can do this\n *\n * const mat = mat4.translation([1, 2, 3]); // Creates a new translation matrix\n *\n * or\n *\n * const mat = mat4.create();\n * mat4.translation([1, 2, 3], mat); // Puts translation matrix in mat.\n *\n * The first style is often easier but depending on where it's used it generates garbage where\n * as there is almost never allocation with the second style.\n *\n * It is always save to pass any matrix as the destination. So for example\n *\n * const mat = mat4.identity();\n * const trans = mat4.translation([1, 2, 3]);\n * mat4.multiply(mat, trans, mat); // Multiplies mat * trans and puts result in mat.\n *\n */\nlet MatType: Mat4LikeCtor = Float32Array;\n\n/**\n * Sets the type this library creates for a Mat4\n * @param ctor - the constructor for the type. Either `Float32Array`, `Float64Array`, or `Array`\n * @returns previous constructor for Mat4\n */\nexport function setDefaultType(ctor: new (n: number) => Mat4) {\n const oldType = MatType;\n MatType = ctor;\n return oldType;\n}\n\n/**\n * Create a Mat4 from values\n *\n * Note: Since passing in a raw JavaScript array\n * is valid in all circumstances, if you want to\n * force a JavaScript array into a Mat4's specified type\n * it would be faster to use\n *\n * ```\n * const m = mat4.clone(someJSArray);\n * ```\n *\n * Note: a consequence of the implementation is if your Mat4Type = `Array`\n * instead of `Float32Array` or `Float64Array` then any values you\n * don't pass in will be undefined. Usually this is not an issue since\n * (a) using `Array` is rare and (b) using `mat4.create` is usually used\n * to create a Mat4 to be filled out as in\n *\n * ```\n * const m = mat4.create();\n * mat4.perspective(fov, aspect, near, far, m);\n * ```\n *\n * @param v0 - value for element 0\n * @param v1 - value for element 1\n * @param v2 - value for element 2\n * @param v3 - value for element 3\n * @param v4 - value for element 4\n * @param v5 - value for element 5\n * @param v6 - value for element 6\n * @param v7 - value for element 7\n * @param v8 - value for element 8\n * @param v9 - value for element 9\n * @param v10 - value for element 10\n * @param v11 - value for element 11\n * @param v12 - value for element 12\n * @param v13 - value for element 13\n * @param v14 - value for element 14\n * @param v15 - value for element 15\n * @returns created from values.\n */\nexport function create(\n v0?: number, v1?: number, v2?: number, v3?: number,\n v4?: number, v5?: number, v6?: number, v7?: number,\n v8?: number, v9?: number, v10?: number, v11?: number,\n v12?: number, v13?: number, v14?: number, v15?: number): Mat4 {\n const dst = new MatType(16);\n if (v0 !== undefined) {\n dst[0] = v0;\n if (v1 !== undefined) {\n dst[1] = v1;\n if (v2 !== undefined) {\n dst[2] = v2;\n if (v3 !== undefined) {\n dst[3] = v3;\n if (v4 !== undefined) {\n dst[4] = v4;\n if (v5 !== undefined) {\n dst[5] = v5;\n if (v6 !== undefined) {\n dst[6] = v6;\n if (v7 !== undefined) {\n dst[7] = v7;\n if (v8 !== undefined) {\n dst[8] = v8;\n if (v9 !== undefined) {\n dst[9] = v9;\n if (v10 !== undefined) {\n dst[10] = v10;\n if (v11 !== undefined) {\n dst[11] = v11;\n if (v12 !== undefined) {\n dst[12] = v12;\n if (v13 !== undefined) {\n dst[13] = v13;\n if (v14 !== undefined) {\n dst[14] = v14;\n if (v15 !== undefined) {\n dst[15] = v15;\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n return dst;\n}\n\n/**\n * Sets the values of a Mat4\n * Also see {@link mat4.create} and {@link mat4.copy}\n *\n * @param v0 - value for element 0\n * @param v1 - value for element 1\n * @param v2 - value for element 2\n * @param v3 - value for element 3\n * @param v4 - value for element 4\n * @param v5 - value for element 5\n * @param v6 - value for element 6\n * @param v7 - value for element 7\n * @param v8 - value for element 8\n * @param v9 - value for element 9\n * @param v10 - value for element 10\n * @param v11 - value for element 11\n * @param v12 - value for element 12\n * @param v13 - value for element 13\n * @param v14 - value for element 14\n * @param v15 - value for element 15\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat4 created from values.\n */\nexport function set(\n v0: number, v1: number, v2: number, v3: number,\n v4: number, v5: number, v6: number, v7: number,\n v8: number, v9: number, v10: number, v11: number,\n v12: number, v13: number, v14: number, v15: number,\n dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n dst[ 0] = v0; dst[ 1] = v1; dst[ 2] = v2; dst[ 3] = v3;\n dst[ 4] = v4; dst[ 5] = v5; dst[ 6] = v6; dst[ 7] = v7;\n dst[ 8] = v8; dst[ 9] = v9; dst[10] = v10; dst[11] = v11;\n dst[12] = v12; dst[13] = v13; dst[14] = v14; dst[15] = v15;\n\n return dst;\n}\n\n/**\n * Creates a Mat4 from a Mat3\n * @param m3 - source matrix\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat4 made from m3\n */\nexport function fromMat3(m3: Mat3, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n dst[ 0] = m3[0]; dst[ 1] = m3[1]; dst[ 2] = m3[ 2]; dst[ 3] = 0;\n dst[ 4] = m3[4]; dst[ 5] = m3[5]; dst[ 6] = m3[ 6]; dst[ 7] = 0;\n dst[ 8] = m3[8]; dst[ 9] = m3[9]; dst[10] = m3[10]; dst[11] = 0;\n dst[12] = 0; dst[13] = 0; dst[14] = 0; dst[15] = 1;\n\n return dst;\n}\n\n/**\n * Creates a Mat4 rotation matrix from a quaternion\n * @param q - quaternion to create matrix from\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat4 made from q\n */\nexport function fromQuat(q: Quat, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n const x = q[0]; const y = q[1]; const z = q[2]; const w = q[3];\n const x2 = x + x; const y2 = y + y; const z2 = z + z;\n\n const xx = x * x2;\n const yx = y * x2;\n const yy = y * y2;\n const zx = z * x2;\n const zy = z * y2;\n const zz = z * z2;\n const wx = w * x2;\n const wy = w * y2;\n const wz = w * z2;\n\n dst[ 0] = 1 - yy - zz; dst[ 1] = yx + wz; dst[ 2] = zx - wy; dst[ 3] = 0;\n dst[ 4] = yx - wz; dst[ 5] = 1 - xx - zz; dst[ 6] = zy + wx; dst[ 7] = 0;\n dst[ 8] = zx + wy; dst[ 9] = zy - wx; dst[10] = 1 - xx - yy; dst[11] = 0;\n dst[12] = 0; dst[13] = 0; dst[14] = 0; dst[15] = 1;\n\n return dst;\n}\n\n/**\n * Negates a matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns -m.\n */\nexport function negate(m: Mat4, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n dst[ 0] = -m[ 0]; dst[ 1] = -m[ 1]; dst[ 2] = -m[ 2]; dst[ 3] = -m[ 3];\n dst[ 4] = -m[ 4]; dst[ 5] = -m[ 5]; dst[ 6] = -m[ 6]; dst[ 7] = -m[ 7];\n dst[ 8] = -m[ 8]; dst[ 9] = -m[ 9]; dst[10] = -m[10]; dst[11] = -m[11];\n dst[12] = -m[12]; dst[13] = -m[13]; dst[14] = -m[14]; dst[15] = -m[15];\n\n return dst;\n}\n\n/**\n * Copies a matrix. (same as {@link mat4.clone})\n * Also see {@link mat4.create} and {@link mat4.set}\n * @param m - The matrix.\n * @param dst - The matrix. If not passed a new one is created.\n * @returns A copy of m.\n */\nexport function copy(m: Mat4, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n dst[ 0] = m[ 0]; dst[ 1] = m[ 1]; dst[ 2] = m[ 2]; dst[ 3] = m[ 3];\n dst[ 4] = m[ 4]; dst[ 5] = m[ 5]; dst[ 6] = m[ 6]; dst[ 7] = m[ 7];\n dst[ 8] = m[ 8]; dst[ 9] = m[ 9]; dst[10] = m[10]; dst[11] = m[11];\n dst[12] = m[12]; dst[13] = m[13]; dst[14] = m[14]; dst[15] = m[15];\n\n return dst;\n}\n\n/**\n * Copies a matrix (same as {@link mat4.copy})\n * Also see {@link mat4.create} and {@link mat4.set}\n * @param m - The matrix.\n * @param dst - The matrix. If not passed a new one is created.\n * @returns A copy of m.\n */\nexport const clone = copy;\n\n/**\n * Check if 2 matrices are approximately equal\n * @param a - Operand matrix.\n * @param b - Operand matrix.\n * @returns true if matrices are approximately equal\n */\nexport function equalsApproximately(a: Mat4, b: Mat4): boolean {\n return Math.abs(a[ 0] - b[ 0]) < utils.EPSILON &&\n Math.abs(a[ 1] - b[ 1]) < utils.EPSILON &&\n Math.abs(a[ 2] - b[ 2]) < utils.EPSILON &&\n Math.abs(a[ 3] - b[ 3]) < utils.EPSILON &&\n Math.abs(a[ 4] - b[ 4]) < utils.EPSILON &&\n Math.abs(a[ 5] - b[ 5]) < utils.EPSILON &&\n Math.abs(a[ 6] - b[ 6]) < utils.EPSILON &&\n Math.abs(a[ 7] - b[ 7]) < utils.EPSILON &&\n Math.abs(a[ 8] - b[ 8]) < utils.EPSILON &&\n Math.abs(a[ 9] - b[ 9]) < utils.EPSILON &&\n Math.abs(a[10] - b[10]) < utils.EPSILON &&\n Math.abs(a[11] - b[11]) < utils.EPSILON &&\n Math.abs(a[12] - b[12]) < utils.EPSILON &&\n Math.abs(a[13] - b[13]) < utils.EPSILON &&\n Math.abs(a[14] - b[14]) < utils.EPSILON &&\n Math.abs(a[15] - b[15]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 matrices are exactly equal\n * @param a - Operand matrix.\n * @param b - Operand matrix.\n * @returns true if matrices are exactly equal\n */\nexport function equals(a: Mat4, b: Mat4): boolean {\n return a[ 0] === b[ 0] &&\n a[ 1] === b[ 1] &&\n a[ 2] === b[ 2] &&\n a[ 3] === b[ 3] &&\n a[ 4] === b[ 4] &&\n a[ 5] === b[ 5] &&\n a[ 6] === b[ 6] &&\n a[ 7] === b[ 7] &&\n a[ 8] === b[ 8] &&\n a[ 9] === b[ 9] &&\n a[10] === b[10] &&\n a[11] === b[11] &&\n a[12] === b[12] &&\n a[13] === b[13] &&\n a[14] === b[14] &&\n a[15] === b[15];\n}\n\n/**\n * Creates a 4-by-4 identity matrix.\n *\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns A 4-by-4 identity matrix.\n */\nexport function identity(dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n dst[ 0] = 1; dst[ 1] = 0; dst[ 2] = 0; dst[ 3] = 0;\n dst[ 4] = 0; dst[ 5] = 1; dst[ 6] = 0; dst[ 7] = 0;\n dst[ 8] = 0; dst[ 9] = 0; dst[10] = 1; dst[11] = 0;\n dst[12] = 0; dst[13] = 0; dst[14] = 0; dst[15] = 1;\n\n return dst;\n}\n\n/**\n * Takes the transpose of a matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The transpose of m.\n */\nexport function transpose(m: Mat4, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n if (dst === m) {\n let t;\n\n t = m[1];\n m[1] = m[4];\n m[4] = t;\n\n t = m[2];\n m[2] = m[8];\n m[8] = t;\n\n t = m[3];\n m[3] = m[12];\n m[12] = t;\n\n t = m[6];\n m[6] = m[9];\n m[9] = t;\n\n t = m[7];\n m[7] = m[13];\n m[13] = t;\n\n t = m[11];\n m[11] = m[14];\n m[14] = t;\n return dst;\n }\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const m30 = m[3 * 4 + 0];\n const m31 = m[3 * 4 + 1];\n const m32 = m[3 * 4 + 2];\n const m33 = m[3 * 4 + 3];\n\n dst[ 0] = m00; dst[ 1] = m10; dst[ 2] = m20; dst[ 3] = m30;\n dst[ 4] = m01; dst[ 5] = m11; dst[ 6] = m21; dst[ 7] = m31;\n dst[ 8] = m02; dst[ 9] = m12; dst[10] = m22; dst[11] = m32;\n dst[12] = m03; dst[13] = m13; dst[14] = m23; dst[15] = m33;\n\n return dst;\n}\n\n/**\n * Computes the inverse of a 4-by-4 matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The inverse of m.\n */\nexport function inverse(m: Mat4, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const m30 = m[3 * 4 + 0];\n const m31 = m[3 * 4 + 1];\n const m32 = m[3 * 4 + 2];\n const m33 = m[3 * 4 + 3];\n const tmp0 = m22 * m33;\n const tmp1 = m32 * m23;\n const tmp2 = m12 * m33;\n const tmp3 = m32 * m13;\n const tmp4 = m12 * m23;\n const tmp5 = m22 * m13;\n const tmp6 = m02 * m33;\n const tmp7 = m32 * m03;\n const tmp8 = m02 * m23;\n const tmp9 = m22 * m03;\n const tmp10 = m02 * m13;\n const tmp11 = m12 * m03;\n const tmp12 = m20 * m31;\n const tmp13 = m30 * m21;\n const tmp14 = m10 * m31;\n const tmp15 = m30 * m11;\n const tmp16 = m10 * m21;\n const tmp17 = m20 * m11;\n const tmp18 = m00 * m31;\n const tmp19 = m30 * m01;\n const tmp20 = m00 * m21;\n const tmp21 = m20 * m01;\n const tmp22 = m00 * m11;\n const tmp23 = m10 * m01;\n\n const t0 = (tmp0 * m11 + tmp3 * m21 + tmp4 * m31) -\n (tmp1 * m11 + tmp2 * m21 + tmp5 * m31);\n const t1 = (tmp1 * m01 + tmp6 * m21 + tmp9 * m31) -\n (tmp0 * m01 + tmp7 * m21 + tmp8 * m31);\n const t2 = (tmp2 * m01 + tmp7 * m11 + tmp10 * m31) -\n (tmp3 * m01 + tmp6 * m11 + tmp11 * m31);\n const t3 = (tmp5 * m01 + tmp8 * m11 + tmp11 * m21) -\n (tmp4 * m01 + tmp9 * m11 + tmp10 * m21);\n\n const d = 1 / (m00 * t0 + m10 * t1 + m20 * t2 + m30 * t3);\n\n dst[ 0] = d * t0;\n dst[ 1] = d * t1;\n dst[ 2] = d * t2;\n dst[ 3] = d * t3;\n dst[ 4] = d * ((tmp1 * m10 + tmp2 * m20 + tmp5 * m30) -\n (tmp0 * m10 + tmp3 * m20 + tmp4 * m30));\n dst[ 5] = d * ((tmp0 * m00 + tmp7 * m20 + tmp8 * m30) -\n (tmp1 * m00 + tmp6 * m20 + tmp9 * m30));\n dst[ 6] = d * ((tmp3 * m00 + tmp6 * m10 + tmp11 * m30) -\n (tmp2 * m00 + tmp7 * m10 + tmp10 * m30));\n dst[ 7] = d * ((tmp4 * m00 + tmp9 * m10 + tmp10 * m20) -\n (tmp5 * m00 + tmp8 * m10 + tmp11 * m20));\n dst[ 8] = d * ((tmp12 * m13 + tmp15 * m23 + tmp16 * m33) -\n (tmp13 * m13 + tmp14 * m23 + tmp17 * m33));\n dst[ 9] = d * ((tmp13 * m03 + tmp18 * m23 + tmp21 * m33) -\n (tmp12 * m03 + tmp19 * m23 + tmp20 * m33));\n dst[10] = d * ((tmp14 * m03 + tmp19 * m13 + tmp22 * m33) -\n (tmp15 * m03 + tmp18 * m13 + tmp23 * m33));\n dst[11] = d * ((tmp17 * m03 + tmp20 * m13 + tmp23 * m23) -\n (tmp16 * m03 + tmp21 * m13 + tmp22 * m23));\n dst[12] = d * ((tmp14 * m22 + tmp17 * m32 + tmp13 * m12) -\n (tmp16 * m32 + tmp12 * m12 + tmp15 * m22));\n dst[13] = d * ((tmp20 * m32 + tmp12 * m02 + tmp19 * m22) -\n (tmp18 * m22 + tmp21 * m32 + tmp13 * m02));\n dst[14] = d * ((tmp18 * m12 + tmp23 * m32 + tmp15 * m02) -\n (tmp22 * m32 + tmp14 * m02 + tmp19 * m12));\n dst[15] = d * ((tmp22 * m22 + tmp16 * m02 + tmp21 * m12) -\n (tmp20 * m12 + tmp23 * m22 + tmp17 * m02));\n\n return dst;\n}\n\n/**\n * Compute the determinant of a matrix\n * @param m - the matrix\n * @returns the determinant\n */\nexport function determinant(m: Mat4): number {\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const m30 = m[3 * 4 + 0];\n const m31 = m[3 * 4 + 1];\n const m32 = m[3 * 4 + 2];\n const m33 = m[3 * 4 + 3];\n\n const tmp0 = m22 * m33;\n const tmp1 = m32 * m23;\n const tmp2 = m12 * m33;\n const tmp3 = m32 * m13;\n const tmp4 = m12 * m23;\n const tmp5 = m22 * m13;\n const tmp6 = m02 * m33;\n const tmp7 = m32 * m03;\n const tmp8 = m02 * m23;\n const tmp9 = m22 * m03;\n const tmp10 = m02 * m13;\n const tmp11 = m12 * m03;\n\n const t0 = (tmp0 * m11 + tmp3 * m21 + tmp4 * m31) -\n (tmp1 * m11 + tmp2 * m21 + tmp5 * m31);\n const t1 = (tmp1 * m01 + tmp6 * m21 + tmp9 * m31) -\n (tmp0 * m01 + tmp7 * m21 + tmp8 * m31);\n const t2 = (tmp2 * m01 + tmp7 * m11 + tmp10 * m31) -\n (tmp3 * m01 + tmp6 * m11 + tmp11 * m31);\n const t3 = (tmp5 * m01 + tmp8 * m11 + tmp11 * m21) -\n (tmp4 * m01 + tmp9 * m11 + tmp10 * m21);\n\n return m00 * t0 + m10 * t1 + m20 * t2 + m30 * t3;\n}\n\n/**\n * Computes the inverse of a 4-by-4 matrix. (same as inverse)\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The inverse of m.\n */\nexport const invert = inverse;\n\n/**\n * Multiplies two 4-by-4 matrices with a on the left and b on the right\n * @param a - The matrix on the left.\n * @param b - The matrix on the right.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix product of a and b.\n */\nexport function multiply(a: Mat4, b: Mat4, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a03 = a[3];\n const a10 = a[ 4 + 0];\n const a11 = a[ 4 + 1];\n const a12 = a[ 4 + 2];\n const a13 = a[ 4 + 3];\n const a20 = a[ 8 + 0];\n const a21 = a[ 8 + 1];\n const a22 = a[ 8 + 2];\n const a23 = a[ 8 + 3];\n const a30 = a[12 + 0];\n const a31 = a[12 + 1];\n const a32 = a[12 + 2];\n const a33 = a[12 + 3];\n const b00 = b[0];\n const b01 = b[1];\n const b02 = b[2];\n const b03 = b[3];\n const b10 = b[ 4 + 0];\n const b11 = b[ 4 + 1];\n const b12 = b[ 4 + 2];\n const b13 = b[ 4 + 3];\n const b20 = b[ 8 + 0];\n const b21 = b[ 8 + 1];\n const b22 = b[ 8 + 2];\n const b23 = b[ 8 + 3];\n const b30 = b[12 + 0];\n const b31 = b[12 + 1];\n const b32 = b[12 + 2];\n const b33 = b[12 + 3];\n\n dst[ 0] = a00 * b00 + a10 * b01 + a20 * b02 + a30 * b03;\n dst[ 1] = a01 * b00 + a11 * b01 + a21 * b02 + a31 * b03;\n dst[ 2] = a02 * b00 + a12 * b01 + a22 * b02 + a32 * b03;\n dst[ 3] = a03 * b00 + a13 * b01 + a23 * b02 + a33 * b03;\n dst[ 4] = a00 * b10 + a10 * b11 + a20 * b12 + a30 * b13;\n dst[ 5] = a01 * b10 + a11 * b11 + a21 * b12 + a31 * b13;\n dst[ 6] = a02 * b10 + a12 * b11 + a22 * b12 + a32 * b13;\n dst[ 7] = a03 * b10 + a13 * b11 + a23 * b12 + a33 * b13;\n dst[ 8] = a00 * b20 + a10 * b21 + a20 * b22 + a30 * b23;\n dst[ 9] = a01 * b20 + a11 * b21 + a21 * b22 + a31 * b23;\n dst[10] = a02 * b20 + a12 * b21 + a22 * b22 + a32 * b23;\n dst[11] = a03 * b20 + a13 * b21 + a23 * b22 + a33 * b23;\n dst[12] = a00 * b30 + a10 * b31 + a20 * b32 + a30 * b33;\n dst[13] = a01 * b30 + a11 * b31 + a21 * b32 + a31 * b33;\n dst[14] = a02 * b30 + a12 * b31 + a22 * b32 + a32 * b33;\n dst[15] = a03 * b30 + a13 * b31 + a23 * b32 + a33 * b33;\n\n return dst;\n}\n\n/**\n * Multiplies two 4-by-4 matrices with a on the left and b on the right (same as multiply)\n * @param a - The matrix on the left.\n * @param b - The matrix on the right.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix product of a and b.\n */\nexport const mul = multiply;\n\n/**\n * Sets the translation component of a 4-by-4 matrix to the given\n * vector.\n * @param a - The matrix.\n * @param v - The vector.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix with translation set.\n */\nexport function setTranslation(a: Mat4, v: Vec3, dst?: Mat4): Mat4 {\n dst = dst || identity();\n if (a !== dst) {\n dst[ 0] = a[ 0];\n dst[ 1] = a[ 1];\n dst[ 2] = a[ 2];\n dst[ 3] = a[ 3];\n dst[ 4] = a[ 4];\n dst[ 5] = a[ 5];\n dst[ 6] = a[ 6];\n dst[ 7] = a[ 7];\n dst[ 8] = a[ 8];\n dst[ 9] = a[ 9];\n dst[10] = a[10];\n dst[11] = a[11];\n }\n dst[12] = v[0];\n dst[13] = v[1];\n dst[14] = v[2];\n dst[15] = 1;\n return dst;\n}\n\n/**\n * Returns the translation component of a 4-by-4 matrix as a vector with 3\n * entries.\n * @param m - The matrix.\n * @param dst - vector to hold result. If not passed a new one is created.\n * @returns The translation component of m.\n */\nexport function getTranslation(m: Mat4, dst?: Vec3): Vec3 {\n dst = dst || vec3.create();\n dst[0] = m[12];\n dst[1] = m[13];\n dst[2] = m[14];\n return dst;\n}\n\n/**\n * Returns an axis of a 4x4 matrix as a vector with 3 entries\n * @param m - The matrix.\n * @param axis - The axis 0 = x, 1 = y, 2 = z;\n * @returns The axis component of m.\n */\nexport function getAxis(m: Mat4, axis: number, dst?: Vec3): Vec3 {\n dst = dst || vec3.create();\n const off = axis * 4;\n dst[0] = m[off + 0];\n dst[1] = m[off + 1];\n dst[2] = m[off + 2];\n return dst;\n}\n\n/**\n * Sets an axis of a 4x4 matrix as a vector with 3 entries\n * @param m - The matrix.\n * @param v - the axis vector\n * @param axis - The axis 0 = x, 1 = y, 2 = z;\n * @param dst - The matrix to set. If not passed a new one is created.\n * @returns The matrix with axis set.\n */\nexport function setAxis(m: Mat4, v: Vec3, axis: number, dst: Mat4): Mat4 {\n if (dst !== m) {\n dst = copy(m, dst);\n }\n const off = axis * 4;\n dst[off + 0] = v[0];\n dst[off + 1] = v[1];\n dst[off + 2] = v[2];\n return dst;\n}\n\n/**\n * Returns the scaling component of the matrix\n * @param m - The Matrix\n * @param dst - The vector to set. If not passed a new one is created.\n */\nexport function getScaling(m: Mat4, dst?: Vec3): Vec3 {\n dst = dst || vec3.create();\n\n const xx = m[0];\n const xy = m[1];\n const xz = m[2];\n const yx = m[4];\n const yy = m[5];\n const yz = m[6];\n const zx = m[8];\n const zy = m[9];\n const zz = m[10];\n\n dst[0] = Math.sqrt(xx * xx + xy * xy + xz * xz);\n dst[1] = Math.sqrt(yx * yx + yy * yy + yz * yz);\n dst[2] = Math.sqrt(zx * zx + zy * zy + zz * zz);\n\n return dst;\n}\n\n/**\n * Computes a 4-by-4 perspective transformation matrix given the angular height\n * of the frustum, the aspect ratio, and the near and far clipping planes. The\n * arguments define a frustum extending in the negative z direction. The given\n * angle is the vertical angle of the frustum, and the horizontal angle is\n * determined to produce the given aspect ratio. The arguments near and far are\n * the distances to the near and far clipping planes. Note that near and far\n * are not z coordinates, but rather they are distances along the negative\n * z-axis. The matrix generated sends the viewing frustum to the unit box.\n * We assume a unit box extending from -1 to 1 in the x and y dimensions and\n * from 0 to 1 in the z dimension.\n *\n * Note: If you pass `Infinity` for zFar then it will produce a projection matrix\n * returns -Infinity for Z when transforming coordinates with Z <= 0 and +Infinity for Z\n * otherwise.\n *\n * @param fieldOfViewYInRadians - The camera angle from top to bottom (in radians).\n * @param aspect - The aspect ratio width / height.\n * @param zNear - The depth (negative z coordinate)\n * of the near clipping plane.\n * @param zFar - The depth (negative z coordinate)\n * of the far clipping plane.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The perspective matrix.\n */\nexport function perspective(fieldOfViewYInRadians: number, aspect: number, zNear: number, zFar: number, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n const f = Math.tan(Math.PI * 0.5 - 0.5 * fieldOfViewYInRadians);\n\n dst[0] = f / aspect;\n dst[1] = 0;\n dst[2] = 0;\n dst[3] = 0;\n\n dst[4] = 0;\n dst[5] = f;\n dst[6] = 0;\n dst[7] = 0;\n\n dst[8] = 0;\n dst[9] = 0;\n dst[11] = -1;\n\n dst[12] = 0;\n dst[13] = 0;\n dst[15] = 0;\n\n if (Number.isFinite(zFar)) {\n const rangeInv = 1 / (zNear - zFar);\n dst[10] = zFar * rangeInv;\n dst[14] = zFar * zNear * rangeInv;\n } else {\n dst[10] = -1;\n dst[14] = -zNear;\n }\n\n return dst;\n}\n\n/**\n * Computes a 4-by-4 reverse-z perspective transformation matrix given the angular height\n * of the frustum, the aspect ratio, and the near and far clipping planes. The\n * arguments define a frustum extending in the negative z direction. The given\n * angle is the vertical angle of the frustum, and the horizontal angle is\n * determined to produce the given aspect ratio. The arguments near and far are\n * the distances to the near and far clipping planes. Note that near and far\n * are not z coordinates, but rather they are distances along the negative\n * z-axis. The matrix generated sends the viewing frustum to the unit box.\n * We assume a unit box extending from -1 to 1 in the x and y dimensions and\n * from 1 (at -zNear) to 0 (at -zFar) in the z dimension.\n *\n * @param fieldOfViewYInRadians - The camera angle from top to bottom (in radians).\n * @param aspect - The aspect ratio width / height.\n * @param zNear - The depth (negative z coordinate)\n * of the near clipping plane.\n * @param zFar - The depth (negative z coordinate)\n * of the far clipping plane. (default = Infinity)\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The perspective matrix.\n */export function perspectiveReverseZ(fieldOfViewYInRadians: number, aspect: number, zNear: number, zFar = Infinity, dst?: Mat4) {\n dst = dst || new MatType(16);\n\n const f = 1 / Math.tan(fieldOfViewYInRadians * 0.5);\n\n dst[ 0] = f / aspect;\n dst[ 1] = 0;\n dst[ 2] = 0;\n dst[ 3] = 0;\n\n dst[ 4] = 0;\n dst[ 5] = f;\n dst[ 6] = 0;\n dst[ 7] = 0;\n\n dst[ 8] = 0;\n dst[ 9] = 0;\n dst[11] = -1;\n\n dst[12] = 0;\n dst[13] = 0;\n dst[15] = 0;\n\n if (zFar === Infinity) {\n dst[10] = 0;\n dst[14] = zNear;\n } else {\n const rangeInv = 1 / (zFar - zNear);\n dst[10] = zNear * rangeInv;\n dst[14] = zFar * zNear * rangeInv;\n }\n\n return dst;\n}\n\n/**\n * Computes a 4-by-4 orthogonal transformation matrix that transforms from\n * the given the left, right, bottom, and top dimensions to -1 +1 in x, and y\n * and 0 to +1 in z.\n * @param left - Left side of the near clipping plane viewport.\n * @param right - Right side of the near clipping plane viewport.\n * @param bottom - Bottom of the near clipping plane viewport.\n * @param top - Top of the near clipping plane viewport.\n * @param near - The depth (negative z coordinate)\n * of the near clipping plane.\n * @param far - The depth (negative z coordinate)\n * of the far clipping plane.\n * @param dst - Output matrix. If not passed a new one is created.\n * @returns The orthographic projection matrix.\n */\nexport function ortho(left: number, right: number, bottom: number, top: number, near: number, far: number, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n dst[0] = 2 / (right - left);\n dst[1] = 0;\n dst[2] = 0;\n dst[3] = 0;\n\n dst[4] = 0;\n dst[5] = 2 / (top - bottom);\n dst[6] = 0;\n dst[7] = 0;\n\n dst[8] = 0;\n dst[9] = 0;\n dst[10] = 1 / (near - far);\n dst[11] = 0;\n\n dst[12] = (right + left) / (left - right);\n dst[13] = (top + bottom) / (bottom - top);\n dst[14] = near / (near - far);\n dst[15] = 1;\n\n return dst;\n}\n\n/**\n * Computes a 4-by-4 perspective transformation matrix given the left, right,\n * top, bottom, near and far clipping planes. The arguments define a frustum\n * extending in the negative z direction. The arguments near and far are the\n * distances to the near and far clipping planes. Note that near and far are not\n * z coordinates, but rather they are distances along the negative z-axis. The\n * matrix generated sends the viewing frustum to the unit box. We assume a unit\n * box extending from -1 to 1 in the x and y dimensions and from 0 to 1 in the z\n * dimension.\n * @param left - The x coordinate of the left plane of the box.\n * @param right - The x coordinate of the right plane of the box.\n * @param bottom - The y coordinate of the bottom plane of the box.\n * @param top - The y coordinate of the right plane of the box.\n * @param near - The negative z coordinate of the near plane of the box.\n * @param far - The negative z coordinate of the far plane of the box.\n * @param dst - Output matrix. If not passed a new one is created.\n * @returns The perspective projection matrix.\n */\nexport function frustum(left: number, right: number, bottom: number, top: number, near: number, far: number, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n const dx = (right - left);\n const dy = (top - bottom);\n const dz = (near - far);\n\n dst[ 0] = 2 * near / dx;\n dst[ 1] = 0;\n dst[ 2] = 0;\n dst[ 3] = 0;\n dst[ 4] = 0;\n dst[ 5] = 2 * near / dy;\n dst[ 6] = 0;\n dst[ 7] = 0;\n dst[ 8] = (left + right) / dx;\n dst[ 9] = (top + bottom) / dy;\n dst[10] = far / dz;\n dst[11] = -1;\n dst[12] = 0;\n dst[13] = 0;\n dst[14] = near * far / dz;\n dst[15] = 0;\n\n return dst;\n}\n\n/**\n * Computes a 4-by-4 reverse-z perspective transformation matrix given the left, right,\n * top, bottom, near and far clipping planes. The arguments define a frustum\n * extending in the negative z direction. The arguments near and far are the\n * distances to the near and far clipping planes. Note that near and far are not\n * z coordinates, but rather they are distances along the negative z-axis. The\n * matrix generated sends the viewing frustum to the unit box. We assume a unit\n * box extending from -1 to 1 in the x and y dimensions and from 1 (-near) to 0 (-far) in the z\n * dimension.\n * @param left - The x coordinate of the left plane of the box.\n * @param right - The x coordinate of the right plane of the box.\n * @param bottom - The y coordinate of the bottom plane of the box.\n * @param top - The y coordinate of the right plane of the box.\n * @param near - The negative z coordinate of the near plane of the box.\n * @param far - The negative z coordinate of the far plane of the box.\n * @param dst - Output matrix. If not passed a new one is created.\n * @returns The perspective projection matrix.\n */\nexport function frustumReverseZ(left: number, right: number, bottom: number, top: number, near: number, far = Infinity, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n const dx = (right - left);\n const dy = (top - bottom);\n\n dst[ 0] = 2 * near / dx;\n dst[ 1] = 0;\n dst[ 2] = 0;\n dst[ 3] = 0;\n dst[ 4] = 0;\n dst[ 5] = 2 * near / dy;\n dst[ 6] = 0;\n dst[ 7] = 0;\n dst[ 8] = (left + right) / dx;\n dst[ 9] = (top + bottom) / dy;\n dst[11] = -1;\n dst[12] = 0;\n dst[13] = 0;\n dst[15] = 0;\n\n if (far === Infinity) {\n dst[10] = 0;\n dst[14] = near;\n } else {\n const rangeInv = 1 / (far - near);\n dst[10] = near * rangeInv;\n dst[14] = far * near * rangeInv;\n }\n\n return dst;\n}\n\nlet xAxis: Vec3;\nlet yAxis: Vec3;\nlet zAxis: Vec3;\n\n/**\n * Computes a 4-by-4 aim transformation.\n *\n * This is a matrix which positions an object aiming down positive Z.\n * toward the target.\n *\n * Note: this is **NOT** the inverse of lookAt as lookAt looks at negative Z.\n *\n * @param position - The position of the object.\n * @param target - The position meant to be aimed at.\n * @param up - A vector pointing up.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The aim matrix.\n */\nexport function aim(position: Vec3, target: Vec3, up: Vec3, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n xAxis = xAxis || vec3.create();\n yAxis = yAxis || vec3.create();\n zAxis = zAxis || vec3.create();\n\n vec3.normalize(vec3.subtract(target, position, zAxis), zAxis);\n vec3.normalize(vec3.cross(up, zAxis, xAxis), xAxis);\n vec3.normalize(vec3.cross(zAxis, xAxis, yAxis), yAxis);\n\n dst[ 0] = xAxis[0]; dst[ 1] = xAxis[1]; dst[ 2] = xAxis[2]; dst[ 3] = 0;\n dst[ 4] = yAxis[0]; dst[ 5] = yAxis[1]; dst[ 6] = yAxis[2]; dst[ 7] = 0;\n dst[ 8] = zAxis[0]; dst[ 9] = zAxis[1]; dst[10] = zAxis[2]; dst[11] = 0;\n dst[12] = position[0]; dst[13] = position[1]; dst[14] = position[2]; dst[15] = 1;\n\n return dst;\n}\n\n/**\n * Computes a 4-by-4 camera aim transformation.\n *\n * This is a matrix which positions an object aiming down negative Z.\n * toward the target.\n *\n * Note: this is the inverse of `lookAt`\n *\n * @param eye - The position of the object.\n * @param target - The position meant to be aimed at.\n * @param up - A vector pointing up.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The aim matrix.\n */\nexport function cameraAim(eye: Vec3, target: Vec3, up: Vec3, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n xAxis = xAxis || vec3.create();\n yAxis = yAxis || vec3.create();\n zAxis = zAxis || vec3.create();\n\n vec3.normalize(vec3.subtract(eye, target, zAxis), zAxis);\n vec3.normalize(vec3.cross(up, zAxis, xAxis), xAxis);\n vec3.normalize(vec3.cross(zAxis, xAxis, yAxis), yAxis);\n\n dst[ 0] = xAxis[0]; dst[ 1] = xAxis[1]; dst[ 2] = xAxis[2]; dst[ 3] = 0;\n dst[ 4] = yAxis[0]; dst[ 5] = yAxis[1]; dst[ 6] = yAxis[2]; dst[ 7] = 0;\n dst[ 8] = zAxis[0]; dst[ 9] = zAxis[1]; dst[10] = zAxis[2]; dst[11] = 0;\n dst[12] = eye[0]; dst[13] = eye[1]; dst[14] = eye[2]; dst[15] = 1;\n\n return dst;\n}\n\n/**\n * Computes a 4-by-4 view transformation.\n *\n * This is a view matrix which transforms all other objects\n * to be in the space of the view defined by the parameters.\n *\n * @param eye - The position of the object.\n * @param target - The position meant to be aimed at.\n * @param up - A vector pointing up.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The look-at matrix.\n */\nexport function lookAt(eye: Vec3, target: Vec3, up: Vec3, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n xAxis = xAxis || vec3.create();\n yAxis = yAxis || vec3.create();\n zAxis = zAxis || vec3.create();\n\n vec3.normalize(vec3.subtract(eye, target, zAxis), zAxis);\n vec3.normalize(vec3.cross(up, zAxis, xAxis), xAxis);\n vec3.normalize(vec3.cross(zAxis, xAxis, yAxis), yAxis);\n\n dst[ 0] = xAxis[0]; dst[ 1] = yAxis[0]; dst[ 2] = zAxis[0]; dst[ 3] = 0;\n dst[ 4] = xAxis[1]; dst[ 5] = yAxis[1]; dst[ 6] = zAxis[1]; dst[ 7] = 0;\n dst[ 8] = xAxis[2]; dst[ 9] = yAxis[2]; dst[10] = zAxis[2]; dst[11] = 0;\n\n dst[12] = -(xAxis[0] * eye[0] + xAxis[1] * eye[1] + xAxis[2] * eye[2]);\n dst[13] = -(yAxis[0] * eye[0] + yAxis[1] * eye[1] + yAxis[2] * eye[2]);\n dst[14] = -(zAxis[0] * eye[0] + zAxis[1] * eye[1] + zAxis[2] * eye[2]);\n dst[15] = 1;\n\n return dst;\n}\n\n/**\n * Creates a 4-by-4 matrix which translates by the given vector v.\n * @param v - The vector by\n * which to translate.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The translation matrix.\n */\nexport function translation(v: Vec3, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n dst[ 0] = 1; dst[ 1] = 0; dst[ 2] = 0; dst[ 3] = 0;\n dst[ 4] = 0; dst[ 5] = 1; dst[ 6] = 0; dst[ 7] = 0;\n dst[ 8] = 0; dst[ 9] = 0; dst[10] = 1; dst[11] = 0;\n dst[12] = v[0]; dst[13] = v[1]; dst[14] = v[2]; dst[15] = 1;\n\n return dst;\n}\n\n/**\n * Translates the given 4-by-4 matrix by the given vector v.\n * @param m - The matrix.\n * @param v - The vector by\n * which to translate.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The translated matrix.\n */\nexport function translate(m: Mat4, v: Vec3, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const m00 = m[0];\n const m01 = m[1];\n const m02 = m[2];\n const m03 = m[3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const m30 = m[3 * 4 + 0];\n const m31 = m[3 * 4 + 1];\n const m32 = m[3 * 4 + 2];\n const m33 = m[3 * 4 + 3];\n\n if (m !== dst) {\n dst[ 0] = m00;\n dst[ 1] = m01;\n dst[ 2] = m02;\n dst[ 3] = m03;\n dst[ 4] = m10;\n dst[ 5] = m11;\n dst[ 6] = m12;\n dst[ 7] = m13;\n dst[ 8] = m20;\n dst[ 9] = m21;\n dst[10] = m22;\n dst[11] = m23;\n }\n\n dst[12] = m00 * v0 + m10 * v1 + m20 * v2 + m30;\n dst[13] = m01 * v0 + m11 * v1 + m21 * v2 + m31;\n dst[14] = m02 * v0 + m12 * v1 + m22 * v2 + m32;\n dst[15] = m03 * v0 + m13 * v1 + m23 * v2 + m33;\n\n return dst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the x-axis by the given angle.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotation matrix.\n */\nexport function rotationX(angleInRadians: number, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n dst[ 0] = 1; dst[ 1] = 0; dst[ 2] = 0; dst[ 3] = 0;\n dst[ 4] = 0; dst[ 5] = c; dst[ 6] = s; dst[ 7] = 0;\n dst[ 8] = 0; dst[ 9] = -s; dst[10] = c; dst[11] = 0;\n dst[12] = 0; dst[13] = 0; dst[14] = 0; dst[15] = 1;\n\n return dst;\n}\n\n/**\n * Rotates the given 4-by-4 matrix around the x-axis by the given\n * angle.\n * @param m - The matrix.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nexport function rotateX(m: Mat4, angleInRadians: number, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n const m10 = m[4];\n const m11 = m[5];\n const m12 = m[6];\n const m13 = m[7];\n const m20 = m[8];\n const m21 = m[9];\n const m22 = m[10];\n const m23 = m[11];\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n dst[4] = c * m10 + s * m20;\n dst[5] = c * m11 + s * m21;\n dst[6] = c * m12 + s * m22;\n dst[7] = c * m13 + s * m23;\n dst[8] = c * m20 - s * m10;\n dst[9] = c * m21 - s * m11;\n dst[10] = c * m22 - s * m12;\n dst[11] = c * m23 - s * m13;\n\n if (m !== dst) {\n dst[ 0] = m[ 0];\n dst[ 1] = m[ 1];\n dst[ 2] = m[ 2];\n dst[ 3] = m[ 3];\n dst[12] = m[12];\n dst[13] = m[13];\n dst[14] = m[14];\n dst[15] = m[15];\n }\n\n return dst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the y-axis by the given angle.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotation matrix.\n */\nexport function rotationY(angleInRadians: number, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n dst[ 0] = c; dst[ 1] = 0; dst[ 2] = -s; dst[ 3] = 0;\n dst[ 4] = 0; dst[ 5] = 1; dst[ 6] = 0; dst[ 7] = 0;\n dst[ 8] = s; dst[ 9] = 0; dst[10] = c; dst[11] = 0;\n dst[12] = 0; dst[13] = 0; dst[14] = 0; dst[15] = 1;\n\n return dst;\n}\n\n/**\n * Rotates the given 4-by-4 matrix around the y-axis by the given\n * angle.\n * @param m - The matrix.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nexport function rotateY(m: Mat4, angleInRadians: number, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n dst[ 0] = c * m00 - s * m20;\n dst[ 1] = c * m01 - s * m21;\n dst[ 2] = c * m02 - s * m22;\n dst[ 3] = c * m03 - s * m23;\n dst[ 8] = c * m20 + s * m00;\n dst[ 9] = c * m21 + s * m01;\n dst[10] = c * m22 + s * m02;\n dst[11] = c * m23 + s * m03;\n\n if (m !== dst) {\n dst[ 4] = m[ 4];\n dst[ 5] = m[ 5];\n dst[ 6] = m[ 6];\n dst[ 7] = m[ 7];\n dst[12] = m[12];\n dst[13] = m[13];\n dst[14] = m[14];\n dst[15] = m[15];\n }\n\n return dst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the z-axis by the given angle.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotation matrix.\n */\nexport function rotationZ(angleInRadians: number, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n dst[ 0] = c; dst[ 1] = s; dst[ 2] = 0; dst[ 3] = 0;\n dst[ 4] = -s; dst[ 5] = c; dst[ 6] = 0; dst[ 7] = 0;\n dst[ 8] = 0; dst[ 9] = 0; dst[10] = 1; dst[11] = 0;\n dst[12] = 0; dst[13] = 0; dst[14] = 0; dst[15] = 1;\n\n return dst;\n}\n\n/**\n * Rotates the given 4-by-4 matrix around the z-axis by the given\n * angle.\n * @param m - The matrix.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nexport function rotateZ(m: Mat4, angleInRadians: number, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n dst[ 0] = c * m00 + s * m10;\n dst[ 1] = c * m01 + s * m11;\n dst[ 2] = c * m02 + s * m12;\n dst[ 3] = c * m03 + s * m13;\n dst[ 4] = c * m10 - s * m00;\n dst[ 5] = c * m11 - s * m01;\n dst[ 6] = c * m12 - s * m02;\n dst[ 7] = c * m13 - s * m03;\n\n if (m !== dst) {\n dst[ 8] = m[ 8];\n dst[ 9] = m[ 9];\n dst[10] = m[10];\n dst[11] = m[11];\n dst[12] = m[12];\n dst[13] = m[13];\n dst[14] = m[14];\n dst[15] = m[15];\n }\n\n return dst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the given axis by the given\n * angle.\n * @param axis - The axis\n * about which to rotate.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns A matrix which rotates angle radians\n * around the axis.\n */\nexport function axisRotation(axis: Vec3, angleInRadians: number, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n let x = axis[0];\n let y = axis[1];\n let z = axis[2];\n const n = Math.sqrt(x * x + y * y + z * z);\n x /= n;\n y /= n;\n z /= n;\n const xx = x * x;\n const yy = y * y;\n const zz = z * z;\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n const oneMinusCosine = 1 - c;\n\n dst[ 0] = xx + (1 - xx) * c;\n dst[ 1] = x * y * oneMinusCosine + z * s;\n dst[ 2] = x * z * oneMinusCosine - y * s;\n dst[ 3] = 0;\n dst[ 4] = x * y * oneMinusCosine - z * s;\n dst[ 5] = yy + (1 - yy) * c;\n dst[ 6] = y * z * oneMinusCosine + x * s;\n dst[ 7] = 0;\n dst[ 8] = x * z * oneMinusCosine + y * s;\n dst[ 9] = y * z * oneMinusCosine - x * s;\n dst[10] = zz + (1 - zz) * c;\n dst[11] = 0;\n dst[12] = 0;\n dst[13] = 0;\n dst[14] = 0;\n dst[15] = 1;\n\n return dst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the given axis by the given\n * angle. (same as axisRotation)\n * @param axis - The axis\n * about which to rotate.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns A matrix which rotates angle radians\n * around the axis.\n */\nexport const rotation = axisRotation;\n\n/**\n * Rotates the given 4-by-4 matrix around the given axis by the\n * given angle.\n * @param m - The matrix.\n * @param axis - The axis\n * about which to rotate.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nexport function axisRotate(m: Mat4, axis: Vec3, angleInRadians: number, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n let x = axis[0];\n let y = axis[1];\n let z = axis[2];\n const n = Math.sqrt(x * x + y * y + z * z);\n x /= n;\n y /= n;\n z /= n;\n const xx = x * x;\n const yy = y * y;\n const zz = z * z;\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n const oneMinusCosine = 1 - c;\n\n const r00 = xx + (1 - xx) * c;\n const r01 = x * y * oneMinusCosine + z * s;\n const r02 = x * z * oneMinusCosine - y * s;\n const r10 = x * y * oneMinusCosine - z * s;\n const r11 = yy + (1 - yy) * c;\n const r12 = y * z * oneMinusCosine + x * s;\n const r20 = x * z * oneMinusCosine + y * s;\n const r21 = y * z * oneMinusCosine - x * s;\n const r22 = zz + (1 - zz) * c;\n\n const m00 = m[0];\n const m01 = m[1];\n const m02 = m[2];\n const m03 = m[3];\n const m10 = m[4];\n const m11 = m[5];\n const m12 = m[6];\n const m13 = m[7];\n const m20 = m[8];\n const m21 = m[9];\n const m22 = m[10];\n const m23 = m[11];\n\n dst[ 0] = r00 * m00 + r01 * m10 + r02 * m20;\n dst[ 1] = r00 * m01 + r01 * m11 + r02 * m21;\n dst[ 2] = r00 * m02 + r01 * m12 + r02 * m22;\n dst[ 3] = r00 * m03 + r01 * m13 + r02 * m23;\n dst[ 4] = r10 * m00 + r11 * m10 + r12 * m20;\n dst[ 5] = r10 * m01 + r11 * m11 + r12 * m21;\n dst[ 6] = r10 * m02 + r11 * m12 + r12 * m22;\n dst[ 7] = r10 * m03 + r11 * m13 + r12 * m23;\n dst[ 8] = r20 * m00 + r21 * m10 + r22 * m20;\n dst[ 9] = r20 * m01 + r21 * m11 + r22 * m21;\n dst[10] = r20 * m02 + r21 * m12 + r22 * m22;\n dst[11] = r20 * m03 + r21 * m13 + r22 * m23;\n\n if (m !== dst) {\n dst[12] = m[12];\n dst[13] = m[13];\n dst[14] = m[14];\n dst[15] = m[15];\n }\n\n return dst;\n}\n\n/**\n * Rotates the given 4-by-4 matrix around the given axis by the\n * given angle. (same as rotate)\n * @param m - The matrix.\n * @param axis - The axis\n * about which to rotate.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nexport const rotate = axisRotate;\n\n/**\n * Creates a 4-by-4 matrix which scales in each dimension by an amount given by\n * the corresponding entry in the given vector; assumes the vector has three\n * entries.\n * @param v - A vector of\n * three entries specifying the factor by which to scale in each dimension.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaling matrix.\n */\nexport function scaling(v: Vec3, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n dst[ 0] = v[0]; dst[ 1] = 0; dst[ 2] = 0; dst[ 3] = 0;\n dst[ 4] = 0; dst[ 5] = v[1]; dst[ 6] = 0; dst[ 7] = 0;\n dst[ 8] = 0; dst[ 9] = 0; dst[10] = v[2]; dst[11] = 0;\n dst[12] = 0; dst[13] = 0; dst[14] = 0; dst[15] = 1;\n\n return dst;\n}\n\n/**\n * Scales the given 4-by-4 matrix in each dimension by an amount\n * given by the corresponding entry in the given vector; assumes the vector has\n * three entries.\n * @param m - The matrix to be modified.\n * @param v - A vector of three entries specifying the\n * factor by which to scale in each dimension.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaled matrix.\n */\nexport function scale(m: Mat4, v: Vec3, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n\n dst[ 0] = v0 * m[0 * 4 + 0];\n dst[ 1] = v0 * m[0 * 4 + 1];\n dst[ 2] = v0 * m[0 * 4 + 2];\n dst[ 3] = v0 * m[0 * 4 + 3];\n dst[ 4] = v1 * m[1 * 4 + 0];\n dst[ 5] = v1 * m[1 * 4 + 1];\n dst[ 6] = v1 * m[1 * 4 + 2];\n dst[ 7] = v1 * m[1 * 4 + 3];\n dst[ 8] = v2 * m[2 * 4 + 0];\n dst[ 9] = v2 * m[2 * 4 + 1];\n dst[10] = v2 * m[2 * 4 + 2];\n dst[11] = v2 * m[2 * 4 + 3];\n\n if (m !== dst) {\n dst[12] = m[12];\n dst[13] = m[13];\n dst[14] = m[14];\n dst[15] = m[15];\n }\n\n return dst;\n}\n\n/**\n * Creates a 4-by-4 matrix which scales a uniform amount in each dimension.\n * @param s - the amount to scale\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaling matrix.\n */\nexport function uniformScaling(s: number, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n dst[ 0] = s; dst[ 1] = 0; dst[ 2] = 0; dst[ 3] = 0;\n dst[ 4] = 0; dst[ 5] = s; dst[ 6] = 0; dst[ 7] = 0;\n dst[ 8] = 0; dst[ 9] = 0; dst[10] = s; dst[11] = 0;\n dst[12] = 0; dst[13] = 0; dst[14] = 0; dst[15] = 1;\n\n return dst;\n}\n\n/**\n * Scales the given 4-by-4 matrix in each dimension by a uniform scale.\n * @param m - The matrix to be modified.\n * @param s - The amount to scale.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaled matrix.\n */\nexport function uniformScale(m: Mat4, s: number, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n dst[ 0] = s * m[0 * 4 + 0];\n dst[ 1] = s * m[0 * 4 + 1];\n dst[ 2] = s * m[0 * 4 + 2];\n dst[ 3] = s * m[0 * 4 + 3];\n dst[ 4] = s * m[1 * 4 + 0];\n dst[ 5] = s * m[1 * 4 + 1];\n dst[ 6] = s * m[1 * 4 + 2];\n dst[ 7] = s * m[1 * 4 + 3];\n dst[ 8] = s * m[2 * 4 + 0];\n dst[ 9] = s * m[2 * 4 + 1];\n dst[10] = s * m[2 * 4 + 2];\n dst[11] = s * m[2 * 4 + 3];\n\n if (m !== dst) {\n dst[12] = m[12];\n dst[13] = m[13];\n dst[14] = m[14];\n dst[15] = m[15];\n }\n\n return dst;\n}","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\n\n/**\n * A JavaScript array with 4 values, Float32Array with 4 values, or a Float64Array with 4 values.\n * When created by the library will create the default type which is `Float32Array`\n * but can be set by calling {@link quat.setDefaultType}.\n */\nexport type Quat = number[] | Float32Array | Float64Array;\n\n/**\n *\n * Quat4 math functions.\n *\n * Almost all functions take an optional `dst` argument. If it is not passed in the\n * functions will create a new `Quat4`. In other words you can do this\n *\n * const v = quat4.cross(v1, v2); // Creates a new Quat4 with the cross product of v1 x v2.\n *\n * or\n *\n * const v = quat4.create();\n * quat4.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v\n *\n * The first style is often easier but depending on where it's used it generates garbage where\n * as there is almost never allocation with the second style.\n *\n * It is always safe to pass any vector as the destination. So for example\n *\n * quat4.cross(v1, v2, v1); // Puts the cross product of v1 x v2 in v1\n *\n */\n\nexport let QuatType: new (n: number) => Quat = Float32Array;\n\n/**\n * Sets the type this library creates for a Quat4\n * @param ctor - the constructor for the type. Either `Float32Array`, `Float64Array`, or `Array`\n * @returns previous constructor for Quat4\n */\nexport function setDefaultType(ctor: new (n: number) => Quat) {\n const oldType = QuatType;\n QuatType = ctor;\n return oldType;\n}\n\n/**\n * Creates a quat4; may be called with x, y, z to set initial values.\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @param w - Initial w value.\n * @returns the created vector\n */\nexport function create(x?: number, y?: number, z?: number, w?: number): Quat {\n const dst = new QuatType(4);\n if (x !== undefined) {\n dst[0] = x;\n if (y !== undefined) {\n dst[1] = y;\n if (z !== undefined) {\n dst[2] = z;\n if (w !== undefined) {\n dst[3] = w;\n }\n }\n }\n }\n return dst;\n}","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport * as utils from './utils.js';\nimport { Quat, create, setDefaultType, QuatType } from './quat';\nimport { Mat3 } from './mat3.js';\nimport { Mat4 } from './mat4.js';\nimport { Vec3 } from './vec3.js';\nimport * as vec3 from './vec3-impl.js';\n\nexport type RotationOrder = 'xyz' | 'xzy' | 'yxz' | 'yzx' | 'zxy' | 'zyx';\n\nexport default Quat;\nexport { create, setDefaultType };\n\n/**\n * Creates a Quat; may be called with x, y, z to set initial values. (same as create)\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @param z - Initial w value.\n * @returns the created vector\n */\nexport const fromValues = create;\n\n/**\n * Sets the values of a Quat\n * Also see {@link quat.create} and {@link quat.copy}\n *\n * @param x first value\n * @param y second value\n * @param z third value\n * @param w fourth value\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector with its elements set.\n */\nexport function set(x: number, y: number, z: number, w: number, dst?: Quat) {\n dst = dst || new QuatType(4);\n\n dst[0] = x;\n dst[1] = y;\n dst[2] = z;\n dst[3] = w;\n\n return dst;\n}\n\n/**\n * Sets a quaternion from the given angle and axis,\n * then returns it.\n *\n * @param axis - the axis to rotate around\n * @param angleInRadians - the angle\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The quaternion that represents the given axis and angle\n **/\nexport function fromAxisAngle(axis: Vec3, angleInRadians: number, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n const halfAngle = angleInRadians * 0.5;\n const s = Math.sin(halfAngle);\n\n dst[0] = s * axis[0];\n dst[1] = s * axis[1];\n dst[2] = s * axis[2];\n dst[3] = Math.cos(halfAngle);\n\n return dst;\n}\n\n/**\n * Gets the rotation axis and angle\n * @param q - quaternion to compute from\n * @param dst - Vec3 to hold result. If not passed in a new one is created.\n * @return angle and axis\n */\nexport function toAxisAngle(q: Quat, dst?: Vec3): { angle: number, axis: Vec3 } {\n dst = dst || vec3.create(4);\n\n const angle = Math.acos(q[3]) * 2;\n const s = Math.sin(angle * 0.5);\n if (s > utils.EPSILON) {\n dst[0] = q[0] / s;\n dst[1] = q[1] / s;\n dst[2] = q[2] / s;\n } else {\n dst[0] = 1;\n dst[1] = 0;\n dst[2] = 0;\n }\n\n return { angle, axis: dst };\n}\n\n/**\n * Returns the angle in degrees between two rotations a and b.\n * @param a - quaternion a\n * @param b - quaternion b\n * @return angle in radians between the two quaternions\n */\nexport function angle(a: Quat, b: Quat) {\n const d = dot(a, b);\n return Math.acos(2 * d * d - 1);\n}\n\n/**\n * Multiplies two quaternions\n *\n * @param a - the first quaternion\n * @param b - the second quaternion\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nexport function multiply(a: Quat, b: Quat, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const aw = a[3];\n\n const bx = b[0];\n const by = b[1];\n const bz = b[2];\n const bw = b[3];\n\n dst[0] = ax * bw + aw * bx + ay * bz - az * by;\n dst[1] = ay * bw + aw * by + az * bx - ax * bz;\n dst[2] = az * bw + aw * bz + ax * by - ay * bx;\n dst[3] = aw * bw - ax * bx - ay * by - az * bz;\n\n return dst;\n}\n\n/**\n * Multiplies two quaternions\n *\n * @param a - the first quaternion\n * @param b - the second quaternion\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nexport const mul = multiply;\n\n/**\n * Rotates the given quaternion around the X axis by the given angle.\n * @param q - quaternion to rotate\n * @param angleInRadians - The angle by which to rotate\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nexport function rotateX(q: Quat, angleInRadians: number, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n const halfAngle = angleInRadians * 0.5;\n\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const qw = q[3];\n\n const bx = Math.sin(halfAngle);\n const bw = Math.cos(halfAngle);\n\n dst[0] = qx * bw + qw * bx;\n dst[1] = qy * bw + qz * bx;\n dst[2] = qz * bw - qy * bx;\n dst[3] = qw * bw - qx * bx;\n\n return dst;\n}\n\n/**\n * Rotates the given quaternion around the Y axis by the given angle.\n * @param q - quaternion to rotate\n * @param angleInRadians - The angle by which to rotate\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nexport function rotateY(q: Quat, angleInRadians: number, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n const halfAngle = angleInRadians * 0.5;\n\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const qw = q[3];\n\n const by = Math.sin(halfAngle);\n const bw = Math.cos(halfAngle);\n\n dst[0] = qx * bw - qz * by;\n dst[1] = qy * bw + qw * by;\n dst[2] = qz * bw + qx * by;\n dst[3] = qw * bw - qy * by;\n\n return dst;\n}\n\n/**\n * Rotates the given quaternion around the Z axis by the given angle.\n * @param q - quaternion to rotate\n * @param angleInRadians - The angle by which to rotate\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nexport function rotateZ(q: Quat, angleInRadians: number, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n const halfAngle = angleInRadians * 0.5;\n\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const qw = q[3];\n\n const bz = Math.sin(halfAngle);\n const bw = Math.cos(halfAngle);\n\n dst[0] = qx * bw + qy * bz;\n dst[1] = qy * bw - qx * bz;\n dst[2] = qz * bw + qw * bz;\n dst[3] = qw * bw - qz * bz;\n\n return dst;\n}\n\n/**\n * Spherically linear interpolate between two quaternions\n *\n * @param a - starting value\n * @param b - ending value\n * @param t - value where 0 = a and 1 = b\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nexport function slerp(a: Quat, b: Quat, t: number, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const aw = a[3];\n\n let bx = b[0];\n let by = b[1];\n let bz = b[2];\n let bw = b[3];\n\n let cosOmega = ax * bx + ay * by + az * bz + aw * bw;\n\n if (cosOmega < 0) {\n cosOmega = -cosOmega;\n bx = -bx;\n by = -by;\n bz = -bz;\n bw = -bw;\n }\n\n let scale0;\n let scale1;\n\n if (1.0 - cosOmega > utils.EPSILON) {\n const omega = Math.acos(cosOmega);\n const sinOmega = Math.sin(omega);\n scale0 = Math.sin((1 - t) * omega) / sinOmega;\n scale1 = Math.sin(t * omega) / sinOmega;\n } else {\n scale0 = 1.0 - t;\n scale1 = t;\n }\n\n dst[0] = scale0 * ax + scale1 * bx;\n dst[1] = scale0 * ay + scale1 * by;\n dst[2] = scale0 * az + scale1 * bz;\n dst[3] = scale0 * aw + scale1 * bw;\n\n return dst;\n}\n\n/**\n * Compute the inverse of a quaternion\n *\n * @param q - quaternion to compute the inverse of\n * @returns A quaternion that is the result of a * b\n */\nexport function inverse(q: Quat, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n const a0 = q[0];\n const a1 = q[1];\n const a2 = q[2];\n const a3 = q[3];\n\n const dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3;\n const invDot = dot ? 1 / dot : 0;\n\n dst[0] = -a0 * invDot;\n dst[1] = -a1 * invDot;\n dst[2] = -a2 * invDot;\n dst[3] = a3 * invDot;\n\n return dst;\n}\n\n/**\n * Compute the conjugate of a quaternion\n * For quaternions with a magnitude of 1 (a unit quaternion)\n * this returns the same as the inverse but is faster to calculate.\n *\n * @param q - quaternion to compute the conjugate of.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The conjugate of q\n */\nexport function conjugate(q: Quat, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n dst[0] = -q[0];\n dst[1] = -q[1];\n dst[2] = -q[2];\n dst[3] = q[3];\n\n return dst;\n}\n\n/**\n * Creates a quaternion from the given rotation matrix.\n *\n * The created quaternion is not normalized.\n *\n * @param m - rotation matrix\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns the result\n */\nexport function fromMat(m: Mat3 | Mat4, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n /*\n 0 1 2\n 3 4 5\n 6 7 8\n\n 0 1 2\n 4 5 6\n 8 9 10\n */\n\n // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes\n // article \"Quaternion Calculus and Fast Animation\".\n const trace = m[0] + m[5] + m[10];\n\n if (trace > 0.0) {\n // |w| > 1/2, may as well choose w > 1/2\n const root = Math.sqrt(trace + 1); // 2w\n dst[3] = 0.5 * root;\n const invRoot = 0.5 / root; // 1/(4w)\n\n dst[0] = (m[6] - m[9]) * invRoot;\n dst[1] = (m[8] - m[2]) * invRoot;\n dst[2] = (m[1] - m[4]) * invRoot;\n } else {\n // |w| <= 1/2\n let i = 0;\n\n if (m[5] > m[0]) {\n i = 1;\n }\n if (m[10] > m[i * 4 + i]) {\n i = 2;\n }\n\n const j = (i + 1) % 3;\n const k = (i + 2) % 3;\n\n const root = Math.sqrt(m[i * 4 + i] - m[j * 4 + j] - m[k * 4 + k] + 1.0);\n dst[i] = 0.5 * root;\n\n const invRoot = 0.5 / root;\n\n dst[3] = (m[j * 4 + k] - m[k * 4 + j]) * invRoot;\n dst[j] = (m[j * 4 + i] + m[i * 4 + j]) * invRoot;\n dst[k] = (m[k * 4 + i] + m[i * 4 + k]) * invRoot;\n }\n\n return dst;\n}\n\n/**\n * Creates a quaternion from the given euler angle x, y, z using the provided intrinsic order for the conversion.\n *\n * @param xAngleInRadians - angle to rotate around X axis in radians.\n * @param yAngleInRadians - angle to rotate around Y axis in radians.\n * @param zAngleInRadians - angle to rotate around Z axis in radians.\n * @param order - order to apply euler angles\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion representing the same rotation as the euler angles applied in the given order\n */\nexport function fromEuler(\n xAngleInRadians: number,\n yAngleInRadians: number,\n zAngleInRadians: number,\n order: RotationOrder,\n dst?: Quat) {\n dst = dst || new QuatType(4);\n\n const xHalfAngle = xAngleInRadians * 0.5;\n const yHalfAngle = yAngleInRadians * 0.5;\n const zHalfAngle = zAngleInRadians * 0.5;\n\n const sx = Math.sin(xHalfAngle);\n const cx = Math.cos(xHalfAngle);\n const sy = Math.sin(yHalfAngle);\n const cy = Math.cos(yHalfAngle);\n const sz = Math.sin(zHalfAngle);\n const cz = Math.cos(zHalfAngle);\n\n switch (order) {\n case 'xyz':\n dst[0] = sx * cy * cz + cx * sy * sz;\n dst[1] = cx * sy * cz - sx * cy * sz;\n dst[2] = cx * cy * sz + sx * sy * cz;\n dst[3] = cx * cy * cz - sx * sy * sz;\n break;\n\n case 'xzy':\n dst[0] = sx * cy * cz - cx * sy * sz;\n dst[1] = cx * sy * cz - sx * cy * sz;\n dst[2] = cx * cy * sz + sx * sy * cz;\n dst[3] = cx * cy * cz + sx * sy * sz;\n break;\n\n case 'yxz':\n dst[0] = sx * cy * cz + cx * sy * sz;\n dst[1] = cx * sy * cz - sx * cy * sz;\n dst[2] = cx * cy * sz - sx * sy * cz;\n dst[3] = cx * cy * cz + sx * sy * sz;\n break;\n\n case 'yzx':\n dst[0] = sx * cy * cz + cx * sy * sz;\n dst[1] = cx * sy * cz + sx * cy * sz;\n dst[2] = cx * cy * sz - sx * sy * cz;\n dst[3] = cx * cy * cz - sx * sy * sz;\n break;\n\n case 'zxy':\n dst[0] = sx * cy * cz - cx * sy * sz;\n dst[1] = cx * sy * cz + sx * cy * sz;\n dst[2] = cx * cy * sz + sx * sy * cz;\n dst[3] = cx * cy * cz - sx * sy * sz;\n break;\n\n case 'zyx':\n dst[0] = sx * cy * cz - cx * sy * sz;\n dst[1] = cx * sy * cz + sx * cy * sz;\n dst[2] = cx * cy * sz - sx * sy * cz;\n dst[3] = cx * cy * cz + sx * sy * sz;\n break;\n\n default:\n throw new Error(`Unknown rotation order: ${order}`);\n }\n\n return dst;\n}\n\n/**\n * Copies a quaternion. (same as {@link quat.clone})\n * Also see {@link quat.create} and {@link quat.set}\n * @param q - The quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is a copy of q\n */\nexport function copy(q: Quat, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n dst[0] = q[0];\n dst[1] = q[1];\n dst[2] = q[2];\n dst[3] = q[3];\n\n return dst;\n}\n\n/**\n * Clones a quaternion. (same as {@link quat.copy})\n * Also see {@link quat.create} and {@link quat.set}\n * @param q - The quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A copy of q.\n */\nexport const clone = copy;\n\n/**\n * Adds two quaternions; assumes a and b have the same dimension.\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the sum of a and b.\n */\nexport function add(a: Quat, b: Quat, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n dst[0] = a[0] + b[0];\n dst[1] = a[1] + b[1];\n dst[2] = a[2] + b[2];\n dst[3] = a[3] + b[3];\n\n return dst;\n}\n\n/**\n * Subtracts two quaternions.\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the difference of a and b.\n */\nexport function subtract(a: Quat, b: Quat, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n dst[0] = a[0] - b[0];\n dst[1] = a[1] - b[1];\n dst[2] = a[2] - b[2];\n dst[3] = a[3] - b[3];\n\n return dst;\n}\n\n/**\n * Subtracts two quaternions.\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the difference of a and b.\n */\nexport const sub = subtract;\n\n/**\n * Multiplies a quaternion by a scalar.\n * @param v - The quaternion.\n * @param k - The scalar.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The scaled quaternion.\n */\nexport function mulScalar(v: Quat, k: number, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n dst[0] = v[0] * k;\n dst[1] = v[1] * k;\n dst[2] = v[2] * k;\n dst[3] = v[3] * k;\n\n return dst;\n}\n\n/**\n * Multiplies a quaternion by a scalar. (same as mulScalar)\n * @param v - The quaternion.\n * @param k - The scalar.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The scaled quaternion.\n */\nexport const scale = mulScalar;\n\n/**\n * Divides a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The scaled quaternion.\n */\nexport function divScalar(v: Quat, k: number, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n dst[0] = v[0] / k;\n dst[1] = v[1] / k;\n dst[2] = v[2] / k;\n dst[3] = v[3] / k;\n\n return dst;\n}\n\n/**\n * Computes the dot product of two quaternions\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @returns dot product\n */\nexport function dot(a: Quat, b: Quat): number {\n return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]) + (a[3] * b[3]);\n}\n\n/**\n * Performs linear interpolation on two quaternions.\n * Given quaternions a and b and interpolation coefficient t, returns\n * a + t * (b - a).\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @param t - Interpolation coefficient.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The linear interpolated result.\n */\nexport function lerp(a: Quat, b: Quat, t: number, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n dst[0] = a[0] + t * (b[0] - a[0]);\n dst[1] = a[1] + t * (b[1] - a[1]);\n dst[2] = a[2] + t * (b[2] - a[2]);\n dst[3] = a[3] + t * (b[3] - a[3]);\n\n return dst;\n}\n\n/**\n * Computes the length of quaternion\n * @param v - quaternion.\n * @returns length of quaternion.\n */\nexport function length(v: Quat): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n return Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3);\n}\n\n/**\n * Computes the length of quaternion (same as length)\n * @param v - quaternion.\n * @returns length of quaternion.\n */\nexport const len = length;\n\n/**\n * Computes the square of the length of quaternion\n * @param v - quaternion.\n * @returns square of the length of quaternion.\n */\nexport function lengthSq(v: Quat): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n return v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3;\n}\n\n/**\n * Computes the square of the length of quaternion (same as lengthSq)\n * @param v - quaternion.\n * @returns square of the length of quaternion.\n */\nexport const lenSq = lengthSq;\n\n/**\n * Divides a quaternion by its Euclidean length and returns the quotient.\n * @param v - The quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The normalized quaternion.\n */\nexport function normalize(v: Quat, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n const len = Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3);\n\n if (len > 0.00001) {\n dst[0] = v0 / len;\n dst[1] = v1 / len;\n dst[2] = v2 / len;\n dst[3] = v3 / len;\n } else {\n dst[0] = 0;\n dst[1] = 0;\n dst[2] = 0;\n dst[3] = 0;\n }\n\n return dst;\n}\n\n/**\n * Check if 2 quaternions are approximately equal\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @returns true if quaternions are approximately equal\n */\nexport function equalsApproximately(a: Quat, b: Quat): boolean {\n return Math.abs(a[0] - b[0]) < utils.EPSILON &&\n Math.abs(a[1] - b[1]) < utils.EPSILON &&\n Math.abs(a[2] - b[2]) < utils.EPSILON &&\n Math.abs(a[3] - b[3]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 quaternions are exactly equal\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @returns true if quaternions are exactly equal\n */\nexport function equals(a: Quat, b: Quat): boolean {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];\n}\n\n/**\n * Creates an identity quaternion\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns an identity quaternion\n */\nexport function identity(dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n dst[0] = 0;\n dst[1] = 0;\n dst[2] = 0;\n dst[3] = 1;\n\n return dst;\n}\n\nlet tempVec3: Vec3;\nlet xUnitVec3: Vec3;\nlet yUnitVec3: Vec3;\n\n/**\n * Computes a quaternion to represent the shortest rotation from one vector to another.\n *\n * @param aUnit - the start vector\n * @param bUnit - the end vector\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns the result\n */\nexport function rotationTo(aUnit: Vec3, bUnit: Vec3, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n tempVec3 = tempVec3 || vec3.create();\n xUnitVec3 = xUnitVec3 || vec3.create(1, 0, 0);\n yUnitVec3 = yUnitVec3 || vec3.create(0, 1, 0);\n\n const dot = vec3.dot(aUnit, bUnit);\n if (dot < -0.999999) {\n vec3.cross(xUnitVec3, aUnit, tempVec3);\n if (vec3.len(tempVec3) < 0.000001) {\n vec3.cross(yUnitVec3, aUnit, tempVec3);\n }\n\n vec3.normalize(tempVec3, tempVec3);\n fromAxisAngle(tempVec3, Math.PI, dst);\n\n return dst;\n } else if (dot > 0.999999) {\n dst[0] = 0;\n dst[1] = 0;\n dst[2] = 0;\n dst[3] = 1;\n\n return dst;\n } else {\n vec3.cross(aUnit, bUnit, tempVec3);\n\n dst[0] = tempVec3[0];\n dst[1] = tempVec3[1];\n dst[2] = tempVec3[2];\n dst[3] = 1 + dot;\n\n return normalize(dst, dst);\n }\n}\n\nlet tempQuat1: Quat;\nlet tempQuat2: Quat;\n\n/**\n * Performs a spherical linear interpolation with two control points\n *\n * @param a - the first quaternion\n * @param b - the second quaternion\n * @param c - the third quaternion\n * @param d - the fourth quaternion\n * @param t - Interpolation coefficient 0 to 1\n * @returns result\n */\nexport function sqlerp(\n a: Quat,\n b: Quat,\n c: Quat,\n d: Quat,\n t: number,\n dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n tempQuat1 = tempQuat1 || new QuatType(4);\n tempQuat2 = tempQuat2 || new QuatType(4);\n\n slerp(a, d, t, tempQuat1);\n slerp(b, c, t, tempQuat2);\n slerp(tempQuat1, tempQuat2, 2 * t * (1 - t), dst);\n\n return dst;\n}\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\n\n/**\n * A JavaScript array with 4 values, Float32Array with 4 values, or a Float64Array with 4 values.\n * When created by the library will create the default type which is `Float32Array`\n * but can be set by calling {@link vec4.setDefaultType}.\n */\nexport type Vec4 = number[] | Float32Array | Float64Array;\n\n/**\n *\n * Vec4 math functions.\n *\n * Almost all functions take an optional `dst` argument. If it is not passed in the\n * functions will create a new `Vec4`. In other words you can do this\n *\n * const v = vec4.cross(v1, v2); // Creates a new Vec4 with the cross product of v1 x v2.\n *\n * or\n *\n * const v = vec4.create();\n * vec4.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v\n *\n * The first style is often easier but depending on where it's used it generates garbage where\n * as there is almost never allocation with the second style.\n *\n * It is always safe to pass any vector as the destination. So for example\n *\n * vec4.cross(v1, v2, v1); // Puts the cross product of v1 x v2 in v1\n *\n */\n\nexport let VecType: new (n: number) => Vec4 = Float32Array;\n\n/**\n * Sets the type this library creates for a Vec4\n * @param ctor - the constructor for the type. Either `Float32Array`, `Float64Array`, or `Array`\n * @returns previous constructor for Vec4\n */\nexport function setDefaultType(ctor: new (n: number) => Vec4) {\n const oldType = VecType;\n VecType = ctor;\n return oldType;\n}\n\n/**\n * Creates a vec4; may be called with x, y, z to set initial values.\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @param w - Initial w value.\n * @returns the created vector\n */\nexport function create(x?: number, y?: number, z?: number, w?: number): Vec4 {\n const dst = new VecType(4);\n if (x !== undefined) {\n dst[0] = x;\n if (y !== undefined) {\n dst[1] = y;\n if (z !== undefined) {\n dst[2] = z;\n if (w !== undefined) {\n dst[3] = w;\n }\n }\n }\n }\n return dst;\n}","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport * as utils from './utils.js';\nimport { Vec4, create, setDefaultType, VecType } from './vec4';\nimport { Mat4 } from './mat4';\n\nexport default Vec4;\nexport { create, setDefaultType };\n\n/**\n * Creates a vec4; may be called with x, y, z to set initial values. (same as create)\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @param z - Initial w value.\n * @returns the created vector\n */\nexport const fromValues = create;\n\n/**\n * Sets the values of a Vec4\n * Also see {@link vec4.create} and {@link vec4.copy}\n *\n * @param x first value\n * @param y second value\n * @param z third value\n * @param w fourth value\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector with its elements set.\n */\nexport function set(x: number, y: number, z: number, w: number, dst?: Vec4) {\n dst = dst || new VecType(4);\n\n dst[0] = x;\n dst[1] = y;\n dst[2] = z;\n dst[3] = w;\n\n return dst;\n}\n\n/**\n * Applies Math.ceil to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the ceil of each element of v.\n */\nexport function ceil(v: Vec4, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = Math.ceil(v[0]);\n dst[1] = Math.ceil(v[1]);\n dst[2] = Math.ceil(v[2]);\n dst[3] = Math.ceil(v[3]);\n\n return dst;\n}\n\n/**\n * Applies Math.floor to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the floor of each element of v.\n */\nexport function floor(v: Vec4, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = Math.floor(v[0]);\n dst[1] = Math.floor(v[1]);\n dst[2] = Math.floor(v[2]);\n dst[3] = Math.floor(v[3]);\n\n return dst;\n}\n\n/**\n * Applies Math.round to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the round of each element of v.\n */\nexport function round(v: Vec4, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = Math.round(v[0]);\n dst[1] = Math.round(v[1]);\n dst[2] = Math.round(v[2]);\n dst[3] = Math.round(v[3]);\n\n return dst;\n}\n\n/**\n * Clamp each element of vector between min and max\n * @param v - Operand vector.\n * @param max - Min value, default 0\n * @param min - Max value, default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that the clamped value of each element of v.\n */\nexport function clamp(v: Vec4, min = 0, max = 1, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = Math.min(max, Math.max(min, v[0]));\n dst[1] = Math.min(max, Math.max(min, v[1]));\n dst[2] = Math.min(max, Math.max(min, v[2]));\n dst[3] = Math.min(max, Math.max(min, v[3]));\n\n return dst;\n}\n\n/**\n * Adds two vectors; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a and b.\n */\nexport function add(a: Vec4, b: Vec4, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = a[0] + b[0];\n dst[1] = a[1] + b[1];\n dst[2] = a[2] + b[2];\n dst[3] = a[3] + b[3];\n\n return dst;\n}\n\n/**\n * Adds two vectors, scaling the 2nd; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param scale - Amount to scale b\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a + b * scale.\n */\nexport function addScaled(a: Vec4, b: Vec4, scale: number, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = a[0] + b[0] * scale;\n dst[1] = a[1] + b[1] * scale;\n dst[2] = a[2] + b[2] * scale;\n dst[3] = a[3] + b[3] * scale;\n\n return dst;\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nexport function subtract(a: Vec4, b: Vec4, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = a[0] - b[0];\n dst[1] = a[1] - b[1];\n dst[2] = a[2] - b[2];\n dst[3] = a[3] - b[3];\n\n return dst;\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nexport const sub = subtract;\n\n/**\n * Check if 2 vectors are approximately equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are approximately equal\n */\nexport function equalsApproximately(a: Vec4, b: Vec4): boolean {\n return Math.abs(a[0] - b[0]) < utils.EPSILON &&\n Math.abs(a[1] - b[1]) < utils.EPSILON &&\n Math.abs(a[2] - b[2]) < utils.EPSILON &&\n Math.abs(a[3] - b[3]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 vectors are exactly equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are exactly equal\n */\nexport function equals(a: Vec4, b: Vec4): boolean {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficient.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The linear interpolated result.\n */\nexport function lerp(a: Vec4, b: Vec4, t: number, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = a[0] + t * (b[0] - a[0]);\n dst[1] = a[1] + t * (b[1] - a[1]);\n dst[2] = a[2] + t * (b[2] - a[2]);\n dst[3] = a[3] + t * (b[3] - a[3]);\n\n return dst;\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient vector t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficients vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns the linear interpolated result.\n */\nexport function lerpV(a: Vec4, b: Vec4, t: Vec4, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = a[0] + t[0] * (b[0] - a[0]);\n dst[1] = a[1] + t[1] * (b[1] - a[1]);\n dst[2] = a[2] + t[2] * (b[2] - a[2]);\n dst[3] = a[3] + t[3] * (b[3] - a[3]);\n\n return dst;\n}\n\n/**\n * Return max values of two vectors.\n * Given vectors a and b returns\n * [max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The max components vector.\n */\nexport function max(a: Vec4, b: Vec4, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = Math.max(a[0], b[0]);\n dst[1] = Math.max(a[1], b[1]);\n dst[2] = Math.max(a[2], b[2]);\n dst[3] = Math.max(a[3], b[3]);\n\n return dst;\n}\n\n/**\n * Return min values of two vectors.\n * Given vectors a and b returns\n * [min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The min components vector.\n */\nexport function min(a: Vec4, b: Vec4, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = Math.min(a[0], b[0]);\n dst[1] = Math.min(a[1], b[1]);\n dst[2] = Math.min(a[2], b[2]);\n dst[3] = Math.min(a[3], b[3]);\n\n return dst;\n}\n\n/**\n * Multiplies a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nexport function mulScalar(v: Vec4, k: number, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = v[0] * k;\n dst[1] = v[1] * k;\n dst[2] = v[2] * k;\n dst[3] = v[3] * k;\n\n return dst;\n}\n\n/**\n * Multiplies a vector by a scalar. (same as mulScalar)\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nexport const scale = mulScalar;\n\n/**\n * Divides a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nexport function divScalar(v: Vec4, k: number, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = v[0] / k;\n dst[1] = v[1] / k;\n dst[2] = v[2] / k;\n dst[3] = v[3] / k;\n\n return dst;\n}\n\n/**\n * Inverse a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nexport function inverse(v: Vec4, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = 1 / v[0];\n dst[1] = 1 / v[1];\n dst[2] = 1 / v[2];\n dst[3] = 1 / v[3];\n\n return dst;\n}\n\n/**\n * Invert a vector. (same as inverse)\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nexport const invert = inverse;\n\n/**\n * Computes the dot product of two vectors\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns dot product\n */\nexport function dot(a: Vec4, b: Vec4): number {\n return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]) + (a[3] * b[3]);\n}\n\n/**\n * Computes the length of vector\n * @param v - vector.\n * @returns length of vector.\n */\nexport function length(v: Vec4): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n return Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3);\n}\n\n/**\n * Computes the length of vector (same as length)\n * @param v - vector.\n * @returns length of vector.\n */\nexport const len = length;\n\n/**\n * Computes the square of the length of vector\n * @param v - vector.\n * @returns square of the length of vector.\n */\nexport function lengthSq(v: Vec4): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n return v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3;\n}\n\n/**\n * Computes the square of the length of vector (same as lengthSq)\n * @param v - vector.\n * @returns square of the length of vector.\n */\nexport const lenSq = lengthSq;\n\n/**\n * Computes the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nexport function distance(a: Vec4, b: Vec4): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n const dz = a[2] - b[2];\n const dw = a[3] - b[3];\n return Math.sqrt(dx * dx + dy * dy + dz * dz + dw * dw);\n}\n\n/**\n * Computes the distance between 2 points (same as distance)\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nexport const dist = distance;\n\n/**\n * Computes the square of the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nexport function distanceSq(a: Vec4, b: Vec4): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n const dz = a[2] - b[2];\n const dw = a[3] - b[3];\n return dx * dx + dy * dy + dz * dz + dw * dw;\n}\n\n/**\n * Computes the square of the distance between 2 points (same as distanceSq)\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nexport const distSq = distanceSq;\n\n/**\n * Divides a vector by its Euclidean length and returns the quotient.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The normalized vector.\n */\nexport function normalize(v: Vec4, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n const len = Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3);\n\n if (len > 0.00001) {\n dst[0] = v0 / len;\n dst[1] = v1 / len;\n dst[2] = v2 / len;\n dst[3] = v3 / len;\n } else {\n dst[0] = 0;\n dst[1] = 0;\n dst[2] = 0;\n dst[3] = 0;\n }\n\n return dst;\n}\n\n/**\n * Negates a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns -v.\n */\nexport function negate(v: Vec4, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = -v[0];\n dst[1] = -v[1];\n dst[2] = -v[2];\n dst[3] = -v[3];\n\n return dst;\n}\n\n/**\n * Copies a vector. (same as {@link vec4.clone})\n * Also see {@link vec4.create} and {@link vec4.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nexport function copy(v: Vec4, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = v[0];\n dst[1] = v[1];\n dst[2] = v[2];\n dst[3] = v[3];\n\n return dst;\n}\n\n/**\n * Clones a vector. (same as {@link vec4.copy})\n * Also see {@link vec4.create} and {@link vec4.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nexport const clone = copy;\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nexport function multiply(a: Vec4, b: Vec4, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = a[0] * b[0];\n dst[1] = a[1] * b[1];\n dst[2] = a[2] * b[2];\n dst[3] = a[3] * b[3];\n\n return dst;\n}\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as mul)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nexport const mul = multiply;\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nexport function divide(a: Vec4, b: Vec4, dst?: Vec4) {\n dst = dst || new VecType(4);\n\n dst[0] = a[0] / b[0];\n dst[1] = a[1] / b[1];\n dst[2] = a[2] / b[2];\n dst[3] = a[3] / b[3];\n\n return dst;\n}\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as divide)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nexport const div = divide;\n\n/**\n * Zero's a vector\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The zeroed vector.\n */\nexport function zero(dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = 0;\n dst[1] = 0;\n dst[2] = 0;\n dst[3] = 0;\n\n return dst;\n}\n\n\n/**\n * transform vec4 by 4x4 matrix\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional vec4 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nexport function transformMat4(v: Vec4, m: Mat4, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n const x = v[0];\n const y = v[1];\n const z = v[2];\n const w = v[3];\n\n dst[0] = m[0] * x + m[4] * y + m[ 8] * z + m[12] * w;\n dst[1] = m[1] * x + m[5] * y + m[ 9] * z + m[13] * w;\n dst[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;\n dst[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;\n\n return dst;\n}\n\n\n/**\n * Treat a 4D vector as a direction and set it's length\n *\n * @param a The vec4 to lengthen\n * @param len The length of the resulting vector\n * @returns The lengthened vector\n */\nexport function setLength(a: Vec4, len: number, dst?: Vec4) {\n dst = dst || new VecType(4);\n normalize(a, dst);\n return mulScalar(dst, len, dst);\n}\n\n/**\n * Ensure a vector is not longer than a max length\n *\n * @param a The vec4 to limit\n * @param maxLen The longest length of the resulting vector\n * @returns The vector, shortened to maxLen if it's too long\n */\nexport function truncate(a: Vec4, maxLen: number, dst?: Vec4) {\n dst = dst || new VecType(4);\n\n if (length(a) > maxLen) {\n return setLength(a, maxLen, dst);\n }\n\n return copy(a, dst);\n}\n\n/**\n * Return the vector exactly between 2 endpoint vectors\n *\n * @param a Endpoint 1\n * @param b Endpoint 2\n * @returns The vector exactly residing between endpoints 1 and 2\n */\nexport function midpoint(a: Vec4, b: Vec4, dst?: Vec4) {\n dst = dst || new VecType(4);\n return lerp(a, b, 0.5, dst);\n}\n","import Mat3, * as mat3 from './mat3-impl';\nimport Mat4, * as mat4 from './mat4-impl';\nimport Quat, * as quat from './quat-impl';\nimport Vec2, * as vec2 from './vec2-impl';\nimport Vec3, * as vec3 from './vec3-impl';\nimport Vec4, * as vec4 from './vec4-impl';\nimport * as utils from './utils';\n\n/**\n * Sets the type this library creates for all types\n *\n * example:\n *\n * ```\n * setDefaultType(Float64Array);\n * ```\n *\n * @param ctor - the constructor for the type. Either `Float32Array`, `Float64Array`, or `Array`\n */\nexport function setDefaultType(ctor: new (n: number) => Float32Array | Float64Array | number[]) {\n mat3.setDefaultType(ctor);\n mat4.setDefaultType(ctor);\n quat.setDefaultType(ctor);\n vec2.setDefaultType(ctor);\n vec3.setDefaultType(ctor);\n vec4.setDefaultType(ctor);\n}\n\nexport {\n Mat3,\n mat3,\n Mat4,\n mat4,\n Quat,\n quat,\n utils,\n Vec2,\n vec2,\n Vec3,\n vec3,\n Vec4,\n vec4,\n};"],"names":["lerp","VecType","setDefaultType","create","fromValues","set","ceil","floor","round","clamp","add","addScaled","angle","dot","subtract","sub","equalsApproximately","utils.EPSILON","equals","lerpV","max","min","mulScalar","scale","divScalar","inverse","invert","cross","Vec3Type","length","len","lengthSq","lenSq","distance","dist","distanceSq","distSq","normalize","negate","copy","clone","multiply","mul","divide","div","random","zero","transformMat4","transformMat3","rotate","setLength","truncate","midpoint","MatType","fromQuat","identity","transpose","determinant","setTranslation","getTranslation","vec2.create","getAxis","setAxis","getScaling","translation","translate","rotation","scaling","uniformScaling","uniformScale","rotateX","rotateY","rotateZ","vec3.create","vec3.normalize","vec3.subtract","vec3.cross","vec3.dot","vec3.len","mat3.setDefaultType","mat4.setDefaultType","quat.setDefaultType","vec2.setDefaultType","vec3.setDefaultType","vec4.setDefaultType"],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;AAoBG;AAEI,IAAI,OAAO,GAAG,QAAQ,CAAC;AAE9B;;;;AAIG;AACG,SAAU,UAAU,CAAC,CAAS,EAAA;IAClC,MAAM,GAAG,GAAG,OAAO,CAAC;IACpB,OAAO,GAAG,CAAC,CAAC;AACZ,IAAA,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;;;AAIG;AACG,SAAU,QAAQ,CAAC,OAAe,EAAA;AACtC,IAAA,OAAO,OAAO,GAAG,IAAI,CAAC,EAAE,GAAG,GAAG,CAAC;AACjC,CAAC;AAED;;;;AAIG;AACG,SAAU,QAAQ,CAAC,OAAe,EAAA;AACtC,IAAA,OAAO,OAAO,GAAG,GAAG,GAAG,IAAI,CAAC,EAAE,CAAC;AACjC,CAAC;AAED;;;;;;AAMG;SACaA,MAAI,CAAC,CAAS,EAAE,CAAS,EAAE,CAAS,EAAA;IAClD,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACzB,CAAC;AAED;;;;;;;;AAQG;SACa,WAAW,CAAC,CAAS,EAAE,CAAS,EAAE,CAAS,EAAA;AACzD,IAAA,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAChB,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,OAAO;AAC9B,UAAE,CAAC;UACD,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACnB,CAAC;AAED;;;;;;;;;;;;;;AAcG;AACa,SAAA,eAAe,CAAC,CAAS,EAAE,CAA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G,CAAC,CAAC;AACtB,CAAC;AAED;;;;;;AAMG;SACa,QAAQ,CAAC,CAAO,EAAE,CAAO,EAAE,GAAU,EAAA;IACnD,GAAG,GAAG,GAAG,IAAI,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC;IAC5B,OAAO,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AAC9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC5pBA;;;;;;;;;;AAUG;AACG,SAAU,cAAc,CAAC,IAA+D,EAAA;AAC5F,IAAA8D,gBAAmB,CAAC,IAAI,CAAC,CAAC;AAC1B,IAAAC,gBAAmB,CAAC,IAAI,CAAC,CAAC;AAC1B,IAAAC,gBAAmB,CAAC,IAAI,CAAC,CAAC;AAC1B,IAAAC,gBAAmB,CAAC,IAAI,CAAC,CAAC;AAC1B,IAAAC,gBAAmB,CAAC,IAAI,CAAC,CAAC;AAC1B,IAAAC,gBAAmB,CAAC,IAAI,CAAC,CAAC;AAC5B;;;;"} \ No newline at end of file diff --git a/dist/2.x/wgpu-matrix.module.min.js b/dist/2.x/wgpu-matrix.module.min.js deleted file mode 100644 index 6ff2975..0000000 --- a/dist/2.x/wgpu-matrix.module.min.js +++ /dev/null @@ -1,2 +0,0 @@ -let n=1e-6;var t={__proto__:null,get EPSILON(){return n},degToRad:function(n){return n*Math.PI/180},euclideanModulo:function(n,t){return(n%t+t)%t},inverseLerp:function(t,r,e){const o=r-t;return Math.abs(r-t)1e-5?(t[0]=e/u,t[1]=o/u):(t[0]=0,t[1]=0),t}function p(n,t){return(t=t||new r(2))[0]=n[0],t[1]=n[1],t}function q(n,t,e){return(e=e||new r(2))[0]=n[0]*t[0],e[1]=n[1]*t[1],e}function b(n,t,e){return(e=e||new r(2))[0]=n[0]/t[0],e[1]=n[1]/t[1],e}function y(n,t,e){return v(n,e=e||new r(2)),f(e,t,e)}var x={__proto__:null,add:function(n,t,e){return(e=e||new r(2))[0]=n[0]+t[0],e[1]=n[1]+t[1],e},addScaled:function(n,t,e,o){return(o=o||new r(2))[0]=n[0]+t[0]*e,o[1]=n[1]+t[1]*e,o},angle:function(n,t){const r=n[0],e=n[1],o=t[0],u=t[1],a=Math.sqrt(r*r+e*e)*Math.sqrt(o*o+u*u),c=a&&M(n,t)/a;return Math.acos(c)},ceil:function(n,t){return(t=t||new r(2))[0]=Math.ceil(n[0]),t[1]=Math.ceil(n[1]),t},clamp:function(n,t=0,e=1,o){return(o=o||new r(2))[0]=Math.min(e,Math.max(t,n[0])),o[1]=Math.min(e,Math.max(t,n[1])),o},clone:p,copy:p,create:o,cross:function(n,t,r){r=r||new u(3);const e=n[0]*t[1]-n[1]*t[0];return r[0]=0,r[1]=0,r[2]=e,r},dist:d,distSq:m,distance:d,distanceSq:m,div:b,divScalar:function(n,t,e){return(e=e||new r(2))[0]=n[0]/t,e[1]=n[1]/t,e},divide:b,dot:M,equals:function(n,t){return n[0]===t[0]&&n[1]===t[1]},equalsApproximately:function(t,r){return Math.abs(t[0]-r[0])t?y(n,t,e):p(n,e)},zero:function(n){return(n=n||new r(2))[0]=0,n[1]=0,n}};let g=Float32Array;const S=new Map([[Float32Array,()=>new Float32Array(12)],[Float64Array,()=>new Float64Array(12)],[Array,()=>new Array(12).fill(0)]]);let A=S.get(Float32Array);function _(n){const t=g;return g=n,A=S.get(n),t}function T(n,t){return(t=t||A())[0]=n[0],t[1]=n[1],t[2]=n[2],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[8]=n[8],t[9]=n[9],t[10]=n[10],t}function z(n){return(n=n||A())[0]=1,n[1]=0,n[2]=0,n[4]=0,n[5]=1,n[6]=0,n[8]=0,n[9]=0,n[10]=1,n}function F(n,t){t=t||A();const r=n[0],e=n[1],o=n[2],u=n[4],a=n[5],c=n[6],i=n[8],s=n[9],f=n[10],h=f*a-c*s,M=-f*u+c*i,l=s*u-a*i,w=1/(r*h+e*M+o*l);return t[0]=h*w,t[1]=(-f*e+o*s)*w,t[2]=(c*e-o*a)*w,t[4]=M*w,t[5]=(f*r-o*i)*w,t[6]=(-c*r+o*u)*w,t[8]=l*w,t[9]=(-s*r+e*i)*w,t[10]=(a*r-e*u)*w,t}function k(n,t,r){r=r||A();const e=n[0],o=n[1],u=n[2],a=n[4],c=n[5],i=n[6],s=n[8],f=n[9],h=n[10],M=t[0],l=t[1],w=t[2],d=t[4],m=t[5],v=t[6],p=t[8],q=t[9],b=t[10];return r[0]=e*M+a*l+s*w,r[1]=o*M+c*l+f*w,r[2]=u*M+i*l+h*w,r[4]=e*d+a*m+s*v,r[5]=o*d+c*m+f*v,r[6]=u*d+i*m+h*v,r[8]=e*p+a*q+s*b,r[9]=o*p+c*q+f*b,r[10]=u*p+i*q+h*b,r}var D={__proto__:null,clone:T,copy:T,create:function(n,t,r,e,o,u,a,c,i){const s=A();return s[3]=0,s[7]=0,s[11]=0,void 0!==n&&(s[0]=n,void 0!==t&&(s[1]=t,void 0!==r&&(s[2]=r,void 0!==e&&(s[4]=e,void 0!==o&&(s[5]=o,void 0!==u&&(s[6]=u,void 0!==a&&(s[8]=a,void 0!==c&&(s[9]=c,void 0!==i&&(s[10]=i))))))))),s},determinant:function(n){const t=n[0],r=n[1],e=n[2],o=n[4],u=n[5],a=n[6],c=n[8],i=n[9],s=n[10];return t*(u*s-i*a)-o*(r*s-i*e)+c*(r*a-u*e)},equals:function(n,t){return n[0]===t[0]&&n[1]===t[1]&&n[2]===t[2]&&n[4]===t[4]&&n[5]===t[5]&&n[6]===t[6]&&n[8]===t[8]&&n[9]===t[9]&&n[10]===t[10]},equalsApproximately:function(t,r){return Math.abs(t[0]-r[0])1e-5?(t[0]=r/a,t[1]=e/a,t[2]=o/a):(t[0]=0,t[1]=0,t[2]=0),t}function j(n,t){return(t=t||new u(3))[0]=n[0],t[1]=n[1],t[2]=n[2],t}function O(n,t,r){return(r=r||new u(3))[0]=n[0]*t[0],r[1]=n[1]*t[1],r[2]=n[2]*t[2],r}function $(n,t,r){return(r=r||new u(3))[0]=n[0]/t[0],r[1]=n[1]/t[1],r[2]=n[2]/t[2],r}function B(n,t,r){return U(n,r=r||new u(3)),V(r,t,r)}var C={__proto__:null,add:function(n,t,r){return(r=r||new u(3))[0]=n[0]+t[0],r[1]=n[1]+t[1],r[2]=n[2]+t[2],r},addScaled:function(n,t,r,e){return(e=e||new u(3))[0]=n[0]+t[0]*r,e[1]=n[1]+t[1]*r,e[2]=n[2]+t[2]*r,e},angle:function(n,t){const r=n[0],e=n[1],o=n[2],u=t[0],a=t[1],c=t[2],i=Math.sqrt(r*r+e*e+o*o)*Math.sqrt(u*u+a*a+c*c),s=i&&R(n,t)/i;return Math.acos(s)},ceil:function(n,t){return(t=t||new u(3))[0]=Math.ceil(n[0]),t[1]=Math.ceil(n[1]),t[2]=Math.ceil(n[2]),t},clamp:function(n,t=0,r=1,e){return(e=e||new u(3))[0]=Math.min(r,Math.max(t,n[0])),e[1]=Math.min(r,Math.max(t,n[1])),e[2]=Math.min(r,Math.max(t,n[2])),e},clone:j,copy:j,create:c,cross:L,dist:Q,distSq:N,distance:Q,distanceSq:N,div:$,divScalar:function(n,t,r){return(r=r||new u(3))[0]=n[0]/t,r[1]=n[1]/t,r[2]=n[2]/t,r},divide:$,dot:R,equals:function(n,t){return n[0]===t[0]&&n[1]===t[1]&&n[2]===t[2]},equalsApproximately:function(t,r){return Math.abs(t[0]-r[0])t?B(n,t,r):j(n,r)},zero:function(n){return(n=n||new u(3))[0]=0,n[1]=0,n[2]=0,n}};let G=Float32Array;function H(n){const t=G;return G=n,t}function J(n,t){return(t=t||new G(16))[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],t}function K(n){return(n=n||new G(16))[0]=1,n[1]=0,n[2]=0,n[3]=0,n[4]=0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12],m=n[13],v=n[14],p=n[15],q=t[0],b=t[1],y=t[2],x=t[3],g=t[4],S=t[5],A=t[6],_=t[7],T=t[8],z=t[9],F=t[10],k=t[11],D=t[12],I=t[13],P=t[14],V=t[15];return r[0]=e*q+c*b+h*y+d*x,r[1]=o*q+i*b+M*y+m*x,r[2]=u*q+s*b+l*y+v*x,r[3]=a*q+f*b+w*y+p*x,r[4]=e*g+c*S+h*A+d*_,r[5]=o*g+i*S+M*A+m*_,r[6]=u*g+s*S+l*A+v*_,r[7]=a*g+f*S+w*A+p*_,r[8]=e*T+c*z+h*F+d*k,r[9]=o*T+i*z+M*F+m*k,r[10]=u*T+s*z+l*F+v*k,r[11]=a*T+f*z+w*F+p*k,r[12]=e*D+c*I+h*P+d*V,r[13]=o*D+i*I+M*P+m*V,r[14]=u*D+s*I+l*P+v*V,r[15]=a*D+f*I+w*P+p*V,r}let tn,rn,en;function on(n,t,r){r=r||new G(16);let e=n[0],o=n[1],u=n[2];const a=Math.sqrt(e*e+o*o+u*u);e/=a,o/=a,u/=a;const c=e*e,i=o*o,s=u*u,f=Math.cos(t),h=Math.sin(t),M=1-f;return r[0]=c+(1-c)*f,r[1]=e*o*M+u*h,r[2]=e*u*M-o*h,r[3]=0,r[4]=e*o*M-u*h,r[5]=i+(1-i)*f,r[6]=o*u*M+e*h,r[7]=0,r[8]=e*u*M+o*h,r[9]=o*u*M-e*h,r[10]=s+(1-s)*f,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function un(n,t,r,e){e=e||new G(16);let o=t[0],u=t[1],a=t[2];const c=Math.sqrt(o*o+u*u+a*a);o/=c,u/=c,a/=c;const i=o*o,s=u*u,f=a*a,h=Math.cos(r),M=Math.sin(r),l=1-h,w=i+(1-i)*h,d=o*u*l+a*M,m=o*a*l-u*M,v=o*u*l-a*M,p=s+(1-s)*h,q=u*a*l+o*M,b=o*a*l+u*M,y=u*a*l-o*M,x=f+(1-f)*h,g=n[0],S=n[1],A=n[2],_=n[3],T=n[4],z=n[5],F=n[6],k=n[7],D=n[8],I=n[9],P=n[10],V=n[11];return e[0]=w*g+d*T+m*D,e[1]=w*S+d*z+m*I,e[2]=w*A+d*F+m*P,e[3]=w*_+d*k+m*V,e[4]=v*g+p*T+q*D,e[5]=v*S+p*z+q*I,e[6]=v*A+p*F+q*P,e[7]=v*_+p*k+q*V,e[8]=b*g+y*T+x*D,e[9]=b*S+y*z+x*I,e[10]=b*A+y*F+x*P,e[11]=b*_+y*k+x*V,n!==e&&(e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15]),e}var an={__proto__:null,aim:function(n,t,r,e){return e=e||new G(16),tn=tn||c(),rn=rn||c(),en=en||c(),U(I(t,n,en),en),U(L(r,en,tn),tn),U(L(en,tn,rn),rn),e[0]=tn[0],e[1]=tn[1],e[2]=tn[2],e[3]=0,e[4]=rn[0],e[5]=rn[1],e[6]=rn[2],e[7]=0,e[8]=en[0],e[9]=en[1],e[10]=en[2],e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e},axisRotate:un,axisRotation:on,cameraAim:function(n,t,r,e){return e=e||new G(16),tn=tn||c(),rn=rn||c(),en=en||c(),U(I(n,t,en),en),U(L(r,en,tn),tn),U(L(en,tn,rn),rn),e[0]=tn[0],e[1]=tn[1],e[2]=tn[2],e[3]=0,e[4]=rn[0],e[5]=rn[1],e[6]=rn[2],e[7]=0,e[8]=en[0],e[9]=en[1],e[10]=en[2],e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e},clone:J,copy:J,create:function(n,t,r,e,o,u,a,c,i,s,f,h,M,l,w,d){const m=new G(16);return void 0!==n&&(m[0]=n,void 0!==t&&(m[1]=t,void 0!==r&&(m[2]=r,void 0!==e&&(m[3]=e,void 0!==o&&(m[4]=o,void 0!==u&&(m[5]=u,void 0!==a&&(m[6]=a,void 0!==c&&(m[7]=c,void 0!==i&&(m[8]=i,void 0!==s&&(m[9]=s,void 0!==f&&(m[10]=f,void 0!==h&&(m[11]=h,void 0!==M&&(m[12]=M,void 0!==l&&(m[13]=l,void 0!==w&&(m[14]=w,void 0!==d&&(m[15]=d)))))))))))))))),m},determinant:function(n){const t=n[0],r=n[1],e=n[2],o=n[3],u=n[4],a=n[5],c=n[6],i=n[7],s=n[8],f=n[9],h=n[10],M=n[11],l=n[12],w=n[13],d=n[14],m=n[15],v=h*m,p=d*M,q=c*m,b=d*i,y=c*M,x=h*i,g=e*m,S=d*o,A=e*M,_=h*o,T=e*i,z=c*o;return t*(v*a+b*f+y*w-(p*a+q*f+x*w))+u*(p*r+g*f+_*w-(v*r+S*f+A*w))+s*(q*r+S*a+T*w-(b*r+g*a+z*w))+l*(x*r+A*a+z*f-(y*r+_*a+T*f))},equals:function(n,t){return n[0]===t[0]&&n[1]===t[1]&&n[2]===t[2]&&n[3]===t[3]&&n[4]===t[4]&&n[5]===t[5]&&n[6]===t[6]&&n[7]===t[7]&&n[8]===t[8]&&n[9]===t[9]&&n[10]===t[10]&&n[11]===t[11]&&n[12]===t[12]&&n[13]===t[13]&&n[14]===t[14]&&n[15]===t[15]},equalsApproximately:function(t,r){return Math.abs(t[0]-r[0])n){const n=Math.acos(d),t=Math.sin(n);s=Math.sin((1-e)*n)/t,f=Math.sin(e*n)/t}else s=1-e,f=e;return o[0]=s*u+f*h,o[1]=s*a+f*M,o[2]=s*c+f*l,o[3]=s*i+f*w,o}function wn(n,t){return(t=t||new cn(4))[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t}function dn(n,t,r){return(r=r||new cn(4))[0]=n[0]-t[0],r[1]=n[1]-t[1],r[2]=n[2]-t[2],r[3]=n[3]-t[3],r}function mn(n,t,r){return(r=r||new cn(4))[0]=n[0]*t,r[1]=n[1]*t,r[2]=n[2]*t,r[3]=n[3]*t,r}function vn(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]+n[3]*t[3]}function pn(n){const t=n[0],r=n[1],e=n[2],o=n[3];return Math.sqrt(t*t+r*r+e*e+o*o)}function qn(n){const t=n[0],r=n[1],e=n[2],o=n[3];return t*t+r*r+e*e+o*o}function bn(n,t){t=t||new cn(4);const r=n[0],e=n[1],o=n[2],u=n[3],a=Math.sqrt(r*r+e*e+o*o+u*u);return a>1e-5?(t[0]=r/a,t[1]=e/a,t[2]=o/a,t[3]=u/a):(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}let yn,xn,gn,Sn,An;var _n={__proto__:null,add:function(n,t,r){return(r=r||new cn(4))[0]=n[0]+t[0],r[1]=n[1]+t[1],r[2]=n[2]+t[2],r[3]=n[3]+t[3],r},angle:function(n,t){const r=vn(n,t);return Math.acos(2*r*r-1)},clone:wn,conjugate:function(n,t){return(t=t||new cn(4))[0]=-n[0],t[1]=-n[1],t[2]=-n[2],t[3]=n[3],t},copy:wn,create:fn,divScalar:function(n,t,r){return(r=r||new cn(4))[0]=n[0]/t,r[1]=n[1]/t,r[2]=n[2]/t,r[3]=n[3]/t,r},dot:vn,equals:function(n,t){return n[0]===t[0]&&n[1]===t[1]&&n[2]===t[2]&&n[3]===t[3]},equalsApproximately:function(t,r){return Math.abs(t[0]-r[0])0){const e=Math.sqrt(r+1);t[3]=.5*e;const o=.5/e;t[0]=(n[6]-n[9])*o,t[1]=(n[8]-n[2])*o,t[2]=(n[1]-n[4])*o}else{let r=0;n[5]>n[0]&&(r=1),n[10]>n[4*r+r]&&(r=2);const e=(r+1)%3,o=(r+2)%3,u=Math.sqrt(n[4*r+r]-n[4*e+e]-n[4*o+o]+1);t[r]=.5*u;const a=.5/u;t[3]=(n[4*e+o]-n[4*o+e])*a,t[e]=(n[4*e+r]+n[4*r+e])*a,t[o]=(n[4*o+r]+n[4*r+o])*a}return t},fromValues:fn,identity:function(n){return(n=n||new cn(4))[0]=0,n[1]=0,n[2]=0,n[3]=1,n},inverse:function(n,t){t=t||new cn(4);const r=n[0],e=n[1],o=n[2],u=n[3],a=r*r+e*e+o*o+u*u,c=a?1/a:0;return t[0]=-r*c,t[1]=-e*c,t[2]=-o*c,t[3]=u*c,t},len:pn,lenSq:qn,length:pn,lengthSq:qn,lerp:function(n,t,r,e){return(e=e||new cn(4))[0]=n[0]+r*(t[0]-n[0]),e[1]=n[1]+r*(t[1]-n[1]),e[2]=n[2]+r*(t[2]-n[2]),e[3]=n[3]+r*(t[3]-n[3]),e},mul:Mn,mulScalar:mn,multiply:Mn,normalize:bn,rotateX:function(n,t,r){r=r||new cn(4);const e=.5*t,o=n[0],u=n[1],a=n[2],c=n[3],i=Math.sin(e),s=Math.cos(e);return r[0]=o*s+c*i,r[1]=u*s+a*i,r[2]=a*s-u*i,r[3]=c*s-o*i,r},rotateY:function(n,t,r){r=r||new cn(4);const e=.5*t,o=n[0],u=n[1],a=n[2],c=n[3],i=Math.sin(e),s=Math.cos(e);return r[0]=o*s-a*i,r[1]=u*s+c*i,r[2]=a*s+o*i,r[3]=c*s-u*i,r},rotateZ:function(n,t,r){r=r||new cn(4);const e=.5*t,o=n[0],u=n[1],a=n[2],c=n[3],i=Math.sin(e),s=Math.cos(e);return r[0]=o*s+u*i,r[1]=u*s-o*i,r[2]=a*s+c*i,r[3]=c*s-a*i,r},rotationTo:function(n,t,r){r=r||new cn(4),yn=yn||c(),xn=xn||c(1,0,0),gn=gn||c(0,1,0);const e=R(n,t);return e<-.999999?(L(xn,n,yn),X(yn)<1e-6&&L(gn,n,yn),U(yn,yn),hn(yn,Math.PI,r),r):e>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(L(n,t,yn),r[0]=yn[0],r[1]=yn[1],r[2]=yn[2],r[3]=1+e,bn(r,r))},scale:mn,set:function(n,t,r,e,o){return(o=o||new cn(4))[0]=n,o[1]=t,o[2]=r,o[3]=e,o},setDefaultType:sn,slerp:ln,sqlerp:function(n,t,r,e,o,u){return u=u||new cn(4),Sn=Sn||new cn(4),An=An||new cn(4),ln(n,e,o,Sn),ln(t,r,o,An),ln(Sn,An,2*o*(1-o),u),u},sub:dn,subtract:dn,toAxisAngle:function(t,r){r=r||c(4);const e=2*Math.acos(t[3]),o=Math.sin(.5*e);return o>n?(r[0]=t[0]/o,r[1]=t[1]/o,r[2]=t[2]/o):(r[0]=1,r[1]=0,r[2]=0),{angle:e,axis:r}}};let Tn=Float32Array;function zn(n){const t=Tn;return Tn=n,t}function Fn(n,t,r,e){const o=new Tn(4);return void 0!==n&&(o[0]=n,void 0!==t&&(o[1]=t,void 0!==r&&(o[2]=r,void 0!==e&&(o[3]=e)))),o}function kn(n,t,r){return(r=r||new Tn(4))[0]=n[0]-t[0],r[1]=n[1]-t[1],r[2]=n[2]-t[2],r[3]=n[3]-t[3],r}function Dn(n,t,r,e){return(e=e||new Tn(4))[0]=n[0]+r*(t[0]-n[0]),e[1]=n[1]+r*(t[1]-n[1]),e[2]=n[2]+r*(t[2]-n[2]),e[3]=n[3]+r*(t[3]-n[3]),e}function In(n,t,r){return(r=r||new Tn(4))[0]=n[0]*t,r[1]=n[1]*t,r[2]=n[2]*t,r[3]=n[3]*t,r}function Pn(n,t){return(t=t||new Tn(4))[0]=1/n[0],t[1]=1/n[1],t[2]=1/n[2],t[3]=1/n[3],t}function Vn(n){const t=n[0],r=n[1],e=n[2],o=n[3];return Math.sqrt(t*t+r*r+e*e+o*o)}function Zn(n){const t=n[0],r=n[1],e=n[2],o=n[3];return t*t+r*r+e*e+o*o}function Ln(n,t){const r=n[0]-t[0],e=n[1]-t[1],o=n[2]-t[2],u=n[3]-t[3];return Math.sqrt(r*r+e*e+o*o+u*u)}function Rn(n,t){const r=n[0]-t[0],e=n[1]-t[1],o=n[2]-t[2],u=n[3]-t[3];return r*r+e*e+o*o+u*u}function En(n,t){t=t||new Tn(4);const r=n[0],e=n[1],o=n[2],u=n[3],a=Math.sqrt(r*r+e*e+o*o+u*u);return a>1e-5?(t[0]=r/a,t[1]=e/a,t[2]=o/a,t[3]=u/a):(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function Xn(n,t){return(t=t||new Tn(4))[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t}function Yn(n,t,r){return(r=r||new Tn(4))[0]=n[0]*t[0],r[1]=n[1]*t[1],r[2]=n[2]*t[2],r[3]=n[3]*t[3],r}function Qn(n,t,r){return(r=r||new Tn(4))[0]=n[0]/t[0],r[1]=n[1]/t[1],r[2]=n[2]/t[2],r[3]=n[3]/t[3],r}function Nn(n,t,r){return En(n,r=r||new Tn(4)),In(r,t,r)}var Un={__proto__:null,add:function(n,t,r){return(r=r||new Tn(4))[0]=n[0]+t[0],r[1]=n[1]+t[1],r[2]=n[2]+t[2],r[3]=n[3]+t[3],r},addScaled:function(n,t,r,e){return(e=e||new Tn(4))[0]=n[0]+t[0]*r,e[1]=n[1]+t[1]*r,e[2]=n[2]+t[2]*r,e[3]=n[3]+t[3]*r,e},ceil:function(n,t){return(t=t||new Tn(4))[0]=Math.ceil(n[0]),t[1]=Math.ceil(n[1]),t[2]=Math.ceil(n[2]),t[3]=Math.ceil(n[3]),t},clamp:function(n,t=0,r=1,e){return(e=e||new Tn(4))[0]=Math.min(r,Math.max(t,n[0])),e[1]=Math.min(r,Math.max(t,n[1])),e[2]=Math.min(r,Math.max(t,n[2])),e[3]=Math.min(r,Math.max(t,n[3])),e},clone:Xn,copy:Xn,create:Fn,dist:Ln,distSq:Rn,distance:Ln,distanceSq:Rn,div:Qn,divScalar:function(n,t,r){return(r=r||new Tn(4))[0]=n[0]/t,r[1]=n[1]/t,r[2]=n[2]/t,r[3]=n[3]/t,r},divide:Qn,dot:function(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]+n[3]*t[3]},equals:function(n,t){return n[0]===t[0]&&n[1]===t[1]&&n[2]===t[2]&&n[3]===t[3]},equalsApproximately:function(t,r){return Math.abs(t[0]-r[0])t?Nn(n,t,r):Xn(n,r)},zero:function(n){return(n=n||new Tn(4))[0]=0,n[1]=0,n[2]=0,n[3]=0,n}};function jn(n){_(n),H(n),sn(n),e(n),a(n),zn(n)}export{D as mat3,an as mat4,_n as quat,jn as setDefaultType,t as utils,x as vec2,C as vec3,Un as vec4}; -//# sourceMappingURL=wgpu-matrix.module.min.js.map diff --git a/dist/2.x/wgpu-matrix.module.min.js.map b/dist/2.x/wgpu-matrix.module.min.js.map deleted file mode 100644 index 972811d..0000000 --- a/dist/2.x/wgpu-matrix.module.min.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"wgpu-matrix.module.min.js","sources":["../../../src/utils.ts","../../../src/vec2.ts","../../../src/vec3.ts","../../../src/vec2-impl.ts","../../../src/mat3-impl.ts","../../../src/vec3-impl.ts","../../../src/mat4-impl.ts","../../../src/quat.ts","../../../src/quat-impl.ts","../../../src/vec4.ts","../../../src/vec4-impl.ts","../../../src/wgpu-matrix.ts"],"sourcesContent":["/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\n\nexport let EPSILON = 0.000001;\n\n/**\n * Set the value for EPSILON for various checks\n * @param v - Value to use for EPSILON.\n * @returns previous value of EPSILON;\n */\nexport function setEpsilon(v: number): number {\n const old = EPSILON;\n EPSILON = v;\n return old;\n}\n\n/**\n * Convert degrees to radians\n * @param degrees - Angle in degrees\n * @returns angle converted to radians\n */\nexport function degToRad(degrees: number): number {\n return degrees * Math.PI / 180;\n}\n\n/**\n * Convert radians to degrees\n * @param radians - Angle in radians\n * @returns angle converted to degrees\n */\nexport function radToDeg(radians: number): number {\n return radians * 180 / Math.PI;\n}\n\n/**\n * Lerps between a and b via t\n * @param a - starting value\n * @param b - ending value\n * @param t - value where 0 = a and 1 = b\n * @returns a + (b - a) * t\n */\nexport function lerp(a: number, b: number, t: number): number {\n return a + (b - a) * t;\n}\n\n/**\n * Compute the opposite of lerp. Given a and b and a value between\n * a and b returns a value between 0 and 1. 0 if a, 1 if b.\n * Note: no clamping is done.\n * @param a - start value\n * @param b - end value\n * @param v - value between a and b\n * @returns (v - a) / (b - a)\n */\nexport function inverseLerp(a: number, b: number, v: number): number {\n const d = b - a;\n return (Math.abs(b - a) < EPSILON)\n ? a\n : (v - a) / d;\n}\n\n/**\n * Compute the euclidean modulo\n *\n * ```\n * // table for n / 3\n * -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5 <- n\n * ------------------------------------\n * -2 -1 -0 -2 -1 0, 1, 2, 0, 1, 2 <- n % 3\n * 1 2 0 1 2 0, 1, 2, 0, 1, 2 <- euclideanModule(n, 3)\n * ```\n *\n * @param n - dividend\n * @param m - divisor\n * @returns the euclidean modulo of n / m\n */\nexport function euclideanModulo(n: number, m: number) {\n return ((n % m) + m) % m;\n}","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\n\n/**\n * A JavaScript array with 2 values, Float32Array with 2 values, or a Float64Array with 2 values.\n * When created by the library will create the default type which is `Float32Array`\n * but can be set by calling {@link vec2.setDefaultType}.\n */\nexport type Vec2 = number[] | Float32Array | Float64Array;\n\n/**\n *\n * Vec2 math functions.\n *\n * Almost all functions take an optional `dst` argument. If it is not passed in the\n * functions will create a new Vec2. In other words you can do this\n *\n * const v = vec2.cross(v1, v2); // Creates a new Vec2 with the cross product of v1 x v2.\n *\n * or\n *\n * const v = vec2.create();\n * vec2.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v\n *\n * The first style is often easier but depending on where it's used it generates garbage where\n * as there is almost never allocation with the second style.\n *\n * It is always safe to pass any vector as the destination. So for example\n *\n * vec2.cross(v1, v2, v1); // Puts the cross product of v1 x v2 in v1\n *\n */\n\nexport let VecType: new (n: number) => Vec2 = Float32Array;\n\n/**\n * Sets the type this library creates for a Vec2\n * @param ctor - the constructor for the type. Either `Float32Array`, `Float64Array`, or `Array`\n * @returns previous constructor for Vec2\n */\nexport function setDefaultType(ctor: new (n: number) => Vec2) {\n const oldType = VecType;\n VecType = ctor;\n return oldType;\n}\n\n/**\n * Creates a Vec2; may be called with x, y, z to set initial values.\n *\n * Note: Since passing in a raw JavaScript array\n * is valid in all circumstances, if you want to\n * force a JavaScript array into a Vec2's specified type\n * it would be faster to use\n *\n * ```\n * const v = vec2.clone(someJSArray);\n * ```\n *\n * Note: a consequence of the implementation is if your Vec2Type = `Array`\n * instead of `Float32Array` or `Float64Array` then any values you\n * don't pass in will be undefined. Usually this is not an issue since\n * (a) using `Array` is rare and (b) using `vec2.create` is usually used\n * to create a Vec2 to be filled out as in\n *\n * ```\n * const sum = vec2.create();\n * vec2.add(v1, v2, sum);\n * ```\n *\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @returns the created vector\n */\nexport function create(x = 0, y = 0): Vec2 {\n const dst = new VecType(2);\n if (x !== undefined) {\n dst[0] = x;\n if (y !== undefined) {\n dst[1] = y;\n }\n }\n return dst;\n}\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\n\n/**\n * A JavaScript array with 3 values, Float32Array with 3 values, or a Float64Array with 3 values.\n * When created by the library will create the default type which is `Float32Array`\n * but can be set by calling {@link vec3.setDefaultType}.\n */\nexport type Vec3 = number[] | Float32Array | Float64Array;\n\n/**\n *\n * Vec3 math functions.\n *\n * Almost all functions take an optional `dst` argument. If it is not passed in the\n * functions will create a new `Vec3`. In other words you can do this\n *\n * const v = vec3.cross(v1, v2); // Creates a new Vec3 with the cross product of v1 x v2.\n *\n * or\n *\n * const v = vec3.create();\n * vec3.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v\n *\n * The first style is often easier but depending on where it's used it generates garbage where\n * as there is almost never allocation with the second style.\n *\n * It is always safe to pass any vector as the destination. So for example\n *\n * vec3.cross(v1, v2, v1); // Puts the cross product of v1 x v2 in v1\n *\n */\n\nexport let VecType: new (n: number) => Vec3 = Float32Array;\n\n/**\n * Sets the type this library creates for a Vec3\n * @param ctor - the constructor for the type. Either `Float32Array`, `Float64Array`, or `Array`\n * @returns previous constructor for Vec3\n */\nexport function setDefaultType(ctor: new (n: number) => Vec3) {\n const oldType = VecType;\n VecType = ctor;\n return oldType;\n}\n\n/**\n * Creates a vec3; may be called with x, y, z to set initial values.\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @returns the created vector\n */\nexport function create(x?: number, y?: number, z?: number): Vec3 {\n const dst = new VecType(3);\n if (x !== undefined) {\n dst[0] = x;\n if (y !== undefined) {\n dst[1] = y;\n if (z !== undefined) {\n dst[2] = z;\n }\n }\n }\n return dst;\n}","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport * as utils from './utils.js';\nimport { Mat3 } from './mat3';\nimport { Mat4 } from './mat4';\nimport { Vec2, create, setDefaultType, VecType } from './vec2';\nimport { Vec3, VecType as Vec3Type } from './vec3';\n\nexport default Vec2;\nexport { create, setDefaultType };\n\n/**\n * Creates a Vec2; may be called with x, y, z to set initial values. (same as create)\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @returns the created vector\n */\nexport const fromValues = create;\n\n/**\n * Sets the values of a Vec2\n * Also see {@link vec2.create} and {@link vec2.copy}\n *\n * @param x first value\n * @param y second value\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector with its elements set.\n */\nexport function set(x: number, y: number, dst?: Vec2) {\n dst = dst || new VecType(2);\n\n dst[0] = x;\n dst[1] = y;\n\n return dst;\n}\n\n/**\n * Applies Math.ceil to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the ceil of each element of v.\n */\nexport function ceil(v: Vec2, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = Math.ceil(v[0]);\n dst[1] = Math.ceil(v[1]);\n\n return dst;\n}\n\n/**\n * Applies Math.floor to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the floor of each element of v.\n */\nexport function floor(v: Vec2, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = Math.floor(v[0]);\n dst[1] = Math.floor(v[1]);\n\n return dst;\n}\n\n/**\n * Applies Math.round to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the round of each element of v.\n */\nexport function round(v: Vec2, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = Math.round(v[0]);\n dst[1] = Math.round(v[1]);\n\n return dst;\n}\n\n/**\n * Clamp each element of vector between min and max\n * @param v - Operand vector.\n * @param max - Min value, default 0\n * @param min - Max value, default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that the clamped value of each element of v.\n */\nexport function clamp(v: Vec2, min = 0, max = 1, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = Math.min(max, Math.max(min, v[0]));\n dst[1] = Math.min(max, Math.max(min, v[1]));\n\n return dst;\n}\n\n/**\n * Adds two vectors; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a and b.\n */\nexport function add(a: Vec2, b: Vec2, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = a[0] + b[0];\n dst[1] = a[1] + b[1];\n\n return dst;\n}\n\n/**\n * Adds two vectors, scaling the 2nd; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param scale - Amount to scale b\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a + b * scale.\n */\nexport function addScaled(a: Vec2, b: Vec2, scale: number, dst?: Vec2) {\n dst = dst || new VecType(2);\n\n dst[0] = a[0] + b[0] * scale;\n dst[1] = a[1] + b[1] * scale;\n\n return dst;\n}\n\n/**\n * Returns the angle in radians between two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns The angle in radians between the 2 vectors.\n */\nexport function angle(a: Vec2, b: Vec2): number {\n const ax = a[0];\n const ay = a[1];\n const bx = b[0];\n const by = b[1];\n const mag1 = Math.sqrt(ax * ax + ay * ay);\n const mag2 = Math.sqrt(bx * bx + by * by);\n const mag = mag1 * mag2;\n const cosine = mag && dot(a, b) / mag;\n return Math.acos(cosine);\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nexport function subtract(a: Vec2, b: Vec2, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = a[0] - b[0];\n dst[1] = a[1] - b[1];\n\n return dst;\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nexport const sub = subtract;\n\n/**\n * Check if 2 vectors are approximately equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are approximately equal\n */\nexport function equalsApproximately(a: Vec2, b: Vec2): boolean {\n return Math.abs(a[0] - b[0]) < utils.EPSILON &&\n Math.abs(a[1] - b[1]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 vectors are exactly equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are exactly equal\n */\nexport function equals(a: Vec2, b: Vec2): boolean {\n return a[0] === b[0] && a[1] === b[1];\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficient.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The linear interpolated result.\n */\nexport function lerp(a: Vec2, b: Vec2, t: number, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = a[0] + t * (b[0] - a[0]);\n dst[1] = a[1] + t * (b[1] - a[1]);\n\n return dst;\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient vector t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficients vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns the linear interpolated result.\n */\nexport function lerpV(a: Vec2, b: Vec2, t: Vec2, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = a[0] + t[0] * (b[0] - a[0]);\n dst[1] = a[1] + t[1] * (b[1] - a[1]);\n\n return dst;\n}\n\n/**\n * Return max values of two vectors.\n * Given vectors a and b returns\n * [max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The max components vector.\n */\nexport function max(a: Vec2, b: Vec2, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = Math.max(a[0], b[0]);\n dst[1] = Math.max(a[1], b[1]);\n\n return dst;\n}\n\n/**\n * Return min values of two vectors.\n * Given vectors a and b returns\n * [min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The min components vector.\n */\nexport function min(a: Vec2, b: Vec2, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = Math.min(a[0], b[0]);\n dst[1] = Math.min(a[1], b[1]);\n\n return dst;\n}\n\n/**\n * Multiplies a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nexport function mulScalar(v: Vec2, k: number, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = v[0] * k;\n dst[1] = v[1] * k;\n\n return dst;\n}\n\n/**\n * Multiplies a vector by a scalar. (same as mulScalar)\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nexport const scale = mulScalar;\n\n/**\n * Divides a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nexport function divScalar(v: Vec2, k: number, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = v[0] / k;\n dst[1] = v[1] / k;\n\n return dst;\n}\n\n/**\n * Inverse a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nexport function inverse(v: Vec2, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = 1 / v[0];\n dst[1] = 1 / v[1];\n\n return dst;\n}\n\n/**\n * Invert a vector. (same as inverse)\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nexport const invert = inverse;\n\n/**\n * Computes the cross product of two vectors; assumes both vectors have\n * three entries.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of a cross b.\n */\nexport function cross(a: Vec2, b: Vec2, dst?: Vec3): Vec3 {\n dst = dst || new Vec3Type(3);\n const z = a[0] * b[1] - a[1] * b[0];\n dst[0] = 0;\n dst[1] = 0;\n dst[2] = z;\n\n return dst;\n}\n\n/**\n * Computes the dot product of two vectors; assumes both vectors have\n * three entries.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns dot product\n */\nexport function dot(a: Vec2, b: Vec2): number {\n return a[0] * b[0] + a[1] * b[1];\n}\n\n/**\n * Computes the length of vector\n * @param v - vector.\n * @returns length of vector.\n */\nexport function length(v: Vec2): number {\n const v0 = v[0];\n const v1 = v[1];\n return Math.sqrt(v0 * v0 + v1 * v1);\n}\n\n/**\n * Computes the length of vector (same as length)\n * @param v - vector.\n * @returns length of vector.\n */\nexport const len = length;\n\n/**\n * Computes the square of the length of vector\n * @param v - vector.\n * @returns square of the length of vector.\n */\nexport function lengthSq(v: Vec2): number {\n const v0 = v[0];\n const v1 = v[1];\n return v0 * v0 + v1 * v1;\n}\n\n/**\n * Computes the square of the length of vector (same as lengthSq)\n * @param v - vector.\n * @returns square of the length of vector.\n */\nexport const lenSq = lengthSq;\n\n/**\n * Computes the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nexport function distance(a: Vec2, b: Vec2): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n return Math.sqrt(dx * dx + dy * dy);\n}\n\n/**\n * Computes the distance between 2 points (same as distance)\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nexport const dist = distance;\n\n/**\n * Computes the square of the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nexport function distanceSq(a: Vec2, b: Vec2): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n return dx * dx + dy * dy;\n}\n\n/**\n * Computes the square of the distance between 2 points (same as distanceSq)\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nexport const distSq = distanceSq;\n\n/**\n * Divides a vector by its Euclidean length and returns the quotient.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The normalized vector.\n */\nexport function normalize(v: Vec2, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n const v0 = v[0];\n const v1 = v[1];\n const len = Math.sqrt(v0 * v0 + v1 * v1);\n\n if (len > 0.00001) {\n dst[0] = v0 / len;\n dst[1] = v1 / len;\n } else {\n dst[0] = 0;\n dst[1] = 0;\n }\n\n return dst;\n}\n\n/**\n * Negates a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns -v.\n */\nexport function negate(v: Vec2, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = -v[0];\n dst[1] = -v[1];\n\n return dst;\n}\n\n/**\n * Copies a vector. (same as {@link vec2.clone})\n * Also see {@link vec2.create} and {@link vec2.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nexport function copy(v: Vec2, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = v[0];\n dst[1] = v[1];\n\n return dst;\n}\n\n/**\n * Clones a vector. (same as {@link vec2.copy})\n * Also see {@link vec2.create} and {@link vec2.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nexport const clone = copy;\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nexport function multiply(a: Vec2, b: Vec2, dst?: Vec2) {\n dst = dst || new VecType(2);\n\n dst[0] = a[0] * b[0];\n dst[1] = a[1] * b[1];\n\n return dst;\n}\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as mul)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nexport const mul = multiply;\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nexport function divide(a: Vec2, b: Vec2, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = a[0] / b[0];\n dst[1] = a[1] / b[1];\n\n return dst;\n}\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as divide)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nexport const div = divide;\n\n/**\n * Creates a random unit vector * scale\n * @param scale - Default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The random vector.\n */\nexport function random(scale = 1, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n const angle = Math.random() * 2 * Math.PI;\n dst[0] = Math.cos(angle) * scale;\n dst[1] = Math.sin(angle) * scale;\n\n return dst;\n}\n\n/**\n * Zero's a vector\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The zeroed vector.\n */\nexport function zero(dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n dst[0] = 0;\n dst[1] = 0;\n\n return dst;\n}\n\n\n/**\n * transform Vec2 by 4x4 matrix\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional Vec2 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nexport function transformMat4(v: Vec2, m: Mat4, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n const x = v[0];\n const y = v[1];\n\n dst[0] = x * m[0] + y * m[4] + m[12];\n dst[1] = x * m[1] + y * m[5] + m[13];\n\n return dst;\n}\n\n/**\n * Transforms vec4 by 3x3 matrix\n *\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional Vec2 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nexport function transformMat3(v: Vec2, m: Mat3, dst?: Vec2): Vec2 {\n dst = dst || new VecType(2);\n\n const x = v[0];\n const y = v[1];\n\n dst[0] = m[0] * x + m[4] * y + m[8];\n dst[1] = m[1] * x + m[5] * y + m[9];\n\n return dst;\n}\n\n/**\n * Rotate a 2D vector\n *\n * @param a The vec2 point to rotate\n * @param b The origin of the rotation\n * @param rad The angle of rotation in radians\n * @returns the rotated vector\n */\nexport function rotate(a: Vec2, b: Vec2, rad: number, dst?: Vec2) {\n dst = dst || new VecType(2);\n\n // Translate point to the origin\n const p0 = a[0] - b[0];\n const p1 = a[1] - b[1];\n const sinC = Math.sin(rad);\n const cosC = Math.cos(rad);\n\n //perform rotation and translate to correct position\n dst[0] = p0 * cosC - p1 * sinC + b[0];\n dst[1] = p0 * sinC + p1 * cosC + b[1];\n\n return dst;\n}\n\n/**\n * Treat a 2D vector as a direction and set it's length\n *\n * @param a The vec2 to lengthen\n * @param len The length of the resulting vector\n * @returns The lengthened vector\n */\nexport function setLength(a: Vec2, len: number, dst?: Vec2) {\n dst = dst || new VecType(2);\n normalize(a, dst);\n return mulScalar(dst, len, dst);\n}\n\n/**\n * Ensure a vector is not longer than a max length\n *\n * @param a The vec2 to limit\n * @param maxLen The longest length of the resulting vector\n * @returns The vector, shortened to maxLen if it's too long\n */\nexport function truncate(a: Vec2, maxLen: number, dst?: Vec2) {\n dst = dst || new VecType(2);\n\n if (length(a) > maxLen) {\n return setLength(a, maxLen, dst);\n }\n\n return copy(a, dst);\n}\n\n/**\n * Return the vector exactly between 2 endpoint vectors\n *\n * @param a Endpoint 1\n * @param b Endpoint 2\n * @returns The vector exactly residing between endpoints 1 and 2\n */\nexport function midpoint(a: Vec2, b: Vec2, dst?: Vec2) {\n dst = dst || new VecType(2);\n return lerp(a, b, 0.5, dst);\n}\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\n\nimport * as utils from './utils.js';\nimport { Quat } from './quat';\nimport { Mat3 } from './mat3';\nimport { Mat4 } from './mat4';\nimport Vec2, * as vec2 from './vec2-impl';\n\nexport default Mat3;\n\nexport type Mat3LikeCtor = new (n: number) => Mat3;\n\n/**\n * 3x3 Matrix math math functions.\n *\n * Almost all functions take an optional `dst` argument. If it is not passed in the\n * functions will create a new matrix. In other words you can do this\n *\n * const mat = mat3.translation([1, 2, 3]); // Creates a new translation matrix\n *\n * or\n *\n * const mat = mat3.create();\n * mat3.translation([1, 2, 3], mat); // Puts translation matrix in mat.\n *\n * The first style is often easier but depending on where it's used it generates garbage where\n * as there is almost never allocation with the second style.\n *\n * It is always save to pass any matrix as the destination. So for example\n *\n * const mat = mat3.identity();\n * const trans = mat3.translation([1, 2, 3]);\n * mat3.multiply(mat, trans, mat); // Multiplies mat * trans and puts result in mat.\n *\n */\nlet MatType: Mat3LikeCtor = Float32Array;\n\n// This mess is because with Mat3 we have 3 unused elements.\n// For Float32Array and Float64Array that's not an issue\n// but for Array it's troublesome\nconst ctorMap = new Map Mat3>([\n [Float32Array, () => new Float32Array(12)],\n [Float64Array, () => new Float64Array(12)],\n [Array, () => new Array(12).fill(0)],\n]);\nlet newMat3: () => Mat3 = ctorMap.get(Float32Array)!;\n\n/**\n * Sets the type this library creates for a Mat3\n * @param ctor - the constructor for the type. Either `Float32Array`, `Float64Array`, or `Array`\n * @returns previous constructor for Mat3\n */\nexport function setDefaultType(ctor: new (n: number) => Mat3) {\n const oldType = MatType;\n MatType = ctor;\n newMat3 = ctorMap.get(ctor)!;\n return oldType;\n}\n\n/**\n * Create a Mat3 from values\n *\n * Note: Since passing in a raw JavaScript array\n * is valid in all circumstances, if you want to\n * force a JavaScript array into a Mat3's specified type\n * it would be faster to use\n *\n * ```\n * const m = mat3.clone(someJSArray);\n * ```\n *\n * Note: a consequence of the implementation is if your Mat3Type = `Array`\n * instead of `Float32Array` or `Float64Array` then any values you\n * don't pass in will be undefined. Usually this is not an issue since\n * (a) using `Array` is rare and (b) using `mat3.create` is usually used\n * to create a Mat3 to be filled out as in\n *\n * ```\n * const m = mat3.create();\n * mat3.perspective(fov, aspect, near, far, m);\n * ```\n *\n * @param v0 - value for element 0\n * @param v1 - value for element 1\n * @param v2 - value for element 2\n * @param v3 - value for element 3\n * @param v4 - value for element 4\n * @param v5 - value for element 5\n * @param v6 - value for element 6\n * @param v7 - value for element 7\n * @param v8 - value for element 8\n * @returns matrix created from values.\n */\nexport function create(\n v0?: number, v1?: number, v2?: number,\n v3?: number, v4?: number, v5?: number,\n v6?: number, v7?: number, v8?: number): Mat3 {\n const dst = newMat3();\n // to make the array homogenous\n dst[3] = 0;\n dst[7] = 0;\n dst[11] = 0;\n\n if (v0 !== undefined) {\n dst[0] = v0;\n if (v1 !== undefined) {\n dst[1] = v1;\n if (v2 !== undefined) {\n dst[2] = v2;\n if (v3 !== undefined) {\n dst[4] = v3;\n if (v4 !== undefined) {\n dst[5] = v4;\n if (v5 !== undefined) {\n dst[6] = v5;\n if (v6 !== undefined) {\n dst[8] = v6;\n if (v7 !== undefined) {\n dst[9] = v7;\n if (v8 !== undefined) {\n dst[10] = v8;\n }\n }\n }\n }\n }\n }\n }\n }\n }\n\n return dst;\n}\n\n/**\n * Sets the values of a Mat3\n * Also see {@link mat3.create} and {@link mat3.copy}\n *\n * @param v0 - value for element 0\n * @param v1 - value for element 1\n * @param v2 - value for element 2\n * @param v3 - value for element 3\n * @param v4 - value for element 4\n * @param v5 - value for element 5\n * @param v6 - value for element 6\n * @param v7 - value for element 7\n * @param v8 - value for element 8\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat3 set from values.\n */\nexport function set(\n v0: number, v1: number, v2: number,\n v3: number, v4: number, v5: number,\n v6: number, v7: number, v8: number, dst?: Mat3) {\n dst = dst || newMat3();\n\n dst[0] = v0; dst[1] = v1; dst[ 2] = v2; dst[ 3] = 0;\n dst[4] = v3; dst[5] = v4; dst[ 6] = v5; dst[ 7] = 0;\n dst[8] = v6; dst[9] = v7; dst[10] = v8; dst[11] = 0;\n\n return dst;\n}\n\n/**\n * Creates a Mat3 from the upper left 3x3 part of a Mat4\n * @param m4 - source matrix\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat3 made from m4\n */\nexport function fromMat4(m4: Mat4, dst?: Mat3): Mat3 {\n dst = dst || newMat3();\n dst[0] = m4[0]; dst[1] = m4[1]; dst[ 2] = m4[ 2]; dst[ 3] = 0;\n dst[4] = m4[4]; dst[5] = m4[5]; dst[ 6] = m4[ 6]; dst[ 7] = 0;\n dst[8] = m4[8]; dst[9] = m4[9]; dst[10] = m4[10]; dst[11] = 0;\n return dst;\n}\n\n/**\n * Creates a Mat3 rotation matrix from a quaternion\n * @param q - quaternion to create matrix from\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat3 made from q\n */\nexport function fromQuat(q: Quat, dst?: Mat3): Mat3 {\n dst = dst || newMat3();\n\n const x = q[0]; const y = q[1]; const z = q[2]; const w = q[3];\n const x2 = x + x; const y2 = y + y; const z2 = z + z;\n\n const xx = x * x2;\n const yx = y * x2;\n const yy = y * y2;\n const zx = z * x2;\n const zy = z * y2;\n const zz = z * z2;\n const wx = w * x2;\n const wy = w * y2;\n const wz = w * z2;\n\n dst[ 0] = 1 - yy - zz; dst[ 1] = yx + wz; dst[ 2] = zx - wy; dst[ 3] = 0;\n dst[ 4] = yx - wz; dst[ 5] = 1 - xx - zz; dst[ 6] = zy + wx; dst[ 7] = 0;\n dst[ 8] = zx + wy; dst[ 9] = zy - wx; dst[10] = 1 - xx - yy; dst[11] = 0;\n\n return dst;\n}\n\n/**\n * Negates a matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns -m.\n */\nexport function negate(m: Mat3, dst?: Mat3): Mat3 {\n dst = dst || newMat3();\n\n dst[ 0] = -m[ 0]; dst[ 1] = -m[ 1]; dst[ 2] = -m[ 2];\n dst[ 4] = -m[ 4]; dst[ 5] = -m[ 5]; dst[ 6] = -m[ 6];\n dst[ 8] = -m[ 8]; dst[ 9] = -m[ 9]; dst[10] = -m[10];\n\n return dst;\n}\n\n/**\n * Copies a matrix. (same as {@link mat3.clone})\n * Also see {@link mat3.create} and {@link mat3.set}\n * @param m - The matrix.\n * @param dst - The matrix. If not passed a new one is created.\n * @returns A copy of m.\n */\nexport function copy(m: Mat3, dst?: Mat3): Mat3 {\n dst = dst || newMat3();\n\n dst[ 0] = m[ 0]; dst[ 1] = m[ 1]; dst[ 2] = m[ 2];\n dst[ 4] = m[ 4]; dst[ 5] = m[ 5]; dst[ 6] = m[ 6];\n dst[ 8] = m[ 8]; dst[ 9] = m[ 9]; dst[10] = m[10];\n\n return dst;\n}\n\n/**\n * Copies a matrix (same as {@link mat3.copy})\n * Also see {@link mat3.create} and {@link mat3.set}\n * @param m - The matrix.\n * @param dst - The matrix. If not passed a new one is created.\n * @returns A copy of m.\n */\nexport const clone = copy;\n\n/**\n * Check if 2 matrices are approximately equal\n * @param a Operand matrix.\n * @param b Operand matrix.\n * @returns true if matrices are approximately equal\n */\nexport function equalsApproximately(a: Mat3, b: Mat3): boolean {\n return Math.abs(a[ 0] - b[ 0]) < utils.EPSILON &&\n Math.abs(a[ 1] - b[ 1]) < utils.EPSILON &&\n Math.abs(a[ 2] - b[ 2]) < utils.EPSILON &&\n Math.abs(a[ 4] - b[ 4]) < utils.EPSILON &&\n Math.abs(a[ 5] - b[ 5]) < utils.EPSILON &&\n Math.abs(a[ 6] - b[ 6]) < utils.EPSILON &&\n Math.abs(a[ 8] - b[ 8]) < utils.EPSILON &&\n Math.abs(a[ 9] - b[ 9]) < utils.EPSILON &&\n Math.abs(a[10] - b[10]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 matrices are exactly equal\n * @param a Operand matrix.\n * @param b Operand matrix.\n * @returns true if matrices are exactly equal\n */\nexport function equals(a: Mat3, b: Mat3): boolean {\n return a[ 0] === b[ 0] &&\n a[ 1] === b[ 1] &&\n a[ 2] === b[ 2] &&\n a[ 4] === b[ 4] &&\n a[ 5] === b[ 5] &&\n a[ 6] === b[ 6] &&\n a[ 8] === b[ 8] &&\n a[ 9] === b[ 9] &&\n a[10] === b[10];\n}\n\n/**\n * Creates a 3-by-3 identity matrix.\n *\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns A 3-by-3 identity matrix.\n */\nexport function identity(dst?: Mat3): Mat3 {\n dst = dst || newMat3();\n\n dst[ 0] = 1; dst[ 1] = 0; dst[ 2] = 0;\n dst[ 4] = 0; dst[ 5] = 1; dst[ 6] = 0;\n dst[ 8] = 0; dst[ 9] = 0; dst[10] = 1;\n\n return dst;\n}\n\n/**\n * Takes the transpose of a matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The transpose of m.\n */\nexport function transpose(m: Mat3, dst?: Mat3): Mat3 {\n dst = dst || newMat3();\n if (dst === m) {\n let t: number;\n\n // 0 1 2\n // 4 5 6\n // 8 9 10\n\n t = m[1];\n m[1] = m[4];\n m[4] = t;\n\n t = m[2];\n m[2] = m[8];\n m[8] = t;\n\n t = m[6];\n m[6] = m[9];\n m[9] = t;\n\n return dst;\n }\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n\n dst[ 0] = m00; dst[ 1] = m10; dst[ 2] = m20;\n dst[ 4] = m01; dst[ 5] = m11; dst[ 6] = m21;\n dst[ 8] = m02; dst[ 9] = m12; dst[10] = m22;\n\n return dst;\n}\n\n/**\n * Computes the inverse of a 3-by-3 matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The inverse of m.\n */\nexport function inverse(m: Mat3, dst?: Mat3): Mat3 {\n dst = dst || newMat3();\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n\n const b01 = m22 * m11 - m12 * m21;\n const b11 = -m22 * m10 + m12 * m20;\n const b21 = m21 * m10 - m11 * m20;\n\n const invDet = 1 / (m00 * b01 + m01 * b11 + m02 * b21);\n\n dst[ 0] = b01 * invDet;\n dst[ 1] = (-m22 * m01 + m02 * m21) * invDet;\n dst[ 2] = ( m12 * m01 - m02 * m11) * invDet;\n dst[ 4] = b11 * invDet;\n dst[ 5] = ( m22 * m00 - m02 * m20) * invDet;\n dst[ 6] = (-m12 * m00 + m02 * m10) * invDet;\n dst[ 8] = b21 * invDet;\n dst[ 9] = (-m21 * m00 + m01 * m20) * invDet;\n dst[10] = ( m11 * m00 - m01 * m10) * invDet;\n\n return dst;\n}\n\n/**\n * Compute the determinant of a matrix\n * @param m - the matrix\n * @returns the determinant\n */\nexport function determinant(m: Mat3): number {\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n\n return m00 * (m11 * m22 - m21 * m12) -\n m10 * (m01 * m22 - m21 * m02) +\n m20 * (m01 * m12 - m11 * m02);\n}\n\n/**\n * Computes the inverse of a 3-by-3 matrix. (same as inverse)\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The inverse of m.\n */\nexport const invert = inverse;\n\n/**\n * Multiplies two 3-by-3 matrices with a on the left and b on the right\n * @param a - The matrix on the left.\n * @param b - The matrix on the right.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix product of a and b.\n */\nexport function multiply(a: Mat3, b: Mat3, dst?: Mat3): Mat3 {\n dst = dst || newMat3();\n\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a10 = a[ 4 + 0];\n const a11 = a[ 4 + 1];\n const a12 = a[ 4 + 2];\n const a20 = a[ 8 + 0];\n const a21 = a[ 8 + 1];\n const a22 = a[ 8 + 2];\n const b00 = b[0];\n const b01 = b[1];\n const b02 = b[2];\n const b10 = b[ 4 + 0];\n const b11 = b[ 4 + 1];\n const b12 = b[ 4 + 2];\n const b20 = b[ 8 + 0];\n const b21 = b[ 8 + 1];\n const b22 = b[ 8 + 2];\n\n dst[ 0] = a00 * b00 + a10 * b01 + a20 * b02;\n dst[ 1] = a01 * b00 + a11 * b01 + a21 * b02;\n dst[ 2] = a02 * b00 + a12 * b01 + a22 * b02;\n dst[ 4] = a00 * b10 + a10 * b11 + a20 * b12;\n dst[ 5] = a01 * b10 + a11 * b11 + a21 * b12;\n dst[ 6] = a02 * b10 + a12 * b11 + a22 * b12;\n dst[ 8] = a00 * b20 + a10 * b21 + a20 * b22;\n dst[ 9] = a01 * b20 + a11 * b21 + a21 * b22;\n dst[10] = a02 * b20 + a12 * b21 + a22 * b22;\n\n return dst;\n}\n\n/**\n * Multiplies two 3-by-3 matrices with a on the left and b on the right (same as multiply)\n * @param a - The matrix on the left.\n * @param b - The matrix on the right.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix product of a and b.\n */\nexport const mul = multiply;\n\n/**\n * Sets the translation component of a 3-by-3 matrix to the given\n * vector.\n * @param a - The matrix.\n * @param v - The vector.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix with translation set.\n */\nexport function setTranslation(a: Mat3, v: Vec2, dst?: Mat3): Mat3 {\n dst = dst || identity();\n if (a !== dst) {\n dst[ 0] = a[ 0];\n dst[ 1] = a[ 1];\n dst[ 2] = a[ 2];\n dst[ 4] = a[ 4];\n dst[ 5] = a[ 5];\n dst[ 6] = a[ 6];\n }\n dst[ 8] = v[0];\n dst[ 9] = v[1];\n dst[10] = 1;\n return dst;\n}\n\n/**\n * Returns the translation component of a 3-by-3 matrix as a vector with 3\n * entries.\n * @param m - The matrix.\n * @param dst - vector to hold result. If not passed a new one is created.\n * @returns The translation component of m.\n */\nexport function getTranslation(m: Mat3, dst?: Vec2): Vec2 {\n dst = dst || vec2.create();\n dst[0] = m[8];\n dst[1] = m[9];\n return dst;\n}\n\n/**\n * Returns an axis of a 3x3 matrix as a vector with 2 entries\n * @param m - The matrix.\n * @param axis - The axis 0 = x, 1 = y,\n * @returns The axis component of m.\n */\nexport function getAxis(m: Mat3, axis: number, dst?: Vec2): Vec2 {\n dst = dst || vec2.create();\n const off = axis * 4;\n dst[0] = m[off + 0];\n dst[1] = m[off + 1];\n return dst;\n}\n\n/**\n * Sets an axis of a 3x3 matrix as a vector with 2 entries\n * @param m - The matrix.\n * @param v - the axis vector\n * @param axis - The axis 0 = x, 1 = y;\n * @param dst - The matrix to set. If not passed a new one is created.\n * @returns The matrix with axis set.\n */\nexport function setAxis(m: Mat3, v: Vec2, axis: number, dst?: Mat3): Mat3 {\n if (dst !== m) {\n dst = copy(m, dst);\n }\n const off = axis * 4;\n dst[off + 0] = v[0];\n dst[off + 1] = v[1];\n return dst;\n}\n\n/**\n * Returns the scaling component of the matrix\n * @param m - The Matrix\n * @param dst - The vector to set. If not passed a new one is created.\n */\nexport function getScaling(m: Mat3, dst?: Vec2): Vec2 {\n dst = dst || vec2.create();\n\n const xx = m[0];\n const xy = m[1];\n const yx = m[4];\n const yy = m[5];\n\n dst[0] = Math.sqrt(xx * xx + xy * xy);\n dst[1] = Math.sqrt(yx * yx + yy * yy);\n\n return dst;\n}\n\n/**\n * Creates a 3-by-3 matrix which translates by the given vector v.\n * @param v - The vector by which to translate.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The translation matrix.\n */\nexport function translation(v: Vec2, dst?: Mat3): Mat3 {\n dst = dst || newMat3();\n\n dst[ 0] = 1; dst[ 1] = 0; dst[ 2] = 0;\n dst[ 4] = 0; dst[ 5] = 1; dst[ 6] = 0;\n dst[ 8] = v[0]; dst[ 9] = v[1]; dst[10] = 1;\n\n return dst;\n}\n\n/**\n * Translates the given 3-by-3 matrix by the given vector v.\n * @param m - The matrix.\n * @param v - The vector by which to translate.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The translated matrix.\n */\nexport function translate(m: Mat3, v: Vec2, dst?: Mat3): Mat3 {\n dst = dst || newMat3();\n\n const v0 = v[0];\n const v1 = v[1];\n\n const m00 = m[0];\n const m01 = m[1];\n const m02 = m[2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n\n if (m !== dst) {\n dst[ 0] = m00;\n dst[ 1] = m01;\n dst[ 2] = m02;\n dst[ 4] = m10;\n dst[ 5] = m11;\n dst[ 6] = m12;\n }\n\n dst[ 8] = m00 * v0 + m10 * v1 + m20;\n dst[ 9] = m01 * v0 + m11 * v1 + m21;\n dst[10] = m02 * v0 + m12 * v1 + m22;\n\n return dst;\n}\n\n/**\n * Creates a 3-by-3 matrix which rotates by the given angle.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotation matrix.\n */\nexport function rotation(angleInRadians: number, dst?: Mat3): Mat3 {\n dst = dst || newMat3();\n\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n dst[ 0] = c; dst[ 1] = s; dst[ 2] = 0;\n dst[ 4] = -s; dst[ 5] = c; dst[ 6] = 0;\n dst[ 8] = 0; dst[ 9] = 0; dst[10] = 1;\n\n return dst;\n}\n\n/**\n * Rotates the given 3-by-3 matrix by the given angle.\n * @param m - The matrix.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nexport function rotate(m: Mat3, angleInRadians: number, dst?: Mat3): Mat3 {\n dst = dst || newMat3();\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n dst[ 0] = c * m00 + s * m10;\n dst[ 1] = c * m01 + s * m11;\n dst[ 2] = c * m02 + s * m12;\n\n dst[ 4] = c * m10 - s * m00;\n dst[ 5] = c * m11 - s * m01;\n dst[ 6] = c * m12 - s * m02;\n\n\n if (m !== dst) {\n dst[ 8] = m[ 8];\n dst[ 9] = m[ 9];\n dst[10] = m[10];\n }\n\n return dst;\n}\n\n/**\n * Creates a 3-by-3 matrix which scales in each dimension by an amount given by\n * the corresponding entry in the given vector; assumes the vector has three\n * entries.\n * @param v - A vector of\n * 2 entries specifying the factor by which to scale in each dimension.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaling matrix.\n */\nexport function scaling(v: Vec2, dst?: Mat3): Mat3 {\n dst = dst || newMat3();\n\n dst[ 0] = v[0]; dst[ 1] = 0; dst[ 2] = 0;\n dst[ 4] = 0; dst[ 5] = v[1]; dst[ 6] = 0;\n dst[ 8] = 0; dst[ 9] = 0; dst[10] = 1;\n\n return dst;\n}\n\n/**\n * Scales the given 3-by-3 matrix in each dimension by an amount\n * given by the corresponding entry in the given vector; assumes the vector has\n * three entries.\n * @param m - The matrix to be modified.\n * @param v - A vector of 2 entries specifying the\n * factor by which to scale in each dimension.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaled matrix.\n */\nexport function scale(m: Mat3, v: Vec2, dst?: Mat3): Mat3 {\n dst = dst || newMat3();\n\n const v0 = v[0];\n const v1 = v[1];\n\n dst[ 0] = v0 * m[0 * 4 + 0];\n dst[ 1] = v0 * m[0 * 4 + 1];\n dst[ 2] = v0 * m[0 * 4 + 2];\n\n dst[ 4] = v1 * m[1 * 4 + 0];\n dst[ 5] = v1 * m[1 * 4 + 1];\n dst[ 6] = v1 * m[1 * 4 + 2];\n\n if (m !== dst) {\n dst[ 8] = m[ 8];\n dst[ 9] = m[ 9];\n dst[10] = m[10];\n }\n\n return dst;\n}\n\n/**\n * Creates a 3-by-3 matrix which scales uniformly in each dimension\n * @param s - Amount to scale\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaling matrix.\n */\nexport function uniformScaling(s: number, dst?: Mat3): Mat3 {\n dst = dst || newMat3();\n\n dst[ 0] = s; dst[ 1] = 0; dst[ 2] = 0;\n dst[ 4] = 0; dst[ 5] = s; dst[ 6] = 0;\n dst[ 8] = 0; dst[ 9] = 0; dst[10] = 1;\n\n return dst;\n}\n\n/**\n * Scales the given 3-by-3 matrix in each dimension by an amount\n * given.\n * @param m - The matrix to be modified.\n * @param s - Amount to scale.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaled matrix.\n */\nexport function uniformScale(m: Mat3, s: number, dst?: Mat3): Mat3 {\n dst = dst || newMat3();\n\n dst[ 0] = s * m[0 * 4 + 0];\n dst[ 1] = s * m[0 * 4 + 1];\n dst[ 2] = s * m[0 * 4 + 2];\n\n dst[ 4] = s * m[1 * 4 + 0];\n dst[ 5] = s * m[1 * 4 + 1];\n dst[ 6] = s * m[1 * 4 + 2];\n\n if (m !== dst) {\n dst[ 8] = m[ 8];\n dst[ 9] = m[ 9];\n dst[10] = m[10];\n }\n\n return dst;\n}\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport * as utils from './utils.js';\nimport { Vec3, create, setDefaultType, VecType } from './vec3';\nimport { Mat3 } from './mat3';\nimport { Mat4 } from './mat4';\nimport { Quat } from './quat';\n\nexport default Vec3;\nexport { create, setDefaultType };\n\n/**\n * Creates a vec3; may be called with x, y, z to set initial values. (same as create)\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @returns the created vector\n */\nexport const fromValues = create;\n\n/**\n * Sets the values of a Vec3\n * Also see {@link vec3.create} and {@link vec3.copy}\n *\n * @param x first value\n * @param y second value\n * @param z third value\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector with its elements set.\n */\nexport function set(x: number, y: number, z: number, dst?: Vec3) {\n dst = dst || new VecType(3);\n\n dst[0] = x;\n dst[1] = y;\n dst[2] = z;\n\n return dst;\n}\n\n/**\n * Applies Math.ceil to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the ceil of each element of v.\n */\nexport function ceil(v: Vec3, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = Math.ceil(v[0]);\n dst[1] = Math.ceil(v[1]);\n dst[2] = Math.ceil(v[2]);\n\n return dst;\n}\n\n/**\n * Applies Math.floor to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the floor of each element of v.\n */\nexport function floor(v: Vec3, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = Math.floor(v[0]);\n dst[1] = Math.floor(v[1]);\n dst[2] = Math.floor(v[2]);\n\n return dst;\n}\n\n/**\n * Applies Math.round to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the round of each element of v.\n */\nexport function round(v: Vec3, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = Math.round(v[0]);\n dst[1] = Math.round(v[1]);\n dst[2] = Math.round(v[2]);\n\n return dst;\n}\n\n/**\n * Clamp each element of vector between min and max\n * @param v - Operand vector.\n * @param max - Min value, default 0\n * @param min - Max value, default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that the clamped value of each element of v.\n */\nexport function clamp(v: Vec3, min = 0, max = 1, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = Math.min(max, Math.max(min, v[0]));\n dst[1] = Math.min(max, Math.max(min, v[1]));\n dst[2] = Math.min(max, Math.max(min, v[2]));\n\n return dst;\n}\n\n/**\n * Adds two vectors; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a and b.\n */\nexport function add(a: Vec3, b: Vec3, dst?: Vec3) {\n dst = dst || new VecType(3);\n\n dst[0] = a[0] + b[0];\n dst[1] = a[1] + b[1];\n dst[2] = a[2] + b[2];\n\n return dst;\n}\n\n/**\n * Adds two vectors, scaling the 2nd; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param scale - Amount to scale b\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a + b * scale.\n */\nexport function addScaled(a: Vec3, b: Vec3, scale: number, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = a[0] + b[0] * scale;\n dst[1] = a[1] + b[1] * scale;\n dst[2] = a[2] + b[2] * scale;\n\n return dst;\n}\n\n/**\n * Returns the angle in radians between two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns The angle in radians between the 2 vectors.\n */\nexport function angle(a: Vec3, b: Vec3): number {\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const bx = b[0];\n const by = b[1];\n const bz = b[2];\n const mag1 = Math.sqrt(ax * ax + ay * ay + az * az);\n const mag2 = Math.sqrt(bx * bx + by * by + bz * bz);\n const mag = mag1 * mag2;\n const cosine = mag && dot(a, b) / mag;\n return Math.acos(cosine);\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nexport function subtract(a: Vec3, b: Vec3, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = a[0] - b[0];\n dst[1] = a[1] - b[1];\n dst[2] = a[2] - b[2];\n\n return dst;\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nexport const sub = subtract;\n\n/**\n * Check if 2 vectors are approximately equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are approximately equal\n */\nexport function equalsApproximately(a: Vec3, b: Vec3): boolean {\n return Math.abs(a[0] - b[0]) < utils.EPSILON &&\n Math.abs(a[1] - b[1]) < utils.EPSILON &&\n Math.abs(a[2] - b[2]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 vectors are exactly equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are exactly equal\n */\nexport function equals(a: Vec3, b: Vec3): boolean {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2];\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficient.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The linear interpolated result.\n */\nexport function lerp(a: Vec3, b: Vec3, t: number, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = a[0] + t * (b[0] - a[0]);\n dst[1] = a[1] + t * (b[1] - a[1]);\n dst[2] = a[2] + t * (b[2] - a[2]);\n\n return dst;\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient vector t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficients vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns the linear interpolated result.\n */\nexport function lerpV(a: Vec3, b: Vec3, t: Vec3, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = a[0] + t[0] * (b[0] - a[0]);\n dst[1] = a[1] + t[1] * (b[1] - a[1]);\n dst[2] = a[2] + t[2] * (b[2] - a[2]);\n\n return dst;\n}\n\n/**\n * Return max values of two vectors.\n * Given vectors a and b returns\n * [max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The max components vector.\n */\nexport function max(a: Vec3, b: Vec3, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = Math.max(a[0], b[0]);\n dst[1] = Math.max(a[1], b[1]);\n dst[2] = Math.max(a[2], b[2]);\n\n return dst;\n}\n\n/**\n * Return min values of two vectors.\n * Given vectors a and b returns\n * [min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The min components vector.\n */\nexport function min(a: Vec3, b: Vec3, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = Math.min(a[0], b[0]);\n dst[1] = Math.min(a[1], b[1]);\n dst[2] = Math.min(a[2], b[2]);\n\n return dst;\n}\n\n/**\n * Multiplies a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nexport function mulScalar(v: Vec3, k: number, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = v[0] * k;\n dst[1] = v[1] * k;\n dst[2] = v[2] * k;\n\n return dst;\n}\n\n/**\n * Multiplies a vector by a scalar. (same as mulScalar)\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nexport const scale = mulScalar;\n\n/**\n * Divides a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nexport function divScalar(v: Vec3, k: number, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = v[0] / k;\n dst[1] = v[1] / k;\n dst[2] = v[2] / k;\n\n return dst;\n}\n\n/**\n * Inverse a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nexport function inverse(v: Vec3, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = 1 / v[0];\n dst[1] = 1 / v[1];\n dst[2] = 1 / v[2];\n\n return dst;\n}\n\n/**\n * Invert a vector. (same as inverse)\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nexport const invert = inverse;\n\n/**\n * Computes the cross product of two vectors; assumes both vectors have\n * three entries.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of a cross b.\n */\nexport function cross(a: Vec3, b: Vec3, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n const t1 = a[2] * b[0] - a[0] * b[2];\n const t2 = a[0] * b[1] - a[1] * b[0];\n dst[0] = a[1] * b[2] - a[2] * b[1];\n dst[1] = t1;\n dst[2] = t2;\n\n return dst;\n}\n\n/**\n * Computes the dot product of two vectors; assumes both vectors have\n * three entries.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns dot product\n */\nexport function dot(a: Vec3, b: Vec3): number {\n return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]);\n}\n\n/**\n * Computes the length of vector\n * @param v - vector.\n * @returns length of vector.\n */\nexport function length(v: Vec3): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n return Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2);\n}\n\n/**\n * Computes the length of vector (same as length)\n * @param v - vector.\n * @returns length of vector.\n */\nexport const len = length;\n\n/**\n * Computes the square of the length of vector\n * @param v - vector.\n * @returns square of the length of vector.\n */\nexport function lengthSq(v: Vec3): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n return v0 * v0 + v1 * v1 + v2 * v2;\n}\n\n/**\n * Computes the square of the length of vector (same as lengthSq)\n * @param v - vector.\n * @returns square of the length of vector.\n */\nexport const lenSq = lengthSq;\n\n/**\n * Computes the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nexport function distance(a: Vec3, b: Vec3): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n const dz = a[2] - b[2];\n return Math.sqrt(dx * dx + dy * dy + dz * dz);\n}\n\n/**\n * Computes the distance between 2 points (same as distance)\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nexport const dist = distance;\n\n/**\n * Computes the square of the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nexport function distanceSq(a: Vec3, b: Vec3): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n const dz = a[2] - b[2];\n return dx * dx + dy * dy + dz * dz;\n}\n\n/**\n * Computes the square of the distance between 2 points (same as distanceSq)\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nexport const distSq = distanceSq;\n\n/**\n * Divides a vector by its Euclidean length and returns the quotient.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The normalized vector.\n */\nexport function normalize(v: Vec3, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const len = Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2);\n\n if (len > 0.00001) {\n dst[0] = v0 / len;\n dst[1] = v1 / len;\n dst[2] = v2 / len;\n } else {\n dst[0] = 0;\n dst[1] = 0;\n dst[2] = 0;\n }\n\n\n return dst;\n}\n\n/**\n * Negates a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns -v.\n */\nexport function negate(v: Vec3, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = -v[0];\n dst[1] = -v[1];\n dst[2] = -v[2];\n\n return dst;\n}\n\n/**\n * Copies a vector. (same as {@link vec3.clone})\n * Also see {@link vec3.create} and {@link vec3.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nexport function copy(v: Vec3, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = v[0];\n dst[1] = v[1];\n dst[2] = v[2];\n\n return dst;\n}\n\n/**\n * Clones a vector. (same as {@link vec3.copy})\n * Also see {@link vec3.create} and {@link vec3.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nexport const clone = copy;\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nexport function multiply(a: Vec3, b: Vec3, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = a[0] * b[0];\n dst[1] = a[1] * b[1];\n dst[2] = a[2] * b[2];\n\n return dst;\n}\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as mul)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nexport const mul = multiply;\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nexport function divide(a: Vec3, b: Vec3, dst?: Vec3) {\n dst = dst || new VecType(3);\n\n dst[0] = a[0] / b[0];\n dst[1] = a[1] / b[1];\n dst[2] = a[2] / b[2];\n\n return dst;\n}\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as divide)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nexport const div = divide;\n\n/**\n * Creates a random vector\n * @param scale - Default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The random vector.\n */\nexport function random(scale = 1, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n const angle = Math.random() * 2 * Math.PI;\n const z = Math.random() * 2 - 1;\n const zScale = Math.sqrt(1 - z * z) * scale;\n dst[0] = Math.cos(angle) * zScale;\n dst[1] = Math.sin(angle) * zScale;\n dst[2] = z * scale;\n\n return dst;\n}\n\n/**\n * Zero's a vector\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The zeroed vector.\n */\nexport function zero(dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n dst[0] = 0;\n dst[1] = 0;\n dst[2] = 0;\n\n return dst;\n}\n\n\n/**\n * transform vec3 by 4x4 matrix\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional vec3 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nexport function transformMat4(v: Vec3, m: Mat4, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n const x = v[0];\n const y = v[1];\n const z = v[2];\n const w = (m[3] * x + m[7] * y + m[11] * z + m[15]) || 1;\n\n dst[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;\n dst[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;\n dst[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;\n\n return dst;\n}\n\n/**\n * Transform vec4 by upper 3x3 matrix inside 4x4 matrix.\n * @param v - The direction.\n * @param m - The matrix.\n * @param dst - optional Vec3 to store result. If not passed a new one is created.\n * @returns The transformed vector.\n */\nexport function transformMat4Upper3x3(v: Vec3, m: Mat4, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n\n dst[0] = v0 * m[0 * 4 + 0] + v1 * m[1 * 4 + 0] + v2 * m[2 * 4 + 0];\n dst[1] = v0 * m[0 * 4 + 1] + v1 * m[1 * 4 + 1] + v2 * m[2 * 4 + 1];\n dst[2] = v0 * m[0 * 4 + 2] + v1 * m[1 * 4 + 2] + v2 * m[2 * 4 + 2];\n\n return dst;\n}\n\n/**\n * Transforms vec3 by 3x3 matrix\n *\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional vec3 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nexport function transformMat3(v: Vec3, m: Mat3, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n const x = v[0];\n const y = v[1];\n const z = v[2];\n\n dst[0] = x * m[0] + y * m[4] + z * m[8];\n dst[1] = x * m[1] + y * m[5] + z * m[9];\n dst[2] = x * m[2] + y * m[6] + z * m[10];\n\n return dst;\n}\n\n/**\n * Transforms vec3 by Quaternion\n * @param v - the vector to transform\n * @param q - the quaternion to transform by\n * @param dst - optional vec3 to store result. If not passed a new one is created.\n * @returns the transformed\n */\nexport function transformQuat(v: Vec3, q: Quat, dst?: Vec3): Vec3 {\n dst = dst || new VecType(3);\n\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const w2 = q[3] * 2;\n\n const x = v[0];\n const y = v[1];\n const z = v[2];\n\n const uvX = qy * z - qz * y;\n const uvY = qz * x - qx * z;\n const uvZ = qx * y - qy * x;\n\n dst[0] = x + uvX * w2 + (qy * uvZ - qz * uvY) * 2;\n dst[1] = y + uvY * w2 + (qz * uvX - qx * uvZ) * 2;\n dst[2] = z + uvZ * w2 + (qx * uvY - qy * uvX) * 2;\n\n return dst;\n}\n\n/**\n * Returns the translation component of a 4-by-4 matrix as a vector with 3\n * entries.\n * @param m - The matrix.\n * @param dst - vector to hold result. If not passed a new one is created.\n * @returns The translation component of m.\n */\nexport function getTranslation(m: Mat3, dst?: Vec3) {\n dst = dst || new VecType(3);\n dst[0] = m[12];\n dst[1] = m[13];\n dst[2] = m[14];\n return dst;\n}\n/**\n * Returns an axis of a 4x4 matrix as a vector with 3 entries\n * @param m - The matrix.\n * @param axis - The axis 0 = x, 1 = y, 2 = z;\n * @returns The axis component of m.\n */\nexport function getAxis(m: Mat4, axis: number, dst?: Vec3) {\n dst = dst || new VecType(3);\n const off = axis * 4;\n dst[0] = m[off + 0];\n dst[1] = m[off + 1];\n dst[2] = m[off + 2];\n return dst;\n}\n/**\n * Returns the scaling component of the matrix\n * @param m - The Matrix\n * @param dst - The vector to set. If not passed a new one is created.\n */\nexport function getScaling(m: Mat4, dst: Vec3) {\n dst = dst || new VecType(3);\n const xx = m[0];\n const xy = m[1];\n const xz = m[2];\n const yx = m[4];\n const yy = m[5];\n const yz = m[6];\n const zx = m[8];\n const zy = m[9];\n const zz = m[10];\n dst[0] = Math.sqrt(xx * xx + xy * xy + xz * xz);\n dst[1] = Math.sqrt(yx * yx + yy * yy + yz * yz);\n dst[2] = Math.sqrt(zx * zx + zy * zy + zz * zz);\n return dst;\n}\n\n/**\n * Rotate a 3D vector around the x-axis\n *\n * @param {ReadonlyVec3} a The vec3 point to rotate\n * @param {ReadonlyVec3} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @param dst - The vector to set. If not passed a new one is created.\n * @returns the rotated vector\n */\nexport function rotateX(a: Vec3, b: Vec3, rad: number, dst?: Vec3) {\n dst = dst || new VecType(3);\n const p = [];\n const r = [];\n\n //Translate point to the origin\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2];\n\n //perform rotation\n r[0] = p[0];\n r[1] = p[1] * Math.cos(rad) - p[2] * Math.sin(rad);\n r[2] = p[1] * Math.sin(rad) + p[2] * Math.cos(rad);\n\n //translate to correct position\n dst[0] = r[0] + b[0];\n dst[1] = r[1] + b[1];\n dst[2] = r[2] + b[2];\n\n return dst;\n}\n\n/**\n * Rotate a 3D vector around the y-axis\n *\n * @param {ReadonlyVec3} a The vec3 point to rotate\n * @param {ReadonlyVec3} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @param dst - The vector to set. If not passed a new one is created.\n * @returns the rotated vector\n */\nexport function rotateY(a: Vec3, b: Vec3, rad: number, dst?: Vec3) {\n dst = dst || new VecType(3);\n const p = [];\n const r = [];\n\n // translate point to the origin\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2];\n\n // perform rotation\n r[0] = p[2] * Math.sin(rad) + p[0] * Math.cos(rad);\n r[1] = p[1];\n r[2] = p[2] * Math.cos(rad) - p[0] * Math.sin(rad);\n\n // translate to correct position\n dst[0] = r[0] + b[0];\n dst[1] = r[1] + b[1];\n dst[2] = r[2] + b[2];\n\n return dst;\n}\n\n/**\n * Rotate a 3D vector around the z-axis\n *\n * @param {ReadonlyVec3} a The vec3 point to rotate\n * @param {ReadonlyVec3} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @param dst - The vector to set. If not passed a new one is created.\n * @returns {vec3} out\n */\nexport function rotateZ(a: Vec3, b: Vec3, rad: number, dst?: Vec3) {\n dst = dst || new VecType(3);\n const p = [];\n const r = [];\n\n // translate point to the origin\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2];\n\n // perform rotation\n r[0] = p[0] * Math.cos(rad) - p[1] * Math.sin(rad);\n r[1] = p[0] * Math.sin(rad) + p[1] * Math.cos(rad);\n r[2] = p[2];\n\n // translate to correct position\n dst[0] = r[0] + b[0];\n dst[1] = r[1] + b[1];\n dst[2] = r[2] + b[2];\n\n return dst;\n}\n\n/**\n * Treat a 3D vector as a direction and set it's length\n *\n * @param a The vec3 to lengthen\n * @param len The length of the resulting vector\n * @returns The lengthened vector\n */\nexport function setLength(a: Vec3, len: number, dst?: Vec3) {\n dst = dst || new VecType(3);\n normalize(a, dst);\n return mulScalar(dst, len, dst);\n}\n\n/**\n * Ensure a vector is not longer than a max length\n *\n * @param a The vec3 to limit\n * @param maxLen The longest length of the resulting vector\n * @returns The vector, shortened to maxLen if it's too long\n */\nexport function truncate(a: Vec3, maxLen: number, dst?: Vec3) {\n dst = dst || new VecType(3);\n\n if (length(a) > maxLen) {\n return setLength(a, maxLen, dst);\n }\n\n return copy(a, dst);\n}\n\n/**\n * Return the vector exactly between 2 endpoint vectors\n *\n * @param a Endpoint 1\n * @param b Endpoint 2\n * @returns The vector exactly residing between endpoints 1 and 2\n */\nexport function midpoint(a: Vec3, b: Vec3, dst?: Vec3) {\n dst = dst || new VecType(3);\n return lerp(a, b, 0.5, dst);\n}\n","\nimport { Mat3 } from './mat3';\nimport { Mat4 } from './mat4';\nimport { Quat } from './quat';\nimport Vec3, * as vec3 from './vec3-impl';\nimport * as utils from './utils';\n\nexport default Mat4;\n\nexport type Mat4LikeCtor = new (n: number) => Mat4;\n\n/**\n * 4x4 Matrix math math functions.\n *\n * Almost all functions take an optional `dst` argument. If it is not passed in the\n * functions will create a new matrix. In other words you can do this\n *\n * const mat = mat4.translation([1, 2, 3]); // Creates a new translation matrix\n *\n * or\n *\n * const mat = mat4.create();\n * mat4.translation([1, 2, 3], mat); // Puts translation matrix in mat.\n *\n * The first style is often easier but depending on where it's used it generates garbage where\n * as there is almost never allocation with the second style.\n *\n * It is always save to pass any matrix as the destination. So for example\n *\n * const mat = mat4.identity();\n * const trans = mat4.translation([1, 2, 3]);\n * mat4.multiply(mat, trans, mat); // Multiplies mat * trans and puts result in mat.\n *\n */\nlet MatType: Mat4LikeCtor = Float32Array;\n\n/**\n * Sets the type this library creates for a Mat4\n * @param ctor - the constructor for the type. Either `Float32Array`, `Float64Array`, or `Array`\n * @returns previous constructor for Mat4\n */\nexport function setDefaultType(ctor: new (n: number) => Mat4) {\n const oldType = MatType;\n MatType = ctor;\n return oldType;\n}\n\n/**\n * Create a Mat4 from values\n *\n * Note: Since passing in a raw JavaScript array\n * is valid in all circumstances, if you want to\n * force a JavaScript array into a Mat4's specified type\n * it would be faster to use\n *\n * ```\n * const m = mat4.clone(someJSArray);\n * ```\n *\n * Note: a consequence of the implementation is if your Mat4Type = `Array`\n * instead of `Float32Array` or `Float64Array` then any values you\n * don't pass in will be undefined. Usually this is not an issue since\n * (a) using `Array` is rare and (b) using `mat4.create` is usually used\n * to create a Mat4 to be filled out as in\n *\n * ```\n * const m = mat4.create();\n * mat4.perspective(fov, aspect, near, far, m);\n * ```\n *\n * @param v0 - value for element 0\n * @param v1 - value for element 1\n * @param v2 - value for element 2\n * @param v3 - value for element 3\n * @param v4 - value for element 4\n * @param v5 - value for element 5\n * @param v6 - value for element 6\n * @param v7 - value for element 7\n * @param v8 - value for element 8\n * @param v9 - value for element 9\n * @param v10 - value for element 10\n * @param v11 - value for element 11\n * @param v12 - value for element 12\n * @param v13 - value for element 13\n * @param v14 - value for element 14\n * @param v15 - value for element 15\n * @returns created from values.\n */\nexport function create(\n v0?: number, v1?: number, v2?: number, v3?: number,\n v4?: number, v5?: number, v6?: number, v7?: number,\n v8?: number, v9?: number, v10?: number, v11?: number,\n v12?: number, v13?: number, v14?: number, v15?: number): Mat4 {\n const dst = new MatType(16);\n if (v0 !== undefined) {\n dst[0] = v0;\n if (v1 !== undefined) {\n dst[1] = v1;\n if (v2 !== undefined) {\n dst[2] = v2;\n if (v3 !== undefined) {\n dst[3] = v3;\n if (v4 !== undefined) {\n dst[4] = v4;\n if (v5 !== undefined) {\n dst[5] = v5;\n if (v6 !== undefined) {\n dst[6] = v6;\n if (v7 !== undefined) {\n dst[7] = v7;\n if (v8 !== undefined) {\n dst[8] = v8;\n if (v9 !== undefined) {\n dst[9] = v9;\n if (v10 !== undefined) {\n dst[10] = v10;\n if (v11 !== undefined) {\n dst[11] = v11;\n if (v12 !== undefined) {\n dst[12] = v12;\n if (v13 !== undefined) {\n dst[13] = v13;\n if (v14 !== undefined) {\n dst[14] = v14;\n if (v15 !== undefined) {\n dst[15] = v15;\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n return dst;\n}\n\n/**\n * Sets the values of a Mat4\n * Also see {@link mat4.create} and {@link mat4.copy}\n *\n * @param v0 - value for element 0\n * @param v1 - value for element 1\n * @param v2 - value for element 2\n * @param v3 - value for element 3\n * @param v4 - value for element 4\n * @param v5 - value for element 5\n * @param v6 - value for element 6\n * @param v7 - value for element 7\n * @param v8 - value for element 8\n * @param v9 - value for element 9\n * @param v10 - value for element 10\n * @param v11 - value for element 11\n * @param v12 - value for element 12\n * @param v13 - value for element 13\n * @param v14 - value for element 14\n * @param v15 - value for element 15\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat4 created from values.\n */\nexport function set(\n v0: number, v1: number, v2: number, v3: number,\n v4: number, v5: number, v6: number, v7: number,\n v8: number, v9: number, v10: number, v11: number,\n v12: number, v13: number, v14: number, v15: number,\n dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n dst[ 0] = v0; dst[ 1] = v1; dst[ 2] = v2; dst[ 3] = v3;\n dst[ 4] = v4; dst[ 5] = v5; dst[ 6] = v6; dst[ 7] = v7;\n dst[ 8] = v8; dst[ 9] = v9; dst[10] = v10; dst[11] = v11;\n dst[12] = v12; dst[13] = v13; dst[14] = v14; dst[15] = v15;\n\n return dst;\n}\n\n/**\n * Creates a Mat4 from a Mat3\n * @param m3 - source matrix\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat4 made from m3\n */\nexport function fromMat3(m3: Mat3, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n dst[ 0] = m3[0]; dst[ 1] = m3[1]; dst[ 2] = m3[ 2]; dst[ 3] = 0;\n dst[ 4] = m3[4]; dst[ 5] = m3[5]; dst[ 6] = m3[ 6]; dst[ 7] = 0;\n dst[ 8] = m3[8]; dst[ 9] = m3[9]; dst[10] = m3[10]; dst[11] = 0;\n dst[12] = 0; dst[13] = 0; dst[14] = 0; dst[15] = 1;\n\n return dst;\n}\n\n/**\n * Creates a Mat4 rotation matrix from a quaternion\n * @param q - quaternion to create matrix from\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat4 made from q\n */\nexport function fromQuat(q: Quat, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n const x = q[0]; const y = q[1]; const z = q[2]; const w = q[3];\n const x2 = x + x; const y2 = y + y; const z2 = z + z;\n\n const xx = x * x2;\n const yx = y * x2;\n const yy = y * y2;\n const zx = z * x2;\n const zy = z * y2;\n const zz = z * z2;\n const wx = w * x2;\n const wy = w * y2;\n const wz = w * z2;\n\n dst[ 0] = 1 - yy - zz; dst[ 1] = yx + wz; dst[ 2] = zx - wy; dst[ 3] = 0;\n dst[ 4] = yx - wz; dst[ 5] = 1 - xx - zz; dst[ 6] = zy + wx; dst[ 7] = 0;\n dst[ 8] = zx + wy; dst[ 9] = zy - wx; dst[10] = 1 - xx - yy; dst[11] = 0;\n dst[12] = 0; dst[13] = 0; dst[14] = 0; dst[15] = 1;\n\n return dst;\n}\n\n/**\n * Negates a matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns -m.\n */\nexport function negate(m: Mat4, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n dst[ 0] = -m[ 0]; dst[ 1] = -m[ 1]; dst[ 2] = -m[ 2]; dst[ 3] = -m[ 3];\n dst[ 4] = -m[ 4]; dst[ 5] = -m[ 5]; dst[ 6] = -m[ 6]; dst[ 7] = -m[ 7];\n dst[ 8] = -m[ 8]; dst[ 9] = -m[ 9]; dst[10] = -m[10]; dst[11] = -m[11];\n dst[12] = -m[12]; dst[13] = -m[13]; dst[14] = -m[14]; dst[15] = -m[15];\n\n return dst;\n}\n\n/**\n * Copies a matrix. (same as {@link mat4.clone})\n * Also see {@link mat4.create} and {@link mat4.set}\n * @param m - The matrix.\n * @param dst - The matrix. If not passed a new one is created.\n * @returns A copy of m.\n */\nexport function copy(m: Mat4, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n dst[ 0] = m[ 0]; dst[ 1] = m[ 1]; dst[ 2] = m[ 2]; dst[ 3] = m[ 3];\n dst[ 4] = m[ 4]; dst[ 5] = m[ 5]; dst[ 6] = m[ 6]; dst[ 7] = m[ 7];\n dst[ 8] = m[ 8]; dst[ 9] = m[ 9]; dst[10] = m[10]; dst[11] = m[11];\n dst[12] = m[12]; dst[13] = m[13]; dst[14] = m[14]; dst[15] = m[15];\n\n return dst;\n}\n\n/**\n * Copies a matrix (same as {@link mat4.copy})\n * Also see {@link mat4.create} and {@link mat4.set}\n * @param m - The matrix.\n * @param dst - The matrix. If not passed a new one is created.\n * @returns A copy of m.\n */\nexport const clone = copy;\n\n/**\n * Check if 2 matrices are approximately equal\n * @param a - Operand matrix.\n * @param b - Operand matrix.\n * @returns true if matrices are approximately equal\n */\nexport function equalsApproximately(a: Mat4, b: Mat4): boolean {\n return Math.abs(a[ 0] - b[ 0]) < utils.EPSILON &&\n Math.abs(a[ 1] - b[ 1]) < utils.EPSILON &&\n Math.abs(a[ 2] - b[ 2]) < utils.EPSILON &&\n Math.abs(a[ 3] - b[ 3]) < utils.EPSILON &&\n Math.abs(a[ 4] - b[ 4]) < utils.EPSILON &&\n Math.abs(a[ 5] - b[ 5]) < utils.EPSILON &&\n Math.abs(a[ 6] - b[ 6]) < utils.EPSILON &&\n Math.abs(a[ 7] - b[ 7]) < utils.EPSILON &&\n Math.abs(a[ 8] - b[ 8]) < utils.EPSILON &&\n Math.abs(a[ 9] - b[ 9]) < utils.EPSILON &&\n Math.abs(a[10] - b[10]) < utils.EPSILON &&\n Math.abs(a[11] - b[11]) < utils.EPSILON &&\n Math.abs(a[12] - b[12]) < utils.EPSILON &&\n Math.abs(a[13] - b[13]) < utils.EPSILON &&\n Math.abs(a[14] - b[14]) < utils.EPSILON &&\n Math.abs(a[15] - b[15]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 matrices are exactly equal\n * @param a - Operand matrix.\n * @param b - Operand matrix.\n * @returns true if matrices are exactly equal\n */\nexport function equals(a: Mat4, b: Mat4): boolean {\n return a[ 0] === b[ 0] &&\n a[ 1] === b[ 1] &&\n a[ 2] === b[ 2] &&\n a[ 3] === b[ 3] &&\n a[ 4] === b[ 4] &&\n a[ 5] === b[ 5] &&\n a[ 6] === b[ 6] &&\n a[ 7] === b[ 7] &&\n a[ 8] === b[ 8] &&\n a[ 9] === b[ 9] &&\n a[10] === b[10] &&\n a[11] === b[11] &&\n a[12] === b[12] &&\n a[13] === b[13] &&\n a[14] === b[14] &&\n a[15] === b[15];\n}\n\n/**\n * Creates a 4-by-4 identity matrix.\n *\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns A 4-by-4 identity matrix.\n */\nexport function identity(dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n dst[ 0] = 1; dst[ 1] = 0; dst[ 2] = 0; dst[ 3] = 0;\n dst[ 4] = 0; dst[ 5] = 1; dst[ 6] = 0; dst[ 7] = 0;\n dst[ 8] = 0; dst[ 9] = 0; dst[10] = 1; dst[11] = 0;\n dst[12] = 0; dst[13] = 0; dst[14] = 0; dst[15] = 1;\n\n return dst;\n}\n\n/**\n * Takes the transpose of a matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The transpose of m.\n */\nexport function transpose(m: Mat4, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n if (dst === m) {\n let t;\n\n t = m[1];\n m[1] = m[4];\n m[4] = t;\n\n t = m[2];\n m[2] = m[8];\n m[8] = t;\n\n t = m[3];\n m[3] = m[12];\n m[12] = t;\n\n t = m[6];\n m[6] = m[9];\n m[9] = t;\n\n t = m[7];\n m[7] = m[13];\n m[13] = t;\n\n t = m[11];\n m[11] = m[14];\n m[14] = t;\n return dst;\n }\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const m30 = m[3 * 4 + 0];\n const m31 = m[3 * 4 + 1];\n const m32 = m[3 * 4 + 2];\n const m33 = m[3 * 4 + 3];\n\n dst[ 0] = m00; dst[ 1] = m10; dst[ 2] = m20; dst[ 3] = m30;\n dst[ 4] = m01; dst[ 5] = m11; dst[ 6] = m21; dst[ 7] = m31;\n dst[ 8] = m02; dst[ 9] = m12; dst[10] = m22; dst[11] = m32;\n dst[12] = m03; dst[13] = m13; dst[14] = m23; dst[15] = m33;\n\n return dst;\n}\n\n/**\n * Computes the inverse of a 4-by-4 matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The inverse of m.\n */\nexport function inverse(m: Mat4, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const m30 = m[3 * 4 + 0];\n const m31 = m[3 * 4 + 1];\n const m32 = m[3 * 4 + 2];\n const m33 = m[3 * 4 + 3];\n const tmp0 = m22 * m33;\n const tmp1 = m32 * m23;\n const tmp2 = m12 * m33;\n const tmp3 = m32 * m13;\n const tmp4 = m12 * m23;\n const tmp5 = m22 * m13;\n const tmp6 = m02 * m33;\n const tmp7 = m32 * m03;\n const tmp8 = m02 * m23;\n const tmp9 = m22 * m03;\n const tmp10 = m02 * m13;\n const tmp11 = m12 * m03;\n const tmp12 = m20 * m31;\n const tmp13 = m30 * m21;\n const tmp14 = m10 * m31;\n const tmp15 = m30 * m11;\n const tmp16 = m10 * m21;\n const tmp17 = m20 * m11;\n const tmp18 = m00 * m31;\n const tmp19 = m30 * m01;\n const tmp20 = m00 * m21;\n const tmp21 = m20 * m01;\n const tmp22 = m00 * m11;\n const tmp23 = m10 * m01;\n\n const t0 = (tmp0 * m11 + tmp3 * m21 + tmp4 * m31) -\n (tmp1 * m11 + tmp2 * m21 + tmp5 * m31);\n const t1 = (tmp1 * m01 + tmp6 * m21 + tmp9 * m31) -\n (tmp0 * m01 + tmp7 * m21 + tmp8 * m31);\n const t2 = (tmp2 * m01 + tmp7 * m11 + tmp10 * m31) -\n (tmp3 * m01 + tmp6 * m11 + tmp11 * m31);\n const t3 = (tmp5 * m01 + tmp8 * m11 + tmp11 * m21) -\n (tmp4 * m01 + tmp9 * m11 + tmp10 * m21);\n\n const d = 1 / (m00 * t0 + m10 * t1 + m20 * t2 + m30 * t3);\n\n dst[ 0] = d * t0;\n dst[ 1] = d * t1;\n dst[ 2] = d * t2;\n dst[ 3] = d * t3;\n dst[ 4] = d * ((tmp1 * m10 + tmp2 * m20 + tmp5 * m30) -\n (tmp0 * m10 + tmp3 * m20 + tmp4 * m30));\n dst[ 5] = d * ((tmp0 * m00 + tmp7 * m20 + tmp8 * m30) -\n (tmp1 * m00 + tmp6 * m20 + tmp9 * m30));\n dst[ 6] = d * ((tmp3 * m00 + tmp6 * m10 + tmp11 * m30) -\n (tmp2 * m00 + tmp7 * m10 + tmp10 * m30));\n dst[ 7] = d * ((tmp4 * m00 + tmp9 * m10 + tmp10 * m20) -\n (tmp5 * m00 + tmp8 * m10 + tmp11 * m20));\n dst[ 8] = d * ((tmp12 * m13 + tmp15 * m23 + tmp16 * m33) -\n (tmp13 * m13 + tmp14 * m23 + tmp17 * m33));\n dst[ 9] = d * ((tmp13 * m03 + tmp18 * m23 + tmp21 * m33) -\n (tmp12 * m03 + tmp19 * m23 + tmp20 * m33));\n dst[10] = d * ((tmp14 * m03 + tmp19 * m13 + tmp22 * m33) -\n (tmp15 * m03 + tmp18 * m13 + tmp23 * m33));\n dst[11] = d * ((tmp17 * m03 + tmp20 * m13 + tmp23 * m23) -\n (tmp16 * m03 + tmp21 * m13 + tmp22 * m23));\n dst[12] = d * ((tmp14 * m22 + tmp17 * m32 + tmp13 * m12) -\n (tmp16 * m32 + tmp12 * m12 + tmp15 * m22));\n dst[13] = d * ((tmp20 * m32 + tmp12 * m02 + tmp19 * m22) -\n (tmp18 * m22 + tmp21 * m32 + tmp13 * m02));\n dst[14] = d * ((tmp18 * m12 + tmp23 * m32 + tmp15 * m02) -\n (tmp22 * m32 + tmp14 * m02 + tmp19 * m12));\n dst[15] = d * ((tmp22 * m22 + tmp16 * m02 + tmp21 * m12) -\n (tmp20 * m12 + tmp23 * m22 + tmp17 * m02));\n\n return dst;\n}\n\n/**\n * Compute the determinant of a matrix\n * @param m - the matrix\n * @returns the determinant\n */\nexport function determinant(m: Mat4): number {\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const m30 = m[3 * 4 + 0];\n const m31 = m[3 * 4 + 1];\n const m32 = m[3 * 4 + 2];\n const m33 = m[3 * 4 + 3];\n\n const tmp0 = m22 * m33;\n const tmp1 = m32 * m23;\n const tmp2 = m12 * m33;\n const tmp3 = m32 * m13;\n const tmp4 = m12 * m23;\n const tmp5 = m22 * m13;\n const tmp6 = m02 * m33;\n const tmp7 = m32 * m03;\n const tmp8 = m02 * m23;\n const tmp9 = m22 * m03;\n const tmp10 = m02 * m13;\n const tmp11 = m12 * m03;\n\n const t0 = (tmp0 * m11 + tmp3 * m21 + tmp4 * m31) -\n (tmp1 * m11 + tmp2 * m21 + tmp5 * m31);\n const t1 = (tmp1 * m01 + tmp6 * m21 + tmp9 * m31) -\n (tmp0 * m01 + tmp7 * m21 + tmp8 * m31);\n const t2 = (tmp2 * m01 + tmp7 * m11 + tmp10 * m31) -\n (tmp3 * m01 + tmp6 * m11 + tmp11 * m31);\n const t3 = (tmp5 * m01 + tmp8 * m11 + tmp11 * m21) -\n (tmp4 * m01 + tmp9 * m11 + tmp10 * m21);\n\n return m00 * t0 + m10 * t1 + m20 * t2 + m30 * t3;\n}\n\n/**\n * Computes the inverse of a 4-by-4 matrix. (same as inverse)\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The inverse of m.\n */\nexport const invert = inverse;\n\n/**\n * Multiplies two 4-by-4 matrices with a on the left and b on the right\n * @param a - The matrix on the left.\n * @param b - The matrix on the right.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix product of a and b.\n */\nexport function multiply(a: Mat4, b: Mat4, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a03 = a[3];\n const a10 = a[ 4 + 0];\n const a11 = a[ 4 + 1];\n const a12 = a[ 4 + 2];\n const a13 = a[ 4 + 3];\n const a20 = a[ 8 + 0];\n const a21 = a[ 8 + 1];\n const a22 = a[ 8 + 2];\n const a23 = a[ 8 + 3];\n const a30 = a[12 + 0];\n const a31 = a[12 + 1];\n const a32 = a[12 + 2];\n const a33 = a[12 + 3];\n const b00 = b[0];\n const b01 = b[1];\n const b02 = b[2];\n const b03 = b[3];\n const b10 = b[ 4 + 0];\n const b11 = b[ 4 + 1];\n const b12 = b[ 4 + 2];\n const b13 = b[ 4 + 3];\n const b20 = b[ 8 + 0];\n const b21 = b[ 8 + 1];\n const b22 = b[ 8 + 2];\n const b23 = b[ 8 + 3];\n const b30 = b[12 + 0];\n const b31 = b[12 + 1];\n const b32 = b[12 + 2];\n const b33 = b[12 + 3];\n\n dst[ 0] = a00 * b00 + a10 * b01 + a20 * b02 + a30 * b03;\n dst[ 1] = a01 * b00 + a11 * b01 + a21 * b02 + a31 * b03;\n dst[ 2] = a02 * b00 + a12 * b01 + a22 * b02 + a32 * b03;\n dst[ 3] = a03 * b00 + a13 * b01 + a23 * b02 + a33 * b03;\n dst[ 4] = a00 * b10 + a10 * b11 + a20 * b12 + a30 * b13;\n dst[ 5] = a01 * b10 + a11 * b11 + a21 * b12 + a31 * b13;\n dst[ 6] = a02 * b10 + a12 * b11 + a22 * b12 + a32 * b13;\n dst[ 7] = a03 * b10 + a13 * b11 + a23 * b12 + a33 * b13;\n dst[ 8] = a00 * b20 + a10 * b21 + a20 * b22 + a30 * b23;\n dst[ 9] = a01 * b20 + a11 * b21 + a21 * b22 + a31 * b23;\n dst[10] = a02 * b20 + a12 * b21 + a22 * b22 + a32 * b23;\n dst[11] = a03 * b20 + a13 * b21 + a23 * b22 + a33 * b23;\n dst[12] = a00 * b30 + a10 * b31 + a20 * b32 + a30 * b33;\n dst[13] = a01 * b30 + a11 * b31 + a21 * b32 + a31 * b33;\n dst[14] = a02 * b30 + a12 * b31 + a22 * b32 + a32 * b33;\n dst[15] = a03 * b30 + a13 * b31 + a23 * b32 + a33 * b33;\n\n return dst;\n}\n\n/**\n * Multiplies two 4-by-4 matrices with a on the left and b on the right (same as multiply)\n * @param a - The matrix on the left.\n * @param b - The matrix on the right.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix product of a and b.\n */\nexport const mul = multiply;\n\n/**\n * Sets the translation component of a 4-by-4 matrix to the given\n * vector.\n * @param a - The matrix.\n * @param v - The vector.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix with translation set.\n */\nexport function setTranslation(a: Mat4, v: Vec3, dst?: Mat4): Mat4 {\n dst = dst || identity();\n if (a !== dst) {\n dst[ 0] = a[ 0];\n dst[ 1] = a[ 1];\n dst[ 2] = a[ 2];\n dst[ 3] = a[ 3];\n dst[ 4] = a[ 4];\n dst[ 5] = a[ 5];\n dst[ 6] = a[ 6];\n dst[ 7] = a[ 7];\n dst[ 8] = a[ 8];\n dst[ 9] = a[ 9];\n dst[10] = a[10];\n dst[11] = a[11];\n }\n dst[12] = v[0];\n dst[13] = v[1];\n dst[14] = v[2];\n dst[15] = 1;\n return dst;\n}\n\n/**\n * Returns the translation component of a 4-by-4 matrix as a vector with 3\n * entries.\n * @param m - The matrix.\n * @param dst - vector to hold result. If not passed a new one is created.\n * @returns The translation component of m.\n */\nexport function getTranslation(m: Mat4, dst?: Vec3): Vec3 {\n dst = dst || vec3.create();\n dst[0] = m[12];\n dst[1] = m[13];\n dst[2] = m[14];\n return dst;\n}\n\n/**\n * Returns an axis of a 4x4 matrix as a vector with 3 entries\n * @param m - The matrix.\n * @param axis - The axis 0 = x, 1 = y, 2 = z;\n * @returns The axis component of m.\n */\nexport function getAxis(m: Mat4, axis: number, dst?: Vec3): Vec3 {\n dst = dst || vec3.create();\n const off = axis * 4;\n dst[0] = m[off + 0];\n dst[1] = m[off + 1];\n dst[2] = m[off + 2];\n return dst;\n}\n\n/**\n * Sets an axis of a 4x4 matrix as a vector with 3 entries\n * @param m - The matrix.\n * @param v - the axis vector\n * @param axis - The axis 0 = x, 1 = y, 2 = z;\n * @param dst - The matrix to set. If not passed a new one is created.\n * @returns The matrix with axis set.\n */\nexport function setAxis(m: Mat4, v: Vec3, axis: number, dst: Mat4): Mat4 {\n if (dst !== m) {\n dst = copy(m, dst);\n }\n const off = axis * 4;\n dst[off + 0] = v[0];\n dst[off + 1] = v[1];\n dst[off + 2] = v[2];\n return dst;\n}\n\n/**\n * Returns the scaling component of the matrix\n * @param m - The Matrix\n * @param dst - The vector to set. If not passed a new one is created.\n */\nexport function getScaling(m: Mat4, dst?: Vec3): Vec3 {\n dst = dst || vec3.create();\n\n const xx = m[0];\n const xy = m[1];\n const xz = m[2];\n const yx = m[4];\n const yy = m[5];\n const yz = m[6];\n const zx = m[8];\n const zy = m[9];\n const zz = m[10];\n\n dst[0] = Math.sqrt(xx * xx + xy * xy + xz * xz);\n dst[1] = Math.sqrt(yx * yx + yy * yy + yz * yz);\n dst[2] = Math.sqrt(zx * zx + zy * zy + zz * zz);\n\n return dst;\n}\n\n/**\n * Computes a 4-by-4 perspective transformation matrix given the angular height\n * of the frustum, the aspect ratio, and the near and far clipping planes. The\n * arguments define a frustum extending in the negative z direction. The given\n * angle is the vertical angle of the frustum, and the horizontal angle is\n * determined to produce the given aspect ratio. The arguments near and far are\n * the distances to the near and far clipping planes. Note that near and far\n * are not z coordinates, but rather they are distances along the negative\n * z-axis. The matrix generated sends the viewing frustum to the unit box.\n * We assume a unit box extending from -1 to 1 in the x and y dimensions and\n * from 0 to 1 in the z dimension.\n *\n * Note: If you pass `Infinity` for zFar then it will produce a projection matrix\n * returns -Infinity for Z when transforming coordinates with Z <= 0 and +Infinity for Z\n * otherwise.\n *\n * @param fieldOfViewYInRadians - The camera angle from top to bottom (in radians).\n * @param aspect - The aspect ratio width / height.\n * @param zNear - The depth (negative z coordinate)\n * of the near clipping plane.\n * @param zFar - The depth (negative z coordinate)\n * of the far clipping plane.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The perspective matrix.\n */\nexport function perspective(fieldOfViewYInRadians: number, aspect: number, zNear: number, zFar: number, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n const f = Math.tan(Math.PI * 0.5 - 0.5 * fieldOfViewYInRadians);\n\n dst[0] = f / aspect;\n dst[1] = 0;\n dst[2] = 0;\n dst[3] = 0;\n\n dst[4] = 0;\n dst[5] = f;\n dst[6] = 0;\n dst[7] = 0;\n\n dst[8] = 0;\n dst[9] = 0;\n dst[11] = -1;\n\n dst[12] = 0;\n dst[13] = 0;\n dst[15] = 0;\n\n if (Number.isFinite(zFar)) {\n const rangeInv = 1 / (zNear - zFar);\n dst[10] = zFar * rangeInv;\n dst[14] = zFar * zNear * rangeInv;\n } else {\n dst[10] = -1;\n dst[14] = -zNear;\n }\n\n return dst;\n}\n\n/**\n * Computes a 4-by-4 reverse-z perspective transformation matrix given the angular height\n * of the frustum, the aspect ratio, and the near and far clipping planes. The\n * arguments define a frustum extending in the negative z direction. The given\n * angle is the vertical angle of the frustum, and the horizontal angle is\n * determined to produce the given aspect ratio. The arguments near and far are\n * the distances to the near and far clipping planes. Note that near and far\n * are not z coordinates, but rather they are distances along the negative\n * z-axis. The matrix generated sends the viewing frustum to the unit box.\n * We assume a unit box extending from -1 to 1 in the x and y dimensions and\n * from 1 (at -zNear) to 0 (at -zFar) in the z dimension.\n *\n * @param fieldOfViewYInRadians - The camera angle from top to bottom (in radians).\n * @param aspect - The aspect ratio width / height.\n * @param zNear - The depth (negative z coordinate)\n * of the near clipping plane.\n * @param zFar - The depth (negative z coordinate)\n * of the far clipping plane. (default = Infinity)\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The perspective matrix.\n */export function perspectiveReverseZ(fieldOfViewYInRadians: number, aspect: number, zNear: number, zFar = Infinity, dst?: Mat4) {\n dst = dst || new MatType(16);\n\n const f = 1 / Math.tan(fieldOfViewYInRadians * 0.5);\n\n dst[ 0] = f / aspect;\n dst[ 1] = 0;\n dst[ 2] = 0;\n dst[ 3] = 0;\n\n dst[ 4] = 0;\n dst[ 5] = f;\n dst[ 6] = 0;\n dst[ 7] = 0;\n\n dst[ 8] = 0;\n dst[ 9] = 0;\n dst[11] = -1;\n\n dst[12] = 0;\n dst[13] = 0;\n dst[15] = 0;\n\n if (zFar === Infinity) {\n dst[10] = 0;\n dst[14] = zNear;\n } else {\n const rangeInv = 1 / (zFar - zNear);\n dst[10] = zNear * rangeInv;\n dst[14] = zFar * zNear * rangeInv;\n }\n\n return dst;\n}\n\n/**\n * Computes a 4-by-4 orthogonal transformation matrix that transforms from\n * the given the left, right, bottom, and top dimensions to -1 +1 in x, and y\n * and 0 to +1 in z.\n * @param left - Left side of the near clipping plane viewport.\n * @param right - Right side of the near clipping plane viewport.\n * @param bottom - Bottom of the near clipping plane viewport.\n * @param top - Top of the near clipping plane viewport.\n * @param near - The depth (negative z coordinate)\n * of the near clipping plane.\n * @param far - The depth (negative z coordinate)\n * of the far clipping plane.\n * @param dst - Output matrix. If not passed a new one is created.\n * @returns The orthographic projection matrix.\n */\nexport function ortho(left: number, right: number, bottom: number, top: number, near: number, far: number, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n dst[0] = 2 / (right - left);\n dst[1] = 0;\n dst[2] = 0;\n dst[3] = 0;\n\n dst[4] = 0;\n dst[5] = 2 / (top - bottom);\n dst[6] = 0;\n dst[7] = 0;\n\n dst[8] = 0;\n dst[9] = 0;\n dst[10] = 1 / (near - far);\n dst[11] = 0;\n\n dst[12] = (right + left) / (left - right);\n dst[13] = (top + bottom) / (bottom - top);\n dst[14] = near / (near - far);\n dst[15] = 1;\n\n return dst;\n}\n\n/**\n * Computes a 4-by-4 perspective transformation matrix given the left, right,\n * top, bottom, near and far clipping planes. The arguments define a frustum\n * extending in the negative z direction. The arguments near and far are the\n * distances to the near and far clipping planes. Note that near and far are not\n * z coordinates, but rather they are distances along the negative z-axis. The\n * matrix generated sends the viewing frustum to the unit box. We assume a unit\n * box extending from -1 to 1 in the x and y dimensions and from 0 to 1 in the z\n * dimension.\n * @param left - The x coordinate of the left plane of the box.\n * @param right - The x coordinate of the right plane of the box.\n * @param bottom - The y coordinate of the bottom plane of the box.\n * @param top - The y coordinate of the right plane of the box.\n * @param near - The negative z coordinate of the near plane of the box.\n * @param far - The negative z coordinate of the far plane of the box.\n * @param dst - Output matrix. If not passed a new one is created.\n * @returns The perspective projection matrix.\n */\nexport function frustum(left: number, right: number, bottom: number, top: number, near: number, far: number, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n const dx = (right - left);\n const dy = (top - bottom);\n const dz = (near - far);\n\n dst[ 0] = 2 * near / dx;\n dst[ 1] = 0;\n dst[ 2] = 0;\n dst[ 3] = 0;\n dst[ 4] = 0;\n dst[ 5] = 2 * near / dy;\n dst[ 6] = 0;\n dst[ 7] = 0;\n dst[ 8] = (left + right) / dx;\n dst[ 9] = (top + bottom) / dy;\n dst[10] = far / dz;\n dst[11] = -1;\n dst[12] = 0;\n dst[13] = 0;\n dst[14] = near * far / dz;\n dst[15] = 0;\n\n return dst;\n}\n\n/**\n * Computes a 4-by-4 reverse-z perspective transformation matrix given the left, right,\n * top, bottom, near and far clipping planes. The arguments define a frustum\n * extending in the negative z direction. The arguments near and far are the\n * distances to the near and far clipping planes. Note that near and far are not\n * z coordinates, but rather they are distances along the negative z-axis. The\n * matrix generated sends the viewing frustum to the unit box. We assume a unit\n * box extending from -1 to 1 in the x and y dimensions and from 1 (-near) to 0 (-far) in the z\n * dimension.\n * @param left - The x coordinate of the left plane of the box.\n * @param right - The x coordinate of the right plane of the box.\n * @param bottom - The y coordinate of the bottom plane of the box.\n * @param top - The y coordinate of the right plane of the box.\n * @param near - The negative z coordinate of the near plane of the box.\n * @param far - The negative z coordinate of the far plane of the box.\n * @param dst - Output matrix. If not passed a new one is created.\n * @returns The perspective projection matrix.\n */\nexport function frustumReverseZ(left: number, right: number, bottom: number, top: number, near: number, far = Infinity, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n const dx = (right - left);\n const dy = (top - bottom);\n\n dst[ 0] = 2 * near / dx;\n dst[ 1] = 0;\n dst[ 2] = 0;\n dst[ 3] = 0;\n dst[ 4] = 0;\n dst[ 5] = 2 * near / dy;\n dst[ 6] = 0;\n dst[ 7] = 0;\n dst[ 8] = (left + right) / dx;\n dst[ 9] = (top + bottom) / dy;\n dst[11] = -1;\n dst[12] = 0;\n dst[13] = 0;\n dst[15] = 0;\n\n if (far === Infinity) {\n dst[10] = 0;\n dst[14] = near;\n } else {\n const rangeInv = 1 / (far - near);\n dst[10] = near * rangeInv;\n dst[14] = far * near * rangeInv;\n }\n\n return dst;\n}\n\nlet xAxis: Vec3;\nlet yAxis: Vec3;\nlet zAxis: Vec3;\n\n/**\n * Computes a 4-by-4 aim transformation.\n *\n * This is a matrix which positions an object aiming down positive Z.\n * toward the target.\n *\n * Note: this is **NOT** the inverse of lookAt as lookAt looks at negative Z.\n *\n * @param position - The position of the object.\n * @param target - The position meant to be aimed at.\n * @param up - A vector pointing up.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The aim matrix.\n */\nexport function aim(position: Vec3, target: Vec3, up: Vec3, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n xAxis = xAxis || vec3.create();\n yAxis = yAxis || vec3.create();\n zAxis = zAxis || vec3.create();\n\n vec3.normalize(vec3.subtract(target, position, zAxis), zAxis);\n vec3.normalize(vec3.cross(up, zAxis, xAxis), xAxis);\n vec3.normalize(vec3.cross(zAxis, xAxis, yAxis), yAxis);\n\n dst[ 0] = xAxis[0]; dst[ 1] = xAxis[1]; dst[ 2] = xAxis[2]; dst[ 3] = 0;\n dst[ 4] = yAxis[0]; dst[ 5] = yAxis[1]; dst[ 6] = yAxis[2]; dst[ 7] = 0;\n dst[ 8] = zAxis[0]; dst[ 9] = zAxis[1]; dst[10] = zAxis[2]; dst[11] = 0;\n dst[12] = position[0]; dst[13] = position[1]; dst[14] = position[2]; dst[15] = 1;\n\n return dst;\n}\n\n/**\n * Computes a 4-by-4 camera aim transformation.\n *\n * This is a matrix which positions an object aiming down negative Z.\n * toward the target.\n *\n * Note: this is the inverse of `lookAt`\n *\n * @param eye - The position of the object.\n * @param target - The position meant to be aimed at.\n * @param up - A vector pointing up.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The aim matrix.\n */\nexport function cameraAim(eye: Vec3, target: Vec3, up: Vec3, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n xAxis = xAxis || vec3.create();\n yAxis = yAxis || vec3.create();\n zAxis = zAxis || vec3.create();\n\n vec3.normalize(vec3.subtract(eye, target, zAxis), zAxis);\n vec3.normalize(vec3.cross(up, zAxis, xAxis), xAxis);\n vec3.normalize(vec3.cross(zAxis, xAxis, yAxis), yAxis);\n\n dst[ 0] = xAxis[0]; dst[ 1] = xAxis[1]; dst[ 2] = xAxis[2]; dst[ 3] = 0;\n dst[ 4] = yAxis[0]; dst[ 5] = yAxis[1]; dst[ 6] = yAxis[2]; dst[ 7] = 0;\n dst[ 8] = zAxis[0]; dst[ 9] = zAxis[1]; dst[10] = zAxis[2]; dst[11] = 0;\n dst[12] = eye[0]; dst[13] = eye[1]; dst[14] = eye[2]; dst[15] = 1;\n\n return dst;\n}\n\n/**\n * Computes a 4-by-4 view transformation.\n *\n * This is a view matrix which transforms all other objects\n * to be in the space of the view defined by the parameters.\n *\n * @param eye - The position of the object.\n * @param target - The position meant to be aimed at.\n * @param up - A vector pointing up.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The look-at matrix.\n */\nexport function lookAt(eye: Vec3, target: Vec3, up: Vec3, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n xAxis = xAxis || vec3.create();\n yAxis = yAxis || vec3.create();\n zAxis = zAxis || vec3.create();\n\n vec3.normalize(vec3.subtract(eye, target, zAxis), zAxis);\n vec3.normalize(vec3.cross(up, zAxis, xAxis), xAxis);\n vec3.normalize(vec3.cross(zAxis, xAxis, yAxis), yAxis);\n\n dst[ 0] = xAxis[0]; dst[ 1] = yAxis[0]; dst[ 2] = zAxis[0]; dst[ 3] = 0;\n dst[ 4] = xAxis[1]; dst[ 5] = yAxis[1]; dst[ 6] = zAxis[1]; dst[ 7] = 0;\n dst[ 8] = xAxis[2]; dst[ 9] = yAxis[2]; dst[10] = zAxis[2]; dst[11] = 0;\n\n dst[12] = -(xAxis[0] * eye[0] + xAxis[1] * eye[1] + xAxis[2] * eye[2]);\n dst[13] = -(yAxis[0] * eye[0] + yAxis[1] * eye[1] + yAxis[2] * eye[2]);\n dst[14] = -(zAxis[0] * eye[0] + zAxis[1] * eye[1] + zAxis[2] * eye[2]);\n dst[15] = 1;\n\n return dst;\n}\n\n/**\n * Creates a 4-by-4 matrix which translates by the given vector v.\n * @param v - The vector by\n * which to translate.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The translation matrix.\n */\nexport function translation(v: Vec3, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n dst[ 0] = 1; dst[ 1] = 0; dst[ 2] = 0; dst[ 3] = 0;\n dst[ 4] = 0; dst[ 5] = 1; dst[ 6] = 0; dst[ 7] = 0;\n dst[ 8] = 0; dst[ 9] = 0; dst[10] = 1; dst[11] = 0;\n dst[12] = v[0]; dst[13] = v[1]; dst[14] = v[2]; dst[15] = 1;\n\n return dst;\n}\n\n/**\n * Translates the given 4-by-4 matrix by the given vector v.\n * @param m - The matrix.\n * @param v - The vector by\n * which to translate.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The translated matrix.\n */\nexport function translate(m: Mat4, v: Vec3, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const m00 = m[0];\n const m01 = m[1];\n const m02 = m[2];\n const m03 = m[3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const m30 = m[3 * 4 + 0];\n const m31 = m[3 * 4 + 1];\n const m32 = m[3 * 4 + 2];\n const m33 = m[3 * 4 + 3];\n\n if (m !== dst) {\n dst[ 0] = m00;\n dst[ 1] = m01;\n dst[ 2] = m02;\n dst[ 3] = m03;\n dst[ 4] = m10;\n dst[ 5] = m11;\n dst[ 6] = m12;\n dst[ 7] = m13;\n dst[ 8] = m20;\n dst[ 9] = m21;\n dst[10] = m22;\n dst[11] = m23;\n }\n\n dst[12] = m00 * v0 + m10 * v1 + m20 * v2 + m30;\n dst[13] = m01 * v0 + m11 * v1 + m21 * v2 + m31;\n dst[14] = m02 * v0 + m12 * v1 + m22 * v2 + m32;\n dst[15] = m03 * v0 + m13 * v1 + m23 * v2 + m33;\n\n return dst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the x-axis by the given angle.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotation matrix.\n */\nexport function rotationX(angleInRadians: number, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n dst[ 0] = 1; dst[ 1] = 0; dst[ 2] = 0; dst[ 3] = 0;\n dst[ 4] = 0; dst[ 5] = c; dst[ 6] = s; dst[ 7] = 0;\n dst[ 8] = 0; dst[ 9] = -s; dst[10] = c; dst[11] = 0;\n dst[12] = 0; dst[13] = 0; dst[14] = 0; dst[15] = 1;\n\n return dst;\n}\n\n/**\n * Rotates the given 4-by-4 matrix around the x-axis by the given\n * angle.\n * @param m - The matrix.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nexport function rotateX(m: Mat4, angleInRadians: number, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n const m10 = m[4];\n const m11 = m[5];\n const m12 = m[6];\n const m13 = m[7];\n const m20 = m[8];\n const m21 = m[9];\n const m22 = m[10];\n const m23 = m[11];\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n dst[4] = c * m10 + s * m20;\n dst[5] = c * m11 + s * m21;\n dst[6] = c * m12 + s * m22;\n dst[7] = c * m13 + s * m23;\n dst[8] = c * m20 - s * m10;\n dst[9] = c * m21 - s * m11;\n dst[10] = c * m22 - s * m12;\n dst[11] = c * m23 - s * m13;\n\n if (m !== dst) {\n dst[ 0] = m[ 0];\n dst[ 1] = m[ 1];\n dst[ 2] = m[ 2];\n dst[ 3] = m[ 3];\n dst[12] = m[12];\n dst[13] = m[13];\n dst[14] = m[14];\n dst[15] = m[15];\n }\n\n return dst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the y-axis by the given angle.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotation matrix.\n */\nexport function rotationY(angleInRadians: number, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n dst[ 0] = c; dst[ 1] = 0; dst[ 2] = -s; dst[ 3] = 0;\n dst[ 4] = 0; dst[ 5] = 1; dst[ 6] = 0; dst[ 7] = 0;\n dst[ 8] = s; dst[ 9] = 0; dst[10] = c; dst[11] = 0;\n dst[12] = 0; dst[13] = 0; dst[14] = 0; dst[15] = 1;\n\n return dst;\n}\n\n/**\n * Rotates the given 4-by-4 matrix around the y-axis by the given\n * angle.\n * @param m - The matrix.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nexport function rotateY(m: Mat4, angleInRadians: number, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n dst[ 0] = c * m00 - s * m20;\n dst[ 1] = c * m01 - s * m21;\n dst[ 2] = c * m02 - s * m22;\n dst[ 3] = c * m03 - s * m23;\n dst[ 8] = c * m20 + s * m00;\n dst[ 9] = c * m21 + s * m01;\n dst[10] = c * m22 + s * m02;\n dst[11] = c * m23 + s * m03;\n\n if (m !== dst) {\n dst[ 4] = m[ 4];\n dst[ 5] = m[ 5];\n dst[ 6] = m[ 6];\n dst[ 7] = m[ 7];\n dst[12] = m[12];\n dst[13] = m[13];\n dst[14] = m[14];\n dst[15] = m[15];\n }\n\n return dst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the z-axis by the given angle.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotation matrix.\n */\nexport function rotationZ(angleInRadians: number, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n dst[ 0] = c; dst[ 1] = s; dst[ 2] = 0; dst[ 3] = 0;\n dst[ 4] = -s; dst[ 5] = c; dst[ 6] = 0; dst[ 7] = 0;\n dst[ 8] = 0; dst[ 9] = 0; dst[10] = 1; dst[11] = 0;\n dst[12] = 0; dst[13] = 0; dst[14] = 0; dst[15] = 1;\n\n return dst;\n}\n\n/**\n * Rotates the given 4-by-4 matrix around the z-axis by the given\n * angle.\n * @param m - The matrix.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nexport function rotateZ(m: Mat4, angleInRadians: number, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n dst[ 0] = c * m00 + s * m10;\n dst[ 1] = c * m01 + s * m11;\n dst[ 2] = c * m02 + s * m12;\n dst[ 3] = c * m03 + s * m13;\n dst[ 4] = c * m10 - s * m00;\n dst[ 5] = c * m11 - s * m01;\n dst[ 6] = c * m12 - s * m02;\n dst[ 7] = c * m13 - s * m03;\n\n if (m !== dst) {\n dst[ 8] = m[ 8];\n dst[ 9] = m[ 9];\n dst[10] = m[10];\n dst[11] = m[11];\n dst[12] = m[12];\n dst[13] = m[13];\n dst[14] = m[14];\n dst[15] = m[15];\n }\n\n return dst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the given axis by the given\n * angle.\n * @param axis - The axis\n * about which to rotate.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns A matrix which rotates angle radians\n * around the axis.\n */\nexport function axisRotation(axis: Vec3, angleInRadians: number, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n let x = axis[0];\n let y = axis[1];\n let z = axis[2];\n const n = Math.sqrt(x * x + y * y + z * z);\n x /= n;\n y /= n;\n z /= n;\n const xx = x * x;\n const yy = y * y;\n const zz = z * z;\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n const oneMinusCosine = 1 - c;\n\n dst[ 0] = xx + (1 - xx) * c;\n dst[ 1] = x * y * oneMinusCosine + z * s;\n dst[ 2] = x * z * oneMinusCosine - y * s;\n dst[ 3] = 0;\n dst[ 4] = x * y * oneMinusCosine - z * s;\n dst[ 5] = yy + (1 - yy) * c;\n dst[ 6] = y * z * oneMinusCosine + x * s;\n dst[ 7] = 0;\n dst[ 8] = x * z * oneMinusCosine + y * s;\n dst[ 9] = y * z * oneMinusCosine - x * s;\n dst[10] = zz + (1 - zz) * c;\n dst[11] = 0;\n dst[12] = 0;\n dst[13] = 0;\n dst[14] = 0;\n dst[15] = 1;\n\n return dst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the given axis by the given\n * angle. (same as axisRotation)\n * @param axis - The axis\n * about which to rotate.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns A matrix which rotates angle radians\n * around the axis.\n */\nexport const rotation = axisRotation;\n\n/**\n * Rotates the given 4-by-4 matrix around the given axis by the\n * given angle.\n * @param m - The matrix.\n * @param axis - The axis\n * about which to rotate.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nexport function axisRotate(m: Mat4, axis: Vec3, angleInRadians: number, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n let x = axis[0];\n let y = axis[1];\n let z = axis[2];\n const n = Math.sqrt(x * x + y * y + z * z);\n x /= n;\n y /= n;\n z /= n;\n const xx = x * x;\n const yy = y * y;\n const zz = z * z;\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n const oneMinusCosine = 1 - c;\n\n const r00 = xx + (1 - xx) * c;\n const r01 = x * y * oneMinusCosine + z * s;\n const r02 = x * z * oneMinusCosine - y * s;\n const r10 = x * y * oneMinusCosine - z * s;\n const r11 = yy + (1 - yy) * c;\n const r12 = y * z * oneMinusCosine + x * s;\n const r20 = x * z * oneMinusCosine + y * s;\n const r21 = y * z * oneMinusCosine - x * s;\n const r22 = zz + (1 - zz) * c;\n\n const m00 = m[0];\n const m01 = m[1];\n const m02 = m[2];\n const m03 = m[3];\n const m10 = m[4];\n const m11 = m[5];\n const m12 = m[6];\n const m13 = m[7];\n const m20 = m[8];\n const m21 = m[9];\n const m22 = m[10];\n const m23 = m[11];\n\n dst[ 0] = r00 * m00 + r01 * m10 + r02 * m20;\n dst[ 1] = r00 * m01 + r01 * m11 + r02 * m21;\n dst[ 2] = r00 * m02 + r01 * m12 + r02 * m22;\n dst[ 3] = r00 * m03 + r01 * m13 + r02 * m23;\n dst[ 4] = r10 * m00 + r11 * m10 + r12 * m20;\n dst[ 5] = r10 * m01 + r11 * m11 + r12 * m21;\n dst[ 6] = r10 * m02 + r11 * m12 + r12 * m22;\n dst[ 7] = r10 * m03 + r11 * m13 + r12 * m23;\n dst[ 8] = r20 * m00 + r21 * m10 + r22 * m20;\n dst[ 9] = r20 * m01 + r21 * m11 + r22 * m21;\n dst[10] = r20 * m02 + r21 * m12 + r22 * m22;\n dst[11] = r20 * m03 + r21 * m13 + r22 * m23;\n\n if (m !== dst) {\n dst[12] = m[12];\n dst[13] = m[13];\n dst[14] = m[14];\n dst[15] = m[15];\n }\n\n return dst;\n}\n\n/**\n * Rotates the given 4-by-4 matrix around the given axis by the\n * given angle. (same as rotate)\n * @param m - The matrix.\n * @param axis - The axis\n * about which to rotate.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nexport const rotate = axisRotate;\n\n/**\n * Creates a 4-by-4 matrix which scales in each dimension by an amount given by\n * the corresponding entry in the given vector; assumes the vector has three\n * entries.\n * @param v - A vector of\n * three entries specifying the factor by which to scale in each dimension.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaling matrix.\n */\nexport function scaling(v: Vec3, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n dst[ 0] = v[0]; dst[ 1] = 0; dst[ 2] = 0; dst[ 3] = 0;\n dst[ 4] = 0; dst[ 5] = v[1]; dst[ 6] = 0; dst[ 7] = 0;\n dst[ 8] = 0; dst[ 9] = 0; dst[10] = v[2]; dst[11] = 0;\n dst[12] = 0; dst[13] = 0; dst[14] = 0; dst[15] = 1;\n\n return dst;\n}\n\n/**\n * Scales the given 4-by-4 matrix in each dimension by an amount\n * given by the corresponding entry in the given vector; assumes the vector has\n * three entries.\n * @param m - The matrix to be modified.\n * @param v - A vector of three entries specifying the\n * factor by which to scale in each dimension.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaled matrix.\n */\nexport function scale(m: Mat4, v: Vec3, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n\n dst[ 0] = v0 * m[0 * 4 + 0];\n dst[ 1] = v0 * m[0 * 4 + 1];\n dst[ 2] = v0 * m[0 * 4 + 2];\n dst[ 3] = v0 * m[0 * 4 + 3];\n dst[ 4] = v1 * m[1 * 4 + 0];\n dst[ 5] = v1 * m[1 * 4 + 1];\n dst[ 6] = v1 * m[1 * 4 + 2];\n dst[ 7] = v1 * m[1 * 4 + 3];\n dst[ 8] = v2 * m[2 * 4 + 0];\n dst[ 9] = v2 * m[2 * 4 + 1];\n dst[10] = v2 * m[2 * 4 + 2];\n dst[11] = v2 * m[2 * 4 + 3];\n\n if (m !== dst) {\n dst[12] = m[12];\n dst[13] = m[13];\n dst[14] = m[14];\n dst[15] = m[15];\n }\n\n return dst;\n}\n\n/**\n * Creates a 4-by-4 matrix which scales a uniform amount in each dimension.\n * @param s - the amount to scale\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaling matrix.\n */\nexport function uniformScaling(s: number, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n dst[ 0] = s; dst[ 1] = 0; dst[ 2] = 0; dst[ 3] = 0;\n dst[ 4] = 0; dst[ 5] = s; dst[ 6] = 0; dst[ 7] = 0;\n dst[ 8] = 0; dst[ 9] = 0; dst[10] = s; dst[11] = 0;\n dst[12] = 0; dst[13] = 0; dst[14] = 0; dst[15] = 1;\n\n return dst;\n}\n\n/**\n * Scales the given 4-by-4 matrix in each dimension by a uniform scale.\n * @param m - The matrix to be modified.\n * @param s - The amount to scale.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaled matrix.\n */\nexport function uniformScale(m: Mat4, s: number, dst?: Mat4): Mat4 {\n dst = dst || new MatType(16);\n\n dst[ 0] = s * m[0 * 4 + 0];\n dst[ 1] = s * m[0 * 4 + 1];\n dst[ 2] = s * m[0 * 4 + 2];\n dst[ 3] = s * m[0 * 4 + 3];\n dst[ 4] = s * m[1 * 4 + 0];\n dst[ 5] = s * m[1 * 4 + 1];\n dst[ 6] = s * m[1 * 4 + 2];\n dst[ 7] = s * m[1 * 4 + 3];\n dst[ 8] = s * m[2 * 4 + 0];\n dst[ 9] = s * m[2 * 4 + 1];\n dst[10] = s * m[2 * 4 + 2];\n dst[11] = s * m[2 * 4 + 3];\n\n if (m !== dst) {\n dst[12] = m[12];\n dst[13] = m[13];\n dst[14] = m[14];\n dst[15] = m[15];\n }\n\n return dst;\n}","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\n\n/**\n * A JavaScript array with 4 values, Float32Array with 4 values, or a Float64Array with 4 values.\n * When created by the library will create the default type which is `Float32Array`\n * but can be set by calling {@link quat.setDefaultType}.\n */\nexport type Quat = number[] | Float32Array | Float64Array;\n\n/**\n *\n * Quat4 math functions.\n *\n * Almost all functions take an optional `dst` argument. If it is not passed in the\n * functions will create a new `Quat4`. In other words you can do this\n *\n * const v = quat4.cross(v1, v2); // Creates a new Quat4 with the cross product of v1 x v2.\n *\n * or\n *\n * const v = quat4.create();\n * quat4.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v\n *\n * The first style is often easier but depending on where it's used it generates garbage where\n * as there is almost never allocation with the second style.\n *\n * It is always safe to pass any vector as the destination. So for example\n *\n * quat4.cross(v1, v2, v1); // Puts the cross product of v1 x v2 in v1\n *\n */\n\nexport let QuatType: new (n: number) => Quat = Float32Array;\n\n/**\n * Sets the type this library creates for a Quat4\n * @param ctor - the constructor for the type. Either `Float32Array`, `Float64Array`, or `Array`\n * @returns previous constructor for Quat4\n */\nexport function setDefaultType(ctor: new (n: number) => Quat) {\n const oldType = QuatType;\n QuatType = ctor;\n return oldType;\n}\n\n/**\n * Creates a quat4; may be called with x, y, z to set initial values.\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @param w - Initial w value.\n * @returns the created vector\n */\nexport function create(x?: number, y?: number, z?: number, w?: number): Quat {\n const dst = new QuatType(4);\n if (x !== undefined) {\n dst[0] = x;\n if (y !== undefined) {\n dst[1] = y;\n if (z !== undefined) {\n dst[2] = z;\n if (w !== undefined) {\n dst[3] = w;\n }\n }\n }\n }\n return dst;\n}","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport * as utils from './utils.js';\nimport { Quat, create, setDefaultType, QuatType } from './quat';\nimport { Mat3 } from './mat3.js';\nimport { Mat4 } from './mat4.js';\nimport { Vec3 } from './vec3.js';\nimport * as vec3 from './vec3-impl.js';\n\nexport type RotationOrder = 'xyz' | 'xzy' | 'yxz' | 'yzx' | 'zxy' | 'zyx';\n\nexport default Quat;\nexport { create, setDefaultType };\n\n/**\n * Creates a Quat; may be called with x, y, z to set initial values. (same as create)\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @param z - Initial w value.\n * @returns the created vector\n */\nexport const fromValues = create;\n\n/**\n * Sets the values of a Quat\n * Also see {@link quat.create} and {@link quat.copy}\n *\n * @param x first value\n * @param y second value\n * @param z third value\n * @param w fourth value\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector with its elements set.\n */\nexport function set(x: number, y: number, z: number, w: number, dst?: Quat) {\n dst = dst || new QuatType(4);\n\n dst[0] = x;\n dst[1] = y;\n dst[2] = z;\n dst[3] = w;\n\n return dst;\n}\n\n/**\n * Sets a quaternion from the given angle and axis,\n * then returns it.\n *\n * @param axis - the axis to rotate around\n * @param angleInRadians - the angle\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The quaternion that represents the given axis and angle\n **/\nexport function fromAxisAngle(axis: Vec3, angleInRadians: number, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n const halfAngle = angleInRadians * 0.5;\n const s = Math.sin(halfAngle);\n\n dst[0] = s * axis[0];\n dst[1] = s * axis[1];\n dst[2] = s * axis[2];\n dst[3] = Math.cos(halfAngle);\n\n return dst;\n}\n\n/**\n * Gets the rotation axis and angle\n * @param q - quaternion to compute from\n * @param dst - Vec3 to hold result. If not passed in a new one is created.\n * @return angle and axis\n */\nexport function toAxisAngle(q: Quat, dst?: Vec3): { angle: number, axis: Vec3 } {\n dst = dst || vec3.create(4);\n\n const angle = Math.acos(q[3]) * 2;\n const s = Math.sin(angle * 0.5);\n if (s > utils.EPSILON) {\n dst[0] = q[0] / s;\n dst[1] = q[1] / s;\n dst[2] = q[2] / s;\n } else {\n dst[0] = 1;\n dst[1] = 0;\n dst[2] = 0;\n }\n\n return { angle, axis: dst };\n}\n\n/**\n * Returns the angle in degrees between two rotations a and b.\n * @param a - quaternion a\n * @param b - quaternion b\n * @return angle in radians between the two quaternions\n */\nexport function angle(a: Quat, b: Quat) {\n const d = dot(a, b);\n return Math.acos(2 * d * d - 1);\n}\n\n/**\n * Multiplies two quaternions\n *\n * @param a - the first quaternion\n * @param b - the second quaternion\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nexport function multiply(a: Quat, b: Quat, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const aw = a[3];\n\n const bx = b[0];\n const by = b[1];\n const bz = b[2];\n const bw = b[3];\n\n dst[0] = ax * bw + aw * bx + ay * bz - az * by;\n dst[1] = ay * bw + aw * by + az * bx - ax * bz;\n dst[2] = az * bw + aw * bz + ax * by - ay * bx;\n dst[3] = aw * bw - ax * bx - ay * by - az * bz;\n\n return dst;\n}\n\n/**\n * Multiplies two quaternions\n *\n * @param a - the first quaternion\n * @param b - the second quaternion\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nexport const mul = multiply;\n\n/**\n * Rotates the given quaternion around the X axis by the given angle.\n * @param q - quaternion to rotate\n * @param angleInRadians - The angle by which to rotate\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nexport function rotateX(q: Quat, angleInRadians: number, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n const halfAngle = angleInRadians * 0.5;\n\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const qw = q[3];\n\n const bx = Math.sin(halfAngle);\n const bw = Math.cos(halfAngle);\n\n dst[0] = qx * bw + qw * bx;\n dst[1] = qy * bw + qz * bx;\n dst[2] = qz * bw - qy * bx;\n dst[3] = qw * bw - qx * bx;\n\n return dst;\n}\n\n/**\n * Rotates the given quaternion around the Y axis by the given angle.\n * @param q - quaternion to rotate\n * @param angleInRadians - The angle by which to rotate\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nexport function rotateY(q: Quat, angleInRadians: number, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n const halfAngle = angleInRadians * 0.5;\n\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const qw = q[3];\n\n const by = Math.sin(halfAngle);\n const bw = Math.cos(halfAngle);\n\n dst[0] = qx * bw - qz * by;\n dst[1] = qy * bw + qw * by;\n dst[2] = qz * bw + qx * by;\n dst[3] = qw * bw - qy * by;\n\n return dst;\n}\n\n/**\n * Rotates the given quaternion around the Z axis by the given angle.\n * @param q - quaternion to rotate\n * @param angleInRadians - The angle by which to rotate\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nexport function rotateZ(q: Quat, angleInRadians: number, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n const halfAngle = angleInRadians * 0.5;\n\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const qw = q[3];\n\n const bz = Math.sin(halfAngle);\n const bw = Math.cos(halfAngle);\n\n dst[0] = qx * bw + qy * bz;\n dst[1] = qy * bw - qx * bz;\n dst[2] = qz * bw + qw * bz;\n dst[3] = qw * bw - qz * bz;\n\n return dst;\n}\n\n/**\n * Spherically linear interpolate between two quaternions\n *\n * @param a - starting value\n * @param b - ending value\n * @param t - value where 0 = a and 1 = b\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nexport function slerp(a: Quat, b: Quat, t: number, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const aw = a[3];\n\n let bx = b[0];\n let by = b[1];\n let bz = b[2];\n let bw = b[3];\n\n let cosOmega = ax * bx + ay * by + az * bz + aw * bw;\n\n if (cosOmega < 0) {\n cosOmega = -cosOmega;\n bx = -bx;\n by = -by;\n bz = -bz;\n bw = -bw;\n }\n\n let scale0;\n let scale1;\n\n if (1.0 - cosOmega > utils.EPSILON) {\n const omega = Math.acos(cosOmega);\n const sinOmega = Math.sin(omega);\n scale0 = Math.sin((1 - t) * omega) / sinOmega;\n scale1 = Math.sin(t * omega) / sinOmega;\n } else {\n scale0 = 1.0 - t;\n scale1 = t;\n }\n\n dst[0] = scale0 * ax + scale1 * bx;\n dst[1] = scale0 * ay + scale1 * by;\n dst[2] = scale0 * az + scale1 * bz;\n dst[3] = scale0 * aw + scale1 * bw;\n\n return dst;\n}\n\n/**\n * Compute the inverse of a quaternion\n *\n * @param q - quaternion to compute the inverse of\n * @returns A quaternion that is the result of a * b\n */\nexport function inverse(q: Quat, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n const a0 = q[0];\n const a1 = q[1];\n const a2 = q[2];\n const a3 = q[3];\n\n const dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3;\n const invDot = dot ? 1 / dot : 0;\n\n dst[0] = -a0 * invDot;\n dst[1] = -a1 * invDot;\n dst[2] = -a2 * invDot;\n dst[3] = a3 * invDot;\n\n return dst;\n}\n\n/**\n * Compute the conjugate of a quaternion\n * For quaternions with a magnitude of 1 (a unit quaternion)\n * this returns the same as the inverse but is faster to calculate.\n *\n * @param q - quaternion to compute the conjugate of.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The conjugate of q\n */\nexport function conjugate(q: Quat, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n dst[0] = -q[0];\n dst[1] = -q[1];\n dst[2] = -q[2];\n dst[3] = q[3];\n\n return dst;\n}\n\n/**\n * Creates a quaternion from the given rotation matrix.\n *\n * The created quaternion is not normalized.\n *\n * @param m - rotation matrix\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns the result\n */\nexport function fromMat(m: Mat3 | Mat4, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n /*\n 0 1 2\n 3 4 5\n 6 7 8\n\n 0 1 2\n 4 5 6\n 8 9 10\n */\n\n // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes\n // article \"Quaternion Calculus and Fast Animation\".\n const trace = m[0] + m[5] + m[10];\n\n if (trace > 0.0) {\n // |w| > 1/2, may as well choose w > 1/2\n const root = Math.sqrt(trace + 1); // 2w\n dst[3] = 0.5 * root;\n const invRoot = 0.5 / root; // 1/(4w)\n\n dst[0] = (m[6] - m[9]) * invRoot;\n dst[1] = (m[8] - m[2]) * invRoot;\n dst[2] = (m[1] - m[4]) * invRoot;\n } else {\n // |w| <= 1/2\n let i = 0;\n\n if (m[5] > m[0]) {\n i = 1;\n }\n if (m[10] > m[i * 4 + i]) {\n i = 2;\n }\n\n const j = (i + 1) % 3;\n const k = (i + 2) % 3;\n\n const root = Math.sqrt(m[i * 4 + i] - m[j * 4 + j] - m[k * 4 + k] + 1.0);\n dst[i] = 0.5 * root;\n\n const invRoot = 0.5 / root;\n\n dst[3] = (m[j * 4 + k] - m[k * 4 + j]) * invRoot;\n dst[j] = (m[j * 4 + i] + m[i * 4 + j]) * invRoot;\n dst[k] = (m[k * 4 + i] + m[i * 4 + k]) * invRoot;\n }\n\n return dst;\n}\n\n/**\n * Creates a quaternion from the given euler angle x, y, z using the provided intrinsic order for the conversion.\n *\n * @param xAngleInRadians - angle to rotate around X axis in radians.\n * @param yAngleInRadians - angle to rotate around Y axis in radians.\n * @param zAngleInRadians - angle to rotate around Z axis in radians.\n * @param order - order to apply euler angles\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion representing the same rotation as the euler angles applied in the given order\n */\nexport function fromEuler(\n xAngleInRadians: number,\n yAngleInRadians: number,\n zAngleInRadians: number,\n order: RotationOrder,\n dst?: Quat) {\n dst = dst || new QuatType(4);\n\n const xHalfAngle = xAngleInRadians * 0.5;\n const yHalfAngle = yAngleInRadians * 0.5;\n const zHalfAngle = zAngleInRadians * 0.5;\n\n const sx = Math.sin(xHalfAngle);\n const cx = Math.cos(xHalfAngle);\n const sy = Math.sin(yHalfAngle);\n const cy = Math.cos(yHalfAngle);\n const sz = Math.sin(zHalfAngle);\n const cz = Math.cos(zHalfAngle);\n\n switch (order) {\n case 'xyz':\n dst[0] = sx * cy * cz + cx * sy * sz;\n dst[1] = cx * sy * cz - sx * cy * sz;\n dst[2] = cx * cy * sz + sx * sy * cz;\n dst[3] = cx * cy * cz - sx * sy * sz;\n break;\n\n case 'xzy':\n dst[0] = sx * cy * cz - cx * sy * sz;\n dst[1] = cx * sy * cz - sx * cy * sz;\n dst[2] = cx * cy * sz + sx * sy * cz;\n dst[3] = cx * cy * cz + sx * sy * sz;\n break;\n\n case 'yxz':\n dst[0] = sx * cy * cz + cx * sy * sz;\n dst[1] = cx * sy * cz - sx * cy * sz;\n dst[2] = cx * cy * sz - sx * sy * cz;\n dst[3] = cx * cy * cz + sx * sy * sz;\n break;\n\n case 'yzx':\n dst[0] = sx * cy * cz + cx * sy * sz;\n dst[1] = cx * sy * cz + sx * cy * sz;\n dst[2] = cx * cy * sz - sx * sy * cz;\n dst[3] = cx * cy * cz - sx * sy * sz;\n break;\n\n case 'zxy':\n dst[0] = sx * cy * cz - cx * sy * sz;\n dst[1] = cx * sy * cz + sx * cy * sz;\n dst[2] = cx * cy * sz + sx * sy * cz;\n dst[3] = cx * cy * cz - sx * sy * sz;\n break;\n\n case 'zyx':\n dst[0] = sx * cy * cz - cx * sy * sz;\n dst[1] = cx * sy * cz + sx * cy * sz;\n dst[2] = cx * cy * sz - sx * sy * cz;\n dst[3] = cx * cy * cz + sx * sy * sz;\n break;\n\n default:\n throw new Error(`Unknown rotation order: ${order}`);\n }\n\n return dst;\n}\n\n/**\n * Copies a quaternion. (same as {@link quat.clone})\n * Also see {@link quat.create} and {@link quat.set}\n * @param q - The quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is a copy of q\n */\nexport function copy(q: Quat, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n dst[0] = q[0];\n dst[1] = q[1];\n dst[2] = q[2];\n dst[3] = q[3];\n\n return dst;\n}\n\n/**\n * Clones a quaternion. (same as {@link quat.copy})\n * Also see {@link quat.create} and {@link quat.set}\n * @param q - The quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A copy of q.\n */\nexport const clone = copy;\n\n/**\n * Adds two quaternions; assumes a and b have the same dimension.\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the sum of a and b.\n */\nexport function add(a: Quat, b: Quat, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n dst[0] = a[0] + b[0];\n dst[1] = a[1] + b[1];\n dst[2] = a[2] + b[2];\n dst[3] = a[3] + b[3];\n\n return dst;\n}\n\n/**\n * Subtracts two quaternions.\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the difference of a and b.\n */\nexport function subtract(a: Quat, b: Quat, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n dst[0] = a[0] - b[0];\n dst[1] = a[1] - b[1];\n dst[2] = a[2] - b[2];\n dst[3] = a[3] - b[3];\n\n return dst;\n}\n\n/**\n * Subtracts two quaternions.\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the difference of a and b.\n */\nexport const sub = subtract;\n\n/**\n * Multiplies a quaternion by a scalar.\n * @param v - The quaternion.\n * @param k - The scalar.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The scaled quaternion.\n */\nexport function mulScalar(v: Quat, k: number, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n dst[0] = v[0] * k;\n dst[1] = v[1] * k;\n dst[2] = v[2] * k;\n dst[3] = v[3] * k;\n\n return dst;\n}\n\n/**\n * Multiplies a quaternion by a scalar. (same as mulScalar)\n * @param v - The quaternion.\n * @param k - The scalar.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The scaled quaternion.\n */\nexport const scale = mulScalar;\n\n/**\n * Divides a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The scaled quaternion.\n */\nexport function divScalar(v: Quat, k: number, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n dst[0] = v[0] / k;\n dst[1] = v[1] / k;\n dst[2] = v[2] / k;\n dst[3] = v[3] / k;\n\n return dst;\n}\n\n/**\n * Computes the dot product of two quaternions\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @returns dot product\n */\nexport function dot(a: Quat, b: Quat): number {\n return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]) + (a[3] * b[3]);\n}\n\n/**\n * Performs linear interpolation on two quaternions.\n * Given quaternions a and b and interpolation coefficient t, returns\n * a + t * (b - a).\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @param t - Interpolation coefficient.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The linear interpolated result.\n */\nexport function lerp(a: Quat, b: Quat, t: number, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n dst[0] = a[0] + t * (b[0] - a[0]);\n dst[1] = a[1] + t * (b[1] - a[1]);\n dst[2] = a[2] + t * (b[2] - a[2]);\n dst[3] = a[3] + t * (b[3] - a[3]);\n\n return dst;\n}\n\n/**\n * Computes the length of quaternion\n * @param v - quaternion.\n * @returns length of quaternion.\n */\nexport function length(v: Quat): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n return Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3);\n}\n\n/**\n * Computes the length of quaternion (same as length)\n * @param v - quaternion.\n * @returns length of quaternion.\n */\nexport const len = length;\n\n/**\n * Computes the square of the length of quaternion\n * @param v - quaternion.\n * @returns square of the length of quaternion.\n */\nexport function lengthSq(v: Quat): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n return v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3;\n}\n\n/**\n * Computes the square of the length of quaternion (same as lengthSq)\n * @param v - quaternion.\n * @returns square of the length of quaternion.\n */\nexport const lenSq = lengthSq;\n\n/**\n * Divides a quaternion by its Euclidean length and returns the quotient.\n * @param v - The quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The normalized quaternion.\n */\nexport function normalize(v: Quat, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n const len = Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3);\n\n if (len > 0.00001) {\n dst[0] = v0 / len;\n dst[1] = v1 / len;\n dst[2] = v2 / len;\n dst[3] = v3 / len;\n } else {\n dst[0] = 0;\n dst[1] = 0;\n dst[2] = 0;\n dst[3] = 0;\n }\n\n return dst;\n}\n\n/**\n * Check if 2 quaternions are approximately equal\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @returns true if quaternions are approximately equal\n */\nexport function equalsApproximately(a: Quat, b: Quat): boolean {\n return Math.abs(a[0] - b[0]) < utils.EPSILON &&\n Math.abs(a[1] - b[1]) < utils.EPSILON &&\n Math.abs(a[2] - b[2]) < utils.EPSILON &&\n Math.abs(a[3] - b[3]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 quaternions are exactly equal\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @returns true if quaternions are exactly equal\n */\nexport function equals(a: Quat, b: Quat): boolean {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];\n}\n\n/**\n * Creates an identity quaternion\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns an identity quaternion\n */\nexport function identity(dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n dst[0] = 0;\n dst[1] = 0;\n dst[2] = 0;\n dst[3] = 1;\n\n return dst;\n}\n\nlet tempVec3: Vec3;\nlet xUnitVec3: Vec3;\nlet yUnitVec3: Vec3;\n\n/**\n * Computes a quaternion to represent the shortest rotation from one vector to another.\n *\n * @param aUnit - the start vector\n * @param bUnit - the end vector\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns the result\n */\nexport function rotationTo(aUnit: Vec3, bUnit: Vec3, dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n tempVec3 = tempVec3 || vec3.create();\n xUnitVec3 = xUnitVec3 || vec3.create(1, 0, 0);\n yUnitVec3 = yUnitVec3 || vec3.create(0, 1, 0);\n\n const dot = vec3.dot(aUnit, bUnit);\n if (dot < -0.999999) {\n vec3.cross(xUnitVec3, aUnit, tempVec3);\n if (vec3.len(tempVec3) < 0.000001) {\n vec3.cross(yUnitVec3, aUnit, tempVec3);\n }\n\n vec3.normalize(tempVec3, tempVec3);\n fromAxisAngle(tempVec3, Math.PI, dst);\n\n return dst;\n } else if (dot > 0.999999) {\n dst[0] = 0;\n dst[1] = 0;\n dst[2] = 0;\n dst[3] = 1;\n\n return dst;\n } else {\n vec3.cross(aUnit, bUnit, tempVec3);\n\n dst[0] = tempVec3[0];\n dst[1] = tempVec3[1];\n dst[2] = tempVec3[2];\n dst[3] = 1 + dot;\n\n return normalize(dst, dst);\n }\n}\n\nlet tempQuat1: Quat;\nlet tempQuat2: Quat;\n\n/**\n * Performs a spherical linear interpolation with two control points\n *\n * @param a - the first quaternion\n * @param b - the second quaternion\n * @param c - the third quaternion\n * @param d - the fourth quaternion\n * @param t - Interpolation coefficient 0 to 1\n * @returns result\n */\nexport function sqlerp(\n a: Quat,\n b: Quat,\n c: Quat,\n d: Quat,\n t: number,\n dst?: Quat): Quat {\n dst = dst || new QuatType(4);\n\n tempQuat1 = tempQuat1 || new QuatType(4);\n tempQuat2 = tempQuat2 || new QuatType(4);\n\n slerp(a, d, t, tempQuat1);\n slerp(b, c, t, tempQuat2);\n slerp(tempQuat1, tempQuat2, 2 * t * (1 - t), dst);\n\n return dst;\n}\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\n\n/**\n * A JavaScript array with 4 values, Float32Array with 4 values, or a Float64Array with 4 values.\n * When created by the library will create the default type which is `Float32Array`\n * but can be set by calling {@link vec4.setDefaultType}.\n */\nexport type Vec4 = number[] | Float32Array | Float64Array;\n\n/**\n *\n * Vec4 math functions.\n *\n * Almost all functions take an optional `dst` argument. If it is not passed in the\n * functions will create a new `Vec4`. In other words you can do this\n *\n * const v = vec4.cross(v1, v2); // Creates a new Vec4 with the cross product of v1 x v2.\n *\n * or\n *\n * const v = vec4.create();\n * vec4.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v\n *\n * The first style is often easier but depending on where it's used it generates garbage where\n * as there is almost never allocation with the second style.\n *\n * It is always safe to pass any vector as the destination. So for example\n *\n * vec4.cross(v1, v2, v1); // Puts the cross product of v1 x v2 in v1\n *\n */\n\nexport let VecType: new (n: number) => Vec4 = Float32Array;\n\n/**\n * Sets the type this library creates for a Vec4\n * @param ctor - the constructor for the type. Either `Float32Array`, `Float64Array`, or `Array`\n * @returns previous constructor for Vec4\n */\nexport function setDefaultType(ctor: new (n: number) => Vec4) {\n const oldType = VecType;\n VecType = ctor;\n return oldType;\n}\n\n/**\n * Creates a vec4; may be called with x, y, z to set initial values.\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @param w - Initial w value.\n * @returns the created vector\n */\nexport function create(x?: number, y?: number, z?: number, w?: number): Vec4 {\n const dst = new VecType(4);\n if (x !== undefined) {\n dst[0] = x;\n if (y !== undefined) {\n dst[1] = y;\n if (z !== undefined) {\n dst[2] = z;\n if (w !== undefined) {\n dst[3] = w;\n }\n }\n }\n }\n return dst;\n}","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport * as utils from './utils.js';\nimport { Vec4, create, setDefaultType, VecType } from './vec4';\nimport { Mat4 } from './mat4';\n\nexport default Vec4;\nexport { create, setDefaultType };\n\n/**\n * Creates a vec4; may be called with x, y, z to set initial values. (same as create)\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @param z - Initial w value.\n * @returns the created vector\n */\nexport const fromValues = create;\n\n/**\n * Sets the values of a Vec4\n * Also see {@link vec4.create} and {@link vec4.copy}\n *\n * @param x first value\n * @param y second value\n * @param z third value\n * @param w fourth value\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector with its elements set.\n */\nexport function set(x: number, y: number, z: number, w: number, dst?: Vec4) {\n dst = dst || new VecType(4);\n\n dst[0] = x;\n dst[1] = y;\n dst[2] = z;\n dst[3] = w;\n\n return dst;\n}\n\n/**\n * Applies Math.ceil to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the ceil of each element of v.\n */\nexport function ceil(v: Vec4, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = Math.ceil(v[0]);\n dst[1] = Math.ceil(v[1]);\n dst[2] = Math.ceil(v[2]);\n dst[3] = Math.ceil(v[3]);\n\n return dst;\n}\n\n/**\n * Applies Math.floor to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the floor of each element of v.\n */\nexport function floor(v: Vec4, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = Math.floor(v[0]);\n dst[1] = Math.floor(v[1]);\n dst[2] = Math.floor(v[2]);\n dst[3] = Math.floor(v[3]);\n\n return dst;\n}\n\n/**\n * Applies Math.round to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the round of each element of v.\n */\nexport function round(v: Vec4, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = Math.round(v[0]);\n dst[1] = Math.round(v[1]);\n dst[2] = Math.round(v[2]);\n dst[3] = Math.round(v[3]);\n\n return dst;\n}\n\n/**\n * Clamp each element of vector between min and max\n * @param v - Operand vector.\n * @param max - Min value, default 0\n * @param min - Max value, default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that the clamped value of each element of v.\n */\nexport function clamp(v: Vec4, min = 0, max = 1, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = Math.min(max, Math.max(min, v[0]));\n dst[1] = Math.min(max, Math.max(min, v[1]));\n dst[2] = Math.min(max, Math.max(min, v[2]));\n dst[3] = Math.min(max, Math.max(min, v[3]));\n\n return dst;\n}\n\n/**\n * Adds two vectors; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a and b.\n */\nexport function add(a: Vec4, b: Vec4, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = a[0] + b[0];\n dst[1] = a[1] + b[1];\n dst[2] = a[2] + b[2];\n dst[3] = a[3] + b[3];\n\n return dst;\n}\n\n/**\n * Adds two vectors, scaling the 2nd; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param scale - Amount to scale b\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a + b * scale.\n */\nexport function addScaled(a: Vec4, b: Vec4, scale: number, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = a[0] + b[0] * scale;\n dst[1] = a[1] + b[1] * scale;\n dst[2] = a[2] + b[2] * scale;\n dst[3] = a[3] + b[3] * scale;\n\n return dst;\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nexport function subtract(a: Vec4, b: Vec4, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = a[0] - b[0];\n dst[1] = a[1] - b[1];\n dst[2] = a[2] - b[2];\n dst[3] = a[3] - b[3];\n\n return dst;\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nexport const sub = subtract;\n\n/**\n * Check if 2 vectors are approximately equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are approximately equal\n */\nexport function equalsApproximately(a: Vec4, b: Vec4): boolean {\n return Math.abs(a[0] - b[0]) < utils.EPSILON &&\n Math.abs(a[1] - b[1]) < utils.EPSILON &&\n Math.abs(a[2] - b[2]) < utils.EPSILON &&\n Math.abs(a[3] - b[3]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 vectors are exactly equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are exactly equal\n */\nexport function equals(a: Vec4, b: Vec4): boolean {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficient.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The linear interpolated result.\n */\nexport function lerp(a: Vec4, b: Vec4, t: number, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = a[0] + t * (b[0] - a[0]);\n dst[1] = a[1] + t * (b[1] - a[1]);\n dst[2] = a[2] + t * (b[2] - a[2]);\n dst[3] = a[3] + t * (b[3] - a[3]);\n\n return dst;\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient vector t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficients vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns the linear interpolated result.\n */\nexport function lerpV(a: Vec4, b: Vec4, t: Vec4, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = a[0] + t[0] * (b[0] - a[0]);\n dst[1] = a[1] + t[1] * (b[1] - a[1]);\n dst[2] = a[2] + t[2] * (b[2] - a[2]);\n dst[3] = a[3] + t[3] * (b[3] - a[3]);\n\n return dst;\n}\n\n/**\n * Return max values of two vectors.\n * Given vectors a and b returns\n * [max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The max components vector.\n */\nexport function max(a: Vec4, b: Vec4, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = Math.max(a[0], b[0]);\n dst[1] = Math.max(a[1], b[1]);\n dst[2] = Math.max(a[2], b[2]);\n dst[3] = Math.max(a[3], b[3]);\n\n return dst;\n}\n\n/**\n * Return min values of two vectors.\n * Given vectors a and b returns\n * [min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The min components vector.\n */\nexport function min(a: Vec4, b: Vec4, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = Math.min(a[0], b[0]);\n dst[1] = Math.min(a[1], b[1]);\n dst[2] = Math.min(a[2], b[2]);\n dst[3] = Math.min(a[3], b[3]);\n\n return dst;\n}\n\n/**\n * Multiplies a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nexport function mulScalar(v: Vec4, k: number, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = v[0] * k;\n dst[1] = v[1] * k;\n dst[2] = v[2] * k;\n dst[3] = v[3] * k;\n\n return dst;\n}\n\n/**\n * Multiplies a vector by a scalar. (same as mulScalar)\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nexport const scale = mulScalar;\n\n/**\n * Divides a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nexport function divScalar(v: Vec4, k: number, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = v[0] / k;\n dst[1] = v[1] / k;\n dst[2] = v[2] / k;\n dst[3] = v[3] / k;\n\n return dst;\n}\n\n/**\n * Inverse a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nexport function inverse(v: Vec4, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = 1 / v[0];\n dst[1] = 1 / v[1];\n dst[2] = 1 / v[2];\n dst[3] = 1 / v[3];\n\n return dst;\n}\n\n/**\n * Invert a vector. (same as inverse)\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nexport const invert = inverse;\n\n/**\n * Computes the dot product of two vectors\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns dot product\n */\nexport function dot(a: Vec4, b: Vec4): number {\n return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]) + (a[3] * b[3]);\n}\n\n/**\n * Computes the length of vector\n * @param v - vector.\n * @returns length of vector.\n */\nexport function length(v: Vec4): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n return Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3);\n}\n\n/**\n * Computes the length of vector (same as length)\n * @param v - vector.\n * @returns length of vector.\n */\nexport const len = length;\n\n/**\n * Computes the square of the length of vector\n * @param v - vector.\n * @returns square of the length of vector.\n */\nexport function lengthSq(v: Vec4): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n return v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3;\n}\n\n/**\n * Computes the square of the length of vector (same as lengthSq)\n * @param v - vector.\n * @returns square of the length of vector.\n */\nexport const lenSq = lengthSq;\n\n/**\n * Computes the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nexport function distance(a: Vec4, b: Vec4): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n const dz = a[2] - b[2];\n const dw = a[3] - b[3];\n return Math.sqrt(dx * dx + dy * dy + dz * dz + dw * dw);\n}\n\n/**\n * Computes the distance between 2 points (same as distance)\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nexport const dist = distance;\n\n/**\n * Computes the square of the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nexport function distanceSq(a: Vec4, b: Vec4): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n const dz = a[2] - b[2];\n const dw = a[3] - b[3];\n return dx * dx + dy * dy + dz * dz + dw * dw;\n}\n\n/**\n * Computes the square of the distance between 2 points (same as distanceSq)\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nexport const distSq = distanceSq;\n\n/**\n * Divides a vector by its Euclidean length and returns the quotient.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The normalized vector.\n */\nexport function normalize(v: Vec4, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n const len = Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3);\n\n if (len > 0.00001) {\n dst[0] = v0 / len;\n dst[1] = v1 / len;\n dst[2] = v2 / len;\n dst[3] = v3 / len;\n } else {\n dst[0] = 0;\n dst[1] = 0;\n dst[2] = 0;\n dst[3] = 0;\n }\n\n return dst;\n}\n\n/**\n * Negates a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns -v.\n */\nexport function negate(v: Vec4, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = -v[0];\n dst[1] = -v[1];\n dst[2] = -v[2];\n dst[3] = -v[3];\n\n return dst;\n}\n\n/**\n * Copies a vector. (same as {@link vec4.clone})\n * Also see {@link vec4.create} and {@link vec4.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nexport function copy(v: Vec4, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = v[0];\n dst[1] = v[1];\n dst[2] = v[2];\n dst[3] = v[3];\n\n return dst;\n}\n\n/**\n * Clones a vector. (same as {@link vec4.copy})\n * Also see {@link vec4.create} and {@link vec4.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nexport const clone = copy;\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nexport function multiply(a: Vec4, b: Vec4, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = a[0] * b[0];\n dst[1] = a[1] * b[1];\n dst[2] = a[2] * b[2];\n dst[3] = a[3] * b[3];\n\n return dst;\n}\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as mul)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nexport const mul = multiply;\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nexport function divide(a: Vec4, b: Vec4, dst?: Vec4) {\n dst = dst || new VecType(4);\n\n dst[0] = a[0] / b[0];\n dst[1] = a[1] / b[1];\n dst[2] = a[2] / b[2];\n dst[3] = a[3] / b[3];\n\n return dst;\n}\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as divide)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nexport const div = divide;\n\n/**\n * Zero's a vector\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The zeroed vector.\n */\nexport function zero(dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n dst[0] = 0;\n dst[1] = 0;\n dst[2] = 0;\n dst[3] = 0;\n\n return dst;\n}\n\n\n/**\n * transform vec4 by 4x4 matrix\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional vec4 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nexport function transformMat4(v: Vec4, m: Mat4, dst?: Vec4): Vec4 {\n dst = dst || new VecType(4);\n\n const x = v[0];\n const y = v[1];\n const z = v[2];\n const w = v[3];\n\n dst[0] = m[0] * x + m[4] * y + m[ 8] * z + m[12] * w;\n dst[1] = m[1] * x + m[5] * y + m[ 9] * z + m[13] * w;\n dst[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;\n dst[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;\n\n return dst;\n}\n\n\n/**\n * Treat a 4D vector as a direction and set it's length\n *\n * @param a The vec4 to lengthen\n * @param len The length of the resulting vector\n * @returns The lengthened vector\n */\nexport function setLength(a: Vec4, len: number, dst?: Vec4) {\n dst = dst || new VecType(4);\n normalize(a, dst);\n return mulScalar(dst, len, dst);\n}\n\n/**\n * Ensure a vector is not longer than a max length\n *\n * @param a The vec4 to limit\n * @param maxLen The longest length of the resulting vector\n * @returns The vector, shortened to maxLen if it's too long\n */\nexport function truncate(a: Vec4, maxLen: number, dst?: Vec4) {\n dst = dst || new VecType(4);\n\n if (length(a) > maxLen) {\n return setLength(a, maxLen, dst);\n }\n\n return copy(a, dst);\n}\n\n/**\n * Return the vector exactly between 2 endpoint vectors\n *\n * @param a Endpoint 1\n * @param b Endpoint 2\n * @returns The vector exactly residing between endpoints 1 and 2\n */\nexport function midpoint(a: Vec4, b: Vec4, dst?: Vec4) {\n dst = dst || new VecType(4);\n return lerp(a, b, 0.5, dst);\n}\n","import Mat3, * as mat3 from './mat3-impl';\nimport Mat4, * as mat4 from './mat4-impl';\nimport Quat, * as quat from './quat-impl';\nimport Vec2, * as vec2 from './vec2-impl';\nimport Vec3, * as vec3 from './vec3-impl';\nimport Vec4, * as vec4 from './vec4-impl';\nimport * as utils from './utils';\n\n/**\n * Sets the type this library creates for all types\n *\n * example:\n *\n * ```\n * setDefaultType(Float64Array);\n * ```\n *\n * @param ctor - the constructor for the type. Either `Float32Array`, `Float64Array`, or `Array`\n */\nexport function setDefaultType(ctor: new (n: number) => Float32Array | Float64Array | number[]) {\n mat3.setDefaultType(ctor);\n mat4.setDefaultType(ctor);\n quat.setDefaultType(ctor);\n vec2.setDefaultType(ctor);\n vec3.setDefaultType(ctor);\n vec4.setDefaultType(ctor);\n}\n\nexport {\n Mat3,\n mat3,\n Mat4,\n mat4,\n Quat,\n quat,\n utils,\n Vec2,\n vec2,\n Vec3,\n vec3,\n Vec4,\n vec4,\n};"],"names":["EPSILON","degrees","Math","PI","n","m","a","b","v","d","abs","t","radians","old","VecType","Float32Array","setDefaultType","ctor","oldType","create","x","y","dst","undefined","z","subtract","lerp","mulScalar","k","inverse","dot","length","v0","v1","sqrt","lengthSq","distance","dx","dy","distanceSq","normalize","len","copy","multiply","divide","setLength","scale","ax","ay","bx","by","mag","cosine","acos","ceil","min","max","Vec3Type","utils.EPSILON","floor","angle","random","cos","sin","rad","p0","p1","sinC","cosC","round","maxLen","MatType","ctorMap","Map","Float64Array","Array","fill","newMat3","get","identity","m00","m01","m02","m10","m11","m12","m20","m21","m22","b01","b11","b21","invDet","a00","a01","a02","a10","a11","a12","a20","a21","a22","b00","b02","b10","b12","b20","b22","v2","v3","v4","v5","v6","v7","v8","m4","q","w","x2","y2","z2","xx","yx","yy","zx","zy","zz","wx","wy","wz","axis","off","vec2.create","xy","angleInRadians","c","s","cross","t1","t2","dz","az","bz","xz","yz","zScale","p","r","qx","qy","qz","w2","uvX","uvY","uvZ","m03","m13","m23","m30","m31","m32","m33","tmp0","tmp1","tmp2","tmp3","tmp4","tmp5","tmp6","tmp7","tmp8","tmp9","tmp10","tmp11","tmp12","tmp13","tmp14","tmp15","tmp16","tmp17","tmp18","tmp19","tmp20","tmp21","tmp22","tmp23","t0","t3","a03","a13","a23","a30","a31","a32","a33","b03","b13","b23","b30","b31","b32","b33","xAxis","yAxis","zAxis","axisRotation","oneMinusCosine","axisRotate","r00","r01","r02","r10","r11","r12","r20","r21","r22","position","target","up","vec3.create","vec3.normalize","vec3.subtract","vec3.cross","eye","v9","v10","v11","v12","v13","v14","v15","m3","left","right","bottom","top","near","far","Infinity","rangeInv","fieldOfViewYInRadians","aspect","zNear","zFar","f","tan","Number","isFinite","QuatType","fromAxisAngle","halfAngle","aw","bw","slerp","scale0","scale1","cosOmega","omega","sinOmega","tempVec3","xUnitVec3","yUnitVec3","tempQuat1","tempQuat2","xAngleInRadians","yAngleInRadians","zAngleInRadians","order","xHalfAngle","yHalfAngle","zHalfAngle","sx","cx","sy","cy","sz","cz","Error","trace","root","invRoot","i","j","a0","a1","a2","a3","invDot","qw","aUnit","bUnit","vec3.dot","vec3.len","dw","mat3.setDefaultType","mat4.setDefaultType","quat.setDefaultType","vec2.setDefaultType","vec3.setDefaultType","vec4.setDefaultType"],"mappings":"AAsBO,IAAIA,EAAU,4DAkBf,SAAmBC,GACvB,OAAOA,EAAUC,KAA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EAAI,GAAKjB,EAAE,GAAKe,EAAIf,EAAE,GAAKgB,EAAIhB,EAAE,IAAMmB,EAAInB,EAAE,IAAMgH,EAE5C/F,CACT,oBAuByBhB,EAASgE,EAAgBhD,GAGhD,OAFAA,EAAMA,GAAO,IAAIR,GAAQ,GAErBiB,GAAOzB,GAAKgE,EACPzB,GAAUvC,EAAGgE,EAAQhD,GAGvBoB,GAAKpC,EAAGgB,EACjB,OAhEM,SAAeA,GAQnB,OAPAA,EAAMA,GAAO,IAAIR,GAAQ,IAErB,GAAK,EACTQ,EAAI,GAAK,EACTA,EAAI,GAAK,EACTA,EAAI,GAAK,EAEFA,CACT,GC9kBM,SAAUN,GAAeC,GAC7BsR,EAAoBtR,GACpBuR,EAAoBvR,GACpBwR,GAAoBxR,GACpByR,EAAoBzR,GACpB0R,EAAoB1R,GACpB2R,GAAoB3R,EACtB"} \ No newline at end of file diff --git a/dist/3.x/mat3-impl.d.ts b/dist/3.x/mat3-impl.d.ts new file mode 100644 index 0000000..d87b1dc --- /dev/null +++ b/dist/3.x/mat3-impl.d.ts @@ -0,0 +1,36 @@ +import { Mat3Arg, Mat3Type } from './mat3'; +import { Mat4Arg } from './mat4'; +import { BaseArgType } from './types'; +export { Mat3Arg, Mat3Type }; +type Mat3Ctor = new (n: number) => T; +export declare function getAPI(Ctor: Mat3Ctor): { + clone: (m: BaseArgType, dst?: T_1 | undefined) => T_1; + create: (v0?: number | undefined, v1?: number | undefined, v2?: number | undefined, v3?: number | undefined, v4?: number | undefined, v5?: number | undefined, v6?: number | undefined, v7?: number | undefined, v8?: number | undefined) => T; + set: (v0: number, v1: number, v2: number, v3: number, v4: number, v5: number, v6: number, v7: number, v8: number, dst?: T_2 | undefined) => T_2; + fromMat4: (m4: BaseArgType, dst?: T_3 | undefined) => T_3; + fromQuat: (q: BaseArgType, dst?: T_4 | undefined) => T_4; + negate: (m: BaseArgType, dst?: T_5 | undefined) => T_5; + copy: (m: BaseArgType, dst?: T_1 | undefined) => T_1; + equalsApproximately: (a: BaseArgType, b: BaseArgType) => boolean; + equals: (a: BaseArgType, b: BaseArgType) => boolean; + identity: (dst?: T_6 | undefined) => T_6; + transpose: (m: BaseArgType, dst?: T_7 | undefined) => T_7; + inverse: (m: BaseArgType, dst?: T_8 | undefined) => T_8; + invert: (m: BaseArgType, dst?: T_8 | undefined) => T_8; + determinant: (m: BaseArgType) => number; + mul: (a: BaseArgType, b: BaseArgType, dst?: T_9 | undefined) => T_9; + multiply: (a: BaseArgType, b: BaseArgType, dst?: T_9 | undefined) => T_9; + setTranslation: (a: BaseArgType, v: BaseArgType, dst?: T_10 | undefined) => T_10; + getTranslation: (m: BaseArgType, dst?: T_11 | undefined) => T_11; + getAxis: (m: BaseArgType, axis: number, dst?: T_12 | undefined) => T_12; + setAxis: (m: BaseArgType, v: BaseArgType, axis: number, dst?: T_13 | undefined) => T_13; + getScaling: (m: BaseArgType, dst?: T_14 | undefined) => T | T_14; + translation: (v: BaseArgType, dst?: T_15 | undefined) => T_15; + translate: (m: BaseArgType, v: BaseArgType, dst?: T_16 | undefined) => T_16; + rotation: (angleInRadians: number, dst?: T_17 | undefined) => T_17; + rotate: (m: BaseArgType, angleInRadians: number, dst?: T_18 | undefined) => T_18; + scaling: (v: BaseArgType, dst?: T_19 | undefined) => T_19; + scale: (m: BaseArgType, v: BaseArgType, dst?: T_20 | undefined) => T_20; + uniformScaling: (s: number, dst?: T_21 | undefined) => T_21; + uniformScale: (m: BaseArgType, s: number, dst?: T_22 | undefined) => T_22; +}; diff --git a/dist/3.x/mat3.d.ts b/dist/3.x/mat3.d.ts new file mode 100644 index 0000000..83bfc95 --- /dev/null +++ b/dist/3.x/mat3.d.ts @@ -0,0 +1,9 @@ +import { BaseArgType } from "./types"; +/** + * A JavaScript array with 12 values, a Float32Array with 12 values, or a Float64Array with 12 values. + */ +export type Mat3Arg = BaseArgType; +/** + * A specific concrete 3x3 element vector. + */ +export type Mat3Type = T; diff --git a/dist/3.x/mat4-impl.d.ts b/dist/3.x/mat4-impl.d.ts new file mode 100644 index 0000000..a59abb3 --- /dev/null +++ b/dist/3.x/mat4-impl.d.ts @@ -0,0 +1,51 @@ +import { Mat4Arg, Mat4Type } from './mat4'; +import { BaseArgType } from './types'; +export { Mat4Arg, Mat4Type }; +type Mat4Ctor = new (n: number) => T; +export declare function getAPI(Ctor: Mat4Ctor): { + create: (v0?: number | undefined, v1?: number | undefined, v2?: number | undefined, v3?: number | undefined, v4?: number | undefined, v5?: number | undefined, v6?: number | undefined, v7?: number | undefined, v8?: number | undefined, v9?: number | undefined, v10?: number | undefined, v11?: number | undefined, v12?: number | undefined, v13?: number | undefined, v14?: number | undefined, v15?: number | undefined) => T; + set: (v0: number, v1: number, v2: number, v3: number, v4: number, v5: number, v6: number, v7: number, v8: number, v9: number, v10: number, v11: number, v12: number, v13: number, v14: number, v15: number, dst?: T_1 | undefined) => T_1; + fromMat3: (m3: BaseArgType, dst?: T_2 | undefined) => T_2; + fromQuat: (q: BaseArgType, dst?: T_3 | undefined) => T_3; + negate: (m: BaseArgType, dst?: T_4 | undefined) => T_4; + copy: (m: BaseArgType, dst?: T_5 | undefined) => T_5; + clone: (m: BaseArgType, dst?: T_5 | undefined) => T_5; + equalsApproximately: (a: BaseArgType, b: BaseArgType) => boolean; + equals: (a: BaseArgType, b: BaseArgType) => boolean; + identity: (dst?: T_6 | undefined) => T_6; + transpose: (m: BaseArgType, dst?: T_7 | undefined) => T_7; + inverse: (m: BaseArgType, dst?: T_8 | undefined) => T_8; + determinant: (m: BaseArgType) => number; + invert: (m: BaseArgType, dst?: T_8 | undefined) => T_8; + multiply: (a: BaseArgType, b: BaseArgType, dst?: T_9 | undefined) => T_9; + mul: (a: BaseArgType, b: BaseArgType, dst?: T_9 | undefined) => T_9; + setTranslation: (a: BaseArgType, v: BaseArgType, dst?: T_10 | undefined) => T_10; + getTranslation: (m: BaseArgType, dst?: T_11 | undefined) => T_11; + getAxis: (m: BaseArgType, axis: number, dst?: T_12 | undefined) => T | T_12; + setAxis: (m: BaseArgType, v: BaseArgType, axis: number, dst: T_13) => T_13; + getScaling: (m: BaseArgType, dst?: T_14 | undefined) => T_14; + perspective: (fieldOfViewYInRadians: number, aspect: number, zNear: number, zFar: number, dst?: T_15 | undefined) => T_15; + perspectiveReverseZ: (fieldOfViewYInRadians: number, aspect: number, zNear: number, zFar?: number, dst?: T_16 | undefined) => T_16; + ortho: (left: number, right: number, bottom: number, top: number, near: number, far: number, dst?: T_17 | undefined) => T_17; + frustum: (left: number, right: number, bottom: number, top: number, near: number, far: number, dst?: T_18 | undefined) => T_18; + frustumReverseZ: (left: number, right: number, bottom: number, top: number, near: number, far?: number, dst?: T_19 | undefined) => T_19; + aim: (position: BaseArgType, target: BaseArgType, up: BaseArgType, dst?: T_20 | undefined) => T_20; + cameraAim: (eye: BaseArgType, target: BaseArgType, up: BaseArgType, dst?: T_21 | undefined) => T_21; + lookAt: (eye: BaseArgType, target: BaseArgType, up: BaseArgType, dst?: T_22 | undefined) => T_22; + translation: (v: BaseArgType, dst?: T_23 | undefined) => T_23; + translate: (m: BaseArgType, v: BaseArgType, dst?: T_24 | undefined) => T_24; + rotationX: (angleInRadians: number, dst?: T_25 | undefined) => T_25; + rotateX: (m: BaseArgType, angleInRadians: number, dst?: T_26 | undefined) => T_26; + rotationY: (angleInRadians: number, dst?: T_27 | undefined) => T_27; + rotateY: (m: BaseArgType, angleInRadians: number, dst?: T_28 | undefined) => T_28; + rotationZ: (angleInRadians: number, dst?: T_29 | undefined) => T_29; + rotateZ: (m: BaseArgType, angleInRadians: number, dst?: T_30 | undefined) => T_30; + axisRotation: (axis: BaseArgType, angleInRadians: number, dst?: T_31 | undefined) => T_31; + rotation: (axis: BaseArgType, angleInRadians: number, dst?: T_31 | undefined) => T_31; + axisRotate: (m: BaseArgType, axis: BaseArgType, angleInRadians: number, dst?: T_32 | undefined) => T_32; + rotate: (m: BaseArgType, axis: BaseArgType, angleInRadians: number, dst?: T_32 | undefined) => T_32; + scaling: (v: BaseArgType, dst?: T_33 | undefined) => T_33; + scale: (m: BaseArgType, v: BaseArgType, dst?: T_34 | undefined) => T_34; + uniformScaling: (s: number, dst?: T_35 | undefined) => T_35; + uniformScale: (m: BaseArgType, s: number, dst?: T_36 | undefined) => T_36; +}; diff --git a/dist/3.x/mat4.d.ts b/dist/3.x/mat4.d.ts new file mode 100644 index 0000000..570ed4a --- /dev/null +++ b/dist/3.x/mat4.d.ts @@ -0,0 +1,9 @@ +import { BaseArgType } from "./types"; +/** + * A JavaScript array with 16 values, a Float32Array with 16 values, or a Float64Array with 16 values. + */ +export type Mat4Arg = BaseArgType; +/** + * A specific concrete 4x4 Matrix Type + */ +export type Mat4Type = T; diff --git a/dist/3.x/quat-impl.d.ts b/dist/3.x/quat-impl.d.ts new file mode 100644 index 0000000..fa5ea56 --- /dev/null +++ b/dist/3.x/quat-impl.d.ts @@ -0,0 +1,68 @@ +import { QuatArg, QuatType } from './quat'; +import { BaseArgType } from './types'; +export { QuatArg, QuatType }; +type QuatCtor = new (n: number) => T; +export type RotationOrder = 'xyz' | 'xzy' | 'yxz' | 'yzx' | 'zxy' | 'zyx'; +/** + * + * Quat4 math functions. + * + * Almost all functions take an optional `newDst` argument. If it is not passed in the + * functions will create a new `Quat4`. In other words you can do this + * + * const v = quat4.cross(v1, v2); // Creates a new Quat4 with the cross product of v1 x v2. + * + * or + * + * const v = quat4.create(); + * quat4.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v + * + * The first style is often easier but depending on where it's used it generates garbage where + * as there is almost never allocation with the second style. + * + * It is always safe to pass any vector as the destination. So for example + * + * quat4.cross(v1, v2, v1); // Puts the cross product of v1 x v2 in v1 + * + */ +export declare function getAPI(Ctor: QuatCtor): { + create: (x?: number | undefined, y?: number | undefined, z?: number | undefined, w?: number | undefined) => T; + fromValues: (x?: number | undefined, y?: number | undefined, z?: number | undefined, w?: number | undefined) => T; + set: (x: number, y: number, z: number, w: number, dst?: T_1 | undefined) => T_1; + fromAxisAngle: (axis: BaseArgType, angleInRadians: number, dst?: T_2 | undefined) => T_2; + toAxisAngle: (q: BaseArgType, dst?: T_3 | undefined) => { + angle: number; + axis: T_3; + }; + angle: (a: BaseArgType, b: BaseArgType) => number; + multiply: (a: BaseArgType, b: BaseArgType, dst?: T_4 | undefined) => T_4; + mul: (a: BaseArgType, b: BaseArgType, dst?: T_4 | undefined) => T_4; + rotateX: (q: BaseArgType, angleInRadians: number, dst?: T_5 | undefined) => T_5; + rotateY: (q: BaseArgType, angleInRadians: number, dst?: T_6 | undefined) => T_6; + rotateZ: (q: BaseArgType, angleInRadians: number, dst?: T_7 | undefined) => T_7; + slerp: (a: BaseArgType, b: BaseArgType, t: number, dst?: T_8 | undefined) => T_8; + inverse: (q: BaseArgType, dst?: T_9 | undefined) => T_9; + conjugate: (q: BaseArgType, dst?: T_10 | undefined) => T_10; + fromMat: (m: BaseArgType, dst?: T_11 | undefined) => T_11; + fromEuler: (xAngleInRadians: number, yAngleInRadians: number, zAngleInRadians: number, order: RotationOrder, dst?: T_12 | undefined) => T_12; + copy: (q: BaseArgType, dst?: T_13 | undefined) => T_13; + clone: (q: BaseArgType, dst?: T_13 | undefined) => T_13; + add: (a: BaseArgType, b: BaseArgType, dst?: T_14 | undefined) => T_14; + subtract: (a: BaseArgType, b: BaseArgType, dst?: T_15 | undefined) => T_15; + sub: (a: BaseArgType, b: BaseArgType, dst?: T_15 | undefined) => T_15; + mulScalar: (v: BaseArgType, k: number, dst?: T_16 | undefined) => T_16; + scale: (v: BaseArgType, k: number, dst?: T_16 | undefined) => T_16; + divScalar: (v: BaseArgType, k: number, dst?: T_17 | undefined) => T_17; + dot: (a: BaseArgType, b: BaseArgType) => number; + lerp: (a: BaseArgType, b: BaseArgType, t: number, dst?: T_18 | undefined) => T_18; + length: (v: BaseArgType) => number; + len: (v: BaseArgType) => number; + lengthSq: (v: BaseArgType) => number; + lenSq: (v: BaseArgType) => number; + normalize: (v: BaseArgType, dst?: T_19 | undefined) => T_19; + equalsApproximately: (a: BaseArgType, b: BaseArgType) => boolean; + equals: (a: BaseArgType, b: BaseArgType) => boolean; + identity: (dst?: T_20 | undefined) => T_20; + rotationTo: (aUnit: BaseArgType, bUnit: BaseArgType, dst?: T_21 | undefined) => T_21; + sqlerp: (a: BaseArgType, b: BaseArgType, c: BaseArgType, d: BaseArgType, t: number, dst?: T_22 | undefined) => T_22; +}; diff --git a/dist/3.x/quat.d.ts b/dist/3.x/quat.d.ts new file mode 100644 index 0000000..2e69cc9 --- /dev/null +++ b/dist/3.x/quat.d.ts @@ -0,0 +1,9 @@ +import { BaseArgType } from "./types"; +/** + * A JavaScript array with 4 values, a Float32Array with 4 values, or a Float64Array with 4 values. + */ +export type QuatArg = BaseArgType; +/** + * A specific concrete 4x4 Matrix Type + */ +export type QuatType = T; diff --git a/dist/3.x/types.d.ts b/dist/3.x/types.d.ts new file mode 100644 index 0000000..06e5762 --- /dev/null +++ b/dist/3.x/types.d.ts @@ -0,0 +1,19 @@ +/** + * The types you can pass to most functions that take an + * array of numbers. + */ +export type BaseArgType = Float32Array | Float64Array | number[]; +export declare const ZeroArray: { + (arrayLength: number): number[]; + (...items: number[]): number[]; + new (arrayLength: number): number[]; + new (...items: number[]): number[]; + isArray(arg: any): arg is any[]; + readonly prototype: any[]; + from(arrayLike: ArrayLike): T[]; + from(arrayLike: ArrayLike, mapfn: (v: T_1, k: number) => U, thisArg?: any): U[]; + from(iterable: Iterable | ArrayLike): T_2[]; + from(iterable: Iterable | ArrayLike, mapfn: (v: T_3, k: number) => U_1, thisArg?: any): U_1[]; + of(...items: T_4[]): T_4[]; + readonly [Symbol.species]: ArrayConstructor; +}; diff --git a/dist/2.x/utils.d.ts b/dist/3.x/utils.d.ts similarity index 100% rename from dist/2.x/utils.d.ts rename to dist/3.x/utils.d.ts diff --git a/dist/3.x/vec2-impl.d.ts b/dist/3.x/vec2-impl.d.ts new file mode 100644 index 0000000..21e1dda --- /dev/null +++ b/dist/3.x/vec2-impl.d.ts @@ -0,0 +1,55 @@ +import { Vec2Arg, Vec2Type } from './vec2'; +import { BaseArgType } from './types'; +export { Vec2Arg, Vec2Type }; +type Vec2Ctor = new (n: number) => T; +export declare function getAPI(Ctor: Vec2Ctor): { + create: (x?: number, y?: number) => T; + fromValues: (x?: number, y?: number) => T; + set: (x: number, y: number, dst?: T_1 | undefined) => T_1; + ceil: (v: BaseArgType, dst?: T_2 | undefined) => T_2; + floor: (v: BaseArgType, dst?: T_3 | undefined) => T_3; + round: (v: BaseArgType, dst?: T_4 | undefined) => T_4; + clamp: (v: BaseArgType, min?: number, max?: number, dst?: T_5 | undefined) => T_5; + add: (a: BaseArgType, b: BaseArgType, dst?: T_6 | undefined) => T_6; + addScaled: (a: BaseArgType, b: BaseArgType, scale: number, dst?: T_7 | undefined) => T_7; + angle: (a: BaseArgType, b: BaseArgType) => number; + subtract: (a: BaseArgType, b: BaseArgType, dst?: T_8 | undefined) => T_8; + sub: (a: BaseArgType, b: BaseArgType, dst?: T_8 | undefined) => T_8; + equalsApproximately: (a: BaseArgType, b: BaseArgType) => boolean; + equals: (a: BaseArgType, b: BaseArgType) => boolean; + lerp: (a: BaseArgType, b: BaseArgType, t: number, dst?: T_9 | undefined) => T_9; + lerpV: (a: BaseArgType, b: BaseArgType, t: BaseArgType, dst?: T_10 | undefined) => T_10; + max: (a: BaseArgType, b: BaseArgType, dst?: T_11 | undefined) => T_11; + min: (a: BaseArgType, b: BaseArgType, dst?: T_12 | undefined) => T_12; + mulScalar: (v: BaseArgType, k: number, dst?: T_13 | undefined) => T_13; + scale: (v: BaseArgType, k: number, dst?: T_13 | undefined) => T_13; + divScalar: (v: BaseArgType, k: number, dst?: T_14 | undefined) => T_14; + inverse: (v: BaseArgType, dst?: T_15 | undefined) => T_15; + invert: (v: BaseArgType, dst?: T_15 | undefined) => T_15; + cross: (a: BaseArgType, b: BaseArgType, dst?: T_16 | undefined) => T_16; + dot: (a: BaseArgType, b: BaseArgType) => number; + length: (v: BaseArgType) => number; + len: (v: BaseArgType) => number; + lengthSq: (v: BaseArgType) => number; + lenSq: (v: BaseArgType) => number; + distance: (a: BaseArgType, b: BaseArgType) => number; + dist: (a: BaseArgType, b: BaseArgType) => number; + distanceSq: (a: BaseArgType, b: BaseArgType) => number; + distSq: (a: BaseArgType, b: BaseArgType) => number; + normalize: (v: BaseArgType, dst?: T_17 | undefined) => T_17; + negate: (v: BaseArgType, dst?: T_18 | undefined) => T_18; + copy: (v: BaseArgType, dst?: T_19 | undefined) => T_19; + clone: (v: BaseArgType, dst?: T_19 | undefined) => T_19; + multiply: (a: BaseArgType, b: BaseArgType, dst?: T_20 | undefined) => T_20; + mul: (a: BaseArgType, b: BaseArgType, dst?: T_20 | undefined) => T_20; + divide: (a: BaseArgType, b: BaseArgType, dst?: T_21 | undefined) => T_21; + div: (a: BaseArgType, b: BaseArgType, dst?: T_21 | undefined) => T_21; + random: (scale?: number, dst?: T_22 | undefined) => T_22; + zero: (dst?: T_23 | undefined) => T_23; + transformMat4: (v: BaseArgType, m: BaseArgType, dst?: T_24 | undefined) => T_24; + transformMat3: (v: BaseArgType, m: BaseArgType, dst?: T_25 | undefined) => T_25; + rotate: (a: BaseArgType, b: BaseArgType, rad: number, dst?: T_26 | undefined) => T_26; + setLength: (a: BaseArgType, len: number, dst?: T_27 | undefined) => T_27; + truncate: (a: BaseArgType, maxLen: number, dst?: T_28 | undefined) => T_28; + midpoint: (a: BaseArgType, b: BaseArgType, dst?: T_29 | undefined) => T_29; +}; diff --git a/dist/3.x/vec2.d.ts b/dist/3.x/vec2.d.ts new file mode 100644 index 0000000..b6a756b --- /dev/null +++ b/dist/3.x/vec2.d.ts @@ -0,0 +1,9 @@ +import { BaseArgType } from "./types"; +/** + * A JavaScript array with 2 values, a Float32Array with 2 values, or a Float64Array with 2 values. + */ +export type Vec2Arg = BaseArgType; +/** + * A specific concrete 2 element vector. + */ +export type Vec2Type = T; diff --git a/dist/3.x/vec3-impl.d.ts b/dist/3.x/vec3-impl.d.ts new file mode 100644 index 0000000..41fcd10 --- /dev/null +++ b/dist/3.x/vec3-impl.d.ts @@ -0,0 +1,63 @@ +import { Vec3Arg, Vec3Type } from './vec3'; +import { Mat4Arg } from './mat4'; +import { BaseArgType } from './types'; +export { Vec3Arg, Vec3Type }; +type Vec3Ctor = new (n: number) => T; +export declare function getAPI(Ctor: Vec3Ctor): { + create: (x?: number | undefined, y?: number | undefined, z?: number | undefined) => T; + fromValues: (x?: number | undefined, y?: number | undefined, z?: number | undefined) => T; + set: (x: number, y: number, z: number, dst?: T_1 | undefined) => T_1; + ceil: (v: BaseArgType, dst?: T_2 | undefined) => T_2; + floor: (v: BaseArgType, dst?: T_3 | undefined) => T_3; + round: (v: BaseArgType, dst?: T_4 | undefined) => T_4; + clamp: (v: BaseArgType, min?: number, max?: number, dst?: T_5 | undefined) => T_5; + add: (a: BaseArgType, b: BaseArgType, dst?: T_6 | undefined) => T_6; + addScaled: (a: BaseArgType, b: BaseArgType, scale: number, dst?: T_7 | undefined) => T_7; + angle: (a: BaseArgType, b: BaseArgType) => number; + subtract: (a: BaseArgType, b: BaseArgType, dst?: T_8 | undefined) => T_8; + sub: (a: BaseArgType, b: BaseArgType, dst?: T_8 | undefined) => T_8; + equalsApproximately: (a: BaseArgType, b: BaseArgType) => boolean; + equals: (a: BaseArgType, b: BaseArgType) => boolean; + lerp: (a: BaseArgType, b: BaseArgType, t: number, dst?: T_9 | undefined) => T_9; + lerpV: (a: BaseArgType, b: BaseArgType, t: BaseArgType, dst?: T_10 | undefined) => T_10; + max: (a: BaseArgType, b: BaseArgType, dst?: T_11 | undefined) => T_11; + min: (a: BaseArgType, b: BaseArgType, dst?: T_12 | undefined) => T_12; + mulScalar: (v: BaseArgType, k: number, dst?: T_13 | undefined) => T_13; + scale: (v: BaseArgType, k: number, dst?: T_13 | undefined) => T_13; + divScalar: (v: BaseArgType, k: number, dst?: T_14 | undefined) => T_14; + inverse: (v: BaseArgType, dst?: T_15 | undefined) => T_15; + invert: (v: BaseArgType, dst?: T_15 | undefined) => T_15; + cross: (a: BaseArgType, b: BaseArgType, dst?: T_16 | undefined) => T_16; + dot: (a: BaseArgType, b: BaseArgType) => number; + length: (v: BaseArgType) => number; + len: (v: BaseArgType) => number; + lengthSq: (v: BaseArgType) => number; + lenSq: (v: BaseArgType) => number; + distance: (a: BaseArgType, b: BaseArgType) => number; + dist: (a: BaseArgType, b: BaseArgType) => number; + distanceSq: (a: BaseArgType, b: BaseArgType) => number; + distSq: (a: BaseArgType, b: BaseArgType) => number; + normalize: (v: BaseArgType, dst?: T_17 | undefined) => T_17; + negate: (v: BaseArgType, dst?: T_18 | undefined) => T_18; + copy: (v: BaseArgType, dst?: T_19 | undefined) => T_19; + clone: (v: BaseArgType, dst?: T_19 | undefined) => T_19; + multiply: (a: BaseArgType, b: BaseArgType, dst?: T_20 | undefined) => T_20; + mul: (a: BaseArgType, b: BaseArgType, dst?: T_20 | undefined) => T_20; + divide: (a: BaseArgType, b: BaseArgType, dst?: T_21 | undefined) => T_21; + div: (a: BaseArgType, b: BaseArgType, dst?: T_21 | undefined) => T_21; + random: (scale?: number, dst?: T_22 | undefined) => T_22; + zero: (dst?: T_23 | undefined) => T_23; + transformMat4: (v: BaseArgType, m: BaseArgType, dst?: T_24 | undefined) => T_24; + transformMat4Upper3x3: (v: BaseArgType, m: BaseArgType, dst?: T_25 | undefined) => T_25; + transformMat3: (v: BaseArgType, m: BaseArgType, dst?: T_26 | undefined) => T_26; + transformQuat: (v: BaseArgType, q: BaseArgType, dst?: T_27 | undefined) => T_27; + getTranslation: (m: BaseArgType, dst?: T_28 | undefined) => T_28; + getAxis: (m: BaseArgType, axis: number, dst?: T_29 | undefined) => T_29; + getScaling: (m: BaseArgType, dst?: T_30 | undefined) => T_30; + rotateX: (a: BaseArgType, b: BaseArgType, rad: number, dst?: T_31 | undefined) => T_31; + rotateY: (a: BaseArgType, b: BaseArgType, rad: number, dst?: T_32 | undefined) => T_32; + rotateZ: (a: BaseArgType, b: BaseArgType, rad: number, dst?: T_33 | undefined) => T_33; + setLength: (a: BaseArgType, len: number, dst?: T_34 | undefined) => T_34; + truncate: (a: BaseArgType, maxLen: number, dst?: T_35 | undefined) => T_35; + midpoint: (a: BaseArgType, b: BaseArgType, dst?: T_36 | undefined) => T_36; +}; diff --git a/dist/3.x/vec3.d.ts b/dist/3.x/vec3.d.ts new file mode 100644 index 0000000..8a62510 --- /dev/null +++ b/dist/3.x/vec3.d.ts @@ -0,0 +1,9 @@ +import { BaseArgType } from "./types"; +/** + * A JavaScript array with 3 values, a Float32Array with 3 values, or a Float64Array with 3 values. + */ +export type Vec3Arg = BaseArgType; +/** + * A specific concrete 3 element vector. + */ +export type Vec3Type = T; diff --git a/dist/3.x/vec4-impl.d.ts b/dist/3.x/vec4-impl.d.ts new file mode 100644 index 0000000..f3be2f4 --- /dev/null +++ b/dist/3.x/vec4-impl.d.ts @@ -0,0 +1,73 @@ +import { Vec4Arg, Vec4Type } from './vec4'; +import { Mat4Arg } from './mat4'; +import { BaseArgType } from './types'; +export { Vec4Arg, Vec4Type }; +type Vec4Ctor = new (n: number) => T; +/** + * + * Vec4 math functions. + * + * Almost all functions take an optional `newDst` argument. If it is not passed in the + * functions will create a new `Vec4`. In other words you can do this + * + * const v = vec4.cross(v1, v2); // Creates a new Vec4 with the cross product of v1 x v2. + * + * or + * + * const v = vec4.create(); + * vec4.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v + * + * The first style is often easier but depending on where it's used it generates garbage where + * as there is almost never allocation with the second style. + * + * It is always safe to pass any vector as the destination. So for example + * + * vec4.cross(v1, v2, v1); // Puts the cross product of v1 x v2 in v1 + * + */ +export declare function getAPI(Ctor: Vec4Ctor): { + create: (x?: number | undefined, y?: number | undefined, z?: number | undefined, w?: number | undefined) => T; + fromValues: (x?: number | undefined, y?: number | undefined, z?: number | undefined, w?: number | undefined) => T; + set: (x: number, y: number, z: number, w: number, dst?: T_1 | undefined) => T_1; + ceil: (v: BaseArgType, dst?: T_2 | undefined) => T_2; + floor: (v: BaseArgType, dst?: T_3 | undefined) => T_3; + round: (v: BaseArgType, dst?: T_4 | undefined) => T_4; + clamp: (v: BaseArgType, min?: number, max?: number, dst?: T_5 | undefined) => T_5; + add: (a: BaseArgType, b: BaseArgType, dst?: T_6 | undefined) => T_6; + addScaled: (a: BaseArgType, b: BaseArgType, scale: number, dst?: T_7 | undefined) => T_7; + subtract: (a: BaseArgType, b: BaseArgType, dst?: T_8 | undefined) => T_8; + sub: (a: BaseArgType, b: BaseArgType, dst?: T_8 | undefined) => T_8; + equalsApproximately: (a: BaseArgType, b: BaseArgType) => boolean; + equals: (a: BaseArgType, b: BaseArgType) => boolean; + lerp: (a: BaseArgType, b: BaseArgType, t: number, dst?: T_9 | undefined) => T_9; + lerpV: (a: BaseArgType, b: BaseArgType, t: BaseArgType, dst?: T_10 | undefined) => T_10; + max: (a: BaseArgType, b: BaseArgType, dst?: T_11 | undefined) => T_11; + min: (a: BaseArgType, b: BaseArgType, dst?: T_12 | undefined) => T_12; + mulScalar: (v: BaseArgType, k: number, dst?: T_13 | undefined) => T_13; + scale: (v: BaseArgType, k: number, dst?: T_13 | undefined) => T_13; + divScalar: (v: BaseArgType, k: number, dst?: T_14 | undefined) => T_14; + inverse: (v: BaseArgType, dst?: T_15 | undefined) => T_15; + invert: (v: BaseArgType, dst?: T_15 | undefined) => T_15; + dot: (a: BaseArgType, b: BaseArgType) => number; + length: (v: BaseArgType) => number; + len: (v: BaseArgType) => number; + lengthSq: (v: BaseArgType) => number; + lenSq: (v: BaseArgType) => number; + distance: (a: BaseArgType, b: BaseArgType) => number; + dist: (a: BaseArgType, b: BaseArgType) => number; + distanceSq: (a: BaseArgType, b: BaseArgType) => number; + distSq: (a: BaseArgType, b: BaseArgType) => number; + normalize: (v: BaseArgType, dst?: T_16 | undefined) => T_16; + negate: (v: BaseArgType, dst?: T_17 | undefined) => T_17; + copy: (v: BaseArgType, dst?: T_18 | undefined) => T_18; + clone: (v: BaseArgType, dst?: T_18 | undefined) => T_18; + multiply: (a: BaseArgType, b: BaseArgType, dst?: T_19 | undefined) => T_19; + mul: (a: BaseArgType, b: BaseArgType, dst?: T_19 | undefined) => T_19; + divide: (a: BaseArgType, b: BaseArgType, dst?: T_20 | undefined) => T_20; + div: (a: BaseArgType, b: BaseArgType, dst?: T_20 | undefined) => T_20; + zero: (dst?: T_21 | undefined) => T_21; + transformMat4: (v: BaseArgType, m: BaseArgType, dst?: T_22 | undefined) => T_22; + setLength: (a: BaseArgType, len: number, dst?: T_23 | undefined) => T_23; + truncate: (a: BaseArgType, maxLen: number, dst?: T_24 | undefined) => T_24; + midpoint: (a: BaseArgType, b: BaseArgType, dst?: T_25 | undefined) => T_25; +}; diff --git a/dist/3.x/vec4.d.ts b/dist/3.x/vec4.d.ts new file mode 100644 index 0000000..574dbda --- /dev/null +++ b/dist/3.x/vec4.d.ts @@ -0,0 +1,9 @@ +import { BaseArgType } from "./types"; +/** + * A JavaScript array with 4 values, a Float32Array with 4 values, or a Float64Array with 4 values. + */ +export type Vec4Arg = BaseArgType; +/** + * A specific concrete 4 element vector. + */ +export type Vec4Type = T; diff --git a/dist/3.x/wgpu-matrix.d.ts b/dist/3.x/wgpu-matrix.d.ts new file mode 100644 index 0000000..6072c3a --- /dev/null +++ b/dist/3.x/wgpu-matrix.d.ts @@ -0,0 +1,847 @@ +import { BaseArgType } from './types'; +import { Mat3Arg, Mat3Type } from './mat3-impl'; +import { Mat4Arg, Mat4Type } from './mat4-impl'; +import { QuatArg, QuatType, RotationOrder } from './quat-impl'; +import { Vec2Arg, Vec2Type } from './vec2-impl'; +import { Vec3Arg, Vec3Type } from './vec3-impl'; +import { Vec4Arg, Vec4Type } from './vec4-impl'; +import * as utils from './utils'; +export { RotationOrder, utils, BaseArgType, Mat3Arg, Mat4Arg, QuatArg, Vec2Arg, Vec3Arg, Vec4Arg, Mat3Type, Mat4Type, QuatType, Vec2Type, Vec3Type, Vec4Type, }; +export type BaseCtor = new (n: number) => T; +export type Mat3 = Mat3Type; +export type Mat4 = Mat4Type; +export type Quat = QuatType; +export type Vec2 = Vec2Type; +export type Vec3 = Vec3Type; +export type Vec4 = Vec4Type; +export type Mat3d = Mat3Type; +export type Mat4d = Mat4Type; +export type Quatd = QuatType; +export type Vec2d = Vec2Type; +export type Vec3d = Vec3Type; +export type Vec4d = Vec4Type; +export type Mat3n = Mat3Type; +export type Mat4n = Mat4Type; +export type Quatn = QuatType; +export type Vec2n = Vec2Type; +export type Vec3n = Vec3Type; +export type Vec4n = Vec4Type; +export declare const +/** @namespace */ +mat4: { + create: (v0?: number | undefined, v1?: number | undefined, v2?: number | undefined, v3?: number | undefined, v4?: number | undefined, v5?: number | undefined, v6?: number | undefined, v7?: number | undefined, v8?: number | undefined, v9?: number | undefined, v10?: number | undefined, v11?: number | undefined, v12?: number | undefined, v13?: number | undefined, v14?: number | undefined, v15?: number | undefined) => Float32Array; + set: (v0: number, v1: number, v2: number, v3: number, v4: number, v5: number, v6: number, v7: number, v8: number, v9: number, v10: number, v11: number, v12: number, v13: number, v14: number, v15: number, dst?: T | undefined) => T; + fromMat3: (m3: BaseArgType, dst?: T_1 | undefined) => T_1; + fromQuat: (q: BaseArgType, dst?: T_2 | undefined) => T_2; + negate: (m: BaseArgType, dst?: T_3 | undefined) => T_3; + copy: (m: BaseArgType, dst?: T_4 | undefined) => T_4; + clone: (m: BaseArgType, dst?: T_4 | undefined) => T_4; + equalsApproximately: (a: BaseArgType, b: BaseArgType) => boolean; + equals: (a: BaseArgType, b: BaseArgType) => boolean; + identity: (dst?: T_5 | undefined) => T_5; + transpose: (m: BaseArgType, dst?: T_6 | undefined) => T_6; + inverse: (m: BaseArgType, dst?: T_7 | undefined) => T_7; + determinant: (m: BaseArgType) => number; + invert: (m: BaseArgType, dst?: T_7 | undefined) => T_7; + multiply: (a: BaseArgType, b: BaseArgType, dst?: T_8 | undefined) => T_8; + mul: (a: BaseArgType, b: BaseArgType, dst?: T_8 | undefined) => T_8; + setTranslation: (a: BaseArgType, v: BaseArgType, dst?: T_9 | undefined) => T_9; + getTranslation: (m: BaseArgType, dst?: T_10 | undefined) => T_10; + getAxis: (m: BaseArgType, axis: number, dst?: T_11 | undefined) => Float32Array | T_11; + setAxis: (m: BaseArgType, v: BaseArgType, axis: number, dst: T_12) => T_12; + getScaling: (m: BaseArgType, dst?: T_13 | undefined) => T_13; + perspective: (fieldOfViewYInRadians: number, aspect: number, zNear: number, zFar: number, dst?: T_14 | undefined) => T_14; + perspectiveReverseZ: (fieldOfViewYInRadians: number, aspect: number, zNear: number, zFar?: number, dst?: T_15 | undefined) => T_15; + ortho: (left: number, right: number, bottom: number, top: number, near: number, far: number, dst?: T_16 | undefined) => T_16; + frustum: (left: number, right: number, bottom: number, top: number, near: number, far: number, dst?: T_17 | undefined) => T_17; + frustumReverseZ: (left: number, right: number, bottom: number, top: number, near: number, far?: number, dst?: T_18 | undefined) => T_18; + aim: (position: BaseArgType, target: BaseArgType, up: BaseArgType, dst?: T_19 | undefined) => T_19; + cameraAim: (eye: BaseArgType, target: BaseArgType, up: BaseArgType, dst?: T_20 | undefined) => T_20; + lookAt: (eye: BaseArgType, target: BaseArgType, up: BaseArgType, dst?: T_21 | undefined) => T_21; + translation: (v: BaseArgType, dst?: T_22 | undefined) => T_22; + translate: (m: BaseArgType, v: BaseArgType, dst?: T_23 | undefined) => T_23; + rotationX: (angleInRadians: number, dst?: T_24 | undefined) => T_24; + rotateX: (m: BaseArgType, angleInRadians: number, dst?: T_25 | undefined) => T_25; + rotationY: (angleInRadians: number, dst?: T_26 | undefined) => T_26; + rotateY: (m: BaseArgType, angleInRadians: number, dst?: T_27 | undefined) => T_27; + rotationZ: (angleInRadians: number, dst?: T_28 | undefined) => T_28; + rotateZ: (m: BaseArgType, angleInRadians: number, dst?: T_29 | undefined) => T_29; + axisRotation: (axis: BaseArgType, angleInRadians: number, dst?: T_30 | undefined) => T_30; + rotation: (axis: BaseArgType, angleInRadians: number, dst?: T_30 | undefined) => T_30; + axisRotate: (m: BaseArgType, axis: BaseArgType, angleInRadians: number, dst?: T_31 | undefined) => T_31; + rotate: (m: BaseArgType, axis: BaseArgType, angleInRadians: number, dst?: T_31 | undefined) => T_31; + scaling: (v: BaseArgType, dst?: T_32 | undefined) => T_32; + scale: (m: BaseArgType, v: BaseArgType, dst?: T_33 | undefined) => T_33; + uniformScaling: (s: number, dst?: T_34 | undefined) => T_34; + uniformScale: (m: BaseArgType, s: number, dst?: T_35 | undefined) => T_35; +}, +/** @namespace */ +mat3: { + clone: (m: BaseArgType, dst?: T | undefined) => T; + create: (v0?: number | undefined, v1?: number | undefined, v2?: number | undefined, v3?: number | undefined, v4?: number | undefined, v5?: number | undefined, v6?: number | undefined, v7?: number | undefined, v8?: number | undefined) => Float32Array; + set: (v0: number, v1: number, v2: number, v3: number, v4: number, v5: number, v6: number, v7: number, v8: number, dst?: T_1 | undefined) => T_1; + fromMat4: (m4: BaseArgType, dst?: T_2 | undefined) => T_2; + fromQuat: (q: BaseArgType, dst?: T_3 | undefined) => T_3; + negate: (m: BaseArgType, dst?: T_4 | undefined) => T_4; + copy: (m: BaseArgType, dst?: T | undefined) => T; + equalsApproximately: (a: BaseArgType, b: BaseArgType) => boolean; + equals: (a: BaseArgType, b: BaseArgType) => boolean; + identity: (dst?: T_5 | undefined) => T_5; + transpose: (m: BaseArgType, dst?: T_6 | undefined) => T_6; + inverse: (m: BaseArgType, dst?: T_7 | undefined) => T_7; + invert: (m: BaseArgType, dst?: T_7 | undefined) => T_7; + determinant: (m: BaseArgType) => number; + mul: (a: BaseArgType, b: BaseArgType, dst?: T_8 | undefined) => T_8; + multiply: (a: BaseArgType, b: BaseArgType, dst?: T_8 | undefined) => T_8; + setTranslation: (a: BaseArgType, v: BaseArgType, dst?: T_9 | undefined) => T_9; + getTranslation: (m: BaseArgType, dst?: T_10 | undefined) => T_10; + getAxis: (m: BaseArgType, axis: number, dst?: T_11 | undefined) => T_11; + setAxis: (m: BaseArgType, v: BaseArgType, axis: number, dst?: T_12 | undefined) => T_12; + getScaling: (m: BaseArgType, dst?: T_13 | undefined) => Float32Array | T_13; + translation: (v: BaseArgType, dst?: T_14 | undefined) => T_14; + translate: (m: BaseArgType, v: BaseArgType, dst?: T_15 | undefined) => T_15; + rotation: (angleInRadians: number, dst?: T_16 | undefined) => T_16; + rotate: (m: BaseArgType, angleInRadians: number, dst?: T_17 | undefined) => T_17; + scaling: (v: BaseArgType, dst?: T_18 | undefined) => T_18; + scale: (m: BaseArgType, v: BaseArgType, dst?: T_19 | undefined) => T_19; + uniformScaling: (s: number, dst?: T_20 | undefined) => T_20; + uniformScale: (m: BaseArgType, s: number, dst?: T_21 | undefined) => T_21; +}, +/** @namespace */ +quat: { + create: (x?: number | undefined, y?: number | undefined, z?: number | undefined, w?: number | undefined) => Float32Array; + fromValues: (x?: number | undefined, y?: number | undefined, z?: number | undefined, w?: number | undefined) => Float32Array; + set: (x: number, y: number, z: number, w: number, dst?: T | undefined) => T; + fromAxisAngle: (axis: BaseArgType, angleInRadians: number, dst?: T_1 | undefined) => T_1; + toAxisAngle: (q: BaseArgType, dst?: T_2 | undefined) => { + angle: number; + axis: T_2; + }; + angle: (a: BaseArgType, b: BaseArgType) => number; + multiply: (a: BaseArgType, b: BaseArgType, dst?: T_3 | undefined) => T_3; + mul: (a: BaseArgType, b: BaseArgType, dst?: T_3 | undefined) => T_3; + rotateX: (q: BaseArgType, angleInRadians: number, dst?: T_4 | undefined) => T_4; + rotateY: (q: BaseArgType, angleInRadians: number, dst?: T_5 | undefined) => T_5; + rotateZ: (q: BaseArgType, angleInRadians: number, dst?: T_6 | undefined) => T_6; + slerp: (a: BaseArgType, b: BaseArgType, t: number, dst?: T_7 | undefined) => T_7; + inverse: (q: BaseArgType, dst?: T_8 | undefined) => T_8; + conjugate: (q: BaseArgType, dst?: T_9 | undefined) => T_9; + fromMat: (m: BaseArgType, dst?: T_10 | undefined) => T_10; + fromEuler: (xAngleInRadians: number, yAngleInRadians: number, zAngleInRadians: number, order: RotationOrder, dst?: T_11 | undefined) => T_11; + copy: (q: BaseArgType, dst?: T_12 | undefined) => T_12; + clone: (q: BaseArgType, dst?: T_12 | undefined) => T_12; + add: (a: BaseArgType, b: BaseArgType, dst?: T_13 | undefined) => T_13; + subtract: (a: BaseArgType, b: BaseArgType, dst?: T_14 | undefined) => T_14; + sub: (a: BaseArgType, b: BaseArgType, dst?: T_14 | undefined) => T_14; + mulScalar: (v: BaseArgType, k: number, dst?: T_15 | undefined) => T_15; + scale: (v: BaseArgType, k: number, dst?: T_15 | undefined) => T_15; + divScalar: (v: BaseArgType, k: number, dst?: T_16 | undefined) => T_16; + dot: (a: BaseArgType, b: BaseArgType) => number; + lerp: (a: BaseArgType, b: BaseArgType, t: number, dst?: T_17 | undefined) => T_17; + length: (v: BaseArgType) => number; + len: (v: BaseArgType) => number; + lengthSq: (v: BaseArgType) => number; + lenSq: (v: BaseArgType) => number; + normalize: (v: BaseArgType, dst?: T_18 | undefined) => T_18; + equalsApproximately: (a: BaseArgType, b: BaseArgType) => boolean; + equals: (a: BaseArgType, b: BaseArgType) => boolean; + identity: (dst?: T_19 | undefined) => T_19; + rotationTo: (aUnit: BaseArgType, bUnit: BaseArgType, dst?: T_20 | undefined) => T_20; + sqlerp: (a: BaseArgType, b: BaseArgType, c: BaseArgType, d: BaseArgType, t: number, dst?: T_21 | undefined) => T_21; +}, +/** @namespace */ +vec2: { + create: (x?: number, y?: number) => Float32Array; + fromValues: (x?: number, y?: number) => Float32Array; + set: (x: number, y: number, dst?: T | undefined) => T; + ceil: (v: BaseArgType, dst?: T_1 | undefined) => T_1; + floor: (v: BaseArgType, dst?: T_2 | undefined) => T_2; + round: (v: BaseArgType, dst?: T_3 | undefined) => T_3; + clamp: (v: BaseArgType, min?: number, max?: number, dst?: T_4 | undefined) => T_4; + add: (a: BaseArgType, b: BaseArgType, dst?: T_5 | undefined) => T_5; + addScaled: (a: BaseArgType, b: BaseArgType, scale: number, dst?: T_6 | undefined) => T_6; + angle: (a: BaseArgType, b: BaseArgType) => number; + subtract: (a: BaseArgType, b: BaseArgType, dst?: T_7 | undefined) => T_7; + sub: (a: BaseArgType, b: BaseArgType, dst?: T_7 | undefined) => T_7; + equalsApproximately: (a: BaseArgType, b: BaseArgType) => boolean; + equals: (a: BaseArgType, b: BaseArgType) => boolean; + lerp: (a: BaseArgType, b: BaseArgType, t: number, dst?: T_8 | undefined) => T_8; + lerpV: (a: BaseArgType, b: BaseArgType, t: BaseArgType, dst?: T_9 | undefined) => T_9; + max: (a: BaseArgType, b: BaseArgType, dst?: T_10 | undefined) => T_10; + min: (a: BaseArgType, b: BaseArgType, dst?: T_11 | undefined) => T_11; + mulScalar: (v: BaseArgType, k: number, dst?: T_12 | undefined) => T_12; + scale: (v: BaseArgType, k: number, dst?: T_12 | undefined) => T_12; + divScalar: (v: BaseArgType, k: number, dst?: T_13 | undefined) => T_13; + inverse: (v: BaseArgType, dst?: T_14 | undefined) => T_14; + invert: (v: BaseArgType, dst?: T_14 | undefined) => T_14; + cross: (a: BaseArgType, b: BaseArgType, dst?: T_15 | undefined) => T_15; + dot: (a: BaseArgType, b: BaseArgType) => number; + length: (v: BaseArgType) => number; + len: (v: BaseArgType) => number; + lengthSq: (v: BaseArgType) => number; + lenSq: (v: BaseArgType) => number; + distance: (a: BaseArgType, b: BaseArgType) => number; + dist: (a: BaseArgType, b: BaseArgType) => number; + distanceSq: (a: BaseArgType, b: BaseArgType) => number; + distSq: (a: BaseArgType, b: BaseArgType) => number; + normalize: (v: BaseArgType, dst?: T_16 | undefined) => T_16; + negate: (v: BaseArgType, dst?: T_17 | undefined) => T_17; + copy: (v: BaseArgType, dst?: T_18 | undefined) => T_18; + clone: (v: BaseArgType, dst?: T_18 | undefined) => T_18; + multiply: (a: BaseArgType, b: BaseArgType, dst?: T_19 | undefined) => T_19; + mul: (a: BaseArgType, b: BaseArgType, dst?: T_19 | undefined) => T_19; + divide: (a: BaseArgType, b: BaseArgType, dst?: T_20 | undefined) => T_20; + div: (a: BaseArgType, b: BaseArgType, dst?: T_20 | undefined) => T_20; + random: (scale?: number, dst?: T_21 | undefined) => T_21; + zero: (dst?: T_22 | undefined) => T_22; + transformMat4: (v: BaseArgType, m: BaseArgType, dst?: T_23 | undefined) => T_23; + transformMat3: (v: BaseArgType, m: BaseArgType, dst?: T_24 | undefined) => T_24; + rotate: (a: BaseArgType, b: BaseArgType, rad: number, dst?: T_25 | undefined) => T_25; + setLength: (a: BaseArgType, len: number, dst?: T_26 | undefined) => T_26; + truncate: (a: BaseArgType, maxLen: number, dst?: T_27 | undefined) => T_27; + midpoint: (a: BaseArgType, b: BaseArgType, dst?: T_28 | undefined) => T_28; +}, +/** @namespace */ +vec3: { + create: (x?: number | undefined, y?: number | undefined, z?: number | undefined) => Float32Array; + fromValues: (x?: number | undefined, y?: number | undefined, z?: number | undefined) => Float32Array; + set: (x: number, y: number, z: number, dst?: T | undefined) => T; + ceil: (v: BaseArgType, dst?: T_1 | undefined) => T_1; + floor: (v: BaseArgType, dst?: T_2 | undefined) => T_2; + round: (v: BaseArgType, dst?: T_3 | undefined) => T_3; + clamp: (v: BaseArgType, min?: number, max?: number, dst?: T_4 | undefined) => T_4; + add: (a: BaseArgType, b: BaseArgType, dst?: T_5 | undefined) => T_5; + addScaled: (a: BaseArgType, b: BaseArgType, scale: number, dst?: T_6 | undefined) => T_6; + angle: (a: BaseArgType, b: BaseArgType) => number; + subtract: (a: BaseArgType, b: BaseArgType, dst?: T_7 | undefined) => T_7; + sub: (a: BaseArgType, b: BaseArgType, dst?: T_7 | undefined) => T_7; + equalsApproximately: (a: BaseArgType, b: BaseArgType) => boolean; + equals: (a: BaseArgType, b: BaseArgType) => boolean; + lerp: (a: BaseArgType, b: BaseArgType, t: number, dst?: T_8 | undefined) => T_8; + lerpV: (a: BaseArgType, b: BaseArgType, t: BaseArgType, dst?: T_9 | undefined) => T_9; + max: (a: BaseArgType, b: BaseArgType, dst?: T_10 | undefined) => T_10; + min: (a: BaseArgType, b: BaseArgType, dst?: T_11 | undefined) => T_11; + mulScalar: (v: BaseArgType, k: number, dst?: T_12 | undefined) => T_12; + scale: (v: BaseArgType, k: number, dst?: T_12 | undefined) => T_12; + divScalar: (v: BaseArgType, k: number, dst?: T_13 | undefined) => T_13; + inverse: (v: BaseArgType, dst?: T_14 | undefined) => T_14; + invert: (v: BaseArgType, dst?: T_14 | undefined) => T_14; + cross: (a: BaseArgType, b: BaseArgType, dst?: T_15 | undefined) => T_15; + dot: (a: BaseArgType, b: BaseArgType) => number; + length: (v: BaseArgType) => number; + len: (v: BaseArgType) => number; + lengthSq: (v: BaseArgType) => number; + lenSq: (v: BaseArgType) => number; + distance: (a: BaseArgType, b: BaseArgType) => number; + dist: (a: BaseArgType, b: BaseArgType) => number; + distanceSq: (a: BaseArgType, b: BaseArgType) => number; + distSq: (a: BaseArgType, b: BaseArgType) => number; + normalize: (v: BaseArgType, dst?: T_16 | undefined) => T_16; + negate: (v: BaseArgType, dst?: T_17 | undefined) => T_17; + copy: (v: BaseArgType, dst?: T_18 | undefined) => T_18; + clone: (v: BaseArgType, dst?: T_18 | undefined) => T_18; + multiply: (a: BaseArgType, b: BaseArgType, dst?: T_19 | undefined) => T_19; + mul: (a: BaseArgType, b: BaseArgType, dst?: T_19 | undefined) => T_19; + divide: (a: BaseArgType, b: BaseArgType, dst?: T_20 | undefined) => T_20; + div: (a: BaseArgType, b: BaseArgType, dst?: T_20 | undefined) => T_20; + random: (scale?: number, dst?: T_21 | undefined) => T_21; + zero: (dst?: T_22 | undefined) => T_22; + transformMat4: (v: BaseArgType, m: BaseArgType, dst?: T_23 | undefined) => T_23; + transformMat4Upper3x3: (v: BaseArgType, m: BaseArgType, dst?: T_24 | undefined) => T_24; + transformMat3: (v: BaseArgType, m: BaseArgType, dst?: T_25 | undefined) => T_25; + transformQuat: (v: BaseArgType, q: BaseArgType, dst?: T_26 | undefined) => T_26; + getTranslation: (m: BaseArgType, dst?: T_27 | undefined) => T_27; + getAxis: (m: BaseArgType, axis: number, dst?: T_28 | undefined) => T_28; + getScaling: (m: BaseArgType, dst?: T_29 | undefined) => T_29; + rotateX: (a: BaseArgType, b: BaseArgType, rad: number, dst?: T_30 | undefined) => T_30; + rotateY: (a: BaseArgType, b: BaseArgType, rad: number, dst?: T_31 | undefined) => T_31; + rotateZ: (a: BaseArgType, b: BaseArgType, rad: number, dst?: T_32 | undefined) => T_32; + setLength: (a: BaseArgType, len: number, dst?: T_33 | undefined) => T_33; + truncate: (a: BaseArgType, maxLen: number, dst?: T_34 | undefined) => T_34; + midpoint: (a: BaseArgType, b: BaseArgType, dst?: T_35 | undefined) => T_35; +}, +/** @namespace */ +vec4: { + create: (x?: number | undefined, y?: number | undefined, z?: number | undefined, w?: number | undefined) => Float32Array; + fromValues: (x?: number | undefined, y?: number | undefined, z?: number | undefined, w?: number | undefined) => Float32Array; + set: (x: number, y: number, z: number, w: number, dst?: T | undefined) => T; + ceil: (v: BaseArgType, dst?: T_1 | undefined) => T_1; + floor: (v: BaseArgType, dst?: T_2 | undefined) => T_2; + round: (v: BaseArgType, dst?: T_3 | undefined) => T_3; + clamp: (v: BaseArgType, min?: number, max?: number, dst?: T_4 | undefined) => T_4; + add: (a: BaseArgType, b: BaseArgType, dst?: T_5 | undefined) => T_5; + addScaled: (a: BaseArgType, b: BaseArgType, scale: number, dst?: T_6 | undefined) => T_6; + subtract: (a: BaseArgType, b: BaseArgType, dst?: T_7 | undefined) => T_7; + sub: (a: BaseArgType, b: BaseArgType, dst?: T_7 | undefined) => T_7; + equalsApproximately: (a: BaseArgType, b: BaseArgType) => boolean; + equals: (a: BaseArgType, b: BaseArgType) => boolean; + lerp: (a: BaseArgType, b: BaseArgType, t: number, dst?: T_8 | undefined) => T_8; + lerpV: (a: BaseArgType, b: BaseArgType, t: BaseArgType, dst?: T_9 | undefined) => T_9; + max: (a: BaseArgType, b: BaseArgType, dst?: T_10 | undefined) => T_10; + min: (a: BaseArgType, b: BaseArgType, dst?: T_11 | undefined) => T_11; + mulScalar: (v: BaseArgType, k: number, dst?: T_12 | undefined) => T_12; + scale: (v: BaseArgType, k: number, dst?: T_12 | undefined) => T_12; + divScalar: (v: BaseArgType, k: number, dst?: T_13 | undefined) => T_13; + inverse: (v: BaseArgType, dst?: T_14 | undefined) => T_14; + invert: (v: BaseArgType, dst?: T_14 | undefined) => T_14; + dot: (a: BaseArgType, b: BaseArgType) => number; + length: (v: BaseArgType) => number; + len: (v: BaseArgType) => number; + lengthSq: (v: BaseArgType) => number; + lenSq: (v: BaseArgType) => number; + distance: (a: BaseArgType, b: BaseArgType) => number; + dist: (a: BaseArgType, b: BaseArgType) => number; + distanceSq: (a: BaseArgType, b: BaseArgType) => number; + distSq: (a: BaseArgType, b: BaseArgType) => number; + normalize: (v: BaseArgType, dst?: T_15 | undefined) => T_15; + negate: (v: BaseArgType, dst?: T_16 | undefined) => T_16; + copy: (v: BaseArgType, dst?: T_17 | undefined) => T_17; + clone: (v: BaseArgType, dst?: T_17 | undefined) => T_17; + multiply: (a: BaseArgType, b: BaseArgType, dst?: T_18 | undefined) => T_18; + mul: (a: BaseArgType, b: BaseArgType, dst?: T_18 | undefined) => T_18; + divide: (a: BaseArgType, b: BaseArgType, dst?: T_19 | undefined) => T_19; + div: (a: BaseArgType, b: BaseArgType, dst?: T_19 | undefined) => T_19; + zero: (dst?: T_20 | undefined) => T_20; + transformMat4: (v: BaseArgType, m: BaseArgType, dst?: T_21 | undefined) => T_21; + setLength: (a: BaseArgType, len: number, dst?: T_22 | undefined) => T_22; + truncate: (a: BaseArgType, maxLen: number, dst?: T_23 | undefined) => T_23; + midpoint: (a: BaseArgType, b: BaseArgType, dst?: T_24 | undefined) => T_24; +}; +export declare const mat4d: { + create: (v0?: number | undefined, v1?: number | undefined, v2?: number | undefined, v3?: number | undefined, v4?: number | undefined, v5?: number | undefined, v6?: number | undefined, v7?: number | undefined, v8?: number | undefined, v9?: number | undefined, v10?: number | undefined, v11?: number | undefined, v12?: number | undefined, v13?: number | undefined, v14?: number | undefined, v15?: number | undefined) => Float64Array; + set: (v0: number, v1: number, v2: number, v3: number, v4: number, v5: number, v6: number, v7: number, v8: number, v9: number, v10: number, v11: number, v12: number, v13: number, v14: number, v15: number, dst?: T | undefined) => T; + fromMat3: (m3: BaseArgType, dst?: T_1 | undefined) => T_1; + fromQuat: (q: BaseArgType, dst?: T_2 | undefined) => T_2; + negate: (m: BaseArgType, dst?: T_3 | undefined) => T_3; + copy: (m: BaseArgType, dst?: T_4 | undefined) => T_4; + clone: (m: BaseArgType, dst?: T_4 | undefined) => T_4; + equalsApproximately: (a: BaseArgType, b: BaseArgType) => boolean; + equals: (a: BaseArgType, b: BaseArgType) => boolean; + identity: (dst?: T_5 | undefined) => T_5; + transpose: (m: BaseArgType, dst?: T_6 | undefined) => T_6; + inverse: (m: BaseArgType, dst?: T_7 | undefined) => T_7; + determinant: (m: BaseArgType) => number; + invert: (m: BaseArgType, dst?: T_7 | undefined) => T_7; + multiply: (a: BaseArgType, b: BaseArgType, dst?: T_8 | undefined) => T_8; + mul: (a: BaseArgType, b: BaseArgType, dst?: T_8 | undefined) => T_8; + setTranslation: (a: BaseArgType, v: BaseArgType, dst?: T_9 | undefined) => T_9; + getTranslation: (m: BaseArgType, dst?: T_10 | undefined) => T_10; + getAxis: (m: BaseArgType, axis: number, dst?: T_11 | undefined) => Float64Array | T_11; + setAxis: (m: BaseArgType, v: BaseArgType, axis: number, dst: T_12) => T_12; + getScaling: (m: BaseArgType, dst?: T_13 | undefined) => T_13; + perspective: (fieldOfViewYInRadians: number, aspect: number, zNear: number, zFar: number, dst?: T_14 | undefined) => T_14; + perspectiveReverseZ: (fieldOfViewYInRadians: number, aspect: number, zNear: number, zFar?: number, dst?: T_15 | undefined) => T_15; + ortho: (left: number, right: number, bottom: number, top: number, near: number, far: number, dst?: T_16 | undefined) => T_16; + frustum: (left: number, right: number, bottom: number, top: number, near: number, far: number, dst?: T_17 | undefined) => T_17; + frustumReverseZ: (left: number, right: number, bottom: number, top: number, near: number, far?: number, dst?: T_18 | undefined) => T_18; + aim: (position: BaseArgType, target: BaseArgType, up: BaseArgType, dst?: T_19 | undefined) => T_19; + cameraAim: (eye: BaseArgType, target: BaseArgType, up: BaseArgType, dst?: T_20 | undefined) => T_20; + lookAt: (eye: BaseArgType, target: BaseArgType, up: BaseArgType, dst?: T_21 | undefined) => T_21; + translation: (v: BaseArgType, dst?: T_22 | undefined) => T_22; + translate: (m: BaseArgType, v: BaseArgType, dst?: T_23 | undefined) => T_23; + rotationX: (angleInRadians: number, dst?: T_24 | undefined) => T_24; + rotateX: (m: BaseArgType, angleInRadians: number, dst?: T_25 | undefined) => T_25; + rotationY: (angleInRadians: number, dst?: T_26 | undefined) => T_26; + rotateY: (m: BaseArgType, angleInRadians: number, dst?: T_27 | undefined) => T_27; + rotationZ: (angleInRadians: number, dst?: T_28 | undefined) => T_28; + rotateZ: (m: BaseArgType, angleInRadians: number, dst?: T_29 | undefined) => T_29; + axisRotation: (axis: BaseArgType, angleInRadians: number, dst?: T_30 | undefined) => T_30; + rotation: (axis: BaseArgType, angleInRadians: number, dst?: T_30 | undefined) => T_30; + axisRotate: (m: BaseArgType, axis: BaseArgType, angleInRadians: number, dst?: T_31 | undefined) => T_31; + rotate: (m: BaseArgType, axis: BaseArgType, angleInRadians: number, dst?: T_31 | undefined) => T_31; + scaling: (v: BaseArgType, dst?: T_32 | undefined) => T_32; + scale: (m: BaseArgType, v: BaseArgType, dst?: T_33 | undefined) => T_33; + uniformScaling: (s: number, dst?: T_34 | undefined) => T_34; + uniformScale: (m: BaseArgType, s: number, dst?: T_35 | undefined) => T_35; +}, mat3d: { + clone: (m: BaseArgType, dst?: T | undefined) => T; + create: (v0?: number | undefined, v1?: number | undefined, v2?: number | undefined, v3?: number | undefined, v4?: number | undefined, v5?: number | undefined, v6?: number | undefined, v7?: number | undefined, v8?: number | undefined) => Float64Array; + set: (v0: number, v1: number, v2: number, v3: number, v4: number, v5: number, v6: number, v7: number, v8: number, dst?: T_1 | undefined) => T_1; + fromMat4: (m4: BaseArgType, dst?: T_2 | undefined) => T_2; + fromQuat: (q: BaseArgType, dst?: T_3 | undefined) => T_3; + negate: (m: BaseArgType, dst?: T_4 | undefined) => T_4; + copy: (m: BaseArgType, dst?: T | undefined) => T; + equalsApproximately: (a: BaseArgType, b: BaseArgType) => boolean; + equals: (a: BaseArgType, b: BaseArgType) => boolean; + identity: (dst?: T_5 | undefined) => T_5; + transpose: (m: BaseArgType, dst?: T_6 | undefined) => T_6; + inverse: (m: BaseArgType, dst?: T_7 | undefined) => T_7; + invert: (m: BaseArgType, dst?: T_7 | undefined) => T_7; + determinant: (m: BaseArgType) => number; + mul: (a: BaseArgType, b: BaseArgType, dst?: T_8 | undefined) => T_8; + multiply: (a: BaseArgType, b: BaseArgType, dst?: T_8 | undefined) => T_8; + setTranslation: (a: BaseArgType, v: BaseArgType, dst?: T_9 | undefined) => T_9; + getTranslation: (m: BaseArgType, dst?: T_10 | undefined) => T_10; + getAxis: (m: BaseArgType, axis: number, dst?: T_11 | undefined) => T_11; + setAxis: (m: BaseArgType, v: BaseArgType, axis: number, dst?: T_12 | undefined) => T_12; + getScaling: (m: BaseArgType, dst?: T_13 | undefined) => Float64Array | T_13; + translation: (v: BaseArgType, dst?: T_14 | undefined) => T_14; + translate: (m: BaseArgType, v: BaseArgType, dst?: T_15 | undefined) => T_15; + rotation: (angleInRadians: number, dst?: T_16 | undefined) => T_16; + rotate: (m: BaseArgType, angleInRadians: number, dst?: T_17 | undefined) => T_17; + scaling: (v: BaseArgType, dst?: T_18 | undefined) => T_18; + scale: (m: BaseArgType, v: BaseArgType, dst?: T_19 | undefined) => T_19; + uniformScaling: (s: number, dst?: T_20 | undefined) => T_20; + uniformScale: (m: BaseArgType, s: number, dst?: T_21 | undefined) => T_21; +}, quatd: { + create: (x?: number | undefined, y?: number | undefined, z?: number | undefined, w?: number | undefined) => Float64Array; + fromValues: (x?: number | undefined, y?: number | undefined, z?: number | undefined, w?: number | undefined) => Float64Array; + set: (x: number, y: number, z: number, w: number, dst?: T | undefined) => T; + fromAxisAngle: (axis: BaseArgType, angleInRadians: number, dst?: T_1 | undefined) => T_1; + toAxisAngle: (q: BaseArgType, dst?: T_2 | undefined) => { + angle: number; + axis: T_2; + }; + angle: (a: BaseArgType, b: BaseArgType) => number; + multiply: (a: BaseArgType, b: BaseArgType, dst?: T_3 | undefined) => T_3; + mul: (a: BaseArgType, b: BaseArgType, dst?: T_3 | undefined) => T_3; + rotateX: (q: BaseArgType, angleInRadians: number, dst?: T_4 | undefined) => T_4; + rotateY: (q: BaseArgType, angleInRadians: number, dst?: T_5 | undefined) => T_5; + rotateZ: (q: BaseArgType, angleInRadians: number, dst?: T_6 | undefined) => T_6; + slerp: (a: BaseArgType, b: BaseArgType, t: number, dst?: T_7 | undefined) => T_7; + inverse: (q: BaseArgType, dst?: T_8 | undefined) => T_8; + conjugate: (q: BaseArgType, dst?: T_9 | undefined) => T_9; + fromMat: (m: BaseArgType, dst?: T_10 | undefined) => T_10; + fromEuler: (xAngleInRadians: number, yAngleInRadians: number, zAngleInRadians: number, order: RotationOrder, dst?: T_11 | undefined) => T_11; + copy: (q: BaseArgType, dst?: T_12 | undefined) => T_12; + clone: (q: BaseArgType, dst?: T_12 | undefined) => T_12; + add: (a: BaseArgType, b: BaseArgType, dst?: T_13 | undefined) => T_13; + subtract: (a: BaseArgType, b: BaseArgType, dst?: T_14 | undefined) => T_14; + sub: (a: BaseArgType, b: BaseArgType, dst?: T_14 | undefined) => T_14; + mulScalar: (v: BaseArgType, k: number, dst?: T_15 | undefined) => T_15; + scale: (v: BaseArgType, k: number, dst?: T_15 | undefined) => T_15; + divScalar: (v: BaseArgType, k: number, dst?: T_16 | undefined) => T_16; + dot: (a: BaseArgType, b: BaseArgType) => number; + lerp: (a: BaseArgType, b: BaseArgType, t: number, dst?: T_17 | undefined) => T_17; + length: (v: BaseArgType) => number; + len: (v: BaseArgType) => number; + lengthSq: (v: BaseArgType) => number; + lenSq: (v: BaseArgType) => number; + normalize: (v: BaseArgType, dst?: T_18 | undefined) => T_18; + equalsApproximately: (a: BaseArgType, b: BaseArgType) => boolean; + equals: (a: BaseArgType, b: BaseArgType) => boolean; + identity: (dst?: T_19 | undefined) => T_19; + rotationTo: (aUnit: BaseArgType, bUnit: BaseArgType, dst?: T_20 | undefined) => T_20; + sqlerp: (a: BaseArgType, b: BaseArgType, c: BaseArgType, d: BaseArgType, t: number, dst?: T_21 | undefined) => T_21; +}, vec2d: { + create: (x?: number, y?: number) => Float64Array; + fromValues: (x?: number, y?: number) => Float64Array; + set: (x: number, y: number, dst?: T | undefined) => T; + ceil: (v: BaseArgType, dst?: T_1 | undefined) => T_1; + floor: (v: BaseArgType, dst?: T_2 | undefined) => T_2; + round: (v: BaseArgType, dst?: T_3 | undefined) => T_3; + clamp: (v: BaseArgType, min?: number, max?: number, dst?: T_4 | undefined) => T_4; + add: (a: BaseArgType, b: BaseArgType, dst?: T_5 | undefined) => T_5; + addScaled: (a: BaseArgType, b: BaseArgType, scale: number, dst?: T_6 | undefined) => T_6; + angle: (a: BaseArgType, b: BaseArgType) => number; + subtract: (a: BaseArgType, b: BaseArgType, dst?: T_7 | undefined) => T_7; + sub: (a: BaseArgType, b: BaseArgType, dst?: T_7 | undefined) => T_7; + equalsApproximately: (a: BaseArgType, b: BaseArgType) => boolean; + equals: (a: BaseArgType, b: BaseArgType) => boolean; + lerp: (a: BaseArgType, b: BaseArgType, t: number, dst?: T_8 | undefined) => T_8; + lerpV: (a: BaseArgType, b: BaseArgType, t: BaseArgType, dst?: T_9 | undefined) => T_9; + max: (a: BaseArgType, b: BaseArgType, dst?: T_10 | undefined) => T_10; + min: (a: BaseArgType, b: BaseArgType, dst?: T_11 | undefined) => T_11; + mulScalar: (v: BaseArgType, k: number, dst?: T_12 | undefined) => T_12; + scale: (v: BaseArgType, k: number, dst?: T_12 | undefined) => T_12; + divScalar: (v: BaseArgType, k: number, dst?: T_13 | undefined) => T_13; + inverse: (v: BaseArgType, dst?: T_14 | undefined) => T_14; + invert: (v: BaseArgType, dst?: T_14 | undefined) => T_14; + cross: (a: BaseArgType, b: BaseArgType, dst?: T_15 | undefined) => T_15; + dot: (a: BaseArgType, b: BaseArgType) => number; + length: (v: BaseArgType) => number; + len: (v: BaseArgType) => number; + lengthSq: (v: BaseArgType) => number; + lenSq: (v: BaseArgType) => number; + distance: (a: BaseArgType, b: BaseArgType) => number; + dist: (a: BaseArgType, b: BaseArgType) => number; + distanceSq: (a: BaseArgType, b: BaseArgType) => number; + distSq: (a: BaseArgType, b: BaseArgType) => number; + normalize: (v: BaseArgType, dst?: T_16 | undefined) => T_16; + negate: (v: BaseArgType, dst?: T_17 | undefined) => T_17; + copy: (v: BaseArgType, dst?: T_18 | undefined) => T_18; + clone: (v: BaseArgType, dst?: T_18 | undefined) => T_18; + multiply: (a: BaseArgType, b: BaseArgType, dst?: T_19 | undefined) => T_19; + mul: (a: BaseArgType, b: BaseArgType, dst?: T_19 | undefined) => T_19; + divide: (a: BaseArgType, b: BaseArgType, dst?: T_20 | undefined) => T_20; + div: (a: BaseArgType, b: BaseArgType, dst?: T_20 | undefined) => T_20; + random: (scale?: number, dst?: T_21 | undefined) => T_21; + zero: (dst?: T_22 | undefined) => T_22; + transformMat4: (v: BaseArgType, m: BaseArgType, dst?: T_23 | undefined) => T_23; + transformMat3: (v: BaseArgType, m: BaseArgType, dst?: T_24 | undefined) => T_24; + rotate: (a: BaseArgType, b: BaseArgType, rad: number, dst?: T_25 | undefined) => T_25; + setLength: (a: BaseArgType, len: number, dst?: T_26 | undefined) => T_26; + truncate: (a: BaseArgType, maxLen: number, dst?: T_27 | undefined) => T_27; + midpoint: (a: BaseArgType, b: BaseArgType, dst?: T_28 | undefined) => T_28; +}, vec3d: { + create: (x?: number | undefined, y?: number | undefined, z?: number | undefined) => Float64Array; + fromValues: (x?: number | undefined, y?: number | undefined, z?: number | undefined) => Float64Array; + set: (x: number, y: number, z: number, dst?: T | undefined) => T; + ceil: (v: BaseArgType, dst?: T_1 | undefined) => T_1; + floor: (v: BaseArgType, dst?: T_2 | undefined) => T_2; + round: (v: BaseArgType, dst?: T_3 | undefined) => T_3; + clamp: (v: BaseArgType, min?: number, max?: number, dst?: T_4 | undefined) => T_4; + add: (a: BaseArgType, b: BaseArgType, dst?: T_5 | undefined) => T_5; + addScaled: (a: BaseArgType, b: BaseArgType, scale: number, dst?: T_6 | undefined) => T_6; + angle: (a: BaseArgType, b: BaseArgType) => number; + subtract: (a: BaseArgType, b: BaseArgType, dst?: T_7 | undefined) => T_7; + sub: (a: BaseArgType, b: BaseArgType, dst?: T_7 | undefined) => T_7; + equalsApproximately: (a: BaseArgType, b: BaseArgType) => boolean; + equals: (a: BaseArgType, b: BaseArgType) => boolean; + lerp: (a: BaseArgType, b: BaseArgType, t: number, dst?: T_8 | undefined) => T_8; + lerpV: (a: BaseArgType, b: BaseArgType, t: BaseArgType, dst?: T_9 | undefined) => T_9; + max: (a: BaseArgType, b: BaseArgType, dst?: T_10 | undefined) => T_10; + min: (a: BaseArgType, b: BaseArgType, dst?: T_11 | undefined) => T_11; + mulScalar: (v: BaseArgType, k: number, dst?: T_12 | undefined) => T_12; + scale: (v: BaseArgType, k: number, dst?: T_12 | undefined) => T_12; + divScalar: (v: BaseArgType, k: number, dst?: T_13 | undefined) => T_13; + inverse: (v: BaseArgType, dst?: T_14 | undefined) => T_14; + invert: (v: BaseArgType, dst?: T_14 | undefined) => T_14; + cross: (a: BaseArgType, b: BaseArgType, dst?: T_15 | undefined) => T_15; + dot: (a: BaseArgType, b: BaseArgType) => number; + length: (v: BaseArgType) => number; + len: (v: BaseArgType) => number; + lengthSq: (v: BaseArgType) => number; + lenSq: (v: BaseArgType) => number; + distance: (a: BaseArgType, b: BaseArgType) => number; + dist: (a: BaseArgType, b: BaseArgType) => number; + distanceSq: (a: BaseArgType, b: BaseArgType) => number; + distSq: (a: BaseArgType, b: BaseArgType) => number; + normalize: (v: BaseArgType, dst?: T_16 | undefined) => T_16; + negate: (v: BaseArgType, dst?: T_17 | undefined) => T_17; + copy: (v: BaseArgType, dst?: T_18 | undefined) => T_18; + clone: (v: BaseArgType, dst?: T_18 | undefined) => T_18; + multiply: (a: BaseArgType, b: BaseArgType, dst?: T_19 | undefined) => T_19; + mul: (a: BaseArgType, b: BaseArgType, dst?: T_19 | undefined) => T_19; + divide: (a: BaseArgType, b: BaseArgType, dst?: T_20 | undefined) => T_20; + div: (a: BaseArgType, b: BaseArgType, dst?: T_20 | undefined) => T_20; + random: (scale?: number, dst?: T_21 | undefined) => T_21; + zero: (dst?: T_22 | undefined) => T_22; + transformMat4: (v: BaseArgType, m: BaseArgType, dst?: T_23 | undefined) => T_23; + transformMat4Upper3x3: (v: BaseArgType, m: BaseArgType, dst?: T_24 | undefined) => T_24; + transformMat3: (v: BaseArgType, m: BaseArgType, dst?: T_25 | undefined) => T_25; + transformQuat: (v: BaseArgType, q: BaseArgType, dst?: T_26 | undefined) => T_26; + getTranslation: (m: BaseArgType, dst?: T_27 | undefined) => T_27; + getAxis: (m: BaseArgType, axis: number, dst?: T_28 | undefined) => T_28; + getScaling: (m: BaseArgType, dst?: T_29 | undefined) => T_29; + rotateX: (a: BaseArgType, b: BaseArgType, rad: number, dst?: T_30 | undefined) => T_30; + rotateY: (a: BaseArgType, b: BaseArgType, rad: number, dst?: T_31 | undefined) => T_31; + rotateZ: (a: BaseArgType, b: BaseArgType, rad: number, dst?: T_32 | undefined) => T_32; + setLength: (a: BaseArgType, len: number, dst?: T_33 | undefined) => T_33; + truncate: (a: BaseArgType, maxLen: number, dst?: T_34 | undefined) => T_34; + midpoint: (a: BaseArgType, b: BaseArgType, dst?: T_35 | undefined) => T_35; +}, vec4d: { + create: (x?: number | undefined, y?: number | undefined, z?: number | undefined, w?: number | undefined) => Float64Array; + fromValues: (x?: number | undefined, y?: number | undefined, z?: number | undefined, w?: number | undefined) => Float64Array; + set: (x: number, y: number, z: number, w: number, dst?: T | undefined) => T; + ceil: (v: BaseArgType, dst?: T_1 | undefined) => T_1; + floor: (v: BaseArgType, dst?: T_2 | undefined) => T_2; + round: (v: BaseArgType, dst?: T_3 | undefined) => T_3; + clamp: (v: BaseArgType, min?: number, max?: number, dst?: T_4 | undefined) => T_4; + add: (a: BaseArgType, b: BaseArgType, dst?: T_5 | undefined) => T_5; + addScaled: (a: BaseArgType, b: BaseArgType, scale: number, dst?: T_6 | undefined) => T_6; + subtract: (a: BaseArgType, b: BaseArgType, dst?: T_7 | undefined) => T_7; + sub: (a: BaseArgType, b: BaseArgType, dst?: T_7 | undefined) => T_7; + equalsApproximately: (a: BaseArgType, b: BaseArgType) => boolean; + equals: (a: BaseArgType, b: BaseArgType) => boolean; + lerp: (a: BaseArgType, b: BaseArgType, t: number, dst?: T_8 | undefined) => T_8; + lerpV: (a: BaseArgType, b: BaseArgType, t: BaseArgType, dst?: T_9 | undefined) => T_9; + max: (a: BaseArgType, b: BaseArgType, dst?: T_10 | undefined) => T_10; + min: (a: BaseArgType, b: BaseArgType, dst?: T_11 | undefined) => T_11; + mulScalar: (v: BaseArgType, k: number, dst?: T_12 | undefined) => T_12; + scale: (v: BaseArgType, k: number, dst?: T_12 | undefined) => T_12; + divScalar: (v: BaseArgType, k: number, dst?: T_13 | undefined) => T_13; + inverse: (v: BaseArgType, dst?: T_14 | undefined) => T_14; + invert: (v: BaseArgType, dst?: T_14 | undefined) => T_14; + dot: (a: BaseArgType, b: BaseArgType) => number; + length: (v: BaseArgType) => number; + len: (v: BaseArgType) => number; + lengthSq: (v: BaseArgType) => number; + lenSq: (v: BaseArgType) => number; + distance: (a: BaseArgType, b: BaseArgType) => number; + dist: (a: BaseArgType, b: BaseArgType) => number; + distanceSq: (a: BaseArgType, b: BaseArgType) => number; + distSq: (a: BaseArgType, b: BaseArgType) => number; + normalize: (v: BaseArgType, dst?: T_15 | undefined) => T_15; + negate: (v: BaseArgType, dst?: T_16 | undefined) => T_16; + copy: (v: BaseArgType, dst?: T_17 | undefined) => T_17; + clone: (v: BaseArgType, dst?: T_17 | undefined) => T_17; + multiply: (a: BaseArgType, b: BaseArgType, dst?: T_18 | undefined) => T_18; + mul: (a: BaseArgType, b: BaseArgType, dst?: T_18 | undefined) => T_18; + divide: (a: BaseArgType, b: BaseArgType, dst?: T_19 | undefined) => T_19; + div: (a: BaseArgType, b: BaseArgType, dst?: T_19 | undefined) => T_19; + zero: (dst?: T_20 | undefined) => T_20; + transformMat4: (v: BaseArgType, m: BaseArgType, dst?: T_21 | undefined) => T_21; + setLength: (a: BaseArgType, len: number, dst?: T_22 | undefined) => T_22; + truncate: (a: BaseArgType, maxLen: number, dst?: T_23 | undefined) => T_23; + midpoint: (a: BaseArgType, b: BaseArgType, dst?: T_24 | undefined) => T_24; +}; +export declare const mat4n: { + create: (v0?: number | undefined, v1?: number | undefined, v2?: number | undefined, v3?: number | undefined, v4?: number | undefined, v5?: number | undefined, v6?: number | undefined, v7?: number | undefined, v8?: number | undefined, v9?: number | undefined, v10?: number | undefined, v11?: number | undefined, v12?: number | undefined, v13?: number | undefined, v14?: number | undefined, v15?: number | undefined) => number[]; + set: (v0: number, v1: number, v2: number, v3: number, v4: number, v5: number, v6: number, v7: number, v8: number, v9: number, v10: number, v11: number, v12: number, v13: number, v14: number, v15: number, dst?: T | undefined) => T; + fromMat3: (m3: BaseArgType, dst?: T_1 | undefined) => T_1; + fromQuat: (q: BaseArgType, dst?: T_2 | undefined) => T_2; + negate: (m: BaseArgType, dst?: T_3 | undefined) => T_3; + copy: (m: BaseArgType, dst?: T_4 | undefined) => T_4; + clone: (m: BaseArgType, dst?: T_4 | undefined) => T_4; + equalsApproximately: (a: BaseArgType, b: BaseArgType) => boolean; + equals: (a: BaseArgType, b: BaseArgType) => boolean; + identity: (dst?: T_5 | undefined) => T_5; + transpose: (m: BaseArgType, dst?: T_6 | undefined) => T_6; + inverse: (m: BaseArgType, dst?: T_7 | undefined) => T_7; + determinant: (m: BaseArgType) => number; + invert: (m: BaseArgType, dst?: T_7 | undefined) => T_7; + multiply: (a: BaseArgType, b: BaseArgType, dst?: T_8 | undefined) => T_8; + mul: (a: BaseArgType, b: BaseArgType, dst?: T_8 | undefined) => T_8; + setTranslation: (a: BaseArgType, v: BaseArgType, dst?: T_9 | undefined) => T_9; + getTranslation: (m: BaseArgType, dst?: T_10 | undefined) => T_10; + getAxis: (m: BaseArgType, axis: number, dst?: T_11 | undefined) => number[] | T_11; + setAxis: (m: BaseArgType, v: BaseArgType, axis: number, dst: T_12) => T_12; + getScaling: (m: BaseArgType, dst?: T_13 | undefined) => T_13; + perspective: (fieldOfViewYInRadians: number, aspect: number, zNear: number, zFar: number, dst?: T_14 | undefined) => T_14; + perspectiveReverseZ: (fieldOfViewYInRadians: number, aspect: number, zNear: number, zFar?: number, dst?: T_15 | undefined) => T_15; + ortho: (left: number, right: number, bottom: number, top: number, near: number, far: number, dst?: T_16 | undefined) => T_16; + frustum: (left: number, right: number, bottom: number, top: number, near: number, far: number, dst?: T_17 | undefined) => T_17; + frustumReverseZ: (left: number, right: number, bottom: number, top: number, near: number, far?: number, dst?: T_18 | undefined) => T_18; + aim: (position: BaseArgType, target: BaseArgType, up: BaseArgType, dst?: T_19 | undefined) => T_19; + cameraAim: (eye: BaseArgType, target: BaseArgType, up: BaseArgType, dst?: T_20 | undefined) => T_20; + lookAt: (eye: BaseArgType, target: BaseArgType, up: BaseArgType, dst?: T_21 | undefined) => T_21; + translation: (v: BaseArgType, dst?: T_22 | undefined) => T_22; + translate: (m: BaseArgType, v: BaseArgType, dst?: T_23 | undefined) => T_23; + rotationX: (angleInRadians: number, dst?: T_24 | undefined) => T_24; + rotateX: (m: BaseArgType, angleInRadians: number, dst?: T_25 | undefined) => T_25; + rotationY: (angleInRadians: number, dst?: T_26 | undefined) => T_26; + rotateY: (m: BaseArgType, angleInRadians: number, dst?: T_27 | undefined) => T_27; + rotationZ: (angleInRadians: number, dst?: T_28 | undefined) => T_28; + rotateZ: (m: BaseArgType, angleInRadians: number, dst?: T_29 | undefined) => T_29; + axisRotation: (axis: BaseArgType, angleInRadians: number, dst?: T_30 | undefined) => T_30; + rotation: (axis: BaseArgType, angleInRadians: number, dst?: T_30 | undefined) => T_30; + axisRotate: (m: BaseArgType, axis: BaseArgType, angleInRadians: number, dst?: T_31 | undefined) => T_31; + rotate: (m: BaseArgType, axis: BaseArgType, angleInRadians: number, dst?: T_31 | undefined) => T_31; + scaling: (v: BaseArgType, dst?: T_32 | undefined) => T_32; + scale: (m: BaseArgType, v: BaseArgType, dst?: T_33 | undefined) => T_33; + uniformScaling: (s: number, dst?: T_34 | undefined) => T_34; + uniformScale: (m: BaseArgType, s: number, dst?: T_35 | undefined) => T_35; +}, mat3n: { + clone: (m: BaseArgType, dst?: T | undefined) => T; + create: (v0?: number | undefined, v1?: number | undefined, v2?: number | undefined, v3?: number | undefined, v4?: number | undefined, v5?: number | undefined, v6?: number | undefined, v7?: number | undefined, v8?: number | undefined) => number[]; + set: (v0: number, v1: number, v2: number, v3: number, v4: number, v5: number, v6: number, v7: number, v8: number, dst?: T_1 | undefined) => T_1; + fromMat4: (m4: BaseArgType, dst?: T_2 | undefined) => T_2; + fromQuat: (q: BaseArgType, dst?: T_3 | undefined) => T_3; + negate: (m: BaseArgType, dst?: T_4 | undefined) => T_4; + copy: (m: BaseArgType, dst?: T | undefined) => T; + equalsApproximately: (a: BaseArgType, b: BaseArgType) => boolean; + equals: (a: BaseArgType, b: BaseArgType) => boolean; + identity: (dst?: T_5 | undefined) => T_5; + transpose: (m: BaseArgType, dst?: T_6 | undefined) => T_6; + inverse: (m: BaseArgType, dst?: T_7 | undefined) => T_7; + invert: (m: BaseArgType, dst?: T_7 | undefined) => T_7; + determinant: (m: BaseArgType) => number; + mul: (a: BaseArgType, b: BaseArgType, dst?: T_8 | undefined) => T_8; + multiply: (a: BaseArgType, b: BaseArgType, dst?: T_8 | undefined) => T_8; + setTranslation: (a: BaseArgType, v: BaseArgType, dst?: T_9 | undefined) => T_9; + getTranslation: (m: BaseArgType, dst?: T_10 | undefined) => T_10; + getAxis: (m: BaseArgType, axis: number, dst?: T_11 | undefined) => T_11; + setAxis: (m: BaseArgType, v: BaseArgType, axis: number, dst?: T_12 | undefined) => T_12; + getScaling: (m: BaseArgType, dst?: T_13 | undefined) => number[] | T_13; + translation: (v: BaseArgType, dst?: T_14 | undefined) => T_14; + translate: (m: BaseArgType, v: BaseArgType, dst?: T_15 | undefined) => T_15; + rotation: (angleInRadians: number, dst?: T_16 | undefined) => T_16; + rotate: (m: BaseArgType, angleInRadians: number, dst?: T_17 | undefined) => T_17; + scaling: (v: BaseArgType, dst?: T_18 | undefined) => T_18; + scale: (m: BaseArgType, v: BaseArgType, dst?: T_19 | undefined) => T_19; + uniformScaling: (s: number, dst?: T_20 | undefined) => T_20; + uniformScale: (m: BaseArgType, s: number, dst?: T_21 | undefined) => T_21; +}, quatn: { + create: (x?: number | undefined, y?: number | undefined, z?: number | undefined, w?: number | undefined) => number[]; + fromValues: (x?: number | undefined, y?: number | undefined, z?: number | undefined, w?: number | undefined) => number[]; + set: (x: number, y: number, z: number, w: number, dst?: T | undefined) => T; + fromAxisAngle: (axis: BaseArgType, angleInRadians: number, dst?: T_1 | undefined) => T_1; + toAxisAngle: (q: BaseArgType, dst?: T_2 | undefined) => { + angle: number; + axis: T_2; + }; + angle: (a: BaseArgType, b: BaseArgType) => number; + multiply: (a: BaseArgType, b: BaseArgType, dst?: T_3 | undefined) => T_3; + mul: (a: BaseArgType, b: BaseArgType, dst?: T_3 | undefined) => T_3; + rotateX: (q: BaseArgType, angleInRadians: number, dst?: T_4 | undefined) => T_4; + rotateY: (q: BaseArgType, angleInRadians: number, dst?: T_5 | undefined) => T_5; + rotateZ: (q: BaseArgType, angleInRadians: number, dst?: T_6 | undefined) => T_6; + slerp: (a: BaseArgType, b: BaseArgType, t: number, dst?: T_7 | undefined) => T_7; + inverse: (q: BaseArgType, dst?: T_8 | undefined) => T_8; + conjugate: (q: BaseArgType, dst?: T_9 | undefined) => T_9; + fromMat: (m: BaseArgType, dst?: T_10 | undefined) => T_10; + fromEuler: (xAngleInRadians: number, yAngleInRadians: number, zAngleInRadians: number, order: RotationOrder, dst?: T_11 | undefined) => T_11; + copy: (q: BaseArgType, dst?: T_12 | undefined) => T_12; + clone: (q: BaseArgType, dst?: T_12 | undefined) => T_12; + add: (a: BaseArgType, b: BaseArgType, dst?: T_13 | undefined) => T_13; + subtract: (a: BaseArgType, b: BaseArgType, dst?: T_14 | undefined) => T_14; + sub: (a: BaseArgType, b: BaseArgType, dst?: T_14 | undefined) => T_14; + mulScalar: (v: BaseArgType, k: number, dst?: T_15 | undefined) => T_15; + scale: (v: BaseArgType, k: number, dst?: T_15 | undefined) => T_15; + divScalar: (v: BaseArgType, k: number, dst?: T_16 | undefined) => T_16; + dot: (a: BaseArgType, b: BaseArgType) => number; + lerp: (a: BaseArgType, b: BaseArgType, t: number, dst?: T_17 | undefined) => T_17; + length: (v: BaseArgType) => number; + len: (v: BaseArgType) => number; + lengthSq: (v: BaseArgType) => number; + lenSq: (v: BaseArgType) => number; + normalize: (v: BaseArgType, dst?: T_18 | undefined) => T_18; + equalsApproximately: (a: BaseArgType, b: BaseArgType) => boolean; + equals: (a: BaseArgType, b: BaseArgType) => boolean; + identity: (dst?: T_19 | undefined) => T_19; + rotationTo: (aUnit: BaseArgType, bUnit: BaseArgType, dst?: T_20 | undefined) => T_20; + sqlerp: (a: BaseArgType, b: BaseArgType, c: BaseArgType, d: BaseArgType, t: number, dst?: T_21 | undefined) => T_21; +}, vec2n: { + create: (x?: number, y?: number) => number[]; + fromValues: (x?: number, y?: number) => number[]; + set: (x: number, y: number, dst?: T | undefined) => T; + ceil: (v: BaseArgType, dst?: T_1 | undefined) => T_1; + floor: (v: BaseArgType, dst?: T_2 | undefined) => T_2; + round: (v: BaseArgType, dst?: T_3 | undefined) => T_3; + clamp: (v: BaseArgType, min?: number, max?: number, dst?: T_4 | undefined) => T_4; + add: (a: BaseArgType, b: BaseArgType, dst?: T_5 | undefined) => T_5; + addScaled: (a: BaseArgType, b: BaseArgType, scale: number, dst?: T_6 | undefined) => T_6; + angle: (a: BaseArgType, b: BaseArgType) => number; + subtract: (a: BaseArgType, b: BaseArgType, dst?: T_7 | undefined) => T_7; + sub: (a: BaseArgType, b: BaseArgType, dst?: T_7 | undefined) => T_7; + equalsApproximately: (a: BaseArgType, b: BaseArgType) => boolean; + equals: (a: BaseArgType, b: BaseArgType) => boolean; + lerp: (a: BaseArgType, b: BaseArgType, t: number, dst?: T_8 | undefined) => T_8; + lerpV: (a: BaseArgType, b: BaseArgType, t: BaseArgType, dst?: T_9 | undefined) => T_9; + max: (a: BaseArgType, b: BaseArgType, dst?: T_10 | undefined) => T_10; + min: (a: BaseArgType, b: BaseArgType, dst?: T_11 | undefined) => T_11; + mulScalar: (v: BaseArgType, k: number, dst?: T_12 | undefined) => T_12; + scale: (v: BaseArgType, k: number, dst?: T_12 | undefined) => T_12; + divScalar: (v: BaseArgType, k: number, dst?: T_13 | undefined) => T_13; + inverse: (v: BaseArgType, dst?: T_14 | undefined) => T_14; + invert: (v: BaseArgType, dst?: T_14 | undefined) => T_14; + cross: (a: BaseArgType, b: BaseArgType, dst?: T_15 | undefined) => T_15; + dot: (a: BaseArgType, b: BaseArgType) => number; + length: (v: BaseArgType) => number; + len: (v: BaseArgType) => number; + lengthSq: (v: BaseArgType) => number; + lenSq: (v: BaseArgType) => number; + distance: (a: BaseArgType, b: BaseArgType) => number; + dist: (a: BaseArgType, b: BaseArgType) => number; + distanceSq: (a: BaseArgType, b: BaseArgType) => number; + distSq: (a: BaseArgType, b: BaseArgType) => number; + normalize: (v: BaseArgType, dst?: T_16 | undefined) => T_16; + negate: (v: BaseArgType, dst?: T_17 | undefined) => T_17; + copy: (v: BaseArgType, dst?: T_18 | undefined) => T_18; + clone: (v: BaseArgType, dst?: T_18 | undefined) => T_18; + multiply: (a: BaseArgType, b: BaseArgType, dst?: T_19 | undefined) => T_19; + mul: (a: BaseArgType, b: BaseArgType, dst?: T_19 | undefined) => T_19; + divide: (a: BaseArgType, b: BaseArgType, dst?: T_20 | undefined) => T_20; + div: (a: BaseArgType, b: BaseArgType, dst?: T_20 | undefined) => T_20; + random: (scale?: number, dst?: T_21 | undefined) => T_21; + zero: (dst?: T_22 | undefined) => T_22; + transformMat4: (v: BaseArgType, m: BaseArgType, dst?: T_23 | undefined) => T_23; + transformMat3: (v: BaseArgType, m: BaseArgType, dst?: T_24 | undefined) => T_24; + rotate: (a: BaseArgType, b: BaseArgType, rad: number, dst?: T_25 | undefined) => T_25; + setLength: (a: BaseArgType, len: number, dst?: T_26 | undefined) => T_26; + truncate: (a: BaseArgType, maxLen: number, dst?: T_27 | undefined) => T_27; + midpoint: (a: BaseArgType, b: BaseArgType, dst?: T_28 | undefined) => T_28; +}, vec3n: { + create: (x?: number | undefined, y?: number | undefined, z?: number | undefined) => number[]; + fromValues: (x?: number | undefined, y?: number | undefined, z?: number | undefined) => number[]; + set: (x: number, y: number, z: number, dst?: T | undefined) => T; + ceil: (v: BaseArgType, dst?: T_1 | undefined) => T_1; + floor: (v: BaseArgType, dst?: T_2 | undefined) => T_2; + round: (v: BaseArgType, dst?: T_3 | undefined) => T_3; + clamp: (v: BaseArgType, min?: number, max?: number, dst?: T_4 | undefined) => T_4; + add: (a: BaseArgType, b: BaseArgType, dst?: T_5 | undefined) => T_5; + addScaled: (a: BaseArgType, b: BaseArgType, scale: number, dst?: T_6 | undefined) => T_6; + angle: (a: BaseArgType, b: BaseArgType) => number; + subtract: (a: BaseArgType, b: BaseArgType, dst?: T_7 | undefined) => T_7; + sub: (a: BaseArgType, b: BaseArgType, dst?: T_7 | undefined) => T_7; + equalsApproximately: (a: BaseArgType, b: BaseArgType) => boolean; + equals: (a: BaseArgType, b: BaseArgType) => boolean; + lerp: (a: BaseArgType, b: BaseArgType, t: number, dst?: T_8 | undefined) => T_8; + lerpV: (a: BaseArgType, b: BaseArgType, t: BaseArgType, dst?: T_9 | undefined) => T_9; + max: (a: BaseArgType, b: BaseArgType, dst?: T_10 | undefined) => T_10; + min: (a: BaseArgType, b: BaseArgType, dst?: T_11 | undefined) => T_11; + mulScalar: (v: BaseArgType, k: number, dst?: T_12 | undefined) => T_12; + scale: (v: BaseArgType, k: number, dst?: T_12 | undefined) => T_12; + divScalar: (v: BaseArgType, k: number, dst?: T_13 | undefined) => T_13; + inverse: (v: BaseArgType, dst?: T_14 | undefined) => T_14; + invert: (v: BaseArgType, dst?: T_14 | undefined) => T_14; + cross: (a: BaseArgType, b: BaseArgType, dst?: T_15 | undefined) => T_15; + dot: (a: BaseArgType, b: BaseArgType) => number; + length: (v: BaseArgType) => number; + len: (v: BaseArgType) => number; + lengthSq: (v: BaseArgType) => number; + lenSq: (v: BaseArgType) => number; + distance: (a: BaseArgType, b: BaseArgType) => number; + dist: (a: BaseArgType, b: BaseArgType) => number; + distanceSq: (a: BaseArgType, b: BaseArgType) => number; + distSq: (a: BaseArgType, b: BaseArgType) => number; + normalize: (v: BaseArgType, dst?: T_16 | undefined) => T_16; + negate: (v: BaseArgType, dst?: T_17 | undefined) => T_17; + copy: (v: BaseArgType, dst?: T_18 | undefined) => T_18; + clone: (v: BaseArgType, dst?: T_18 | undefined) => T_18; + multiply: (a: BaseArgType, b: BaseArgType, dst?: T_19 | undefined) => T_19; + mul: (a: BaseArgType, b: BaseArgType, dst?: T_19 | undefined) => T_19; + divide: (a: BaseArgType, b: BaseArgType, dst?: T_20 | undefined) => T_20; + div: (a: BaseArgType, b: BaseArgType, dst?: T_20 | undefined) => T_20; + random: (scale?: number, dst?: T_21 | undefined) => T_21; + zero: (dst?: T_22 | undefined) => T_22; + transformMat4: (v: BaseArgType, m: BaseArgType, dst?: T_23 | undefined) => T_23; + transformMat4Upper3x3: (v: BaseArgType, m: BaseArgType, dst?: T_24 | undefined) => T_24; + transformMat3: (v: BaseArgType, m: BaseArgType, dst?: T_25 | undefined) => T_25; + transformQuat: (v: BaseArgType, q: BaseArgType, dst?: T_26 | undefined) => T_26; + getTranslation: (m: BaseArgType, dst?: T_27 | undefined) => T_27; + getAxis: (m: BaseArgType, axis: number, dst?: T_28 | undefined) => T_28; + getScaling: (m: BaseArgType, dst?: T_29 | undefined) => T_29; + rotateX: (a: BaseArgType, b: BaseArgType, rad: number, dst?: T_30 | undefined) => T_30; + rotateY: (a: BaseArgType, b: BaseArgType, rad: number, dst?: T_31 | undefined) => T_31; + rotateZ: (a: BaseArgType, b: BaseArgType, rad: number, dst?: T_32 | undefined) => T_32; + setLength: (a: BaseArgType, len: number, dst?: T_33 | undefined) => T_33; + truncate: (a: BaseArgType, maxLen: number, dst?: T_34 | undefined) => T_34; + midpoint: (a: BaseArgType, b: BaseArgType, dst?: T_35 | undefined) => T_35; +}, vec4n: { + create: (x?: number | undefined, y?: number | undefined, z?: number | undefined, w?: number | undefined) => number[]; + fromValues: (x?: number | undefined, y?: number | undefined, z?: number | undefined, w?: number | undefined) => number[]; + set: (x: number, y: number, z: number, w: number, dst?: T | undefined) => T; + ceil: (v: BaseArgType, dst?: T_1 | undefined) => T_1; + floor: (v: BaseArgType, dst?: T_2 | undefined) => T_2; + round: (v: BaseArgType, dst?: T_3 | undefined) => T_3; + clamp: (v: BaseArgType, min?: number, max?: number, dst?: T_4 | undefined) => T_4; + add: (a: BaseArgType, b: BaseArgType, dst?: T_5 | undefined) => T_5; + addScaled: (a: BaseArgType, b: BaseArgType, scale: number, dst?: T_6 | undefined) => T_6; + subtract: (a: BaseArgType, b: BaseArgType, dst?: T_7 | undefined) => T_7; + sub: (a: BaseArgType, b: BaseArgType, dst?: T_7 | undefined) => T_7; + equalsApproximately: (a: BaseArgType, b: BaseArgType) => boolean; + equals: (a: BaseArgType, b: BaseArgType) => boolean; + lerp: (a: BaseArgType, b: BaseArgType, t: number, dst?: T_8 | undefined) => T_8; + lerpV: (a: BaseArgType, b: BaseArgType, t: BaseArgType, dst?: T_9 | undefined) => T_9; + max: (a: BaseArgType, b: BaseArgType, dst?: T_10 | undefined) => T_10; + min: (a: BaseArgType, b: BaseArgType, dst?: T_11 | undefined) => T_11; + mulScalar: (v: BaseArgType, k: number, dst?: T_12 | undefined) => T_12; + scale: (v: BaseArgType, k: number, dst?: T_12 | undefined) => T_12; + divScalar: (v: BaseArgType, k: number, dst?: T_13 | undefined) => T_13; + inverse: (v: BaseArgType, dst?: T_14 | undefined) => T_14; + invert: (v: BaseArgType, dst?: T_14 | undefined) => T_14; + dot: (a: BaseArgType, b: BaseArgType) => number; + length: (v: BaseArgType) => number; + len: (v: BaseArgType) => number; + lengthSq: (v: BaseArgType) => number; + lenSq: (v: BaseArgType) => number; + distance: (a: BaseArgType, b: BaseArgType) => number; + dist: (a: BaseArgType, b: BaseArgType) => number; + distanceSq: (a: BaseArgType, b: BaseArgType) => number; + distSq: (a: BaseArgType, b: BaseArgType) => number; + normalize: (v: BaseArgType, dst?: T_15 | undefined) => T_15; + negate: (v: BaseArgType, dst?: T_16 | undefined) => T_16; + copy: (v: BaseArgType, dst?: T_17 | undefined) => T_17; + clone: (v: BaseArgType, dst?: T_17 | undefined) => T_17; + multiply: (a: BaseArgType, b: BaseArgType, dst?: T_18 | undefined) => T_18; + mul: (a: BaseArgType, b: BaseArgType, dst?: T_18 | undefined) => T_18; + divide: (a: BaseArgType, b: BaseArgType, dst?: T_19 | undefined) => T_19; + div: (a: BaseArgType, b: BaseArgType, dst?: T_19 | undefined) => T_19; + zero: (dst?: T_20 | undefined) => T_20; + transformMat4: (v: BaseArgType, m: BaseArgType, dst?: T_21 | undefined) => T_21; + setLength: (a: BaseArgType, len: number, dst?: T_22 | undefined) => T_22; + truncate: (a: BaseArgType, maxLen: number, dst?: T_23 | undefined) => T_23; + midpoint: (a: BaseArgType, b: BaseArgType, dst?: T_24 | undefined) => T_24; +}; diff --git a/dist/3.x/wgpu-matrix.js b/dist/3.x/wgpu-matrix.js new file mode 100644 index 0000000..4ba6c47 --- /dev/null +++ b/dist/3.x/wgpu-matrix.js @@ -0,0 +1,5620 @@ +/* wgpu-matrix@3.0.0, license MIT */ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.wgpuMatrix = {})); +})(this, (function (exports) { 'use strict'; + + function wrapConstructor(OriginalConstructor, modifier) { + return class extends OriginalConstructor { + constructor(...args) { + super(...args); + modifier(this); + } + }; // Type assertion is necessary here + } + const ZeroArray = wrapConstructor((Array), a => a.fill(0)); + + /* + * Copyright 2022 Gregg Tavares + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + let EPSILON = 0.000001; + /** + * Set the value for EPSILON for various checks + * @param v - Value to use for EPSILON. + * @returns previous value of EPSILON; + */ + function setEpsilon(v) { + const old = EPSILON; + EPSILON = v; + return old; + } + /** + * Convert degrees to radians + * @param degrees - Angle in degrees + * @returns angle converted to radians + */ + function degToRad(degrees) { + return degrees * Math.PI / 180; + } + /** + * Convert radians to degrees + * @param radians - Angle in radians + * @returns angle converted to degrees + */ + function radToDeg(radians) { + return radians * 180 / Math.PI; + } + /** + * Lerps between a and b via t + * @param a - starting value + * @param b - ending value + * @param t - value where 0 = a and 1 = b + * @returns a + (b - a) * t + */ + function lerp(a, b, t) { + return a + (b - a) * t; + } + /** + * Compute the opposite of lerp. Given a and b and a value between + * a and b returns a value between 0 and 1. 0 if a, 1 if b. + * Note: no clamping is done. + * @param a - start value + * @param b - end value + * @param v - value between a and b + * @returns (v - a) / (b - a) + */ + function inverseLerp(a, b, v) { + const d = b - a; + return (Math.abs(b - a) < EPSILON) + ? a + : (v - a) / d; + } + /** + * Compute the euclidean modulo + * + * ``` + * // table for n / 3 + * -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5 <- n + * ------------------------------------ + * -2 -1 -0 -2 -1 0, 1, 2, 0, 1, 2 <- n % 3 + * 1 2 0 1 2 0, 1, 2, 0, 1, 2 <- euclideanModule(n, 3) + * ``` + * + * @param n - dividend + * @param m - divisor + * @returns the euclidean modulo of n / m + */ + function euclideanModulo(n, m) { + return ((n % m) + m) % m; + } + + var utils = { + __proto__: null, + get EPSILON () { return EPSILON; }, + degToRad: degToRad, + euclideanModulo: euclideanModulo, + inverseLerp: inverseLerp, + lerp: lerp, + radToDeg: radToDeg, + setEpsilon: setEpsilon + }; + + /* + * Copyright 2022 Gregg Tavares + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + /** + * Generates am typed API for Vec3 + */ + function getAPIImpl$5(Ctor) { + /** + * Creates a Vec2; may be called with x, y, z to set initial values. + * + * Note: Since passing in a raw JavaScript array + * is valid in all circumstances, if you want to + * force a JavaScript array into a Vec2's specified type + * it would be faster to use + * + * ``` + * const v = vec2.clone(someJSArray); + * ``` + * + * @param x - Initial x value. + * @param y - Initial y value. + * @returns the created vector + */ + function create(x = 0, y = 0) { + const newDst = new Ctor(2); + if (x !== undefined) { + newDst[0] = x; + if (y !== undefined) { + newDst[1] = y; + } + } + return newDst; + } + /** + * Creates a Vec2; may be called with x, y, z to set initial values. (same as create) + * @param x - Initial x value. + * @param y - Initial y value. + * @returns the created vector + */ + const fromValues = create; + /** + * Sets the values of a Vec2 + * Also see {@link vec2.create} and {@link vec2.copy} + * + * @param x first value + * @param y second value + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns A vector with its elements set. + */ + function set(x, y, dst) { + const newDst = (dst ?? new Ctor(2)); + newDst[0] = x; + newDst[1] = y; + return newDst; + } + /** + * Applies Math.ceil to each element of vector + * @param v - Operand vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns A vector that is the ceil of each element of v. + */ + function ceil(v, dst) { + const newDst = (dst ?? new Ctor(2)); + newDst[0] = Math.ceil(v[0]); + newDst[1] = Math.ceil(v[1]); + return newDst; + } + /** + * Applies Math.floor to each element of vector + * @param v - Operand vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns A vector that is the floor of each element of v. + */ + function floor(v, dst) { + const newDst = (dst ?? new Ctor(2)); + newDst[0] = Math.floor(v[0]); + newDst[1] = Math.floor(v[1]); + return newDst; + } + /** + * Applies Math.round to each element of vector + * @param v - Operand vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns A vector that is the round of each element of v. + */ + function round(v, dst) { + const newDst = (dst ?? new Ctor(2)); + newDst[0] = Math.round(v[0]); + newDst[1] = Math.round(v[1]); + return newDst; + } + /** + * Clamp each element of vector between min and max + * @param v - Operand vector. + * @param max - Min value, default 0 + * @param min - Max value, default 1 + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns A vector that the clamped value of each element of v. + */ + function clamp(v, min = 0, max = 1, dst) { + const newDst = (dst ?? new Ctor(2)); + newDst[0] = Math.min(max, Math.max(min, v[0])); + newDst[1] = Math.min(max, Math.max(min, v[1])); + return newDst; + } + /** + * Adds two vectors; assumes a and b have the same dimension. + * @param a - Operand vector. + * @param b - Operand vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns A vector that is the sum of a and b. + */ + function add(a, b, dst) { + const newDst = (dst ?? new Ctor(2)); + newDst[0] = a[0] + b[0]; + newDst[1] = a[1] + b[1]; + return newDst; + } + /** + * Adds two vectors, scaling the 2nd; assumes a and b have the same dimension. + * @param a - Operand vector. + * @param b - Operand vector. + * @param scale - Amount to scale b + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns A vector that is the sum of a + b * scale. + */ + function addScaled(a, b, scale, dst) { + const newDst = (dst ?? new Ctor(2)); + newDst[0] = a[0] + b[0] * scale; + newDst[1] = a[1] + b[1] * scale; + return newDst; + } + /** + * Returns the angle in radians between two vectors. + * @param a - Operand vector. + * @param b - Operand vector. + * @returns The angle in radians between the 2 vectors. + */ + function angle(a, b) { + const ax = a[0]; + const ay = a[1]; + const bx = b[0]; + const by = b[1]; + const mag1 = Math.sqrt(ax * ax + ay * ay); + const mag2 = Math.sqrt(bx * bx + by * by); + const mag = mag1 * mag2; + const cosine = mag && dot(a, b) / mag; + return Math.acos(cosine); + } + /** + * Subtracts two vectors. + * @param a - Operand vector. + * @param b - Operand vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns A vector that is the difference of a and b. + */ + function subtract(a, b, dst) { + const newDst = (dst ?? new Ctor(2)); + newDst[0] = a[0] - b[0]; + newDst[1] = a[1] - b[1]; + return newDst; + } + /** + * Subtracts two vectors. + * @param a - Operand vector. + * @param b - Operand vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns A vector that is the difference of a and b. + */ + const sub = subtract; + /** + * Check if 2 vectors are approximately equal + * @param a - Operand vector. + * @param b - Operand vector. + * @returns true if vectors are approximately equal + */ + function equalsApproximately(a, b) { + return Math.abs(a[0] - b[0]) < EPSILON && + Math.abs(a[1] - b[1]) < EPSILON; + } + /** + * Check if 2 vectors are exactly equal + * @param a - Operand vector. + * @param b - Operand vector. + * @returns true if vectors are exactly equal + */ + function equals(a, b) { + return a[0] === b[0] && a[1] === b[1]; + } + /** + * Performs linear interpolation on two vectors. + * Given vectors a and b and interpolation coefficient t, returns + * a + t * (b - a). + * @param a - Operand vector. + * @param b - Operand vector. + * @param t - Interpolation coefficient. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns The linear interpolated result. + */ + function lerp(a, b, t, dst) { + const newDst = (dst ?? new Ctor(2)); + newDst[0] = a[0] + t * (b[0] - a[0]); + newDst[1] = a[1] + t * (b[1] - a[1]); + return newDst; + } + /** + * Performs linear interpolation on two vectors. + * Given vectors a and b and interpolation coefficient vector t, returns + * a + t * (b - a). + * @param a - Operand vector. + * @param b - Operand vector. + * @param t - Interpolation coefficients vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns the linear interpolated result. + */ + function lerpV(a, b, t, dst) { + const newDst = (dst ?? new Ctor(2)); + newDst[0] = a[0] + t[0] * (b[0] - a[0]); + newDst[1] = a[1] + t[1] * (b[1] - a[1]); + return newDst; + } + /** + * Return max values of two vectors. + * Given vectors a and b returns + * [max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])]. + * @param a - Operand vector. + * @param b - Operand vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns The max components vector. + */ + function max(a, b, dst) { + const newDst = (dst ?? new Ctor(2)); + newDst[0] = Math.max(a[0], b[0]); + newDst[1] = Math.max(a[1], b[1]); + return newDst; + } + /** + * Return min values of two vectors. + * Given vectors a and b returns + * [min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])]. + * @param a - Operand vector. + * @param b - Operand vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns The min components vector. + */ + function min(a, b, dst) { + const newDst = (dst ?? new Ctor(2)); + newDst[0] = Math.min(a[0], b[0]); + newDst[1] = Math.min(a[1], b[1]); + return newDst; + } + /** + * Multiplies a vector by a scalar. + * @param v - The vector. + * @param k - The scalar. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns The scaled vector. + */ + function mulScalar(v, k, dst) { + const newDst = (dst ?? new Ctor(2)); + newDst[0] = v[0] * k; + newDst[1] = v[1] * k; + return newDst; + } + /** + * Multiplies a vector by a scalar. (same as mulScalar) + * @param v - The vector. + * @param k - The scalar. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns The scaled vector. + */ + const scale = mulScalar; + /** + * Divides a vector by a scalar. + * @param v - The vector. + * @param k - The scalar. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns The scaled vector. + */ + function divScalar(v, k, dst) { + const newDst = (dst ?? new Ctor(2)); + newDst[0] = v[0] / k; + newDst[1] = v[1] / k; + return newDst; + } + /** + * Inverse a vector. + * @param v - The vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns The inverted vector. + */ + function inverse(v, dst) { + const newDst = (dst ?? new Ctor(2)); + newDst[0] = 1 / v[0]; + newDst[1] = 1 / v[1]; + return newDst; + } + /** + * Invert a vector. (same as inverse) + * @param v - The vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns The inverted vector. + */ + const invert = inverse; + /** + * Computes the cross product of two vectors; assumes both vectors have + * three entries. + * @param a - Operand vector. + * @param b - Operand vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns The vector of a cross b. + */ + function cross(a, b, dst) { + const newDst = (dst ?? new Ctor(3)); + const z = a[0] * b[1] - a[1] * b[0]; + newDst[0] = 0; + newDst[1] = 0; + newDst[2] = z; + return newDst; + } + /** + * Computes the dot product of two vectors; assumes both vectors have + * three entries. + * @param a - Operand vector. + * @param b - Operand vector. + * @returns dot product + */ + function dot(a, b) { + return a[0] * b[0] + a[1] * b[1]; + } + /** + * Computes the length of vector + * @param v - vector. + * @returns length of vector. + */ + function length(v) { + const v0 = v[0]; + const v1 = v[1]; + return Math.sqrt(v0 * v0 + v1 * v1); + } + /** + * Computes the length of vector (same as length) + * @param v - vector. + * @returns length of vector. + */ + const len = length; + /** + * Computes the square of the length of vector + * @param v - vector. + * @returns square of the length of vector. + */ + function lengthSq(v) { + const v0 = v[0]; + const v1 = v[1]; + return v0 * v0 + v1 * v1; + } + /** + * Computes the square of the length of vector (same as lengthSq) + * @param v - vector. + * @returns square of the length of vector. + */ + const lenSq = lengthSq; + /** + * Computes the distance between 2 points + * @param a - vector. + * @param b - vector. + * @returns distance between a and b + */ + function distance(a, b) { + const dx = a[0] - b[0]; + const dy = a[1] - b[1]; + return Math.sqrt(dx * dx + dy * dy); + } + /** + * Computes the distance between 2 points (same as distance) + * @param a - vector. + * @param b - vector. + * @returns distance between a and b + */ + const dist = distance; + /** + * Computes the square of the distance between 2 points + * @param a - vector. + * @param b - vector. + * @returns square of the distance between a and b + */ + function distanceSq(a, b) { + const dx = a[0] - b[0]; + const dy = a[1] - b[1]; + return dx * dx + dy * dy; + } + /** + * Computes the square of the distance between 2 points (same as distanceSq) + * @param a - vector. + * @param b - vector. + * @returns square of the distance between a and b + */ + const distSq = distanceSq; + /** + * Divides a vector by its Euclidean length and returns the quotient. + * @param v - The vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns The normalized vector. + */ + function normalize(v, dst) { + const newDst = (dst ?? new Ctor(2)); + const v0 = v[0]; + const v1 = v[1]; + const len = Math.sqrt(v0 * v0 + v1 * v1); + if (len > 0.00001) { + newDst[0] = v0 / len; + newDst[1] = v1 / len; + } + else { + newDst[0] = 0; + newDst[1] = 0; + } + return newDst; + } + /** + * Negates a vector. + * @param v - The vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns -v. + */ + function negate(v, dst) { + const newDst = (dst ?? new Ctor(2)); + newDst[0] = -v[0]; + newDst[1] = -v[1]; + return newDst; + } + /** + * Copies a vector. (same as {@link vec2.clone}) + * Also see {@link vec2.create} and {@link vec2.set} + * @param v - The vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns A copy of v. + */ + function copy(v, dst) { + const newDst = (dst ?? new Ctor(2)); + newDst[0] = v[0]; + newDst[1] = v[1]; + return newDst; + } + /** + * Clones a vector. (same as {@link vec2.copy}) + * Also see {@link vec2.create} and {@link vec2.set} + * @param v - The vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns A copy of v. + */ + const clone = copy; + /** + * Multiplies a vector by another vector (component-wise); assumes a and + * b have the same length. + * @param a - Operand vector. + * @param b - Operand vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns The vector of products of entries of a and b. + */ + function multiply(a, b, dst) { + const newDst = (dst ?? new Ctor(2)); + newDst[0] = a[0] * b[0]; + newDst[1] = a[1] * b[1]; + return newDst; + } + /** + * Multiplies a vector by another vector (component-wise); assumes a and + * b have the same length. (same as mul) + * @param a - Operand vector. + * @param b - Operand vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns The vector of products of entries of a and b. + */ + const mul = multiply; + /** + * Divides a vector by another vector (component-wise); assumes a and + * b have the same length. + * @param a - Operand vector. + * @param b - Operand vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns The vector of quotients of entries of a and b. + */ + function divide(a, b, dst) { + const newDst = (dst ?? new Ctor(2)); + newDst[0] = a[0] / b[0]; + newDst[1] = a[1] / b[1]; + return newDst; + } + /** + * Divides a vector by another vector (component-wise); assumes a and + * b have the same length. (same as divide) + * @param a - Operand vector. + * @param b - Operand vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns The vector of quotients of entries of a and b. + */ + const div = divide; + /** + * Creates a random unit vector * scale + * @param scale - Default 1 + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns The random vector. + */ + function random(scale = 1, dst) { + const newDst = (dst ?? new Ctor(2)); + const angle = Math.random() * 2 * Math.PI; + newDst[0] = Math.cos(angle) * scale; + newDst[1] = Math.sin(angle) * scale; + return newDst; + } + /** + * Zero's a vector + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns The zeroed vector. + */ + function zero(dst) { + const newDst = (dst ?? new Ctor(2)); + newDst[0] = 0; + newDst[1] = 0; + return newDst; + } + /** + * transform Vec2 by 4x4 matrix + * @param v - the vector + * @param m - The matrix. + * @param dst - optional Vec2 to store result. If not passed a new one is created. + * @returns the transformed vector + */ + function transformMat4(v, m, dst) { + const newDst = (dst ?? new Ctor(2)); + const x = v[0]; + const y = v[1]; + newDst[0] = x * m[0] + y * m[4] + m[12]; + newDst[1] = x * m[1] + y * m[5] + m[13]; + return newDst; + } + /** + * Transforms vec4 by 3x3 matrix + * + * @param v - the vector + * @param m - The matrix. + * @param dst - optional Vec2 to store result. If not passed a new one is created. + * @returns the transformed vector + */ + function transformMat3(v, m, dst) { + const newDst = (dst ?? new Ctor(2)); + const x = v[0]; + const y = v[1]; + newDst[0] = m[0] * x + m[4] * y + m[8]; + newDst[1] = m[1] * x + m[5] * y + m[9]; + return newDst; + } + /** + * Rotate a 2D vector + * + * @param a The vec2 point to rotate + * @param b The origin of the rotation + * @param rad The angle of rotation in radians + * @returns the rotated vector + */ + function rotate(a, b, rad, dst) { + const newDst = (dst ?? new Ctor(2)); + // Translate point to the origin + const p0 = a[0] - b[0]; + const p1 = a[1] - b[1]; + const sinC = Math.sin(rad); + const cosC = Math.cos(rad); + //perform rotation and translate to correct position + newDst[0] = p0 * cosC - p1 * sinC + b[0]; + newDst[1] = p0 * sinC + p1 * cosC + b[1]; + return newDst; + } + /** + * Treat a 2D vector as a direction and set it's length + * + * @param a The vec2 to lengthen + * @param len The length of the resulting vector + * @returns The lengthened vector + */ + function setLength(a, len, dst) { + const newDst = (dst ?? new Ctor(2)); + normalize(a, newDst); + return mulScalar(newDst, len, newDst); + } + /** + * Ensure a vector is not longer than a max length + * + * @param a The vec2 to limit + * @param maxLen The longest length of the resulting vector + * @returns The vector, shortened to maxLen if it's too long + */ + function truncate(a, maxLen, dst) { + const newDst = (dst ?? new Ctor(2)); + if (length(a) > maxLen) { + return setLength(a, maxLen, newDst); + } + return copy(a, newDst); + } + /** + * Return the vector exactly between 2 endpoint vectors + * + * @param a Endpoint 1 + * @param b Endpoint 2 + * @returns The vector exactly residing between endpoints 1 and 2 + */ + function midpoint(a, b, dst) { + const newDst = (dst ?? new Ctor(2)); + return lerp(a, b, 0.5, newDst); + } + return { + create, + fromValues, + set, + ceil, + floor, + round, + clamp, + add, + addScaled, + angle, + subtract, + sub, + equalsApproximately, + equals, + lerp, + lerpV, + max, + min, + mulScalar, + scale, + divScalar, + inverse, + invert, + cross, + dot, + length, + len, + lengthSq, + lenSq, + distance, + dist, + distanceSq, + distSq, + normalize, + negate, + copy, + clone, + multiply, + mul, + divide, + div, + random, + zero, + transformMat4, + transformMat3, + rotate, + setLength, + truncate, + midpoint, + }; + } + const cache$5 = new Map(); + function getAPI$5(Ctor) { + let api = cache$5.get(Ctor); + if (!api) { + api = getAPIImpl$5(Ctor); + cache$5.set(Ctor, api); + } + return api; + } + + /* + * Copyright 2022 Gregg Tavares + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + /** + * Generates a typed API for Mat3 + * */ + function getAPIImpl$4(Ctor) { + const vec2 = getAPI$5(Ctor); + /** + * Create a Mat3 from values + * + * Note: Since passing in a raw JavaScript array + * is valid in all circumstances, if you want to + * force a JavaScript array into a Mat3's specified type + * it would be faster to use + * + * ``` + * const m = mat3.clone(someJSArray); + * ``` + * + * @param v0 - value for element 0 + * @param v1 - value for element 1 + * @param v2 - value for element 2 + * @param v3 - value for element 3 + * @param v4 - value for element 4 + * @param v5 - value for element 5 + * @param v6 - value for element 6 + * @param v7 - value for element 7 + * @param v8 - value for element 8 + * @returns matrix created from values. + */ + function create(v0, v1, v2, v3, v4, v5, v6, v7, v8) { + const newDst = new Ctor(12); + // to make the array homogenous + newDst[3] = 0; + newDst[7] = 0; + newDst[11] = 0; + if (v0 !== undefined) { + newDst[0] = v0; + if (v1 !== undefined) { + newDst[1] = v1; + if (v2 !== undefined) { + newDst[2] = v2; + if (v3 !== undefined) { + newDst[4] = v3; + if (v4 !== undefined) { + newDst[5] = v4; + if (v5 !== undefined) { + newDst[6] = v5; + if (v6 !== undefined) { + newDst[8] = v6; + if (v7 !== undefined) { + newDst[9] = v7; + if (v8 !== undefined) { + newDst[10] = v8; + } + } + } + } + } + } + } + } + } + return newDst; + } + /** + * Sets the values of a Mat3 + * Also see {@link mat3.create} and {@link mat3.copy} + * + * @param v0 - value for element 0 + * @param v1 - value for element 1 + * @param v2 - value for element 2 + * @param v3 - value for element 3 + * @param v4 - value for element 4 + * @param v5 - value for element 5 + * @param v6 - value for element 6 + * @param v7 - value for element 7 + * @param v8 - value for element 8 + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns Mat3 set from values. + */ + function set(v0, v1, v2, v3, v4, v5, v6, v7, v8, dst) { + const newDst = (dst ?? new Ctor(12)); + newDst[0] = v0; + newDst[1] = v1; + newDst[2] = v2; + newDst[3] = 0; + newDst[4] = v3; + newDst[5] = v4; + newDst[6] = v5; + newDst[7] = 0; + newDst[8] = v6; + newDst[9] = v7; + newDst[10] = v8; + newDst[11] = 0; + return newDst; + } + /** + * Creates a Mat3 from the upper left 3x3 part of a Mat4 + * @param m4 - source matrix + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns Mat3 made from m4 + */ + function fromMat4(m4, dst) { + const newDst = (dst ?? new Ctor(12)); + newDst[0] = m4[0]; + newDst[1] = m4[1]; + newDst[2] = m4[2]; + newDst[3] = 0; + newDst[4] = m4[4]; + newDst[5] = m4[5]; + newDst[6] = m4[6]; + newDst[7] = 0; + newDst[8] = m4[8]; + newDst[9] = m4[9]; + newDst[10] = m4[10]; + newDst[11] = 0; + return newDst; + } + /** + * Creates a Mat3 rotation matrix from a quaternion + * @param q - quaternion to create matrix from + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns Mat3 made from q + */ + function fromQuat(q, dst) { + const newDst = (dst ?? new Ctor(12)); + const x = q[0]; + const y = q[1]; + const z = q[2]; + const w = q[3]; + const x2 = x + x; + const y2 = y + y; + const z2 = z + z; + const xx = x * x2; + const yx = y * x2; + const yy = y * y2; + const zx = z * x2; + const zy = z * y2; + const zz = z * z2; + const wx = w * x2; + const wy = w * y2; + const wz = w * z2; + newDst[0] = 1 - yy - zz; + newDst[1] = yx + wz; + newDst[2] = zx - wy; + newDst[3] = 0; + newDst[4] = yx - wz; + newDst[5] = 1 - xx - zz; + newDst[6] = zy + wx; + newDst[7] = 0; + newDst[8] = zx + wy; + newDst[9] = zy - wx; + newDst[10] = 1 - xx - yy; + newDst[11] = 0; + return newDst; + } + /** + * Negates a matrix. + * @param m - The matrix. + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns -m. + */ + function negate(m, dst) { + const newDst = (dst ?? new Ctor(12)); + newDst[0] = -m[0]; + newDst[1] = -m[1]; + newDst[2] = -m[2]; + newDst[4] = -m[4]; + newDst[5] = -m[5]; + newDst[6] = -m[6]; + newDst[8] = -m[8]; + newDst[9] = -m[9]; + newDst[10] = -m[10]; + return newDst; + } + /** + * Copies a matrix. (same as {@link mat3.clone}) + * Also see {@link mat3.create} and {@link mat3.set} + * @param m - The matrix. + * @param dst - The matrix. If not passed a new one is created. + * @returns A copy of m. + */ + function copy(m, dst) { + const newDst = (dst ?? new Ctor(12)); + newDst[0] = m[0]; + newDst[1] = m[1]; + newDst[2] = m[2]; + newDst[4] = m[4]; + newDst[5] = m[5]; + newDst[6] = m[6]; + newDst[8] = m[8]; + newDst[9] = m[9]; + newDst[10] = m[10]; + return newDst; + } + /** + * Copies a matrix (same as {@link mat3.copy}) + * Also see {@link mat3.create} and {@link mat3.set} + * @param m - The matrix. + * @param dst - The matrix. If not passed a new one is created. + * @returns A copy of m. + */ + const clone = copy; + /** + * Check if 2 matrices are approximately equal + * @param a Operand matrix. + * @param b Operand matrix. + * @returns true if matrices are approximately equal + */ + function equalsApproximately(a, b) { + return Math.abs(a[0] - b[0]) < EPSILON && + Math.abs(a[1] - b[1]) < EPSILON && + Math.abs(a[2] - b[2]) < EPSILON && + Math.abs(a[4] - b[4]) < EPSILON && + Math.abs(a[5] - b[5]) < EPSILON && + Math.abs(a[6] - b[6]) < EPSILON && + Math.abs(a[8] - b[8]) < EPSILON && + Math.abs(a[9] - b[9]) < EPSILON && + Math.abs(a[10] - b[10]) < EPSILON; + } + /** + * Check if 2 matrices are exactly equal + * @param a Operand matrix. + * @param b Operand matrix. + * @returns true if matrices are exactly equal + */ + function equals(a, b) { + return a[0] === b[0] && + a[1] === b[1] && + a[2] === b[2] && + a[4] === b[4] && + a[5] === b[5] && + a[6] === b[6] && + a[8] === b[8] && + a[9] === b[9] && + a[10] === b[10]; + } + /** + * Creates a 3-by-3 identity matrix. + * + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns A 3-by-3 identity matrix. + */ + function identity(dst) { + const newDst = (dst ?? new Ctor(12)); + newDst[0] = 1; + newDst[1] = 0; + newDst[2] = 0; + newDst[4] = 0; + newDst[5] = 1; + newDst[6] = 0; + newDst[8] = 0; + newDst[9] = 0; + newDst[10] = 1; + return newDst; + } + /** + * Takes the transpose of a matrix. + * @param m - The matrix. + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns The transpose of m. + */ + function transpose(m, dst) { + const newDst = (dst ?? new Ctor(12)); + if (newDst === m) { + let t; + // 0 1 2 + // 4 5 6 + // 8 9 10 + t = m[1]; + m[1] = m[4]; + m[4] = t; + t = m[2]; + m[2] = m[8]; + m[8] = t; + t = m[6]; + m[6] = m[9]; + m[9] = t; + return newDst; + } + const m00 = m[0 * 4 + 0]; + const m01 = m[0 * 4 + 1]; + const m02 = m[0 * 4 + 2]; + const m10 = m[1 * 4 + 0]; + const m11 = m[1 * 4 + 1]; + const m12 = m[1 * 4 + 2]; + const m20 = m[2 * 4 + 0]; + const m21 = m[2 * 4 + 1]; + const m22 = m[2 * 4 + 2]; + newDst[0] = m00; + newDst[1] = m10; + newDst[2] = m20; + newDst[4] = m01; + newDst[5] = m11; + newDst[6] = m21; + newDst[8] = m02; + newDst[9] = m12; + newDst[10] = m22; + return newDst; + } + /** + * Computes the inverse of a 3-by-3 matrix. + * @param m - The matrix. + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns The inverse of m. + */ + function inverse(m, dst) { + const newDst = (dst ?? new Ctor(12)); + const m00 = m[0 * 4 + 0]; + const m01 = m[0 * 4 + 1]; + const m02 = m[0 * 4 + 2]; + const m10 = m[1 * 4 + 0]; + const m11 = m[1 * 4 + 1]; + const m12 = m[1 * 4 + 2]; + const m20 = m[2 * 4 + 0]; + const m21 = m[2 * 4 + 1]; + const m22 = m[2 * 4 + 2]; + const b01 = m22 * m11 - m12 * m21; + const b11 = -m22 * m10 + m12 * m20; + const b21 = m21 * m10 - m11 * m20; + const invDet = 1 / (m00 * b01 + m01 * b11 + m02 * b21); + newDst[0] = b01 * invDet; + newDst[1] = (-m22 * m01 + m02 * m21) * invDet; + newDst[2] = (m12 * m01 - m02 * m11) * invDet; + newDst[4] = b11 * invDet; + newDst[5] = (m22 * m00 - m02 * m20) * invDet; + newDst[6] = (-m12 * m00 + m02 * m10) * invDet; + newDst[8] = b21 * invDet; + newDst[9] = (-m21 * m00 + m01 * m20) * invDet; + newDst[10] = (m11 * m00 - m01 * m10) * invDet; + return newDst; + } + /** + * Compute the determinant of a matrix + * @param m - the matrix + * @returns the determinant + */ + function determinant(m) { + const m00 = m[0 * 4 + 0]; + const m01 = m[0 * 4 + 1]; + const m02 = m[0 * 4 + 2]; + const m10 = m[1 * 4 + 0]; + const m11 = m[1 * 4 + 1]; + const m12 = m[1 * 4 + 2]; + const m20 = m[2 * 4 + 0]; + const m21 = m[2 * 4 + 1]; + const m22 = m[2 * 4 + 2]; + return m00 * (m11 * m22 - m21 * m12) - + m10 * (m01 * m22 - m21 * m02) + + m20 * (m01 * m12 - m11 * m02); + } + /** + * Computes the inverse of a 3-by-3 matrix. (same as inverse) + * @param m - The matrix. + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns The inverse of m. + */ + const invert = inverse; + /** + * Multiplies two 3-by-3 matrices with a on the left and b on the right + * @param a - The matrix on the left. + * @param b - The matrix on the right. + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns The matrix product of a and b. + */ + function multiply(a, b, dst) { + const newDst = (dst ?? new Ctor(12)); + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a10 = a[4 + 0]; + const a11 = a[4 + 1]; + const a12 = a[4 + 2]; + const a20 = a[8 + 0]; + const a21 = a[8 + 1]; + const a22 = a[8 + 2]; + const b00 = b[0]; + const b01 = b[1]; + const b02 = b[2]; + const b10 = b[4 + 0]; + const b11 = b[4 + 1]; + const b12 = b[4 + 2]; + const b20 = b[8 + 0]; + const b21 = b[8 + 1]; + const b22 = b[8 + 2]; + newDst[0] = a00 * b00 + a10 * b01 + a20 * b02; + newDst[1] = a01 * b00 + a11 * b01 + a21 * b02; + newDst[2] = a02 * b00 + a12 * b01 + a22 * b02; + newDst[4] = a00 * b10 + a10 * b11 + a20 * b12; + newDst[5] = a01 * b10 + a11 * b11 + a21 * b12; + newDst[6] = a02 * b10 + a12 * b11 + a22 * b12; + newDst[8] = a00 * b20 + a10 * b21 + a20 * b22; + newDst[9] = a01 * b20 + a11 * b21 + a21 * b22; + newDst[10] = a02 * b20 + a12 * b21 + a22 * b22; + return newDst; + } + /** + * Multiplies two 3-by-3 matrices with a on the left and b on the right (same as multiply) + * @param a - The matrix on the left. + * @param b - The matrix on the right. + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns The matrix product of a and b. + */ + const mul = multiply; + /** + * Sets the translation component of a 3-by-3 matrix to the given + * vector. + * @param a - The matrix. + * @param v - The vector. + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns The matrix with translation set. + */ + function setTranslation(a, v, dst) { + const newDst = (dst ?? identity()); + if (a !== newDst) { + newDst[0] = a[0]; + newDst[1] = a[1]; + newDst[2] = a[2]; + newDst[4] = a[4]; + newDst[5] = a[5]; + newDst[6] = a[6]; + } + newDst[8] = v[0]; + newDst[9] = v[1]; + newDst[10] = 1; + return newDst; + } + /** + * Returns the translation component of a 3-by-3 matrix as a vector with 3 + * entries. + * @param m - The matrix. + * @param dst - vector to hold result. If not passed a new one is created. + * @returns The translation component of m. + */ + function getTranslation(m, dst) { + const newDst = (dst ?? vec2.create()); + newDst[0] = m[8]; + newDst[1] = m[9]; + return newDst; + } + /** + * Returns an axis of a 3x3 matrix as a vector with 2 entries + * @param m - The matrix. + * @param axis - The axis 0 = x, 1 = y, + * @returns The axis component of m. + */ + function getAxis(m, axis, dst) { + const newDst = (dst ?? vec2.create()); + const off = axis * 4; + newDst[0] = m[off + 0]; + newDst[1] = m[off + 1]; + return newDst; + } + /** + * Sets an axis of a 3x3 matrix as a vector with 2 entries + * @param m - The matrix. + * @param v - the axis vector + * @param axis - The axis 0 = x, 1 = y; + * @param dst - The matrix to set. If not passed a new one is created. + * @returns The matrix with axis set. + */ + function setAxis(m, v, axis, dst) { + const newDst = (dst === m ? m : copy(m, dst)); + const off = axis * 4; + newDst[off + 0] = v[0]; + newDst[off + 1] = v[1]; + return newDst; + } + ///** + // * Returns the scaling component of the matrix + // * @param m - The Matrix + // * @param dst - The vector to set. If not passed a new one is created. + // */ + function getScaling(m, dst) { + const newDst = (dst ?? vec2.create()); + const xx = m[0]; + const xy = m[1]; + const yx = m[4]; + const yy = m[5]; + newDst[0] = Math.sqrt(xx * xx + xy * xy); + newDst[1] = Math.sqrt(yx * yx + yy * yy); + return newDst; + } + /** + * Creates a 3-by-3 matrix which translates by the given vector v. + * @param v - The vector by which to translate. + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns The translation matrix. + */ + function translation(v, dst) { + const newDst = (dst ?? new Ctor(12)); + newDst[0] = 1; + newDst[1] = 0; + newDst[2] = 0; + newDst[4] = 0; + newDst[5] = 1; + newDst[6] = 0; + newDst[8] = v[0]; + newDst[9] = v[1]; + newDst[10] = 1; + return newDst; + } + /** + * Translates the given 3-by-3 matrix by the given vector v. + * @param m - The matrix. + * @param v - The vector by which to translate. + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns The translated matrix. + */ + function translate(m, v, dst) { + const newDst = (dst ?? new Ctor(12)); + const v0 = v[0]; + const v1 = v[1]; + const m00 = m[0]; + const m01 = m[1]; + const m02 = m[2]; + const m10 = m[1 * 4 + 0]; + const m11 = m[1 * 4 + 1]; + const m12 = m[1 * 4 + 2]; + const m20 = m[2 * 4 + 0]; + const m21 = m[2 * 4 + 1]; + const m22 = m[2 * 4 + 2]; + if (m !== newDst) { + newDst[0] = m00; + newDst[1] = m01; + newDst[2] = m02; + newDst[4] = m10; + newDst[5] = m11; + newDst[6] = m12; + } + newDst[8] = m00 * v0 + m10 * v1 + m20; + newDst[9] = m01 * v0 + m11 * v1 + m21; + newDst[10] = m02 * v0 + m12 * v1 + m22; + return newDst; + } + /** + * Creates a 3-by-3 matrix which rotates by the given angle. + * @param angleInRadians - The angle by which to rotate (in radians). + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns The rotation matrix. + */ + function rotation(angleInRadians, dst) { + const newDst = (dst ?? new Ctor(12)); + const c = Math.cos(angleInRadians); + const s = Math.sin(angleInRadians); + newDst[0] = c; + newDst[1] = s; + newDst[2] = 0; + newDst[4] = -s; + newDst[5] = c; + newDst[6] = 0; + newDst[8] = 0; + newDst[9] = 0; + newDst[10] = 1; + return newDst; + } + /** + * Rotates the given 3-by-3 matrix by the given angle. + * @param m - The matrix. + * @param angleInRadians - The angle by which to rotate (in radians). + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns The rotated matrix. + */ + function rotate(m, angleInRadians, dst) { + const newDst = (dst ?? new Ctor(12)); + const m00 = m[0 * 4 + 0]; + const m01 = m[0 * 4 + 1]; + const m02 = m[0 * 4 + 2]; + const m10 = m[1 * 4 + 0]; + const m11 = m[1 * 4 + 1]; + const m12 = m[1 * 4 + 2]; + const c = Math.cos(angleInRadians); + const s = Math.sin(angleInRadians); + newDst[0] = c * m00 + s * m10; + newDst[1] = c * m01 + s * m11; + newDst[2] = c * m02 + s * m12; + newDst[4] = c * m10 - s * m00; + newDst[5] = c * m11 - s * m01; + newDst[6] = c * m12 - s * m02; + if (m !== newDst) { + newDst[8] = m[8]; + newDst[9] = m[9]; + newDst[10] = m[10]; + } + return newDst; + } + /** + * Creates a 3-by-3 matrix which scales in each dimension by an amount given by + * the corresponding entry in the given vector; assumes the vector has three + * entries. + * @param v - A vector of + * 2 entries specifying the factor by which to scale in each dimension. + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns The scaling matrix. + */ + function scaling(v, dst) { + const newDst = (dst ?? new Ctor(12)); + newDst[0] = v[0]; + newDst[1] = 0; + newDst[2] = 0; + newDst[4] = 0; + newDst[5] = v[1]; + newDst[6] = 0; + newDst[8] = 0; + newDst[9] = 0; + newDst[10] = 1; + return newDst; + } + /** + * Scales the given 3-by-3 matrix in each dimension by an amount + * given by the corresponding entry in the given vector; assumes the vector has + * three entries. + * @param m - The matrix to be modified. + * @param v - A vector of 2 entries specifying the + * factor by which to scale in each dimension. + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns The scaled matrix. + */ + function scale(m, v, dst) { + const newDst = (dst ?? new Ctor(12)); + const v0 = v[0]; + const v1 = v[1]; + newDst[0] = v0 * m[0 * 4 + 0]; + newDst[1] = v0 * m[0 * 4 + 1]; + newDst[2] = v0 * m[0 * 4 + 2]; + newDst[4] = v1 * m[1 * 4 + 0]; + newDst[5] = v1 * m[1 * 4 + 1]; + newDst[6] = v1 * m[1 * 4 + 2]; + if (m !== newDst) { + newDst[8] = m[8]; + newDst[9] = m[9]; + newDst[10] = m[10]; + } + return newDst; + } + /** + * Creates a 3-by-3 matrix which scales uniformly in each dimension + * @param s - Amount to scale + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns The scaling matrix. + */ + function uniformScaling(s, dst) { + const newDst = (dst ?? new Ctor(12)); + newDst[0] = s; + newDst[1] = 0; + newDst[2] = 0; + newDst[4] = 0; + newDst[5] = s; + newDst[6] = 0; + newDst[8] = 0; + newDst[9] = 0; + newDst[10] = 1; + return newDst; + } + /** + * Scales the given 3-by-3 matrix in each dimension by an amount + * given. + * @param m - The matrix to be modified. + * @param s - Amount to scale. + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns The scaled matrix. + */ + function uniformScale(m, s, dst) { + const newDst = (dst ?? new Ctor(12)); + newDst[0] = s * m[0 * 4 + 0]; + newDst[1] = s * m[0 * 4 + 1]; + newDst[2] = s * m[0 * 4 + 2]; + newDst[4] = s * m[1 * 4 + 0]; + newDst[5] = s * m[1 * 4 + 1]; + newDst[6] = s * m[1 * 4 + 2]; + if (m !== newDst) { + newDst[8] = m[8]; + newDst[9] = m[9]; + newDst[10] = m[10]; + } + return newDst; + } + return { + clone, + create, + set, + fromMat4, + fromQuat, + negate, + copy, + equalsApproximately, + equals, + identity, + transpose, + inverse, + invert, + determinant, + mul, + multiply, + setTranslation, + getTranslation, + getAxis, + setAxis, + getScaling, + translation, + translate, + rotation, + rotate, + scaling, + scale, + uniformScaling, + uniformScale, + }; + } + const cache$4 = new Map(); + function getAPI$4(Ctor) { + let api = cache$4.get(Ctor); + if (!api) { + api = getAPIImpl$4(Ctor); + cache$4.set(Ctor, api); + } + return api; + } + + /* + * Copyright 2022 Gregg Tavares + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + /** + * Generates am typed API for Vec3 + * */ + function getAPIImpl$3(Ctor) { + /** + * Creates a vec3; may be called with x, y, z to set initial values. + * @param x - Initial x value. + * @param y - Initial y value. + * @param z - Initial z value. + * @returns the created vector + */ + function create(x, y, z) { + const newDst = new Ctor(3); + if (x !== undefined) { + newDst[0] = x; + if (y !== undefined) { + newDst[1] = y; + if (z !== undefined) { + newDst[2] = z; + } + } + } + return newDst; + } + /** + * Creates a vec3; may be called with x, y, z to set initial values. (same as create) + * @param x - Initial x value. + * @param y - Initial y value. + * @param z - Initial z value. + * @returns the created vector + */ + const fromValues = create; + /** + * Sets the values of a Vec3 + * Also see {@link vec3.create} and {@link vec3.copy} + * + * @param x first value + * @param y second value + * @param z third value + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns A vector with its elements set. + */ + function set(x, y, z, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = x; + newDst[1] = y; + newDst[2] = z; + return newDst; + } + /** + * Applies Math.ceil to each element of vector + * @param v - Operand vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns A vector that is the ceil of each element of v. + */ + function ceil(v, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = Math.ceil(v[0]); + newDst[1] = Math.ceil(v[1]); + newDst[2] = Math.ceil(v[2]); + return newDst; + } + /** + * Applies Math.floor to each element of vector + * @param v - Operand vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns A vector that is the floor of each element of v. + */ + function floor(v, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = Math.floor(v[0]); + newDst[1] = Math.floor(v[1]); + newDst[2] = Math.floor(v[2]); + return newDst; + } + /** + * Applies Math.round to each element of vector + * @param v - Operand vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns A vector that is the round of each element of v. + */ + function round(v, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = Math.round(v[0]); + newDst[1] = Math.round(v[1]); + newDst[2] = Math.round(v[2]); + return newDst; + } + /** + * Clamp each element of vector between min and max + * @param v - Operand vector. + * @param max - Min value, default 0 + * @param min - Max value, default 1 + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns A vector that the clamped value of each element of v. + */ + function clamp(v, min = 0, max = 1, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = Math.min(max, Math.max(min, v[0])); + newDst[1] = Math.min(max, Math.max(min, v[1])); + newDst[2] = Math.min(max, Math.max(min, v[2])); + return newDst; + } + /** + * Adds two vectors; assumes a and b have the same dimension. + * @param a - Operand vector. + * @param b - Operand vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns A vector that is the sum of a and b. + */ + function add(a, b, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = a[0] + b[0]; + newDst[1] = a[1] + b[1]; + newDst[2] = a[2] + b[2]; + return newDst; + } + /** + * Adds two vectors, scaling the 2nd; assumes a and b have the same dimension. + * @param a - Operand vector. + * @param b - Operand vector. + * @param scale - Amount to scale b + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns A vector that is the sum of a + b * scale. + */ + function addScaled(a, b, scale, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = a[0] + b[0] * scale; + newDst[1] = a[1] + b[1] * scale; + newDst[2] = a[2] + b[2] * scale; + return newDst; + } + /** + * Returns the angle in radians between two vectors. + * @param a - Operand vector. + * @param b - Operand vector. + * @returns The angle in radians between the 2 vectors. + */ + function angle(a, b) { + const ax = a[0]; + const ay = a[1]; + const az = a[2]; + const bx = b[0]; + const by = b[1]; + const bz = b[2]; + const mag1 = Math.sqrt(ax * ax + ay * ay + az * az); + const mag2 = Math.sqrt(bx * bx + by * by + bz * bz); + const mag = mag1 * mag2; + const cosine = mag && dot(a, b) / mag; + return Math.acos(cosine); + } + /** + * Subtracts two vectors. + * @param a - Operand vector. + * @param b - Operand vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns A vector that is the difference of a and b. + */ + function subtract(a, b, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = a[0] - b[0]; + newDst[1] = a[1] - b[1]; + newDst[2] = a[2] - b[2]; + return newDst; + } + /** + * Subtracts two vectors. + * @param a - Operand vector. + * @param b - Operand vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns A vector that is the difference of a and b. + */ + const sub = subtract; + /** + * Check if 2 vectors are approximately equal + * @param a - Operand vector. + * @param b - Operand vector. + * @returns true if vectors are approximately equal + */ + function equalsApproximately(a, b) { + return Math.abs(a[0] - b[0]) < EPSILON && + Math.abs(a[1] - b[1]) < EPSILON && + Math.abs(a[2] - b[2]) < EPSILON; + } + /** + * Check if 2 vectors are exactly equal + * @param a - Operand vector. + * @param b - Operand vector. + * @returns true if vectors are exactly equal + */ + function equals(a, b) { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2]; + } + /** + * Performs linear interpolation on two vectors. + * Given vectors a and b and interpolation coefficient t, returns + * a + t * (b - a). + * @param a - Operand vector. + * @param b - Operand vector. + * @param t - Interpolation coefficient. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns The linear interpolated result. + */ + function lerp(a, b, t, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = a[0] + t * (b[0] - a[0]); + newDst[1] = a[1] + t * (b[1] - a[1]); + newDst[2] = a[2] + t * (b[2] - a[2]); + return newDst; + } + /** + * Performs linear interpolation on two vectors. + * Given vectors a and b and interpolation coefficient vector t, returns + * a + t * (b - a). + * @param a - Operand vector. + * @param b - Operand vector. + * @param t - Interpolation coefficients vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns the linear interpolated result. + */ + function lerpV(a, b, t, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = a[0] + t[0] * (b[0] - a[0]); + newDst[1] = a[1] + t[1] * (b[1] - a[1]); + newDst[2] = a[2] + t[2] * (b[2] - a[2]); + return newDst; + } + /** + * Return max values of two vectors. + * Given vectors a and b returns + * [max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])]. + * @param a - Operand vector. + * @param b - Operand vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns The max components vector. + */ + function max(a, b, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = Math.max(a[0], b[0]); + newDst[1] = Math.max(a[1], b[1]); + newDst[2] = Math.max(a[2], b[2]); + return newDst; + } + /** + * Return min values of two vectors. + * Given vectors a and b returns + * [min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])]. + * @param a - Operand vector. + * @param b - Operand vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns The min components vector. + */ + function min(a, b, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = Math.min(a[0], b[0]); + newDst[1] = Math.min(a[1], b[1]); + newDst[2] = Math.min(a[2], b[2]); + return newDst; + } + /** + * Multiplies a vector by a scalar. + * @param v - The vector. + * @param k - The scalar. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns The scaled vector. + */ + function mulScalar(v, k, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = v[0] * k; + newDst[1] = v[1] * k; + newDst[2] = v[2] * k; + return newDst; + } + /** + * Multiplies a vector by a scalar. (same as mulScalar) + * @param v - The vector. + * @param k - The scalar. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns The scaled vector. + */ + const scale = mulScalar; + /** + * Divides a vector by a scalar. + * @param v - The vector. + * @param k - The scalar. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns The scaled vector. + */ + function divScalar(v, k, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = v[0] / k; + newDst[1] = v[1] / k; + newDst[2] = v[2] / k; + return newDst; + } + /** + * Inverse a vector. + * @param v - The vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns The inverted vector. + */ + function inverse(v, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = 1 / v[0]; + newDst[1] = 1 / v[1]; + newDst[2] = 1 / v[2]; + return newDst; + } + /** + * Invert a vector. (same as inverse) + * @param v - The vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns The inverted vector. + */ + const invert = inverse; + /** + * Computes the cross product of two vectors; assumes both vectors have + * three entries. + * @param a - Operand vector. + * @param b - Operand vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns The vector of a cross b. + */ + function cross(a, b, dst) { + const newDst = (dst ?? new Ctor(3)); + const t1 = a[2] * b[0] - a[0] * b[2]; + const t2 = a[0] * b[1] - a[1] * b[0]; + newDst[0] = a[1] * b[2] - a[2] * b[1]; + newDst[1] = t1; + newDst[2] = t2; + return newDst; + } + /** + * Computes the dot product of two vectors; assumes both vectors have + * three entries. + * @param a - Operand vector. + * @param b - Operand vector. + * @returns dot product + */ + function dot(a, b) { + return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]); + } + /** + * Computes the length of vector + * @param v - vector. + * @returns length of vector. + */ + function length(v) { + const v0 = v[0]; + const v1 = v[1]; + const v2 = v[2]; + return Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2); + } + /** + * Computes the length of vector (same as length) + * @param v - vector. + * @returns length of vector. + */ + const len = length; + /** + * Computes the square of the length of vector + * @param v - vector. + * @returns square of the length of vector. + */ + function lengthSq(v) { + const v0 = v[0]; + const v1 = v[1]; + const v2 = v[2]; + return v0 * v0 + v1 * v1 + v2 * v2; + } + /** + * Computes the square of the length of vector (same as lengthSq) + * @param v - vector. + * @returns square of the length of vector. + */ + const lenSq = lengthSq; + /** + * Computes the distance between 2 points + * @param a - vector. + * @param b - vector. + * @returns distance between a and b + */ + function distance(a, b) { + const dx = a[0] - b[0]; + const dy = a[1] - b[1]; + const dz = a[2] - b[2]; + return Math.sqrt(dx * dx + dy * dy + dz * dz); + } + /** + * Computes the distance between 2 points (same as distance) + * @param a - vector. + * @param b - vector. + * @returns distance between a and b + */ + const dist = distance; + /** + * Computes the square of the distance between 2 points + * @param a - vector. + * @param b - vector. + * @returns square of the distance between a and b + */ + function distanceSq(a, b) { + const dx = a[0] - b[0]; + const dy = a[1] - b[1]; + const dz = a[2] - b[2]; + return dx * dx + dy * dy + dz * dz; + } + /** + * Computes the square of the distance between 2 points (same as distanceSq) + * @param a - vector. + * @param b - vector. + * @returns square of the distance between a and b + */ + const distSq = distanceSq; + /** + * Divides a vector by its Euclidean length and returns the quotient. + * @param v - The vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns The normalized vector. + */ + function normalize(v, dst) { + const newDst = (dst ?? new Ctor(3)); + const v0 = v[0]; + const v1 = v[1]; + const v2 = v[2]; + const len = Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2); + if (len > 0.00001) { + newDst[0] = v0 / len; + newDst[1] = v1 / len; + newDst[2] = v2 / len; + } + else { + newDst[0] = 0; + newDst[1] = 0; + newDst[2] = 0; + } + return newDst; + } + /** + * Negates a vector. + * @param v - The vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns -v. + */ + function negate(v, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = -v[0]; + newDst[1] = -v[1]; + newDst[2] = -v[2]; + return newDst; + } + /** + * Copies a vector. (same as {@link vec3.clone}) + * Also see {@link vec3.create} and {@link vec3.set} + * @param v - The vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns A copy of v. + */ + function copy(v, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = v[0]; + newDst[1] = v[1]; + newDst[2] = v[2]; + return newDst; + } + /** + * Clones a vector. (same as {@link vec3.copy}) + * Also see {@link vec3.create} and {@link vec3.set} + * @param v - The vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns A copy of v. + */ + const clone = copy; + /** + * Multiplies a vector by another vector (component-wise); assumes a and + * b have the same length. + * @param a - Operand vector. + * @param b - Operand vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns The vector of products of entries of a and b. + */ + function multiply(a, b, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = a[0] * b[0]; + newDst[1] = a[1] * b[1]; + newDst[2] = a[2] * b[2]; + return newDst; + } + /** + * Multiplies a vector by another vector (component-wise); assumes a and + * b have the same length. (same as mul) + * @param a - Operand vector. + * @param b - Operand vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns The vector of products of entries of a and b. + */ + const mul = multiply; + /** + * Divides a vector by another vector (component-wise); assumes a and + * b have the same length. + * @param a - Operand vector. + * @param b - Operand vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns The vector of quotients of entries of a and b. + */ + function divide(a, b, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = a[0] / b[0]; + newDst[1] = a[1] / b[1]; + newDst[2] = a[2] / b[2]; + return newDst; + } + /** + * Divides a vector by another vector (component-wise); assumes a and + * b have the same length. (same as divide) + * @param a - Operand vector. + * @param b - Operand vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns The vector of quotients of entries of a and b. + */ + const div = divide; + /** + * Creates a random vector + * @param scale - Default 1 + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns The random vector. + */ + function random(scale = 1, dst) { + const newDst = (dst ?? new Ctor(3)); + const angle = Math.random() * 2 * Math.PI; + const z = Math.random() * 2 - 1; + const zScale = Math.sqrt(1 - z * z) * scale; + newDst[0] = Math.cos(angle) * zScale; + newDst[1] = Math.sin(angle) * zScale; + newDst[2] = z * scale; + return newDst; + } + /** + * Zero's a vector + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns The zeroed vector. + */ + function zero(dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = 0; + newDst[1] = 0; + newDst[2] = 0; + return newDst; + } + /** + * transform vec3 by 4x4 matrix + * @param v - the vector + * @param m - The matrix. + * @param dst - optional vec3 to store result. If not passed a new one is created. + * @returns the transformed vector + */ + function transformMat4(v, m, dst) { + const newDst = (dst ?? new Ctor(3)); + const x = v[0]; + const y = v[1]; + const z = v[2]; + const w = (m[3] * x + m[7] * y + m[11] * z + m[15]) || 1; + newDst[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w; + newDst[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w; + newDst[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w; + return newDst; + } + /** + * Transform vec3 by upper 3x3 matrix inside 4x4 matrix. + * @param v - The direction. + * @param m - The matrix. + * @param dst - optional vec3 to store result. If not passed a new one is created. + * @returns The transformed vector. + */ + function transformMat4Upper3x3(v, m, dst) { + const newDst = (dst ?? new Ctor(3)); + const v0 = v[0]; + const v1 = v[1]; + const v2 = v[2]; + newDst[0] = v0 * m[0 * 4 + 0] + v1 * m[1 * 4 + 0] + v2 * m[2 * 4 + 0]; + newDst[1] = v0 * m[0 * 4 + 1] + v1 * m[1 * 4 + 1] + v2 * m[2 * 4 + 1]; + newDst[2] = v0 * m[0 * 4 + 2] + v1 * m[1 * 4 + 2] + v2 * m[2 * 4 + 2]; + return newDst; + } + /** + * Transforms vec3 by 3x3 matrix + * + * @param v - the vector + * @param m - The matrix. + * @param dst - optional vec3 to store result. If not passed a new one is created. + * @returns the transformed vector + */ + function transformMat3(v, m, dst) { + const newDst = (dst ?? new Ctor(3)); + const x = v[0]; + const y = v[1]; + const z = v[2]; + newDst[0] = x * m[0] + y * m[4] + z * m[8]; + newDst[1] = x * m[1] + y * m[5] + z * m[9]; + newDst[2] = x * m[2] + y * m[6] + z * m[10]; + return newDst; + } + /** + * Transforms vec3 by Quaternion + * @param v - the vector to transform + * @param q - the quaternion to transform by + * @param dst - optional vec3 to store result. If not passed a new one is created. + * @returns the transformed + */ + function transformQuat(v, q, dst) { + const newDst = (dst ?? new Ctor(3)); + const qx = q[0]; + const qy = q[1]; + const qz = q[2]; + const w2 = q[3] * 2; + const x = v[0]; + const y = v[1]; + const z = v[2]; + const uvX = qy * z - qz * y; + const uvY = qz * x - qx * z; + const uvZ = qx * y - qy * x; + newDst[0] = x + uvX * w2 + (qy * uvZ - qz * uvY) * 2; + newDst[1] = y + uvY * w2 + (qz * uvX - qx * uvZ) * 2; + newDst[2] = z + uvZ * w2 + (qx * uvY - qy * uvX) * 2; + return newDst; + } + /** + * Returns the translation component of a 4-by-4 matrix as a vector with 3 + * entries. + * @param m - The matrix. + * @param dst - vector to hold result. If not passed a new one is created. + * @returns The translation component of m. + */ + function getTranslation(m, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = m[12]; + newDst[1] = m[13]; + newDst[2] = m[14]; + return newDst; + } + /** + * Returns an axis of a 4x4 matrix as a vector with 3 entries + * @param m - The matrix. + * @param axis - The axis 0 = x, 1 = y, 2 = z; + * @returns The axis component of m. + */ + function getAxis(m, axis, dst) { + const newDst = (dst ?? new Ctor(3)); + const off = axis * 4; + newDst[0] = m[off + 0]; + newDst[1] = m[off + 1]; + newDst[2] = m[off + 2]; + return newDst; + } + /** + * Returns the scaling component of the matrix + * @param m - The Matrix + * @param dst - The vector to set. If not passed a new one is created. + */ + function getScaling(m, dst) { + const newDst = (dst ?? new Ctor(3)); + const xx = m[0]; + const xy = m[1]; + const xz = m[2]; + const yx = m[4]; + const yy = m[5]; + const yz = m[6]; + const zx = m[8]; + const zy = m[9]; + const zz = m[10]; + newDst[0] = Math.sqrt(xx * xx + xy * xy + xz * xz); + newDst[1] = Math.sqrt(yx * yx + yy * yy + yz * yz); + newDst[2] = Math.sqrt(zx * zx + zy * zy + zz * zz); + return newDst; + } + /** + * Rotate a 3D vector around the x-axis + * + * @param {ReadonlyVec3} a The vec3 point to rotate + * @param {ReadonlyVec3} b The origin of the rotation + * @param {Number} rad The angle of rotation in radians + * @param dst - The vector to set. If not passed a new one is created. + * @returns the rotated vector + */ + function rotateX(a, b, rad, dst) { + const newDst = (dst ?? new Ctor(3)); + const p = []; + const r = []; + //Translate point to the origin + p[0] = a[0] - b[0]; + p[1] = a[1] - b[1]; + p[2] = a[2] - b[2]; + //perform rotation + r[0] = p[0]; + r[1] = p[1] * Math.cos(rad) - p[2] * Math.sin(rad); + r[2] = p[1] * Math.sin(rad) + p[2] * Math.cos(rad); + //translate to correct position + newDst[0] = r[0] + b[0]; + newDst[1] = r[1] + b[1]; + newDst[2] = r[2] + b[2]; + return newDst; + } + /** + * Rotate a 3D vector around the y-axis + * + * @param {ReadonlyVec3} a The vec3 point to rotate + * @param {ReadonlyVec3} b The origin of the rotation + * @param {Number} rad The angle of rotation in radians + * @param dst - The vector to set. If not passed a new one is created. + * @returns the rotated vector + */ + function rotateY(a, b, rad, dst) { + const newDst = (dst ?? new Ctor(3)); + const p = []; + const r = []; + // translate point to the origin + p[0] = a[0] - b[0]; + p[1] = a[1] - b[1]; + p[2] = a[2] - b[2]; + // perform rotation + r[0] = p[2] * Math.sin(rad) + p[0] * Math.cos(rad); + r[1] = p[1]; + r[2] = p[2] * Math.cos(rad) - p[0] * Math.sin(rad); + // translate to correct position + newDst[0] = r[0] + b[0]; + newDst[1] = r[1] + b[1]; + newDst[2] = r[2] + b[2]; + return newDst; + } + /** + * Rotate a 3D vector around the z-axis + * + * @param {ReadonlyVec3} a The vec3 point to rotate + * @param {ReadonlyVec3} b The origin of the rotation + * @param {Number} rad The angle of rotation in radians + * @param dst - The vector to set. If not passed a new one is created. + * @returns {vec3} out + */ + function rotateZ(a, b, rad, dst) { + const newDst = (dst ?? new Ctor(3)); + const p = []; + const r = []; + // translate point to the origin + p[0] = a[0] - b[0]; + p[1] = a[1] - b[1]; + p[2] = a[2] - b[2]; + // perform rotation + r[0] = p[0] * Math.cos(rad) - p[1] * Math.sin(rad); + r[1] = p[0] * Math.sin(rad) + p[1] * Math.cos(rad); + r[2] = p[2]; + // translate to correct position + newDst[0] = r[0] + b[0]; + newDst[1] = r[1] + b[1]; + newDst[2] = r[2] + b[2]; + return newDst; + } + /** + * Treat a 3D vector as a direction and set it's length + * + * @param a The vec3 to lengthen + * @param len The length of the resulting vector + * @returns The lengthened vector + */ + function setLength(a, len, dst) { + const newDst = (dst ?? new Ctor(3)); + normalize(a, newDst); + return mulScalar(newDst, len, newDst); + } + /** + * Ensure a vector is not longer than a max length + * + * @param a The vec3 to limit + * @param maxLen The longest length of the resulting vector + * @returns The vector, shortened to maxLen if it's too long + */ + function truncate(a, maxLen, dst) { + const newDst = (dst ?? new Ctor(3)); + if (length(a) > maxLen) { + return setLength(a, maxLen, newDst); + } + return copy(a, newDst); + } + /** + * Return the vector exactly between 2 endpoint vectors + * + * @param a Endpoint 1 + * @param b Endpoint 2 + * @returns The vector exactly residing between endpoints 1 and 2 + */ + function midpoint(a, b, dst) { + const newDst = (dst ?? new Ctor(3)); + return lerp(a, b, 0.5, newDst); + } + return { + create, + fromValues, + set, + ceil, + floor, + round, + clamp, + add, + addScaled, + angle, + subtract, + sub, + equalsApproximately, + equals, + lerp, + lerpV, + max, + min, + mulScalar, + scale, + divScalar, + inverse, + invert, + cross, + dot, + length, + len, + lengthSq, + lenSq, + distance, + dist, + distanceSq, + distSq, + normalize, + negate, + copy, + clone, + multiply, + mul, + divide, + div, + random, + zero, + transformMat4, + transformMat4Upper3x3, + transformMat3, + transformQuat, + getTranslation, + getAxis, + getScaling, + rotateX, + rotateY, + rotateZ, + setLength, + truncate, + midpoint, + }; + } + const cache$3 = new Map(); + function getAPI$3(Ctor) { + let api = cache$3.get(Ctor); + if (!api) { + api = getAPIImpl$3(Ctor); + cache$3.set(Ctor, api); + } + return api; + } + + /** + * Generates a typed API for Mat4 + * */ + function getAPIImpl$2(Ctor) { + const vec3 = getAPI$3(Ctor); + /** + * 4x4 Matrix math math functions. + * + * Almost all functions take an optional `newDst` argument. If it is not passed in the + * functions will create a new matrix. In other words you can do this + * + * const mat = mat4.translation([1, 2, 3]); // Creates a new translation matrix + * + * or + * + * const mat = mat4.create(); + * mat4.translation([1, 2, 3], mat); // Puts translation matrix in mat. + * + * The first style is often easier but depending on where it's used it generates garbage where + * as there is almost never allocation with the second style. + * + * It is always save to pass any matrix as the destination. So for example + * + * const mat = mat4.identity(); + * const trans = mat4.translation([1, 2, 3]); + * mat4.multiply(mat, trans, mat); // Multiplies mat * trans and puts result in mat. + * + */ + /** + * Create a Mat4 from values + * + * Note: Since passing in a raw JavaScript array + * is valid in all circumstances, if you want to + * force a JavaScript array into a Mat4's specified type + * it would be faster to use + * + * ``` + * const m = mat4.clone(someJSArray); + * ``` + * + * @param v0 - value for element 0 + * @param v1 - value for element 1 + * @param v2 - value for element 2 + * @param v3 - value for element 3 + * @param v4 - value for element 4 + * @param v5 - value for element 5 + * @param v6 - value for element 6 + * @param v7 - value for element 7 + * @param v8 - value for element 8 + * @param v9 - value for element 9 + * @param v10 - value for element 10 + * @param v11 - value for element 11 + * @param v12 - value for element 12 + * @param v13 - value for element 13 + * @param v14 - value for element 14 + * @param v15 - value for element 15 + * @returns created from values. + */ + function create(v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15) { + const newDst = new Ctor(16); + if (v0 !== undefined) { + newDst[0] = v0; + if (v1 !== undefined) { + newDst[1] = v1; + if (v2 !== undefined) { + newDst[2] = v2; + if (v3 !== undefined) { + newDst[3] = v3; + if (v4 !== undefined) { + newDst[4] = v4; + if (v5 !== undefined) { + newDst[5] = v5; + if (v6 !== undefined) { + newDst[6] = v6; + if (v7 !== undefined) { + newDst[7] = v7; + if (v8 !== undefined) { + newDst[8] = v8; + if (v9 !== undefined) { + newDst[9] = v9; + if (v10 !== undefined) { + newDst[10] = v10; + if (v11 !== undefined) { + newDst[11] = v11; + if (v12 !== undefined) { + newDst[12] = v12; + if (v13 !== undefined) { + newDst[13] = v13; + if (v14 !== undefined) { + newDst[14] = v14; + if (v15 !== undefined) { + newDst[15] = v15; + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + return newDst; + } + /** + * Sets the values of a Mat4 + * Also see {@link mat4.create} and {@link mat4.copy} + * + * @param v0 - value for element 0 + * @param v1 - value for element 1 + * @param v2 - value for element 2 + * @param v3 - value for element 3 + * @param v4 - value for element 4 + * @param v5 - value for element 5 + * @param v6 - value for element 6 + * @param v7 - value for element 7 + * @param v8 - value for element 8 + * @param v9 - value for element 9 + * @param v10 - value for element 10 + * @param v11 - value for element 11 + * @param v12 - value for element 12 + * @param v13 - value for element 13 + * @param v14 - value for element 14 + * @param v15 - value for element 15 + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns Mat4 created from values. + */ + function set(v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, dst) { + const newDst = (dst ?? new Ctor(16)); + newDst[0] = v0; + newDst[1] = v1; + newDst[2] = v2; + newDst[3] = v3; + newDst[4] = v4; + newDst[5] = v5; + newDst[6] = v6; + newDst[7] = v7; + newDst[8] = v8; + newDst[9] = v9; + newDst[10] = v10; + newDst[11] = v11; + newDst[12] = v12; + newDst[13] = v13; + newDst[14] = v14; + newDst[15] = v15; + return newDst; + } + /** + * Creates a Mat4 from a Mat3 + * @param m3 - source matrix + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns Mat4 made from m3 + */ + function fromMat3(m3, dst) { + const newDst = (dst ?? new Ctor(16)); + newDst[0] = m3[0]; + newDst[1] = m3[1]; + newDst[2] = m3[2]; + newDst[3] = 0; + newDst[4] = m3[4]; + newDst[5] = m3[5]; + newDst[6] = m3[6]; + newDst[7] = 0; + newDst[8] = m3[8]; + newDst[9] = m3[9]; + newDst[10] = m3[10]; + newDst[11] = 0; + newDst[12] = 0; + newDst[13] = 0; + newDst[14] = 0; + newDst[15] = 1; + return newDst; + } + /** + * Creates a Mat4 rotation matrix from a quaternion + * @param q - quaternion to create matrix from + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns Mat4 made from q + */ + function fromQuat(q, dst) { + const newDst = (dst ?? new Ctor(16)); + const x = q[0]; + const y = q[1]; + const z = q[2]; + const w = q[3]; + const x2 = x + x; + const y2 = y + y; + const z2 = z + z; + const xx = x * x2; + const yx = y * x2; + const yy = y * y2; + const zx = z * x2; + const zy = z * y2; + const zz = z * z2; + const wx = w * x2; + const wy = w * y2; + const wz = w * z2; + newDst[0] = 1 - yy - zz; + newDst[1] = yx + wz; + newDst[2] = zx - wy; + newDst[3] = 0; + newDst[4] = yx - wz; + newDst[5] = 1 - xx - zz; + newDst[6] = zy + wx; + newDst[7] = 0; + newDst[8] = zx + wy; + newDst[9] = zy - wx; + newDst[10] = 1 - xx - yy; + newDst[11] = 0; + newDst[12] = 0; + newDst[13] = 0; + newDst[14] = 0; + newDst[15] = 1; + return newDst; + } + /** + * Negates a matrix. + * @param m - The matrix. + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns -m. + */ + function negate(m, dst) { + const newDst = (dst ?? new Ctor(16)); + newDst[0] = -m[0]; + newDst[1] = -m[1]; + newDst[2] = -m[2]; + newDst[3] = -m[3]; + newDst[4] = -m[4]; + newDst[5] = -m[5]; + newDst[6] = -m[6]; + newDst[7] = -m[7]; + newDst[8] = -m[8]; + newDst[9] = -m[9]; + newDst[10] = -m[10]; + newDst[11] = -m[11]; + newDst[12] = -m[12]; + newDst[13] = -m[13]; + newDst[14] = -m[14]; + newDst[15] = -m[15]; + return newDst; + } + /** + * Copies a matrix. (same as {@link mat4.clone}) + * Also see {@link mat4.create} and {@link mat4.set} + * @param m - The matrix. + * @param dst - The matrix. If not passed a new one is created. + * @returns A copy of m. + */ + function copy(m, dst) { + const newDst = (dst ?? new Ctor(16)); + newDst[0] = m[0]; + newDst[1] = m[1]; + newDst[2] = m[2]; + newDst[3] = m[3]; + newDst[4] = m[4]; + newDst[5] = m[5]; + newDst[6] = m[6]; + newDst[7] = m[7]; + newDst[8] = m[8]; + newDst[9] = m[9]; + newDst[10] = m[10]; + newDst[11] = m[11]; + newDst[12] = m[12]; + newDst[13] = m[13]; + newDst[14] = m[14]; + newDst[15] = m[15]; + return newDst; + } + /** + * Copies a matrix (same as {@link mat4.copy}) + * Also see {@link mat4.create} and {@link mat4.set} + * @param m - The matrix. + * @param dst - The matrix. If not passed a new one is created. + * @returns A copy of m. + */ + const clone = copy; + /** + * Check if 2 matrices are approximately equal + * @param a - Operand matrix. + * @param b - Operand matrix. + * @returns true if matrices are approximately equal + */ + function equalsApproximately(a, b) { + return Math.abs(a[0] - b[0]) < EPSILON && + Math.abs(a[1] - b[1]) < EPSILON && + Math.abs(a[2] - b[2]) < EPSILON && + Math.abs(a[3] - b[3]) < EPSILON && + Math.abs(a[4] - b[4]) < EPSILON && + Math.abs(a[5] - b[5]) < EPSILON && + Math.abs(a[6] - b[6]) < EPSILON && + Math.abs(a[7] - b[7]) < EPSILON && + Math.abs(a[8] - b[8]) < EPSILON && + Math.abs(a[9] - b[9]) < EPSILON && + Math.abs(a[10] - b[10]) < EPSILON && + Math.abs(a[11] - b[11]) < EPSILON && + Math.abs(a[12] - b[12]) < EPSILON && + Math.abs(a[13] - b[13]) < EPSILON && + Math.abs(a[14] - b[14]) < EPSILON && + Math.abs(a[15] - b[15]) < EPSILON; + } + /** + * Check if 2 matrices are exactly equal + * @param a - Operand matrix. + * @param b - Operand matrix. + * @returns true if matrices are exactly equal + */ + function equals(a, b) { + return a[0] === b[0] && + a[1] === b[1] && + a[2] === b[2] && + a[3] === b[3] && + a[4] === b[4] && + a[5] === b[5] && + a[6] === b[6] && + a[7] === b[7] && + a[8] === b[8] && + a[9] === b[9] && + a[10] === b[10] && + a[11] === b[11] && + a[12] === b[12] && + a[13] === b[13] && + a[14] === b[14] && + a[15] === b[15]; + } + /** + * Creates a 4-by-4 identity matrix. + * + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns A 4-by-4 identity matrix. + */ + function identity(dst) { + const newDst = (dst ?? new Ctor(16)); + newDst[0] = 1; + newDst[1] = 0; + newDst[2] = 0; + newDst[3] = 0; + newDst[4] = 0; + newDst[5] = 1; + newDst[6] = 0; + newDst[7] = 0; + newDst[8] = 0; + newDst[9] = 0; + newDst[10] = 1; + newDst[11] = 0; + newDst[12] = 0; + newDst[13] = 0; + newDst[14] = 0; + newDst[15] = 1; + return newDst; + } + /** + * Takes the transpose of a matrix. + * @param m - The matrix. + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns The transpose of m. + */ + function transpose(m, dst) { + const newDst = (dst ?? new Ctor(16)); + if (newDst === m) { + let t; + t = m[1]; + m[1] = m[4]; + m[4] = t; + t = m[2]; + m[2] = m[8]; + m[8] = t; + t = m[3]; + m[3] = m[12]; + m[12] = t; + t = m[6]; + m[6] = m[9]; + m[9] = t; + t = m[7]; + m[7] = m[13]; + m[13] = t; + t = m[11]; + m[11] = m[14]; + m[14] = t; + return newDst; + } + const m00 = m[0 * 4 + 0]; + const m01 = m[0 * 4 + 1]; + const m02 = m[0 * 4 + 2]; + const m03 = m[0 * 4 + 3]; + const m10 = m[1 * 4 + 0]; + const m11 = m[1 * 4 + 1]; + const m12 = m[1 * 4 + 2]; + const m13 = m[1 * 4 + 3]; + const m20 = m[2 * 4 + 0]; + const m21 = m[2 * 4 + 1]; + const m22 = m[2 * 4 + 2]; + const m23 = m[2 * 4 + 3]; + const m30 = m[3 * 4 + 0]; + const m31 = m[3 * 4 + 1]; + const m32 = m[3 * 4 + 2]; + const m33 = m[3 * 4 + 3]; + newDst[0] = m00; + newDst[1] = m10; + newDst[2] = m20; + newDst[3] = m30; + newDst[4] = m01; + newDst[5] = m11; + newDst[6] = m21; + newDst[7] = m31; + newDst[8] = m02; + newDst[9] = m12; + newDst[10] = m22; + newDst[11] = m32; + newDst[12] = m03; + newDst[13] = m13; + newDst[14] = m23; + newDst[15] = m33; + return newDst; + } + /** + * Computes the inverse of a 4-by-4 matrix. + * @param m - The matrix. + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns The inverse of m. + */ + function inverse(m, dst) { + const newDst = (dst ?? new Ctor(16)); + const m00 = m[0 * 4 + 0]; + const m01 = m[0 * 4 + 1]; + const m02 = m[0 * 4 + 2]; + const m03 = m[0 * 4 + 3]; + const m10 = m[1 * 4 + 0]; + const m11 = m[1 * 4 + 1]; + const m12 = m[1 * 4 + 2]; + const m13 = m[1 * 4 + 3]; + const m20 = m[2 * 4 + 0]; + const m21 = m[2 * 4 + 1]; + const m22 = m[2 * 4 + 2]; + const m23 = m[2 * 4 + 3]; + const m30 = m[3 * 4 + 0]; + const m31 = m[3 * 4 + 1]; + const m32 = m[3 * 4 + 2]; + const m33 = m[3 * 4 + 3]; + const tmp0 = m22 * m33; + const tmp1 = m32 * m23; + const tmp2 = m12 * m33; + const tmp3 = m32 * m13; + const tmp4 = m12 * m23; + const tmp5 = m22 * m13; + const tmp6 = m02 * m33; + const tmp7 = m32 * m03; + const tmp8 = m02 * m23; + const tmp9 = m22 * m03; + const tmp10 = m02 * m13; + const tmp11 = m12 * m03; + const tmp12 = m20 * m31; + const tmp13 = m30 * m21; + const tmp14 = m10 * m31; + const tmp15 = m30 * m11; + const tmp16 = m10 * m21; + const tmp17 = m20 * m11; + const tmp18 = m00 * m31; + const tmp19 = m30 * m01; + const tmp20 = m00 * m21; + const tmp21 = m20 * m01; + const tmp22 = m00 * m11; + const tmp23 = m10 * m01; + const t0 = (tmp0 * m11 + tmp3 * m21 + tmp4 * m31) - + (tmp1 * m11 + tmp2 * m21 + tmp5 * m31); + const t1 = (tmp1 * m01 + tmp6 * m21 + tmp9 * m31) - + (tmp0 * m01 + tmp7 * m21 + tmp8 * m31); + const t2 = (tmp2 * m01 + tmp7 * m11 + tmp10 * m31) - + (tmp3 * m01 + tmp6 * m11 + tmp11 * m31); + const t3 = (tmp5 * m01 + tmp8 * m11 + tmp11 * m21) - + (tmp4 * m01 + tmp9 * m11 + tmp10 * m21); + const d = 1 / (m00 * t0 + m10 * t1 + m20 * t2 + m30 * t3); + newDst[0] = d * t0; + newDst[1] = d * t1; + newDst[2] = d * t2; + newDst[3] = d * t3; + newDst[4] = d * ((tmp1 * m10 + tmp2 * m20 + tmp5 * m30) - + (tmp0 * m10 + tmp3 * m20 + tmp4 * m30)); + newDst[5] = d * ((tmp0 * m00 + tmp7 * m20 + tmp8 * m30) - + (tmp1 * m00 + tmp6 * m20 + tmp9 * m30)); + newDst[6] = d * ((tmp3 * m00 + tmp6 * m10 + tmp11 * m30) - + (tmp2 * m00 + tmp7 * m10 + tmp10 * m30)); + newDst[7] = d * ((tmp4 * m00 + tmp9 * m10 + tmp10 * m20) - + (tmp5 * m00 + tmp8 * m10 + tmp11 * m20)); + newDst[8] = d * ((tmp12 * m13 + tmp15 * m23 + tmp16 * m33) - + (tmp13 * m13 + tmp14 * m23 + tmp17 * m33)); + newDst[9] = d * ((tmp13 * m03 + tmp18 * m23 + tmp21 * m33) - + (tmp12 * m03 + tmp19 * m23 + tmp20 * m33)); + newDst[10] = d * ((tmp14 * m03 + tmp19 * m13 + tmp22 * m33) - + (tmp15 * m03 + tmp18 * m13 + tmp23 * m33)); + newDst[11] = d * ((tmp17 * m03 + tmp20 * m13 + tmp23 * m23) - + (tmp16 * m03 + tmp21 * m13 + tmp22 * m23)); + newDst[12] = d * ((tmp14 * m22 + tmp17 * m32 + tmp13 * m12) - + (tmp16 * m32 + tmp12 * m12 + tmp15 * m22)); + newDst[13] = d * ((tmp20 * m32 + tmp12 * m02 + tmp19 * m22) - + (tmp18 * m22 + tmp21 * m32 + tmp13 * m02)); + newDst[14] = d * ((tmp18 * m12 + tmp23 * m32 + tmp15 * m02) - + (tmp22 * m32 + tmp14 * m02 + tmp19 * m12)); + newDst[15] = d * ((tmp22 * m22 + tmp16 * m02 + tmp21 * m12) - + (tmp20 * m12 + tmp23 * m22 + tmp17 * m02)); + return newDst; + } + /** + * Compute the determinant of a matrix + * @param m - the matrix + * @returns the determinant + */ + function determinant(m) { + const m00 = m[0 * 4 + 0]; + const m01 = m[0 * 4 + 1]; + const m02 = m[0 * 4 + 2]; + const m03 = m[0 * 4 + 3]; + const m10 = m[1 * 4 + 0]; + const m11 = m[1 * 4 + 1]; + const m12 = m[1 * 4 + 2]; + const m13 = m[1 * 4 + 3]; + const m20 = m[2 * 4 + 0]; + const m21 = m[2 * 4 + 1]; + const m22 = m[2 * 4 + 2]; + const m23 = m[2 * 4 + 3]; + const m30 = m[3 * 4 + 0]; + const m31 = m[3 * 4 + 1]; + const m32 = m[3 * 4 + 2]; + const m33 = m[3 * 4 + 3]; + const tmp0 = m22 * m33; + const tmp1 = m32 * m23; + const tmp2 = m12 * m33; + const tmp3 = m32 * m13; + const tmp4 = m12 * m23; + const tmp5 = m22 * m13; + const tmp6 = m02 * m33; + const tmp7 = m32 * m03; + const tmp8 = m02 * m23; + const tmp9 = m22 * m03; + const tmp10 = m02 * m13; + const tmp11 = m12 * m03; + const t0 = (tmp0 * m11 + tmp3 * m21 + tmp4 * m31) - + (tmp1 * m11 + tmp2 * m21 + tmp5 * m31); + const t1 = (tmp1 * m01 + tmp6 * m21 + tmp9 * m31) - + (tmp0 * m01 + tmp7 * m21 + tmp8 * m31); + const t2 = (tmp2 * m01 + tmp7 * m11 + tmp10 * m31) - + (tmp3 * m01 + tmp6 * m11 + tmp11 * m31); + const t3 = (tmp5 * m01 + tmp8 * m11 + tmp11 * m21) - + (tmp4 * m01 + tmp9 * m11 + tmp10 * m21); + return m00 * t0 + m10 * t1 + m20 * t2 + m30 * t3; + } + /** + * Computes the inverse of a 4-by-4 matrix. (same as inverse) + * @param m - The matrix. + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns The inverse of m. + */ + const invert = inverse; + /** + * Multiplies two 4-by-4 matrices with a on the left and b on the right + * @param a - The matrix on the left. + * @param b - The matrix on the right. + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns The matrix product of a and b. + */ + function multiply(a, b, dst) { + const newDst = (dst ?? new Ctor(16)); + const a00 = a[0]; + const a01 = a[1]; + const a02 = a[2]; + const a03 = a[3]; + const a10 = a[4 + 0]; + const a11 = a[4 + 1]; + const a12 = a[4 + 2]; + const a13 = a[4 + 3]; + const a20 = a[8 + 0]; + const a21 = a[8 + 1]; + const a22 = a[8 + 2]; + const a23 = a[8 + 3]; + const a30 = a[12 + 0]; + const a31 = a[12 + 1]; + const a32 = a[12 + 2]; + const a33 = a[12 + 3]; + const b00 = b[0]; + const b01 = b[1]; + const b02 = b[2]; + const b03 = b[3]; + const b10 = b[4 + 0]; + const b11 = b[4 + 1]; + const b12 = b[4 + 2]; + const b13 = b[4 + 3]; + const b20 = b[8 + 0]; + const b21 = b[8 + 1]; + const b22 = b[8 + 2]; + const b23 = b[8 + 3]; + const b30 = b[12 + 0]; + const b31 = b[12 + 1]; + const b32 = b[12 + 2]; + const b33 = b[12 + 3]; + newDst[0] = a00 * b00 + a10 * b01 + a20 * b02 + a30 * b03; + newDst[1] = a01 * b00 + a11 * b01 + a21 * b02 + a31 * b03; + newDst[2] = a02 * b00 + a12 * b01 + a22 * b02 + a32 * b03; + newDst[3] = a03 * b00 + a13 * b01 + a23 * b02 + a33 * b03; + newDst[4] = a00 * b10 + a10 * b11 + a20 * b12 + a30 * b13; + newDst[5] = a01 * b10 + a11 * b11 + a21 * b12 + a31 * b13; + newDst[6] = a02 * b10 + a12 * b11 + a22 * b12 + a32 * b13; + newDst[7] = a03 * b10 + a13 * b11 + a23 * b12 + a33 * b13; + newDst[8] = a00 * b20 + a10 * b21 + a20 * b22 + a30 * b23; + newDst[9] = a01 * b20 + a11 * b21 + a21 * b22 + a31 * b23; + newDst[10] = a02 * b20 + a12 * b21 + a22 * b22 + a32 * b23; + newDst[11] = a03 * b20 + a13 * b21 + a23 * b22 + a33 * b23; + newDst[12] = a00 * b30 + a10 * b31 + a20 * b32 + a30 * b33; + newDst[13] = a01 * b30 + a11 * b31 + a21 * b32 + a31 * b33; + newDst[14] = a02 * b30 + a12 * b31 + a22 * b32 + a32 * b33; + newDst[15] = a03 * b30 + a13 * b31 + a23 * b32 + a33 * b33; + return newDst; + } + /** + * Multiplies two 4-by-4 matrices with a on the left and b on the right (same as multiply) + * @param a - The matrix on the left. + * @param b - The matrix on the right. + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns The matrix product of a and b. + */ + const mul = multiply; + /** + * Sets the translation component of a 4-by-4 matrix to the given + * vector. + * @param a - The matrix. + * @param v - The vector. + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns The matrix with translation set. + */ + function setTranslation(a, v, dst) { + const newDst = (dst ?? identity()); + if (a !== newDst) { + newDst[0] = a[0]; + newDst[1] = a[1]; + newDst[2] = a[2]; + newDst[3] = a[3]; + newDst[4] = a[4]; + newDst[5] = a[5]; + newDst[6] = a[6]; + newDst[7] = a[7]; + newDst[8] = a[8]; + newDst[9] = a[9]; + newDst[10] = a[10]; + newDst[11] = a[11]; + } + newDst[12] = v[0]; + newDst[13] = v[1]; + newDst[14] = v[2]; + newDst[15] = 1; + return newDst; + } + ///** + // * Returns the translation component of a 4-by-4 matrix as a vector with 3 + // * entries. + // * @param m - The matrix. + // * @param dst - vector to hold result. If not passed a new one is created. + // * @returns The translation component of m. + // */ + function getTranslation(m, dst) { + const newDst = (dst ?? vec3.create()); + newDst[0] = m[12]; + newDst[1] = m[13]; + newDst[2] = m[14]; + return newDst; + } + /** + * Returns an axis of a 4x4 matrix as a vector with 3 entries + * @param m - The matrix. + * @param axis - The axis 0 = x, 1 = y, 2 = z; + * @returns The axis component of m. + */ + function getAxis(m, axis, dst) { + const newDst = (dst ?? vec3.create()); + const off = axis * 4; + newDst[0] = m[off + 0]; + newDst[1] = m[off + 1]; + newDst[2] = m[off + 2]; + return newDst; + } + /** + * Sets an axis of a 4x4 matrix as a vector with 3 entries + * @param m - The matrix. + * @param v - the axis vector + * @param axis - The axis 0 = x, 1 = y, 2 = z; + * @param dst - The matrix to set. If not passed a new one is created. + * @returns The matrix with axis set. + */ + function setAxis(m, v, axis, dst) { + const newDst = (dst === m) ? dst : copy(m, dst); + const off = axis * 4; + newDst[off + 0] = v[0]; + newDst[off + 1] = v[1]; + newDst[off + 2] = v[2]; + return newDst; + } + ///** + // * Returns the scaling component of the matrix + // * @param m - The Matrix + // * @param dst - The vector to set. If not passed a new one is created. + // */ + function getScaling(m, dst) { + const newDst = (dst ?? vec3.create()); + const xx = m[0]; + const xy = m[1]; + const xz = m[2]; + const yx = m[4]; + const yy = m[5]; + const yz = m[6]; + const zx = m[8]; + const zy = m[9]; + const zz = m[10]; + newDst[0] = Math.sqrt(xx * xx + xy * xy + xz * xz); + newDst[1] = Math.sqrt(yx * yx + yy * yy + yz * yz); + newDst[2] = Math.sqrt(zx * zx + zy * zy + zz * zz); + return newDst; + } + /** + * Computes a 4-by-4 perspective transformation matrix given the angular height + * of the frustum, the aspect ratio, and the near and far clipping planes. The + * arguments define a frustum extending in the negative z direction. The given + * angle is the vertical angle of the frustum, and the horizontal angle is + * determined to produce the given aspect ratio. The arguments near and far are + * the distances to the near and far clipping planes. Note that near and far + * are not z coordinates, but rather they are distances along the negative + * z-axis. The matrix generated sends the viewing frustum to the unit box. + * We assume a unit box extending from -1 to 1 in the x and y dimensions and + * from 0 to 1 in the z dimension. + * + * Note: If you pass `Infinity` for zFar then it will produce a projection matrix + * returns -Infinity for Z when transforming coordinates with Z <= 0 and +Infinity for Z + * otherwise. + * + * @param fieldOfViewYInRadians - The camera angle from top to bottom (in radians). + * @param aspect - The aspect ratio width / height. + * @param zNear - The depth (negative z coordinate) + * of the near clipping plane. + * @param zFar - The depth (negative z coordinate) + * of the far clipping plane. + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns The perspective matrix. + */ + function perspective(fieldOfViewYInRadians, aspect, zNear, zFar, dst) { + const newDst = (dst ?? new Ctor(16)); + const f = Math.tan(Math.PI * 0.5 - 0.5 * fieldOfViewYInRadians); + newDst[0] = f / aspect; + newDst[1] = 0; + newDst[2] = 0; + newDst[3] = 0; + newDst[4] = 0; + newDst[5] = f; + newDst[6] = 0; + newDst[7] = 0; + newDst[8] = 0; + newDst[9] = 0; + newDst[11] = -1; + newDst[12] = 0; + newDst[13] = 0; + newDst[15] = 0; + if (Number.isFinite(zFar)) { + const rangeInv = 1 / (zNear - zFar); + newDst[10] = zFar * rangeInv; + newDst[14] = zFar * zNear * rangeInv; + } + else { + newDst[10] = -1; + newDst[14] = -zNear; + } + return newDst; + } + /** + * Computes a 4-by-4 reverse-z perspective transformation matrix given the angular height + * of the frustum, the aspect ratio, and the near and far clipping planes. The + * arguments define a frustum extending in the negative z direction. The given + * angle is the vertical angle of the frustum, and the horizontal angle is + * determined to produce the given aspect ratio. The arguments near and far are + * the distances to the near and far clipping planes. Note that near and far + * are not z coordinates, but rather they are distances along the negative + * z-axis. The matrix generated sends the viewing frustum to the unit box. + * We assume a unit box extending from -1 to 1 in the x and y dimensions and + * from 1 (at -zNear) to 0 (at -zFar) in the z dimension. + * + * @param fieldOfViewYInRadians - The camera angle from top to bottom (in radians). + * @param aspect - The aspect ratio width / height. + * @param zNear - The depth (negative z coordinate) + * of the near clipping plane. + * @param zFar - The depth (negative z coordinate) + * of the far clipping plane. (default = Infinity) + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns The perspective matrix. + */ function perspectiveReverseZ(fieldOfViewYInRadians, aspect, zNear, zFar = Infinity, dst) { + const newDst = (dst ?? new Ctor(16)); + const f = 1 / Math.tan(fieldOfViewYInRadians * 0.5); + newDst[0] = f / aspect; + newDst[1] = 0; + newDst[2] = 0; + newDst[3] = 0; + newDst[4] = 0; + newDst[5] = f; + newDst[6] = 0; + newDst[7] = 0; + newDst[8] = 0; + newDst[9] = 0; + newDst[11] = -1; + newDst[12] = 0; + newDst[13] = 0; + newDst[15] = 0; + if (zFar === Infinity) { + newDst[10] = 0; + newDst[14] = zNear; + } + else { + const rangeInv = 1 / (zFar - zNear); + newDst[10] = zNear * rangeInv; + newDst[14] = zFar * zNear * rangeInv; + } + return newDst; + } + /** + * Computes a 4-by-4 orthogonal transformation matrix that transforms from + * the given the left, right, bottom, and top dimensions to -1 +1 in x, and y + * and 0 to +1 in z. + * @param left - Left side of the near clipping plane viewport. + * @param right - Right side of the near clipping plane viewport. + * @param bottom - Bottom of the near clipping plane viewport. + * @param top - Top of the near clipping plane viewport. + * @param near - The depth (negative z coordinate) + * of the near clipping plane. + * @param far - The depth (negative z coordinate) + * of the far clipping plane. + * @param dst - Output matrix. If not passed a new one is created. + * @returns The orthographic projection matrix. + */ + function ortho(left, right, bottom, top, near, far, dst) { + const newDst = (dst ?? new Ctor(16)); + newDst[0] = 2 / (right - left); + newDst[1] = 0; + newDst[2] = 0; + newDst[3] = 0; + newDst[4] = 0; + newDst[5] = 2 / (top - bottom); + newDst[6] = 0; + newDst[7] = 0; + newDst[8] = 0; + newDst[9] = 0; + newDst[10] = 1 / (near - far); + newDst[11] = 0; + newDst[12] = (right + left) / (left - right); + newDst[13] = (top + bottom) / (bottom - top); + newDst[14] = near / (near - far); + newDst[15] = 1; + return newDst; + } + /** + * Computes a 4-by-4 perspective transformation matrix given the left, right, + * top, bottom, near and far clipping planes. The arguments define a frustum + * extending in the negative z direction. The arguments near and far are the + * distances to the near and far clipping planes. Note that near and far are not + * z coordinates, but rather they are distances along the negative z-axis. The + * matrix generated sends the viewing frustum to the unit box. We assume a unit + * box extending from -1 to 1 in the x and y dimensions and from 0 to 1 in the z + * dimension. + * @param left - The x coordinate of the left plane of the box. + * @param right - The x coordinate of the right plane of the box. + * @param bottom - The y coordinate of the bottom plane of the box. + * @param top - The y coordinate of the right plane of the box. + * @param near - The negative z coordinate of the near plane of the box. + * @param far - The negative z coordinate of the far plane of the box. + * @param dst - Output matrix. If not passed a new one is created. + * @returns The perspective projection matrix. + */ + function frustum(left, right, bottom, top, near, far, dst) { + const newDst = (dst ?? new Ctor(16)); + const dx = (right - left); + const dy = (top - bottom); + const dz = (near - far); + newDst[0] = 2 * near / dx; + newDst[1] = 0; + newDst[2] = 0; + newDst[3] = 0; + newDst[4] = 0; + newDst[5] = 2 * near / dy; + newDst[6] = 0; + newDst[7] = 0; + newDst[8] = (left + right) / dx; + newDst[9] = (top + bottom) / dy; + newDst[10] = far / dz; + newDst[11] = -1; + newDst[12] = 0; + newDst[13] = 0; + newDst[14] = near * far / dz; + newDst[15] = 0; + return newDst; + } + /** + * Computes a 4-by-4 reverse-z perspective transformation matrix given the left, right, + * top, bottom, near and far clipping planes. The arguments define a frustum + * extending in the negative z direction. The arguments near and far are the + * distances to the near and far clipping planes. Note that near and far are not + * z coordinates, but rather they are distances along the negative z-axis. The + * matrix generated sends the viewing frustum to the unit box. We assume a unit + * box extending from -1 to 1 in the x and y dimensions and from 1 (-near) to 0 (-far) in the z + * dimension. + * @param left - The x coordinate of the left plane of the box. + * @param right - The x coordinate of the right plane of the box. + * @param bottom - The y coordinate of the bottom plane of the box. + * @param top - The y coordinate of the right plane of the box. + * @param near - The negative z coordinate of the near plane of the box. + * @param far - The negative z coordinate of the far plane of the box. + * @param dst - Output matrix. If not passed a new one is created. + * @returns The perspective projection matrix. + */ + function frustumReverseZ(left, right, bottom, top, near, far = Infinity, dst) { + const newDst = (dst ?? new Ctor(16)); + const dx = (right - left); + const dy = (top - bottom); + newDst[0] = 2 * near / dx; + newDst[1] = 0; + newDst[2] = 0; + newDst[3] = 0; + newDst[4] = 0; + newDst[5] = 2 * near / dy; + newDst[6] = 0; + newDst[7] = 0; + newDst[8] = (left + right) / dx; + newDst[9] = (top + bottom) / dy; + newDst[11] = -1; + newDst[12] = 0; + newDst[13] = 0; + newDst[15] = 0; + if (far === Infinity) { + newDst[10] = 0; + newDst[14] = near; + } + else { + const rangeInv = 1 / (far - near); + newDst[10] = near * rangeInv; + newDst[14] = far * near * rangeInv; + } + return newDst; + } + const xAxis = vec3.create(); + const yAxis = vec3.create(); + const zAxis = vec3.create(); + /** + * Computes a 4-by-4 aim transformation. + * + * This is a matrix which positions an object aiming down positive Z. + * toward the target. + * + * Note: this is **NOT** the inverse of lookAt as lookAt looks at negative Z. + * + * @param position - The position of the object. + * @param target - The position meant to be aimed at. + * @param up - A vector pointing up. + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns The aim matrix. + */ + function aim(position, target, up, dst) { + const newDst = (dst ?? new Ctor(16)); + vec3.normalize(vec3.subtract(target, position, zAxis), zAxis); + vec3.normalize(vec3.cross(up, zAxis, xAxis), xAxis); + vec3.normalize(vec3.cross(zAxis, xAxis, yAxis), yAxis); + newDst[0] = xAxis[0]; + newDst[1] = xAxis[1]; + newDst[2] = xAxis[2]; + newDst[3] = 0; + newDst[4] = yAxis[0]; + newDst[5] = yAxis[1]; + newDst[6] = yAxis[2]; + newDst[7] = 0; + newDst[8] = zAxis[0]; + newDst[9] = zAxis[1]; + newDst[10] = zAxis[2]; + newDst[11] = 0; + newDst[12] = position[0]; + newDst[13] = position[1]; + newDst[14] = position[2]; + newDst[15] = 1; + return newDst; + } + /** + * Computes a 4-by-4 camera aim transformation. + * + * This is a matrix which positions an object aiming down negative Z. + * toward the target. + * + * Note: this is the inverse of `lookAt` + * + * @param eye - The position of the object. + * @param target - The position meant to be aimed at. + * @param up - A vector pointing up. + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns The aim matrix. + */ + function cameraAim(eye, target, up, dst) { + const newDst = (dst ?? new Ctor(16)); + vec3.normalize(vec3.subtract(eye, target, zAxis), zAxis); + vec3.normalize(vec3.cross(up, zAxis, xAxis), xAxis); + vec3.normalize(vec3.cross(zAxis, xAxis, yAxis), yAxis); + newDst[0] = xAxis[0]; + newDst[1] = xAxis[1]; + newDst[2] = xAxis[2]; + newDst[3] = 0; + newDst[4] = yAxis[0]; + newDst[5] = yAxis[1]; + newDst[6] = yAxis[2]; + newDst[7] = 0; + newDst[8] = zAxis[0]; + newDst[9] = zAxis[1]; + newDst[10] = zAxis[2]; + newDst[11] = 0; + newDst[12] = eye[0]; + newDst[13] = eye[1]; + newDst[14] = eye[2]; + newDst[15] = 1; + return newDst; + } + /** + * Computes a 4-by-4 view transformation. + * + * This is a view matrix which transforms all other objects + * to be in the space of the view defined by the parameters. + * + * @param eye - The position of the object. + * @param target - The position meant to be aimed at. + * @param up - A vector pointing up. + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns The look-at matrix. + */ + function lookAt(eye, target, up, dst) { + const newDst = (dst ?? new Ctor(16)); + vec3.normalize(vec3.subtract(eye, target, zAxis), zAxis); + vec3.normalize(vec3.cross(up, zAxis, xAxis), xAxis); + vec3.normalize(vec3.cross(zAxis, xAxis, yAxis), yAxis); + newDst[0] = xAxis[0]; + newDst[1] = yAxis[0]; + newDst[2] = zAxis[0]; + newDst[3] = 0; + newDst[4] = xAxis[1]; + newDst[5] = yAxis[1]; + newDst[6] = zAxis[1]; + newDst[7] = 0; + newDst[8] = xAxis[2]; + newDst[9] = yAxis[2]; + newDst[10] = zAxis[2]; + newDst[11] = 0; + newDst[12] = -(xAxis[0] * eye[0] + xAxis[1] * eye[1] + xAxis[2] * eye[2]); + newDst[13] = -(yAxis[0] * eye[0] + yAxis[1] * eye[1] + yAxis[2] * eye[2]); + newDst[14] = -(zAxis[0] * eye[0] + zAxis[1] * eye[1] + zAxis[2] * eye[2]); + newDst[15] = 1; + return newDst; + } + /** + * Creates a 4-by-4 matrix which translates by the given vector v. + * @param v - The vector by + * which to translate. + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns The translation matrix. + */ + function translation(v, dst) { + const newDst = (dst ?? new Ctor(16)); + newDst[0] = 1; + newDst[1] = 0; + newDst[2] = 0; + newDst[3] = 0; + newDst[4] = 0; + newDst[5] = 1; + newDst[6] = 0; + newDst[7] = 0; + newDst[8] = 0; + newDst[9] = 0; + newDst[10] = 1; + newDst[11] = 0; + newDst[12] = v[0]; + newDst[13] = v[1]; + newDst[14] = v[2]; + newDst[15] = 1; + return newDst; + } + /** + * Translates the given 4-by-4 matrix by the given vector v. + * @param m - The matrix. + * @param v - The vector by + * which to translate. + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns The translated matrix. + */ + function translate(m, v, dst) { + const newDst = (dst ?? new Ctor(16)); + const v0 = v[0]; + const v1 = v[1]; + const v2 = v[2]; + const m00 = m[0]; + const m01 = m[1]; + const m02 = m[2]; + const m03 = m[3]; + const m10 = m[1 * 4 + 0]; + const m11 = m[1 * 4 + 1]; + const m12 = m[1 * 4 + 2]; + const m13 = m[1 * 4 + 3]; + const m20 = m[2 * 4 + 0]; + const m21 = m[2 * 4 + 1]; + const m22 = m[2 * 4 + 2]; + const m23 = m[2 * 4 + 3]; + const m30 = m[3 * 4 + 0]; + const m31 = m[3 * 4 + 1]; + const m32 = m[3 * 4 + 2]; + const m33 = m[3 * 4 + 3]; + if (m !== newDst) { + newDst[0] = m00; + newDst[1] = m01; + newDst[2] = m02; + newDst[3] = m03; + newDst[4] = m10; + newDst[5] = m11; + newDst[6] = m12; + newDst[7] = m13; + newDst[8] = m20; + newDst[9] = m21; + newDst[10] = m22; + newDst[11] = m23; + } + newDst[12] = m00 * v0 + m10 * v1 + m20 * v2 + m30; + newDst[13] = m01 * v0 + m11 * v1 + m21 * v2 + m31; + newDst[14] = m02 * v0 + m12 * v1 + m22 * v2 + m32; + newDst[15] = m03 * v0 + m13 * v1 + m23 * v2 + m33; + return newDst; + } + /** + * Creates a 4-by-4 matrix which rotates around the x-axis by the given angle. + * @param angleInRadians - The angle by which to rotate (in radians). + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns The rotation matrix. + */ + function rotationX(angleInRadians, dst) { + const newDst = (dst ?? new Ctor(16)); + const c = Math.cos(angleInRadians); + const s = Math.sin(angleInRadians); + newDst[0] = 1; + newDst[1] = 0; + newDst[2] = 0; + newDst[3] = 0; + newDst[4] = 0; + newDst[5] = c; + newDst[6] = s; + newDst[7] = 0; + newDst[8] = 0; + newDst[9] = -s; + newDst[10] = c; + newDst[11] = 0; + newDst[12] = 0; + newDst[13] = 0; + newDst[14] = 0; + newDst[15] = 1; + return newDst; + } + /** + * Rotates the given 4-by-4 matrix around the x-axis by the given + * angle. + * @param m - The matrix. + * @param angleInRadians - The angle by which to rotate (in radians). + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns The rotated matrix. + */ + function rotateX(m, angleInRadians, dst) { + const newDst = (dst ?? new Ctor(16)); + const m10 = m[4]; + const m11 = m[5]; + const m12 = m[6]; + const m13 = m[7]; + const m20 = m[8]; + const m21 = m[9]; + const m22 = m[10]; + const m23 = m[11]; + const c = Math.cos(angleInRadians); + const s = Math.sin(angleInRadians); + newDst[4] = c * m10 + s * m20; + newDst[5] = c * m11 + s * m21; + newDst[6] = c * m12 + s * m22; + newDst[7] = c * m13 + s * m23; + newDst[8] = c * m20 - s * m10; + newDst[9] = c * m21 - s * m11; + newDst[10] = c * m22 - s * m12; + newDst[11] = c * m23 - s * m13; + if (m !== newDst) { + newDst[0] = m[0]; + newDst[1] = m[1]; + newDst[2] = m[2]; + newDst[3] = m[3]; + newDst[12] = m[12]; + newDst[13] = m[13]; + newDst[14] = m[14]; + newDst[15] = m[15]; + } + return newDst; + } + /** + * Creates a 4-by-4 matrix which rotates around the y-axis by the given angle. + * @param angleInRadians - The angle by which to rotate (in radians). + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns The rotation matrix. + */ + function rotationY(angleInRadians, dst) { + const newDst = (dst ?? new Ctor(16)); + const c = Math.cos(angleInRadians); + const s = Math.sin(angleInRadians); + newDst[0] = c; + newDst[1] = 0; + newDst[2] = -s; + newDst[3] = 0; + newDst[4] = 0; + newDst[5] = 1; + newDst[6] = 0; + newDst[7] = 0; + newDst[8] = s; + newDst[9] = 0; + newDst[10] = c; + newDst[11] = 0; + newDst[12] = 0; + newDst[13] = 0; + newDst[14] = 0; + newDst[15] = 1; + return newDst; + } + /** + * Rotates the given 4-by-4 matrix around the y-axis by the given + * angle. + * @param m - The matrix. + * @param angleInRadians - The angle by which to rotate (in radians). + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns The rotated matrix. + */ + function rotateY(m, angleInRadians, dst) { + const newDst = (dst ?? new Ctor(16)); + const m00 = m[0 * 4 + 0]; + const m01 = m[0 * 4 + 1]; + const m02 = m[0 * 4 + 2]; + const m03 = m[0 * 4 + 3]; + const m20 = m[2 * 4 + 0]; + const m21 = m[2 * 4 + 1]; + const m22 = m[2 * 4 + 2]; + const m23 = m[2 * 4 + 3]; + const c = Math.cos(angleInRadians); + const s = Math.sin(angleInRadians); + newDst[0] = c * m00 - s * m20; + newDst[1] = c * m01 - s * m21; + newDst[2] = c * m02 - s * m22; + newDst[3] = c * m03 - s * m23; + newDst[8] = c * m20 + s * m00; + newDst[9] = c * m21 + s * m01; + newDst[10] = c * m22 + s * m02; + newDst[11] = c * m23 + s * m03; + if (m !== newDst) { + newDst[4] = m[4]; + newDst[5] = m[5]; + newDst[6] = m[6]; + newDst[7] = m[7]; + newDst[12] = m[12]; + newDst[13] = m[13]; + newDst[14] = m[14]; + newDst[15] = m[15]; + } + return newDst; + } + /** + * Creates a 4-by-4 matrix which rotates around the z-axis by the given angle. + * @param angleInRadians - The angle by which to rotate (in radians). + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns The rotation matrix. + */ + function rotationZ(angleInRadians, dst) { + const newDst = (dst ?? new Ctor(16)); + const c = Math.cos(angleInRadians); + const s = Math.sin(angleInRadians); + newDst[0] = c; + newDst[1] = s; + newDst[2] = 0; + newDst[3] = 0; + newDst[4] = -s; + newDst[5] = c; + newDst[6] = 0; + newDst[7] = 0; + newDst[8] = 0; + newDst[9] = 0; + newDst[10] = 1; + newDst[11] = 0; + newDst[12] = 0; + newDst[13] = 0; + newDst[14] = 0; + newDst[15] = 1; + return newDst; + } + /** + * Rotates the given 4-by-4 matrix around the z-axis by the given + * angle. + * @param m - The matrix. + * @param angleInRadians - The angle by which to rotate (in radians). + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns The rotated matrix. + */ + function rotateZ(m, angleInRadians, dst) { + const newDst = (dst ?? new Ctor(16)); + const m00 = m[0 * 4 + 0]; + const m01 = m[0 * 4 + 1]; + const m02 = m[0 * 4 + 2]; + const m03 = m[0 * 4 + 3]; + const m10 = m[1 * 4 + 0]; + const m11 = m[1 * 4 + 1]; + const m12 = m[1 * 4 + 2]; + const m13 = m[1 * 4 + 3]; + const c = Math.cos(angleInRadians); + const s = Math.sin(angleInRadians); + newDst[0] = c * m00 + s * m10; + newDst[1] = c * m01 + s * m11; + newDst[2] = c * m02 + s * m12; + newDst[3] = c * m03 + s * m13; + newDst[4] = c * m10 - s * m00; + newDst[5] = c * m11 - s * m01; + newDst[6] = c * m12 - s * m02; + newDst[7] = c * m13 - s * m03; + if (m !== newDst) { + newDst[8] = m[8]; + newDst[9] = m[9]; + newDst[10] = m[10]; + newDst[11] = m[11]; + newDst[12] = m[12]; + newDst[13] = m[13]; + newDst[14] = m[14]; + newDst[15] = m[15]; + } + return newDst; + } + /** + * Creates a 4-by-4 matrix which rotates around the given axis by the given + * angle. + * @param axis - The axis + * about which to rotate. + * @param angleInRadians - The angle by which to rotate (in radians). + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns A matrix which rotates angle radians + * around the axis. + */ + function axisRotation(axis, angleInRadians, dst) { + const newDst = (dst ?? new Ctor(16)); + let x = axis[0]; + let y = axis[1]; + let z = axis[2]; + const n = Math.sqrt(x * x + y * y + z * z); + x /= n; + y /= n; + z /= n; + const xx = x * x; + const yy = y * y; + const zz = z * z; + const c = Math.cos(angleInRadians); + const s = Math.sin(angleInRadians); + const oneMinusCosine = 1 - c; + newDst[0] = xx + (1 - xx) * c; + newDst[1] = x * y * oneMinusCosine + z * s; + newDst[2] = x * z * oneMinusCosine - y * s; + newDst[3] = 0; + newDst[4] = x * y * oneMinusCosine - z * s; + newDst[5] = yy + (1 - yy) * c; + newDst[6] = y * z * oneMinusCosine + x * s; + newDst[7] = 0; + newDst[8] = x * z * oneMinusCosine + y * s; + newDst[9] = y * z * oneMinusCosine - x * s; + newDst[10] = zz + (1 - zz) * c; + newDst[11] = 0; + newDst[12] = 0; + newDst[13] = 0; + newDst[14] = 0; + newDst[15] = 1; + return newDst; + } + /** + * Creates a 4-by-4 matrix which rotates around the given axis by the given + * angle. (same as axisRotation) + * @param axis - The axis + * about which to rotate. + * @param angleInRadians - The angle by which to rotate (in radians). + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns A matrix which rotates angle radians + * around the axis. + */ + const rotation = axisRotation; + /** + * Rotates the given 4-by-4 matrix around the given axis by the + * given angle. + * @param m - The matrix. + * @param axis - The axis + * about which to rotate. + * @param angleInRadians - The angle by which to rotate (in radians). + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns The rotated matrix. + */ + function axisRotate(m, axis, angleInRadians, dst) { + const newDst = (dst ?? new Ctor(16)); + let x = axis[0]; + let y = axis[1]; + let z = axis[2]; + const n = Math.sqrt(x * x + y * y + z * z); + x /= n; + y /= n; + z /= n; + const xx = x * x; + const yy = y * y; + const zz = z * z; + const c = Math.cos(angleInRadians); + const s = Math.sin(angleInRadians); + const oneMinusCosine = 1 - c; + const r00 = xx + (1 - xx) * c; + const r01 = x * y * oneMinusCosine + z * s; + const r02 = x * z * oneMinusCosine - y * s; + const r10 = x * y * oneMinusCosine - z * s; + const r11 = yy + (1 - yy) * c; + const r12 = y * z * oneMinusCosine + x * s; + const r20 = x * z * oneMinusCosine + y * s; + const r21 = y * z * oneMinusCosine - x * s; + const r22 = zz + (1 - zz) * c; + const m00 = m[0]; + const m01 = m[1]; + const m02 = m[2]; + const m03 = m[3]; + const m10 = m[4]; + const m11 = m[5]; + const m12 = m[6]; + const m13 = m[7]; + const m20 = m[8]; + const m21 = m[9]; + const m22 = m[10]; + const m23 = m[11]; + newDst[0] = r00 * m00 + r01 * m10 + r02 * m20; + newDst[1] = r00 * m01 + r01 * m11 + r02 * m21; + newDst[2] = r00 * m02 + r01 * m12 + r02 * m22; + newDst[3] = r00 * m03 + r01 * m13 + r02 * m23; + newDst[4] = r10 * m00 + r11 * m10 + r12 * m20; + newDst[5] = r10 * m01 + r11 * m11 + r12 * m21; + newDst[6] = r10 * m02 + r11 * m12 + r12 * m22; + newDst[7] = r10 * m03 + r11 * m13 + r12 * m23; + newDst[8] = r20 * m00 + r21 * m10 + r22 * m20; + newDst[9] = r20 * m01 + r21 * m11 + r22 * m21; + newDst[10] = r20 * m02 + r21 * m12 + r22 * m22; + newDst[11] = r20 * m03 + r21 * m13 + r22 * m23; + if (m !== newDst) { + newDst[12] = m[12]; + newDst[13] = m[13]; + newDst[14] = m[14]; + newDst[15] = m[15]; + } + return newDst; + } + /** + * Rotates the given 4-by-4 matrix around the given axis by the + * given angle. (same as rotate) + * @param m - The matrix. + * @param axis - The axis + * about which to rotate. + * @param angleInRadians - The angle by which to rotate (in radians). + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns The rotated matrix. + */ + const rotate = axisRotate; + /** + * Creates a 4-by-4 matrix which scales in each dimension by an amount given by + * the corresponding entry in the given vector; assumes the vector has three + * entries. + * @param v - A vector of + * three entries specifying the factor by which to scale in each dimension. + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns The scaling matrix. + */ + function scaling(v, dst) { + const newDst = (dst ?? new Ctor(16)); + newDst[0] = v[0]; + newDst[1] = 0; + newDst[2] = 0; + newDst[3] = 0; + newDst[4] = 0; + newDst[5] = v[1]; + newDst[6] = 0; + newDst[7] = 0; + newDst[8] = 0; + newDst[9] = 0; + newDst[10] = v[2]; + newDst[11] = 0; + newDst[12] = 0; + newDst[13] = 0; + newDst[14] = 0; + newDst[15] = 1; + return newDst; + } + /** + * Scales the given 4-by-4 matrix in each dimension by an amount + * given by the corresponding entry in the given vector; assumes the vector has + * three entries. + * @param m - The matrix to be modified. + * @param v - A vector of three entries specifying the + * factor by which to scale in each dimension. + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns The scaled matrix. + */ + function scale(m, v, dst) { + const newDst = (dst ?? new Ctor(16)); + const v0 = v[0]; + const v1 = v[1]; + const v2 = v[2]; + newDst[0] = v0 * m[0 * 4 + 0]; + newDst[1] = v0 * m[0 * 4 + 1]; + newDst[2] = v0 * m[0 * 4 + 2]; + newDst[3] = v0 * m[0 * 4 + 3]; + newDst[4] = v1 * m[1 * 4 + 0]; + newDst[5] = v1 * m[1 * 4 + 1]; + newDst[6] = v1 * m[1 * 4 + 2]; + newDst[7] = v1 * m[1 * 4 + 3]; + newDst[8] = v2 * m[2 * 4 + 0]; + newDst[9] = v2 * m[2 * 4 + 1]; + newDst[10] = v2 * m[2 * 4 + 2]; + newDst[11] = v2 * m[2 * 4 + 3]; + if (m !== newDst) { + newDst[12] = m[12]; + newDst[13] = m[13]; + newDst[14] = m[14]; + newDst[15] = m[15]; + } + return newDst; + } + /** + * Creates a 4-by-4 matrix which scales a uniform amount in each dimension. + * @param s - the amount to scale + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns The scaling matrix. + */ + function uniformScaling(s, dst) { + const newDst = (dst ?? new Ctor(16)); + newDst[0] = s; + newDst[1] = 0; + newDst[2] = 0; + newDst[3] = 0; + newDst[4] = 0; + newDst[5] = s; + newDst[6] = 0; + newDst[7] = 0; + newDst[8] = 0; + newDst[9] = 0; + newDst[10] = s; + newDst[11] = 0; + newDst[12] = 0; + newDst[13] = 0; + newDst[14] = 0; + newDst[15] = 1; + return newDst; + } + /** + * Scales the given 4-by-4 matrix in each dimension by a uniform scale. + * @param m - The matrix to be modified. + * @param s - The amount to scale. + * @param dst - matrix to hold result. If not passed a new one is created. + * @returns The scaled matrix. + */ + function uniformScale(m, s, dst) { + const newDst = (dst ?? new Ctor(16)); + newDst[0] = s * m[0 * 4 + 0]; + newDst[1] = s * m[0 * 4 + 1]; + newDst[2] = s * m[0 * 4 + 2]; + newDst[3] = s * m[0 * 4 + 3]; + newDst[4] = s * m[1 * 4 + 0]; + newDst[5] = s * m[1 * 4 + 1]; + newDst[6] = s * m[1 * 4 + 2]; + newDst[7] = s * m[1 * 4 + 3]; + newDst[8] = s * m[2 * 4 + 0]; + newDst[9] = s * m[2 * 4 + 1]; + newDst[10] = s * m[2 * 4 + 2]; + newDst[11] = s * m[2 * 4 + 3]; + if (m !== newDst) { + newDst[12] = m[12]; + newDst[13] = m[13]; + newDst[14] = m[14]; + newDst[15] = m[15]; + } + return newDst; + } + return { + create, + set, + fromMat3, + fromQuat, + negate, + copy, + clone, + equalsApproximately, + equals, + identity, + transpose, + inverse, + determinant, + invert, + multiply, + mul, + setTranslation, + getTranslation, + getAxis, + setAxis, + getScaling, + perspective, + perspectiveReverseZ, + ortho, + frustum, + frustumReverseZ, + aim, + cameraAim, + lookAt, + translation, + translate, + rotationX, + rotateX, + rotationY, + rotateY, + rotationZ, + rotateZ, + axisRotation, + rotation, + axisRotate, + rotate, + scaling, + scale, + uniformScaling, + uniformScale, + }; + } + const cache$2 = new Map(); + function getAPI$2(Ctor) { + let api = cache$2.get(Ctor); + if (!api) { + api = getAPIImpl$2(Ctor); + cache$2.set(Ctor, api); + } + return api; + } + + /* + * Copyright 2022 Gregg Tavares + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + /** + * Generates am typed API for Qud + * */ + function getAPIImpl$1(Ctor) { + const vec3 = getAPI$3(Ctor); + /** + * Creates a quat4; may be called with x, y, z to set initial values. + * @param x - Initial x value. + * @param y - Initial y value. + * @param z - Initial z value. + * @param w - Initial w value. + * @returns the created vector + */ + function create(x, y, z, w) { + const newDst = new Ctor(4); + if (x !== undefined) { + newDst[0] = x; + if (y !== undefined) { + newDst[1] = y; + if (z !== undefined) { + newDst[2] = z; + if (w !== undefined) { + newDst[3] = w; + } + } + } + } + return newDst; + } + /** + * Creates a Quat; may be called with x, y, z to set initial values. (same as create) + * @param x - Initial x value. + * @param y - Initial y value. + * @param z - Initial z value. + * @param z - Initial w value. + * @returns the created vector + */ + const fromValues = create; + /** + * Sets the values of a Quat + * Also see {@link quat.create} and {@link quat.copy} + * + * @param x first value + * @param y second value + * @param z third value + * @param w fourth value + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns A vector with its elements set. + */ + function set(x, y, z, w, dst) { + const newDst = (dst ?? new Ctor(4)); + newDst[0] = x; + newDst[1] = y; + newDst[2] = z; + newDst[3] = w; + return newDst; + } + /** + * Sets a quaternion from the given angle and axis, + * then returns it. + * + * @param axis - the axis to rotate around + * @param angleInRadians - the angle + * @param dst - quaternion to hold result. If not passed in a new one is created. + * @returns The quaternion that represents the given axis and angle + **/ + function fromAxisAngle(axis, angleInRadians, dst) { + const newDst = (dst ?? new Ctor(4)); + const halfAngle = angleInRadians * 0.5; + const s = Math.sin(halfAngle); + newDst[0] = s * axis[0]; + newDst[1] = s * axis[1]; + newDst[2] = s * axis[2]; + newDst[3] = Math.cos(halfAngle); + return newDst; + } + /** + * Gets the rotation axis and angle + * @param q - quaternion to compute from + * @param dst - Vec3 to hold result. If not passed in a new one is created. + * @return angle and axis + */ + function toAxisAngle(q, dst) { + const newDst = (dst ?? vec3.create(3)); + const angle = Math.acos(q[3]) * 2; + const s = Math.sin(angle * 0.5); + if (s > EPSILON) { + newDst[0] = q[0] / s; + newDst[1] = q[1] / s; + newDst[2] = q[2] / s; + } + else { + newDst[0] = 1; + newDst[1] = 0; + newDst[2] = 0; + } + return { angle, axis: newDst }; + } + /** + * Returns the angle in degrees between two rotations a and b. + * @param a - quaternion a + * @param b - quaternion b + * @return angle in radians between the two quaternions + */ + function angle(a, b) { + const d = dot(a, b); + return Math.acos(2 * d * d - 1); + } + /** + * Multiplies two quaternions + * + * @param a - the first quaternion + * @param b - the second quaternion + * @param dst - quaternion to hold result. If not passed in a new one is created. + * @returns A quaternion that is the result of a * b + */ + function multiply(a, b, dst) { + const newDst = (dst ?? new Ctor(4)); + const ax = a[0]; + const ay = a[1]; + const az = a[2]; + const aw = a[3]; + const bx = b[0]; + const by = b[1]; + const bz = b[2]; + const bw = b[3]; + newDst[0] = ax * bw + aw * bx + ay * bz - az * by; + newDst[1] = ay * bw + aw * by + az * bx - ax * bz; + newDst[2] = az * bw + aw * bz + ax * by - ay * bx; + newDst[3] = aw * bw - ax * bx - ay * by - az * bz; + return newDst; + } + /** + * Multiplies two quaternions + * + * @param a - the first quaternion + * @param b - the second quaternion + * @param dst - quaternion to hold result. If not passed in a new one is created. + * @returns A quaternion that is the result of a * b + */ + const mul = multiply; + /** + * Rotates the given quaternion around the X axis by the given angle. + * @param q - quaternion to rotate + * @param angleInRadians - The angle by which to rotate + * @param dst - quaternion to hold result. If not passed in a new one is created. + * @returns A quaternion that is the result of a * b + */ + function rotateX(q, angleInRadians, dst) { + const newDst = (dst ?? new Ctor(4)); + const halfAngle = angleInRadians * 0.5; + const qx = q[0]; + const qy = q[1]; + const qz = q[2]; + const qw = q[3]; + const bx = Math.sin(halfAngle); + const bw = Math.cos(halfAngle); + newDst[0] = qx * bw + qw * bx; + newDst[1] = qy * bw + qz * bx; + newDst[2] = qz * bw - qy * bx; + newDst[3] = qw * bw - qx * bx; + return newDst; + } + /** + * Rotates the given quaternion around the Y axis by the given angle. + * @param q - quaternion to rotate + * @param angleInRadians - The angle by which to rotate + * @param dst - quaternion to hold result. If not passed in a new one is created. + * @returns A quaternion that is the result of a * b + */ + function rotateY(q, angleInRadians, dst) { + const newDst = (dst ?? new Ctor(4)); + const halfAngle = angleInRadians * 0.5; + const qx = q[0]; + const qy = q[1]; + const qz = q[2]; + const qw = q[3]; + const by = Math.sin(halfAngle); + const bw = Math.cos(halfAngle); + newDst[0] = qx * bw - qz * by; + newDst[1] = qy * bw + qw * by; + newDst[2] = qz * bw + qx * by; + newDst[3] = qw * bw - qy * by; + return newDst; + } + /** + * Rotates the given quaternion around the Z axis by the given angle. + * @param q - quaternion to rotate + * @param angleInRadians - The angle by which to rotate + * @param dst - quaternion to hold result. If not passed in a new one is created. + * @returns A quaternion that is the result of a * b + */ + function rotateZ(q, angleInRadians, dst) { + const newDst = (dst ?? new Ctor(4)); + const halfAngle = angleInRadians * 0.5; + const qx = q[0]; + const qy = q[1]; + const qz = q[2]; + const qw = q[3]; + const bz = Math.sin(halfAngle); + const bw = Math.cos(halfAngle); + newDst[0] = qx * bw + qy * bz; + newDst[1] = qy * bw - qx * bz; + newDst[2] = qz * bw + qw * bz; + newDst[3] = qw * bw - qz * bz; + return newDst; + } + /** + * Spherically linear interpolate between two quaternions + * + * @param a - starting value + * @param b - ending value + * @param t - value where 0 = a and 1 = b + * @param dst - quaternion to hold result. If not passed in a new one is created. + * @returns A quaternion that is the result of a * b + */ + function slerp(a, b, t, dst) { + const newDst = (dst ?? new Ctor(4)); + const ax = a[0]; + const ay = a[1]; + const az = a[2]; + const aw = a[3]; + let bx = b[0]; + let by = b[1]; + let bz = b[2]; + let bw = b[3]; + let cosOmega = ax * bx + ay * by + az * bz + aw * bw; + if (cosOmega < 0) { + cosOmega = -cosOmega; + bx = -bx; + by = -by; + bz = -bz; + bw = -bw; + } + let scale0; + let scale1; + if (1.0 - cosOmega > EPSILON) { + const omega = Math.acos(cosOmega); + const sinOmega = Math.sin(omega); + scale0 = Math.sin((1 - t) * omega) / sinOmega; + scale1 = Math.sin(t * omega) / sinOmega; + } + else { + scale0 = 1.0 - t; + scale1 = t; + } + newDst[0] = scale0 * ax + scale1 * bx; + newDst[1] = scale0 * ay + scale1 * by; + newDst[2] = scale0 * az + scale1 * bz; + newDst[3] = scale0 * aw + scale1 * bw; + return newDst; + } + /** + * Compute the inverse of a quaternion + * + * @param q - quaternion to compute the inverse of + * @returns A quaternion that is the result of a * b + */ + function inverse(q, dst) { + const newDst = (dst ?? new Ctor(4)); + const a0 = q[0]; + const a1 = q[1]; + const a2 = q[2]; + const a3 = q[3]; + const dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3; + const invDot = dot ? 1 / dot : 0; + newDst[0] = -a0 * invDot; + newDst[1] = -a1 * invDot; + newDst[2] = -a2 * invDot; + newDst[3] = a3 * invDot; + return newDst; + } + /** + * Compute the conjugate of a quaternion + * For quaternions with a magnitude of 1 (a unit quaternion) + * this returns the same as the inverse but is faster to calculate. + * + * @param q - quaternion to compute the conjugate of. + * @param dst - quaternion to hold result. If not passed in a new one is created. + * @returns The conjugate of q + */ + function conjugate(q, dst) { + const newDst = (dst ?? new Ctor(4)); + newDst[0] = -q[0]; + newDst[1] = -q[1]; + newDst[2] = -q[2]; + newDst[3] = q[3]; + return newDst; + } + /** + * Creates a quaternion from the given rotation matrix. + * + * The created quaternion is not normalized. + * + * @param m - rotation matrix + * @param dst - quaternion to hold result. If not passed in a new one is created. + * @returns the result + */ + function fromMat(m, dst) { + const newDst = (dst ?? new Ctor(4)); + /* + 0 1 2 + 3 4 5 + 6 7 8 + + 0 1 2 + 4 5 6 + 8 9 10 + */ + // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes + // article "Quaternion Calculus and Fast Animation". + const trace = m[0] + m[5] + m[10]; + if (trace > 0.0) { + // |w| > 1/2, may as well choose w > 1/2 + const root = Math.sqrt(trace + 1); // 2w + newDst[3] = 0.5 * root; + const invRoot = 0.5 / root; // 1/(4w) + newDst[0] = (m[6] - m[9]) * invRoot; + newDst[1] = (m[8] - m[2]) * invRoot; + newDst[2] = (m[1] - m[4]) * invRoot; + } + else { + // |w| <= 1/2 + let i = 0; + if (m[5] > m[0]) { + i = 1; + } + if (m[10] > m[i * 4 + i]) { + i = 2; + } + const j = (i + 1) % 3; + const k = (i + 2) % 3; + const root = Math.sqrt(m[i * 4 + i] - m[j * 4 + j] - m[k * 4 + k] + 1.0); + newDst[i] = 0.5 * root; + const invRoot = 0.5 / root; + newDst[3] = (m[j * 4 + k] - m[k * 4 + j]) * invRoot; + newDst[j] = (m[j * 4 + i] + m[i * 4 + j]) * invRoot; + newDst[k] = (m[k * 4 + i] + m[i * 4 + k]) * invRoot; + } + return newDst; + } + /** + * Creates a quaternion from the given euler angle x, y, z using the provided intrinsic order for the conversion. + * + * @param xAngleInRadians - angle to rotate around X axis in radians. + * @param yAngleInRadians - angle to rotate around Y axis in radians. + * @param zAngleInRadians - angle to rotate around Z axis in radians. + * @param order - order to apply euler angles + * @param dst - quaternion to hold result. If not passed in a new one is created. + * @returns A quaternion representing the same rotation as the euler angles applied in the given order + */ + function fromEuler(xAngleInRadians, yAngleInRadians, zAngleInRadians, order, dst) { + const newDst = (dst ?? new Ctor(4)); + const xHalfAngle = xAngleInRadians * 0.5; + const yHalfAngle = yAngleInRadians * 0.5; + const zHalfAngle = zAngleInRadians * 0.5; + const sx = Math.sin(xHalfAngle); + const cx = Math.cos(xHalfAngle); + const sy = Math.sin(yHalfAngle); + const cy = Math.cos(yHalfAngle); + const sz = Math.sin(zHalfAngle); + const cz = Math.cos(zHalfAngle); + switch (order) { + case 'xyz': + newDst[0] = sx * cy * cz + cx * sy * sz; + newDst[1] = cx * sy * cz - sx * cy * sz; + newDst[2] = cx * cy * sz + sx * sy * cz; + newDst[3] = cx * cy * cz - sx * sy * sz; + break; + case 'xzy': + newDst[0] = sx * cy * cz - cx * sy * sz; + newDst[1] = cx * sy * cz - sx * cy * sz; + newDst[2] = cx * cy * sz + sx * sy * cz; + newDst[3] = cx * cy * cz + sx * sy * sz; + break; + case 'yxz': + newDst[0] = sx * cy * cz + cx * sy * sz; + newDst[1] = cx * sy * cz - sx * cy * sz; + newDst[2] = cx * cy * sz - sx * sy * cz; + newDst[3] = cx * cy * cz + sx * sy * sz; + break; + case 'yzx': + newDst[0] = sx * cy * cz + cx * sy * sz; + newDst[1] = cx * sy * cz + sx * cy * sz; + newDst[2] = cx * cy * sz - sx * sy * cz; + newDst[3] = cx * cy * cz - sx * sy * sz; + break; + case 'zxy': + newDst[0] = sx * cy * cz - cx * sy * sz; + newDst[1] = cx * sy * cz + sx * cy * sz; + newDst[2] = cx * cy * sz + sx * sy * cz; + newDst[3] = cx * cy * cz - sx * sy * sz; + break; + case 'zyx': + newDst[0] = sx * cy * cz - cx * sy * sz; + newDst[1] = cx * sy * cz + sx * cy * sz; + newDst[2] = cx * cy * sz - sx * sy * cz; + newDst[3] = cx * cy * cz + sx * sy * sz; + break; + default: + throw new Error(`Unknown rotation order: ${order}`); + } + return newDst; + } + /** + * Copies a quaternion. (same as {@link quat.clone}) + * Also see {@link quat.create} and {@link quat.set} + * @param q - The quaternion. + * @param dst - quaternion to hold result. If not passed in a new one is created. + * @returns A quaternion that is a copy of q + */ + function copy(q, dst) { + const newDst = (dst ?? new Ctor(4)); + newDst[0] = q[0]; + newDst[1] = q[1]; + newDst[2] = q[2]; + newDst[3] = q[3]; + return newDst; + } + /** + * Clones a quaternion. (same as {@link quat.copy}) + * Also see {@link quat.create} and {@link quat.set} + * @param q - The quaternion. + * @param dst - quaternion to hold result. If not passed in a new one is created. + * @returns A copy of q. + */ + const clone = copy; + /** + * Adds two quaternions; assumes a and b have the same dimension. + * @param a - Operand quaternion. + * @param b - Operand quaternion. + * @param dst - quaternion to hold result. If not passed in a new one is created. + * @returns A quaternion that is the sum of a and b. + */ + function add(a, b, dst) { + const newDst = (dst ?? new Ctor(4)); + newDst[0] = a[0] + b[0]; + newDst[1] = a[1] + b[1]; + newDst[2] = a[2] + b[2]; + newDst[3] = a[3] + b[3]; + return newDst; + } + /** + * Subtracts two quaternions. + * @param a - Operand quaternion. + * @param b - Operand quaternion. + * @param dst - quaternion to hold result. If not passed in a new one is created. + * @returns A quaternion that is the difference of a and b. + */ + function subtract(a, b, dst) { + const newDst = (dst ?? new Ctor(4)); + newDst[0] = a[0] - b[0]; + newDst[1] = a[1] - b[1]; + newDst[2] = a[2] - b[2]; + newDst[3] = a[3] - b[3]; + return newDst; + } + /** + * Subtracts two quaternions. + * @param a - Operand quaternion. + * @param b - Operand quaternion. + * @param dst - quaternion to hold result. If not passed in a new one is created. + * @returns A quaternion that is the difference of a and b. + */ + const sub = subtract; + /** + * Multiplies a quaternion by a scalar. + * @param v - The quaternion. + * @param k - The scalar. + * @param dst - quaternion to hold result. If not passed in a new one is created. + * @returns The scaled quaternion. + */ + function mulScalar(v, k, dst) { + const newDst = (dst ?? new Ctor(4)); + newDst[0] = v[0] * k; + newDst[1] = v[1] * k; + newDst[2] = v[2] * k; + newDst[3] = v[3] * k; + return newDst; + } + /** + * Multiplies a quaternion by a scalar. (same as mulScalar) + * @param v - The quaternion. + * @param k - The scalar. + * @param dst - quaternion to hold result. If not passed in a new one is created. + * @returns The scaled quaternion. + */ + const scale = mulScalar; + /** + * Divides a vector by a scalar. + * @param v - The vector. + * @param k - The scalar. + * @param dst - quaternion to hold result. If not passed in a new one is created. + * @returns The scaled quaternion. + */ + function divScalar(v, k, dst) { + const newDst = (dst ?? new Ctor(4)); + newDst[0] = v[0] / k; + newDst[1] = v[1] / k; + newDst[2] = v[2] / k; + newDst[3] = v[3] / k; + return newDst; + } + /** + * Computes the dot product of two quaternions + * @param a - Operand quaternion. + * @param b - Operand quaternion. + * @returns dot product + */ + function dot(a, b) { + return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]) + (a[3] * b[3]); + } + /** + * Performs linear interpolation on two quaternions. + * Given quaternions a and b and interpolation coefficient t, returns + * a + t * (b - a). + * @param a - Operand quaternion. + * @param b - Operand quaternion. + * @param t - Interpolation coefficient. + * @param dst - quaternion to hold result. If not passed in a new one is created. + * @returns The linear interpolated result. + */ + function lerp(a, b, t, dst) { + const newDst = (dst ?? new Ctor(4)); + newDst[0] = a[0] + t * (b[0] - a[0]); + newDst[1] = a[1] + t * (b[1] - a[1]); + newDst[2] = a[2] + t * (b[2] - a[2]); + newDst[3] = a[3] + t * (b[3] - a[3]); + return newDst; + } + /** + * Computes the length of quaternion + * @param v - quaternion. + * @returns length of quaternion. + */ + function length(v) { + const v0 = v[0]; + const v1 = v[1]; + const v2 = v[2]; + const v3 = v[3]; + return Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3); + } + /** + * Computes the length of quaternion (same as length) + * @param v - quaternion. + * @returns length of quaternion. + */ + const len = length; + /** + * Computes the square of the length of quaternion + * @param v - quaternion. + * @returns square of the length of quaternion. + */ + function lengthSq(v) { + const v0 = v[0]; + const v1 = v[1]; + const v2 = v[2]; + const v3 = v[3]; + return v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3; + } + /** + * Computes the square of the length of quaternion (same as lengthSq) + * @param v - quaternion. + * @returns square of the length of quaternion. + */ + const lenSq = lengthSq; + /** + * Divides a quaternion by its Euclidean length and returns the quotient. + * @param v - The quaternion. + * @param dst - quaternion to hold result. If not passed in a new one is created. + * @returns The normalized quaternion. + */ + function normalize(v, dst) { + const newDst = (dst ?? new Ctor(4)); + const v0 = v[0]; + const v1 = v[1]; + const v2 = v[2]; + const v3 = v[3]; + const len = Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3); + if (len > 0.00001) { + newDst[0] = v0 / len; + newDst[1] = v1 / len; + newDst[2] = v2 / len; + newDst[3] = v3 / len; + } + else { + newDst[0] = 0; + newDst[1] = 0; + newDst[2] = 0; + newDst[3] = 0; + } + return newDst; + } + /** + * Check if 2 quaternions are approximately equal + * @param a - Operand quaternion. + * @param b - Operand quaternion. + * @returns true if quaternions are approximately equal + */ + function equalsApproximately(a, b) { + return Math.abs(a[0] - b[0]) < EPSILON && + Math.abs(a[1] - b[1]) < EPSILON && + Math.abs(a[2] - b[2]) < EPSILON && + Math.abs(a[3] - b[3]) < EPSILON; + } + /** + * Check if 2 quaternions are exactly equal + * @param a - Operand quaternion. + * @param b - Operand quaternion. + * @returns true if quaternions are exactly equal + */ + function equals(a, b) { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3]; + } + /** + * Creates an identity quaternion + * @param dst - quaternion to hold result. If not passed in a new one is created. + * @returns an identity quaternion + */ + function identity(dst) { + const newDst = (dst ?? new Ctor(4)); + newDst[0] = 0; + newDst[1] = 0; + newDst[2] = 0; + newDst[3] = 1; + return newDst; + } + const tempVec3 = vec3.create(); + const xUnitVec3 = vec3.create(); + const yUnitVec3 = vec3.create(); + /** + * Computes a quaternion to represent the shortest rotation from one vector to another. + * + * @param aUnit - the start vector + * @param bUnit - the end vector + * @param dst - quaternion to hold result. If not passed in a new one is created. + * @returns the result + */ + function rotationTo(aUnit, bUnit, dst) { + const newDst = (dst ?? new Ctor(4)); + const dot = vec3.dot(aUnit, bUnit); + if (dot < -0.999999) { + vec3.cross(xUnitVec3, aUnit, tempVec3); + if (vec3.len(tempVec3) < 0.000001) { + vec3.cross(yUnitVec3, aUnit, tempVec3); + } + vec3.normalize(tempVec3, tempVec3); + fromAxisAngle(tempVec3, Math.PI, newDst); + return newDst; + } + else if (dot > 0.999999) { + newDst[0] = 0; + newDst[1] = 0; + newDst[2] = 0; + newDst[3] = 1; + return newDst; + } + else { + vec3.cross(aUnit, bUnit, tempVec3); + newDst[0] = tempVec3[0]; + newDst[1] = tempVec3[1]; + newDst[2] = tempVec3[2]; + newDst[3] = 1 + dot; + return normalize(newDst, newDst); + } + } + const tempQuat1 = new Ctor(4); + const tempQuat2 = new Ctor(4); + /** + * Performs a spherical linear interpolation with two control points + * + * @param a - the first quaternion + * @param b - the second quaternion + * @param c - the third quaternion + * @param d - the fourth quaternion + * @param t - Interpolation coefficient 0 to 1 + * @returns result + */ + function sqlerp(a, b, c, d, t, dst) { + const newDst = (dst ?? new Ctor(4)); + slerp(a, d, t, tempQuat1); + slerp(b, c, t, tempQuat2); + slerp(tempQuat1, tempQuat2, 2 * t * (1 - t), newDst); + return newDst; + } + return { + create, + fromValues, + set, + fromAxisAngle, + toAxisAngle, + angle, + multiply, + mul, + rotateX, + rotateY, + rotateZ, + slerp, + inverse, + conjugate, + fromMat, + fromEuler, + copy, + clone, + add, + subtract, + sub, + mulScalar, + scale, + divScalar, + dot, + lerp, + length, + len, + lengthSq, + lenSq, + normalize, + equalsApproximately, + equals, + identity, + rotationTo, + sqlerp, + }; + } + const cache$1 = new Map(); + /** + * + * Quat4 math functions. + * + * Almost all functions take an optional `newDst` argument. If it is not passed in the + * functions will create a new `Quat4`. In other words you can do this + * + * const v = quat4.cross(v1, v2); // Creates a new Quat4 with the cross product of v1 x v2. + * + * or + * + * const v = quat4.create(); + * quat4.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v + * + * The first style is often easier but depending on where it's used it generates garbage where + * as there is almost never allocation with the second style. + * + * It is always safe to pass any vector as the destination. So for example + * + * quat4.cross(v1, v2, v1); // Puts the cross product of v1 x v2 in v1 + * + */ + function getAPI$1(Ctor) { + let api = cache$1.get(Ctor); + if (!api) { + api = getAPIImpl$1(Ctor); + cache$1.set(Ctor, api); + } + return api; + } + + /* + * Copyright 2022 Gregg Tavares + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + /** + * Generates am typed API for Vec4 + * */ + function getAPIImpl(Ctor) { + /** + * Creates a vec4; may be called with x, y, z to set initial values. + * @param x - Initial x value. + * @param y - Initial y value. + * @param z - Initial z value. + * @param w - Initial w value. + * @returns the created vector + */ + function create(x, y, z, w) { + const newDst = new Ctor(4); + if (x !== undefined) { + newDst[0] = x; + if (y !== undefined) { + newDst[1] = y; + if (z !== undefined) { + newDst[2] = z; + if (w !== undefined) { + newDst[3] = w; + } + } + } + } + return newDst; + } + /** + * Creates a vec4; may be called with x, y, z to set initial values. (same as create) + * @param x - Initial x value. + * @param y - Initial y value. + * @param z - Initial z value. + * @param z - Initial w value. + * @returns the created vector + */ + const fromValues = create; + /** + * Sets the values of a Vec4 + * Also see {@link vec4.create} and {@link vec4.copy} + * + * @param x first value + * @param y second value + * @param z third value + * @param w fourth value + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns A vector with its elements set. + */ + function set(x, y, z, w, dst) { + const newDst = (dst ?? new Ctor(4)); + newDst[0] = x; + newDst[1] = y; + newDst[2] = z; + newDst[3] = w; + return newDst; + } + /** + * Applies Math.ceil to each element of vector + * @param v - Operand vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns A vector that is the ceil of each element of v. + */ + function ceil(v, dst) { + const newDst = (dst ?? new Ctor(4)); + newDst[0] = Math.ceil(v[0]); + newDst[1] = Math.ceil(v[1]); + newDst[2] = Math.ceil(v[2]); + newDst[3] = Math.ceil(v[3]); + return newDst; + } + /** + * Applies Math.floor to each element of vector + * @param v - Operand vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns A vector that is the floor of each element of v. + */ + function floor(v, dst) { + const newDst = (dst ?? new Ctor(4)); + newDst[0] = Math.floor(v[0]); + newDst[1] = Math.floor(v[1]); + newDst[2] = Math.floor(v[2]); + newDst[3] = Math.floor(v[3]); + return newDst; + } + /** + * Applies Math.round to each element of vector + * @param v - Operand vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns A vector that is the round of each element of v. + */ + function round(v, dst) { + const newDst = (dst ?? new Ctor(4)); + newDst[0] = Math.round(v[0]); + newDst[1] = Math.round(v[1]); + newDst[2] = Math.round(v[2]); + newDst[3] = Math.round(v[3]); + return newDst; + } + /** + * Clamp each element of vector between min and max + * @param v - Operand vector. + * @param max - Min value, default 0 + * @param min - Max value, default 1 + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns A vector that the clamped value of each element of v. + */ + function clamp(v, min = 0, max = 1, dst) { + const newDst = (dst ?? new Ctor(4)); + newDst[0] = Math.min(max, Math.max(min, v[0])); + newDst[1] = Math.min(max, Math.max(min, v[1])); + newDst[2] = Math.min(max, Math.max(min, v[2])); + newDst[3] = Math.min(max, Math.max(min, v[3])); + return newDst; + } + /** + * Adds two vectors; assumes a and b have the same dimension. + * @param a - Operand vector. + * @param b - Operand vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns A vector that is the sum of a and b. + */ + function add(a, b, dst) { + const newDst = (dst ?? new Ctor(4)); + newDst[0] = a[0] + b[0]; + newDst[1] = a[1] + b[1]; + newDst[2] = a[2] + b[2]; + newDst[3] = a[3] + b[3]; + return newDst; + } + /** + * Adds two vectors, scaling the 2nd; assumes a and b have the same dimension. + * @param a - Operand vector. + * @param b - Operand vector. + * @param scale - Amount to scale b + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns A vector that is the sum of a + b * scale. + */ + function addScaled(a, b, scale, dst) { + const newDst = (dst ?? new Ctor(4)); + newDst[0] = a[0] + b[0] * scale; + newDst[1] = a[1] + b[1] * scale; + newDst[2] = a[2] + b[2] * scale; + newDst[3] = a[3] + b[3] * scale; + return newDst; + } + /** + * Subtracts two vectors. + * @param a - Operand vector. + * @param b - Operand vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns A vector that is the difference of a and b. + */ + function subtract(a, b, dst) { + const newDst = (dst ?? new Ctor(4)); + newDst[0] = a[0] - b[0]; + newDst[1] = a[1] - b[1]; + newDst[2] = a[2] - b[2]; + newDst[3] = a[3] - b[3]; + return newDst; + } + /** + * Subtracts two vectors. + * @param a - Operand vector. + * @param b - Operand vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns A vector that is the difference of a and b. + */ + const sub = subtract; + /** + * Check if 2 vectors are approximately equal + * @param a - Operand vector. + * @param b - Operand vector. + * @returns true if vectors are approximately equal + */ + function equalsApproximately(a, b) { + return Math.abs(a[0] - b[0]) < EPSILON && + Math.abs(a[1] - b[1]) < EPSILON && + Math.abs(a[2] - b[2]) < EPSILON && + Math.abs(a[3] - b[3]) < EPSILON; + } + /** + * Check if 2 vectors are exactly equal + * @param a - Operand vector. + * @param b - Operand vector. + * @returns true if vectors are exactly equal + */ + function equals(a, b) { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3]; + } + /** + * Performs linear interpolation on two vectors. + * Given vectors a and b and interpolation coefficient t, returns + * a + t * (b - a). + * @param a - Operand vector. + * @param b - Operand vector. + * @param t - Interpolation coefficient. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns The linear interpolated result. + */ + function lerp(a, b, t, dst) { + const newDst = (dst ?? new Ctor(4)); + newDst[0] = a[0] + t * (b[0] - a[0]); + newDst[1] = a[1] + t * (b[1] - a[1]); + newDst[2] = a[2] + t * (b[2] - a[2]); + newDst[3] = a[3] + t * (b[3] - a[3]); + return newDst; + } + /** + * Performs linear interpolation on two vectors. + * Given vectors a and b and interpolation coefficient vector t, returns + * a + t * (b - a). + * @param a - Operand vector. + * @param b - Operand vector. + * @param t - Interpolation coefficients vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns the linear interpolated result. + */ + function lerpV(a, b, t, dst) { + const newDst = (dst ?? new Ctor(4)); + newDst[0] = a[0] + t[0] * (b[0] - a[0]); + newDst[1] = a[1] + t[1] * (b[1] - a[1]); + newDst[2] = a[2] + t[2] * (b[2] - a[2]); + newDst[3] = a[3] + t[3] * (b[3] - a[3]); + return newDst; + } + /** + * Return max values of two vectors. + * Given vectors a and b returns + * [max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])]. + * @param a - Operand vector. + * @param b - Operand vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns The max components vector. + */ + function max(a, b, dst) { + const newDst = (dst ?? new Ctor(4)); + newDst[0] = Math.max(a[0], b[0]); + newDst[1] = Math.max(a[1], b[1]); + newDst[2] = Math.max(a[2], b[2]); + newDst[3] = Math.max(a[3], b[3]); + return newDst; + } + /** + * Return min values of two vectors. + * Given vectors a and b returns + * [min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])]. + * @param a - Operand vector. + * @param b - Operand vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns The min components vector. + */ + function min(a, b, dst) { + const newDst = (dst ?? new Ctor(4)); + newDst[0] = Math.min(a[0], b[0]); + newDst[1] = Math.min(a[1], b[1]); + newDst[2] = Math.min(a[2], b[2]); + newDst[3] = Math.min(a[3], b[3]); + return newDst; + } + /** + * Multiplies a vector by a scalar. + * @param v - The vector. + * @param k - The scalar. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns The scaled vector. + */ + function mulScalar(v, k, dst) { + const newDst = (dst ?? new Ctor(4)); + newDst[0] = v[0] * k; + newDst[1] = v[1] * k; + newDst[2] = v[2] * k; + newDst[3] = v[3] * k; + return newDst; + } + /** + * Multiplies a vector by a scalar. (same as mulScalar) + * @param v - The vector. + * @param k - The scalar. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns The scaled vector. + */ + const scale = mulScalar; + /** + * Divides a vector by a scalar. + * @param v - The vector. + * @param k - The scalar. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns The scaled vector. + */ + function divScalar(v, k, dst) { + const newDst = (dst ?? new Ctor(4)); + newDst[0] = v[0] / k; + newDst[1] = v[1] / k; + newDst[2] = v[2] / k; + newDst[3] = v[3] / k; + return newDst; + } + /** + * Inverse a vector. + * @param v - The vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns The inverted vector. + */ + function inverse(v, dst) { + const newDst = (dst ?? new Ctor(4)); + newDst[0] = 1 / v[0]; + newDst[1] = 1 / v[1]; + newDst[2] = 1 / v[2]; + newDst[3] = 1 / v[3]; + return newDst; + } + /** + * Invert a vector. (same as inverse) + * @param v - The vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns The inverted vector. + */ + const invert = inverse; + /** + * Computes the dot product of two vectors + * @param a - Operand vector. + * @param b - Operand vector. + * @returns dot product + */ + function dot(a, b) { + return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]) + (a[3] * b[3]); + } + /** + * Computes the length of vector + * @param v - vector. + * @returns length of vector. + */ + function length(v) { + const v0 = v[0]; + const v1 = v[1]; + const v2 = v[2]; + const v3 = v[3]; + return Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3); + } + /** + * Computes the length of vector (same as length) + * @param v - vector. + * @returns length of vector. + */ + const len = length; + /** + * Computes the square of the length of vector + * @param v - vector. + * @returns square of the length of vector. + */ + function lengthSq(v) { + const v0 = v[0]; + const v1 = v[1]; + const v2 = v[2]; + const v3 = v[3]; + return v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3; + } + /** + * Computes the square of the length of vector (same as lengthSq) + * @param v - vector. + * @returns square of the length of vector. + */ + const lenSq = lengthSq; + /** + * Computes the distance between 2 points + * @param a - vector. + * @param b - vector. + * @returns distance between a and b + */ + function distance(a, b) { + const dx = a[0] - b[0]; + const dy = a[1] - b[1]; + const dz = a[2] - b[2]; + const dw = a[3] - b[3]; + return Math.sqrt(dx * dx + dy * dy + dz * dz + dw * dw); + } + /** + * Computes the distance between 2 points (same as distance) + * @param a - vector. + * @param b - vector. + * @returns distance between a and b + */ + const dist = distance; + /** + * Computes the square of the distance between 2 points + * @param a - vector. + * @param b - vector. + * @returns square of the distance between a and b + */ + function distanceSq(a, b) { + const dx = a[0] - b[0]; + const dy = a[1] - b[1]; + const dz = a[2] - b[2]; + const dw = a[3] - b[3]; + return dx * dx + dy * dy + dz * dz + dw * dw; + } + /** + * Computes the square of the distance between 2 points (same as distanceSq) + * @param a - vector. + * @param b - vector. + * @returns square of the distance between a and b + */ + const distSq = distanceSq; + /** + * Divides a vector by its Euclidean length and returns the quotient. + * @param v - The vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns The normalized vector. + */ + function normalize(v, dst) { + const newDst = (dst ?? new Ctor(4)); + const v0 = v[0]; + const v1 = v[1]; + const v2 = v[2]; + const v3 = v[3]; + const len = Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3); + if (len > 0.00001) { + newDst[0] = v0 / len; + newDst[1] = v1 / len; + newDst[2] = v2 / len; + newDst[3] = v3 / len; + } + else { + newDst[0] = 0; + newDst[1] = 0; + newDst[2] = 0; + newDst[3] = 0; + } + return newDst; + } + /** + * Negates a vector. + * @param v - The vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns -v. + */ + function negate(v, dst) { + const newDst = (dst ?? new Ctor(4)); + newDst[0] = -v[0]; + newDst[1] = -v[1]; + newDst[2] = -v[2]; + newDst[3] = -v[3]; + return newDst; + } + /** + * Copies a vector. (same as {@link vec4.clone}) + * Also see {@link vec4.create} and {@link vec4.set} + * @param v - The vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns A copy of v. + */ + function copy(v, dst) { + const newDst = (dst ?? new Ctor(4)); + newDst[0] = v[0]; + newDst[1] = v[1]; + newDst[2] = v[2]; + newDst[3] = v[3]; + return newDst; + } + /** + * Clones a vector. (same as {@link vec4.copy}) + * Also see {@link vec4.create} and {@link vec4.set} + * @param v - The vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns A copy of v. + */ + const clone = copy; + /** + * Multiplies a vector by another vector (component-wise); assumes a and + * b have the same length. + * @param a - Operand vector. + * @param b - Operand vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns The vector of products of entries of a and b. + */ + function multiply(a, b, dst) { + const newDst = (dst ?? new Ctor(4)); + newDst[0] = a[0] * b[0]; + newDst[1] = a[1] * b[1]; + newDst[2] = a[2] * b[2]; + newDst[3] = a[3] * b[3]; + return newDst; + } + /** + * Multiplies a vector by another vector (component-wise); assumes a and + * b have the same length. (same as mul) + * @param a - Operand vector. + * @param b - Operand vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns The vector of products of entries of a and b. + */ + const mul = multiply; + /** + * Divides a vector by another vector (component-wise); assumes a and + * b have the same length. + * @param a - Operand vector. + * @param b - Operand vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns The vector of quotients of entries of a and b. + */ + function divide(a, b, dst) { + const newDst = (dst ?? new Ctor(4)); + newDst[0] = a[0] / b[0]; + newDst[1] = a[1] / b[1]; + newDst[2] = a[2] / b[2]; + newDst[3] = a[3] / b[3]; + return newDst; + } + /** + * Divides a vector by another vector (component-wise); assumes a and + * b have the same length. (same as divide) + * @param a - Operand vector. + * @param b - Operand vector. + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns The vector of quotients of entries of a and b. + */ + const div = divide; + /** + * Zero's a vector + * @param dst - vector to hold result. If not passed in a new one is created. + * @returns The zeroed vector. + */ + function zero(dst) { + const newDst = (dst ?? new Ctor(4)); + newDst[0] = 0; + newDst[1] = 0; + newDst[2] = 0; + newDst[3] = 0; + return newDst; + } + /** + * transform vec4 by 4x4 matrix + * @param v - the vector + * @param m - The matrix. + * @param dst - optional vec4 to store result. If not passed a new one is created. + * @returns the transformed vector + */ + function transformMat4(v, m, dst) { + const newDst = (dst ?? new Ctor(4)); + const x = v[0]; + const y = v[1]; + const z = v[2]; + const w = v[3]; + newDst[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w; + newDst[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w; + newDst[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w; + newDst[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w; + return newDst; + } + /** + * Treat a 4D vector as a direction and set it's length + * + * @param a The vec4 to lengthen + * @param len The length of the resulting vector + * @returns The lengthened vector + */ + function setLength(a, len, dst) { + const newDst = (dst ?? new Ctor(4)); + normalize(a, newDst); + return mulScalar(newDst, len, newDst); + } + /** + * Ensure a vector is not longer than a max length + * + * @param a The vec4 to limit + * @param maxLen The longest length of the resulting vector + * @returns The vector, shortened to maxLen if it's too long + */ + function truncate(a, maxLen, dst) { + const newDst = (dst ?? new Ctor(4)); + if (length(a) > maxLen) { + return setLength(a, maxLen, newDst); + } + return copy(a, newDst); + } + /** + * Return the vector exactly between 2 endpoint vectors + * + * @param a Endpoint 1 + * @param b Endpoint 2 + * @returns The vector exactly residing between endpoints 1 and 2 + */ + function midpoint(a, b, dst) { + const newDst = (dst ?? new Ctor(4)); + return lerp(a, b, 0.5, newDst); + } + return { + create, + fromValues, + set, + ceil, + floor, + round, + clamp, + add, + addScaled, + subtract, + sub, + equalsApproximately, + equals, + lerp, + lerpV, + max, + min, + mulScalar, + scale, + divScalar, + inverse, + invert, + dot, + length, + len, + lengthSq, + lenSq, + distance, + dist, + distanceSq, + distSq, + normalize, + negate, + copy, + clone, + multiply, + mul, + divide, + div, + zero, + transformMat4, + setLength, + truncate, + midpoint, + }; + } + const cache = new Map(); + /** + * + * Vec4 math functions. + * + * Almost all functions take an optional `newDst` argument. If it is not passed in the + * functions will create a new `Vec4`. In other words you can do this + * + * const v = vec4.cross(v1, v2); // Creates a new Vec4 with the cross product of v1 x v2. + * + * or + * + * const v = vec4.create(); + * vec4.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v + * + * The first style is often easier but depending on where it's used it generates garbage where + * as there is almost never allocation with the second style. + * + * It is always safe to pass any vector as the destination. So for example + * + * vec4.cross(v1, v2, v1); // Puts the cross product of v1 x v2 in v1 + * + */ + function getAPI(Ctor) { + let api = cache.get(Ctor); + if (!api) { + api = getAPIImpl(Ctor); + cache.set(Ctor, api); + } + return api; + } + + /** + * Generate wgpu-matrix API for type + */ + function wgpuMatrixAPI(Mat3Ctor, Mat4Ctor, QuatCtor, Vec2Ctor, Vec3Ctor, Vec4Ctor) { + return { + /** @namespace mat4 */ + mat4: getAPI$2(Mat3Ctor), + /** @namespace mat3 */ + mat3: getAPI$4(Mat4Ctor), + /** @namespace quat */ + quat: getAPI$1(QuatCtor), + /** @namespace vec2 */ + vec2: getAPI$5(Vec2Ctor), + /** @namespace vec3 */ + vec3: getAPI$3(Vec3Ctor), + /** @namespace vec4 */ + vec4: getAPI(Vec4Ctor), + }; + } + const { + /** @namespace */ + mat4, + /** @namespace */ + mat3, + /** @namespace */ + quat, + /** @namespace */ + vec2, + /** @namespace */ + vec3, + /** @namespace */ + vec4, } = wgpuMatrixAPI(Float32Array, Float32Array, Float32Array, Float32Array, Float32Array, Float32Array); + const { + /** @namespace */ + mat4: mat4d, + /** @namespace */ + mat3: mat3d, + /** @namespace */ + quat: quatd, + /** @namespace */ + vec2: vec2d, + /** @namespace */ + vec3: vec3d, + /** @namespace */ + vec4: vec4d, } = wgpuMatrixAPI(Float64Array, Float64Array, Float64Array, Float64Array, Float64Array, Float64Array); + const { + /** @namespace */ + mat4: mat4n, + /** @namespace */ + mat3: mat3n, + /** @namespace */ + quat: quatn, + /** @namespace */ + vec2: vec2n, + /** @namespace */ + vec3: vec3n, + /** @namespace */ + vec4: vec4n, } = wgpuMatrixAPI(ZeroArray, Array, Array, Array, Array, Array); + + exports.mat3 = mat3; + exports.mat3d = mat3d; + exports.mat3n = mat3n; + exports.mat4 = mat4; + exports.mat4d = mat4d; + exports.mat4n = mat4n; + exports.quat = quat; + exports.quatd = quatd; + exports.quatn = quatn; + exports.utils = utils; + exports.vec2 = vec2; + exports.vec2d = vec2d; + exports.vec2n = vec2n; + exports.vec3 = vec3; + exports.vec3d = vec3d; + exports.vec3n = vec3n; + exports.vec4 = vec4; + exports.vec4d = vec4d; + exports.vec4n = vec4n; + +})); +//# sourceMappingURL=wgpu-matrix.js.map diff --git a/dist/3.x/wgpu-matrix.js.map b/dist/3.x/wgpu-matrix.js.map new file mode 100644 index 0000000..78f96bf --- /dev/null +++ b/dist/3.x/wgpu-matrix.js.map @@ -0,0 +1 @@ +{"version":3,"file":"wgpu-matrix.js","sources":["../../../src/types.ts","../../../src/utils.ts","../../../src/vec2-impl.ts","../../../src/mat3-impl.ts","../../../src/vec3-impl.ts","../../../src/mat4-impl.ts","../../../src/quat-impl.ts","../../../src/vec4-impl.ts","../../../src/wgpu-matrix.ts"],"sourcesContent":["/**\n * The types you can pass to most functions that take an\n * array of numbers.\n */\nexport type BaseArgType = Float32Array | Float64Array | number[];\n\nfunction wrapConstructor any>(\n OriginalConstructor: T,\n modifier: (instance: InstanceType) => void\n): T {\n return class extends OriginalConstructor {\n constructor(...args: any[]) {\n super(...args);\n modifier(this as InstanceType);\n }\n } as T; // Type assertion is necessary here\n}\n\nexport const ZeroArray = wrapConstructor(Array, a => a.fill(0));\n\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\n\nexport let EPSILON = 0.000001;\n\n/**\n * Set the value for EPSILON for various checks\n * @param v - Value to use for EPSILON.\n * @returns previous value of EPSILON;\n */\nexport function setEpsilon(v: number): number {\n const old = EPSILON;\n EPSILON = v;\n return old;\n}\n\n/**\n * Convert degrees to radians\n * @param degrees - Angle in degrees\n * @returns angle converted to radians\n */\nexport function degToRad(degrees: number): number {\n return degrees * Math.PI / 180;\n}\n\n/**\n * Convert radians to degrees\n * @param radians - Angle in radians\n * @returns angle converted to degrees\n */\nexport function radToDeg(radians: number): number {\n return radians * 180 / Math.PI;\n}\n\n/**\n * Lerps between a and b via t\n * @param a - starting value\n * @param b - ending value\n * @param t - value where 0 = a and 1 = b\n * @returns a + (b - a) * t\n */\nexport function lerp(a: number, b: number, t: number): number {\n return a + (b - a) * t;\n}\n\n/**\n * Compute the opposite of lerp. Given a and b and a value between\n * a and b returns a value between 0 and 1. 0 if a, 1 if b.\n * Note: no clamping is done.\n * @param a - start value\n * @param b - end value\n * @param v - value between a and b\n * @returns (v - a) / (b - a)\n */\nexport function inverseLerp(a: number, b: number, v: number): number {\n const d = b - a;\n return (Math.abs(b - a) < EPSILON)\n ? a\n : (v - a) / d;\n}\n\n/**\n * Compute the euclidean modulo\n *\n * ```\n * // table for n / 3\n * -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5 <- n\n * ------------------------------------\n * -2 -1 -0 -2 -1 0, 1, 2, 0, 1, 2 <- n % 3\n * 1 2 0 1 2 0, 1, 2, 0, 1, 2 <- euclideanModule(n, 3)\n * ```\n *\n * @param n - dividend\n * @param m - divisor\n * @returns the euclidean modulo of n / m\n */\nexport function euclideanModulo(n: number, m: number) {\n return ((n % m) + m) % m;\n}","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport * as utils from './utils.js';\nimport { Mat3Arg } from './mat3';\nimport { Mat4Arg } from './mat4';\nimport { Vec2Arg, Vec2Type } from './vec2';\nimport { Vec3Arg } from './vec3';\nimport { BaseArgType } from './types';\n\nexport { Vec2Arg, Vec2Type };\n\ntype Vec2Ctor = new (n: number) => T;\n\n/**\n * Generates am typed API for Vec3\n */\nfunction getAPIImpl(Ctor: Vec2Ctor) {\n\n/**\n * Creates a Vec2; may be called with x, y, z to set initial values.\n *\n * Note: Since passing in a raw JavaScript array\n * is valid in all circumstances, if you want to\n * force a JavaScript array into a Vec2's specified type\n * it would be faster to use\n *\n * ```\n * const v = vec2.clone(someJSArray);\n * ```\n *\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @returns the created vector\n */\nfunction create(x = 0, y = 0) {\n const newDst = new Ctor(2);\n if (x !== undefined) {\n newDst[0] = x;\n if (y !== undefined) {\n newDst[1] = y;\n }\n }\n return newDst;\n}\n\n/**\n * Creates a Vec2; may be called with x, y, z to set initial values. (same as create)\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @returns the created vector\n */\nconst fromValues = create;\n\n/**\n * Sets the values of a Vec2\n * Also see {@link vec2.create} and {@link vec2.copy}\n *\n * @param x first value\n * @param y second value\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector with its elements set.\n */\nfunction set(x: number, y: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = x;\n newDst[1] = y;\n\n return newDst;\n}\n\n/**\n * Applies Math.ceil to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the ceil of each element of v.\n */\nfunction ceil(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.ceil(v[0]);\n newDst[1] = Math.ceil(v[1]);\n\n return newDst;\n}\n\n/**\n * Applies Math.floor to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the floor of each element of v.\n */\nfunction floor(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.floor(v[0]);\n newDst[1] = Math.floor(v[1]);\n\n return newDst;\n}\n\n/**\n * Applies Math.round to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the round of each element of v.\n */\nfunction round(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.round(v[0]);\n newDst[1] = Math.round(v[1]);\n\n return newDst;\n}\n\n/**\n * Clamp each element of vector between min and max\n * @param v - Operand vector.\n * @param max - Min value, default 0\n * @param min - Max value, default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that the clamped value of each element of v.\n */\nfunction clamp(v: Vec2Arg, min = 0, max = 1, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.min(max, Math.max(min, v[0]));\n newDst[1] = Math.min(max, Math.max(min, v[1]));\n\n return newDst;\n}\n\n/**\n * Adds two vectors; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a and b.\n */\nfunction add(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] + b[0];\n newDst[1] = a[1] + b[1];\n\n return newDst;\n}\n\n/**\n * Adds two vectors, scaling the 2nd; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param scale - Amount to scale b\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a + b * scale.\n */\nfunction addScaled(a: Vec2Arg, b: Vec2Arg, scale: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] + b[0] * scale;\n newDst[1] = a[1] + b[1] * scale;\n\n return newDst;\n}\n\n/**\n * Returns the angle in radians between two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns The angle in radians between the 2 vectors.\n */\nfunction angle(a: Vec2Arg, b: Vec2Arg): number {\n const ax = a[0];\n const ay = a[1];\n const bx = b[0];\n const by = b[1];\n const mag1 = Math.sqrt(ax * ax + ay * ay);\n const mag2 = Math.sqrt(bx * bx + by * by);\n const mag = mag1 * mag2;\n const cosine = mag && dot(a, b) / mag;\n return Math.acos(cosine);\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nfunction subtract(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] - b[0];\n newDst[1] = a[1] - b[1];\n\n return newDst;\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nconst sub = subtract;\n\n/**\n * Check if 2 vectors are approximately equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are approximately equal\n */\nfunction equalsApproximately(a: Vec2Arg, b: Vec2Arg): boolean {\n return Math.abs(a[0] - b[0]) < utils.EPSILON &&\n Math.abs(a[1] - b[1]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 vectors are exactly equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are exactly equal\n */\nfunction equals(a: Vec2Arg, b: Vec2Arg): boolean {\n return a[0] === b[0] && a[1] === b[1];\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficient.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The linear interpolated result.\n */\nfunction lerp(a: Vec2Arg, b: Vec2Arg, t: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] + t * (b[0] - a[0]);\n newDst[1] = a[1] + t * (b[1] - a[1]);\n\n return newDst;\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient vector t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficients vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns the linear interpolated result.\n */\nfunction lerpV(a: Vec2Arg, b: Vec2Arg, t: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] + t[0] * (b[0] - a[0]);\n newDst[1] = a[1] + t[1] * (b[1] - a[1]);\n\n return newDst;\n}\n\n/**\n * Return max values of two vectors.\n * Given vectors a and b returns\n * [max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The max components vector.\n */\nfunction max(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.max(a[0], b[0]);\n newDst[1] = Math.max(a[1], b[1]);\n\n return newDst;\n}\n\n/**\n * Return min values of two vectors.\n * Given vectors a and b returns\n * [min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The min components vector.\n */\nfunction min(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.min(a[0], b[0]);\n newDst[1] = Math.min(a[1], b[1]);\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction mulScalar(v: Vec2Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = v[0] * k;\n newDst[1] = v[1] * k;\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar. (same as mulScalar)\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nconst scale = mulScalar;\n\n/**\n * Divides a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction divScalar(v: Vec2Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = v[0] / k;\n newDst[1] = v[1] / k;\n\n return newDst;\n}\n\n/**\n * Inverse a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nfunction inverse(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = 1 / v[0];\n newDst[1] = 1 / v[1];\n\n return newDst;\n}\n\n/**\n * Invert a vector. (same as inverse)\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nconst invert = inverse;\n\n/**\n * Computes the cross product of two vectors; assumes both vectors have\n * three entries.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of a cross b.\n */\nfunction cross(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const z = a[0] * b[1] - a[1] * b[0];\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = z;\n\n return newDst;\n}\n\n/**\n * Computes the dot product of two vectors; assumes both vectors have\n * three entries.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns dot product\n */\nfunction dot(a: Vec2Arg, b: Vec2Arg): number {\n return a[0] * b[0] + a[1] * b[1];\n}\n\n/**\n * Computes the length of vector\n * @param v - vector.\n * @returns length of vector.\n */\nfunction length(v: Vec2Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n return Math.sqrt(v0 * v0 + v1 * v1);\n}\n\n/**\n * Computes the length of vector (same as length)\n * @param v - vector.\n * @returns length of vector.\n */\nconst len = length;\n\n/**\n * Computes the square of the length of vector\n * @param v - vector.\n * @returns square of the length of vector.\n */\nfunction lengthSq(v: Vec2Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n return v0 * v0 + v1 * v1;\n}\n\n/**\n * Computes the square of the length of vector (same as lengthSq)\n * @param v - vector.\n * @returns square of the length of vector.\n */\nconst lenSq = lengthSq;\n\n/**\n * Computes the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nfunction distance(a: Vec2Arg, b: Vec2Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n return Math.sqrt(dx * dx + dy * dy);\n}\n\n/**\n * Computes the distance between 2 points (same as distance)\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nconst dist = distance;\n\n/**\n * Computes the square of the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nfunction distanceSq(a: Vec2Arg, b: Vec2Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n return dx * dx + dy * dy;\n}\n\n/**\n * Computes the square of the distance between 2 points (same as distanceSq)\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nconst distSq = distanceSq;\n\n/**\n * Divides a vector by its Euclidean length and returns the quotient.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The normalized vector.\n */\nfunction normalize(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const len = Math.sqrt(v0 * v0 + v1 * v1);\n\n if (len > 0.00001) {\n newDst[0] = v0 / len;\n newDst[1] = v1 / len;\n } else {\n newDst[0] = 0;\n newDst[1] = 0;\n }\n\n return newDst;\n}\n\n/**\n * Negates a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns -v.\n */\nfunction negate(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = -v[0];\n newDst[1] = -v[1];\n\n return newDst;\n}\n\n/**\n * Copies a vector. (same as {@link vec2.clone})\n * Also see {@link vec2.create} and {@link vec2.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nfunction copy(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = v[0];\n newDst[1] = v[1];\n\n return newDst;\n}\n\n/**\n * Clones a vector. (same as {@link vec2.copy})\n * Also see {@link vec2.create} and {@link vec2.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nconst clone = copy;\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nfunction multiply(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] * b[0];\n newDst[1] = a[1] * b[1];\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as mul)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nconst mul = multiply;\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nfunction divide(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] / b[0];\n newDst[1] = a[1] / b[1];\n\n return newDst;\n}\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as divide)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nconst div = divide;\n\n/**\n * Creates a random unit vector * scale\n * @param scale - Default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The random vector.\n */\nfunction random(scale = 1, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n const angle = Math.random() * 2 * Math.PI;\n newDst[0] = Math.cos(angle) * scale;\n newDst[1] = Math.sin(angle) * scale;\n\n return newDst;\n}\n\n/**\n * Zero's a vector\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The zeroed vector.\n */\nfunction zero(dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = 0;\n newDst[1] = 0;\n\n return newDst;\n}\n\n\n/**\n * transform Vec2 by 4x4 matrix\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional Vec2 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nfunction transformMat4(v: Vec2Arg, m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n const x = v[0];\n const y = v[1];\n\n newDst[0] = x * m[0] + y * m[4] + m[12];\n newDst[1] = x * m[1] + y * m[5] + m[13];\n\n return newDst;\n}\n\n/**\n * Transforms vec4 by 3x3 matrix\n *\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional Vec2 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nfunction transformMat3(v: Vec2Arg, m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n const x = v[0];\n const y = v[1];\n\n newDst[0] = m[0] * x + m[4] * y + m[8];\n newDst[1] = m[1] * x + m[5] * y + m[9];\n\n return newDst;\n}\n\n/**\n * Rotate a 2D vector\n *\n * @param a The vec2 point to rotate\n * @param b The origin of the rotation\n * @param rad The angle of rotation in radians\n * @returns the rotated vector\n */\nfunction rotate(a: Vec2Arg, b: Vec2Arg, rad: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n // Translate point to the origin\n const p0 = a[0] - b[0];\n const p1 = a[1] - b[1];\n const sinC = Math.sin(rad);\n const cosC = Math.cos(rad);\n\n //perform rotation and translate to correct position\n newDst[0] = p0 * cosC - p1 * sinC + b[0];\n newDst[1] = p0 * sinC + p1 * cosC + b[1];\n\n return newDst;\n}\n\n/**\n * Treat a 2D vector as a direction and set it's length\n *\n * @param a The vec2 to lengthen\n * @param len The length of the resulting vector\n * @returns The lengthened vector\n */\nfunction setLength(a: Vec2Arg, len: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n normalize(a, newDst);\n return mulScalar(newDst, len, newDst);\n}\n\n/**\n * Ensure a vector is not longer than a max length\n *\n * @param a The vec2 to limit\n * @param maxLen The longest length of the resulting vector\n * @returns The vector, shortened to maxLen if it's too long\n */\nfunction truncate(a: Vec2Arg, maxLen: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n if (length(a) > maxLen) {\n return setLength(a, maxLen, newDst);\n }\n\n return copy(a, newDst);\n}\n\n/**\n * Return the vector exactly between 2 endpoint vectors\n *\n * @param a Endpoint 1\n * @param b Endpoint 2\n * @returns The vector exactly residing between endpoints 1 and 2\n */\nfunction midpoint(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n return lerp(a, b, 0.5, newDst);\n}\n\nreturn {\n create,\n fromValues,\n set,\n ceil,\n floor,\n round,\n clamp,\n add,\n addScaled,\n angle,\n subtract,\n sub,\n equalsApproximately,\n equals,\n lerp,\n lerpV,\n max,\n min,\n mulScalar,\n scale,\n divScalar,\n inverse,\n invert,\n cross,\n dot,\n length,\n len,\n lengthSq,\n lenSq,\n distance,\n dist,\n distanceSq,\n distSq,\n normalize,\n negate,\n copy,\n clone,\n multiply,\n mul,\n divide,\n div,\n random,\n zero,\n transformMat4,\n transformMat3,\n rotate,\n setLength,\n truncate,\n midpoint,\n};\n}\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\nexport function getAPI(Ctor: Vec2Ctor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\n\nimport * as utils from './utils.js';\nimport { QuatArg } from './quat';\nimport { Mat3Arg, Mat3Type } from './mat3';\nimport { Mat4Arg } from './mat4';\nimport { Vec2Arg } from './vec2';\nimport { getAPI as getVec2API } from './vec2-impl';\nimport { BaseArgType } from './types';\n\nexport { Mat3Arg, Mat3Type };\n\ntype Mat3Ctor = new (n: number) => T;\n\n/**\n * Generates a typed API for Mat3\n * */\nfunction getAPIImpl(Ctor: Mat3Ctor) {\n const vec2 = getVec2API(Ctor);\n\n/**\n * Create a Mat3 from values\n *\n * Note: Since passing in a raw JavaScript array\n * is valid in all circumstances, if you want to\n * force a JavaScript array into a Mat3's specified type\n * it would be faster to use\n *\n * ```\n * const m = mat3.clone(someJSArray);\n * ```\n *\n * @param v0 - value for element 0\n * @param v1 - value for element 1\n * @param v2 - value for element 2\n * @param v3 - value for element 3\n * @param v4 - value for element 4\n * @param v5 - value for element 5\n * @param v6 - value for element 6\n * @param v7 - value for element 7\n * @param v8 - value for element 8\n * @returns matrix created from values.\n */\nfunction create(\n v0?: number, v1?: number, v2?: number,\n v3?: number, v4?: number, v5?: number,\n v6?: number, v7?: number, v8?: number) {\n const newDst = new Ctor(12);\n // to make the array homogenous\n newDst[3] = 0;\n newDst[7] = 0;\n newDst[11] = 0;\n\n if (v0 !== undefined) {\n newDst[0] = v0;\n if (v1 !== undefined) {\n newDst[1] = v1;\n if (v2 !== undefined) {\n newDst[2] = v2;\n if (v3 !== undefined) {\n newDst[4] = v3;\n if (v4 !== undefined) {\n newDst[5] = v4;\n if (v5 !== undefined) {\n newDst[6] = v5;\n if (v6 !== undefined) {\n newDst[8] = v6;\n if (v7 !== undefined) {\n newDst[9] = v7;\n if (v8 !== undefined) {\n newDst[10] = v8;\n }\n }\n }\n }\n }\n }\n }\n }\n }\n\n return newDst;\n}\n\n/**\n * Sets the values of a Mat3\n * Also see {@link mat3.create} and {@link mat3.copy}\n *\n * @param v0 - value for element 0\n * @param v1 - value for element 1\n * @param v2 - value for element 2\n * @param v3 - value for element 3\n * @param v4 - value for element 4\n * @param v5 - value for element 5\n * @param v6 - value for element 6\n * @param v7 - value for element 7\n * @param v8 - value for element 8\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat3 set from values.\n */\nfunction set(\n v0: number, v1: number, v2: number,\n v3: number, v4: number, v5: number,\n v6: number, v7: number, v8: number, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[0] = v0; newDst[1] = v1; newDst[ 2] = v2; newDst[ 3] = 0;\n newDst[4] = v3; newDst[5] = v4; newDst[ 6] = v5; newDst[ 7] = 0;\n newDst[8] = v6; newDst[9] = v7; newDst[10] = v8; newDst[11] = 0;\n\n return newDst;\n}\n\n/**\n * Creates a Mat3 from the upper left 3x3 part of a Mat4\n * @param m4 - source matrix\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat3 made from m4\n */\nfunction fromMat4(m4: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n newDst[0] = m4[0]; newDst[1] = m4[1]; newDst[ 2] = m4[ 2]; newDst[ 3] = 0;\n newDst[4] = m4[4]; newDst[5] = m4[5]; newDst[ 6] = m4[ 6]; newDst[ 7] = 0;\n newDst[8] = m4[8]; newDst[9] = m4[9]; newDst[10] = m4[10]; newDst[11] = 0;\n return newDst;\n}\n\n/**\n * Creates a Mat3 rotation matrix from a quaternion\n * @param q - quaternion to create matrix from\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat3 made from q\n */\nfunction fromQuat(q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const x = q[0]; const y = q[1]; const z = q[2]; const w = q[3];\n const x2 = x + x; const y2 = y + y; const z2 = z + z;\n\n const xx = x * x2;\n const yx = y * x2;\n const yy = y * y2;\n const zx = z * x2;\n const zy = z * y2;\n const zz = z * z2;\n const wx = w * x2;\n const wy = w * y2;\n const wz = w * z2;\n\n newDst[ 0] = 1 - yy - zz; newDst[ 1] = yx + wz; newDst[ 2] = zx - wy; newDst[ 3] = 0;\n newDst[ 4] = yx - wz; newDst[ 5] = 1 - xx - zz; newDst[ 6] = zy + wx; newDst[ 7] = 0;\n newDst[ 8] = zx + wy; newDst[ 9] = zy - wx; newDst[10] = 1 - xx - yy; newDst[11] = 0;\n\n return newDst;\n}\n\n/**\n * Negates a matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns -m.\n */\nfunction negate(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = -m[ 0]; newDst[ 1] = -m[ 1]; newDst[ 2] = -m[ 2];\n newDst[ 4] = -m[ 4]; newDst[ 5] = -m[ 5]; newDst[ 6] = -m[ 6];\n newDst[ 8] = -m[ 8]; newDst[ 9] = -m[ 9]; newDst[10] = -m[10];\n\n return newDst;\n}\n\n/**\n * Copies a matrix. (same as {@link mat3.clone})\n * Also see {@link mat3.create} and {@link mat3.set}\n * @param m - The matrix.\n * @param dst - The matrix. If not passed a new one is created.\n * @returns A copy of m.\n */\nfunction copy(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = m[ 0]; newDst[ 1] = m[ 1]; newDst[ 2] = m[ 2];\n newDst[ 4] = m[ 4]; newDst[ 5] = m[ 5]; newDst[ 6] = m[ 6];\n newDst[ 8] = m[ 8]; newDst[ 9] = m[ 9]; newDst[10] = m[10];\n\n return newDst;\n}\n\n/**\n * Copies a matrix (same as {@link mat3.copy})\n * Also see {@link mat3.create} and {@link mat3.set}\n * @param m - The matrix.\n * @param dst - The matrix. If not passed a new one is created.\n * @returns A copy of m.\n */\nconst clone = copy;\n\n/**\n * Check if 2 matrices are approximately equal\n * @param a Operand matrix.\n * @param b Operand matrix.\n * @returns true if matrices are approximately equal\n */\nfunction equalsApproximately(a: Mat3Arg, b: Mat3Arg): boolean {\n return Math.abs(a[ 0] - b[ 0]) < utils.EPSILON &&\n Math.abs(a[ 1] - b[ 1]) < utils.EPSILON &&\n Math.abs(a[ 2] - b[ 2]) < utils.EPSILON &&\n Math.abs(a[ 4] - b[ 4]) < utils.EPSILON &&\n Math.abs(a[ 5] - b[ 5]) < utils.EPSILON &&\n Math.abs(a[ 6] - b[ 6]) < utils.EPSILON &&\n Math.abs(a[ 8] - b[ 8]) < utils.EPSILON &&\n Math.abs(a[ 9] - b[ 9]) < utils.EPSILON &&\n Math.abs(a[10] - b[10]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 matrices are exactly equal\n * @param a Operand matrix.\n * @param b Operand matrix.\n * @returns true if matrices are exactly equal\n */\nfunction equals(a: Mat3Arg, b: Mat3Arg): boolean {\n return a[ 0] === b[ 0] &&\n a[ 1] === b[ 1] &&\n a[ 2] === b[ 2] &&\n a[ 4] === b[ 4] &&\n a[ 5] === b[ 5] &&\n a[ 6] === b[ 6] &&\n a[ 8] === b[ 8] &&\n a[ 9] === b[ 9] &&\n a[10] === b[10];\n}\n\n/**\n * Creates a 3-by-3 identity matrix.\n *\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns A 3-by-3 identity matrix.\n */\nfunction identity(dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = 1; newDst[ 1] = 0; newDst[ 2] = 0;\n newDst[ 4] = 0; newDst[ 5] = 1; newDst[ 6] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1;\n\n return newDst;\n}\n\n/**\n * Takes the transpose of a matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The transpose of m.\n */\nfunction transpose(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n if (newDst === m) {\n let t: number;\n\n // 0 1 2\n // 4 5 6\n // 8 9 10\n\n t = m[1];\n m[1] = m[4];\n m[4] = t;\n\n t = m[2];\n m[2] = m[8];\n m[8] = t;\n\n t = m[6];\n m[6] = m[9];\n m[9] = t;\n\n return newDst;\n }\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n\n newDst[ 0] = m00; newDst[ 1] = m10; newDst[ 2] = m20;\n newDst[ 4] = m01; newDst[ 5] = m11; newDst[ 6] = m21;\n newDst[ 8] = m02; newDst[ 9] = m12; newDst[10] = m22;\n\n return newDst;\n}\n\n/**\n * Computes the inverse of a 3-by-3 matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The inverse of m.\n */\nfunction inverse(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n\n const b01 = m22 * m11 - m12 * m21;\n const b11 = -m22 * m10 + m12 * m20;\n const b21 = m21 * m10 - m11 * m20;\n\n const invDet = 1 / (m00 * b01 + m01 * b11 + m02 * b21);\n\n newDst[ 0] = b01 * invDet;\n newDst[ 1] = (-m22 * m01 + m02 * m21) * invDet;\n newDst[ 2] = ( m12 * m01 - m02 * m11) * invDet;\n newDst[ 4] = b11 * invDet;\n newDst[ 5] = ( m22 * m00 - m02 * m20) * invDet;\n newDst[ 6] = (-m12 * m00 + m02 * m10) * invDet;\n newDst[ 8] = b21 * invDet;\n newDst[ 9] = (-m21 * m00 + m01 * m20) * invDet;\n newDst[10] = ( m11 * m00 - m01 * m10) * invDet;\n\n return newDst;\n}\n\n/**\n * Compute the determinant of a matrix\n * @param m - the matrix\n * @returns the determinant\n */\nfunction determinant(m: Mat3Arg): number {\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n\n return m00 * (m11 * m22 - m21 * m12) -\n m10 * (m01 * m22 - m21 * m02) +\n m20 * (m01 * m12 - m11 * m02);\n}\n\n/**\n * Computes the inverse of a 3-by-3 matrix. (same as inverse)\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The inverse of m.\n */\nconst invert = inverse;\n\n/**\n * Multiplies two 3-by-3 matrices with a on the left and b on the right\n * @param a - The matrix on the left.\n * @param b - The matrix on the right.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix product of a and b.\n */\nfunction multiply(a: Mat3Arg, b: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a10 = a[ 4 + 0];\n const a11 = a[ 4 + 1];\n const a12 = a[ 4 + 2];\n const a20 = a[ 8 + 0];\n const a21 = a[ 8 + 1];\n const a22 = a[ 8 + 2];\n const b00 = b[0];\n const b01 = b[1];\n const b02 = b[2];\n const b10 = b[ 4 + 0];\n const b11 = b[ 4 + 1];\n const b12 = b[ 4 + 2];\n const b20 = b[ 8 + 0];\n const b21 = b[ 8 + 1];\n const b22 = b[ 8 + 2];\n\n newDst[ 0] = a00 * b00 + a10 * b01 + a20 * b02;\n newDst[ 1] = a01 * b00 + a11 * b01 + a21 * b02;\n newDst[ 2] = a02 * b00 + a12 * b01 + a22 * b02;\n newDst[ 4] = a00 * b10 + a10 * b11 + a20 * b12;\n newDst[ 5] = a01 * b10 + a11 * b11 + a21 * b12;\n newDst[ 6] = a02 * b10 + a12 * b11 + a22 * b12;\n newDst[ 8] = a00 * b20 + a10 * b21 + a20 * b22;\n newDst[ 9] = a01 * b20 + a11 * b21 + a21 * b22;\n newDst[10] = a02 * b20 + a12 * b21 + a22 * b22;\n\n return newDst;\n}\n\n/**\n * Multiplies two 3-by-3 matrices with a on the left and b on the right (same as multiply)\n * @param a - The matrix on the left.\n * @param b - The matrix on the right.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix product of a and b.\n */\nconst mul = multiply;\n\n/**\n * Sets the translation component of a 3-by-3 matrix to the given\n * vector.\n * @param a - The matrix.\n * @param v - The vector.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix with translation set.\n */\nfunction setTranslation(a: Mat3Arg, v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? identity()) as T;\n if (a !== newDst) {\n newDst[ 0] = a[ 0];\n newDst[ 1] = a[ 1];\n newDst[ 2] = a[ 2];\n newDst[ 4] = a[ 4];\n newDst[ 5] = a[ 5];\n newDst[ 6] = a[ 6];\n }\n newDst[ 8] = v[0];\n newDst[ 9] = v[1];\n newDst[10] = 1;\n return newDst;\n}\n\n/**\n * Returns the translation component of a 3-by-3 matrix as a vector with 3\n * entries.\n * @param m - The matrix.\n * @param dst - vector to hold result. If not passed a new one is created.\n * @returns The translation component of m.\n */\nfunction getTranslation(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? vec2.create()) as T;\n newDst[0] = m[8];\n newDst[1] = m[9];\n return newDst;\n}\n\n/**\n * Returns an axis of a 3x3 matrix as a vector with 2 entries\n * @param m - The matrix.\n * @param axis - The axis 0 = x, 1 = y,\n * @returns The axis component of m.\n */\nfunction getAxis(m: Mat3Arg, axis: number, dst?: T) {\n const newDst = (dst ?? vec2.create()) as T;\n const off = axis * 4;\n newDst[0] = m[off + 0];\n newDst[1] = m[off + 1];\n return newDst;\n}\n\n/**\n * Sets an axis of a 3x3 matrix as a vector with 2 entries\n * @param m - The matrix.\n * @param v - the axis vector\n * @param axis - The axis 0 = x, 1 = y;\n * @param dst - The matrix to set. If not passed a new one is created.\n * @returns The matrix with axis set.\n */\nfunction setAxis(m: Mat3Arg, v: Vec2Arg, axis: number, dst?: T) {\n const newDst = (dst === m ? m : copy(m, dst)) as T;\n\n const off = axis * 4;\n newDst[off + 0] = v[0];\n newDst[off + 1] = v[1];\n return newDst;\n}\n\n///**\n// * Returns the scaling component of the matrix\n// * @param m - The Matrix\n// * @param dst - The vector to set. If not passed a new one is created.\n// */\nfunction getScaling(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? vec2.create());\n\n const xx = m[0];\n const xy = m[1];\n const yx = m[4];\n const yy = m[5];\n\n newDst[0] = Math.sqrt(xx * xx + xy * xy);\n newDst[1] = Math.sqrt(yx * yx + yy * yy);\n\n return newDst;\n}\n\n/**\n * Creates a 3-by-3 matrix which translates by the given vector v.\n * @param v - The vector by which to translate.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The translation matrix.\n */\nfunction translation(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = 1; newDst[ 1] = 0; newDst[ 2] = 0;\n newDst[ 4] = 0; newDst[ 5] = 1; newDst[ 6] = 0;\n newDst[ 8] = v[0]; newDst[ 9] = v[1]; newDst[10] = 1;\n\n return newDst;\n}\n\n/**\n * Translates the given 3-by-3 matrix by the given vector v.\n * @param m - The matrix.\n * @param v - The vector by which to translate.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The translated matrix.\n */\nfunction translate(m: Mat3Arg, v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n\n const m00 = m[0];\n const m01 = m[1];\n const m02 = m[2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n\n if (m !== newDst) {\n newDst[ 0] = m00;\n newDst[ 1] = m01;\n newDst[ 2] = m02;\n newDst[ 4] = m10;\n newDst[ 5] = m11;\n newDst[ 6] = m12;\n }\n\n newDst[ 8] = m00 * v0 + m10 * v1 + m20;\n newDst[ 9] = m01 * v0 + m11 * v1 + m21;\n newDst[10] = m02 * v0 + m12 * v1 + m22;\n\n return newDst;\n}\n\n/**\n * Creates a 3-by-3 matrix which rotates by the given angle.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotation matrix.\n */\nfunction rotation(angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c; newDst[ 1] = s; newDst[ 2] = 0;\n newDst[ 4] = -s; newDst[ 5] = c; newDst[ 6] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1;\n\n return newDst;\n}\n\n/**\n * Rotates the given 3-by-3 matrix by the given angle.\n * @param m - The matrix.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nfunction rotate(m: Mat3Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c * m00 + s * m10;\n newDst[ 1] = c * m01 + s * m11;\n newDst[ 2] = c * m02 + s * m12;\n\n newDst[ 4] = c * m10 - s * m00;\n newDst[ 5] = c * m11 - s * m01;\n newDst[ 6] = c * m12 - s * m02;\n\n\n if (m !== newDst) {\n newDst[ 8] = m[ 8];\n newDst[ 9] = m[ 9];\n newDst[10] = m[10];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 3-by-3 matrix which scales in each dimension by an amount given by\n * the corresponding entry in the given vector; assumes the vector has three\n * entries.\n * @param v - A vector of\n * 2 entries specifying the factor by which to scale in each dimension.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaling matrix.\n */\nfunction scaling(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = v[0]; newDst[ 1] = 0; newDst[ 2] = 0;\n newDst[ 4] = 0; newDst[ 5] = v[1]; newDst[ 6] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1;\n\n return newDst;\n}\n\n/**\n * Scales the given 3-by-3 matrix in each dimension by an amount\n * given by the corresponding entry in the given vector; assumes the vector has\n * three entries.\n * @param m - The matrix to be modified.\n * @param v - A vector of 2 entries specifying the\n * factor by which to scale in each dimension.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaled matrix.\n */\nfunction scale(m: Mat3Arg, v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n\n newDst[ 0] = v0 * m[0 * 4 + 0];\n newDst[ 1] = v0 * m[0 * 4 + 1];\n newDst[ 2] = v0 * m[0 * 4 + 2];\n\n newDst[ 4] = v1 * m[1 * 4 + 0];\n newDst[ 5] = v1 * m[1 * 4 + 1];\n newDst[ 6] = v1 * m[1 * 4 + 2];\n\n if (m !== newDst) {\n newDst[ 8] = m[ 8];\n newDst[ 9] = m[ 9];\n newDst[10] = m[10];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 3-by-3 matrix which scales uniformly in each dimension\n * @param s - Amount to scale\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaling matrix.\n */\nfunction uniformScaling(s: number, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = s; newDst[ 1] = 0; newDst[ 2] = 0;\n newDst[ 4] = 0; newDst[ 5] = s; newDst[ 6] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1;\n\n return newDst;\n}\n\n/**\n * Scales the given 3-by-3 matrix in each dimension by an amount\n * given.\n * @param m - The matrix to be modified.\n * @param s - Amount to scale.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaled matrix.\n */\nfunction uniformScale(m: Mat3Arg, s: number, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = s * m[0 * 4 + 0];\n newDst[ 1] = s * m[0 * 4 + 1];\n newDst[ 2] = s * m[0 * 4 + 2];\n\n newDst[ 4] = s * m[1 * 4 + 0];\n newDst[ 5] = s * m[1 * 4 + 1];\n newDst[ 6] = s * m[1 * 4 + 2];\n\n if (m !== newDst) {\n newDst[ 8] = m[ 8];\n newDst[ 9] = m[ 9];\n newDst[10] = m[10];\n }\n\n return newDst;\n}\n\nreturn {\n clone,\n create,\n set,\n fromMat4,\n fromQuat,\n negate,\n copy,\n equalsApproximately,\n equals,\n identity,\n transpose,\n inverse,\n invert,\n determinant,\n mul,\n multiply,\n setTranslation,\n getTranslation,\n getAxis,\n setAxis,\n getScaling,\n translation,\n translate,\n rotation,\n rotate,\n scaling,\n scale,\n uniformScaling,\n uniformScale,\n};\n\n}\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\nexport function getAPI(Ctor: Mat3Ctor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport * as utils from './utils.js';\nimport { Vec3Arg, Vec3Type } from './vec3';\nimport { Mat3Arg } from './mat3';\nimport { Mat4Arg } from './mat4';\nimport { QuatArg } from './quat';\nimport { BaseArgType } from './types';\n\nexport { Vec3Arg, Vec3Type };\n\ntype Vec3Ctor = new (n: number) => T;\n\n/**\n * Generates am typed API for Vec3\n * */\nfunction getAPIImpl(Ctor: Vec3Ctor) {\n\n/**\n * Creates a vec3; may be called with x, y, z to set initial values.\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @returns the created vector\n */\nfunction create(x?: number, y?: number, z?: number) {\n const newDst = new Ctor(3);\n if (x !== undefined) {\n newDst[0] = x;\n if (y !== undefined) {\n newDst[1] = y;\n if (z !== undefined) {\n newDst[2] = z;\n }\n }\n }\n return newDst;\n}\n\n/**\n * Creates a vec3; may be called with x, y, z to set initial values. (same as create)\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @returns the created vector\n */\nconst fromValues = create;\n\n/**\n * Sets the values of a Vec3\n * Also see {@link vec3.create} and {@link vec3.copy}\n *\n * @param x first value\n * @param y second value\n * @param z third value\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector with its elements set.\n */\nfunction set(x: number, y: number, z: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = x;\n newDst[1] = y;\n newDst[2] = z;\n\n return newDst;\n}\n\n/**\n * Applies Math.ceil to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the ceil of each element of v.\n */\nfunction ceil(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.ceil(v[0]);\n newDst[1] = Math.ceil(v[1]);\n newDst[2] = Math.ceil(v[2]);\n\n return newDst;\n}\n\n/**\n * Applies Math.floor to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the floor of each element of v.\n */\nfunction floor(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.floor(v[0]);\n newDst[1] = Math.floor(v[1]);\n newDst[2] = Math.floor(v[2]);\n\n return newDst;\n}\n\n/**\n * Applies Math.round to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the round of each element of v.\n */\nfunction round(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.round(v[0]);\n newDst[1] = Math.round(v[1]);\n newDst[2] = Math.round(v[2]);\n\n return newDst;\n}\n\n/**\n * Clamp each element of vector between min and max\n * @param v - Operand vector.\n * @param max - Min value, default 0\n * @param min - Max value, default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that the clamped value of each element of v.\n */\nfunction clamp(v: Vec3Arg, min = 0, max = 1, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.min(max, Math.max(min, v[0]));\n newDst[1] = Math.min(max, Math.max(min, v[1]));\n newDst[2] = Math.min(max, Math.max(min, v[2]));\n\n return newDst;\n}\n\n/**\n * Adds two vectors; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a and b.\n */\nfunction add(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] + b[0];\n newDst[1] = a[1] + b[1];\n newDst[2] = a[2] + b[2];\n\n return newDst;\n}\n\n/**\n * Adds two vectors, scaling the 2nd; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param scale - Amount to scale b\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a + b * scale.\n */\nfunction addScaled(a: Vec3Arg, b: Vec3Arg, scale: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] + b[0] * scale;\n newDst[1] = a[1] + b[1] * scale;\n newDst[2] = a[2] + b[2] * scale;\n\n return newDst;\n}\n\n/**\n * Returns the angle in radians between two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns The angle in radians between the 2 vectors.\n */\nfunction angle(a: Vec3Arg, b: Vec3Arg): number {\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const bx = b[0];\n const by = b[1];\n const bz = b[2];\n const mag1 = Math.sqrt(ax * ax + ay * ay + az * az);\n const mag2 = Math.sqrt(bx * bx + by * by + bz * bz);\n const mag = mag1 * mag2;\n const cosine = mag && dot(a, b) / mag;\n return Math.acos(cosine);\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nfunction subtract(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] - b[0];\n newDst[1] = a[1] - b[1];\n newDst[2] = a[2] - b[2];\n\n return newDst;\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nconst sub = subtract;\n\n/**\n * Check if 2 vectors are approximately equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are approximately equal\n */\nfunction equalsApproximately(a: Vec3Arg, b: Vec3Arg): boolean {\n return Math.abs(a[0] - b[0]) < utils.EPSILON &&\n Math.abs(a[1] - b[1]) < utils.EPSILON &&\n Math.abs(a[2] - b[2]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 vectors are exactly equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are exactly equal\n */\nfunction equals(a: Vec3Arg, b: Vec3Arg): boolean {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2];\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficient.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The linear interpolated result.\n */\nfunction lerp(a: Vec3Arg, b: Vec3Arg, t: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] + t * (b[0] - a[0]);\n newDst[1] = a[1] + t * (b[1] - a[1]);\n newDst[2] = a[2] + t * (b[2] - a[2]);\n\n return newDst;\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient vector t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficients vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns the linear interpolated result.\n */\nfunction lerpV(a: Vec3Arg, b: Vec3Arg, t: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] + t[0] * (b[0] - a[0]);\n newDst[1] = a[1] + t[1] * (b[1] - a[1]);\n newDst[2] = a[2] + t[2] * (b[2] - a[2]);\n\n return newDst;\n}\n\n/**\n * Return max values of two vectors.\n * Given vectors a and b returns\n * [max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The max components vector.\n */\nfunction max(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.max(a[0], b[0]);\n newDst[1] = Math.max(a[1], b[1]);\n newDst[2] = Math.max(a[2], b[2]);\n\n return newDst;\n}\n\n/**\n * Return min values of two vectors.\n * Given vectors a and b returns\n * [min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The min components vector.\n */\nfunction min(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.min(a[0], b[0]);\n newDst[1] = Math.min(a[1], b[1]);\n newDst[2] = Math.min(a[2], b[2]);\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction mulScalar(v: Vec3Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = v[0] * k;\n newDst[1] = v[1] * k;\n newDst[2] = v[2] * k;\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar. (same as mulScalar)\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nconst scale = mulScalar;\n\n/**\n * Divides a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction divScalar(v: Vec3Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = v[0] / k;\n newDst[1] = v[1] / k;\n newDst[2] = v[2] / k;\n\n return newDst;\n}\n\n/**\n * Inverse a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nfunction inverse(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = 1 / v[0];\n newDst[1] = 1 / v[1];\n newDst[2] = 1 / v[2];\n\n return newDst;\n}\n\n/**\n * Invert a vector. (same as inverse)\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nconst invert = inverse;\n\n/**\n * Computes the cross product of two vectors; assumes both vectors have\n * three entries.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of a cross b.\n */\nfunction cross(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const t1 = a[2] * b[0] - a[0] * b[2];\n const t2 = a[0] * b[1] - a[1] * b[0];\n newDst[0] = a[1] * b[2] - a[2] * b[1];\n newDst[1] = t1;\n newDst[2] = t2;\n\n return newDst;\n}\n\n/**\n * Computes the dot product of two vectors; assumes both vectors have\n * three entries.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns dot product\n */\nfunction dot(a: Vec3Arg, b: Vec3Arg): number {\n return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]);\n}\n\n/**\n * Computes the length of vector\n * @param v - vector.\n * @returns length of vector.\n */\nfunction length(v: Vec3Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n return Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2);\n}\n\n/**\n * Computes the length of vector (same as length)\n * @param v - vector.\n * @returns length of vector.\n */\nconst len = length;\n\n/**\n * Computes the square of the length of vector\n * @param v - vector.\n * @returns square of the length of vector.\n */\nfunction lengthSq(v: Vec3Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n return v0 * v0 + v1 * v1 + v2 * v2;\n}\n\n/**\n * Computes the square of the length of vector (same as lengthSq)\n * @param v - vector.\n * @returns square of the length of vector.\n */\nconst lenSq = lengthSq;\n\n/**\n * Computes the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nfunction distance(a: Vec3Arg, b: Vec3Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n const dz = a[2] - b[2];\n return Math.sqrt(dx * dx + dy * dy + dz * dz);\n}\n\n/**\n * Computes the distance between 2 points (same as distance)\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nconst dist = distance;\n\n/**\n * Computes the square of the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nfunction distanceSq(a: Vec3Arg, b: Vec3Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n const dz = a[2] - b[2];\n return dx * dx + dy * dy + dz * dz;\n}\n\n/**\n * Computes the square of the distance between 2 points (same as distanceSq)\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nconst distSq = distanceSq;\n\n/**\n * Divides a vector by its Euclidean length and returns the quotient.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The normalized vector.\n */\nfunction normalize(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const len = Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2);\n\n if (len > 0.00001) {\n newDst[0] = v0 / len;\n newDst[1] = v1 / len;\n newDst[2] = v2 / len;\n } else {\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n }\n\n\n return newDst;\n}\n\n/**\n * Negates a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns -v.\n */\nfunction negate(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = -v[0];\n newDst[1] = -v[1];\n newDst[2] = -v[2];\n\n return newDst;\n}\n\n/**\n * Copies a vector. (same as {@link vec3.clone})\n * Also see {@link vec3.create} and {@link vec3.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nfunction copy(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = v[0];\n newDst[1] = v[1];\n newDst[2] = v[2];\n\n return newDst;\n}\n\n/**\n * Clones a vector. (same as {@link vec3.copy})\n * Also see {@link vec3.create} and {@link vec3.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nconst clone = copy;\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nfunction multiply(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] * b[0];\n newDst[1] = a[1] * b[1];\n newDst[2] = a[2] * b[2];\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as mul)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nconst mul = multiply;\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nfunction divide(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] / b[0];\n newDst[1] = a[1] / b[1];\n newDst[2] = a[2] / b[2];\n\n return newDst;\n}\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as divide)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nconst div = divide;\n\n/**\n * Creates a random vector\n * @param scale - Default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The random vector.\n */\nfunction random(scale = 1, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const angle = Math.random() * 2 * Math.PI;\n const z = Math.random() * 2 - 1;\n const zScale = Math.sqrt(1 - z * z) * scale;\n newDst[0] = Math.cos(angle) * zScale;\n newDst[1] = Math.sin(angle) * zScale;\n newDst[2] = z * scale;\n\n return newDst;\n}\n\n/**\n * Zero's a vector\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The zeroed vector.\n */\nfunction zero(dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n\n return newDst;\n}\n\n\n/**\n * transform vec3 by 4x4 matrix\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional vec3 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nfunction transformMat4(v: Vec3Arg, m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const x = v[0];\n const y = v[1];\n const z = v[2];\n const w = (m[3] * x + m[7] * y + m[11] * z + m[15]) || 1;\n\n newDst[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;\n newDst[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;\n newDst[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;\n\n return newDst;\n}\n\n/**\n * Transform vec3 by upper 3x3 matrix inside 4x4 matrix.\n * @param v - The direction.\n * @param m - The matrix.\n * @param dst - optional vec3 to store result. If not passed a new one is created.\n * @returns The transformed vector.\n */\nfunction transformMat4Upper3x3(v: Vec3Arg, m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n\n newDst[0] = v0 * m[0 * 4 + 0] + v1 * m[1 * 4 + 0] + v2 * m[2 * 4 + 0];\n newDst[1] = v0 * m[0 * 4 + 1] + v1 * m[1 * 4 + 1] + v2 * m[2 * 4 + 1];\n newDst[2] = v0 * m[0 * 4 + 2] + v1 * m[1 * 4 + 2] + v2 * m[2 * 4 + 2];\n\n return newDst;\n}\n\n/**\n * Transforms vec3 by 3x3 matrix\n *\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional vec3 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nfunction transformMat3(v: Vec3Arg, m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const x = v[0];\n const y = v[1];\n const z = v[2];\n\n newDst[0] = x * m[0] + y * m[4] + z * m[8];\n newDst[1] = x * m[1] + y * m[5] + z * m[9];\n newDst[2] = x * m[2] + y * m[6] + z * m[10];\n\n return newDst;\n}\n\n/**\n * Transforms vec3 by Quaternion\n * @param v - the vector to transform\n * @param q - the quaternion to transform by\n * @param dst - optional vec3 to store result. If not passed a new one is created.\n * @returns the transformed\n */\nfunction transformQuat(v: Vec3Arg, q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const w2 = q[3] * 2;\n\n const x = v[0];\n const y = v[1];\n const z = v[2];\n\n const uvX = qy * z - qz * y;\n const uvY = qz * x - qx * z;\n const uvZ = qx * y - qy * x;\n\n newDst[0] = x + uvX * w2 + (qy * uvZ - qz * uvY) * 2;\n newDst[1] = y + uvY * w2 + (qz * uvX - qx * uvZ) * 2;\n newDst[2] = z + uvZ * w2 + (qx * uvY - qy * uvX) * 2;\n\n return newDst;\n}\n\n/**\n * Returns the translation component of a 4-by-4 matrix as a vector with 3\n * entries.\n * @param m - The matrix.\n * @param dst - vector to hold result. If not passed a new one is created.\n * @returns The translation component of m.\n */\nfunction getTranslation(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n newDst[0] = m[12];\n newDst[1] = m[13];\n newDst[2] = m[14];\n return newDst;\n}\n/**\n * Returns an axis of a 4x4 matrix as a vector with 3 entries\n * @param m - The matrix.\n * @param axis - The axis 0 = x, 1 = y, 2 = z;\n * @returns The axis component of m.\n */\nfunction getAxis(m: Mat4Arg, axis: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const off = axis * 4;\n newDst[0] = m[off + 0];\n newDst[1] = m[off + 1];\n newDst[2] = m[off + 2];\n return newDst;\n}\n/**\n * Returns the scaling component of the matrix\n * @param m - The Matrix\n * @param dst - The vector to set. If not passed a new one is created.\n */\nfunction getScaling(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const xx = m[0];\n const xy = m[1];\n const xz = m[2];\n const yx = m[4];\n const yy = m[5];\n const yz = m[6];\n const zx = m[8];\n const zy = m[9];\n const zz = m[10];\n newDst[0] = Math.sqrt(xx * xx + xy * xy + xz * xz);\n newDst[1] = Math.sqrt(yx * yx + yy * yy + yz * yz);\n newDst[2] = Math.sqrt(zx * zx + zy * zy + zz * zz);\n return newDst;\n}\n\n/**\n * Rotate a 3D vector around the x-axis\n *\n * @param {ReadonlyVec3} a The vec3 point to rotate\n * @param {ReadonlyVec3} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @param dst - The vector to set. If not passed a new one is created.\n * @returns the rotated vector\n */\nfunction rotateX(a: Vec3Arg, b: Vec3Arg, rad: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const p = [];\n const r = [];\n\n //Translate point to the origin\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2];\n\n //perform rotation\n r[0] = p[0];\n r[1] = p[1] * Math.cos(rad) - p[2] * Math.sin(rad);\n r[2] = p[1] * Math.sin(rad) + p[2] * Math.cos(rad);\n\n //translate to correct position\n newDst[0] = r[0] + b[0];\n newDst[1] = r[1] + b[1];\n newDst[2] = r[2] + b[2];\n\n return newDst;\n}\n\n/**\n * Rotate a 3D vector around the y-axis\n *\n * @param {ReadonlyVec3} a The vec3 point to rotate\n * @param {ReadonlyVec3} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @param dst - The vector to set. If not passed a new one is created.\n * @returns the rotated vector\n */\nfunction rotateY(a: Vec3Arg, b: Vec3Arg, rad: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const p = [];\n const r = [];\n\n // translate point to the origin\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2];\n\n // perform rotation\n r[0] = p[2] * Math.sin(rad) + p[0] * Math.cos(rad);\n r[1] = p[1];\n r[2] = p[2] * Math.cos(rad) - p[0] * Math.sin(rad);\n\n // translate to correct position\n newDst[0] = r[0] + b[0];\n newDst[1] = r[1] + b[1];\n newDst[2] = r[2] + b[2];\n\n return newDst;\n}\n\n/**\n * Rotate a 3D vector around the z-axis\n *\n * @param {ReadonlyVec3} a The vec3 point to rotate\n * @param {ReadonlyVec3} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @param dst - The vector to set. If not passed a new one is created.\n * @returns {vec3} out\n */\nfunction rotateZ(a: Vec3Arg, b: Vec3Arg, rad: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const p = [];\n const r = [];\n\n // translate point to the origin\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2];\n\n // perform rotation\n r[0] = p[0] * Math.cos(rad) - p[1] * Math.sin(rad);\n r[1] = p[0] * Math.sin(rad) + p[1] * Math.cos(rad);\n r[2] = p[2];\n\n // translate to correct position\n newDst[0] = r[0] + b[0];\n newDst[1] = r[1] + b[1];\n newDst[2] = r[2] + b[2];\n\n return newDst;\n}\n\n/**\n * Treat a 3D vector as a direction and set it's length\n *\n * @param a The vec3 to lengthen\n * @param len The length of the resulting vector\n * @returns The lengthened vector\n */\nfunction setLength(a: Vec3Arg, len: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n normalize(a, newDst);\n return mulScalar(newDst, len, newDst);\n}\n\n/**\n * Ensure a vector is not longer than a max length\n *\n * @param a The vec3 to limit\n * @param maxLen The longest length of the resulting vector\n * @returns The vector, shortened to maxLen if it's too long\n */\nfunction truncate(a: Vec3Arg, maxLen: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n if (length(a) > maxLen) {\n return setLength(a, maxLen, newDst);\n }\n\n return copy(a, newDst);\n}\n\n/**\n * Return the vector exactly between 2 endpoint vectors\n *\n * @param a Endpoint 1\n * @param b Endpoint 2\n * @returns The vector exactly residing between endpoints 1 and 2\n */\nfunction midpoint(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n return lerp(a, b, 0.5, newDst);\n}\n\nreturn {\n create,\n fromValues,\n set,\n ceil,\n floor,\n round,\n clamp,\n add,\n addScaled,\n angle,\n subtract,\n sub,\n equalsApproximately,\n equals,\n lerp,\n lerpV,\n max,\n min,\n mulScalar,\n scale,\n divScalar,\n inverse,\n invert,\n cross,\n dot,\n length,\n len,\n lengthSq,\n lenSq,\n distance,\n dist,\n distanceSq,\n distSq,\n normalize,\n negate,\n copy,\n clone,\n multiply,\n mul,\n divide,\n div,\n random,\n zero,\n transformMat4,\n transformMat4Upper3x3,\n transformMat3,\n transformQuat,\n getTranslation,\n getAxis,\n getScaling,\n rotateX,\n rotateY,\n rotateZ,\n setLength,\n truncate,\n midpoint,\n};\n\n}\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\nexport function getAPI(Ctor: Vec3Ctor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n","import { Mat4Arg, Mat4Type } from './mat4';\nimport { Mat3Arg } from './mat3';\nimport { QuatArg } from './quat';\nimport { Vec3Arg } from './vec3';\nimport { getAPI as getVec3API } from './vec3-impl';\nimport { BaseArgType } from './types';\nimport * as utils from './utils';\n\nexport { Mat4Arg, Mat4Type };\n\ntype Mat4Ctor = new (n: number) => T;\n\n/**\n * Generates a typed API for Mat4\n * */\nfunction getAPIImpl(Ctor: Mat4Ctor) {\n const vec3 = getVec3API(Ctor);\n\n/**\n * 4x4 Matrix math math functions.\n *\n * Almost all functions take an optional `newDst` argument. If it is not passed in the\n * functions will create a new matrix. In other words you can do this\n *\n * const mat = mat4.translation([1, 2, 3]); // Creates a new translation matrix\n *\n * or\n *\n * const mat = mat4.create();\n * mat4.translation([1, 2, 3], mat); // Puts translation matrix in mat.\n *\n * The first style is often easier but depending on where it's used it generates garbage where\n * as there is almost never allocation with the second style.\n *\n * It is always save to pass any matrix as the destination. So for example\n *\n * const mat = mat4.identity();\n * const trans = mat4.translation([1, 2, 3]);\n * mat4.multiply(mat, trans, mat); // Multiplies mat * trans and puts result in mat.\n *\n */\n\n\n/**\n * Create a Mat4 from values\n *\n * Note: Since passing in a raw JavaScript array\n * is valid in all circumstances, if you want to\n * force a JavaScript array into a Mat4's specified type\n * it would be faster to use\n *\n * ```\n * const m = mat4.clone(someJSArray);\n * ```\n *\n * @param v0 - value for element 0\n * @param v1 - value for element 1\n * @param v2 - value for element 2\n * @param v3 - value for element 3\n * @param v4 - value for element 4\n * @param v5 - value for element 5\n * @param v6 - value for element 6\n * @param v7 - value for element 7\n * @param v8 - value for element 8\n * @param v9 - value for element 9\n * @param v10 - value for element 10\n * @param v11 - value for element 11\n * @param v12 - value for element 12\n * @param v13 - value for element 13\n * @param v14 - value for element 14\n * @param v15 - value for element 15\n * @returns created from values.\n */\nfunction create(\n v0?: number, v1?: number, v2?: number, v3?: number,\n v4?: number, v5?: number, v6?: number, v7?: number,\n v8?: number, v9?: number, v10?: number, v11?: number,\n v12?: number, v13?: number, v14?: number, v15?: number) {\n const newDst = new Ctor(16);\n if (v0 !== undefined) {\n newDst[0] = v0;\n if (v1 !== undefined) {\n newDst[1] = v1;\n if (v2 !== undefined) {\n newDst[2] = v2;\n if (v3 !== undefined) {\n newDst[3] = v3;\n if (v4 !== undefined) {\n newDst[4] = v4;\n if (v5 !== undefined) {\n newDst[5] = v5;\n if (v6 !== undefined) {\n newDst[6] = v6;\n if (v7 !== undefined) {\n newDst[7] = v7;\n if (v8 !== undefined) {\n newDst[8] = v8;\n if (v9 !== undefined) {\n newDst[9] = v9;\n if (v10 !== undefined) {\n newDst[10] = v10;\n if (v11 !== undefined) {\n newDst[11] = v11;\n if (v12 !== undefined) {\n newDst[12] = v12;\n if (v13 !== undefined) {\n newDst[13] = v13;\n if (v14 !== undefined) {\n newDst[14] = v14;\n if (v15 !== undefined) {\n newDst[15] = v15;\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n return newDst;\n}\n\n/**\n * Sets the values of a Mat4\n * Also see {@link mat4.create} and {@link mat4.copy}\n *\n * @param v0 - value for element 0\n * @param v1 - value for element 1\n * @param v2 - value for element 2\n * @param v3 - value for element 3\n * @param v4 - value for element 4\n * @param v5 - value for element 5\n * @param v6 - value for element 6\n * @param v7 - value for element 7\n * @param v8 - value for element 8\n * @param v9 - value for element 9\n * @param v10 - value for element 10\n * @param v11 - value for element 11\n * @param v12 - value for element 12\n * @param v13 - value for element 13\n * @param v14 - value for element 14\n * @param v15 - value for element 15\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat4 created from values.\n */\nfunction set(\n v0: number, v1: number, v2: number, v3: number,\n v4: number, v5: number, v6: number, v7: number,\n v8: number, v9: number, v10: number, v11: number,\n v12: number, v13: number, v14: number, v15: number,\n dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = v0; newDst[ 1] = v1; newDst[ 2] = v2; newDst[ 3] = v3;\n newDst[ 4] = v4; newDst[ 5] = v5; newDst[ 6] = v6; newDst[ 7] = v7;\n newDst[ 8] = v8; newDst[ 9] = v9; newDst[10] = v10; newDst[11] = v11;\n newDst[12] = v12; newDst[13] = v13; newDst[14] = v14; newDst[15] = v15;\n\n return newDst;\n}\n\n/**\n * Creates a Mat4 from a Mat3\n * @param m3 - source matrix\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat4 made from m3\n */\nfunction fromMat3(m3: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = m3[0]; newDst[ 1] = m3[1]; newDst[ 2] = m3[ 2]; newDst[ 3] = 0;\n newDst[ 4] = m3[4]; newDst[ 5] = m3[5]; newDst[ 6] = m3[ 6]; newDst[ 7] = 0;\n newDst[ 8] = m3[8]; newDst[ 9] = m3[9]; newDst[10] = m3[10]; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Creates a Mat4 rotation matrix from a quaternion\n * @param q - quaternion to create matrix from\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat4 made from q\n */\nfunction fromQuat(q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const x = q[0]; const y = q[1]; const z = q[2]; const w = q[3];\n const x2 = x + x; const y2 = y + y; const z2 = z + z;\n\n const xx = x * x2;\n const yx = y * x2;\n const yy = y * y2;\n const zx = z * x2;\n const zy = z * y2;\n const zz = z * z2;\n const wx = w * x2;\n const wy = w * y2;\n const wz = w * z2;\n\n newDst[ 0] = 1 - yy - zz; newDst[ 1] = yx + wz; newDst[ 2] = zx - wy; newDst[ 3] = 0;\n newDst[ 4] = yx - wz; newDst[ 5] = 1 - xx - zz; newDst[ 6] = zy + wx; newDst[ 7] = 0;\n newDst[ 8] = zx + wy; newDst[ 9] = zy - wx; newDst[10] = 1 - xx - yy; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Negates a matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns -m.\n */\nfunction negate(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = -m[ 0]; newDst[ 1] = -m[ 1]; newDst[ 2] = -m[ 2]; newDst[ 3] = -m[ 3];\n newDst[ 4] = -m[ 4]; newDst[ 5] = -m[ 5]; newDst[ 6] = -m[ 6]; newDst[ 7] = -m[ 7];\n newDst[ 8] = -m[ 8]; newDst[ 9] = -m[ 9]; newDst[10] = -m[10]; newDst[11] = -m[11];\n newDst[12] = -m[12]; newDst[13] = -m[13]; newDst[14] = -m[14]; newDst[15] = -m[15];\n\n return newDst;\n}\n\n/**\n * Copies a matrix. (same as {@link mat4.clone})\n * Also see {@link mat4.create} and {@link mat4.set}\n * @param m - The matrix.\n * @param dst - The matrix. If not passed a new one is created.\n * @returns A copy of m.\n */\nfunction copy(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = m[ 0]; newDst[ 1] = m[ 1]; newDst[ 2] = m[ 2]; newDst[ 3] = m[ 3];\n newDst[ 4] = m[ 4]; newDst[ 5] = m[ 5]; newDst[ 6] = m[ 6]; newDst[ 7] = m[ 7];\n newDst[ 8] = m[ 8]; newDst[ 9] = m[ 9]; newDst[10] = m[10]; newDst[11] = m[11];\n newDst[12] = m[12]; newDst[13] = m[13]; newDst[14] = m[14]; newDst[15] = m[15];\n\n return newDst;\n}\n\n/**\n * Copies a matrix (same as {@link mat4.copy})\n * Also see {@link mat4.create} and {@link mat4.set}\n * @param m - The matrix.\n * @param dst - The matrix. If not passed a new one is created.\n * @returns A copy of m.\n */\nconst clone = copy;\n\n/**\n * Check if 2 matrices are approximately equal\n * @param a - Operand matrix.\n * @param b - Operand matrix.\n * @returns true if matrices are approximately equal\n */\nfunction equalsApproximately(a: Mat4Arg, b: Mat4Arg): boolean {\n return Math.abs(a[ 0] - b[ 0]) < utils.EPSILON &&\n Math.abs(a[ 1] - b[ 1]) < utils.EPSILON &&\n Math.abs(a[ 2] - b[ 2]) < utils.EPSILON &&\n Math.abs(a[ 3] - b[ 3]) < utils.EPSILON &&\n Math.abs(a[ 4] - b[ 4]) < utils.EPSILON &&\n Math.abs(a[ 5] - b[ 5]) < utils.EPSILON &&\n Math.abs(a[ 6] - b[ 6]) < utils.EPSILON &&\n Math.abs(a[ 7] - b[ 7]) < utils.EPSILON &&\n Math.abs(a[ 8] - b[ 8]) < utils.EPSILON &&\n Math.abs(a[ 9] - b[ 9]) < utils.EPSILON &&\n Math.abs(a[10] - b[10]) < utils.EPSILON &&\n Math.abs(a[11] - b[11]) < utils.EPSILON &&\n Math.abs(a[12] - b[12]) < utils.EPSILON &&\n Math.abs(a[13] - b[13]) < utils.EPSILON &&\n Math.abs(a[14] - b[14]) < utils.EPSILON &&\n Math.abs(a[15] - b[15]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 matrices are exactly equal\n * @param a - Operand matrix.\n * @param b - Operand matrix.\n * @returns true if matrices are exactly equal\n */\nfunction equals(a: Mat4Arg, b: Mat4Arg): boolean {\n return a[ 0] === b[ 0] &&\n a[ 1] === b[ 1] &&\n a[ 2] === b[ 2] &&\n a[ 3] === b[ 3] &&\n a[ 4] === b[ 4] &&\n a[ 5] === b[ 5] &&\n a[ 6] === b[ 6] &&\n a[ 7] === b[ 7] &&\n a[ 8] === b[ 8] &&\n a[ 9] === b[ 9] &&\n a[10] === b[10] &&\n a[11] === b[11] &&\n a[12] === b[12] &&\n a[13] === b[13] &&\n a[14] === b[14] &&\n a[15] === b[15];\n}\n\n/**\n * Creates a 4-by-4 identity matrix.\n *\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns A 4-by-4 identity matrix.\n */\nfunction identity(dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = 1; newDst[ 1] = 0; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = 1; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Takes the transpose of a matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The transpose of m.\n */\nfunction transpose(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n if (newDst === m) {\n let t;\n\n t = m[1];\n m[1] = m[4];\n m[4] = t;\n\n t = m[2];\n m[2] = m[8];\n m[8] = t;\n\n t = m[3];\n m[3] = m[12];\n m[12] = t;\n\n t = m[6];\n m[6] = m[9];\n m[9] = t;\n\n t = m[7];\n m[7] = m[13];\n m[13] = t;\n\n t = m[11];\n m[11] = m[14];\n m[14] = t;\n return newDst;\n }\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const m30 = m[3 * 4 + 0];\n const m31 = m[3 * 4 + 1];\n const m32 = m[3 * 4 + 2];\n const m33 = m[3 * 4 + 3];\n\n newDst[ 0] = m00; newDst[ 1] = m10; newDst[ 2] = m20; newDst[ 3] = m30;\n newDst[ 4] = m01; newDst[ 5] = m11; newDst[ 6] = m21; newDst[ 7] = m31;\n newDst[ 8] = m02; newDst[ 9] = m12; newDst[10] = m22; newDst[11] = m32;\n newDst[12] = m03; newDst[13] = m13; newDst[14] = m23; newDst[15] = m33;\n\n return newDst;\n}\n\n/**\n * Computes the inverse of a 4-by-4 matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The inverse of m.\n */\nfunction inverse(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const m30 = m[3 * 4 + 0];\n const m31 = m[3 * 4 + 1];\n const m32 = m[3 * 4 + 2];\n const m33 = m[3 * 4 + 3];\n const tmp0 = m22 * m33;\n const tmp1 = m32 * m23;\n const tmp2 = m12 * m33;\n const tmp3 = m32 * m13;\n const tmp4 = m12 * m23;\n const tmp5 = m22 * m13;\n const tmp6 = m02 * m33;\n const tmp7 = m32 * m03;\n const tmp8 = m02 * m23;\n const tmp9 = m22 * m03;\n const tmp10 = m02 * m13;\n const tmp11 = m12 * m03;\n const tmp12 = m20 * m31;\n const tmp13 = m30 * m21;\n const tmp14 = m10 * m31;\n const tmp15 = m30 * m11;\n const tmp16 = m10 * m21;\n const tmp17 = m20 * m11;\n const tmp18 = m00 * m31;\n const tmp19 = m30 * m01;\n const tmp20 = m00 * m21;\n const tmp21 = m20 * m01;\n const tmp22 = m00 * m11;\n const tmp23 = m10 * m01;\n\n const t0 = (tmp0 * m11 + tmp3 * m21 + tmp4 * m31) -\n (tmp1 * m11 + tmp2 * m21 + tmp5 * m31);\n const t1 = (tmp1 * m01 + tmp6 * m21 + tmp9 * m31) -\n (tmp0 * m01 + tmp7 * m21 + tmp8 * m31);\n const t2 = (tmp2 * m01 + tmp7 * m11 + tmp10 * m31) -\n (tmp3 * m01 + tmp6 * m11 + tmp11 * m31);\n const t3 = (tmp5 * m01 + tmp8 * m11 + tmp11 * m21) -\n (tmp4 * m01 + tmp9 * m11 + tmp10 * m21);\n\n const d = 1 / (m00 * t0 + m10 * t1 + m20 * t2 + m30 * t3);\n\n newDst[ 0] = d * t0;\n newDst[ 1] = d * t1;\n newDst[ 2] = d * t2;\n newDst[ 3] = d * t3;\n newDst[ 4] = d * ((tmp1 * m10 + tmp2 * m20 + tmp5 * m30) -\n (tmp0 * m10 + tmp3 * m20 + tmp4 * m30));\n newDst[ 5] = d * ((tmp0 * m00 + tmp7 * m20 + tmp8 * m30) -\n (tmp1 * m00 + tmp6 * m20 + tmp9 * m30));\n newDst[ 6] = d * ((tmp3 * m00 + tmp6 * m10 + tmp11 * m30) -\n (tmp2 * m00 + tmp7 * m10 + tmp10 * m30));\n newDst[ 7] = d * ((tmp4 * m00 + tmp9 * m10 + tmp10 * m20) -\n (tmp5 * m00 + tmp8 * m10 + tmp11 * m20));\n newDst[ 8] = d * ((tmp12 * m13 + tmp15 * m23 + tmp16 * m33) -\n (tmp13 * m13 + tmp14 * m23 + tmp17 * m33));\n newDst[ 9] = d * ((tmp13 * m03 + tmp18 * m23 + tmp21 * m33) -\n (tmp12 * m03 + tmp19 * m23 + tmp20 * m33));\n newDst[10] = d * ((tmp14 * m03 + tmp19 * m13 + tmp22 * m33) -\n (tmp15 * m03 + tmp18 * m13 + tmp23 * m33));\n newDst[11] = d * ((tmp17 * m03 + tmp20 * m13 + tmp23 * m23) -\n (tmp16 * m03 + tmp21 * m13 + tmp22 * m23));\n newDst[12] = d * ((tmp14 * m22 + tmp17 * m32 + tmp13 * m12) -\n (tmp16 * m32 + tmp12 * m12 + tmp15 * m22));\n newDst[13] = d * ((tmp20 * m32 + tmp12 * m02 + tmp19 * m22) -\n (tmp18 * m22 + tmp21 * m32 + tmp13 * m02));\n newDst[14] = d * ((tmp18 * m12 + tmp23 * m32 + tmp15 * m02) -\n (tmp22 * m32 + tmp14 * m02 + tmp19 * m12));\n newDst[15] = d * ((tmp22 * m22 + tmp16 * m02 + tmp21 * m12) -\n (tmp20 * m12 + tmp23 * m22 + tmp17 * m02));\n\n return newDst;\n}\n\n/**\n * Compute the determinant of a matrix\n * @param m - the matrix\n * @returns the determinant\n */\nfunction determinant(m: Mat4Arg): number {\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const m30 = m[3 * 4 + 0];\n const m31 = m[3 * 4 + 1];\n const m32 = m[3 * 4 + 2];\n const m33 = m[3 * 4 + 3];\n\n const tmp0 = m22 * m33;\n const tmp1 = m32 * m23;\n const tmp2 = m12 * m33;\n const tmp3 = m32 * m13;\n const tmp4 = m12 * m23;\n const tmp5 = m22 * m13;\n const tmp6 = m02 * m33;\n const tmp7 = m32 * m03;\n const tmp8 = m02 * m23;\n const tmp9 = m22 * m03;\n const tmp10 = m02 * m13;\n const tmp11 = m12 * m03;\n\n const t0 = (tmp0 * m11 + tmp3 * m21 + tmp4 * m31) -\n (tmp1 * m11 + tmp2 * m21 + tmp5 * m31);\n const t1 = (tmp1 * m01 + tmp6 * m21 + tmp9 * m31) -\n (tmp0 * m01 + tmp7 * m21 + tmp8 * m31);\n const t2 = (tmp2 * m01 + tmp7 * m11 + tmp10 * m31) -\n (tmp3 * m01 + tmp6 * m11 + tmp11 * m31);\n const t3 = (tmp5 * m01 + tmp8 * m11 + tmp11 * m21) -\n (tmp4 * m01 + tmp9 * m11 + tmp10 * m21);\n\n return m00 * t0 + m10 * t1 + m20 * t2 + m30 * t3;\n}\n\n/**\n * Computes the inverse of a 4-by-4 matrix. (same as inverse)\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The inverse of m.\n */\nconst invert = inverse;\n\n/**\n * Multiplies two 4-by-4 matrices with a on the left and b on the right\n * @param a - The matrix on the left.\n * @param b - The matrix on the right.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix product of a and b.\n */\nfunction multiply(a: Mat4Arg, b: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a03 = a[3];\n const a10 = a[ 4 + 0];\n const a11 = a[ 4 + 1];\n const a12 = a[ 4 + 2];\n const a13 = a[ 4 + 3];\n const a20 = a[ 8 + 0];\n const a21 = a[ 8 + 1];\n const a22 = a[ 8 + 2];\n const a23 = a[ 8 + 3];\n const a30 = a[12 + 0];\n const a31 = a[12 + 1];\n const a32 = a[12 + 2];\n const a33 = a[12 + 3];\n const b00 = b[0];\n const b01 = b[1];\n const b02 = b[2];\n const b03 = b[3];\n const b10 = b[ 4 + 0];\n const b11 = b[ 4 + 1];\n const b12 = b[ 4 + 2];\n const b13 = b[ 4 + 3];\n const b20 = b[ 8 + 0];\n const b21 = b[ 8 + 1];\n const b22 = b[ 8 + 2];\n const b23 = b[ 8 + 3];\n const b30 = b[12 + 0];\n const b31 = b[12 + 1];\n const b32 = b[12 + 2];\n const b33 = b[12 + 3];\n\n newDst[ 0] = a00 * b00 + a10 * b01 + a20 * b02 + a30 * b03;\n newDst[ 1] = a01 * b00 + a11 * b01 + a21 * b02 + a31 * b03;\n newDst[ 2] = a02 * b00 + a12 * b01 + a22 * b02 + a32 * b03;\n newDst[ 3] = a03 * b00 + a13 * b01 + a23 * b02 + a33 * b03;\n newDst[ 4] = a00 * b10 + a10 * b11 + a20 * b12 + a30 * b13;\n newDst[ 5] = a01 * b10 + a11 * b11 + a21 * b12 + a31 * b13;\n newDst[ 6] = a02 * b10 + a12 * b11 + a22 * b12 + a32 * b13;\n newDst[ 7] = a03 * b10 + a13 * b11 + a23 * b12 + a33 * b13;\n newDst[ 8] = a00 * b20 + a10 * b21 + a20 * b22 + a30 * b23;\n newDst[ 9] = a01 * b20 + a11 * b21 + a21 * b22 + a31 * b23;\n newDst[10] = a02 * b20 + a12 * b21 + a22 * b22 + a32 * b23;\n newDst[11] = a03 * b20 + a13 * b21 + a23 * b22 + a33 * b23;\n newDst[12] = a00 * b30 + a10 * b31 + a20 * b32 + a30 * b33;\n newDst[13] = a01 * b30 + a11 * b31 + a21 * b32 + a31 * b33;\n newDst[14] = a02 * b30 + a12 * b31 + a22 * b32 + a32 * b33;\n newDst[15] = a03 * b30 + a13 * b31 + a23 * b32 + a33 * b33;\n\n return newDst;\n}\n\n/**\n * Multiplies two 4-by-4 matrices with a on the left and b on the right (same as multiply)\n * @param a - The matrix on the left.\n * @param b - The matrix on the right.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix product of a and b.\n */\nconst mul = multiply;\n\n/**\n * Sets the translation component of a 4-by-4 matrix to the given\n * vector.\n * @param a - The matrix.\n * @param v - The vector.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix with translation set.\n */\nfunction setTranslation(a: Mat4Arg, v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? identity()) as T;\n if (a !== newDst) {\n newDst[ 0] = a[ 0];\n newDst[ 1] = a[ 1];\n newDst[ 2] = a[ 2];\n newDst[ 3] = a[ 3];\n newDst[ 4] = a[ 4];\n newDst[ 5] = a[ 5];\n newDst[ 6] = a[ 6];\n newDst[ 7] = a[ 7];\n newDst[ 8] = a[ 8];\n newDst[ 9] = a[ 9];\n newDst[10] = a[10];\n newDst[11] = a[11];\n }\n newDst[12] = v[0];\n newDst[13] = v[1];\n newDst[14] = v[2];\n newDst[15] = 1;\n return newDst;\n}\n\n///**\n// * Returns the translation component of a 4-by-4 matrix as a vector with 3\n// * entries.\n// * @param m - The matrix.\n// * @param dst - vector to hold result. If not passed a new one is created.\n// * @returns The translation component of m.\n// */\nfunction getTranslation(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? vec3.create()) as T;\n newDst[0] = m[12];\n newDst[1] = m[13];\n newDst[2] = m[14];\n return newDst;\n}\n\n/**\n * Returns an axis of a 4x4 matrix as a vector with 3 entries\n * @param m - The matrix.\n * @param axis - The axis 0 = x, 1 = y, 2 = z;\n * @returns The axis component of m.\n */\nfunction getAxis(m: Mat4Arg, axis: number, dst?: T) {\n const newDst = (dst ?? vec3.create());\n const off = axis * 4;\n newDst[0] = m[off + 0];\n newDst[1] = m[off + 1];\n newDst[2] = m[off + 2];\n return newDst;\n}\n\n/**\n * Sets an axis of a 4x4 matrix as a vector with 3 entries\n * @param m - The matrix.\n * @param v - the axis vector\n * @param axis - The axis 0 = x, 1 = y, 2 = z;\n * @param dst - The matrix to set. If not passed a new one is created.\n * @returns The matrix with axis set.\n */\nfunction setAxis(m: Mat4Arg, v: Vec3Arg, axis: number, dst: T) {\n const newDst = (dst === m) ? dst : copy(m, dst);\n\n const off = axis * 4;\n newDst[off + 0] = v[0];\n newDst[off + 1] = v[1];\n newDst[off + 2] = v[2];\n return newDst;\n}\n\n///**\n// * Returns the scaling component of the matrix\n// * @param m - The Matrix\n// * @param dst - The vector to set. If not passed a new one is created.\n// */\nfunction getScaling(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? vec3.create()) as T;\n\n const xx = m[0];\n const xy = m[1];\n const xz = m[2];\n const yx = m[4];\n const yy = m[5];\n const yz = m[6];\n const zx = m[8];\n const zy = m[9];\n const zz = m[10];\n\n newDst[0] = Math.sqrt(xx * xx + xy * xy + xz * xz);\n newDst[1] = Math.sqrt(yx * yx + yy * yy + yz * yz);\n newDst[2] = Math.sqrt(zx * zx + zy * zy + zz * zz);\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 perspective transformation matrix given the angular height\n * of the frustum, the aspect ratio, and the near and far clipping planes. The\n * arguments define a frustum extending in the negative z direction. The given\n * angle is the vertical angle of the frustum, and the horizontal angle is\n * determined to produce the given aspect ratio. The arguments near and far are\n * the distances to the near and far clipping planes. Note that near and far\n * are not z coordinates, but rather they are distances along the negative\n * z-axis. The matrix generated sends the viewing frustum to the unit box.\n * We assume a unit box extending from -1 to 1 in the x and y dimensions and\n * from 0 to 1 in the z dimension.\n *\n * Note: If you pass `Infinity` for zFar then it will produce a projection matrix\n * returns -Infinity for Z when transforming coordinates with Z <= 0 and +Infinity for Z\n * otherwise.\n *\n * @param fieldOfViewYInRadians - The camera angle from top to bottom (in radians).\n * @param aspect - The aspect ratio width / height.\n * @param zNear - The depth (negative z coordinate)\n * of the near clipping plane.\n * @param zFar - The depth (negative z coordinate)\n * of the far clipping plane.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The perspective matrix.\n */\nfunction perspective(fieldOfViewYInRadians: number, aspect: number, zNear: number, zFar: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const f = Math.tan(Math.PI * 0.5 - 0.5 * fieldOfViewYInRadians);\n\n newDst[0] = f / aspect;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 0;\n\n newDst[4] = 0;\n newDst[5] = f;\n newDst[6] = 0;\n newDst[7] = 0;\n\n newDst[8] = 0;\n newDst[9] = 0;\n newDst[11] = -1;\n\n newDst[12] = 0;\n newDst[13] = 0;\n newDst[15] = 0;\n\n if (Number.isFinite(zFar)) {\n const rangeInv = 1 / (zNear - zFar);\n newDst[10] = zFar * rangeInv;\n newDst[14] = zFar * zNear * rangeInv;\n } else {\n newDst[10] = -1;\n newDst[14] = -zNear;\n }\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 reverse-z perspective transformation matrix given the angular height\n * of the frustum, the aspect ratio, and the near and far clipping planes. The\n * arguments define a frustum extending in the negative z direction. The given\n * angle is the vertical angle of the frustum, and the horizontal angle is\n * determined to produce the given aspect ratio. The arguments near and far are\n * the distances to the near and far clipping planes. Note that near and far\n * are not z coordinates, but rather they are distances along the negative\n * z-axis. The matrix generated sends the viewing frustum to the unit box.\n * We assume a unit box extending from -1 to 1 in the x and y dimensions and\n * from 1 (at -zNear) to 0 (at -zFar) in the z dimension.\n *\n * @param fieldOfViewYInRadians - The camera angle from top to bottom (in radians).\n * @param aspect - The aspect ratio width / height.\n * @param zNear - The depth (negative z coordinate)\n * of the near clipping plane.\n * @param zFar - The depth (negative z coordinate)\n * of the far clipping plane. (default = Infinity)\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The perspective matrix.\n */function perspectiveReverseZ(fieldOfViewYInRadians: number, aspect: number, zNear: number, zFar = Infinity, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const f = 1 / Math.tan(fieldOfViewYInRadians * 0.5);\n\n newDst[ 0] = f / aspect;\n newDst[ 1] = 0;\n newDst[ 2] = 0;\n newDst[ 3] = 0;\n\n newDst[ 4] = 0;\n newDst[ 5] = f;\n newDst[ 6] = 0;\n newDst[ 7] = 0;\n\n newDst[ 8] = 0;\n newDst[ 9] = 0;\n newDst[11] = -1;\n\n newDst[12] = 0;\n newDst[13] = 0;\n newDst[15] = 0;\n\n if (zFar === Infinity) {\n newDst[10] = 0;\n newDst[14] = zNear;\n } else {\n const rangeInv = 1 / (zFar - zNear);\n newDst[10] = zNear * rangeInv;\n newDst[14] = zFar * zNear * rangeInv;\n }\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 orthogonal transformation matrix that transforms from\n * the given the left, right, bottom, and top dimensions to -1 +1 in x, and y\n * and 0 to +1 in z.\n * @param left - Left side of the near clipping plane viewport.\n * @param right - Right side of the near clipping plane viewport.\n * @param bottom - Bottom of the near clipping plane viewport.\n * @param top - Top of the near clipping plane viewport.\n * @param near - The depth (negative z coordinate)\n * of the near clipping plane.\n * @param far - The depth (negative z coordinate)\n * of the far clipping plane.\n * @param dst - Output matrix. If not passed a new one is created.\n * @returns The orthographic projection matrix.\n */\nfunction ortho(left: number, right: number, bottom: number, top: number, near: number, far: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[0] = 2 / (right - left);\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 0;\n\n newDst[4] = 0;\n newDst[5] = 2 / (top - bottom);\n newDst[6] = 0;\n newDst[7] = 0;\n\n newDst[8] = 0;\n newDst[9] = 0;\n newDst[10] = 1 / (near - far);\n newDst[11] = 0;\n\n newDst[12] = (right + left) / (left - right);\n newDst[13] = (top + bottom) / (bottom - top);\n newDst[14] = near / (near - far);\n newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 perspective transformation matrix given the left, right,\n * top, bottom, near and far clipping planes. The arguments define a frustum\n * extending in the negative z direction. The arguments near and far are the\n * distances to the near and far clipping planes. Note that near and far are not\n * z coordinates, but rather they are distances along the negative z-axis. The\n * matrix generated sends the viewing frustum to the unit box. We assume a unit\n * box extending from -1 to 1 in the x and y dimensions and from 0 to 1 in the z\n * dimension.\n * @param left - The x coordinate of the left plane of the box.\n * @param right - The x coordinate of the right plane of the box.\n * @param bottom - The y coordinate of the bottom plane of the box.\n * @param top - The y coordinate of the right plane of the box.\n * @param near - The negative z coordinate of the near plane of the box.\n * @param far - The negative z coordinate of the far plane of the box.\n * @param dst - Output matrix. If not passed a new one is created.\n * @returns The perspective projection matrix.\n */\nfunction frustum(left: number, right: number, bottom: number, top: number, near: number, far: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const dx = (right - left);\n const dy = (top - bottom);\n const dz = (near - far);\n\n newDst[ 0] = 2 * near / dx;\n newDst[ 1] = 0;\n newDst[ 2] = 0;\n newDst[ 3] = 0;\n newDst[ 4] = 0;\n newDst[ 5] = 2 * near / dy;\n newDst[ 6] = 0;\n newDst[ 7] = 0;\n newDst[ 8] = (left + right) / dx;\n newDst[ 9] = (top + bottom) / dy;\n newDst[10] = far / dz;\n newDst[11] = -1;\n newDst[12] = 0;\n newDst[13] = 0;\n newDst[14] = near * far / dz;\n newDst[15] = 0;\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 reverse-z perspective transformation matrix given the left, right,\n * top, bottom, near and far clipping planes. The arguments define a frustum\n * extending in the negative z direction. The arguments near and far are the\n * distances to the near and far clipping planes. Note that near and far are not\n * z coordinates, but rather they are distances along the negative z-axis. The\n * matrix generated sends the viewing frustum to the unit box. We assume a unit\n * box extending from -1 to 1 in the x and y dimensions and from 1 (-near) to 0 (-far) in the z\n * dimension.\n * @param left - The x coordinate of the left plane of the box.\n * @param right - The x coordinate of the right plane of the box.\n * @param bottom - The y coordinate of the bottom plane of the box.\n * @param top - The y coordinate of the right plane of the box.\n * @param near - The negative z coordinate of the near plane of the box.\n * @param far - The negative z coordinate of the far plane of the box.\n * @param dst - Output matrix. If not passed a new one is created.\n * @returns The perspective projection matrix.\n */\nfunction frustumReverseZ(left: number, right: number, bottom: number, top: number, near: number, far = Infinity, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const dx = (right - left);\n const dy = (top - bottom);\n\n newDst[ 0] = 2 * near / dx;\n newDst[ 1] = 0;\n newDst[ 2] = 0;\n newDst[ 3] = 0;\n newDst[ 4] = 0;\n newDst[ 5] = 2 * near / dy;\n newDst[ 6] = 0;\n newDst[ 7] = 0;\n newDst[ 8] = (left + right) / dx;\n newDst[ 9] = (top + bottom) / dy;\n newDst[11] = -1;\n newDst[12] = 0;\n newDst[13] = 0;\n newDst[15] = 0;\n\n if (far === Infinity) {\n newDst[10] = 0;\n newDst[14] = near;\n } else {\n const rangeInv = 1 / (far - near);\n newDst[10] = near * rangeInv;\n newDst[14] = far * near * rangeInv;\n }\n\n return newDst;\n}\n\nconst xAxis = vec3.create();\nconst yAxis = vec3.create();\nconst zAxis = vec3.create();\n\n/**\n * Computes a 4-by-4 aim transformation.\n *\n * This is a matrix which positions an object aiming down positive Z.\n * toward the target.\n *\n * Note: this is **NOT** the inverse of lookAt as lookAt looks at negative Z.\n *\n * @param position - The position of the object.\n * @param target - The position meant to be aimed at.\n * @param up - A vector pointing up.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The aim matrix.\n */\nfunction aim(position: Vec3Arg, target: Vec3Arg, up: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n vec3.normalize(vec3.subtract(target, position, zAxis), zAxis);\n vec3.normalize(vec3.cross(up, zAxis, xAxis), xAxis);\n vec3.normalize(vec3.cross(zAxis, xAxis, yAxis), yAxis);\n\n newDst[ 0] = xAxis[0]; newDst[ 1] = xAxis[1]; newDst[ 2] = xAxis[2]; newDst[ 3] = 0;\n newDst[ 4] = yAxis[0]; newDst[ 5] = yAxis[1]; newDst[ 6] = yAxis[2]; newDst[ 7] = 0;\n newDst[ 8] = zAxis[0]; newDst[ 9] = zAxis[1]; newDst[10] = zAxis[2]; newDst[11] = 0;\n newDst[12] = position[0]; newDst[13] = position[1]; newDst[14] = position[2]; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 camera aim transformation.\n *\n * This is a matrix which positions an object aiming down negative Z.\n * toward the target.\n *\n * Note: this is the inverse of `lookAt`\n *\n * @param eye - The position of the object.\n * @param target - The position meant to be aimed at.\n * @param up - A vector pointing up.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The aim matrix.\n */\nfunction cameraAim(eye: Vec3Arg, target: Vec3Arg, up: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n vec3.normalize(vec3.subtract(eye, target, zAxis), zAxis);\n vec3.normalize(vec3.cross(up, zAxis, xAxis), xAxis);\n vec3.normalize(vec3.cross(zAxis, xAxis, yAxis), yAxis);\n\n newDst[ 0] = xAxis[0]; newDst[ 1] = xAxis[1]; newDst[ 2] = xAxis[2]; newDst[ 3] = 0;\n newDst[ 4] = yAxis[0]; newDst[ 5] = yAxis[1]; newDst[ 6] = yAxis[2]; newDst[ 7] = 0;\n newDst[ 8] = zAxis[0]; newDst[ 9] = zAxis[1]; newDst[10] = zAxis[2]; newDst[11] = 0;\n newDst[12] = eye[0]; newDst[13] = eye[1]; newDst[14] = eye[2]; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 view transformation.\n *\n * This is a view matrix which transforms all other objects\n * to be in the space of the view defined by the parameters.\n *\n * @param eye - The position of the object.\n * @param target - The position meant to be aimed at.\n * @param up - A vector pointing up.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The look-at matrix.\n */\nfunction lookAt(eye: Vec3Arg, target: Vec3Arg, up: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n vec3.normalize(vec3.subtract(eye, target, zAxis), zAxis);\n vec3.normalize(vec3.cross(up, zAxis, xAxis), xAxis);\n vec3.normalize(vec3.cross(zAxis, xAxis, yAxis), yAxis);\n\n newDst[ 0] = xAxis[0]; newDst[ 1] = yAxis[0]; newDst[ 2] = zAxis[0]; newDst[ 3] = 0;\n newDst[ 4] = xAxis[1]; newDst[ 5] = yAxis[1]; newDst[ 6] = zAxis[1]; newDst[ 7] = 0;\n newDst[ 8] = xAxis[2]; newDst[ 9] = yAxis[2]; newDst[10] = zAxis[2]; newDst[11] = 0;\n\n newDst[12] = -(xAxis[0] * eye[0] + xAxis[1] * eye[1] + xAxis[2] * eye[2]);\n newDst[13] = -(yAxis[0] * eye[0] + yAxis[1] * eye[1] + yAxis[2] * eye[2]);\n newDst[14] = -(zAxis[0] * eye[0] + zAxis[1] * eye[1] + zAxis[2] * eye[2]);\n newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which translates by the given vector v.\n * @param v - The vector by\n * which to translate.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The translation matrix.\n */\nfunction translation(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = 1; newDst[ 1] = 0; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = 1; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1; newDst[11] = 0;\n newDst[12] = v[0]; newDst[13] = v[1]; newDst[14] = v[2]; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Translates the given 4-by-4 matrix by the given vector v.\n * @param m - The matrix.\n * @param v - The vector by\n * which to translate.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The translated matrix.\n */\nfunction translate(m: Mat4Arg, v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const m00 = m[0];\n const m01 = m[1];\n const m02 = m[2];\n const m03 = m[3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const m30 = m[3 * 4 + 0];\n const m31 = m[3 * 4 + 1];\n const m32 = m[3 * 4 + 2];\n const m33 = m[3 * 4 + 3];\n\n if (m !== newDst) {\n newDst[ 0] = m00;\n newDst[ 1] = m01;\n newDst[ 2] = m02;\n newDst[ 3] = m03;\n newDst[ 4] = m10;\n newDst[ 5] = m11;\n newDst[ 6] = m12;\n newDst[ 7] = m13;\n newDst[ 8] = m20;\n newDst[ 9] = m21;\n newDst[10] = m22;\n newDst[11] = m23;\n }\n\n newDst[12] = m00 * v0 + m10 * v1 + m20 * v2 + m30;\n newDst[13] = m01 * v0 + m11 * v1 + m21 * v2 + m31;\n newDst[14] = m02 * v0 + m12 * v1 + m22 * v2 + m32;\n newDst[15] = m03 * v0 + m13 * v1 + m23 * v2 + m33;\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the x-axis by the given angle.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotation matrix.\n */\nfunction rotationX(angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = 1; newDst[ 1] = 0; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = c; newDst[ 6] = s; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = -s; newDst[10] = c; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Rotates the given 4-by-4 matrix around the x-axis by the given\n * angle.\n * @param m - The matrix.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nfunction rotateX(m: Mat4Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const m10 = m[4];\n const m11 = m[5];\n const m12 = m[6];\n const m13 = m[7];\n const m20 = m[8];\n const m21 = m[9];\n const m22 = m[10];\n const m23 = m[11];\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[4] = c * m10 + s * m20;\n newDst[5] = c * m11 + s * m21;\n newDst[6] = c * m12 + s * m22;\n newDst[7] = c * m13 + s * m23;\n newDst[8] = c * m20 - s * m10;\n newDst[9] = c * m21 - s * m11;\n newDst[10] = c * m22 - s * m12;\n newDst[11] = c * m23 - s * m13;\n\n if (m !== newDst) {\n newDst[ 0] = m[ 0];\n newDst[ 1] = m[ 1];\n newDst[ 2] = m[ 2];\n newDst[ 3] = m[ 3];\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the y-axis by the given angle.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotation matrix.\n */\nfunction rotationY(angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c; newDst[ 1] = 0; newDst[ 2] = -s; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = 1; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = s; newDst[ 9] = 0; newDst[10] = c; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Rotates the given 4-by-4 matrix around the y-axis by the given\n * angle.\n * @param m - The matrix.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nfunction rotateY(m: Mat4Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c * m00 - s * m20;\n newDst[ 1] = c * m01 - s * m21;\n newDst[ 2] = c * m02 - s * m22;\n newDst[ 3] = c * m03 - s * m23;\n newDst[ 8] = c * m20 + s * m00;\n newDst[ 9] = c * m21 + s * m01;\n newDst[10] = c * m22 + s * m02;\n newDst[11] = c * m23 + s * m03;\n\n if (m !== newDst) {\n newDst[ 4] = m[ 4];\n newDst[ 5] = m[ 5];\n newDst[ 6] = m[ 6];\n newDst[ 7] = m[ 7];\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the z-axis by the given angle.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotation matrix.\n */\nfunction rotationZ(angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c; newDst[ 1] = s; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = -s; newDst[ 5] = c; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Rotates the given 4-by-4 matrix around the z-axis by the given\n * angle.\n * @param m - The matrix.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nfunction rotateZ(m: Mat4Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c * m00 + s * m10;\n newDst[ 1] = c * m01 + s * m11;\n newDst[ 2] = c * m02 + s * m12;\n newDst[ 3] = c * m03 + s * m13;\n newDst[ 4] = c * m10 - s * m00;\n newDst[ 5] = c * m11 - s * m01;\n newDst[ 6] = c * m12 - s * m02;\n newDst[ 7] = c * m13 - s * m03;\n\n if (m !== newDst) {\n newDst[ 8] = m[ 8];\n newDst[ 9] = m[ 9];\n newDst[10] = m[10];\n newDst[11] = m[11];\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the given axis by the given\n * angle.\n * @param axis - The axis\n * about which to rotate.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns A matrix which rotates angle radians\n * around the axis.\n */\nfunction axisRotation(axis: Vec3Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n let x = axis[0];\n let y = axis[1];\n let z = axis[2];\n const n = Math.sqrt(x * x + y * y + z * z);\n x /= n;\n y /= n;\n z /= n;\n const xx = x * x;\n const yy = y * y;\n const zz = z * z;\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n const oneMinusCosine = 1 - c;\n\n newDst[ 0] = xx + (1 - xx) * c;\n newDst[ 1] = x * y * oneMinusCosine + z * s;\n newDst[ 2] = x * z * oneMinusCosine - y * s;\n newDst[ 3] = 0;\n newDst[ 4] = x * y * oneMinusCosine - z * s;\n newDst[ 5] = yy + (1 - yy) * c;\n newDst[ 6] = y * z * oneMinusCosine + x * s;\n newDst[ 7] = 0;\n newDst[ 8] = x * z * oneMinusCosine + y * s;\n newDst[ 9] = y * z * oneMinusCosine - x * s;\n newDst[10] = zz + (1 - zz) * c;\n newDst[11] = 0;\n newDst[12] = 0;\n newDst[13] = 0;\n newDst[14] = 0;\n newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the given axis by the given\n * angle. (same as axisRotation)\n * @param axis - The axis\n * about which to rotate.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns A matrix which rotates angle radians\n * around the axis.\n */\nconst rotation = axisRotation;\n\n/**\n * Rotates the given 4-by-4 matrix around the given axis by the\n * given angle.\n * @param m - The matrix.\n * @param axis - The axis\n * about which to rotate.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nfunction axisRotate(m: Mat4Arg, axis: Vec3Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n let x = axis[0];\n let y = axis[1];\n let z = axis[2];\n const n = Math.sqrt(x * x + y * y + z * z);\n x /= n;\n y /= n;\n z /= n;\n const xx = x * x;\n const yy = y * y;\n const zz = z * z;\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n const oneMinusCosine = 1 - c;\n\n const r00 = xx + (1 - xx) * c;\n const r01 = x * y * oneMinusCosine + z * s;\n const r02 = x * z * oneMinusCosine - y * s;\n const r10 = x * y * oneMinusCosine - z * s;\n const r11 = yy + (1 - yy) * c;\n const r12 = y * z * oneMinusCosine + x * s;\n const r20 = x * z * oneMinusCosine + y * s;\n const r21 = y * z * oneMinusCosine - x * s;\n const r22 = zz + (1 - zz) * c;\n\n const m00 = m[0];\n const m01 = m[1];\n const m02 = m[2];\n const m03 = m[3];\n const m10 = m[4];\n const m11 = m[5];\n const m12 = m[6];\n const m13 = m[7];\n const m20 = m[8];\n const m21 = m[9];\n const m22 = m[10];\n const m23 = m[11];\n\n newDst[ 0] = r00 * m00 + r01 * m10 + r02 * m20;\n newDst[ 1] = r00 * m01 + r01 * m11 + r02 * m21;\n newDst[ 2] = r00 * m02 + r01 * m12 + r02 * m22;\n newDst[ 3] = r00 * m03 + r01 * m13 + r02 * m23;\n newDst[ 4] = r10 * m00 + r11 * m10 + r12 * m20;\n newDst[ 5] = r10 * m01 + r11 * m11 + r12 * m21;\n newDst[ 6] = r10 * m02 + r11 * m12 + r12 * m22;\n newDst[ 7] = r10 * m03 + r11 * m13 + r12 * m23;\n newDst[ 8] = r20 * m00 + r21 * m10 + r22 * m20;\n newDst[ 9] = r20 * m01 + r21 * m11 + r22 * m21;\n newDst[10] = r20 * m02 + r21 * m12 + r22 * m22;\n newDst[11] = r20 * m03 + r21 * m13 + r22 * m23;\n\n if (m !== newDst) {\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\n/**\n * Rotates the given 4-by-4 matrix around the given axis by the\n * given angle. (same as rotate)\n * @param m - The matrix.\n * @param axis - The axis\n * about which to rotate.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nconst rotate = axisRotate;\n\n/**\n * Creates a 4-by-4 matrix which scales in each dimension by an amount given by\n * the corresponding entry in the given vector; assumes the vector has three\n * entries.\n * @param v - A vector of\n * three entries specifying the factor by which to scale in each dimension.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaling matrix.\n */\nfunction scaling(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = v[0]; newDst[ 1] = 0; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = v[1]; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = v[2]; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Scales the given 4-by-4 matrix in each dimension by an amount\n * given by the corresponding entry in the given vector; assumes the vector has\n * three entries.\n * @param m - The matrix to be modified.\n * @param v - A vector of three entries specifying the\n * factor by which to scale in each dimension.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaled matrix.\n */\nfunction scale(m: Mat4Arg, v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n\n newDst[ 0] = v0 * m[0 * 4 + 0];\n newDst[ 1] = v0 * m[0 * 4 + 1];\n newDst[ 2] = v0 * m[0 * 4 + 2];\n newDst[ 3] = v0 * m[0 * 4 + 3];\n newDst[ 4] = v1 * m[1 * 4 + 0];\n newDst[ 5] = v1 * m[1 * 4 + 1];\n newDst[ 6] = v1 * m[1 * 4 + 2];\n newDst[ 7] = v1 * m[1 * 4 + 3];\n newDst[ 8] = v2 * m[2 * 4 + 0];\n newDst[ 9] = v2 * m[2 * 4 + 1];\n newDst[10] = v2 * m[2 * 4 + 2];\n newDst[11] = v2 * m[2 * 4 + 3];\n\n if (m !== newDst) {\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which scales a uniform amount in each dimension.\n * @param s - the amount to scale\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaling matrix.\n */\nfunction uniformScaling(s: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = s; newDst[ 1] = 0; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = s; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = s; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Scales the given 4-by-4 matrix in each dimension by a uniform scale.\n * @param m - The matrix to be modified.\n * @param s - The amount to scale.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaled matrix.\n */\nfunction uniformScale(m: Mat4Arg, s: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = s * m[0 * 4 + 0];\n newDst[ 1] = s * m[0 * 4 + 1];\n newDst[ 2] = s * m[0 * 4 + 2];\n newDst[ 3] = s * m[0 * 4 + 3];\n newDst[ 4] = s * m[1 * 4 + 0];\n newDst[ 5] = s * m[1 * 4 + 1];\n newDst[ 6] = s * m[1 * 4 + 2];\n newDst[ 7] = s * m[1 * 4 + 3];\n newDst[ 8] = s * m[2 * 4 + 0];\n newDst[ 9] = s * m[2 * 4 + 1];\n newDst[10] = s * m[2 * 4 + 2];\n newDst[11] = s * m[2 * 4 + 3];\n\n if (m !== newDst) {\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\nreturn {\n create,\n set,\n fromMat3,\n fromQuat,\n negate,\n copy,\n clone,\n equalsApproximately,\n equals,\n identity,\n transpose,\n inverse,\n determinant,\n invert,\n multiply,\n mul,\n setTranslation,\n getTranslation,\n getAxis,\n setAxis,\n getScaling,\n perspective,\n perspectiveReverseZ,\n ortho,\n frustum,\n frustumReverseZ,\n aim,\n cameraAim,\n lookAt,\n translation,\n translate,\n rotationX,\n rotateX,\n rotationY,\n rotateY,\n rotationZ,\n rotateZ,\n axisRotation,\n rotation,\n axisRotate,\n rotate,\n scaling,\n scale,\n uniformScaling,\n uniformScale,\n};\n\n}\n\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\nexport function getAPI(Ctor: Mat4Ctor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport * as utils from './utils.js';\nimport { QuatArg, QuatType } from './quat';\nimport { Mat3Arg } from './mat3.js';\nimport { Mat4Arg } from './mat4.js';\nimport { Vec3Arg } from './vec3.js';\nimport { getAPI as getVec3API } from './vec3-impl';\nimport { BaseArgType } from './types';\n\nexport { QuatArg, QuatType };\n\ntype QuatCtor = new (n: number) => T;\n\nexport type RotationOrder = 'xyz' | 'xzy' | 'yxz' | 'yzx' | 'zxy' | 'zyx';\n\n/**\n * Generates am typed API for Qud\n * */\nfunction getAPIImpl(Ctor: QuatCtor) {\n const vec3 = getVec3API(Ctor);\n\n/**\n * Creates a quat4; may be called with x, y, z to set initial values.\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @param w - Initial w value.\n * @returns the created vector\n */\nfunction create(x?: number, y?: number, z?: number, w?: number) {\n const newDst = new Ctor(4);\n if (x !== undefined) {\n newDst[0] = x;\n if (y !== undefined) {\n newDst[1] = y;\n if (z !== undefined) {\n newDst[2] = z;\n if (w !== undefined) {\n newDst[3] = w;\n }\n }\n }\n }\n return newDst;\n}\n\n/**\n * Creates a Quat; may be called with x, y, z to set initial values. (same as create)\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @param z - Initial w value.\n * @returns the created vector\n */\nconst fromValues = create;\n\n/**\n * Sets the values of a Quat\n * Also see {@link quat.create} and {@link quat.copy}\n *\n * @param x first value\n * @param y second value\n * @param z third value\n * @param w fourth value\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector with its elements set.\n */\nfunction set(x: number, y: number, z: number, w: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = x;\n newDst[1] = y;\n newDst[2] = z;\n newDst[3] = w;\n\n return newDst;\n}\n\n/**\n * Sets a quaternion from the given angle and axis,\n * then returns it.\n *\n * @param axis - the axis to rotate around\n * @param angleInRadians - the angle\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The quaternion that represents the given axis and angle\n **/\nfunction fromAxisAngle(axis: Vec3Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const halfAngle = angleInRadians * 0.5;\n const s = Math.sin(halfAngle);\n\n newDst[0] = s * axis[0];\n newDst[1] = s * axis[1];\n newDst[2] = s * axis[2];\n newDst[3] = Math.cos(halfAngle);\n\n return newDst;\n}\n\n/**\n * Gets the rotation axis and angle\n * @param q - quaternion to compute from\n * @param dst - Vec3 to hold result. If not passed in a new one is created.\n * @return angle and axis\n */\nfunction toAxisAngle(q: QuatArg, dst?: T): { angle: number, axis: T } {\n const newDst = (dst ?? vec3.create(3)) as T;\n\n const angle = Math.acos(q[3]) * 2;\n const s = Math.sin(angle * 0.5);\n if (s > utils.EPSILON) {\n newDst[0] = q[0] / s;\n newDst[1] = q[1] / s;\n newDst[2] = q[2] / s;\n } else {\n newDst[0] = 1;\n newDst[1] = 0;\n newDst[2] = 0;\n }\n\n return { angle, axis: newDst };\n}\n\n/**\n * Returns the angle in degrees between two rotations a and b.\n * @param a - quaternion a\n * @param b - quaternion b\n * @return angle in radians between the two quaternions\n */\nfunction angle(a: QuatArg, b: QuatArg) {\n const d = dot(a, b);\n return Math.acos(2 * d * d - 1);\n}\n\n/**\n * Multiplies two quaternions\n *\n * @param a - the first quaternion\n * @param b - the second quaternion\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nfunction multiply(a: QuatArg, b: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const aw = a[3];\n\n const bx = b[0];\n const by = b[1];\n const bz = b[2];\n const bw = b[3];\n\n newDst[0] = ax * bw + aw * bx + ay * bz - az * by;\n newDst[1] = ay * bw + aw * by + az * bx - ax * bz;\n newDst[2] = az * bw + aw * bz + ax * by - ay * bx;\n newDst[3] = aw * bw - ax * bx - ay * by - az * bz;\n\n return newDst;\n}\n\n/**\n * Multiplies two quaternions\n *\n * @param a - the first quaternion\n * @param b - the second quaternion\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nconst mul = multiply;\n\n/**\n * Rotates the given quaternion around the X axis by the given angle.\n * @param q - quaternion to rotate\n * @param angleInRadians - The angle by which to rotate\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nfunction rotateX(q: QuatArg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const halfAngle = angleInRadians * 0.5;\n\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const qw = q[3];\n\n const bx = Math.sin(halfAngle);\n const bw = Math.cos(halfAngle);\n\n newDst[0] = qx * bw + qw * bx;\n newDst[1] = qy * bw + qz * bx;\n newDst[2] = qz * bw - qy * bx;\n newDst[3] = qw * bw - qx * bx;\n\n return newDst;\n}\n\n/**\n * Rotates the given quaternion around the Y axis by the given angle.\n * @param q - quaternion to rotate\n * @param angleInRadians - The angle by which to rotate\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nfunction rotateY(q: QuatArg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const halfAngle = angleInRadians * 0.5;\n\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const qw = q[3];\n\n const by = Math.sin(halfAngle);\n const bw = Math.cos(halfAngle);\n\n newDst[0] = qx * bw - qz * by;\n newDst[1] = qy * bw + qw * by;\n newDst[2] = qz * bw + qx * by;\n newDst[3] = qw * bw - qy * by;\n\n return newDst;\n}\n\n/**\n * Rotates the given quaternion around the Z axis by the given angle.\n * @param q - quaternion to rotate\n * @param angleInRadians - The angle by which to rotate\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nfunction rotateZ(q: QuatArg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const halfAngle = angleInRadians * 0.5;\n\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const qw = q[3];\n\n const bz = Math.sin(halfAngle);\n const bw = Math.cos(halfAngle);\n\n newDst[0] = qx * bw + qy * bz;\n newDst[1] = qy * bw - qx * bz;\n newDst[2] = qz * bw + qw * bz;\n newDst[3] = qw * bw - qz * bz;\n\n return newDst;\n}\n\n/**\n * Spherically linear interpolate between two quaternions\n *\n * @param a - starting value\n * @param b - ending value\n * @param t - value where 0 = a and 1 = b\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nfunction slerp(a: QuatArg, b: QuatArg, t: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const aw = a[3];\n\n let bx = b[0];\n let by = b[1];\n let bz = b[2];\n let bw = b[3];\n\n let cosOmega = ax * bx + ay * by + az * bz + aw * bw;\n\n if (cosOmega < 0) {\n cosOmega = -cosOmega;\n bx = -bx;\n by = -by;\n bz = -bz;\n bw = -bw;\n }\n\n let scale0;\n let scale1;\n\n if (1.0 - cosOmega > utils.EPSILON) {\n const omega = Math.acos(cosOmega);\n const sinOmega = Math.sin(omega);\n scale0 = Math.sin((1 - t) * omega) / sinOmega;\n scale1 = Math.sin(t * omega) / sinOmega;\n } else {\n scale0 = 1.0 - t;\n scale1 = t;\n }\n\n newDst[0] = scale0 * ax + scale1 * bx;\n newDst[1] = scale0 * ay + scale1 * by;\n newDst[2] = scale0 * az + scale1 * bz;\n newDst[3] = scale0 * aw + scale1 * bw;\n\n return newDst;\n}\n\n/**\n * Compute the inverse of a quaternion\n *\n * @param q - quaternion to compute the inverse of\n * @returns A quaternion that is the result of a * b\n */\nfunction inverse(q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const a0 = q[0];\n const a1 = q[1];\n const a2 = q[2];\n const a3 = q[3];\n\n const dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3;\n const invDot = dot ? 1 / dot : 0;\n\n newDst[0] = -a0 * invDot;\n newDst[1] = -a1 * invDot;\n newDst[2] = -a2 * invDot;\n newDst[3] = a3 * invDot;\n\n return newDst;\n}\n\n/**\n * Compute the conjugate of a quaternion\n * For quaternions with a magnitude of 1 (a unit quaternion)\n * this returns the same as the inverse but is faster to calculate.\n *\n * @param q - quaternion to compute the conjugate of.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The conjugate of q\n */\nfunction conjugate(q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = -q[0];\n newDst[1] = -q[1];\n newDst[2] = -q[2];\n newDst[3] = q[3];\n\n return newDst;\n}\n\n/**\n * Creates a quaternion from the given rotation matrix.\n *\n * The created quaternion is not normalized.\n *\n * @param m - rotation matrix\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns the result\n */\nfunction fromMat(m: Mat3Arg | Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n /*\n 0 1 2\n 3 4 5\n 6 7 8\n\n 0 1 2\n 4 5 6\n 8 9 10\n */\n\n // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes\n // article \"Quaternion Calculus and Fast Animation\".\n const trace = m[0] + m[5] + m[10];\n\n if (trace > 0.0) {\n // |w| > 1/2, may as well choose w > 1/2\n const root = Math.sqrt(trace + 1); // 2w\n newDst[3] = 0.5 * root;\n const invRoot = 0.5 / root; // 1/(4w)\n\n newDst[0] = (m[6] - m[9]) * invRoot;\n newDst[1] = (m[8] - m[2]) * invRoot;\n newDst[2] = (m[1] - m[4]) * invRoot;\n } else {\n // |w| <= 1/2\n let i = 0;\n\n if (m[5] > m[0]) {\n i = 1;\n }\n if (m[10] > m[i * 4 + i]) {\n i = 2;\n }\n\n const j = (i + 1) % 3;\n const k = (i + 2) % 3;\n\n const root = Math.sqrt(m[i * 4 + i] - m[j * 4 + j] - m[k * 4 + k] + 1.0);\n newDst[i] = 0.5 * root;\n\n const invRoot = 0.5 / root;\n\n newDst[3] = (m[j * 4 + k] - m[k * 4 + j]) * invRoot;\n newDst[j] = (m[j * 4 + i] + m[i * 4 + j]) * invRoot;\n newDst[k] = (m[k * 4 + i] + m[i * 4 + k]) * invRoot;\n }\n\n return newDst;\n}\n\n/**\n * Creates a quaternion from the given euler angle x, y, z using the provided intrinsic order for the conversion.\n *\n * @param xAngleInRadians - angle to rotate around X axis in radians.\n * @param yAngleInRadians - angle to rotate around Y axis in radians.\n * @param zAngleInRadians - angle to rotate around Z axis in radians.\n * @param order - order to apply euler angles\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion representing the same rotation as the euler angles applied in the given order\n */\nfunction fromEuler(\n xAngleInRadians: number,\n yAngleInRadians: number,\n zAngleInRadians: number,\n order: RotationOrder,\n dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const xHalfAngle = xAngleInRadians * 0.5;\n const yHalfAngle = yAngleInRadians * 0.5;\n const zHalfAngle = zAngleInRadians * 0.5;\n\n const sx = Math.sin(xHalfAngle);\n const cx = Math.cos(xHalfAngle);\n const sy = Math.sin(yHalfAngle);\n const cy = Math.cos(yHalfAngle);\n const sz = Math.sin(zHalfAngle);\n const cz = Math.cos(zHalfAngle);\n\n switch (order) {\n case 'xyz':\n newDst[0] = sx * cy * cz + cx * sy * sz;\n newDst[1] = cx * sy * cz - sx * cy * sz;\n newDst[2] = cx * cy * sz + sx * sy * cz;\n newDst[3] = cx * cy * cz - sx * sy * sz;\n break;\n\n case 'xzy':\n newDst[0] = sx * cy * cz - cx * sy * sz;\n newDst[1] = cx * sy * cz - sx * cy * sz;\n newDst[2] = cx * cy * sz + sx * sy * cz;\n newDst[3] = cx * cy * cz + sx * sy * sz;\n break;\n\n case 'yxz':\n newDst[0] = sx * cy * cz + cx * sy * sz;\n newDst[1] = cx * sy * cz - sx * cy * sz;\n newDst[2] = cx * cy * sz - sx * sy * cz;\n newDst[3] = cx * cy * cz + sx * sy * sz;\n break;\n\n case 'yzx':\n newDst[0] = sx * cy * cz + cx * sy * sz;\n newDst[1] = cx * sy * cz + sx * cy * sz;\n newDst[2] = cx * cy * sz - sx * sy * cz;\n newDst[3] = cx * cy * cz - sx * sy * sz;\n break;\n\n case 'zxy':\n newDst[0] = sx * cy * cz - cx * sy * sz;\n newDst[1] = cx * sy * cz + sx * cy * sz;\n newDst[2] = cx * cy * sz + sx * sy * cz;\n newDst[3] = cx * cy * cz - sx * sy * sz;\n break;\n\n case 'zyx':\n newDst[0] = sx * cy * cz - cx * sy * sz;\n newDst[1] = cx * sy * cz + sx * cy * sz;\n newDst[2] = cx * cy * sz - sx * sy * cz;\n newDst[3] = cx * cy * cz + sx * sy * sz;\n break;\n\n default:\n throw new Error(`Unknown rotation order: ${order}`);\n }\n\n return newDst;\n}\n\n/**\n * Copies a quaternion. (same as {@link quat.clone})\n * Also see {@link quat.create} and {@link quat.set}\n * @param q - The quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is a copy of q\n */\nfunction copy(q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = q[0];\n newDst[1] = q[1];\n newDst[2] = q[2];\n newDst[3] = q[3];\n\n return newDst;\n}\n\n/**\n * Clones a quaternion. (same as {@link quat.copy})\n * Also see {@link quat.create} and {@link quat.set}\n * @param q - The quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A copy of q.\n */\nconst clone = copy;\n\n/**\n * Adds two quaternions; assumes a and b have the same dimension.\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the sum of a and b.\n */\nfunction add(a: QuatArg, b: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + b[0];\n newDst[1] = a[1] + b[1];\n newDst[2] = a[2] + b[2];\n newDst[3] = a[3] + b[3];\n\n return newDst;\n}\n\n/**\n * Subtracts two quaternions.\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the difference of a and b.\n */\nfunction subtract(a: QuatArg, b: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] - b[0];\n newDst[1] = a[1] - b[1];\n newDst[2] = a[2] - b[2];\n newDst[3] = a[3] - b[3];\n\n return newDst;\n}\n\n/**\n * Subtracts two quaternions.\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the difference of a and b.\n */\nconst sub = subtract;\n\n/**\n * Multiplies a quaternion by a scalar.\n * @param v - The quaternion.\n * @param k - The scalar.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The scaled quaternion.\n */\nfunction mulScalar(v: QuatArg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = v[0] * k;\n newDst[1] = v[1] * k;\n newDst[2] = v[2] * k;\n newDst[3] = v[3] * k;\n\n return newDst;\n}\n\n/**\n * Multiplies a quaternion by a scalar. (same as mulScalar)\n * @param v - The quaternion.\n * @param k - The scalar.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The scaled quaternion.\n */\nconst scale = mulScalar;\n\n/**\n * Divides a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The scaled quaternion.\n */\nfunction divScalar(v: QuatArg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = v[0] / k;\n newDst[1] = v[1] / k;\n newDst[2] = v[2] / k;\n newDst[3] = v[3] / k;\n\n return newDst;\n}\n\n/**\n * Computes the dot product of two quaternions\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @returns dot product\n */\nfunction dot(a: QuatArg, b: QuatArg): number {\n return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]) + (a[3] * b[3]);\n}\n\n/**\n * Performs linear interpolation on two quaternions.\n * Given quaternions a and b and interpolation coefficient t, returns\n * a + t * (b - a).\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @param t - Interpolation coefficient.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The linear interpolated result.\n */\nfunction lerp(a: QuatArg, b: QuatArg, t: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + t * (b[0] - a[0]);\n newDst[1] = a[1] + t * (b[1] - a[1]);\n newDst[2] = a[2] + t * (b[2] - a[2]);\n newDst[3] = a[3] + t * (b[3] - a[3]);\n\n return newDst;\n}\n\n/**\n * Computes the length of quaternion\n * @param v - quaternion.\n * @returns length of quaternion.\n */\nfunction length(v: QuatArg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n return Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3);\n}\n\n/**\n * Computes the length of quaternion (same as length)\n * @param v - quaternion.\n * @returns length of quaternion.\n */\nconst len = length;\n\n/**\n * Computes the square of the length of quaternion\n * @param v - quaternion.\n * @returns square of the length of quaternion.\n */\nfunction lengthSq(v: QuatArg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n return v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3;\n}\n\n/**\n * Computes the square of the length of quaternion (same as lengthSq)\n * @param v - quaternion.\n * @returns square of the length of quaternion.\n */\nconst lenSq = lengthSq;\n\n/**\n * Divides a quaternion by its Euclidean length and returns the quotient.\n * @param v - The quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The normalized quaternion.\n */\nfunction normalize(v: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n const len = Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3);\n\n if (len > 0.00001) {\n newDst[0] = v0 / len;\n newDst[1] = v1 / len;\n newDst[2] = v2 / len;\n newDst[3] = v3 / len;\n } else {\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 0;\n }\n\n return newDst;\n}\n\n/**\n * Check if 2 quaternions are approximately equal\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @returns true if quaternions are approximately equal\n */\nfunction equalsApproximately(a: QuatArg, b: QuatArg): boolean {\n return Math.abs(a[0] - b[0]) < utils.EPSILON &&\n Math.abs(a[1] - b[1]) < utils.EPSILON &&\n Math.abs(a[2] - b[2]) < utils.EPSILON &&\n Math.abs(a[3] - b[3]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 quaternions are exactly equal\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @returns true if quaternions are exactly equal\n */\nfunction equals(a: QuatArg, b: QuatArg): boolean {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];\n}\n\n/**\n * Creates an identity quaternion\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns an identity quaternion\n */\nfunction identity(dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 1;\n\n return newDst;\n}\n\nconst tempVec3 = vec3.create();\nconst xUnitVec3 = vec3.create();\nconst yUnitVec3 = vec3.create();\n\n/**\n * Computes a quaternion to represent the shortest rotation from one vector to another.\n *\n * @param aUnit - the start vector\n * @param bUnit - the end vector\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns the result\n */\nfunction rotationTo(aUnit: Vec3Arg, bUnit: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const dot = vec3.dot(aUnit, bUnit);\n if (dot < -0.999999) {\n vec3.cross(xUnitVec3, aUnit, tempVec3);\n if (vec3.len(tempVec3) < 0.000001) {\n vec3.cross(yUnitVec3, aUnit, tempVec3);\n }\n\n vec3.normalize(tempVec3, tempVec3);\n fromAxisAngle(tempVec3, Math.PI, newDst);\n\n return newDst;\n } else if (dot > 0.999999) {\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 1;\n\n return newDst;\n } else {\n vec3.cross(aUnit, bUnit, tempVec3);\n\n newDst[0] = tempVec3[0];\n newDst[1] = tempVec3[1];\n newDst[2] = tempVec3[2];\n newDst[3] = 1 + dot;\n\n return normalize(newDst, newDst);\n }\n}\n\nconst tempQuat1 = new Ctor(4);\nconst tempQuat2 = new Ctor(4);\n\n/**\n * Performs a spherical linear interpolation with two control points\n *\n * @param a - the first quaternion\n * @param b - the second quaternion\n * @param c - the third quaternion\n * @param d - the fourth quaternion\n * @param t - Interpolation coefficient 0 to 1\n * @returns result\n */\nfunction sqlerp(\n a: QuatArg,\n b: QuatArg,\n c: QuatArg,\n d: QuatArg,\n t: number,\n dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n slerp(a, d, t, tempQuat1);\n slerp(b, c, t, tempQuat2);\n slerp(tempQuat1, tempQuat2, 2 * t * (1 - t), newDst);\n\n return newDst;\n}\n\nreturn {\n create,\n fromValues,\n set,\n fromAxisAngle,\n toAxisAngle,\n angle,\n multiply,\n mul,\n rotateX,\n rotateY,\n rotateZ,\n slerp,\n inverse,\n conjugate,\n fromMat,\n fromEuler,\n copy,\n clone,\n add,\n subtract,\n sub,\n mulScalar,\n scale,\n divScalar,\n dot,\n lerp,\n length,\n len,\n lengthSq,\n lenSq,\n normalize,\n equalsApproximately,\n equals,\n identity,\n rotationTo,\n sqlerp,\n};\n\n}\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\n/**\n *\n * Quat4 math functions.\n *\n * Almost all functions take an optional `newDst` argument. If it is not passed in the\n * functions will create a new `Quat4`. In other words you can do this\n *\n * const v = quat4.cross(v1, v2); // Creates a new Quat4 with the cross product of v1 x v2.\n *\n * or\n *\n * const v = quat4.create();\n * quat4.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v\n *\n * The first style is often easier but depending on where it's used it generates garbage where\n * as there is almost never allocation with the second style.\n *\n * It is always safe to pass any vector as the destination. So for example\n *\n * quat4.cross(v1, v2, v1); // Puts the cross product of v1 x v2 in v1\n *\n */\nexport function getAPI(Ctor: QuatCtor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport * as utils from './utils.js';\nimport { Vec4Arg, Vec4Type } from './vec4';\nimport { Mat4Arg } from './mat4';\nimport { BaseArgType } from './types';\n\nexport { Vec4Arg, Vec4Type };\n\ntype Vec4Ctor = new (n: number) => T;\n\n/**\n * Generates am typed API for Vec4\n * */\nfunction getAPIImpl(Ctor: Vec4Ctor) {\n\n/**\n * Creates a vec4; may be called with x, y, z to set initial values.\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @param w - Initial w value.\n * @returns the created vector\n */\nfunction create(x?: number, y?: number, z?: number, w?: number) {\n const newDst = new Ctor(4);\n if (x !== undefined) {\n newDst[0] = x;\n if (y !== undefined) {\n newDst[1] = y;\n if (z !== undefined) {\n newDst[2] = z;\n if (w !== undefined) {\n newDst[3] = w;\n }\n }\n }\n }\n return newDst;\n}\n\n/**\n * Creates a vec4; may be called with x, y, z to set initial values. (same as create)\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @param z - Initial w value.\n * @returns the created vector\n */\nconst fromValues = create;\n\n/**\n * Sets the values of a Vec4\n * Also see {@link vec4.create} and {@link vec4.copy}\n *\n * @param x first value\n * @param y second value\n * @param z third value\n * @param w fourth value\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector with its elements set.\n */\nfunction set(x: number, y: number, z: number, w: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = x;\n newDst[1] = y;\n newDst[2] = z;\n newDst[3] = w;\n\n return newDst;\n}\n\n/**\n * Applies Math.ceil to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the ceil of each element of v.\n */\nfunction ceil(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.ceil(v[0]);\n newDst[1] = Math.ceil(v[1]);\n newDst[2] = Math.ceil(v[2]);\n newDst[3] = Math.ceil(v[3]);\n\n return newDst;\n}\n\n/**\n * Applies Math.floor to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the floor of each element of v.\n */\nfunction floor(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.floor(v[0]);\n newDst[1] = Math.floor(v[1]);\n newDst[2] = Math.floor(v[2]);\n newDst[3] = Math.floor(v[3]);\n\n return newDst;\n}\n\n/**\n * Applies Math.round to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the round of each element of v.\n */\nfunction round(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.round(v[0]);\n newDst[1] = Math.round(v[1]);\n newDst[2] = Math.round(v[2]);\n newDst[3] = Math.round(v[3]);\n\n return newDst;\n}\n\n/**\n * Clamp each element of vector between min and max\n * @param v - Operand vector.\n * @param max - Min value, default 0\n * @param min - Max value, default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that the clamped value of each element of v.\n */\nfunction clamp(v: Vec4Arg, min = 0, max = 1, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.min(max, Math.max(min, v[0]));\n newDst[1] = Math.min(max, Math.max(min, v[1]));\n newDst[2] = Math.min(max, Math.max(min, v[2]));\n newDst[3] = Math.min(max, Math.max(min, v[3]));\n\n return newDst;\n}\n\n/**\n * Adds two vectors; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a and b.\n */\nfunction add(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + b[0];\n newDst[1] = a[1] + b[1];\n newDst[2] = a[2] + b[2];\n newDst[3] = a[3] + b[3];\n\n return newDst;\n}\n\n/**\n * Adds two vectors, scaling the 2nd; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param scale - Amount to scale b\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a + b * scale.\n */\nfunction addScaled(a: Vec4Arg, b: Vec4Arg, scale: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + b[0] * scale;\n newDst[1] = a[1] + b[1] * scale;\n newDst[2] = a[2] + b[2] * scale;\n newDst[3] = a[3] + b[3] * scale;\n\n return newDst;\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nfunction subtract(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] - b[0];\n newDst[1] = a[1] - b[1];\n newDst[2] = a[2] - b[2];\n newDst[3] = a[3] - b[3];\n\n return newDst;\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nconst sub = subtract;\n\n/**\n * Check if 2 vectors are approximately equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are approximately equal\n */\nfunction equalsApproximately(a: Vec4Arg, b: Vec4Arg): boolean {\n return Math.abs(a[0] - b[0]) < utils.EPSILON &&\n Math.abs(a[1] - b[1]) < utils.EPSILON &&\n Math.abs(a[2] - b[2]) < utils.EPSILON &&\n Math.abs(a[3] - b[3]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 vectors are exactly equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are exactly equal\n */\nfunction equals(a: Vec4Arg, b: Vec4Arg): boolean {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficient.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The linear interpolated result.\n */\nfunction lerp(a: Vec4Arg, b: Vec4Arg, t: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + t * (b[0] - a[0]);\n newDst[1] = a[1] + t * (b[1] - a[1]);\n newDst[2] = a[2] + t * (b[2] - a[2]);\n newDst[3] = a[3] + t * (b[3] - a[3]);\n\n return newDst;\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient vector t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficients vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns the linear interpolated result.\n */\nfunction lerpV(a: Vec4Arg, b: Vec4Arg, t: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + t[0] * (b[0] - a[0]);\n newDst[1] = a[1] + t[1] * (b[1] - a[1]);\n newDst[2] = a[2] + t[2] * (b[2] - a[2]);\n newDst[3] = a[3] + t[3] * (b[3] - a[3]);\n\n return newDst;\n}\n\n/**\n * Return max values of two vectors.\n * Given vectors a and b returns\n * [max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The max components vector.\n */\nfunction max(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.max(a[0], b[0]);\n newDst[1] = Math.max(a[1], b[1]);\n newDst[2] = Math.max(a[2], b[2]);\n newDst[3] = Math.max(a[3], b[3]);\n\n return newDst;\n}\n\n/**\n * Return min values of two vectors.\n * Given vectors a and b returns\n * [min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The min components vector.\n */\nfunction min(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.min(a[0], b[0]);\n newDst[1] = Math.min(a[1], b[1]);\n newDst[2] = Math.min(a[2], b[2]);\n newDst[3] = Math.min(a[3], b[3]);\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction mulScalar(v: Vec4Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = v[0] * k;\n newDst[1] = v[1] * k;\n newDst[2] = v[2] * k;\n newDst[3] = v[3] * k;\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar. (same as mulScalar)\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nconst scale = mulScalar;\n\n/**\n * Divides a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction divScalar(v: Vec4Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = v[0] / k;\n newDst[1] = v[1] / k;\n newDst[2] = v[2] / k;\n newDst[3] = v[3] / k;\n\n return newDst;\n}\n\n/**\n * Inverse a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nfunction inverse(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = 1 / v[0];\n newDst[1] = 1 / v[1];\n newDst[2] = 1 / v[2];\n newDst[3] = 1 / v[3];\n\n return newDst;\n}\n\n/**\n * Invert a vector. (same as inverse)\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nconst invert = inverse;\n\n/**\n * Computes the dot product of two vectors\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns dot product\n */\nfunction dot(a: Vec4Arg, b: Vec4Arg): number {\n return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]) + (a[3] * b[3]);\n}\n\n/**\n * Computes the length of vector\n * @param v - vector.\n * @returns length of vector.\n */\nfunction length(v: Vec4Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n return Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3);\n}\n\n/**\n * Computes the length of vector (same as length)\n * @param v - vector.\n * @returns length of vector.\n */\nconst len = length;\n\n/**\n * Computes the square of the length of vector\n * @param v - vector.\n * @returns square of the length of vector.\n */\nfunction lengthSq(v: Vec4Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n return v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3;\n}\n\n/**\n * Computes the square of the length of vector (same as lengthSq)\n * @param v - vector.\n * @returns square of the length of vector.\n */\nconst lenSq = lengthSq;\n\n/**\n * Computes the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nfunction distance(a: Vec4Arg, b: Vec4Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n const dz = a[2] - b[2];\n const dw = a[3] - b[3];\n return Math.sqrt(dx * dx + dy * dy + dz * dz + dw * dw);\n}\n\n/**\n * Computes the distance between 2 points (same as distance)\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nconst dist = distance;\n\n/**\n * Computes the square of the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nfunction distanceSq(a: Vec4Arg, b: Vec4Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n const dz = a[2] - b[2];\n const dw = a[3] - b[3];\n return dx * dx + dy * dy + dz * dz + dw * dw;\n}\n\n/**\n * Computes the square of the distance between 2 points (same as distanceSq)\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nconst distSq = distanceSq;\n\n/**\n * Divides a vector by its Euclidean length and returns the quotient.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The normalized vector.\n */\nfunction normalize(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n const len = Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3);\n\n if (len > 0.00001) {\n newDst[0] = v0 / len;\n newDst[1] = v1 / len;\n newDst[2] = v2 / len;\n newDst[3] = v3 / len;\n } else {\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 0;\n }\n\n return newDst;\n}\n\n/**\n * Negates a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns -v.\n */\nfunction negate(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = -v[0];\n newDst[1] = -v[1];\n newDst[2] = -v[2];\n newDst[3] = -v[3];\n\n return newDst;\n}\n\n/**\n * Copies a vector. (same as {@link vec4.clone})\n * Also see {@link vec4.create} and {@link vec4.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nfunction copy(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = v[0];\n newDst[1] = v[1];\n newDst[2] = v[2];\n newDst[3] = v[3];\n\n return newDst;\n}\n\n/**\n * Clones a vector. (same as {@link vec4.copy})\n * Also see {@link vec4.create} and {@link vec4.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nconst clone = copy;\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nfunction multiply(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] * b[0];\n newDst[1] = a[1] * b[1];\n newDst[2] = a[2] * b[2];\n newDst[3] = a[3] * b[3];\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as mul)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nconst mul = multiply;\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nfunction divide(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] / b[0];\n newDst[1] = a[1] / b[1];\n newDst[2] = a[2] / b[2];\n newDst[3] = a[3] / b[3];\n\n return newDst;\n}\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as divide)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nconst div = divide;\n\n/**\n * Zero's a vector\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The zeroed vector.\n */\nfunction zero(dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 0;\n\n return newDst;\n}\n\n\n/**\n * transform vec4 by 4x4 matrix\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional vec4 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nfunction transformMat4(v: Vec4Arg, m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const x = v[0];\n const y = v[1];\n const z = v[2];\n const w = v[3];\n\n newDst[0] = m[0] * x + m[4] * y + m[ 8] * z + m[12] * w;\n newDst[1] = m[1] * x + m[5] * y + m[ 9] * z + m[13] * w;\n newDst[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;\n newDst[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;\n\n return newDst;\n}\n\n\n/**\n * Treat a 4D vector as a direction and set it's length\n *\n * @param a The vec4 to lengthen\n * @param len The length of the resulting vector\n * @returns The lengthened vector\n */\nfunction setLength(a: Vec4Arg, len: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n normalize(a, newDst);\n return mulScalar(newDst, len, newDst);\n}\n\n/**\n * Ensure a vector is not longer than a max length\n *\n * @param a The vec4 to limit\n * @param maxLen The longest length of the resulting vector\n * @returns The vector, shortened to maxLen if it's too long\n */\nfunction truncate(a: Vec4Arg, maxLen: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n if (length(a) > maxLen) {\n return setLength(a, maxLen, newDst);\n }\n\n return copy(a, newDst);\n}\n\n/**\n * Return the vector exactly between 2 endpoint vectors\n *\n * @param a Endpoint 1\n * @param b Endpoint 2\n * @returns The vector exactly residing between endpoints 1 and 2\n */\nfunction midpoint(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n return lerp(a, b, 0.5, newDst);\n}\n\nreturn {\n create,\n fromValues,\n set,\n ceil,\n floor,\n round,\n clamp,\n add,\n addScaled,\n subtract,\n sub,\n equalsApproximately,\n equals,\n lerp,\n lerpV,\n max,\n min,\n mulScalar,\n scale,\n divScalar,\n inverse,\n invert,\n dot,\n length,\n len,\n lengthSq,\n lenSq,\n distance,\n dist,\n distanceSq,\n distSq,\n normalize,\n negate,\n copy,\n clone,\n multiply,\n mul,\n divide,\n div,\n zero,\n transformMat4,\n setLength,\n truncate,\n midpoint,\n};\n}\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\n/**\n *\n * Vec4 math functions.\n *\n * Almost all functions take an optional `newDst` argument. If it is not passed in the\n * functions will create a new `Vec4`. In other words you can do this\n *\n * const v = vec4.cross(v1, v2); // Creates a new Vec4 with the cross product of v1 x v2.\n *\n * or\n *\n * const v = vec4.create();\n * vec4.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v\n *\n * The first style is often easier but depending on where it's used it generates garbage where\n * as there is almost never allocation with the second style.\n *\n * It is always safe to pass any vector as the destination. So for example\n *\n * vec4.cross(v1, v2, v1); // Puts the cross product of v1 x v2 in v1\n *\n */\nexport function getAPI(Ctor: Vec4Ctor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n\n","import {BaseArgType, ZeroArray} from './types';\nimport {Mat3Arg, Mat3Type, getAPI as getMat3API} from './mat3-impl';\nimport {Mat4Arg, Mat4Type, getAPI as getMat4API} from './mat4-impl';\nimport {QuatArg, QuatType, getAPI as getQuatAPI, RotationOrder} from './quat-impl';\nimport {Vec2Arg, Vec2Type, getAPI as getVec2API} from './vec2-impl';\nimport {Vec3Arg, Vec3Type, getAPI as getVec3API} from './vec3-impl';\nimport {Vec4Arg, Vec4Type, getAPI as getVec4API} from './vec4-impl';\nimport * as utils from './utils';\n\nexport {\n RotationOrder,\n utils,\n\n BaseArgType,\n\n Mat3Arg,\n Mat4Arg,\n QuatArg,\n Vec2Arg,\n Vec3Arg,\n Vec4Arg,\n\n Mat3Type,\n Mat4Type,\n QuatType,\n Vec2Type,\n Vec3Type,\n Vec4Type,\n};\n\nexport type BaseCtor = new (n: number) => T;\n\nexport type Mat3 = Mat3Type;\nexport type Mat4 = Mat4Type;\nexport type Quat = QuatType;\nexport type Vec2 = Vec2Type;\nexport type Vec3 = Vec3Type;\nexport type Vec4 = Vec4Type;\n\nexport type Mat3d = Mat3Type;\nexport type Mat4d = Mat4Type;\nexport type Quatd = QuatType;\nexport type Vec2d = Vec2Type;\nexport type Vec3d = Vec3Type;\nexport type Vec4d = Vec4Type;\n\nexport type Mat3n = Mat3Type;\nexport type Mat4n = Mat4Type;\nexport type Quatn = QuatType;\nexport type Vec2n = Vec2Type;\nexport type Vec3n = Vec3Type;\nexport type Vec4n = Vec4Type;\n\n/**\n * Generate wgpu-matrix API for type\n */\nfunction wgpuMatrixAPI<\n Mat3 extends BaseArgType,\n Mat4 extends BaseArgType,\n Quat extends BaseArgType,\n Vec2 extends BaseArgType,\n Vec3 extends BaseArgType,\n Vec4 extends BaseArgType,\n>(\n Mat3Ctor: BaseCtor,\n Mat4Ctor: BaseCtor,\n QuatCtor: BaseCtor,\n Vec2Ctor: BaseCtor,\n Vec3Ctor: BaseCtor,\n Vec4Ctor: BaseCtor,\n) {\n return {\n /** @namespace mat4 */\n mat4: getMat4API(Mat3Ctor),\n /** @namespace mat3 */\n mat3: getMat3API(Mat4Ctor),\n /** @namespace quat */\n quat: getQuatAPI(QuatCtor),\n /** @namespace vec2 */\n vec2: getVec2API(Vec2Ctor),\n /** @namespace vec3 */\n vec3: getVec3API(Vec3Ctor),\n /** @namespace vec4 */\n vec4: getVec4API(Vec4Ctor),\n };\n}\n\nexport const {\n /** @namespace */\n mat4,\n /** @namespace */\n mat3,\n /** @namespace */\n quat,\n /** @namespace */\n vec2,\n /** @namespace */\n vec3,\n /** @namespace */\n vec4,\n} = wgpuMatrixAPI<\n Mat3, Mat4, Quat, Vec2, Vec3, Vec4>(\n Float32Array, Float32Array, Float32Array, Float32Array, Float32Array, Float32Array);\n\nexport const {\n /** @namespace */\n mat4: mat4d,\n /** @namespace */\n mat3: mat3d,\n /** @namespace */\n quat: quatd,\n /** @namespace */\n vec2: vec2d,\n /** @namespace */\n vec3: vec3d,\n /** @namespace */\n vec4: vec4d,\n} = wgpuMatrixAPI<\n Mat3d, Mat4d, Quatd, Vec2d, Vec3d, Vec4d>(\n Float64Array, Float64Array, Float64Array, Float64Array, Float64Array, Float64Array);\n\nexport const {\n /** @namespace */\n mat4: mat4n,\n /** @namespace */\n mat3: mat3n,\n /** @namespace */\n quat: quatn,\n /** @namespace */\n vec2: vec2n,\n /** @namespace */\n vec3: vec3n,\n /** @namespace */\n vec4: vec4n,\n} = wgpuMatrixAPI<\n Mat3n, Mat4n, Quatn, Vec2n, Vec3n, Vec4n>(\n ZeroArray, Array, Array, Array, Array, Array);\n"],"names":["getAPIImpl","utils.EPSILON","cache","getAPI","getVec2API","getVec3API","getMat4API","getMat3API","getQuatAPI","getVec4API"],"mappings":";;;;;;;IAMA,SAAS,eAAe,CACtB,mBAAsB,EACtB,QAA6C,EAAA;QAE7C,OAAO,cAAc,mBAAmB,CAAA;IACtC,QAAA,WAAA,CAAY,GAAG,IAAW,EAAA;IACxB,YAAA,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;gBACf,QAAQ,CAAC,IAAuB,CAAC,CAAC;aACnC;IACG,KAAA,CAAC;IACT,CAAC;IAEM,MAAM,SAAS,GAAG,eAAe,EAAC,KAAa,GAAE,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;;IClBvE;;;;;;;;;;;;;;;;;;;;IAoBG;IAEI,IAAI,OAAO,GAAG,QAAQ,CAAC;IAE9B;;;;IAIG;IACG,SAAU,UAAU,CAAC,CAAS,EAAA;QAClC,MAAM,GAAG,GAAG,OAAO,CAAC;QACpB,OAAO,GAAG,CAAC,CAAC;IACZ,I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AY,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE;AAE3E,UAAA;IACX;IACA,IAAI,EAAE,KAAK;IACX;IACA,IAAI,EAAE,KAAK;IACX;IACA,IAAI,EAAE,KAAK;IACX;IACA,IAAI,EAAE,KAAK;IACX;IACA,IAAI,EAAE,KAAK;IACX;IACA,IAAI,EAAE,KAAK,GACZ,GAAG,aAAa,CAEb,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/3.x/wgpu-matrix.min.js b/dist/3.x/wgpu-matrix.min.js new file mode 100644 index 0000000..cb62a13 --- /dev/null +++ b/dist/3.x/wgpu-matrix.min.js @@ -0,0 +1,2 @@ +!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((n="undefined"!=typeof globalThis?globalThis:n||self).wgpuMatrix={})}(this,(function(n){"use strict";const t=(e=Array,r=n=>n.fill(0),class extends e{constructor(...n){super(...n),r(this)}});var e,r;let o=1e-6;var c={__proto__:null,get EPSILON(){return o},degToRad:function(n){return n*Math.PI/180},euclideanModulo:function(n,t){return(n%t+t)%t},inverseLerp:function(n,t,e){const r=t-n;return Math.abs(t-n)1e-5?(r[0]=o/u,r[1]=c/u):(r[0]=0,r[1]=0),r}function l(t,e){const r=e??new n(2);return r[0]=t[0],r[1]=t[1],r}function w(t,e,r){const o=r??new n(2);return o[0]=t[0]*e[0],o[1]=t[1]*e[1],o}function m(t,e,r){const o=r??new n(2);return o[0]=t[0]/e[0],o[1]=t[1]/e[1],o}function d(t,e,r){const o=r??new n(2);return M(t,o),c(o,e,o)}return{create:t,fromValues:t,set:function(t,e,r){const o=r??new n(2);return o[0]=t,o[1]=e,o},ceil:function(t,e){const r=e??new n(2);return r[0]=Math.ceil(t[0]),r[1]=Math.ceil(t[1]),r},floor:function(t,e){const r=e??new n(2);return r[0]=Math.floor(t[0]),r[1]=Math.floor(t[1]),r},round:function(t,e){const r=e??new n(2);return r[0]=Math.round(t[0]),r[1]=Math.round(t[1]),r},clamp:function(t,e=0,r=1,o){const c=o??new n(2);return c[0]=Math.min(r,Math.max(e,t[0])),c[1]=Math.min(r,Math.max(e,t[1])),c},add:function(t,e,r){const o=r??new n(2);return o[0]=t[0]+e[0],o[1]=t[1]+e[1],o},addScaled:function(t,e,r,o){const c=o??new n(2);return c[0]=t[0]+e[0]*r,c[1]=t[1]+e[1]*r,c},angle:function(n,t){const e=n[0],r=n[1],o=t[0],c=t[1],u=Math.sqrt(e*e+r*r)*Math.sqrt(o*o+c*c),s=u&&a(n,t)/u;return Math.acos(s)},subtract:e,sub:e,equalsApproximately:function(n,t){return Math.abs(n[0]-t[0])e?d(t,e,o):l(t,o)},midpoint:function(t,e,o){return r(t,e,.5,o??new n(2))}}}(n),u.set(n,t)),t}const s=new Map;function i(n){let t=s.get(n);return t||(t=function(n){const t=a(n);function e(t,e){const r=e??new n(12);return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[4]=t[4],r[5]=t[5],r[6]=t[6],r[8]=t[8],r[9]=t[9],r[10]=t[10],r}function r(t){const e=t??new n(12);return e[0]=1,e[1]=0,e[2]=0,e[4]=0,e[5]=1,e[6]=0,e[8]=0,e[9]=0,e[10]=1,e}function c(t,e){const r=e??new n(12),o=t[0],c=t[1],u=t[2],a=t[4],s=t[5],i=t[6],f=t[8],h=t[9],M=t[10],l=M*s-i*h,w=-M*a+i*f,m=h*a-s*f,d=1/(o*l+c*w+u*m);return r[0]=l*d,r[1]=(-M*c+u*h)*d,r[2]=(i*c-u*s)*d,r[4]=w*d,r[5]=(M*o-u*f)*d,r[6]=(-i*o+u*a)*d,r[8]=m*d,r[9]=(-h*o+c*f)*d,r[10]=(s*o-c*a)*d,r}function u(t,e,r){const o=r??new n(12),c=t[0],u=t[1],a=t[2],s=t[4],i=t[5],f=t[6],h=t[8],M=t[9],l=t[10],w=e[0],m=e[1],d=e[2],v=e[4],p=e[5],q=e[6],b=e[8],g=e[9],x=e[10];return o[0]=c*w+s*m+h*d,o[1]=u*w+i*m+M*d,o[2]=a*w+f*m+l*d,o[4]=c*v+s*p+h*q,o[5]=u*v+i*p+M*q,o[6]=a*v+f*p+l*q,o[8]=c*b+s*g+h*x,o[9]=u*b+i*g+M*x,o[10]=a*b+f*g+l*x,o}return{clone:e,create:function(t,e,r,o,c,u,a,s,i){const f=new n(12);return f[3]=0,f[7]=0,f[11]=0,void 0!==t&&(f[0]=t,void 0!==e&&(f[1]=e,void 0!==r&&(f[2]=r,void 0!==o&&(f[4]=o,void 0!==c&&(f[5]=c,void 0!==u&&(f[6]=u,void 0!==a&&(f[8]=a,void 0!==s&&(f[9]=s,void 0!==i&&(f[10]=i))))))))),f},set:function(t,e,r,o,c,u,a,s,i,f){const h=f??new n(12);return h[0]=t,h[1]=e,h[2]=r,h[3]=0,h[4]=o,h[5]=c,h[6]=u,h[7]=0,h[8]=a,h[9]=s,h[10]=i,h[11]=0,h},fromMat4:function(t,e){const r=e??new n(12);return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=0,r[4]=t[4],r[5]=t[5],r[6]=t[6],r[7]=0,r[8]=t[8],r[9]=t[9],r[10]=t[10],r[11]=0,r},fromQuat:function(t,e){const r=e??new n(12),o=t[0],c=t[1],u=t[2],a=t[3],s=o+o,i=c+c,f=u+u,h=o*s,M=c*s,l=c*i,w=u*s,m=u*i,d=u*f,v=a*s,p=a*i,q=a*f;return r[0]=1-l-d,r[1]=M+q,r[2]=w-p,r[3]=0,r[4]=M-q,r[5]=1-h-d,r[6]=m+v,r[7]=0,r[8]=w+p,r[9]=m-v,r[10]=1-h-l,r[11]=0,r},negate:function(t,e){const r=e??new n(12);return r[0]=-t[0],r[1]=-t[1],r[2]=-t[2],r[4]=-t[4],r[5]=-t[5],r[6]=-t[6],r[8]=-t[8],r[9]=-t[9],r[10]=-t[10],r},copy:e,equalsApproximately:function(n,t){return Math.abs(n[0]-t[0])1e-5?(r[0]=o/a,r[1]=c/a,r[2]=u/a):(r[0]=0,r[1]=0,r[2]=0),r}function l(t,e){const r=e??new n(3);return r[0]=t[0],r[1]=t[1],r[2]=t[2],r}function w(t,e,r){const o=r??new n(3);return o[0]=t[0]*e[0],o[1]=t[1]*e[1],o[2]=t[2]*e[2],o}function m(t,e,r){const o=r??new n(3);return o[0]=t[0]/e[0],o[1]=t[1]/e[1],o[2]=t[2]/e[2],o}function d(t,e,r){const o=r??new n(3);return M(t,o),c(o,e,o)}return{create:t,fromValues:t,set:function(t,e,r,o){const c=o??new n(3);return c[0]=t,c[1]=e,c[2]=r,c},ceil:function(t,e){const r=e??new n(3);return r[0]=Math.ceil(t[0]),r[1]=Math.ceil(t[1]),r[2]=Math.ceil(t[2]),r},floor:function(t,e){const r=e??new n(3);return r[0]=Math.floor(t[0]),r[1]=Math.floor(t[1]),r[2]=Math.floor(t[2]),r},round:function(t,e){const r=e??new n(3);return r[0]=Math.round(t[0]),r[1]=Math.round(t[1]),r[2]=Math.round(t[2]),r},clamp:function(t,e=0,r=1,o){const c=o??new n(3);return c[0]=Math.min(r,Math.max(e,t[0])),c[1]=Math.min(r,Math.max(e,t[1])),c[2]=Math.min(r,Math.max(e,t[2])),c},add:function(t,e,r){const o=r??new n(3);return o[0]=t[0]+e[0],o[1]=t[1]+e[1],o[2]=t[2]+e[2],o},addScaled:function(t,e,r,o){const c=o??new n(3);return c[0]=t[0]+e[0]*r,c[1]=t[1]+e[1]*r,c[2]=t[2]+e[2]*r,c},angle:function(n,t){const e=n[0],r=n[1],o=n[2],c=t[0],u=t[1],s=t[2],i=Math.sqrt(e*e+r*r+o*o)*Math.sqrt(c*c+u*u+s*s),f=i&&a(n,t)/i;return Math.acos(f)},subtract:e,sub:e,equalsApproximately:function(n,t){return Math.abs(n[0]-t[0])e?d(t,e,o):l(t,o)},midpoint:function(t,e,o){return r(t,e,.5,o??new n(3))}}}(n),f.set(n,t)),t}const M=new Map;function l(n){let t=M.get(n);return t||(t=function(n){const t=h(n);function e(t,e){const r=e??new n(16);return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r[4]=t[4],r[5]=t[5],r[6]=t[6],r[7]=t[7],r[8]=t[8],r[9]=t[9],r[10]=t[10],r[11]=t[11],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15],r}const r=e;function c(t){const e=t??new n(16);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function u(t,e){const r=e??new n(16),o=t[0],c=t[1],u=t[2],a=t[3],s=t[4],i=t[5],f=t[6],h=t[7],M=t[8],l=t[9],w=t[10],m=t[11],d=t[12],v=t[13],p=t[14],q=t[15],b=w*q,g=p*m,x=f*q,y=p*h,A=f*m,S=w*h,z=u*q,F=p*a,T=u*m,k=w*a,I=u*h,P=f*a,V=M*v,Z=d*l,L=s*v,R=d*i,E=s*l,X=M*i,Y=o*v,_=d*c,Q=o*l,j=M*c,N=o*i,U=s*c,D=b*i+y*l+A*v-(g*i+x*l+S*v),O=g*c+z*l+k*v-(b*c+F*l+T*v),$=x*c+F*i+I*v-(y*c+z*i+P*v),B=S*c+T*i+P*l-(A*c+k*i+I*l),C=1/(o*D+s*O+M*$+d*B);return r[0]=C*D,r[1]=C*O,r[2]=C*$,r[3]=C*B,r[4]=C*(g*s+x*M+S*d-(b*s+y*M+A*d)),r[5]=C*(b*o+F*M+T*d-(g*o+z*M+k*d)),r[6]=C*(y*o+z*s+P*d-(x*o+F*s+I*d)),r[7]=C*(A*o+k*s+I*M-(S*o+T*s+P*M)),r[8]=C*(V*h+R*m+E*q-(Z*h+L*m+X*q)),r[9]=C*(Z*a+Y*m+j*q-(V*a+_*m+Q*q)),r[10]=C*(L*a+_*h+N*q-(R*a+Y*h+U*q)),r[11]=C*(X*a+Q*h+U*m-(E*a+j*h+N*m)),r[12]=C*(L*w+X*p+Z*f-(E*p+V*f+R*w)),r[13]=C*(Q*p+V*u+_*w-(Y*w+j*p+Z*u)),r[14]=C*(Y*f+U*p+R*u-(N*p+L*u+_*f)),r[15]=C*(N*w+E*u+j*f-(Q*f+U*w+X*u)),r}const a=u;function s(t,e,r){const o=r??new n(16),c=t[0],u=t[1],a=t[2],s=t[3],i=t[4],f=t[5],h=t[6],M=t[7],l=t[8],w=t[9],m=t[10],d=t[11],v=t[12],p=t[13],q=t[14],b=t[15],g=e[0],x=e[1],y=e[2],A=e[3],S=e[4],z=e[5],F=e[6],T=e[7],k=e[8],I=e[9],P=e[10],V=e[11],Z=e[12],L=e[13],R=e[14],E=e[15];return o[0]=c*g+i*x+l*y+v*A,o[1]=u*g+f*x+w*y+p*A,o[2]=a*g+h*x+m*y+q*A,o[3]=s*g+M*x+d*y+b*A,o[4]=c*S+i*z+l*F+v*T,o[5]=u*S+f*z+w*F+p*T,o[6]=a*S+h*z+m*F+q*T,o[7]=s*S+M*z+d*F+b*T,o[8]=c*k+i*I+l*P+v*V,o[9]=u*k+f*I+w*P+p*V,o[10]=a*k+h*I+m*P+q*V,o[11]=s*k+M*I+d*P+b*V,o[12]=c*Z+i*L+l*R+v*E,o[13]=u*Z+f*L+w*R+p*E,o[14]=a*Z+h*L+m*R+q*E,o[15]=s*Z+M*L+d*R+b*E,o}const i=s,f=t.create(),M=t.create(),l=t.create();function w(t,e,r){const o=r??new n(16);let c=t[0],u=t[1],a=t[2];const s=Math.sqrt(c*c+u*u+a*a);c/=s,u/=s,a/=s;const i=c*c,f=u*u,h=a*a,M=Math.cos(e),l=Math.sin(e),w=1-M;return o[0]=i+(1-i)*M,o[1]=c*u*w+a*l,o[2]=c*a*w-u*l,o[3]=0,o[4]=c*u*w-a*l,o[5]=f+(1-f)*M,o[6]=u*a*w+c*l,o[7]=0,o[8]=c*a*w+u*l,o[9]=u*a*w-c*l,o[10]=h+(1-h)*M,o[11]=0,o[12]=0,o[13]=0,o[14]=0,o[15]=1,o}function m(t,e,r,o){const c=o??new n(16);let u=e[0],a=e[1],s=e[2];const i=Math.sqrt(u*u+a*a+s*s);u/=i,a/=i,s/=i;const f=u*u,h=a*a,M=s*s,l=Math.cos(r),w=Math.sin(r),m=1-l,d=f+(1-f)*l,v=u*a*m+s*w,p=u*s*m-a*w,q=u*a*m-s*w,b=h+(1-h)*l,g=a*s*m+u*w,x=u*s*m+a*w,y=a*s*m-u*w,A=M+(1-M)*l,S=t[0],z=t[1],F=t[2],T=t[3],k=t[4],I=t[5],P=t[6],V=t[7],Z=t[8],L=t[9],R=t[10],E=t[11];return c[0]=d*S+v*k+p*Z,c[1]=d*z+v*I+p*L,c[2]=d*F+v*P+p*R,c[3]=d*T+v*V+p*E,c[4]=q*S+b*k+g*Z,c[5]=q*z+b*I+g*L,c[6]=q*F+b*P+g*R,c[7]=q*T+b*V+g*E,c[8]=x*S+y*k+A*Z,c[9]=x*z+y*I+A*L,c[10]=x*F+y*P+A*R,c[11]=x*T+y*V+A*E,t!==c&&(c[12]=t[12],c[13]=t[13],c[14]=t[14],c[15]=t[15]),c}return{create:function(t,e,r,o,c,u,a,s,i,f,h,M,l,w,m,d){const v=new n(16);return void 0!==t&&(v[0]=t,void 0!==e&&(v[1]=e,void 0!==r&&(v[2]=r,void 0!==o&&(v[3]=o,void 0!==c&&(v[4]=c,void 0!==u&&(v[5]=u,void 0!==a&&(v[6]=a,void 0!==s&&(v[7]=s,void 0!==i&&(v[8]=i,void 0!==f&&(v[9]=f,void 0!==h&&(v[10]=h,void 0!==M&&(v[11]=M,void 0!==l&&(v[12]=l,void 0!==w&&(v[13]=w,void 0!==m&&(v[14]=m,void 0!==d&&(v[15]=d)))))))))))))))),v},set:function(t,e,r,o,c,u,a,s,i,f,h,M,l,w,m,d,v){const p=v??new n(16);return p[0]=t,p[1]=e,p[2]=r,p[3]=o,p[4]=c,p[5]=u,p[6]=a,p[7]=s,p[8]=i,p[9]=f,p[10]=h,p[11]=M,p[12]=l,p[13]=w,p[14]=m,p[15]=d,p},fromMat3:function(t,e){const r=e??new n(16);return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=0,r[4]=t[4],r[5]=t[5],r[6]=t[6],r[7]=0,r[8]=t[8],r[9]=t[9],r[10]=t[10],r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r},fromQuat:function(t,e){const r=e??new n(16),o=t[0],c=t[1],u=t[2],a=t[3],s=o+o,i=c+c,f=u+u,h=o*s,M=c*s,l=c*i,w=u*s,m=u*i,d=u*f,v=a*s,p=a*i,q=a*f;return r[0]=1-l-d,r[1]=M+q,r[2]=w-p,r[3]=0,r[4]=M-q,r[5]=1-h-d,r[6]=m+v,r[7]=0,r[8]=w+p,r[9]=m-v,r[10]=1-h-l,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r},negate:function(t,e){const r=e??new n(16);return r[0]=-t[0],r[1]=-t[1],r[2]=-t[2],r[3]=-t[3],r[4]=-t[4],r[5]=-t[5],r[6]=-t[6],r[7]=-t[7],r[8]=-t[8],r[9]=-t[9],r[10]=-t[10],r[11]=-t[11],r[12]=-t[12],r[13]=-t[13],r[14]=-t[14],r[15]=-t[15],r},copy:e,clone:r,equalsApproximately:function(n,t){return Math.abs(n[0]-t[0])o){const n=Math.acos(v),t=Math.sin(n);h=Math.sin((1-r)*n)/t,M=Math.sin(r*n)/t}else h=1-r,M=r;return u[0]=h*a+M*l,u[1]=h*s+M*w,u[2]=h*i+M*m,u[3]=h*f+M*d,u}function i(t,e){const r=e??new n(4);return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r}const f=i;function M(t,e,r){const o=r??new n(4);return o[0]=t[0]-e[0],o[1]=t[1]-e[1],o[2]=t[2]-e[2],o[3]=t[3]-e[3],o}const l=M;function w(t,e,r){const o=r??new n(4);return o[0]=t[0]*e,o[1]=t[1]*e,o[2]=t[2]*e,o[3]=t[3]*e,o}const m=w;function d(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]+n[3]*t[3]}function v(n){const t=n[0],e=n[1],r=n[2],o=n[3];return Math.sqrt(t*t+e*e+r*r+o*o)}const p=v;function q(n){const t=n[0],e=n[1],r=n[2],o=n[3];return t*t+e*e+r*r+o*o}const b=q;function g(t,e){const r=e??new n(4),o=t[0],c=t[1],u=t[2],a=t[3],s=Math.sqrt(o*o+c*c+u*u+a*a);return s>1e-5?(r[0]=o/s,r[1]=c/s,r[2]=u/s,r[3]=a/s):(r[0]=0,r[1]=0,r[2]=0,r[3]=0),r}const x=t.create(),y=t.create(),A=t.create(),S=new n(4),z=new n(4);return{create:e,fromValues:r,set:function(t,e,r,o,c){const u=c??new n(4);return u[0]=t,u[1]=e,u[2]=r,u[3]=o,u},fromAxisAngle:c,toAxisAngle:function(n,e){const r=e??t.create(3),c=2*Math.acos(n[3]),u=Math.sin(.5*c);return u>o?(r[0]=n[0]/u,r[1]=n[1]/u,r[2]=n[2]/u):(r[0]=1,r[1]=0,r[2]=0),{angle:c,axis:r}},angle:function(n,t){const e=d(n,t);return Math.acos(2*e*e-1)},multiply:u,mul:a,rotateX:function(t,e,r){const o=r??new n(4),c=.5*e,u=t[0],a=t[1],s=t[2],i=t[3],f=Math.sin(c),h=Math.cos(c);return o[0]=u*h+i*f,o[1]=a*h+s*f,o[2]=s*h-a*f,o[3]=i*h-u*f,o},rotateY:function(t,e,r){const o=r??new n(4),c=.5*e,u=t[0],a=t[1],s=t[2],i=t[3],f=Math.sin(c),h=Math.cos(c);return o[0]=u*h-s*f,o[1]=a*h+i*f,o[2]=s*h+u*f,o[3]=i*h-a*f,o},rotateZ:function(t,e,r){const o=r??new n(4),c=.5*e,u=t[0],a=t[1],s=t[2],i=t[3],f=Math.sin(c),h=Math.cos(c);return o[0]=u*h+a*f,o[1]=a*h-u*f,o[2]=s*h+i*f,o[3]=i*h-s*f,o},slerp:s,inverse:function(t,e){const r=e??new n(4),o=t[0],c=t[1],u=t[2],a=t[3],s=o*o+c*c+u*u+a*a,i=s?1/s:0;return r[0]=-o*i,r[1]=-c*i,r[2]=-u*i,r[3]=a*i,r},conjugate:function(t,e){const r=e??new n(4);return r[0]=-t[0],r[1]=-t[1],r[2]=-t[2],r[3]=t[3],r},fromMat:function(t,e){const r=e??new n(4),o=t[0]+t[5]+t[10];if(o>0){const n=Math.sqrt(o+1);r[3]=.5*n;const e=.5/n;r[0]=(t[6]-t[9])*e,r[1]=(t[8]-t[2])*e,r[2]=(t[1]-t[4])*e}else{let n=0;t[5]>t[0]&&(n=1),t[10]>t[4*n+n]&&(n=2);const e=(n+1)%3,o=(n+2)%3,c=Math.sqrt(t[4*n+n]-t[4*e+e]-t[4*o+o]+1);r[n]=.5*c;const u=.5/c;r[3]=(t[4*e+o]-t[4*o+e])*u,r[e]=(t[4*e+n]+t[4*n+e])*u,r[o]=(t[4*o+n]+t[4*n+o])*u}return r},fromEuler:function(t,e,r,o,c){const u=c??new n(4),a=.5*t,s=.5*e,i=.5*r,f=Math.sin(a),h=Math.cos(a),M=Math.sin(s),l=Math.cos(s),w=Math.sin(i),m=Math.cos(i);switch(o){case"xyz":u[0]=f*l*m+h*M*w,u[1]=h*M*m-f*l*w,u[2]=h*l*w+f*M*m,u[3]=h*l*m-f*M*w;break;case"xzy":u[0]=f*l*m-h*M*w,u[1]=h*M*m-f*l*w,u[2]=h*l*w+f*M*m,u[3]=h*l*m+f*M*w;break;case"yxz":u[0]=f*l*m+h*M*w,u[1]=h*M*m-f*l*w,u[2]=h*l*w-f*M*m,u[3]=h*l*m+f*M*w;break;case"yzx":u[0]=f*l*m+h*M*w,u[1]=h*M*m+f*l*w,u[2]=h*l*w-f*M*m,u[3]=h*l*m-f*M*w;break;case"zxy":u[0]=f*l*m-h*M*w,u[1]=h*M*m+f*l*w,u[2]=h*l*w+f*M*m,u[3]=h*l*m-f*M*w;break;case"zyx":u[0]=f*l*m-h*M*w,u[1]=h*M*m+f*l*w,u[2]=h*l*w-f*M*m,u[3]=h*l*m+f*M*w;break;default:throw new Error(`Unknown rotation order: ${o}`)}return u},copy:i,clone:f,add:function(t,e,r){const o=r??new n(4);return o[0]=t[0]+e[0],o[1]=t[1]+e[1],o[2]=t[2]+e[2],o[3]=t[3]+e[3],o},subtract:M,sub:l,mulScalar:w,scale:m,divScalar:function(t,e,r){const o=r??new n(4);return o[0]=t[0]/e,o[1]=t[1]/e,o[2]=t[2]/e,o[3]=t[3]/e,o},dot:d,lerp:function(t,e,r,o){const c=o??new n(4);return c[0]=t[0]+r*(e[0]-t[0]),c[1]=t[1]+r*(e[1]-t[1]),c[2]=t[2]+r*(e[2]-t[2]),c[3]=t[3]+r*(e[3]-t[3]),c},length:v,len:p,lengthSq:q,lenSq:b,normalize:g,equalsApproximately:function(n,t){return Math.abs(n[0]-t[0]).999999?(u[0]=0,u[1]=0,u[2]=0,u[3]=1,u):(t.cross(e,r,x),u[0]=x[0],u[1]=x[1],u[2]=x[2],u[3]=1+a,g(u,u))},sqlerp:function(t,e,r,o,c,u){const a=u??new n(4);return s(t,o,c,S),s(e,r,c,z),s(S,z,2*c*(1-c),a),a}}}(n),w.set(n,t)),t}const d=new Map;function v(n){let t=d.get(n);return t||(t=function(n){function t(t,e,r,o){const c=new n(4);return void 0!==t&&(c[0]=t,void 0!==e&&(c[1]=e,void 0!==r&&(c[2]=r,void 0!==o&&(c[3]=o)))),c}function e(t,e,r){const o=r??new n(4);return o[0]=t[0]-e[0],o[1]=t[1]-e[1],o[2]=t[2]-e[2],o[3]=t[3]-e[3],o}function r(t,e,r,o){const c=o??new n(4);return c[0]=t[0]+r*(e[0]-t[0]),c[1]=t[1]+r*(e[1]-t[1]),c[2]=t[2]+r*(e[2]-t[2]),c[3]=t[3]+r*(e[3]-t[3]),c}function c(t,e,r){const o=r??new n(4);return o[0]=t[0]*e,o[1]=t[1]*e,o[2]=t[2]*e,o[3]=t[3]*e,o}function u(t,e){const r=e??new n(4);return r[0]=1/t[0],r[1]=1/t[1],r[2]=1/t[2],r[3]=1/t[3],r}function a(n){const t=n[0],e=n[1],r=n[2],o=n[3];return Math.sqrt(t*t+e*e+r*r+o*o)}function s(n){const t=n[0],e=n[1],r=n[2],o=n[3];return t*t+e*e+r*r+o*o}function i(n,t){const e=n[0]-t[0],r=n[1]-t[1],o=n[2]-t[2],c=n[3]-t[3];return Math.sqrt(e*e+r*r+o*o+c*c)}function f(n,t){const e=n[0]-t[0],r=n[1]-t[1],o=n[2]-t[2],c=n[3]-t[3];return e*e+r*r+o*o+c*c}function h(t,e){const r=e??new n(4),o=t[0],c=t[1],u=t[2],a=t[3],s=Math.sqrt(o*o+c*c+u*u+a*a);return s>1e-5?(r[0]=o/s,r[1]=c/s,r[2]=u/s,r[3]=a/s):(r[0]=0,r[1]=0,r[2]=0,r[3]=0),r}function M(t,e){const r=e??new n(4);return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r}function l(t,e,r){const o=r??new n(4);return o[0]=t[0]*e[0],o[1]=t[1]*e[1],o[2]=t[2]*e[2],o[3]=t[3]*e[3],o}function w(t,e,r){const o=r??new n(4);return o[0]=t[0]/e[0],o[1]=t[1]/e[1],o[2]=t[2]/e[2],o[3]=t[3]/e[3],o}function m(t,e,r){const o=r??new n(4);return h(t,o),c(o,e,o)}return{create:t,fromValues:t,set:function(t,e,r,o,c){const u=c??new n(4);return u[0]=t,u[1]=e,u[2]=r,u[3]=o,u},ceil:function(t,e){const r=e??new n(4);return r[0]=Math.ceil(t[0]),r[1]=Math.ceil(t[1]),r[2]=Math.ceil(t[2]),r[3]=Math.ceil(t[3]),r},floor:function(t,e){const r=e??new n(4);return r[0]=Math.floor(t[0]),r[1]=Math.floor(t[1]),r[2]=Math.floor(t[2]),r[3]=Math.floor(t[3]),r},round:function(t,e){const r=e??new n(4);return r[0]=Math.round(t[0]),r[1]=Math.round(t[1]),r[2]=Math.round(t[2]),r[3]=Math.round(t[3]),r},clamp:function(t,e=0,r=1,o){const c=o??new n(4);return c[0]=Math.min(r,Math.max(e,t[0])),c[1]=Math.min(r,Math.max(e,t[1])),c[2]=Math.min(r,Math.max(e,t[2])),c[3]=Math.min(r,Math.max(e,t[3])),c},add:function(t,e,r){const o=r??new n(4);return o[0]=t[0]+e[0],o[1]=t[1]+e[1],o[2]=t[2]+e[2],o[3]=t[3]+e[3],o},addScaled:function(t,e,r,o){const c=o??new n(4);return c[0]=t[0]+e[0]*r,c[1]=t[1]+e[1]*r,c[2]=t[2]+e[2]*r,c[3]=t[3]+e[3]*r,c},subtract:e,sub:e,equalsApproximately:function(n,t){return Math.abs(n[0]-t[0])e?m(t,e,o):M(t,o)},midpoint:function(t,e,o){return r(t,e,.5,o??new n(4))}}}(n),d.set(n,t)),t}function p(n,t,e,r,o,c){return{mat4:l(n),mat3:i(t),quat:m(e),vec2:a(r),vec3:h(o),vec4:v(c)}}const{mat4:q,mat3:b,quat:g,vec2:x,vec3:y,vec4:A}=p(Float32Array,Float32Array,Float32Array,Float32Array,Float32Array,Float32Array),{mat4:S,mat3:z,quat:F,vec2:T,vec3:k,vec4:I}=p(Float64Array,Float64Array,Float64Array,Float64Array,Float64Array,Float64Array),{mat4:P,mat3:V,quat:Z,vec2:L,vec3:R,vec4:E}=p(t,Array,Array,Array,Array,Array);n.mat3=b,n.mat3d=z,n.mat3n=V,n.mat4=q,n.mat4d=S,n.mat4n=P,n.quat=g,n.quatd=F,n.quatn=Z,n.utils=c,n.vec2=x,n.vec2d=T,n.vec2n=L,n.vec3=y,n.vec3d=k,n.vec3n=R,n.vec4=A,n.vec4d=I,n.vec4n=E})); +//# sourceMappingURL=wgpu-matrix.min.js.map diff --git a/dist/3.x/wgpu-matrix.min.js.map b/dist/3.x/wgpu-matrix.min.js.map new file mode 100644 index 0000000..dba9693 --- /dev/null +++ b/dist/3.x/wgpu-matrix.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"wgpu-matrix.min.js","sources":["../../../src/types.ts","../../../src/utils.ts","../../../src/vec2-impl.ts","../../../src/mat3-impl.ts","../../../src/vec3-impl.ts","../../../src/mat4-impl.ts","../../../src/quat-impl.ts","../../../src/vec4-impl.ts","../../../src/wgpu-matrix.ts"],"sourcesContent":["/**\n * The types you can pass to most functions that take an\n * array of numbers.\n */\nexport type BaseArgType = Float32Array | Float64Array | number[];\n\nfunction wrapConstructor any>(\n OriginalConstructor: T,\n modifier: (instance: InstanceType) => void\n): T {\n return class extends OriginalConstructor {\n constructor(...args: any[]) {\n super(...args);\n modifier(this as InstanceType);\n }\n } as T; // Type assertion is necessary here\n}\n\nexport const ZeroArray = wrapConstructor(Array, a => a.fill(0));\n\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\n\nexport let EPSILON = 0.000001;\n\n/**\n * Set the value for EPSILON for various checks\n * @param v - Value to use for EPSILON.\n * @returns previous value of EPSILON;\n */\nexport function setEpsilon(v: number): number {\n const old = EPSILON;\n EPSILON = v;\n return old;\n}\n\n/**\n * Convert degrees to radians\n * @param degrees - Angle in degrees\n * @returns angle converted to radians\n */\nexport function degToRad(degrees: number): number {\n return degrees * Math.PI / 180;\n}\n\n/**\n * Convert radians to degrees\n * @param radians - Angle in radians\n * @returns angle converted to degrees\n */\nexport function radToDeg(radians: number): number {\n return radians * 180 / Math.PI;\n}\n\n/**\n * Lerps between a and b via t\n * @param a - starting value\n * @param b - ending value\n * @param t - value where 0 = a and 1 = b\n * @returns a + (b - a) * t\n */\nexport function lerp(a: number, b: number, t: number): number {\n return a + (b - a) * t;\n}\n\n/**\n * Compute the opposite of lerp. Given a and b and a value between\n * a and b returns a value between 0 and 1. 0 if a, 1 if b.\n * Note: no clamping is done.\n * @param a - start value\n * @param b - end value\n * @param v - value between a and b\n * @returns (v - a) / (b - a)\n */\nexport function inverseLerp(a: number, b: number, v: number): number {\n const d = b - a;\n return (Math.abs(b - a) < EPSILON)\n ? a\n : (v - a) / d;\n}\n\n/**\n * Compute the euclidean modulo\n *\n * ```\n * // table for n / 3\n * -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5 <- n\n * ------------------------------------\n * -2 -1 -0 -2 -1 0, 1, 2, 0, 1, 2 <- n % 3\n * 1 2 0 1 2 0, 1, 2, 0, 1, 2 <- euclideanModule(n, 3)\n * ```\n *\n * @param n - dividend\n * @param m - divisor\n * @returns the euclidean modulo of n / m\n */\nexport function euclideanModulo(n: number, m: number) {\n return ((n % m) + m) % m;\n}","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport * as utils from './utils.js';\nimport { Mat3Arg } from './mat3';\nimport { Mat4Arg } from './mat4';\nimport { Vec2Arg, Vec2Type } from './vec2';\nimport { Vec3Arg } from './vec3';\nimport { BaseArgType } from './types';\n\nexport { Vec2Arg, Vec2Type };\n\ntype Vec2Ctor = new (n: number) => T;\n\n/**\n * Generates am typed API for Vec3\n */\nfunction getAPIImpl(Ctor: Vec2Ctor) {\n\n/**\n * Creates a Vec2; may be called with x, y, z to set initial values.\n *\n * Note: Since passing in a raw JavaScript array\n * is valid in all circumstances, if you want to\n * force a JavaScript array into a Vec2's specified type\n * it would be faster to use\n *\n * ```\n * const v = vec2.clone(someJSArray);\n * ```\n *\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @returns the created vector\n */\nfunction create(x = 0, y = 0) {\n const newDst = new Ctor(2);\n if (x !== undefined) {\n newDst[0] = x;\n if (y !== undefined) {\n newDst[1] = y;\n }\n }\n return newDst;\n}\n\n/**\n * Creates a Vec2; may be called with x, y, z to set initial values. (same as create)\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @returns the created vector\n */\nconst fromValues = create;\n\n/**\n * Sets the values of a Vec2\n * Also see {@link vec2.create} and {@link vec2.copy}\n *\n * @param x first value\n * @param y second value\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector with its elements set.\n */\nfunction set(x: number, y: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = x;\n newDst[1] = y;\n\n return newDst;\n}\n\n/**\n * Applies Math.ceil to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the ceil of each element of v.\n */\nfunction ceil(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.ceil(v[0]);\n newDst[1] = Math.ceil(v[1]);\n\n return newDst;\n}\n\n/**\n * Applies Math.floor to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the floor of each element of v.\n */\nfunction floor(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.floor(v[0]);\n newDst[1] = Math.floor(v[1]);\n\n return newDst;\n}\n\n/**\n * Applies Math.round to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the round of each element of v.\n */\nfunction round(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.round(v[0]);\n newDst[1] = Math.round(v[1]);\n\n return newDst;\n}\n\n/**\n * Clamp each element of vector between min and max\n * @param v - Operand vector.\n * @param max - Min value, default 0\n * @param min - Max value, default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that the clamped value of each element of v.\n */\nfunction clamp(v: Vec2Arg, min = 0, max = 1, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.min(max, Math.max(min, v[0]));\n newDst[1] = Math.min(max, Math.max(min, v[1]));\n\n return newDst;\n}\n\n/**\n * Adds two vectors; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a and b.\n */\nfunction add(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] + b[0];\n newDst[1] = a[1] + b[1];\n\n return newDst;\n}\n\n/**\n * Adds two vectors, scaling the 2nd; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param scale - Amount to scale b\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a + b * scale.\n */\nfunction addScaled(a: Vec2Arg, b: Vec2Arg, scale: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] + b[0] * scale;\n newDst[1] = a[1] + b[1] * scale;\n\n return newDst;\n}\n\n/**\n * Returns the angle in radians between two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns The angle in radians between the 2 vectors.\n */\nfunction angle(a: Vec2Arg, b: Vec2Arg): number {\n const ax = a[0];\n const ay = a[1];\n const bx = b[0];\n const by = b[1];\n const mag1 = Math.sqrt(ax * ax + ay * ay);\n const mag2 = Math.sqrt(bx * bx + by * by);\n const mag = mag1 * mag2;\n const cosine = mag && dot(a, b) / mag;\n return Math.acos(cosine);\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nfunction subtract(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] - b[0];\n newDst[1] = a[1] - b[1];\n\n return newDst;\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nconst sub = subtract;\n\n/**\n * Check if 2 vectors are approximately equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are approximately equal\n */\nfunction equalsApproximately(a: Vec2Arg, b: Vec2Arg): boolean {\n return Math.abs(a[0] - b[0]) < utils.EPSILON &&\n Math.abs(a[1] - b[1]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 vectors are exactly equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are exactly equal\n */\nfunction equals(a: Vec2Arg, b: Vec2Arg): boolean {\n return a[0] === b[0] && a[1] === b[1];\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficient.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The linear interpolated result.\n */\nfunction lerp(a: Vec2Arg, b: Vec2Arg, t: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] + t * (b[0] - a[0]);\n newDst[1] = a[1] + t * (b[1] - a[1]);\n\n return newDst;\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient vector t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficients vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns the linear interpolated result.\n */\nfunction lerpV(a: Vec2Arg, b: Vec2Arg, t: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] + t[0] * (b[0] - a[0]);\n newDst[1] = a[1] + t[1] * (b[1] - a[1]);\n\n return newDst;\n}\n\n/**\n * Return max values of two vectors.\n * Given vectors a and b returns\n * [max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The max components vector.\n */\nfunction max(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.max(a[0], b[0]);\n newDst[1] = Math.max(a[1], b[1]);\n\n return newDst;\n}\n\n/**\n * Return min values of two vectors.\n * Given vectors a and b returns\n * [min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The min components vector.\n */\nfunction min(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.min(a[0], b[0]);\n newDst[1] = Math.min(a[1], b[1]);\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction mulScalar(v: Vec2Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = v[0] * k;\n newDst[1] = v[1] * k;\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar. (same as mulScalar)\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nconst scale = mulScalar;\n\n/**\n * Divides a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction divScalar(v: Vec2Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = v[0] / k;\n newDst[1] = v[1] / k;\n\n return newDst;\n}\n\n/**\n * Inverse a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nfunction inverse(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = 1 / v[0];\n newDst[1] = 1 / v[1];\n\n return newDst;\n}\n\n/**\n * Invert a vector. (same as inverse)\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nconst invert = inverse;\n\n/**\n * Computes the cross product of two vectors; assumes both vectors have\n * three entries.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of a cross b.\n */\nfunction cross(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const z = a[0] * b[1] - a[1] * b[0];\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = z;\n\n return newDst;\n}\n\n/**\n * Computes the dot product of two vectors; assumes both vectors have\n * three entries.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns dot product\n */\nfunction dot(a: Vec2Arg, b: Vec2Arg): number {\n return a[0] * b[0] + a[1] * b[1];\n}\n\n/**\n * Computes the length of vector\n * @param v - vector.\n * @returns length of vector.\n */\nfunction length(v: Vec2Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n return Math.sqrt(v0 * v0 + v1 * v1);\n}\n\n/**\n * Computes the length of vector (same as length)\n * @param v - vector.\n * @returns length of vector.\n */\nconst len = length;\n\n/**\n * Computes the square of the length of vector\n * @param v - vector.\n * @returns square of the length of vector.\n */\nfunction lengthSq(v: Vec2Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n return v0 * v0 + v1 * v1;\n}\n\n/**\n * Computes the square of the length of vector (same as lengthSq)\n * @param v - vector.\n * @returns square of the length of vector.\n */\nconst lenSq = lengthSq;\n\n/**\n * Computes the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nfunction distance(a: Vec2Arg, b: Vec2Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n return Math.sqrt(dx * dx + dy * dy);\n}\n\n/**\n * Computes the distance between 2 points (same as distance)\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nconst dist = distance;\n\n/**\n * Computes the square of the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nfunction distanceSq(a: Vec2Arg, b: Vec2Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n return dx * dx + dy * dy;\n}\n\n/**\n * Computes the square of the distance between 2 points (same as distanceSq)\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nconst distSq = distanceSq;\n\n/**\n * Divides a vector by its Euclidean length and returns the quotient.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The normalized vector.\n */\nfunction normalize(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const len = Math.sqrt(v0 * v0 + v1 * v1);\n\n if (len > 0.00001) {\n newDst[0] = v0 / len;\n newDst[1] = v1 / len;\n } else {\n newDst[0] = 0;\n newDst[1] = 0;\n }\n\n return newDst;\n}\n\n/**\n * Negates a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns -v.\n */\nfunction negate(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = -v[0];\n newDst[1] = -v[1];\n\n return newDst;\n}\n\n/**\n * Copies a vector. (same as {@link vec2.clone})\n * Also see {@link vec2.create} and {@link vec2.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nfunction copy(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = v[0];\n newDst[1] = v[1];\n\n return newDst;\n}\n\n/**\n * Clones a vector. (same as {@link vec2.copy})\n * Also see {@link vec2.create} and {@link vec2.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nconst clone = copy;\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nfunction multiply(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] * b[0];\n newDst[1] = a[1] * b[1];\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as mul)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nconst mul = multiply;\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nfunction divide(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] / b[0];\n newDst[1] = a[1] / b[1];\n\n return newDst;\n}\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as divide)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nconst div = divide;\n\n/**\n * Creates a random unit vector * scale\n * @param scale - Default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The random vector.\n */\nfunction random(scale = 1, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n const angle = Math.random() * 2 * Math.PI;\n newDst[0] = Math.cos(angle) * scale;\n newDst[1] = Math.sin(angle) * scale;\n\n return newDst;\n}\n\n/**\n * Zero's a vector\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The zeroed vector.\n */\nfunction zero(dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = 0;\n newDst[1] = 0;\n\n return newDst;\n}\n\n\n/**\n * transform Vec2 by 4x4 matrix\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional Vec2 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nfunction transformMat4(v: Vec2Arg, m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n const x = v[0];\n const y = v[1];\n\n newDst[0] = x * m[0] + y * m[4] + m[12];\n newDst[1] = x * m[1] + y * m[5] + m[13];\n\n return newDst;\n}\n\n/**\n * Transforms vec4 by 3x3 matrix\n *\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional Vec2 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nfunction transformMat3(v: Vec2Arg, m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n const x = v[0];\n const y = v[1];\n\n newDst[0] = m[0] * x + m[4] * y + m[8];\n newDst[1] = m[1] * x + m[5] * y + m[9];\n\n return newDst;\n}\n\n/**\n * Rotate a 2D vector\n *\n * @param a The vec2 point to rotate\n * @param b The origin of the rotation\n * @param rad The angle of rotation in radians\n * @returns the rotated vector\n */\nfunction rotate(a: Vec2Arg, b: Vec2Arg, rad: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n // Translate point to the origin\n const p0 = a[0] - b[0];\n const p1 = a[1] - b[1];\n const sinC = Math.sin(rad);\n const cosC = Math.cos(rad);\n\n //perform rotation and translate to correct position\n newDst[0] = p0 * cosC - p1 * sinC + b[0];\n newDst[1] = p0 * sinC + p1 * cosC + b[1];\n\n return newDst;\n}\n\n/**\n * Treat a 2D vector as a direction and set it's length\n *\n * @param a The vec2 to lengthen\n * @param len The length of the resulting vector\n * @returns The lengthened vector\n */\nfunction setLength(a: Vec2Arg, len: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n normalize(a, newDst);\n return mulScalar(newDst, len, newDst);\n}\n\n/**\n * Ensure a vector is not longer than a max length\n *\n * @param a The vec2 to limit\n * @param maxLen The longest length of the resulting vector\n * @returns The vector, shortened to maxLen if it's too long\n */\nfunction truncate(a: Vec2Arg, maxLen: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n if (length(a) > maxLen) {\n return setLength(a, maxLen, newDst);\n }\n\n return copy(a, newDst);\n}\n\n/**\n * Return the vector exactly between 2 endpoint vectors\n *\n * @param a Endpoint 1\n * @param b Endpoint 2\n * @returns The vector exactly residing between endpoints 1 and 2\n */\nfunction midpoint(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n return lerp(a, b, 0.5, newDst);\n}\n\nreturn {\n create,\n fromValues,\n set,\n ceil,\n floor,\n round,\n clamp,\n add,\n addScaled,\n angle,\n subtract,\n sub,\n equalsApproximately,\n equals,\n lerp,\n lerpV,\n max,\n min,\n mulScalar,\n scale,\n divScalar,\n inverse,\n invert,\n cross,\n dot,\n length,\n len,\n lengthSq,\n lenSq,\n distance,\n dist,\n distanceSq,\n distSq,\n normalize,\n negate,\n copy,\n clone,\n multiply,\n mul,\n divide,\n div,\n random,\n zero,\n transformMat4,\n transformMat3,\n rotate,\n setLength,\n truncate,\n midpoint,\n};\n}\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\nexport function getAPI(Ctor: Vec2Ctor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\n\nimport * as utils from './utils.js';\nimport { QuatArg } from './quat';\nimport { Mat3Arg, Mat3Type } from './mat3';\nimport { Mat4Arg } from './mat4';\nimport { Vec2Arg } from './vec2';\nimport { getAPI as getVec2API } from './vec2-impl';\nimport { BaseArgType } from './types';\n\nexport { Mat3Arg, Mat3Type };\n\ntype Mat3Ctor = new (n: number) => T;\n\n/**\n * Generates a typed API for Mat3\n * */\nfunction getAPIImpl(Ctor: Mat3Ctor) {\n const vec2 = getVec2API(Ctor);\n\n/**\n * Create a Mat3 from values\n *\n * Note: Since passing in a raw JavaScript array\n * is valid in all circumstances, if you want to\n * force a JavaScript array into a Mat3's specified type\n * it would be faster to use\n *\n * ```\n * const m = mat3.clone(someJSArray);\n * ```\n *\n * @param v0 - value for element 0\n * @param v1 - value for element 1\n * @param v2 - value for element 2\n * @param v3 - value for element 3\n * @param v4 - value for element 4\n * @param v5 - value for element 5\n * @param v6 - value for element 6\n * @param v7 - value for element 7\n * @param v8 - value for element 8\n * @returns matrix created from values.\n */\nfunction create(\n v0?: number, v1?: number, v2?: number,\n v3?: number, v4?: number, v5?: number,\n v6?: number, v7?: number, v8?: number) {\n const newDst = new Ctor(12);\n // to make the array homogenous\n newDst[3] = 0;\n newDst[7] = 0;\n newDst[11] = 0;\n\n if (v0 !== undefined) {\n newDst[0] = v0;\n if (v1 !== undefined) {\n newDst[1] = v1;\n if (v2 !== undefined) {\n newDst[2] = v2;\n if (v3 !== undefined) {\n newDst[4] = v3;\n if (v4 !== undefined) {\n newDst[5] = v4;\n if (v5 !== undefined) {\n newDst[6] = v5;\n if (v6 !== undefined) {\n newDst[8] = v6;\n if (v7 !== undefined) {\n newDst[9] = v7;\n if (v8 !== undefined) {\n newDst[10] = v8;\n }\n }\n }\n }\n }\n }\n }\n }\n }\n\n return newDst;\n}\n\n/**\n * Sets the values of a Mat3\n * Also see {@link mat3.create} and {@link mat3.copy}\n *\n * @param v0 - value for element 0\n * @param v1 - value for element 1\n * @param v2 - value for element 2\n * @param v3 - value for element 3\n * @param v4 - value for element 4\n * @param v5 - value for element 5\n * @param v6 - value for element 6\n * @param v7 - value for element 7\n * @param v8 - value for element 8\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat3 set from values.\n */\nfunction set(\n v0: number, v1: number, v2: number,\n v3: number, v4: number, v5: number,\n v6: number, v7: number, v8: number, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[0] = v0; newDst[1] = v1; newDst[ 2] = v2; newDst[ 3] = 0;\n newDst[4] = v3; newDst[5] = v4; newDst[ 6] = v5; newDst[ 7] = 0;\n newDst[8] = v6; newDst[9] = v7; newDst[10] = v8; newDst[11] = 0;\n\n return newDst;\n}\n\n/**\n * Creates a Mat3 from the upper left 3x3 part of a Mat4\n * @param m4 - source matrix\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat3 made from m4\n */\nfunction fromMat4(m4: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n newDst[0] = m4[0]; newDst[1] = m4[1]; newDst[ 2] = m4[ 2]; newDst[ 3] = 0;\n newDst[4] = m4[4]; newDst[5] = m4[5]; newDst[ 6] = m4[ 6]; newDst[ 7] = 0;\n newDst[8] = m4[8]; newDst[9] = m4[9]; newDst[10] = m4[10]; newDst[11] = 0;\n return newDst;\n}\n\n/**\n * Creates a Mat3 rotation matrix from a quaternion\n * @param q - quaternion to create matrix from\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat3 made from q\n */\nfunction fromQuat(q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const x = q[0]; const y = q[1]; const z = q[2]; const w = q[3];\n const x2 = x + x; const y2 = y + y; const z2 = z + z;\n\n const xx = x * x2;\n const yx = y * x2;\n const yy = y * y2;\n const zx = z * x2;\n const zy = z * y2;\n const zz = z * z2;\n const wx = w * x2;\n const wy = w * y2;\n const wz = w * z2;\n\n newDst[ 0] = 1 - yy - zz; newDst[ 1] = yx + wz; newDst[ 2] = zx - wy; newDst[ 3] = 0;\n newDst[ 4] = yx - wz; newDst[ 5] = 1 - xx - zz; newDst[ 6] = zy + wx; newDst[ 7] = 0;\n newDst[ 8] = zx + wy; newDst[ 9] = zy - wx; newDst[10] = 1 - xx - yy; newDst[11] = 0;\n\n return newDst;\n}\n\n/**\n * Negates a matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns -m.\n */\nfunction negate(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = -m[ 0]; newDst[ 1] = -m[ 1]; newDst[ 2] = -m[ 2];\n newDst[ 4] = -m[ 4]; newDst[ 5] = -m[ 5]; newDst[ 6] = -m[ 6];\n newDst[ 8] = -m[ 8]; newDst[ 9] = -m[ 9]; newDst[10] = -m[10];\n\n return newDst;\n}\n\n/**\n * Copies a matrix. (same as {@link mat3.clone})\n * Also see {@link mat3.create} and {@link mat3.set}\n * @param m - The matrix.\n * @param dst - The matrix. If not passed a new one is created.\n * @returns A copy of m.\n */\nfunction copy(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = m[ 0]; newDst[ 1] = m[ 1]; newDst[ 2] = m[ 2];\n newDst[ 4] = m[ 4]; newDst[ 5] = m[ 5]; newDst[ 6] = m[ 6];\n newDst[ 8] = m[ 8]; newDst[ 9] = m[ 9]; newDst[10] = m[10];\n\n return newDst;\n}\n\n/**\n * Copies a matrix (same as {@link mat3.copy})\n * Also see {@link mat3.create} and {@link mat3.set}\n * @param m - The matrix.\n * @param dst - The matrix. If not passed a new one is created.\n * @returns A copy of m.\n */\nconst clone = copy;\n\n/**\n * Check if 2 matrices are approximately equal\n * @param a Operand matrix.\n * @param b Operand matrix.\n * @returns true if matrices are approximately equal\n */\nfunction equalsApproximately(a: Mat3Arg, b: Mat3Arg): boolean {\n return Math.abs(a[ 0] - b[ 0]) < utils.EPSILON &&\n Math.abs(a[ 1] - b[ 1]) < utils.EPSILON &&\n Math.abs(a[ 2] - b[ 2]) < utils.EPSILON &&\n Math.abs(a[ 4] - b[ 4]) < utils.EPSILON &&\n Math.abs(a[ 5] - b[ 5]) < utils.EPSILON &&\n Math.abs(a[ 6] - b[ 6]) < utils.EPSILON &&\n Math.abs(a[ 8] - b[ 8]) < utils.EPSILON &&\n Math.abs(a[ 9] - b[ 9]) < utils.EPSILON &&\n Math.abs(a[10] - b[10]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 matrices are exactly equal\n * @param a Operand matrix.\n * @param b Operand matrix.\n * @returns true if matrices are exactly equal\n */\nfunction equals(a: Mat3Arg, b: Mat3Arg): boolean {\n return a[ 0] === b[ 0] &&\n a[ 1] === b[ 1] &&\n a[ 2] === b[ 2] &&\n a[ 4] === b[ 4] &&\n a[ 5] === b[ 5] &&\n a[ 6] === b[ 6] &&\n a[ 8] === b[ 8] &&\n a[ 9] === b[ 9] &&\n a[10] === b[10];\n}\n\n/**\n * Creates a 3-by-3 identity matrix.\n *\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns A 3-by-3 identity matrix.\n */\nfunction identity(dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = 1; newDst[ 1] = 0; newDst[ 2] = 0;\n newDst[ 4] = 0; newDst[ 5] = 1; newDst[ 6] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1;\n\n return newDst;\n}\n\n/**\n * Takes the transpose of a matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The transpose of m.\n */\nfunction transpose(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n if (newDst === m) {\n let t: number;\n\n // 0 1 2\n // 4 5 6\n // 8 9 10\n\n t = m[1];\n m[1] = m[4];\n m[4] = t;\n\n t = m[2];\n m[2] = m[8];\n m[8] = t;\n\n t = m[6];\n m[6] = m[9];\n m[9] = t;\n\n return newDst;\n }\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n\n newDst[ 0] = m00; newDst[ 1] = m10; newDst[ 2] = m20;\n newDst[ 4] = m01; newDst[ 5] = m11; newDst[ 6] = m21;\n newDst[ 8] = m02; newDst[ 9] = m12; newDst[10] = m22;\n\n return newDst;\n}\n\n/**\n * Computes the inverse of a 3-by-3 matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The inverse of m.\n */\nfunction inverse(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n\n const b01 = m22 * m11 - m12 * m21;\n const b11 = -m22 * m10 + m12 * m20;\n const b21 = m21 * m10 - m11 * m20;\n\n const invDet = 1 / (m00 * b01 + m01 * b11 + m02 * b21);\n\n newDst[ 0] = b01 * invDet;\n newDst[ 1] = (-m22 * m01 + m02 * m21) * invDet;\n newDst[ 2] = ( m12 * m01 - m02 * m11) * invDet;\n newDst[ 4] = b11 * invDet;\n newDst[ 5] = ( m22 * m00 - m02 * m20) * invDet;\n newDst[ 6] = (-m12 * m00 + m02 * m10) * invDet;\n newDst[ 8] = b21 * invDet;\n newDst[ 9] = (-m21 * m00 + m01 * m20) * invDet;\n newDst[10] = ( m11 * m00 - m01 * m10) * invDet;\n\n return newDst;\n}\n\n/**\n * Compute the determinant of a matrix\n * @param m - the matrix\n * @returns the determinant\n */\nfunction determinant(m: Mat3Arg): number {\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n\n return m00 * (m11 * m22 - m21 * m12) -\n m10 * (m01 * m22 - m21 * m02) +\n m20 * (m01 * m12 - m11 * m02);\n}\n\n/**\n * Computes the inverse of a 3-by-3 matrix. (same as inverse)\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The inverse of m.\n */\nconst invert = inverse;\n\n/**\n * Multiplies two 3-by-3 matrices with a on the left and b on the right\n * @param a - The matrix on the left.\n * @param b - The matrix on the right.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix product of a and b.\n */\nfunction multiply(a: Mat3Arg, b: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a10 = a[ 4 + 0];\n const a11 = a[ 4 + 1];\n const a12 = a[ 4 + 2];\n const a20 = a[ 8 + 0];\n const a21 = a[ 8 + 1];\n const a22 = a[ 8 + 2];\n const b00 = b[0];\n const b01 = b[1];\n const b02 = b[2];\n const b10 = b[ 4 + 0];\n const b11 = b[ 4 + 1];\n const b12 = b[ 4 + 2];\n const b20 = b[ 8 + 0];\n const b21 = b[ 8 + 1];\n const b22 = b[ 8 + 2];\n\n newDst[ 0] = a00 * b00 + a10 * b01 + a20 * b02;\n newDst[ 1] = a01 * b00 + a11 * b01 + a21 * b02;\n newDst[ 2] = a02 * b00 + a12 * b01 + a22 * b02;\n newDst[ 4] = a00 * b10 + a10 * b11 + a20 * b12;\n newDst[ 5] = a01 * b10 + a11 * b11 + a21 * b12;\n newDst[ 6] = a02 * b10 + a12 * b11 + a22 * b12;\n newDst[ 8] = a00 * b20 + a10 * b21 + a20 * b22;\n newDst[ 9] = a01 * b20 + a11 * b21 + a21 * b22;\n newDst[10] = a02 * b20 + a12 * b21 + a22 * b22;\n\n return newDst;\n}\n\n/**\n * Multiplies two 3-by-3 matrices with a on the left and b on the right (same as multiply)\n * @param a - The matrix on the left.\n * @param b - The matrix on the right.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix product of a and b.\n */\nconst mul = multiply;\n\n/**\n * Sets the translation component of a 3-by-3 matrix to the given\n * vector.\n * @param a - The matrix.\n * @param v - The vector.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix with translation set.\n */\nfunction setTranslation(a: Mat3Arg, v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? identity()) as T;\n if (a !== newDst) {\n newDst[ 0] = a[ 0];\n newDst[ 1] = a[ 1];\n newDst[ 2] = a[ 2];\n newDst[ 4] = a[ 4];\n newDst[ 5] = a[ 5];\n newDst[ 6] = a[ 6];\n }\n newDst[ 8] = v[0];\n newDst[ 9] = v[1];\n newDst[10] = 1;\n return newDst;\n}\n\n/**\n * Returns the translation component of a 3-by-3 matrix as a vector with 3\n * entries.\n * @param m - The matrix.\n * @param dst - vector to hold result. If not passed a new one is created.\n * @returns The translation component of m.\n */\nfunction getTranslation(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? vec2.create()) as T;\n newDst[0] = m[8];\n newDst[1] = m[9];\n return newDst;\n}\n\n/**\n * Returns an axis of a 3x3 matrix as a vector with 2 entries\n * @param m - The matrix.\n * @param axis - The axis 0 = x, 1 = y,\n * @returns The axis component of m.\n */\nfunction getAxis(m: Mat3Arg, axis: number, dst?: T) {\n const newDst = (dst ?? vec2.create()) as T;\n const off = axis * 4;\n newDst[0] = m[off + 0];\n newDst[1] = m[off + 1];\n return newDst;\n}\n\n/**\n * Sets an axis of a 3x3 matrix as a vector with 2 entries\n * @param m - The matrix.\n * @param v - the axis vector\n * @param axis - The axis 0 = x, 1 = y;\n * @param dst - The matrix to set. If not passed a new one is created.\n * @returns The matrix with axis set.\n */\nfunction setAxis(m: Mat3Arg, v: Vec2Arg, axis: number, dst?: T) {\n const newDst = (dst === m ? m : copy(m, dst)) as T;\n\n const off = axis * 4;\n newDst[off + 0] = v[0];\n newDst[off + 1] = v[1];\n return newDst;\n}\n\n///**\n// * Returns the scaling component of the matrix\n// * @param m - The Matrix\n// * @param dst - The vector to set. If not passed a new one is created.\n// */\nfunction getScaling(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? vec2.create());\n\n const xx = m[0];\n const xy = m[1];\n const yx = m[4];\n const yy = m[5];\n\n newDst[0] = Math.sqrt(xx * xx + xy * xy);\n newDst[1] = Math.sqrt(yx * yx + yy * yy);\n\n return newDst;\n}\n\n/**\n * Creates a 3-by-3 matrix which translates by the given vector v.\n * @param v - The vector by which to translate.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The translation matrix.\n */\nfunction translation(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = 1; newDst[ 1] = 0; newDst[ 2] = 0;\n newDst[ 4] = 0; newDst[ 5] = 1; newDst[ 6] = 0;\n newDst[ 8] = v[0]; newDst[ 9] = v[1]; newDst[10] = 1;\n\n return newDst;\n}\n\n/**\n * Translates the given 3-by-3 matrix by the given vector v.\n * @param m - The matrix.\n * @param v - The vector by which to translate.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The translated matrix.\n */\nfunction translate(m: Mat3Arg, v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n\n const m00 = m[0];\n const m01 = m[1];\n const m02 = m[2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n\n if (m !== newDst) {\n newDst[ 0] = m00;\n newDst[ 1] = m01;\n newDst[ 2] = m02;\n newDst[ 4] = m10;\n newDst[ 5] = m11;\n newDst[ 6] = m12;\n }\n\n newDst[ 8] = m00 * v0 + m10 * v1 + m20;\n newDst[ 9] = m01 * v0 + m11 * v1 + m21;\n newDst[10] = m02 * v0 + m12 * v1 + m22;\n\n return newDst;\n}\n\n/**\n * Creates a 3-by-3 matrix which rotates by the given angle.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotation matrix.\n */\nfunction rotation(angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c; newDst[ 1] = s; newDst[ 2] = 0;\n newDst[ 4] = -s; newDst[ 5] = c; newDst[ 6] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1;\n\n return newDst;\n}\n\n/**\n * Rotates the given 3-by-3 matrix by the given angle.\n * @param m - The matrix.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nfunction rotate(m: Mat3Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c * m00 + s * m10;\n newDst[ 1] = c * m01 + s * m11;\n newDst[ 2] = c * m02 + s * m12;\n\n newDst[ 4] = c * m10 - s * m00;\n newDst[ 5] = c * m11 - s * m01;\n newDst[ 6] = c * m12 - s * m02;\n\n\n if (m !== newDst) {\n newDst[ 8] = m[ 8];\n newDst[ 9] = m[ 9];\n newDst[10] = m[10];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 3-by-3 matrix which scales in each dimension by an amount given by\n * the corresponding entry in the given vector; assumes the vector has three\n * entries.\n * @param v - A vector of\n * 2 entries specifying the factor by which to scale in each dimension.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaling matrix.\n */\nfunction scaling(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = v[0]; newDst[ 1] = 0; newDst[ 2] = 0;\n newDst[ 4] = 0; newDst[ 5] = v[1]; newDst[ 6] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1;\n\n return newDst;\n}\n\n/**\n * Scales the given 3-by-3 matrix in each dimension by an amount\n * given by the corresponding entry in the given vector; assumes the vector has\n * three entries.\n * @param m - The matrix to be modified.\n * @param v - A vector of 2 entries specifying the\n * factor by which to scale in each dimension.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaled matrix.\n */\nfunction scale(m: Mat3Arg, v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n\n newDst[ 0] = v0 * m[0 * 4 + 0];\n newDst[ 1] = v0 * m[0 * 4 + 1];\n newDst[ 2] = v0 * m[0 * 4 + 2];\n\n newDst[ 4] = v1 * m[1 * 4 + 0];\n newDst[ 5] = v1 * m[1 * 4 + 1];\n newDst[ 6] = v1 * m[1 * 4 + 2];\n\n if (m !== newDst) {\n newDst[ 8] = m[ 8];\n newDst[ 9] = m[ 9];\n newDst[10] = m[10];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 3-by-3 matrix which scales uniformly in each dimension\n * @param s - Amount to scale\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaling matrix.\n */\nfunction uniformScaling(s: number, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = s; newDst[ 1] = 0; newDst[ 2] = 0;\n newDst[ 4] = 0; newDst[ 5] = s; newDst[ 6] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1;\n\n return newDst;\n}\n\n/**\n * Scales the given 3-by-3 matrix in each dimension by an amount\n * given.\n * @param m - The matrix to be modified.\n * @param s - Amount to scale.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaled matrix.\n */\nfunction uniformScale(m: Mat3Arg, s: number, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = s * m[0 * 4 + 0];\n newDst[ 1] = s * m[0 * 4 + 1];\n newDst[ 2] = s * m[0 * 4 + 2];\n\n newDst[ 4] = s * m[1 * 4 + 0];\n newDst[ 5] = s * m[1 * 4 + 1];\n newDst[ 6] = s * m[1 * 4 + 2];\n\n if (m !== newDst) {\n newDst[ 8] = m[ 8];\n newDst[ 9] = m[ 9];\n newDst[10] = m[10];\n }\n\n return newDst;\n}\n\nreturn {\n clone,\n create,\n set,\n fromMat4,\n fromQuat,\n negate,\n copy,\n equalsApproximately,\n equals,\n identity,\n transpose,\n inverse,\n invert,\n determinant,\n mul,\n multiply,\n setTranslation,\n getTranslation,\n getAxis,\n setAxis,\n getScaling,\n translation,\n translate,\n rotation,\n rotate,\n scaling,\n scale,\n uniformScaling,\n uniformScale,\n};\n\n}\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\nexport function getAPI(Ctor: Mat3Ctor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport * as utils from './utils.js';\nimport { Vec3Arg, Vec3Type } from './vec3';\nimport { Mat3Arg } from './mat3';\nimport { Mat4Arg } from './mat4';\nimport { QuatArg } from './quat';\nimport { BaseArgType } from './types';\n\nexport { Vec3Arg, Vec3Type };\n\ntype Vec3Ctor = new (n: number) => T;\n\n/**\n * Generates am typed API for Vec3\n * */\nfunction getAPIImpl(Ctor: Vec3Ctor) {\n\n/**\n * Creates a vec3; may be called with x, y, z to set initial values.\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @returns the created vector\n */\nfunction create(x?: number, y?: number, z?: number) {\n const newDst = new Ctor(3);\n if (x !== undefined) {\n newDst[0] = x;\n if (y !== undefined) {\n newDst[1] = y;\n if (z !== undefined) {\n newDst[2] = z;\n }\n }\n }\n return newDst;\n}\n\n/**\n * Creates a vec3; may be called with x, y, z to set initial values. (same as create)\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @returns the created vector\n */\nconst fromValues = create;\n\n/**\n * Sets the values of a Vec3\n * Also see {@link vec3.create} and {@link vec3.copy}\n *\n * @param x first value\n * @param y second value\n * @param z third value\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector with its elements set.\n */\nfunction set(x: number, y: number, z: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = x;\n newDst[1] = y;\n newDst[2] = z;\n\n return newDst;\n}\n\n/**\n * Applies Math.ceil to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the ceil of each element of v.\n */\nfunction ceil(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.ceil(v[0]);\n newDst[1] = Math.ceil(v[1]);\n newDst[2] = Math.ceil(v[2]);\n\n return newDst;\n}\n\n/**\n * Applies Math.floor to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the floor of each element of v.\n */\nfunction floor(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.floor(v[0]);\n newDst[1] = Math.floor(v[1]);\n newDst[2] = Math.floor(v[2]);\n\n return newDst;\n}\n\n/**\n * Applies Math.round to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the round of each element of v.\n */\nfunction round(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.round(v[0]);\n newDst[1] = Math.round(v[1]);\n newDst[2] = Math.round(v[2]);\n\n return newDst;\n}\n\n/**\n * Clamp each element of vector between min and max\n * @param v - Operand vector.\n * @param max - Min value, default 0\n * @param min - Max value, default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that the clamped value of each element of v.\n */\nfunction clamp(v: Vec3Arg, min = 0, max = 1, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.min(max, Math.max(min, v[0]));\n newDst[1] = Math.min(max, Math.max(min, v[1]));\n newDst[2] = Math.min(max, Math.max(min, v[2]));\n\n return newDst;\n}\n\n/**\n * Adds two vectors; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a and b.\n */\nfunction add(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] + b[0];\n newDst[1] = a[1] + b[1];\n newDst[2] = a[2] + b[2];\n\n return newDst;\n}\n\n/**\n * Adds two vectors, scaling the 2nd; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param scale - Amount to scale b\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a + b * scale.\n */\nfunction addScaled(a: Vec3Arg, b: Vec3Arg, scale: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] + b[0] * scale;\n newDst[1] = a[1] + b[1] * scale;\n newDst[2] = a[2] + b[2] * scale;\n\n return newDst;\n}\n\n/**\n * Returns the angle in radians between two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns The angle in radians between the 2 vectors.\n */\nfunction angle(a: Vec3Arg, b: Vec3Arg): number {\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const bx = b[0];\n const by = b[1];\n const bz = b[2];\n const mag1 = Math.sqrt(ax * ax + ay * ay + az * az);\n const mag2 = Math.sqrt(bx * bx + by * by + bz * bz);\n const mag = mag1 * mag2;\n const cosine = mag && dot(a, b) / mag;\n return Math.acos(cosine);\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nfunction subtract(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] - b[0];\n newDst[1] = a[1] - b[1];\n newDst[2] = a[2] - b[2];\n\n return newDst;\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nconst sub = subtract;\n\n/**\n * Check if 2 vectors are approximately equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are approximately equal\n */\nfunction equalsApproximately(a: Vec3Arg, b: Vec3Arg): boolean {\n return Math.abs(a[0] - b[0]) < utils.EPSILON &&\n Math.abs(a[1] - b[1]) < utils.EPSILON &&\n Math.abs(a[2] - b[2]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 vectors are exactly equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are exactly equal\n */\nfunction equals(a: Vec3Arg, b: Vec3Arg): boolean {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2];\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficient.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The linear interpolated result.\n */\nfunction lerp(a: Vec3Arg, b: Vec3Arg, t: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] + t * (b[0] - a[0]);\n newDst[1] = a[1] + t * (b[1] - a[1]);\n newDst[2] = a[2] + t * (b[2] - a[2]);\n\n return newDst;\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient vector t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficients vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns the linear interpolated result.\n */\nfunction lerpV(a: Vec3Arg, b: Vec3Arg, t: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] + t[0] * (b[0] - a[0]);\n newDst[1] = a[1] + t[1] * (b[1] - a[1]);\n newDst[2] = a[2] + t[2] * (b[2] - a[2]);\n\n return newDst;\n}\n\n/**\n * Return max values of two vectors.\n * Given vectors a and b returns\n * [max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The max components vector.\n */\nfunction max(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.max(a[0], b[0]);\n newDst[1] = Math.max(a[1], b[1]);\n newDst[2] = Math.max(a[2], b[2]);\n\n return newDst;\n}\n\n/**\n * Return min values of two vectors.\n * Given vectors a and b returns\n * [min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The min components vector.\n */\nfunction min(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.min(a[0], b[0]);\n newDst[1] = Math.min(a[1], b[1]);\n newDst[2] = Math.min(a[2], b[2]);\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction mulScalar(v: Vec3Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = v[0] * k;\n newDst[1] = v[1] * k;\n newDst[2] = v[2] * k;\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar. (same as mulScalar)\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nconst scale = mulScalar;\n\n/**\n * Divides a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction divScalar(v: Vec3Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = v[0] / k;\n newDst[1] = v[1] / k;\n newDst[2] = v[2] / k;\n\n return newDst;\n}\n\n/**\n * Inverse a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nfunction inverse(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = 1 / v[0];\n newDst[1] = 1 / v[1];\n newDst[2] = 1 / v[2];\n\n return newDst;\n}\n\n/**\n * Invert a vector. (same as inverse)\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nconst invert = inverse;\n\n/**\n * Computes the cross product of two vectors; assumes both vectors have\n * three entries.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of a cross b.\n */\nfunction cross(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const t1 = a[2] * b[0] - a[0] * b[2];\n const t2 = a[0] * b[1] - a[1] * b[0];\n newDst[0] = a[1] * b[2] - a[2] * b[1];\n newDst[1] = t1;\n newDst[2] = t2;\n\n return newDst;\n}\n\n/**\n * Computes the dot product of two vectors; assumes both vectors have\n * three entries.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns dot product\n */\nfunction dot(a: Vec3Arg, b: Vec3Arg): number {\n return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]);\n}\n\n/**\n * Computes the length of vector\n * @param v - vector.\n * @returns length of vector.\n */\nfunction length(v: Vec3Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n return Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2);\n}\n\n/**\n * Computes the length of vector (same as length)\n * @param v - vector.\n * @returns length of vector.\n */\nconst len = length;\n\n/**\n * Computes the square of the length of vector\n * @param v - vector.\n * @returns square of the length of vector.\n */\nfunction lengthSq(v: Vec3Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n return v0 * v0 + v1 * v1 + v2 * v2;\n}\n\n/**\n * Computes the square of the length of vector (same as lengthSq)\n * @param v - vector.\n * @returns square of the length of vector.\n */\nconst lenSq = lengthSq;\n\n/**\n * Computes the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nfunction distance(a: Vec3Arg, b: Vec3Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n const dz = a[2] - b[2];\n return Math.sqrt(dx * dx + dy * dy + dz * dz);\n}\n\n/**\n * Computes the distance between 2 points (same as distance)\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nconst dist = distance;\n\n/**\n * Computes the square of the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nfunction distanceSq(a: Vec3Arg, b: Vec3Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n const dz = a[2] - b[2];\n return dx * dx + dy * dy + dz * dz;\n}\n\n/**\n * Computes the square of the distance between 2 points (same as distanceSq)\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nconst distSq = distanceSq;\n\n/**\n * Divides a vector by its Euclidean length and returns the quotient.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The normalized vector.\n */\nfunction normalize(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const len = Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2);\n\n if (len > 0.00001) {\n newDst[0] = v0 / len;\n newDst[1] = v1 / len;\n newDst[2] = v2 / len;\n } else {\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n }\n\n\n return newDst;\n}\n\n/**\n * Negates a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns -v.\n */\nfunction negate(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = -v[0];\n newDst[1] = -v[1];\n newDst[2] = -v[2];\n\n return newDst;\n}\n\n/**\n * Copies a vector. (same as {@link vec3.clone})\n * Also see {@link vec3.create} and {@link vec3.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nfunction copy(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = v[0];\n newDst[1] = v[1];\n newDst[2] = v[2];\n\n return newDst;\n}\n\n/**\n * Clones a vector. (same as {@link vec3.copy})\n * Also see {@link vec3.create} and {@link vec3.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nconst clone = copy;\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nfunction multiply(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] * b[0];\n newDst[1] = a[1] * b[1];\n newDst[2] = a[2] * b[2];\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as mul)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nconst mul = multiply;\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nfunction divide(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] / b[0];\n newDst[1] = a[1] / b[1];\n newDst[2] = a[2] / b[2];\n\n return newDst;\n}\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as divide)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nconst div = divide;\n\n/**\n * Creates a random vector\n * @param scale - Default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The random vector.\n */\nfunction random(scale = 1, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const angle = Math.random() * 2 * Math.PI;\n const z = Math.random() * 2 - 1;\n const zScale = Math.sqrt(1 - z * z) * scale;\n newDst[0] = Math.cos(angle) * zScale;\n newDst[1] = Math.sin(angle) * zScale;\n newDst[2] = z * scale;\n\n return newDst;\n}\n\n/**\n * Zero's a vector\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The zeroed vector.\n */\nfunction zero(dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n\n return newDst;\n}\n\n\n/**\n * transform vec3 by 4x4 matrix\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional vec3 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nfunction transformMat4(v: Vec3Arg, m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const x = v[0];\n const y = v[1];\n const z = v[2];\n const w = (m[3] * x + m[7] * y + m[11] * z + m[15]) || 1;\n\n newDst[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;\n newDst[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;\n newDst[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;\n\n return newDst;\n}\n\n/**\n * Transform vec3 by upper 3x3 matrix inside 4x4 matrix.\n * @param v - The direction.\n * @param m - The matrix.\n * @param dst - optional vec3 to store result. If not passed a new one is created.\n * @returns The transformed vector.\n */\nfunction transformMat4Upper3x3(v: Vec3Arg, m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n\n newDst[0] = v0 * m[0 * 4 + 0] + v1 * m[1 * 4 + 0] + v2 * m[2 * 4 + 0];\n newDst[1] = v0 * m[0 * 4 + 1] + v1 * m[1 * 4 + 1] + v2 * m[2 * 4 + 1];\n newDst[2] = v0 * m[0 * 4 + 2] + v1 * m[1 * 4 + 2] + v2 * m[2 * 4 + 2];\n\n return newDst;\n}\n\n/**\n * Transforms vec3 by 3x3 matrix\n *\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional vec3 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nfunction transformMat3(v: Vec3Arg, m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const x = v[0];\n const y = v[1];\n const z = v[2];\n\n newDst[0] = x * m[0] + y * m[4] + z * m[8];\n newDst[1] = x * m[1] + y * m[5] + z * m[9];\n newDst[2] = x * m[2] + y * m[6] + z * m[10];\n\n return newDst;\n}\n\n/**\n * Transforms vec3 by Quaternion\n * @param v - the vector to transform\n * @param q - the quaternion to transform by\n * @param dst - optional vec3 to store result. If not passed a new one is created.\n * @returns the transformed\n */\nfunction transformQuat(v: Vec3Arg, q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const w2 = q[3] * 2;\n\n const x = v[0];\n const y = v[1];\n const z = v[2];\n\n const uvX = qy * z - qz * y;\n const uvY = qz * x - qx * z;\n const uvZ = qx * y - qy * x;\n\n newDst[0] = x + uvX * w2 + (qy * uvZ - qz * uvY) * 2;\n newDst[1] = y + uvY * w2 + (qz * uvX - qx * uvZ) * 2;\n newDst[2] = z + uvZ * w2 + (qx * uvY - qy * uvX) * 2;\n\n return newDst;\n}\n\n/**\n * Returns the translation component of a 4-by-4 matrix as a vector with 3\n * entries.\n * @param m - The matrix.\n * @param dst - vector to hold result. If not passed a new one is created.\n * @returns The translation component of m.\n */\nfunction getTranslation(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n newDst[0] = m[12];\n newDst[1] = m[13];\n newDst[2] = m[14];\n return newDst;\n}\n/**\n * Returns an axis of a 4x4 matrix as a vector with 3 entries\n * @param m - The matrix.\n * @param axis - The axis 0 = x, 1 = y, 2 = z;\n * @returns The axis component of m.\n */\nfunction getAxis(m: Mat4Arg, axis: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const off = axis * 4;\n newDst[0] = m[off + 0];\n newDst[1] = m[off + 1];\n newDst[2] = m[off + 2];\n return newDst;\n}\n/**\n * Returns the scaling component of the matrix\n * @param m - The Matrix\n * @param dst - The vector to set. If not passed a new one is created.\n */\nfunction getScaling(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const xx = m[0];\n const xy = m[1];\n const xz = m[2];\n const yx = m[4];\n const yy = m[5];\n const yz = m[6];\n const zx = m[8];\n const zy = m[9];\n const zz = m[10];\n newDst[0] = Math.sqrt(xx * xx + xy * xy + xz * xz);\n newDst[1] = Math.sqrt(yx * yx + yy * yy + yz * yz);\n newDst[2] = Math.sqrt(zx * zx + zy * zy + zz * zz);\n return newDst;\n}\n\n/**\n * Rotate a 3D vector around the x-axis\n *\n * @param {ReadonlyVec3} a The vec3 point to rotate\n * @param {ReadonlyVec3} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @param dst - The vector to set. If not passed a new one is created.\n * @returns the rotated vector\n */\nfunction rotateX(a: Vec3Arg, b: Vec3Arg, rad: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const p = [];\n const r = [];\n\n //Translate point to the origin\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2];\n\n //perform rotation\n r[0] = p[0];\n r[1] = p[1] * Math.cos(rad) - p[2] * Math.sin(rad);\n r[2] = p[1] * Math.sin(rad) + p[2] * Math.cos(rad);\n\n //translate to correct position\n newDst[0] = r[0] + b[0];\n newDst[1] = r[1] + b[1];\n newDst[2] = r[2] + b[2];\n\n return newDst;\n}\n\n/**\n * Rotate a 3D vector around the y-axis\n *\n * @param {ReadonlyVec3} a The vec3 point to rotate\n * @param {ReadonlyVec3} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @param dst - The vector to set. If not passed a new one is created.\n * @returns the rotated vector\n */\nfunction rotateY(a: Vec3Arg, b: Vec3Arg, rad: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const p = [];\n const r = [];\n\n // translate point to the origin\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2];\n\n // perform rotation\n r[0] = p[2] * Math.sin(rad) + p[0] * Math.cos(rad);\n r[1] = p[1];\n r[2] = p[2] * Math.cos(rad) - p[0] * Math.sin(rad);\n\n // translate to correct position\n newDst[0] = r[0] + b[0];\n newDst[1] = r[1] + b[1];\n newDst[2] = r[2] + b[2];\n\n return newDst;\n}\n\n/**\n * Rotate a 3D vector around the z-axis\n *\n * @param {ReadonlyVec3} a The vec3 point to rotate\n * @param {ReadonlyVec3} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @param dst - The vector to set. If not passed a new one is created.\n * @returns {vec3} out\n */\nfunction rotateZ(a: Vec3Arg, b: Vec3Arg, rad: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const p = [];\n const r = [];\n\n // translate point to the origin\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2];\n\n // perform rotation\n r[0] = p[0] * Math.cos(rad) - p[1] * Math.sin(rad);\n r[1] = p[0] * Math.sin(rad) + p[1] * Math.cos(rad);\n r[2] = p[2];\n\n // translate to correct position\n newDst[0] = r[0] + b[0];\n newDst[1] = r[1] + b[1];\n newDst[2] = r[2] + b[2];\n\n return newDst;\n}\n\n/**\n * Treat a 3D vector as a direction and set it's length\n *\n * @param a The vec3 to lengthen\n * @param len The length of the resulting vector\n * @returns The lengthened vector\n */\nfunction setLength(a: Vec3Arg, len: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n normalize(a, newDst);\n return mulScalar(newDst, len, newDst);\n}\n\n/**\n * Ensure a vector is not longer than a max length\n *\n * @param a The vec3 to limit\n * @param maxLen The longest length of the resulting vector\n * @returns The vector, shortened to maxLen if it's too long\n */\nfunction truncate(a: Vec3Arg, maxLen: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n if (length(a) > maxLen) {\n return setLength(a, maxLen, newDst);\n }\n\n return copy(a, newDst);\n}\n\n/**\n * Return the vector exactly between 2 endpoint vectors\n *\n * @param a Endpoint 1\n * @param b Endpoint 2\n * @returns The vector exactly residing between endpoints 1 and 2\n */\nfunction midpoint(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n return lerp(a, b, 0.5, newDst);\n}\n\nreturn {\n create,\n fromValues,\n set,\n ceil,\n floor,\n round,\n clamp,\n add,\n addScaled,\n angle,\n subtract,\n sub,\n equalsApproximately,\n equals,\n lerp,\n lerpV,\n max,\n min,\n mulScalar,\n scale,\n divScalar,\n inverse,\n invert,\n cross,\n dot,\n length,\n len,\n lengthSq,\n lenSq,\n distance,\n dist,\n distanceSq,\n distSq,\n normalize,\n negate,\n copy,\n clone,\n multiply,\n mul,\n divide,\n div,\n random,\n zero,\n transformMat4,\n transformMat4Upper3x3,\n transformMat3,\n transformQuat,\n getTranslation,\n getAxis,\n getScaling,\n rotateX,\n rotateY,\n rotateZ,\n setLength,\n truncate,\n midpoint,\n};\n\n}\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\nexport function getAPI(Ctor: Vec3Ctor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n","import { Mat4Arg, Mat4Type } from './mat4';\nimport { Mat3Arg } from './mat3';\nimport { QuatArg } from './quat';\nimport { Vec3Arg } from './vec3';\nimport { getAPI as getVec3API } from './vec3-impl';\nimport { BaseArgType } from './types';\nimport * as utils from './utils';\n\nexport { Mat4Arg, Mat4Type };\n\ntype Mat4Ctor = new (n: number) => T;\n\n/**\n * Generates a typed API for Mat4\n * */\nfunction getAPIImpl(Ctor: Mat4Ctor) {\n const vec3 = getVec3API(Ctor);\n\n/**\n * 4x4 Matrix math math functions.\n *\n * Almost all functions take an optional `newDst` argument. If it is not passed in the\n * functions will create a new matrix. In other words you can do this\n *\n * const mat = mat4.translation([1, 2, 3]); // Creates a new translation matrix\n *\n * or\n *\n * const mat = mat4.create();\n * mat4.translation([1, 2, 3], mat); // Puts translation matrix in mat.\n *\n * The first style is often easier but depending on where it's used it generates garbage where\n * as there is almost never allocation with the second style.\n *\n * It is always save to pass any matrix as the destination. So for example\n *\n * const mat = mat4.identity();\n * const trans = mat4.translation([1, 2, 3]);\n * mat4.multiply(mat, trans, mat); // Multiplies mat * trans and puts result in mat.\n *\n */\n\n\n/**\n * Create a Mat4 from values\n *\n * Note: Since passing in a raw JavaScript array\n * is valid in all circumstances, if you want to\n * force a JavaScript array into a Mat4's specified type\n * it would be faster to use\n *\n * ```\n * const m = mat4.clone(someJSArray);\n * ```\n *\n * @param v0 - value for element 0\n * @param v1 - value for element 1\n * @param v2 - value for element 2\n * @param v3 - value for element 3\n * @param v4 - value for element 4\n * @param v5 - value for element 5\n * @param v6 - value for element 6\n * @param v7 - value for element 7\n * @param v8 - value for element 8\n * @param v9 - value for element 9\n * @param v10 - value for element 10\n * @param v11 - value for element 11\n * @param v12 - value for element 12\n * @param v13 - value for element 13\n * @param v14 - value for element 14\n * @param v15 - value for element 15\n * @returns created from values.\n */\nfunction create(\n v0?: number, v1?: number, v2?: number, v3?: number,\n v4?: number, v5?: number, v6?: number, v7?: number,\n v8?: number, v9?: number, v10?: number, v11?: number,\n v12?: number, v13?: number, v14?: number, v15?: number) {\n const newDst = new Ctor(16);\n if (v0 !== undefined) {\n newDst[0] = v0;\n if (v1 !== undefined) {\n newDst[1] = v1;\n if (v2 !== undefined) {\n newDst[2] = v2;\n if (v3 !== undefined) {\n newDst[3] = v3;\n if (v4 !== undefined) {\n newDst[4] = v4;\n if (v5 !== undefined) {\n newDst[5] = v5;\n if (v6 !== undefined) {\n newDst[6] = v6;\n if (v7 !== undefined) {\n newDst[7] = v7;\n if (v8 !== undefined) {\n newDst[8] = v8;\n if (v9 !== undefined) {\n newDst[9] = v9;\n if (v10 !== undefined) {\n newDst[10] = v10;\n if (v11 !== undefined) {\n newDst[11] = v11;\n if (v12 !== undefined) {\n newDst[12] = v12;\n if (v13 !== undefined) {\n newDst[13] = v13;\n if (v14 !== undefined) {\n newDst[14] = v14;\n if (v15 !== undefined) {\n newDst[15] = v15;\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n return newDst;\n}\n\n/**\n * Sets the values of a Mat4\n * Also see {@link mat4.create} and {@link mat4.copy}\n *\n * @param v0 - value for element 0\n * @param v1 - value for element 1\n * @param v2 - value for element 2\n * @param v3 - value for element 3\n * @param v4 - value for element 4\n * @param v5 - value for element 5\n * @param v6 - value for element 6\n * @param v7 - value for element 7\n * @param v8 - value for element 8\n * @param v9 - value for element 9\n * @param v10 - value for element 10\n * @param v11 - value for element 11\n * @param v12 - value for element 12\n * @param v13 - value for element 13\n * @param v14 - value for element 14\n * @param v15 - value for element 15\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat4 created from values.\n */\nfunction set(\n v0: number, v1: number, v2: number, v3: number,\n v4: number, v5: number, v6: number, v7: number,\n v8: number, v9: number, v10: number, v11: number,\n v12: number, v13: number, v14: number, v15: number,\n dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = v0; newDst[ 1] = v1; newDst[ 2] = v2; newDst[ 3] = v3;\n newDst[ 4] = v4; newDst[ 5] = v5; newDst[ 6] = v6; newDst[ 7] = v7;\n newDst[ 8] = v8; newDst[ 9] = v9; newDst[10] = v10; newDst[11] = v11;\n newDst[12] = v12; newDst[13] = v13; newDst[14] = v14; newDst[15] = v15;\n\n return newDst;\n}\n\n/**\n * Creates a Mat4 from a Mat3\n * @param m3 - source matrix\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat4 made from m3\n */\nfunction fromMat3(m3: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = m3[0]; newDst[ 1] = m3[1]; newDst[ 2] = m3[ 2]; newDst[ 3] = 0;\n newDst[ 4] = m3[4]; newDst[ 5] = m3[5]; newDst[ 6] = m3[ 6]; newDst[ 7] = 0;\n newDst[ 8] = m3[8]; newDst[ 9] = m3[9]; newDst[10] = m3[10]; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Creates a Mat4 rotation matrix from a quaternion\n * @param q - quaternion to create matrix from\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat4 made from q\n */\nfunction fromQuat(q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const x = q[0]; const y = q[1]; const z = q[2]; const w = q[3];\n const x2 = x + x; const y2 = y + y; const z2 = z + z;\n\n const xx = x * x2;\n const yx = y * x2;\n const yy = y * y2;\n const zx = z * x2;\n const zy = z * y2;\n const zz = z * z2;\n const wx = w * x2;\n const wy = w * y2;\n const wz = w * z2;\n\n newDst[ 0] = 1 - yy - zz; newDst[ 1] = yx + wz; newDst[ 2] = zx - wy; newDst[ 3] = 0;\n newDst[ 4] = yx - wz; newDst[ 5] = 1 - xx - zz; newDst[ 6] = zy + wx; newDst[ 7] = 0;\n newDst[ 8] = zx + wy; newDst[ 9] = zy - wx; newDst[10] = 1 - xx - yy; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Negates a matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns -m.\n */\nfunction negate(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = -m[ 0]; newDst[ 1] = -m[ 1]; newDst[ 2] = -m[ 2]; newDst[ 3] = -m[ 3];\n newDst[ 4] = -m[ 4]; newDst[ 5] = -m[ 5]; newDst[ 6] = -m[ 6]; newDst[ 7] = -m[ 7];\n newDst[ 8] = -m[ 8]; newDst[ 9] = -m[ 9]; newDst[10] = -m[10]; newDst[11] = -m[11];\n newDst[12] = -m[12]; newDst[13] = -m[13]; newDst[14] = -m[14]; newDst[15] = -m[15];\n\n return newDst;\n}\n\n/**\n * Copies a matrix. (same as {@link mat4.clone})\n * Also see {@link mat4.create} and {@link mat4.set}\n * @param m - The matrix.\n * @param dst - The matrix. If not passed a new one is created.\n * @returns A copy of m.\n */\nfunction copy(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = m[ 0]; newDst[ 1] = m[ 1]; newDst[ 2] = m[ 2]; newDst[ 3] = m[ 3];\n newDst[ 4] = m[ 4]; newDst[ 5] = m[ 5]; newDst[ 6] = m[ 6]; newDst[ 7] = m[ 7];\n newDst[ 8] = m[ 8]; newDst[ 9] = m[ 9]; newDst[10] = m[10]; newDst[11] = m[11];\n newDst[12] = m[12]; newDst[13] = m[13]; newDst[14] = m[14]; newDst[15] = m[15];\n\n return newDst;\n}\n\n/**\n * Copies a matrix (same as {@link mat4.copy})\n * Also see {@link mat4.create} and {@link mat4.set}\n * @param m - The matrix.\n * @param dst - The matrix. If not passed a new one is created.\n * @returns A copy of m.\n */\nconst clone = copy;\n\n/**\n * Check if 2 matrices are approximately equal\n * @param a - Operand matrix.\n * @param b - Operand matrix.\n * @returns true if matrices are approximately equal\n */\nfunction equalsApproximately(a: Mat4Arg, b: Mat4Arg): boolean {\n return Math.abs(a[ 0] - b[ 0]) < utils.EPSILON &&\n Math.abs(a[ 1] - b[ 1]) < utils.EPSILON &&\n Math.abs(a[ 2] - b[ 2]) < utils.EPSILON &&\n Math.abs(a[ 3] - b[ 3]) < utils.EPSILON &&\n Math.abs(a[ 4] - b[ 4]) < utils.EPSILON &&\n Math.abs(a[ 5] - b[ 5]) < utils.EPSILON &&\n Math.abs(a[ 6] - b[ 6]) < utils.EPSILON &&\n Math.abs(a[ 7] - b[ 7]) < utils.EPSILON &&\n Math.abs(a[ 8] - b[ 8]) < utils.EPSILON &&\n Math.abs(a[ 9] - b[ 9]) < utils.EPSILON &&\n Math.abs(a[10] - b[10]) < utils.EPSILON &&\n Math.abs(a[11] - b[11]) < utils.EPSILON &&\n Math.abs(a[12] - b[12]) < utils.EPSILON &&\n Math.abs(a[13] - b[13]) < utils.EPSILON &&\n Math.abs(a[14] - b[14]) < utils.EPSILON &&\n Math.abs(a[15] - b[15]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 matrices are exactly equal\n * @param a - Operand matrix.\n * @param b - Operand matrix.\n * @returns true if matrices are exactly equal\n */\nfunction equals(a: Mat4Arg, b: Mat4Arg): boolean {\n return a[ 0] === b[ 0] &&\n a[ 1] === b[ 1] &&\n a[ 2] === b[ 2] &&\n a[ 3] === b[ 3] &&\n a[ 4] === b[ 4] &&\n a[ 5] === b[ 5] &&\n a[ 6] === b[ 6] &&\n a[ 7] === b[ 7] &&\n a[ 8] === b[ 8] &&\n a[ 9] === b[ 9] &&\n a[10] === b[10] &&\n a[11] === b[11] &&\n a[12] === b[12] &&\n a[13] === b[13] &&\n a[14] === b[14] &&\n a[15] === b[15];\n}\n\n/**\n * Creates a 4-by-4 identity matrix.\n *\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns A 4-by-4 identity matrix.\n */\nfunction identity(dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = 1; newDst[ 1] = 0; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = 1; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Takes the transpose of a matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The transpose of m.\n */\nfunction transpose(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n if (newDst === m) {\n let t;\n\n t = m[1];\n m[1] = m[4];\n m[4] = t;\n\n t = m[2];\n m[2] = m[8];\n m[8] = t;\n\n t = m[3];\n m[3] = m[12];\n m[12] = t;\n\n t = m[6];\n m[6] = m[9];\n m[9] = t;\n\n t = m[7];\n m[7] = m[13];\n m[13] = t;\n\n t = m[11];\n m[11] = m[14];\n m[14] = t;\n return newDst;\n }\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const m30 = m[3 * 4 + 0];\n const m31 = m[3 * 4 + 1];\n const m32 = m[3 * 4 + 2];\n const m33 = m[3 * 4 + 3];\n\n newDst[ 0] = m00; newDst[ 1] = m10; newDst[ 2] = m20; newDst[ 3] = m30;\n newDst[ 4] = m01; newDst[ 5] = m11; newDst[ 6] = m21; newDst[ 7] = m31;\n newDst[ 8] = m02; newDst[ 9] = m12; newDst[10] = m22; newDst[11] = m32;\n newDst[12] = m03; newDst[13] = m13; newDst[14] = m23; newDst[15] = m33;\n\n return newDst;\n}\n\n/**\n * Computes the inverse of a 4-by-4 matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The inverse of m.\n */\nfunction inverse(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const m30 = m[3 * 4 + 0];\n const m31 = m[3 * 4 + 1];\n const m32 = m[3 * 4 + 2];\n const m33 = m[3 * 4 + 3];\n const tmp0 = m22 * m33;\n const tmp1 = m32 * m23;\n const tmp2 = m12 * m33;\n const tmp3 = m32 * m13;\n const tmp4 = m12 * m23;\n const tmp5 = m22 * m13;\n const tmp6 = m02 * m33;\n const tmp7 = m32 * m03;\n const tmp8 = m02 * m23;\n const tmp9 = m22 * m03;\n const tmp10 = m02 * m13;\n const tmp11 = m12 * m03;\n const tmp12 = m20 * m31;\n const tmp13 = m30 * m21;\n const tmp14 = m10 * m31;\n const tmp15 = m30 * m11;\n const tmp16 = m10 * m21;\n const tmp17 = m20 * m11;\n const tmp18 = m00 * m31;\n const tmp19 = m30 * m01;\n const tmp20 = m00 * m21;\n const tmp21 = m20 * m01;\n const tmp22 = m00 * m11;\n const tmp23 = m10 * m01;\n\n const t0 = (tmp0 * m11 + tmp3 * m21 + tmp4 * m31) -\n (tmp1 * m11 + tmp2 * m21 + tmp5 * m31);\n const t1 = (tmp1 * m01 + tmp6 * m21 + tmp9 * m31) -\n (tmp0 * m01 + tmp7 * m21 + tmp8 * m31);\n const t2 = (tmp2 * m01 + tmp7 * m11 + tmp10 * m31) -\n (tmp3 * m01 + tmp6 * m11 + tmp11 * m31);\n const t3 = (tmp5 * m01 + tmp8 * m11 + tmp11 * m21) -\n (tmp4 * m01 + tmp9 * m11 + tmp10 * m21);\n\n const d = 1 / (m00 * t0 + m10 * t1 + m20 * t2 + m30 * t3);\n\n newDst[ 0] = d * t0;\n newDst[ 1] = d * t1;\n newDst[ 2] = d * t2;\n newDst[ 3] = d * t3;\n newDst[ 4] = d * ((tmp1 * m10 + tmp2 * m20 + tmp5 * m30) -\n (tmp0 * m10 + tmp3 * m20 + tmp4 * m30));\n newDst[ 5] = d * ((tmp0 * m00 + tmp7 * m20 + tmp8 * m30) -\n (tmp1 * m00 + tmp6 * m20 + tmp9 * m30));\n newDst[ 6] = d * ((tmp3 * m00 + tmp6 * m10 + tmp11 * m30) -\n (tmp2 * m00 + tmp7 * m10 + tmp10 * m30));\n newDst[ 7] = d * ((tmp4 * m00 + tmp9 * m10 + tmp10 * m20) -\n (tmp5 * m00 + tmp8 * m10 + tmp11 * m20));\n newDst[ 8] = d * ((tmp12 * m13 + tmp15 * m23 + tmp16 * m33) -\n (tmp13 * m13 + tmp14 * m23 + tmp17 * m33));\n newDst[ 9] = d * ((tmp13 * m03 + tmp18 * m23 + tmp21 * m33) -\n (tmp12 * m03 + tmp19 * m23 + tmp20 * m33));\n newDst[10] = d * ((tmp14 * m03 + tmp19 * m13 + tmp22 * m33) -\n (tmp15 * m03 + tmp18 * m13 + tmp23 * m33));\n newDst[11] = d * ((tmp17 * m03 + tmp20 * m13 + tmp23 * m23) -\n (tmp16 * m03 + tmp21 * m13 + tmp22 * m23));\n newDst[12] = d * ((tmp14 * m22 + tmp17 * m32 + tmp13 * m12) -\n (tmp16 * m32 + tmp12 * m12 + tmp15 * m22));\n newDst[13] = d * ((tmp20 * m32 + tmp12 * m02 + tmp19 * m22) -\n (tmp18 * m22 + tmp21 * m32 + tmp13 * m02));\n newDst[14] = d * ((tmp18 * m12 + tmp23 * m32 + tmp15 * m02) -\n (tmp22 * m32 + tmp14 * m02 + tmp19 * m12));\n newDst[15] = d * ((tmp22 * m22 + tmp16 * m02 + tmp21 * m12) -\n (tmp20 * m12 + tmp23 * m22 + tmp17 * m02));\n\n return newDst;\n}\n\n/**\n * Compute the determinant of a matrix\n * @param m - the matrix\n * @returns the determinant\n */\nfunction determinant(m: Mat4Arg): number {\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const m30 = m[3 * 4 + 0];\n const m31 = m[3 * 4 + 1];\n const m32 = m[3 * 4 + 2];\n const m33 = m[3 * 4 + 3];\n\n const tmp0 = m22 * m33;\n const tmp1 = m32 * m23;\n const tmp2 = m12 * m33;\n const tmp3 = m32 * m13;\n const tmp4 = m12 * m23;\n const tmp5 = m22 * m13;\n const tmp6 = m02 * m33;\n const tmp7 = m32 * m03;\n const tmp8 = m02 * m23;\n const tmp9 = m22 * m03;\n const tmp10 = m02 * m13;\n const tmp11 = m12 * m03;\n\n const t0 = (tmp0 * m11 + tmp3 * m21 + tmp4 * m31) -\n (tmp1 * m11 + tmp2 * m21 + tmp5 * m31);\n const t1 = (tmp1 * m01 + tmp6 * m21 + tmp9 * m31) -\n (tmp0 * m01 + tmp7 * m21 + tmp8 * m31);\n const t2 = (tmp2 * m01 + tmp7 * m11 + tmp10 * m31) -\n (tmp3 * m01 + tmp6 * m11 + tmp11 * m31);\n const t3 = (tmp5 * m01 + tmp8 * m11 + tmp11 * m21) -\n (tmp4 * m01 + tmp9 * m11 + tmp10 * m21);\n\n return m00 * t0 + m10 * t1 + m20 * t2 + m30 * t3;\n}\n\n/**\n * Computes the inverse of a 4-by-4 matrix. (same as inverse)\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The inverse of m.\n */\nconst invert = inverse;\n\n/**\n * Multiplies two 4-by-4 matrices with a on the left and b on the right\n * @param a - The matrix on the left.\n * @param b - The matrix on the right.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix product of a and b.\n */\nfunction multiply(a: Mat4Arg, b: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a03 = a[3];\n const a10 = a[ 4 + 0];\n const a11 = a[ 4 + 1];\n const a12 = a[ 4 + 2];\n const a13 = a[ 4 + 3];\n const a20 = a[ 8 + 0];\n const a21 = a[ 8 + 1];\n const a22 = a[ 8 + 2];\n const a23 = a[ 8 + 3];\n const a30 = a[12 + 0];\n const a31 = a[12 + 1];\n const a32 = a[12 + 2];\n const a33 = a[12 + 3];\n const b00 = b[0];\n const b01 = b[1];\n const b02 = b[2];\n const b03 = b[3];\n const b10 = b[ 4 + 0];\n const b11 = b[ 4 + 1];\n const b12 = b[ 4 + 2];\n const b13 = b[ 4 + 3];\n const b20 = b[ 8 + 0];\n const b21 = b[ 8 + 1];\n const b22 = b[ 8 + 2];\n const b23 = b[ 8 + 3];\n const b30 = b[12 + 0];\n const b31 = b[12 + 1];\n const b32 = b[12 + 2];\n const b33 = b[12 + 3];\n\n newDst[ 0] = a00 * b00 + a10 * b01 + a20 * b02 + a30 * b03;\n newDst[ 1] = a01 * b00 + a11 * b01 + a21 * b02 + a31 * b03;\n newDst[ 2] = a02 * b00 + a12 * b01 + a22 * b02 + a32 * b03;\n newDst[ 3] = a03 * b00 + a13 * b01 + a23 * b02 + a33 * b03;\n newDst[ 4] = a00 * b10 + a10 * b11 + a20 * b12 + a30 * b13;\n newDst[ 5] = a01 * b10 + a11 * b11 + a21 * b12 + a31 * b13;\n newDst[ 6] = a02 * b10 + a12 * b11 + a22 * b12 + a32 * b13;\n newDst[ 7] = a03 * b10 + a13 * b11 + a23 * b12 + a33 * b13;\n newDst[ 8] = a00 * b20 + a10 * b21 + a20 * b22 + a30 * b23;\n newDst[ 9] = a01 * b20 + a11 * b21 + a21 * b22 + a31 * b23;\n newDst[10] = a02 * b20 + a12 * b21 + a22 * b22 + a32 * b23;\n newDst[11] = a03 * b20 + a13 * b21 + a23 * b22 + a33 * b23;\n newDst[12] = a00 * b30 + a10 * b31 + a20 * b32 + a30 * b33;\n newDst[13] = a01 * b30 + a11 * b31 + a21 * b32 + a31 * b33;\n newDst[14] = a02 * b30 + a12 * b31 + a22 * b32 + a32 * b33;\n newDst[15] = a03 * b30 + a13 * b31 + a23 * b32 + a33 * b33;\n\n return newDst;\n}\n\n/**\n * Multiplies two 4-by-4 matrices with a on the left and b on the right (same as multiply)\n * @param a - The matrix on the left.\n * @param b - The matrix on the right.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix product of a and b.\n */\nconst mul = multiply;\n\n/**\n * Sets the translation component of a 4-by-4 matrix to the given\n * vector.\n * @param a - The matrix.\n * @param v - The vector.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix with translation set.\n */\nfunction setTranslation(a: Mat4Arg, v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? identity()) as T;\n if (a !== newDst) {\n newDst[ 0] = a[ 0];\n newDst[ 1] = a[ 1];\n newDst[ 2] = a[ 2];\n newDst[ 3] = a[ 3];\n newDst[ 4] = a[ 4];\n newDst[ 5] = a[ 5];\n newDst[ 6] = a[ 6];\n newDst[ 7] = a[ 7];\n newDst[ 8] = a[ 8];\n newDst[ 9] = a[ 9];\n newDst[10] = a[10];\n newDst[11] = a[11];\n }\n newDst[12] = v[0];\n newDst[13] = v[1];\n newDst[14] = v[2];\n newDst[15] = 1;\n return newDst;\n}\n\n///**\n// * Returns the translation component of a 4-by-4 matrix as a vector with 3\n// * entries.\n// * @param m - The matrix.\n// * @param dst - vector to hold result. If not passed a new one is created.\n// * @returns The translation component of m.\n// */\nfunction getTranslation(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? vec3.create()) as T;\n newDst[0] = m[12];\n newDst[1] = m[13];\n newDst[2] = m[14];\n return newDst;\n}\n\n/**\n * Returns an axis of a 4x4 matrix as a vector with 3 entries\n * @param m - The matrix.\n * @param axis - The axis 0 = x, 1 = y, 2 = z;\n * @returns The axis component of m.\n */\nfunction getAxis(m: Mat4Arg, axis: number, dst?: T) {\n const newDst = (dst ?? vec3.create());\n const off = axis * 4;\n newDst[0] = m[off + 0];\n newDst[1] = m[off + 1];\n newDst[2] = m[off + 2];\n return newDst;\n}\n\n/**\n * Sets an axis of a 4x4 matrix as a vector with 3 entries\n * @param m - The matrix.\n * @param v - the axis vector\n * @param axis - The axis 0 = x, 1 = y, 2 = z;\n * @param dst - The matrix to set. If not passed a new one is created.\n * @returns The matrix with axis set.\n */\nfunction setAxis(m: Mat4Arg, v: Vec3Arg, axis: number, dst: T) {\n const newDst = (dst === m) ? dst : copy(m, dst);\n\n const off = axis * 4;\n newDst[off + 0] = v[0];\n newDst[off + 1] = v[1];\n newDst[off + 2] = v[2];\n return newDst;\n}\n\n///**\n// * Returns the scaling component of the matrix\n// * @param m - The Matrix\n// * @param dst - The vector to set. If not passed a new one is created.\n// */\nfunction getScaling(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? vec3.create()) as T;\n\n const xx = m[0];\n const xy = m[1];\n const xz = m[2];\n const yx = m[4];\n const yy = m[5];\n const yz = m[6];\n const zx = m[8];\n const zy = m[9];\n const zz = m[10];\n\n newDst[0] = Math.sqrt(xx * xx + xy * xy + xz * xz);\n newDst[1] = Math.sqrt(yx * yx + yy * yy + yz * yz);\n newDst[2] = Math.sqrt(zx * zx + zy * zy + zz * zz);\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 perspective transformation matrix given the angular height\n * of the frustum, the aspect ratio, and the near and far clipping planes. The\n * arguments define a frustum extending in the negative z direction. The given\n * angle is the vertical angle of the frustum, and the horizontal angle is\n * determined to produce the given aspect ratio. The arguments near and far are\n * the distances to the near and far clipping planes. Note that near and far\n * are not z coordinates, but rather they are distances along the negative\n * z-axis. The matrix generated sends the viewing frustum to the unit box.\n * We assume a unit box extending from -1 to 1 in the x and y dimensions and\n * from 0 to 1 in the z dimension.\n *\n * Note: If you pass `Infinity` for zFar then it will produce a projection matrix\n * returns -Infinity for Z when transforming coordinates with Z <= 0 and +Infinity for Z\n * otherwise.\n *\n * @param fieldOfViewYInRadians - The camera angle from top to bottom (in radians).\n * @param aspect - The aspect ratio width / height.\n * @param zNear - The depth (negative z coordinate)\n * of the near clipping plane.\n * @param zFar - The depth (negative z coordinate)\n * of the far clipping plane.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The perspective matrix.\n */\nfunction perspective(fieldOfViewYInRadians: number, aspect: number, zNear: number, zFar: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const f = Math.tan(Math.PI * 0.5 - 0.5 * fieldOfViewYInRadians);\n\n newDst[0] = f / aspect;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 0;\n\n newDst[4] = 0;\n newDst[5] = f;\n newDst[6] = 0;\n newDst[7] = 0;\n\n newDst[8] = 0;\n newDst[9] = 0;\n newDst[11] = -1;\n\n newDst[12] = 0;\n newDst[13] = 0;\n newDst[15] = 0;\n\n if (Number.isFinite(zFar)) {\n const rangeInv = 1 / (zNear - zFar);\n newDst[10] = zFar * rangeInv;\n newDst[14] = zFar * zNear * rangeInv;\n } else {\n newDst[10] = -1;\n newDst[14] = -zNear;\n }\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 reverse-z perspective transformation matrix given the angular height\n * of the frustum, the aspect ratio, and the near and far clipping planes. The\n * arguments define a frustum extending in the negative z direction. The given\n * angle is the vertical angle of the frustum, and the horizontal angle is\n * determined to produce the given aspect ratio. The arguments near and far are\n * the distances to the near and far clipping planes. Note that near and far\n * are not z coordinates, but rather they are distances along the negative\n * z-axis. The matrix generated sends the viewing frustum to the unit box.\n * We assume a unit box extending from -1 to 1 in the x and y dimensions and\n * from 1 (at -zNear) to 0 (at -zFar) in the z dimension.\n *\n * @param fieldOfViewYInRadians - The camera angle from top to bottom (in radians).\n * @param aspect - The aspect ratio width / height.\n * @param zNear - The depth (negative z coordinate)\n * of the near clipping plane.\n * @param zFar - The depth (negative z coordinate)\n * of the far clipping plane. (default = Infinity)\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The perspective matrix.\n */function perspectiveReverseZ(fieldOfViewYInRadians: number, aspect: number, zNear: number, zFar = Infinity, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const f = 1 / Math.tan(fieldOfViewYInRadians * 0.5);\n\n newDst[ 0] = f / aspect;\n newDst[ 1] = 0;\n newDst[ 2] = 0;\n newDst[ 3] = 0;\n\n newDst[ 4] = 0;\n newDst[ 5] = f;\n newDst[ 6] = 0;\n newDst[ 7] = 0;\n\n newDst[ 8] = 0;\n newDst[ 9] = 0;\n newDst[11] = -1;\n\n newDst[12] = 0;\n newDst[13] = 0;\n newDst[15] = 0;\n\n if (zFar === Infinity) {\n newDst[10] = 0;\n newDst[14] = zNear;\n } else {\n const rangeInv = 1 / (zFar - zNear);\n newDst[10] = zNear * rangeInv;\n newDst[14] = zFar * zNear * rangeInv;\n }\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 orthogonal transformation matrix that transforms from\n * the given the left, right, bottom, and top dimensions to -1 +1 in x, and y\n * and 0 to +1 in z.\n * @param left - Left side of the near clipping plane viewport.\n * @param right - Right side of the near clipping plane viewport.\n * @param bottom - Bottom of the near clipping plane viewport.\n * @param top - Top of the near clipping plane viewport.\n * @param near - The depth (negative z coordinate)\n * of the near clipping plane.\n * @param far - The depth (negative z coordinate)\n * of the far clipping plane.\n * @param dst - Output matrix. If not passed a new one is created.\n * @returns The orthographic projection matrix.\n */\nfunction ortho(left: number, right: number, bottom: number, top: number, near: number, far: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[0] = 2 / (right - left);\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 0;\n\n newDst[4] = 0;\n newDst[5] = 2 / (top - bottom);\n newDst[6] = 0;\n newDst[7] = 0;\n\n newDst[8] = 0;\n newDst[9] = 0;\n newDst[10] = 1 / (near - far);\n newDst[11] = 0;\n\n newDst[12] = (right + left) / (left - right);\n newDst[13] = (top + bottom) / (bottom - top);\n newDst[14] = near / (near - far);\n newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 perspective transformation matrix given the left, right,\n * top, bottom, near and far clipping planes. The arguments define a frustum\n * extending in the negative z direction. The arguments near and far are the\n * distances to the near and far clipping planes. Note that near and far are not\n * z coordinates, but rather they are distances along the negative z-axis. The\n * matrix generated sends the viewing frustum to the unit box. We assume a unit\n * box extending from -1 to 1 in the x and y dimensions and from 0 to 1 in the z\n * dimension.\n * @param left - The x coordinate of the left plane of the box.\n * @param right - The x coordinate of the right plane of the box.\n * @param bottom - The y coordinate of the bottom plane of the box.\n * @param top - The y coordinate of the right plane of the box.\n * @param near - The negative z coordinate of the near plane of the box.\n * @param far - The negative z coordinate of the far plane of the box.\n * @param dst - Output matrix. If not passed a new one is created.\n * @returns The perspective projection matrix.\n */\nfunction frustum(left: number, right: number, bottom: number, top: number, near: number, far: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const dx = (right - left);\n const dy = (top - bottom);\n const dz = (near - far);\n\n newDst[ 0] = 2 * near / dx;\n newDst[ 1] = 0;\n newDst[ 2] = 0;\n newDst[ 3] = 0;\n newDst[ 4] = 0;\n newDst[ 5] = 2 * near / dy;\n newDst[ 6] = 0;\n newDst[ 7] = 0;\n newDst[ 8] = (left + right) / dx;\n newDst[ 9] = (top + bottom) / dy;\n newDst[10] = far / dz;\n newDst[11] = -1;\n newDst[12] = 0;\n newDst[13] = 0;\n newDst[14] = near * far / dz;\n newDst[15] = 0;\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 reverse-z perspective transformation matrix given the left, right,\n * top, bottom, near and far clipping planes. The arguments define a frustum\n * extending in the negative z direction. The arguments near and far are the\n * distances to the near and far clipping planes. Note that near and far are not\n * z coordinates, but rather they are distances along the negative z-axis. The\n * matrix generated sends the viewing frustum to the unit box. We assume a unit\n * box extending from -1 to 1 in the x and y dimensions and from 1 (-near) to 0 (-far) in the z\n * dimension.\n * @param left - The x coordinate of the left plane of the box.\n * @param right - The x coordinate of the right plane of the box.\n * @param bottom - The y coordinate of the bottom plane of the box.\n * @param top - The y coordinate of the right plane of the box.\n * @param near - The negative z coordinate of the near plane of the box.\n * @param far - The negative z coordinate of the far plane of the box.\n * @param dst - Output matrix. If not passed a new one is created.\n * @returns The perspective projection matrix.\n */\nfunction frustumReverseZ(left: number, right: number, bottom: number, top: number, near: number, far = Infinity, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const dx = (right - left);\n const dy = (top - bottom);\n\n newDst[ 0] = 2 * near / dx;\n newDst[ 1] = 0;\n newDst[ 2] = 0;\n newDst[ 3] = 0;\n newDst[ 4] = 0;\n newDst[ 5] = 2 * near / dy;\n newDst[ 6] = 0;\n newDst[ 7] = 0;\n newDst[ 8] = (left + right) / dx;\n newDst[ 9] = (top + bottom) / dy;\n newDst[11] = -1;\n newDst[12] = 0;\n newDst[13] = 0;\n newDst[15] = 0;\n\n if (far === Infinity) {\n newDst[10] = 0;\n newDst[14] = near;\n } else {\n const rangeInv = 1 / (far - near);\n newDst[10] = near * rangeInv;\n newDst[14] = far * near * rangeInv;\n }\n\n return newDst;\n}\n\nconst xAxis = vec3.create();\nconst yAxis = vec3.create();\nconst zAxis = vec3.create();\n\n/**\n * Computes a 4-by-4 aim transformation.\n *\n * This is a matrix which positions an object aiming down positive Z.\n * toward the target.\n *\n * Note: this is **NOT** the inverse of lookAt as lookAt looks at negative Z.\n *\n * @param position - The position of the object.\n * @param target - The position meant to be aimed at.\n * @param up - A vector pointing up.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The aim matrix.\n */\nfunction aim(position: Vec3Arg, target: Vec3Arg, up: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n vec3.normalize(vec3.subtract(target, position, zAxis), zAxis);\n vec3.normalize(vec3.cross(up, zAxis, xAxis), xAxis);\n vec3.normalize(vec3.cross(zAxis, xAxis, yAxis), yAxis);\n\n newDst[ 0] = xAxis[0]; newDst[ 1] = xAxis[1]; newDst[ 2] = xAxis[2]; newDst[ 3] = 0;\n newDst[ 4] = yAxis[0]; newDst[ 5] = yAxis[1]; newDst[ 6] = yAxis[2]; newDst[ 7] = 0;\n newDst[ 8] = zAxis[0]; newDst[ 9] = zAxis[1]; newDst[10] = zAxis[2]; newDst[11] = 0;\n newDst[12] = position[0]; newDst[13] = position[1]; newDst[14] = position[2]; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 camera aim transformation.\n *\n * This is a matrix which positions an object aiming down negative Z.\n * toward the target.\n *\n * Note: this is the inverse of `lookAt`\n *\n * @param eye - The position of the object.\n * @param target - The position meant to be aimed at.\n * @param up - A vector pointing up.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The aim matrix.\n */\nfunction cameraAim(eye: Vec3Arg, target: Vec3Arg, up: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n vec3.normalize(vec3.subtract(eye, target, zAxis), zAxis);\n vec3.normalize(vec3.cross(up, zAxis, xAxis), xAxis);\n vec3.normalize(vec3.cross(zAxis, xAxis, yAxis), yAxis);\n\n newDst[ 0] = xAxis[0]; newDst[ 1] = xAxis[1]; newDst[ 2] = xAxis[2]; newDst[ 3] = 0;\n newDst[ 4] = yAxis[0]; newDst[ 5] = yAxis[1]; newDst[ 6] = yAxis[2]; newDst[ 7] = 0;\n newDst[ 8] = zAxis[0]; newDst[ 9] = zAxis[1]; newDst[10] = zAxis[2]; newDst[11] = 0;\n newDst[12] = eye[0]; newDst[13] = eye[1]; newDst[14] = eye[2]; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 view transformation.\n *\n * This is a view matrix which transforms all other objects\n * to be in the space of the view defined by the parameters.\n *\n * @param eye - The position of the object.\n * @param target - The position meant to be aimed at.\n * @param up - A vector pointing up.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The look-at matrix.\n */\nfunction lookAt(eye: Vec3Arg, target: Vec3Arg, up: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n vec3.normalize(vec3.subtract(eye, target, zAxis), zAxis);\n vec3.normalize(vec3.cross(up, zAxis, xAxis), xAxis);\n vec3.normalize(vec3.cross(zAxis, xAxis, yAxis), yAxis);\n\n newDst[ 0] = xAxis[0]; newDst[ 1] = yAxis[0]; newDst[ 2] = zAxis[0]; newDst[ 3] = 0;\n newDst[ 4] = xAxis[1]; newDst[ 5] = yAxis[1]; newDst[ 6] = zAxis[1]; newDst[ 7] = 0;\n newDst[ 8] = xAxis[2]; newDst[ 9] = yAxis[2]; newDst[10] = zAxis[2]; newDst[11] = 0;\n\n newDst[12] = -(xAxis[0] * eye[0] + xAxis[1] * eye[1] + xAxis[2] * eye[2]);\n newDst[13] = -(yAxis[0] * eye[0] + yAxis[1] * eye[1] + yAxis[2] * eye[2]);\n newDst[14] = -(zAxis[0] * eye[0] + zAxis[1] * eye[1] + zAxis[2] * eye[2]);\n newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which translates by the given vector v.\n * @param v - The vector by\n * which to translate.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The translation matrix.\n */\nfunction translation(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = 1; newDst[ 1] = 0; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = 1; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1; newDst[11] = 0;\n newDst[12] = v[0]; newDst[13] = v[1]; newDst[14] = v[2]; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Translates the given 4-by-4 matrix by the given vector v.\n * @param m - The matrix.\n * @param v - The vector by\n * which to translate.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The translated matrix.\n */\nfunction translate(m: Mat4Arg, v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const m00 = m[0];\n const m01 = m[1];\n const m02 = m[2];\n const m03 = m[3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const m30 = m[3 * 4 + 0];\n const m31 = m[3 * 4 + 1];\n const m32 = m[3 * 4 + 2];\n const m33 = m[3 * 4 + 3];\n\n if (m !== newDst) {\n newDst[ 0] = m00;\n newDst[ 1] = m01;\n newDst[ 2] = m02;\n newDst[ 3] = m03;\n newDst[ 4] = m10;\n newDst[ 5] = m11;\n newDst[ 6] = m12;\n newDst[ 7] = m13;\n newDst[ 8] = m20;\n newDst[ 9] = m21;\n newDst[10] = m22;\n newDst[11] = m23;\n }\n\n newDst[12] = m00 * v0 + m10 * v1 + m20 * v2 + m30;\n newDst[13] = m01 * v0 + m11 * v1 + m21 * v2 + m31;\n newDst[14] = m02 * v0 + m12 * v1 + m22 * v2 + m32;\n newDst[15] = m03 * v0 + m13 * v1 + m23 * v2 + m33;\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the x-axis by the given angle.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotation matrix.\n */\nfunction rotationX(angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = 1; newDst[ 1] = 0; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = c; newDst[ 6] = s; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = -s; newDst[10] = c; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Rotates the given 4-by-4 matrix around the x-axis by the given\n * angle.\n * @param m - The matrix.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nfunction rotateX(m: Mat4Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const m10 = m[4];\n const m11 = m[5];\n const m12 = m[6];\n const m13 = m[7];\n const m20 = m[8];\n const m21 = m[9];\n const m22 = m[10];\n const m23 = m[11];\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[4] = c * m10 + s * m20;\n newDst[5] = c * m11 + s * m21;\n newDst[6] = c * m12 + s * m22;\n newDst[7] = c * m13 + s * m23;\n newDst[8] = c * m20 - s * m10;\n newDst[9] = c * m21 - s * m11;\n newDst[10] = c * m22 - s * m12;\n newDst[11] = c * m23 - s * m13;\n\n if (m !== newDst) {\n newDst[ 0] = m[ 0];\n newDst[ 1] = m[ 1];\n newDst[ 2] = m[ 2];\n newDst[ 3] = m[ 3];\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the y-axis by the given angle.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotation matrix.\n */\nfunction rotationY(angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c; newDst[ 1] = 0; newDst[ 2] = -s; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = 1; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = s; newDst[ 9] = 0; newDst[10] = c; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Rotates the given 4-by-4 matrix around the y-axis by the given\n * angle.\n * @param m - The matrix.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nfunction rotateY(m: Mat4Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c * m00 - s * m20;\n newDst[ 1] = c * m01 - s * m21;\n newDst[ 2] = c * m02 - s * m22;\n newDst[ 3] = c * m03 - s * m23;\n newDst[ 8] = c * m20 + s * m00;\n newDst[ 9] = c * m21 + s * m01;\n newDst[10] = c * m22 + s * m02;\n newDst[11] = c * m23 + s * m03;\n\n if (m !== newDst) {\n newDst[ 4] = m[ 4];\n newDst[ 5] = m[ 5];\n newDst[ 6] = m[ 6];\n newDst[ 7] = m[ 7];\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the z-axis by the given angle.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotation matrix.\n */\nfunction rotationZ(angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c; newDst[ 1] = s; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = -s; newDst[ 5] = c; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Rotates the given 4-by-4 matrix around the z-axis by the given\n * angle.\n * @param m - The matrix.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nfunction rotateZ(m: Mat4Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c * m00 + s * m10;\n newDst[ 1] = c * m01 + s * m11;\n newDst[ 2] = c * m02 + s * m12;\n newDst[ 3] = c * m03 + s * m13;\n newDst[ 4] = c * m10 - s * m00;\n newDst[ 5] = c * m11 - s * m01;\n newDst[ 6] = c * m12 - s * m02;\n newDst[ 7] = c * m13 - s * m03;\n\n if (m !== newDst) {\n newDst[ 8] = m[ 8];\n newDst[ 9] = m[ 9];\n newDst[10] = m[10];\n newDst[11] = m[11];\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the given axis by the given\n * angle.\n * @param axis - The axis\n * about which to rotate.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns A matrix which rotates angle radians\n * around the axis.\n */\nfunction axisRotation(axis: Vec3Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n let x = axis[0];\n let y = axis[1];\n let z = axis[2];\n const n = Math.sqrt(x * x + y * y + z * z);\n x /= n;\n y /= n;\n z /= n;\n const xx = x * x;\n const yy = y * y;\n const zz = z * z;\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n const oneMinusCosine = 1 - c;\n\n newDst[ 0] = xx + (1 - xx) * c;\n newDst[ 1] = x * y * oneMinusCosine + z * s;\n newDst[ 2] = x * z * oneMinusCosine - y * s;\n newDst[ 3] = 0;\n newDst[ 4] = x * y * oneMinusCosine - z * s;\n newDst[ 5] = yy + (1 - yy) * c;\n newDst[ 6] = y * z * oneMinusCosine + x * s;\n newDst[ 7] = 0;\n newDst[ 8] = x * z * oneMinusCosine + y * s;\n newDst[ 9] = y * z * oneMinusCosine - x * s;\n newDst[10] = zz + (1 - zz) * c;\n newDst[11] = 0;\n newDst[12] = 0;\n newDst[13] = 0;\n newDst[14] = 0;\n newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the given axis by the given\n * angle. (same as axisRotation)\n * @param axis - The axis\n * about which to rotate.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns A matrix which rotates angle radians\n * around the axis.\n */\nconst rotation = axisRotation;\n\n/**\n * Rotates the given 4-by-4 matrix around the given axis by the\n * given angle.\n * @param m - The matrix.\n * @param axis - The axis\n * about which to rotate.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nfunction axisRotate(m: Mat4Arg, axis: Vec3Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n let x = axis[0];\n let y = axis[1];\n let z = axis[2];\n const n = Math.sqrt(x * x + y * y + z * z);\n x /= n;\n y /= n;\n z /= n;\n const xx = x * x;\n const yy = y * y;\n const zz = z * z;\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n const oneMinusCosine = 1 - c;\n\n const r00 = xx + (1 - xx) * c;\n const r01 = x * y * oneMinusCosine + z * s;\n const r02 = x * z * oneMinusCosine - y * s;\n const r10 = x * y * oneMinusCosine - z * s;\n const r11 = yy + (1 - yy) * c;\n const r12 = y * z * oneMinusCosine + x * s;\n const r20 = x * z * oneMinusCosine + y * s;\n const r21 = y * z * oneMinusCosine - x * s;\n const r22 = zz + (1 - zz) * c;\n\n const m00 = m[0];\n const m01 = m[1];\n const m02 = m[2];\n const m03 = m[3];\n const m10 = m[4];\n const m11 = m[5];\n const m12 = m[6];\n const m13 = m[7];\n const m20 = m[8];\n const m21 = m[9];\n const m22 = m[10];\n const m23 = m[11];\n\n newDst[ 0] = r00 * m00 + r01 * m10 + r02 * m20;\n newDst[ 1] = r00 * m01 + r01 * m11 + r02 * m21;\n newDst[ 2] = r00 * m02 + r01 * m12 + r02 * m22;\n newDst[ 3] = r00 * m03 + r01 * m13 + r02 * m23;\n newDst[ 4] = r10 * m00 + r11 * m10 + r12 * m20;\n newDst[ 5] = r10 * m01 + r11 * m11 + r12 * m21;\n newDst[ 6] = r10 * m02 + r11 * m12 + r12 * m22;\n newDst[ 7] = r10 * m03 + r11 * m13 + r12 * m23;\n newDst[ 8] = r20 * m00 + r21 * m10 + r22 * m20;\n newDst[ 9] = r20 * m01 + r21 * m11 + r22 * m21;\n newDst[10] = r20 * m02 + r21 * m12 + r22 * m22;\n newDst[11] = r20 * m03 + r21 * m13 + r22 * m23;\n\n if (m !== newDst) {\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\n/**\n * Rotates the given 4-by-4 matrix around the given axis by the\n * given angle. (same as rotate)\n * @param m - The matrix.\n * @param axis - The axis\n * about which to rotate.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nconst rotate = axisRotate;\n\n/**\n * Creates a 4-by-4 matrix which scales in each dimension by an amount given by\n * the corresponding entry in the given vector; assumes the vector has three\n * entries.\n * @param v - A vector of\n * three entries specifying the factor by which to scale in each dimension.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaling matrix.\n */\nfunction scaling(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = v[0]; newDst[ 1] = 0; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = v[1]; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = v[2]; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Scales the given 4-by-4 matrix in each dimension by an amount\n * given by the corresponding entry in the given vector; assumes the vector has\n * three entries.\n * @param m - The matrix to be modified.\n * @param v - A vector of three entries specifying the\n * factor by which to scale in each dimension.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaled matrix.\n */\nfunction scale(m: Mat4Arg, v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n\n newDst[ 0] = v0 * m[0 * 4 + 0];\n newDst[ 1] = v0 * m[0 * 4 + 1];\n newDst[ 2] = v0 * m[0 * 4 + 2];\n newDst[ 3] = v0 * m[0 * 4 + 3];\n newDst[ 4] = v1 * m[1 * 4 + 0];\n newDst[ 5] = v1 * m[1 * 4 + 1];\n newDst[ 6] = v1 * m[1 * 4 + 2];\n newDst[ 7] = v1 * m[1 * 4 + 3];\n newDst[ 8] = v2 * m[2 * 4 + 0];\n newDst[ 9] = v2 * m[2 * 4 + 1];\n newDst[10] = v2 * m[2 * 4 + 2];\n newDst[11] = v2 * m[2 * 4 + 3];\n\n if (m !== newDst) {\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which scales a uniform amount in each dimension.\n * @param s - the amount to scale\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaling matrix.\n */\nfunction uniformScaling(s: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = s; newDst[ 1] = 0; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = s; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = s; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Scales the given 4-by-4 matrix in each dimension by a uniform scale.\n * @param m - The matrix to be modified.\n * @param s - The amount to scale.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaled matrix.\n */\nfunction uniformScale(m: Mat4Arg, s: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = s * m[0 * 4 + 0];\n newDst[ 1] = s * m[0 * 4 + 1];\n newDst[ 2] = s * m[0 * 4 + 2];\n newDst[ 3] = s * m[0 * 4 + 3];\n newDst[ 4] = s * m[1 * 4 + 0];\n newDst[ 5] = s * m[1 * 4 + 1];\n newDst[ 6] = s * m[1 * 4 + 2];\n newDst[ 7] = s * m[1 * 4 + 3];\n newDst[ 8] = s * m[2 * 4 + 0];\n newDst[ 9] = s * m[2 * 4 + 1];\n newDst[10] = s * m[2 * 4 + 2];\n newDst[11] = s * m[2 * 4 + 3];\n\n if (m !== newDst) {\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\nreturn {\n create,\n set,\n fromMat3,\n fromQuat,\n negate,\n copy,\n clone,\n equalsApproximately,\n equals,\n identity,\n transpose,\n inverse,\n determinant,\n invert,\n multiply,\n mul,\n setTranslation,\n getTranslation,\n getAxis,\n setAxis,\n getScaling,\n perspective,\n perspectiveReverseZ,\n ortho,\n frustum,\n frustumReverseZ,\n aim,\n cameraAim,\n lookAt,\n translation,\n translate,\n rotationX,\n rotateX,\n rotationY,\n rotateY,\n rotationZ,\n rotateZ,\n axisRotation,\n rotation,\n axisRotate,\n rotate,\n scaling,\n scale,\n uniformScaling,\n uniformScale,\n};\n\n}\n\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\nexport function getAPI(Ctor: Mat4Ctor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport * as utils from './utils.js';\nimport { QuatArg, QuatType } from './quat';\nimport { Mat3Arg } from './mat3.js';\nimport { Mat4Arg } from './mat4.js';\nimport { Vec3Arg } from './vec3.js';\nimport { getAPI as getVec3API } from './vec3-impl';\nimport { BaseArgType } from './types';\n\nexport { QuatArg, QuatType };\n\ntype QuatCtor = new (n: number) => T;\n\nexport type RotationOrder = 'xyz' | 'xzy' | 'yxz' | 'yzx' | 'zxy' | 'zyx';\n\n/**\n * Generates am typed API for Qud\n * */\nfunction getAPIImpl(Ctor: QuatCtor) {\n const vec3 = getVec3API(Ctor);\n\n/**\n * Creates a quat4; may be called with x, y, z to set initial values.\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @param w - Initial w value.\n * @returns the created vector\n */\nfunction create(x?: number, y?: number, z?: number, w?: number) {\n const newDst = new Ctor(4);\n if (x !== undefined) {\n newDst[0] = x;\n if (y !== undefined) {\n newDst[1] = y;\n if (z !== undefined) {\n newDst[2] = z;\n if (w !== undefined) {\n newDst[3] = w;\n }\n }\n }\n }\n return newDst;\n}\n\n/**\n * Creates a Quat; may be called with x, y, z to set initial values. (same as create)\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @param z - Initial w value.\n * @returns the created vector\n */\nconst fromValues = create;\n\n/**\n * Sets the values of a Quat\n * Also see {@link quat.create} and {@link quat.copy}\n *\n * @param x first value\n * @param y second value\n * @param z third value\n * @param w fourth value\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector with its elements set.\n */\nfunction set(x: number, y: number, z: number, w: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = x;\n newDst[1] = y;\n newDst[2] = z;\n newDst[3] = w;\n\n return newDst;\n}\n\n/**\n * Sets a quaternion from the given angle and axis,\n * then returns it.\n *\n * @param axis - the axis to rotate around\n * @param angleInRadians - the angle\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The quaternion that represents the given axis and angle\n **/\nfunction fromAxisAngle(axis: Vec3Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const halfAngle = angleInRadians * 0.5;\n const s = Math.sin(halfAngle);\n\n newDst[0] = s * axis[0];\n newDst[1] = s * axis[1];\n newDst[2] = s * axis[2];\n newDst[3] = Math.cos(halfAngle);\n\n return newDst;\n}\n\n/**\n * Gets the rotation axis and angle\n * @param q - quaternion to compute from\n * @param dst - Vec3 to hold result. If not passed in a new one is created.\n * @return angle and axis\n */\nfunction toAxisAngle(q: QuatArg, dst?: T): { angle: number, axis: T } {\n const newDst = (dst ?? vec3.create(3)) as T;\n\n const angle = Math.acos(q[3]) * 2;\n const s = Math.sin(angle * 0.5);\n if (s > utils.EPSILON) {\n newDst[0] = q[0] / s;\n newDst[1] = q[1] / s;\n newDst[2] = q[2] / s;\n } else {\n newDst[0] = 1;\n newDst[1] = 0;\n newDst[2] = 0;\n }\n\n return { angle, axis: newDst };\n}\n\n/**\n * Returns the angle in degrees between two rotations a and b.\n * @param a - quaternion a\n * @param b - quaternion b\n * @return angle in radians between the two quaternions\n */\nfunction angle(a: QuatArg, b: QuatArg) {\n const d = dot(a, b);\n return Math.acos(2 * d * d - 1);\n}\n\n/**\n * Multiplies two quaternions\n *\n * @param a - the first quaternion\n * @param b - the second quaternion\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nfunction multiply(a: QuatArg, b: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const aw = a[3];\n\n const bx = b[0];\n const by = b[1];\n const bz = b[2];\n const bw = b[3];\n\n newDst[0] = ax * bw + aw * bx + ay * bz - az * by;\n newDst[1] = ay * bw + aw * by + az * bx - ax * bz;\n newDst[2] = az * bw + aw * bz + ax * by - ay * bx;\n newDst[3] = aw * bw - ax * bx - ay * by - az * bz;\n\n return newDst;\n}\n\n/**\n * Multiplies two quaternions\n *\n * @param a - the first quaternion\n * @param b - the second quaternion\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nconst mul = multiply;\n\n/**\n * Rotates the given quaternion around the X axis by the given angle.\n * @param q - quaternion to rotate\n * @param angleInRadians - The angle by which to rotate\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nfunction rotateX(q: QuatArg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const halfAngle = angleInRadians * 0.5;\n\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const qw = q[3];\n\n const bx = Math.sin(halfAngle);\n const bw = Math.cos(halfAngle);\n\n newDst[0] = qx * bw + qw * bx;\n newDst[1] = qy * bw + qz * bx;\n newDst[2] = qz * bw - qy * bx;\n newDst[3] = qw * bw - qx * bx;\n\n return newDst;\n}\n\n/**\n * Rotates the given quaternion around the Y axis by the given angle.\n * @param q - quaternion to rotate\n * @param angleInRadians - The angle by which to rotate\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nfunction rotateY(q: QuatArg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const halfAngle = angleInRadians * 0.5;\n\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const qw = q[3];\n\n const by = Math.sin(halfAngle);\n const bw = Math.cos(halfAngle);\n\n newDst[0] = qx * bw - qz * by;\n newDst[1] = qy * bw + qw * by;\n newDst[2] = qz * bw + qx * by;\n newDst[3] = qw * bw - qy * by;\n\n return newDst;\n}\n\n/**\n * Rotates the given quaternion around the Z axis by the given angle.\n * @param q - quaternion to rotate\n * @param angleInRadians - The angle by which to rotate\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nfunction rotateZ(q: QuatArg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const halfAngle = angleInRadians * 0.5;\n\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const qw = q[3];\n\n const bz = Math.sin(halfAngle);\n const bw = Math.cos(halfAngle);\n\n newDst[0] = qx * bw + qy * bz;\n newDst[1] = qy * bw - qx * bz;\n newDst[2] = qz * bw + qw * bz;\n newDst[3] = qw * bw - qz * bz;\n\n return newDst;\n}\n\n/**\n * Spherically linear interpolate between two quaternions\n *\n * @param a - starting value\n * @param b - ending value\n * @param t - value where 0 = a and 1 = b\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nfunction slerp(a: QuatArg, b: QuatArg, t: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const aw = a[3];\n\n let bx = b[0];\n let by = b[1];\n let bz = b[2];\n let bw = b[3];\n\n let cosOmega = ax * bx + ay * by + az * bz + aw * bw;\n\n if (cosOmega < 0) {\n cosOmega = -cosOmega;\n bx = -bx;\n by = -by;\n bz = -bz;\n bw = -bw;\n }\n\n let scale0;\n let scale1;\n\n if (1.0 - cosOmega > utils.EPSILON) {\n const omega = Math.acos(cosOmega);\n const sinOmega = Math.sin(omega);\n scale0 = Math.sin((1 - t) * omega) / sinOmega;\n scale1 = Math.sin(t * omega) / sinOmega;\n } else {\n scale0 = 1.0 - t;\n scale1 = t;\n }\n\n newDst[0] = scale0 * ax + scale1 * bx;\n newDst[1] = scale0 * ay + scale1 * by;\n newDst[2] = scale0 * az + scale1 * bz;\n newDst[3] = scale0 * aw + scale1 * bw;\n\n return newDst;\n}\n\n/**\n * Compute the inverse of a quaternion\n *\n * @param q - quaternion to compute the inverse of\n * @returns A quaternion that is the result of a * b\n */\nfunction inverse(q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const a0 = q[0];\n const a1 = q[1];\n const a2 = q[2];\n const a3 = q[3];\n\n const dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3;\n const invDot = dot ? 1 / dot : 0;\n\n newDst[0] = -a0 * invDot;\n newDst[1] = -a1 * invDot;\n newDst[2] = -a2 * invDot;\n newDst[3] = a3 * invDot;\n\n return newDst;\n}\n\n/**\n * Compute the conjugate of a quaternion\n * For quaternions with a magnitude of 1 (a unit quaternion)\n * this returns the same as the inverse but is faster to calculate.\n *\n * @param q - quaternion to compute the conjugate of.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The conjugate of q\n */\nfunction conjugate(q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = -q[0];\n newDst[1] = -q[1];\n newDst[2] = -q[2];\n newDst[3] = q[3];\n\n return newDst;\n}\n\n/**\n * Creates a quaternion from the given rotation matrix.\n *\n * The created quaternion is not normalized.\n *\n * @param m - rotation matrix\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns the result\n */\nfunction fromMat(m: Mat3Arg | Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n /*\n 0 1 2\n 3 4 5\n 6 7 8\n\n 0 1 2\n 4 5 6\n 8 9 10\n */\n\n // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes\n // article \"Quaternion Calculus and Fast Animation\".\n const trace = m[0] + m[5] + m[10];\n\n if (trace > 0.0) {\n // |w| > 1/2, may as well choose w > 1/2\n const root = Math.sqrt(trace + 1); // 2w\n newDst[3] = 0.5 * root;\n const invRoot = 0.5 / root; // 1/(4w)\n\n newDst[0] = (m[6] - m[9]) * invRoot;\n newDst[1] = (m[8] - m[2]) * invRoot;\n newDst[2] = (m[1] - m[4]) * invRoot;\n } else {\n // |w| <= 1/2\n let i = 0;\n\n if (m[5] > m[0]) {\n i = 1;\n }\n if (m[10] > m[i * 4 + i]) {\n i = 2;\n }\n\n const j = (i + 1) % 3;\n const k = (i + 2) % 3;\n\n const root = Math.sqrt(m[i * 4 + i] - m[j * 4 + j] - m[k * 4 + k] + 1.0);\n newDst[i] = 0.5 * root;\n\n const invRoot = 0.5 / root;\n\n newDst[3] = (m[j * 4 + k] - m[k * 4 + j]) * invRoot;\n newDst[j] = (m[j * 4 + i] + m[i * 4 + j]) * invRoot;\n newDst[k] = (m[k * 4 + i] + m[i * 4 + k]) * invRoot;\n }\n\n return newDst;\n}\n\n/**\n * Creates a quaternion from the given euler angle x, y, z using the provided intrinsic order for the conversion.\n *\n * @param xAngleInRadians - angle to rotate around X axis in radians.\n * @param yAngleInRadians - angle to rotate around Y axis in radians.\n * @param zAngleInRadians - angle to rotate around Z axis in radians.\n * @param order - order to apply euler angles\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion representing the same rotation as the euler angles applied in the given order\n */\nfunction fromEuler(\n xAngleInRadians: number,\n yAngleInRadians: number,\n zAngleInRadians: number,\n order: RotationOrder,\n dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const xHalfAngle = xAngleInRadians * 0.5;\n const yHalfAngle = yAngleInRadians * 0.5;\n const zHalfAngle = zAngleInRadians * 0.5;\n\n const sx = Math.sin(xHalfAngle);\n const cx = Math.cos(xHalfAngle);\n const sy = Math.sin(yHalfAngle);\n const cy = Math.cos(yHalfAngle);\n const sz = Math.sin(zHalfAngle);\n const cz = Math.cos(zHalfAngle);\n\n switch (order) {\n case 'xyz':\n newDst[0] = sx * cy * cz + cx * sy * sz;\n newDst[1] = cx * sy * cz - sx * cy * sz;\n newDst[2] = cx * cy * sz + sx * sy * cz;\n newDst[3] = cx * cy * cz - sx * sy * sz;\n break;\n\n case 'xzy':\n newDst[0] = sx * cy * cz - cx * sy * sz;\n newDst[1] = cx * sy * cz - sx * cy * sz;\n newDst[2] = cx * cy * sz + sx * sy * cz;\n newDst[3] = cx * cy * cz + sx * sy * sz;\n break;\n\n case 'yxz':\n newDst[0] = sx * cy * cz + cx * sy * sz;\n newDst[1] = cx * sy * cz - sx * cy * sz;\n newDst[2] = cx * cy * sz - sx * sy * cz;\n newDst[3] = cx * cy * cz + sx * sy * sz;\n break;\n\n case 'yzx':\n newDst[0] = sx * cy * cz + cx * sy * sz;\n newDst[1] = cx * sy * cz + sx * cy * sz;\n newDst[2] = cx * cy * sz - sx * sy * cz;\n newDst[3] = cx * cy * cz - sx * sy * sz;\n break;\n\n case 'zxy':\n newDst[0] = sx * cy * cz - cx * sy * sz;\n newDst[1] = cx * sy * cz + sx * cy * sz;\n newDst[2] = cx * cy * sz + sx * sy * cz;\n newDst[3] = cx * cy * cz - sx * sy * sz;\n break;\n\n case 'zyx':\n newDst[0] = sx * cy * cz - cx * sy * sz;\n newDst[1] = cx * sy * cz + sx * cy * sz;\n newDst[2] = cx * cy * sz - sx * sy * cz;\n newDst[3] = cx * cy * cz + sx * sy * sz;\n break;\n\n default:\n throw new Error(`Unknown rotation order: ${order}`);\n }\n\n return newDst;\n}\n\n/**\n * Copies a quaternion. (same as {@link quat.clone})\n * Also see {@link quat.create} and {@link quat.set}\n * @param q - The quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is a copy of q\n */\nfunction copy(q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = q[0];\n newDst[1] = q[1];\n newDst[2] = q[2];\n newDst[3] = q[3];\n\n return newDst;\n}\n\n/**\n * Clones a quaternion. (same as {@link quat.copy})\n * Also see {@link quat.create} and {@link quat.set}\n * @param q - The quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A copy of q.\n */\nconst clone = copy;\n\n/**\n * Adds two quaternions; assumes a and b have the same dimension.\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the sum of a and b.\n */\nfunction add(a: QuatArg, b: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + b[0];\n newDst[1] = a[1] + b[1];\n newDst[2] = a[2] + b[2];\n newDst[3] = a[3] + b[3];\n\n return newDst;\n}\n\n/**\n * Subtracts two quaternions.\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the difference of a and b.\n */\nfunction subtract(a: QuatArg, b: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] - b[0];\n newDst[1] = a[1] - b[1];\n newDst[2] = a[2] - b[2];\n newDst[3] = a[3] - b[3];\n\n return newDst;\n}\n\n/**\n * Subtracts two quaternions.\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the difference of a and b.\n */\nconst sub = subtract;\n\n/**\n * Multiplies a quaternion by a scalar.\n * @param v - The quaternion.\n * @param k - The scalar.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The scaled quaternion.\n */\nfunction mulScalar(v: QuatArg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = v[0] * k;\n newDst[1] = v[1] * k;\n newDst[2] = v[2] * k;\n newDst[3] = v[3] * k;\n\n return newDst;\n}\n\n/**\n * Multiplies a quaternion by a scalar. (same as mulScalar)\n * @param v - The quaternion.\n * @param k - The scalar.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The scaled quaternion.\n */\nconst scale = mulScalar;\n\n/**\n * Divides a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The scaled quaternion.\n */\nfunction divScalar(v: QuatArg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = v[0] / k;\n newDst[1] = v[1] / k;\n newDst[2] = v[2] / k;\n newDst[3] = v[3] / k;\n\n return newDst;\n}\n\n/**\n * Computes the dot product of two quaternions\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @returns dot product\n */\nfunction dot(a: QuatArg, b: QuatArg): number {\n return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]) + (a[3] * b[3]);\n}\n\n/**\n * Performs linear interpolation on two quaternions.\n * Given quaternions a and b and interpolation coefficient t, returns\n * a + t * (b - a).\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @param t - Interpolation coefficient.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The linear interpolated result.\n */\nfunction lerp(a: QuatArg, b: QuatArg, t: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + t * (b[0] - a[0]);\n newDst[1] = a[1] + t * (b[1] - a[1]);\n newDst[2] = a[2] + t * (b[2] - a[2]);\n newDst[3] = a[3] + t * (b[3] - a[3]);\n\n return newDst;\n}\n\n/**\n * Computes the length of quaternion\n * @param v - quaternion.\n * @returns length of quaternion.\n */\nfunction length(v: QuatArg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n return Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3);\n}\n\n/**\n * Computes the length of quaternion (same as length)\n * @param v - quaternion.\n * @returns length of quaternion.\n */\nconst len = length;\n\n/**\n * Computes the square of the length of quaternion\n * @param v - quaternion.\n * @returns square of the length of quaternion.\n */\nfunction lengthSq(v: QuatArg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n return v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3;\n}\n\n/**\n * Computes the square of the length of quaternion (same as lengthSq)\n * @param v - quaternion.\n * @returns square of the length of quaternion.\n */\nconst lenSq = lengthSq;\n\n/**\n * Divides a quaternion by its Euclidean length and returns the quotient.\n * @param v - The quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The normalized quaternion.\n */\nfunction normalize(v: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n const len = Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3);\n\n if (len > 0.00001) {\n newDst[0] = v0 / len;\n newDst[1] = v1 / len;\n newDst[2] = v2 / len;\n newDst[3] = v3 / len;\n } else {\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 0;\n }\n\n return newDst;\n}\n\n/**\n * Check if 2 quaternions are approximately equal\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @returns true if quaternions are approximately equal\n */\nfunction equalsApproximately(a: QuatArg, b: QuatArg): boolean {\n return Math.abs(a[0] - b[0]) < utils.EPSILON &&\n Math.abs(a[1] - b[1]) < utils.EPSILON &&\n Math.abs(a[2] - b[2]) < utils.EPSILON &&\n Math.abs(a[3] - b[3]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 quaternions are exactly equal\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @returns true if quaternions are exactly equal\n */\nfunction equals(a: QuatArg, b: QuatArg): boolean {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];\n}\n\n/**\n * Creates an identity quaternion\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns an identity quaternion\n */\nfunction identity(dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 1;\n\n return newDst;\n}\n\nconst tempVec3 = vec3.create();\nconst xUnitVec3 = vec3.create();\nconst yUnitVec3 = vec3.create();\n\n/**\n * Computes a quaternion to represent the shortest rotation from one vector to another.\n *\n * @param aUnit - the start vector\n * @param bUnit - the end vector\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns the result\n */\nfunction rotationTo(aUnit: Vec3Arg, bUnit: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const dot = vec3.dot(aUnit, bUnit);\n if (dot < -0.999999) {\n vec3.cross(xUnitVec3, aUnit, tempVec3);\n if (vec3.len(tempVec3) < 0.000001) {\n vec3.cross(yUnitVec3, aUnit, tempVec3);\n }\n\n vec3.normalize(tempVec3, tempVec3);\n fromAxisAngle(tempVec3, Math.PI, newDst);\n\n return newDst;\n } else if (dot > 0.999999) {\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 1;\n\n return newDst;\n } else {\n vec3.cross(aUnit, bUnit, tempVec3);\n\n newDst[0] = tempVec3[0];\n newDst[1] = tempVec3[1];\n newDst[2] = tempVec3[2];\n newDst[3] = 1 + dot;\n\n return normalize(newDst, newDst);\n }\n}\n\nconst tempQuat1 = new Ctor(4);\nconst tempQuat2 = new Ctor(4);\n\n/**\n * Performs a spherical linear interpolation with two control points\n *\n * @param a - the first quaternion\n * @param b - the second quaternion\n * @param c - the third quaternion\n * @param d - the fourth quaternion\n * @param t - Interpolation coefficient 0 to 1\n * @returns result\n */\nfunction sqlerp(\n a: QuatArg,\n b: QuatArg,\n c: QuatArg,\n d: QuatArg,\n t: number,\n dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n slerp(a, d, t, tempQuat1);\n slerp(b, c, t, tempQuat2);\n slerp(tempQuat1, tempQuat2, 2 * t * (1 - t), newDst);\n\n return newDst;\n}\n\nreturn {\n create,\n fromValues,\n set,\n fromAxisAngle,\n toAxisAngle,\n angle,\n multiply,\n mul,\n rotateX,\n rotateY,\n rotateZ,\n slerp,\n inverse,\n conjugate,\n fromMat,\n fromEuler,\n copy,\n clone,\n add,\n subtract,\n sub,\n mulScalar,\n scale,\n divScalar,\n dot,\n lerp,\n length,\n len,\n lengthSq,\n lenSq,\n normalize,\n equalsApproximately,\n equals,\n identity,\n rotationTo,\n sqlerp,\n};\n\n}\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\n/**\n *\n * Quat4 math functions.\n *\n * Almost all functions take an optional `newDst` argument. If it is not passed in the\n * functions will create a new `Quat4`. In other words you can do this\n *\n * const v = quat4.cross(v1, v2); // Creates a new Quat4 with the cross product of v1 x v2.\n *\n * or\n *\n * const v = quat4.create();\n * quat4.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v\n *\n * The first style is often easier but depending on where it's used it generates garbage where\n * as there is almost never allocation with the second style.\n *\n * It is always safe to pass any vector as the destination. So for example\n *\n * quat4.cross(v1, v2, v1); // Puts the cross product of v1 x v2 in v1\n *\n */\nexport function getAPI(Ctor: QuatCtor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport * as utils from './utils.js';\nimport { Vec4Arg, Vec4Type } from './vec4';\nimport { Mat4Arg } from './mat4';\nimport { BaseArgType } from './types';\n\nexport { Vec4Arg, Vec4Type };\n\ntype Vec4Ctor = new (n: number) => T;\n\n/**\n * Generates am typed API for Vec4\n * */\nfunction getAPIImpl(Ctor: Vec4Ctor) {\n\n/**\n * Creates a vec4; may be called with x, y, z to set initial values.\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @param w - Initial w value.\n * @returns the created vector\n */\nfunction create(x?: number, y?: number, z?: number, w?: number) {\n const newDst = new Ctor(4);\n if (x !== undefined) {\n newDst[0] = x;\n if (y !== undefined) {\n newDst[1] = y;\n if (z !== undefined) {\n newDst[2] = z;\n if (w !== undefined) {\n newDst[3] = w;\n }\n }\n }\n }\n return newDst;\n}\n\n/**\n * Creates a vec4; may be called with x, y, z to set initial values. (same as create)\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @param z - Initial w value.\n * @returns the created vector\n */\nconst fromValues = create;\n\n/**\n * Sets the values of a Vec4\n * Also see {@link vec4.create} and {@link vec4.copy}\n *\n * @param x first value\n * @param y second value\n * @param z third value\n * @param w fourth value\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector with its elements set.\n */\nfunction set(x: number, y: number, z: number, w: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = x;\n newDst[1] = y;\n newDst[2] = z;\n newDst[3] = w;\n\n return newDst;\n}\n\n/**\n * Applies Math.ceil to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the ceil of each element of v.\n */\nfunction ceil(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.ceil(v[0]);\n newDst[1] = Math.ceil(v[1]);\n newDst[2] = Math.ceil(v[2]);\n newDst[3] = Math.ceil(v[3]);\n\n return newDst;\n}\n\n/**\n * Applies Math.floor to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the floor of each element of v.\n */\nfunction floor(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.floor(v[0]);\n newDst[1] = Math.floor(v[1]);\n newDst[2] = Math.floor(v[2]);\n newDst[3] = Math.floor(v[3]);\n\n return newDst;\n}\n\n/**\n * Applies Math.round to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the round of each element of v.\n */\nfunction round(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.round(v[0]);\n newDst[1] = Math.round(v[1]);\n newDst[2] = Math.round(v[2]);\n newDst[3] = Math.round(v[3]);\n\n return newDst;\n}\n\n/**\n * Clamp each element of vector between min and max\n * @param v - Operand vector.\n * @param max - Min value, default 0\n * @param min - Max value, default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that the clamped value of each element of v.\n */\nfunction clamp(v: Vec4Arg, min = 0, max = 1, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.min(max, Math.max(min, v[0]));\n newDst[1] = Math.min(max, Math.max(min, v[1]));\n newDst[2] = Math.min(max, Math.max(min, v[2]));\n newDst[3] = Math.min(max, Math.max(min, v[3]));\n\n return newDst;\n}\n\n/**\n * Adds two vectors; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a and b.\n */\nfunction add(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + b[0];\n newDst[1] = a[1] + b[1];\n newDst[2] = a[2] + b[2];\n newDst[3] = a[3] + b[3];\n\n return newDst;\n}\n\n/**\n * Adds two vectors, scaling the 2nd; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param scale - Amount to scale b\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a + b * scale.\n */\nfunction addScaled(a: Vec4Arg, b: Vec4Arg, scale: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + b[0] * scale;\n newDst[1] = a[1] + b[1] * scale;\n newDst[2] = a[2] + b[2] * scale;\n newDst[3] = a[3] + b[3] * scale;\n\n return newDst;\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nfunction subtract(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] - b[0];\n newDst[1] = a[1] - b[1];\n newDst[2] = a[2] - b[2];\n newDst[3] = a[3] - b[3];\n\n return newDst;\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nconst sub = subtract;\n\n/**\n * Check if 2 vectors are approximately equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are approximately equal\n */\nfunction equalsApproximately(a: Vec4Arg, b: Vec4Arg): boolean {\n return Math.abs(a[0] - b[0]) < utils.EPSILON &&\n Math.abs(a[1] - b[1]) < utils.EPSILON &&\n Math.abs(a[2] - b[2]) < utils.EPSILON &&\n Math.abs(a[3] - b[3]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 vectors are exactly equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are exactly equal\n */\nfunction equals(a: Vec4Arg, b: Vec4Arg): boolean {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficient.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The linear interpolated result.\n */\nfunction lerp(a: Vec4Arg, b: Vec4Arg, t: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + t * (b[0] - a[0]);\n newDst[1] = a[1] + t * (b[1] - a[1]);\n newDst[2] = a[2] + t * (b[2] - a[2]);\n newDst[3] = a[3] + t * (b[3] - a[3]);\n\n return newDst;\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient vector t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficients vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns the linear interpolated result.\n */\nfunction lerpV(a: Vec4Arg, b: Vec4Arg, t: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + t[0] * (b[0] - a[0]);\n newDst[1] = a[1] + t[1] * (b[1] - a[1]);\n newDst[2] = a[2] + t[2] * (b[2] - a[2]);\n newDst[3] = a[3] + t[3] * (b[3] - a[3]);\n\n return newDst;\n}\n\n/**\n * Return max values of two vectors.\n * Given vectors a and b returns\n * [max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The max components vector.\n */\nfunction max(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.max(a[0], b[0]);\n newDst[1] = Math.max(a[1], b[1]);\n newDst[2] = Math.max(a[2], b[2]);\n newDst[3] = Math.max(a[3], b[3]);\n\n return newDst;\n}\n\n/**\n * Return min values of two vectors.\n * Given vectors a and b returns\n * [min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The min components vector.\n */\nfunction min(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.min(a[0], b[0]);\n newDst[1] = Math.min(a[1], b[1]);\n newDst[2] = Math.min(a[2], b[2]);\n newDst[3] = Math.min(a[3], b[3]);\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction mulScalar(v: Vec4Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = v[0] * k;\n newDst[1] = v[1] * k;\n newDst[2] = v[2] * k;\n newDst[3] = v[3] * k;\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar. (same as mulScalar)\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nconst scale = mulScalar;\n\n/**\n * Divides a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction divScalar(v: Vec4Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = v[0] / k;\n newDst[1] = v[1] / k;\n newDst[2] = v[2] / k;\n newDst[3] = v[3] / k;\n\n return newDst;\n}\n\n/**\n * Inverse a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nfunction inverse(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = 1 / v[0];\n newDst[1] = 1 / v[1];\n newDst[2] = 1 / v[2];\n newDst[3] = 1 / v[3];\n\n return newDst;\n}\n\n/**\n * Invert a vector. (same as inverse)\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nconst invert = inverse;\n\n/**\n * Computes the dot product of two vectors\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns dot product\n */\nfunction dot(a: Vec4Arg, b: Vec4Arg): number {\n return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]) + (a[3] * b[3]);\n}\n\n/**\n * Computes the length of vector\n * @param v - vector.\n * @returns length of vector.\n */\nfunction length(v: Vec4Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n return Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3);\n}\n\n/**\n * Computes the length of vector (same as length)\n * @param v - vector.\n * @returns length of vector.\n */\nconst len = length;\n\n/**\n * Computes the square of the length of vector\n * @param v - vector.\n * @returns square of the length of vector.\n */\nfunction lengthSq(v: Vec4Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n return v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3;\n}\n\n/**\n * Computes the square of the length of vector (same as lengthSq)\n * @param v - vector.\n * @returns square of the length of vector.\n */\nconst lenSq = lengthSq;\n\n/**\n * Computes the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nfunction distance(a: Vec4Arg, b: Vec4Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n const dz = a[2] - b[2];\n const dw = a[3] - b[3];\n return Math.sqrt(dx * dx + dy * dy + dz * dz + dw * dw);\n}\n\n/**\n * Computes the distance between 2 points (same as distance)\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nconst dist = distance;\n\n/**\n * Computes the square of the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nfunction distanceSq(a: Vec4Arg, b: Vec4Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n const dz = a[2] - b[2];\n const dw = a[3] - b[3];\n return dx * dx + dy * dy + dz * dz + dw * dw;\n}\n\n/**\n * Computes the square of the distance between 2 points (same as distanceSq)\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nconst distSq = distanceSq;\n\n/**\n * Divides a vector by its Euclidean length and returns the quotient.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The normalized vector.\n */\nfunction normalize(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n const len = Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3);\n\n if (len > 0.00001) {\n newDst[0] = v0 / len;\n newDst[1] = v1 / len;\n newDst[2] = v2 / len;\n newDst[3] = v3 / len;\n } else {\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 0;\n }\n\n return newDst;\n}\n\n/**\n * Negates a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns -v.\n */\nfunction negate(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = -v[0];\n newDst[1] = -v[1];\n newDst[2] = -v[2];\n newDst[3] = -v[3];\n\n return newDst;\n}\n\n/**\n * Copies a vector. (same as {@link vec4.clone})\n * Also see {@link vec4.create} and {@link vec4.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nfunction copy(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = v[0];\n newDst[1] = v[1];\n newDst[2] = v[2];\n newDst[3] = v[3];\n\n return newDst;\n}\n\n/**\n * Clones a vector. (same as {@link vec4.copy})\n * Also see {@link vec4.create} and {@link vec4.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nconst clone = copy;\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nfunction multiply(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] * b[0];\n newDst[1] = a[1] * b[1];\n newDst[2] = a[2] * b[2];\n newDst[3] = a[3] * b[3];\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as mul)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nconst mul = multiply;\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nfunction divide(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] / b[0];\n newDst[1] = a[1] / b[1];\n newDst[2] = a[2] / b[2];\n newDst[3] = a[3] / b[3];\n\n return newDst;\n}\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as divide)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nconst div = divide;\n\n/**\n * Zero's a vector\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The zeroed vector.\n */\nfunction zero(dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 0;\n\n return newDst;\n}\n\n\n/**\n * transform vec4 by 4x4 matrix\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional vec4 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nfunction transformMat4(v: Vec4Arg, m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const x = v[0];\n const y = v[1];\n const z = v[2];\n const w = v[3];\n\n newDst[0] = m[0] * x + m[4] * y + m[ 8] * z + m[12] * w;\n newDst[1] = m[1] * x + m[5] * y + m[ 9] * z + m[13] * w;\n newDst[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;\n newDst[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;\n\n return newDst;\n}\n\n\n/**\n * Treat a 4D vector as a direction and set it's length\n *\n * @param a The vec4 to lengthen\n * @param len The length of the resulting vector\n * @returns The lengthened vector\n */\nfunction setLength(a: Vec4Arg, len: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n normalize(a, newDst);\n return mulScalar(newDst, len, newDst);\n}\n\n/**\n * Ensure a vector is not longer than a max length\n *\n * @param a The vec4 to limit\n * @param maxLen The longest length of the resulting vector\n * @returns The vector, shortened to maxLen if it's too long\n */\nfunction truncate(a: Vec4Arg, maxLen: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n if (length(a) > maxLen) {\n return setLength(a, maxLen, newDst);\n }\n\n return copy(a, newDst);\n}\n\n/**\n * Return the vector exactly between 2 endpoint vectors\n *\n * @param a Endpoint 1\n * @param b Endpoint 2\n * @returns The vector exactly residing between endpoints 1 and 2\n */\nfunction midpoint(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n return lerp(a, b, 0.5, newDst);\n}\n\nreturn {\n create,\n fromValues,\n set,\n ceil,\n floor,\n round,\n clamp,\n add,\n addScaled,\n subtract,\n sub,\n equalsApproximately,\n equals,\n lerp,\n lerpV,\n max,\n min,\n mulScalar,\n scale,\n divScalar,\n inverse,\n invert,\n dot,\n length,\n len,\n lengthSq,\n lenSq,\n distance,\n dist,\n distanceSq,\n distSq,\n normalize,\n negate,\n copy,\n clone,\n multiply,\n mul,\n divide,\n div,\n zero,\n transformMat4,\n setLength,\n truncate,\n midpoint,\n};\n}\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\n/**\n *\n * Vec4 math functions.\n *\n * Almost all functions take an optional `newDst` argument. If it is not passed in the\n * functions will create a new `Vec4`. In other words you can do this\n *\n * const v = vec4.cross(v1, v2); // Creates a new Vec4 with the cross product of v1 x v2.\n *\n * or\n *\n * const v = vec4.create();\n * vec4.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v\n *\n * The first style is often easier but depending on where it's used it generates garbage where\n * as there is almost never allocation with the second style.\n *\n * It is always safe to pass any vector as the destination. So for example\n *\n * vec4.cross(v1, v2, v1); // Puts the cross product of v1 x v2 in v1\n *\n */\nexport function getAPI(Ctor: Vec4Ctor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n\n","import {BaseArgType, ZeroArray} from './types';\nimport {Mat3Arg, Mat3Type, getAPI as getMat3API} from './mat3-impl';\nimport {Mat4Arg, Mat4Type, getAPI as getMat4API} from './mat4-impl';\nimport {QuatArg, QuatType, getAPI as getQuatAPI, RotationOrder} from './quat-impl';\nimport {Vec2Arg, Vec2Type, getAPI as getVec2API} from './vec2-impl';\nimport {Vec3Arg, Vec3Type, getAPI as getVec3API} from './vec3-impl';\nimport {Vec4Arg, Vec4Type, getAPI as getVec4API} from './vec4-impl';\nimport * as utils from './utils';\n\nexport {\n RotationOrder,\n utils,\n\n BaseArgType,\n\n Mat3Arg,\n Mat4Arg,\n QuatArg,\n Vec2Arg,\n Vec3Arg,\n Vec4Arg,\n\n Mat3Type,\n Mat4Type,\n QuatType,\n Vec2Type,\n Vec3Type,\n Vec4Type,\n};\n\nexport type BaseCtor = new (n: number) => T;\n\nexport type Mat3 = Mat3Type;\nexport type Mat4 = Mat4Type;\nexport type Quat = QuatType;\nexport type Vec2 = Vec2Type;\nexport type Vec3 = Vec3Type;\nexport type Vec4 = Vec4Type;\n\nexport type Mat3d = Mat3Type;\nexport type Mat4d = Mat4Type;\nexport type Quatd = QuatType;\nexport type Vec2d = Vec2Type;\nexport type Vec3d = Vec3Type;\nexport type Vec4d = Vec4Type;\n\nexport type Mat3n = Mat3Type;\nexport type Mat4n = Mat4Type;\nexport type Quatn = QuatType;\nexport type Vec2n = Vec2Type;\nexport type Vec3n = Vec3Type;\nexport type Vec4n = Vec4Type;\n\n/**\n * Generate wgpu-matrix API for type\n */\nfunction wgpuMatrixAPI<\n Mat3 extends BaseArgType,\n Mat4 extends BaseArgType,\n Quat extends BaseArgType,\n Vec2 extends BaseArgType,\n Vec3 extends BaseArgType,\n Vec4 extends BaseArgType,\n>(\n Mat3Ctor: BaseCtor,\n Mat4Ctor: BaseCtor,\n QuatCtor: BaseCtor,\n Vec2Ctor: BaseCtor,\n Vec3Ctor: BaseCtor,\n Vec4Ctor: BaseCtor,\n) {\n return {\n /** @namespace mat4 */\n mat4: getMat4API(Mat3Ctor),\n /** @namespace mat3 */\n mat3: getMat3API(Mat4Ctor),\n /** @namespace quat */\n quat: getQuatAPI(QuatCtor),\n /** @namespace vec2 */\n vec2: getVec2API(Vec2Ctor),\n /** @namespace vec3 */\n vec3: getVec3API(Vec3Ctor),\n /** @namespace vec4 */\n vec4: getVec4API(Vec4Ctor),\n };\n}\n\nexport const {\n /** @namespace */\n mat4,\n /** @namespace */\n mat3,\n /** @namespace */\n quat,\n /** @namespace */\n vec2,\n /** @namespace */\n vec3,\n /** @namespace */\n vec4,\n} = wgpuMatrixAPI<\n Mat3, Mat4, Quat, Vec2, Vec3, Vec4>(\n Float32Array, Float32Array, Float32Array, Float32Array, Float32Array, Float32Array);\n\nexport const {\n /** @namespace */\n mat4: mat4d,\n /** @namespace */\n mat3: mat3d,\n /** @namespace */\n quat: quatd,\n /** @namespace */\n vec2: vec2d,\n /** @namespace */\n vec3: vec3d,\n /** @namespace */\n vec4: vec4d,\n} = wgpuMatrixAPI<\n Mat3d, Mat4d, Quatd, Vec2d, Vec3d, Vec4d>(\n Float64Array, Float64Array, Float64Array, Float64Array, Float64Array, Float64Array);\n\nexport const {\n /** @namespace */\n mat4: mat4n,\n /** @namespace */\n mat3: mat3n,\n /** @namespace */\n quat: quatn,\n /** @namespace */\n vec2: vec2n,\n /** @namespace */\n vec3: vec3n,\n /** @namespace */\n vec4: vec4n,\n} = wgpuMatrixAPI<\n Mat3n, Mat4n, Quatn, Vec2n, Vec3n, Vec4n>(\n ZeroArray, Array, Array, Array, Array, Array);\n"],"names":["ZeroArray","OriginalConstructor","modifier","a","fill","constructor","args","super","this","EPSILON","degrees","Math","PI","n","m","b","v","d","abs","t","radians","old","cache","Map","getAPI","Ctor","api","get","create","x","y","newDst","undefined","subtract","dst","lerp","mulScalar","k","inverse","dot","length","v0","v1","sqrt","lengthSq","distance","dx","dy","distanceSq","normalize","len","copy","multiply","divide","setLength","fromValues","set","ceil","floor","round","clamp","min","max","add","addScaled","scale","angle","ax","ay","bx","by","mag","cosine","acos","sub","equalsApproximately","utils.EPSILON","equals","lerpV","divScalar","invert","cross","z","lenSq","dist","distSq","negate","clone","mul","div","random","cos","sin","zero","transformMat4","transformMat3","rotate","rad","p0","p1","sinC","cosC","truncate","maxLen","midpoint","getAPIImpl","vec2","getVec2API","identity","m00","m01","m02","m10","m11","m12","m20","m21","m22","b01","b11","b21","invDet","a00","a01","a02","a10","a11","a12","a20","a21","a22","b00","b02","b10","b12","b20","b22","v2","v3","v4","v5","v6","v7","v8","fromMat4","m4","fromQuat","q","w","x2","y2","z2","xx","yx","yy","zx","zy","zz","wx","wy","wz","transpose","determinant","setTranslation","getTranslation","getAxis","axis","off","setAxis","getScaling","xy","translation","translate","rotation","angleInRadians","c","s","scaling","uniformScaling","uniformScale","dz","az","bz","t1","t2","zScale","transformMat4Upper3x3","transformQuat","qx","qy","qz","w2","uvX","uvY","uvZ","xz","yz","rotateX","p","r","rotateY","rotateZ","vec3","getVec3API","m03","m13","m23","m30","m31","m32","m33","tmp0","tmp1","tmp2","tmp3","tmp4","tmp5","tmp6","tmp7","tmp8","tmp9","tmp10","tmp11","tmp12","tmp13","tmp14","tmp15","tmp16","tmp17","tmp18","tmp19","tmp20","tmp21","tmp22","tmp23","t0","t3","a03","a13","a23","a30","a31","a32","a33","b03","b13","b23","b30","b31","b32","b33","xAxis","yAxis","zAxis","axisRotation","oneMinusCosine","axisRotate","r00","r01","r02","r10","r11","r12","r20","r21","r22","v9","v10","v11","v12","v13","v14","v15","fromMat3","m3","perspective","fieldOfViewYInRadians","aspect","zNear","zFar","f","tan","Number","isFinite","rangeInv","perspectiveReverseZ","Infinity","ortho","left","right","bottom","top","near","far","frustum","frustumReverseZ","aim","position","target","up","cameraAim","eye","lookAt","rotationX","rotationY","rotationZ","fromAxisAngle","halfAngle","aw","bw","slerp","scale0","scale1","cosOmega","omega","sinOmega","tempVec3","xUnitVec3","yUnitVec3","tempQuat1","tempQuat2","toAxisAngle","qw","a0","a1","a2","a3","invDot","conjugate","fromMat","trace","root","invRoot","i","j","fromEuler","xAngleInRadians","yAngleInRadians","zAngleInRadians","order","xHalfAngle","yHalfAngle","zHalfAngle","sx","cx","sy","cy","sz","cz","Error","rotationTo","aUnit","bUnit","sqlerp","dw","wgpuMatrixAPI","Mat3Ctor","Mat4Ctor","QuatCtor","Vec2Ctor","Vec3Ctor","Vec4Ctor","mat4","getMat4API","mat3","getMat3API","quat","getQuatAPI","vec4","getVec4API","Float32Array","mat4d","mat3d","quatd","vec2d","vec3d","vec4d","Float64Array","mat4n","mat3n","quatn","vec2n","vec3n","vec4n","Array"],"mappings":"kPAkBO,MAAMA,GAXXC,EAWsC,MAVtCC,EAUsDC,GAAKA,EAAEC,KAAK,GAR3D,cAAcH,EACnB,WAAAI,IAAeC,GACbC,SAASD,GACTJ,EAASM,KACV,IARL,IACEP,EACAC,ECcK,IAAIO,EAAU,4DAkBf,SAAmBC,GACvB,OAAOA,EAAUC,KAAKC,GAAK,GAC7B,kBAqDgB,SAAgBC,EAAWC,GACzC,OAASD,EAAIC,EAAKA,GAAKA,CACzB,uBAxB4BX,EAAWY,EAAWC,GAChD,MAAMC,EAAIF,EAAIZ,EACd,OAAQQ,KAAKO,IAAIH,EAAIZ,GAAKM,EACrBN,GACCa,EAAIb,GAAKc,CACjB,gBAlBqBd,EAAWY,EAAWI,GACzC,OAAOhB,GAAKY,EAAIZ,GAAKgB,CACvB,WAbM,SAAmBC,GACvB,OAAiB,IAAVA,EAAgBT,KAAKC,EAC9B,aAtBM,SAAqBI,GACzB,MAAMK,EAAMZ,EAEZ,OADAA,EAAUO,EACHK,CACT,GCgwBA,MAAMC,EA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,EAChB,EA0DCyE,SAjDF,SAA+CrG,EAAYY,EAAYmB,GAErE,OAAOC,EAAKhC,EAAGY,EAAG,GADFmB,GAAO,IAAIT,EAAK,GAEjC,EAgDD,CA+BUgF,CAAchF,GACpBH,EAAMkC,IAAI/B,EAAMC,IAEXA,CACT,CC/tBA,SAASyU,EAQLC,EACAC,EACAC,EACAC,EACAC,EACAC,GAEF,MAAO,CAELC,KAAMC,EAAiBP,GAEvBQ,KAAMC,EAAiBR,GAEvBS,KAAMC,EAAiBT,GAEvB5P,KAAMC,EAAiB4P,GAEvB7J,KAAMC,EAAiB6J,GAEvBQ,KAAMC,EAAiBR,GAE3B,CAEa,MAAAC,KAEXA,EAAIE,KAEJA,EAAIE,KAEJA,EAAIpQ,KAEJA,EAAIgG,KAEJA,EAAIsK,KAEJA,GACEb,EAEAe,aAAcA,aAAcA,aAAcA,aAAcA,aAAcA,eAIxER,KAAMS,EAENP,KAAMQ,EAENN,KAAMO,EAEN3Q,KAAM4Q,EAEN5K,KAAM6K,EAENP,KAAMQ,GACJrB,EAEAsB,aAAcA,aAAcA,aAAcA,aAAcA,aAAcA,eAIxEf,KAAMgB,EAENd,KAAMe,EAENb,KAAMc,EAENlR,KAAMmR,EAENnL,KAAMoL,EAENd,KAAMe,GACJ5B,EAEAnW,EAAWgY,MAAOA,MAAOA,MAAOA,MAAOA"} \ No newline at end of file diff --git a/dist/2.x/wgpu-matrix.js b/dist/3.x/wgpu-matrix.module.js similarity index 56% rename from dist/2.x/wgpu-matrix.js rename to dist/3.x/wgpu-matrix.module.js index 54a0628..61025da 100644 --- a/dist/2.x/wgpu-matrix.js +++ b/dist/3.x/wgpu-matrix.module.js @@ -1,167 +1,142 @@ -/* wgpu-matrix@2.9.1, license MIT */ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : - typeof define === 'function' && define.amd ? define(['exports'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.wgpuMatrix = {})); -})(this, (function (exports) { 'use strict'; +/* wgpu-matrix@3.0.0, license MIT */ +function wrapConstructor(OriginalConstructor, modifier) { + return class extends OriginalConstructor { + constructor(...args) { + super(...args); + modifier(this); + } + }; // Type assertion is necessary here +} +const ZeroArray = wrapConstructor((Array), a => a.fill(0)); - /* - * Copyright 2022 Gregg Tavares - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - let EPSILON = 0.000001; - /** - * Set the value for EPSILON for various checks - * @param v - Value to use for EPSILON. - * @returns previous value of EPSILON; - */ - function setEpsilon(v) { - const old = EPSILON; - EPSILON = v; - return old; - } - /** - * Convert degrees to radians - * @param degrees - Angle in degrees - * @returns angle converted to radians - */ - function degToRad(degrees) { - return degrees * Math.PI / 180; - } - /** - * Convert radians to degrees - * @param radians - Angle in radians - * @returns angle converted to degrees - */ - function radToDeg(radians) { - return radians * 180 / Math.PI; - } - /** - * Lerps between a and b via t - * @param a - starting value - * @param b - ending value - * @param t - value where 0 = a and 1 = b - * @returns a + (b - a) * t - */ - function lerp$4(a, b, t) { - return a + (b - a) * t; - } - /** - * Compute the opposite of lerp. Given a and b and a value between - * a and b returns a value between 0 and 1. 0 if a, 1 if b. - * Note: no clamping is done. - * @param a - start value - * @param b - end value - * @param v - value between a and b - * @returns (v - a) / (b - a) - */ - function inverseLerp(a, b, v) { - const d = b - a; - return (Math.abs(b - a) < EPSILON) - ? a - : (v - a) / d; - } - /** - * Compute the euclidean modulo - * - * ``` - * // table for n / 3 - * -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5 <- n - * ------------------------------------ - * -2 -1 -0 -2 -1 0, 1, 2, 0, 1, 2 <- n % 3 - * 1 2 0 1 2 0, 1, 2, 0, 1, 2 <- euclideanModule(n, 3) - * ``` - * - * @param n - dividend - * @param m - divisor - * @returns the euclidean modulo of n / m - */ - function euclideanModulo(n, m) { - return ((n % m) + m) % m; - } +/* + * Copyright 2022 Gregg Tavares + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ +let EPSILON = 0.000001; +/** + * Set the value for EPSILON for various checks + * @param v - Value to use for EPSILON. + * @returns previous value of EPSILON; + */ +function setEpsilon(v) { + const old = EPSILON; + EPSILON = v; + return old; +} +/** + * Convert degrees to radians + * @param degrees - Angle in degrees + * @returns angle converted to radians + */ +function degToRad(degrees) { + return degrees * Math.PI / 180; +} +/** + * Convert radians to degrees + * @param radians - Angle in radians + * @returns angle converted to degrees + */ +function radToDeg(radians) { + return radians * 180 / Math.PI; +} +/** + * Lerps between a and b via t + * @param a - starting value + * @param b - ending value + * @param t - value where 0 = a and 1 = b + * @returns a + (b - a) * t + */ +function lerp(a, b, t) { + return a + (b - a) * t; +} +/** + * Compute the opposite of lerp. Given a and b and a value between + * a and b returns a value between 0 and 1. 0 if a, 1 if b. + * Note: no clamping is done. + * @param a - start value + * @param b - end value + * @param v - value between a and b + * @returns (v - a) / (b - a) + */ +function inverseLerp(a, b, v) { + const d = b - a; + return (Math.abs(b - a) < EPSILON) + ? a + : (v - a) / d; +} +/** + * Compute the euclidean modulo + * + * ``` + * // table for n / 3 + * -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5 <- n + * ------------------------------------ + * -2 -1 -0 -2 -1 0, 1, 2, 0, 1, 2 <- n % 3 + * 1 2 0 1 2 0, 1, 2, 0, 1, 2 <- euclideanModule(n, 3) + * ``` + * + * @param n - dividend + * @param m - divisor + * @returns the euclidean modulo of n / m + */ +function euclideanModulo(n, m) { + return ((n % m) + m) % m; +} - var utils = { - __proto__: null, - get EPSILON () { return EPSILON; }, - degToRad: degToRad, - euclideanModulo: euclideanModulo, - inverseLerp: inverseLerp, - lerp: lerp$4, - radToDeg: radToDeg, - setEpsilon: setEpsilon - }; +var utils = { + __proto__: null, + get EPSILON () { return EPSILON; }, + degToRad: degToRad, + euclideanModulo: euclideanModulo, + inverseLerp: inverseLerp, + lerp: lerp, + radToDeg: radToDeg, + setEpsilon: setEpsilon +}; - /* - * Copyright 2022 Gregg Tavares - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - /** - * - * Vec2 math functions. - * - * Almost all functions take an optional `dst` argument. If it is not passed in the - * functions will create a new Vec2. In other words you can do this - * - * const v = vec2.cross(v1, v2); // Creates a new Vec2 with the cross product of v1 x v2. - * - * or - * - * const v = vec2.create(); - * vec2.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v - * - * The first style is often easier but depending on where it's used it generates garbage where - * as there is almost never allocation with the second style. - * - * It is always safe to pass any vector as the destination. So for example - * - * vec2.cross(v1, v2, v1); // Puts the cross product of v1 x v2 in v1 - * - */ - let VecType$2 = Float32Array; - /** - * Sets the type this library creates for a Vec2 - * @param ctor - the constructor for the type. Either `Float32Array`, `Float64Array`, or `Array` - * @returns previous constructor for Vec2 - */ - function setDefaultType$6(ctor) { - const oldType = VecType$2; - VecType$2 = ctor; - return oldType; - } +/* + * Copyright 2022 Gregg Tavares + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ +/** + * Generates am typed API for Vec3 + */ +function getAPIImpl$5(Ctor) { /** * Creates a Vec2; may be called with x, y, z to set initial values. * @@ -174,135 +149,27 @@ * const v = vec2.clone(someJSArray); * ``` * - * Note: a consequence of the implementation is if your Vec2Type = `Array` - * instead of `Float32Array` or `Float64Array` then any values you - * don't pass in will be undefined. Usually this is not an issue since - * (a) using `Array` is rare and (b) using `vec2.create` is usually used - * to create a Vec2 to be filled out as in - * - * ``` - * const sum = vec2.create(); - * vec2.add(v1, v2, sum); - * ``` - * - * @param x - Initial x value. - * @param y - Initial y value. - * @returns the created vector - */ - function create$5(x = 0, y = 0) { - const dst = new VecType$2(2); - if (x !== undefined) { - dst[0] = x; - if (y !== undefined) { - dst[1] = y; - } - } - return dst; - } - - /* - * Copyright 2022 Gregg Tavares - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - /** - * - * Vec3 math functions. - * - * Almost all functions take an optional `dst` argument. If it is not passed in the - * functions will create a new `Vec3`. In other words you can do this - * - * const v = vec3.cross(v1, v2); // Creates a new Vec3 with the cross product of v1 x v2. - * - * or - * - * const v = vec3.create(); - * vec3.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v - * - * The first style is often easier but depending on where it's used it generates garbage where - * as there is almost never allocation with the second style. - * - * It is always safe to pass any vector as the destination. So for example - * - * vec3.cross(v1, v2, v1); // Puts the cross product of v1 x v2 in v1 - * - */ - let VecType$1 = Float32Array; - /** - * Sets the type this library creates for a Vec3 - * @param ctor - the constructor for the type. Either `Float32Array`, `Float64Array`, or `Array` - * @returns previous constructor for Vec3 - */ - function setDefaultType$5(ctor) { - const oldType = VecType$1; - VecType$1 = ctor; - return oldType; - } - /** - * Creates a vec3; may be called with x, y, z to set initial values. * @param x - Initial x value. * @param y - Initial y value. - * @param z - Initial z value. * @returns the created vector */ - function create$4(x, y, z) { - const dst = new VecType$1(3); + function create(x = 0, y = 0) { + const newDst = new Ctor(2); if (x !== undefined) { - dst[0] = x; + newDst[0] = x; if (y !== undefined) { - dst[1] = y; - if (z !== undefined) { - dst[2] = z; - } + newDst[1] = y; } } - return dst; + return newDst; } - - /* - * Copyright 2022 Gregg Tavares - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ /** * Creates a Vec2; may be called with x, y, z to set initial values. (same as create) * @param x - Initial x value. * @param y - Initial y value. * @returns the created vector */ - const fromValues$3 = create$5; + const fromValues = create; /** * Sets the values of a Vec2 * Also see {@link vec2.create} and {@link vec2.copy} @@ -312,11 +179,11 @@ * @param dst - vector to hold result. If not passed in a new one is created. * @returns A vector with its elements set. */ - function set$5(x, y, dst) { - dst = dst || new VecType$2(2); - dst[0] = x; - dst[1] = y; - return dst; + function set(x, y, dst) { + const newDst = (dst ?? new Ctor(2)); + newDst[0] = x; + newDst[1] = y; + return newDst; } /** * Applies Math.ceil to each element of vector @@ -324,11 +191,11 @@ * @param dst - vector to hold result. If not passed in a new one is created. * @returns A vector that is the ceil of each element of v. */ - function ceil$2(v, dst) { - dst = dst || new VecType$2(2); - dst[0] = Math.ceil(v[0]); - dst[1] = Math.ceil(v[1]); - return dst; + function ceil(v, dst) { + const newDst = (dst ?? new Ctor(2)); + newDst[0] = Math.ceil(v[0]); + newDst[1] = Math.ceil(v[1]); + return newDst; } /** * Applies Math.floor to each element of vector @@ -336,11 +203,11 @@ * @param dst - vector to hold result. If not passed in a new one is created. * @returns A vector that is the floor of each element of v. */ - function floor$2(v, dst) { - dst = dst || new VecType$2(2); - dst[0] = Math.floor(v[0]); - dst[1] = Math.floor(v[1]); - return dst; + function floor(v, dst) { + const newDst = (dst ?? new Ctor(2)); + newDst[0] = Math.floor(v[0]); + newDst[1] = Math.floor(v[1]); + return newDst; } /** * Applies Math.round to each element of vector @@ -348,11 +215,11 @@ * @param dst - vector to hold result. If not passed in a new one is created. * @returns A vector that is the round of each element of v. */ - function round$2(v, dst) { - dst = dst || new VecType$2(2); - dst[0] = Math.round(v[0]); - dst[1] = Math.round(v[1]); - return dst; + function round(v, dst) { + const newDst = (dst ?? new Ctor(2)); + newDst[0] = Math.round(v[0]); + newDst[1] = Math.round(v[1]); + return newDst; } /** * Clamp each element of vector between min and max @@ -362,11 +229,11 @@ * @param dst - vector to hold result. If not passed in a new one is created. * @returns A vector that the clamped value of each element of v. */ - function clamp$2(v, min = 0, max = 1, dst) { - dst = dst || new VecType$2(2); - dst[0] = Math.min(max, Math.max(min, v[0])); - dst[1] = Math.min(max, Math.max(min, v[1])); - return dst; + function clamp(v, min = 0, max = 1, dst) { + const newDst = (dst ?? new Ctor(2)); + newDst[0] = Math.min(max, Math.max(min, v[0])); + newDst[1] = Math.min(max, Math.max(min, v[1])); + return newDst; } /** * Adds two vectors; assumes a and b have the same dimension. @@ -375,11 +242,11 @@ * @param dst - vector to hold result. If not passed in a new one is created. * @returns A vector that is the sum of a and b. */ - function add$3(a, b, dst) { - dst = dst || new VecType$2(2); - dst[0] = a[0] + b[0]; - dst[1] = a[1] + b[1]; - return dst; + function add(a, b, dst) { + const newDst = (dst ?? new Ctor(2)); + newDst[0] = a[0] + b[0]; + newDst[1] = a[1] + b[1]; + return newDst; } /** * Adds two vectors, scaling the 2nd; assumes a and b have the same dimension. @@ -389,11 +256,11 @@ * @param dst - vector to hold result. If not passed in a new one is created. * @returns A vector that is the sum of a + b * scale. */ - function addScaled$2(a, b, scale, dst) { - dst = dst || new VecType$2(2); - dst[0] = a[0] + b[0] * scale; - dst[1] = a[1] + b[1] * scale; - return dst; + function addScaled(a, b, scale, dst) { + const newDst = (dst ?? new Ctor(2)); + newDst[0] = a[0] + b[0] * scale; + newDst[1] = a[1] + b[1] * scale; + return newDst; } /** * Returns the angle in radians between two vectors. @@ -401,7 +268,7 @@ * @param b - Operand vector. * @returns The angle in radians between the 2 vectors. */ - function angle$2(a, b) { + function angle(a, b) { const ax = a[0]; const ay = a[1]; const bx = b[0]; @@ -409,7 +276,7 @@ const mag1 = Math.sqrt(ax * ax + ay * ay); const mag2 = Math.sqrt(bx * bx + by * by); const mag = mag1 * mag2; - const cosine = mag && dot$3(a, b) / mag; + const cosine = mag && dot(a, b) / mag; return Math.acos(cosine); } /** @@ -419,11 +286,11 @@ * @param dst - vector to hold result. If not passed in a new one is created. * @returns A vector that is the difference of a and b. */ - function subtract$3(a, b, dst) { - dst = dst || new VecType$2(2); - dst[0] = a[0] - b[0]; - dst[1] = a[1] - b[1]; - return dst; + function subtract(a, b, dst) { + const newDst = (dst ?? new Ctor(2)); + newDst[0] = a[0] - b[0]; + newDst[1] = a[1] - b[1]; + return newDst; } /** * Subtracts two vectors. @@ -432,14 +299,14 @@ * @param dst - vector to hold result. If not passed in a new one is created. * @returns A vector that is the difference of a and b. */ - const sub$3 = subtract$3; + const sub = subtract; /** * Check if 2 vectors are approximately equal * @param a - Operand vector. * @param b - Operand vector. * @returns true if vectors are approximately equal */ - function equalsApproximately$5(a, b) { + function equalsApproximately(a, b) { return Math.abs(a[0] - b[0]) < EPSILON && Math.abs(a[1] - b[1]) < EPSILON; } @@ -449,7 +316,7 @@ * @param b - Operand vector. * @returns true if vectors are exactly equal */ - function equals$5(a, b) { + function equals(a, b) { return a[0] === b[0] && a[1] === b[1]; } /** @@ -462,11 +329,11 @@ * @param dst - vector to hold result. If not passed in a new one is created. * @returns The linear interpolated result. */ - function lerp$3(a, b, t, dst) { - dst = dst || new VecType$2(2); - dst[0] = a[0] + t * (b[0] - a[0]); - dst[1] = a[1] + t * (b[1] - a[1]); - return dst; + function lerp(a, b, t, dst) { + const newDst = (dst ?? new Ctor(2)); + newDst[0] = a[0] + t * (b[0] - a[0]); + newDst[1] = a[1] + t * (b[1] - a[1]); + return newDst; } /** * Performs linear interpolation on two vectors. @@ -478,11 +345,11 @@ * @param dst - vector to hold result. If not passed in a new one is created. * @returns the linear interpolated result. */ - function lerpV$2(a, b, t, dst) { - dst = dst || new VecType$2(2); - dst[0] = a[0] + t[0] * (b[0] - a[0]); - dst[1] = a[1] + t[1] * (b[1] - a[1]); - return dst; + function lerpV(a, b, t, dst) { + const newDst = (dst ?? new Ctor(2)); + newDst[0] = a[0] + t[0] * (b[0] - a[0]); + newDst[1] = a[1] + t[1] * (b[1] - a[1]); + return newDst; } /** * Return max values of two vectors. @@ -493,11 +360,11 @@ * @param dst - vector to hold result. If not passed in a new one is created. * @returns The max components vector. */ - function max$2(a, b, dst) { - dst = dst || new VecType$2(2); - dst[0] = Math.max(a[0], b[0]); - dst[1] = Math.max(a[1], b[1]); - return dst; + function max(a, b, dst) { + const newDst = (dst ?? new Ctor(2)); + newDst[0] = Math.max(a[0], b[0]); + newDst[1] = Math.max(a[1], b[1]); + return newDst; } /** * Return min values of two vectors. @@ -508,11 +375,11 @@ * @param dst - vector to hold result. If not passed in a new one is created. * @returns The min components vector. */ - function min$2(a, b, dst) { - dst = dst || new VecType$2(2); - dst[0] = Math.min(a[0], b[0]); - dst[1] = Math.min(a[1], b[1]); - return dst; + function min(a, b, dst) { + const newDst = (dst ?? new Ctor(2)); + newDst[0] = Math.min(a[0], b[0]); + newDst[1] = Math.min(a[1], b[1]); + return newDst; } /** * Multiplies a vector by a scalar. @@ -521,11 +388,11 @@ * @param dst - vector to hold result. If not passed in a new one is created. * @returns The scaled vector. */ - function mulScalar$3(v, k, dst) { - dst = dst || new VecType$2(2); - dst[0] = v[0] * k; - dst[1] = v[1] * k; - return dst; + function mulScalar(v, k, dst) { + const newDst = (dst ?? new Ctor(2)); + newDst[0] = v[0] * k; + newDst[1] = v[1] * k; + return newDst; } /** * Multiplies a vector by a scalar. (same as mulScalar) @@ -534,7 +401,7 @@ * @param dst - vector to hold result. If not passed in a new one is created. * @returns The scaled vector. */ - const scale$5 = mulScalar$3; + const scale = mulScalar; /** * Divides a vector by a scalar. * @param v - The vector. @@ -542,11 +409,11 @@ * @param dst - vector to hold result. If not passed in a new one is created. * @returns The scaled vector. */ - function divScalar$3(v, k, dst) { - dst = dst || new VecType$2(2); - dst[0] = v[0] / k; - dst[1] = v[1] / k; - return dst; + function divScalar(v, k, dst) { + const newDst = (dst ?? new Ctor(2)); + newDst[0] = v[0] / k; + newDst[1] = v[1] / k; + return newDst; } /** * Inverse a vector. @@ -554,11 +421,11 @@ * @param dst - vector to hold result. If not passed in a new one is created. * @returns The inverted vector. */ - function inverse$5(v, dst) { - dst = dst || new VecType$2(2); - dst[0] = 1 / v[0]; - dst[1] = 1 / v[1]; - return dst; + function inverse(v, dst) { + const newDst = (dst ?? new Ctor(2)); + newDst[0] = 1 / v[0]; + newDst[1] = 1 / v[1]; + return newDst; } /** * Invert a vector. (same as inverse) @@ -566,7 +433,7 @@ * @param dst - vector to hold result. If not passed in a new one is created. * @returns The inverted vector. */ - const invert$4 = inverse$5; + const invert = inverse; /** * Computes the cross product of two vectors; assumes both vectors have * three entries. @@ -575,13 +442,13 @@ * @param dst - vector to hold result. If not passed in a new one is created. * @returns The vector of a cross b. */ - function cross$1(a, b, dst) { - dst = dst || new VecType$1(3); + function cross(a, b, dst) { + const newDst = (dst ?? new Ctor(3)); const z = a[0] * b[1] - a[1] * b[0]; - dst[0] = 0; - dst[1] = 0; - dst[2] = z; - return dst; + newDst[0] = 0; + newDst[1] = 0; + newDst[2] = z; + return newDst; } /** * Computes the dot product of two vectors; assumes both vectors have @@ -590,7 +457,7 @@ * @param b - Operand vector. * @returns dot product */ - function dot$3(a, b) { + function dot(a, b) { return a[0] * b[0] + a[1] * b[1]; } /** @@ -598,7 +465,7 @@ * @param v - vector. * @returns length of vector. */ - function length$3(v) { + function length(v) { const v0 = v[0]; const v1 = v[1]; return Math.sqrt(v0 * v0 + v1 * v1); @@ -608,13 +475,13 @@ * @param v - vector. * @returns length of vector. */ - const len$3 = length$3; + const len = length; /** * Computes the square of the length of vector * @param v - vector. * @returns square of the length of vector. */ - function lengthSq$3(v) { + function lengthSq(v) { const v0 = v[0]; const v1 = v[1]; return v0 * v0 + v1 * v1; @@ -624,14 +491,14 @@ * @param v - vector. * @returns square of the length of vector. */ - const lenSq$3 = lengthSq$3; + const lenSq = lengthSq; /** * Computes the distance between 2 points * @param a - vector. * @param b - vector. * @returns distance between a and b */ - function distance$2(a, b) { + function distance(a, b) { const dx = a[0] - b[0]; const dy = a[1] - b[1]; return Math.sqrt(dx * dx + dy * dy); @@ -642,14 +509,14 @@ * @param b - vector. * @returns distance between a and b */ - const dist$2 = distance$2; + const dist = distance; /** * Computes the square of the distance between 2 points * @param a - vector. * @param b - vector. * @returns square of the distance between a and b */ - function distanceSq$2(a, b) { + function distanceSq(a, b) { const dx = a[0] - b[0]; const dy = a[1] - b[1]; return dx * dx + dy * dy; @@ -660,27 +527,27 @@ * @param b - vector. * @returns square of the distance between a and b */ - const distSq$2 = distanceSq$2; + const distSq = distanceSq; /** * Divides a vector by its Euclidean length and returns the quotient. * @param v - The vector. * @param dst - vector to hold result. If not passed in a new one is created. * @returns The normalized vector. */ - function normalize$3(v, dst) { - dst = dst || new VecType$2(2); + function normalize(v, dst) { + const newDst = (dst ?? new Ctor(2)); const v0 = v[0]; const v1 = v[1]; const len = Math.sqrt(v0 * v0 + v1 * v1); if (len > 0.00001) { - dst[0] = v0 / len; - dst[1] = v1 / len; + newDst[0] = v0 / len; + newDst[1] = v1 / len; } else { - dst[0] = 0; - dst[1] = 0; + newDst[0] = 0; + newDst[1] = 0; } - return dst; + return newDst; } /** * Negates a vector. @@ -688,11 +555,11 @@ * @param dst - vector to hold result. If not passed in a new one is created. * @returns -v. */ - function negate$4(v, dst) { - dst = dst || new VecType$2(2); - dst[0] = -v[0]; - dst[1] = -v[1]; - return dst; + function negate(v, dst) { + const newDst = (dst ?? new Ctor(2)); + newDst[0] = -v[0]; + newDst[1] = -v[1]; + return newDst; } /** * Copies a vector. (same as {@link vec2.clone}) @@ -701,11 +568,11 @@ * @param dst - vector to hold result. If not passed in a new one is created. * @returns A copy of v. */ - function copy$5(v, dst) { - dst = dst || new VecType$2(2); - dst[0] = v[0]; - dst[1] = v[1]; - return dst; + function copy(v, dst) { + const newDst = (dst ?? new Ctor(2)); + newDst[0] = v[0]; + newDst[1] = v[1]; + return newDst; } /** * Clones a vector. (same as {@link vec2.copy}) @@ -714,7 +581,7 @@ * @param dst - vector to hold result. If not passed in a new one is created. * @returns A copy of v. */ - const clone$5 = copy$5; + const clone = copy; /** * Multiplies a vector by another vector (component-wise); assumes a and * b have the same length. @@ -723,11 +590,11 @@ * @param dst - vector to hold result. If not passed in a new one is created. * @returns The vector of products of entries of a and b. */ - function multiply$5(a, b, dst) { - dst = dst || new VecType$2(2); - dst[0] = a[0] * b[0]; - dst[1] = a[1] * b[1]; - return dst; + function multiply(a, b, dst) { + const newDst = (dst ?? new Ctor(2)); + newDst[0] = a[0] * b[0]; + newDst[1] = a[1] * b[1]; + return newDst; } /** * Multiplies a vector by another vector (component-wise); assumes a and @@ -737,7 +604,7 @@ * @param dst - vector to hold result. If not passed in a new one is created. * @returns The vector of products of entries of a and b. */ - const mul$5 = multiply$5; + const mul = multiply; /** * Divides a vector by another vector (component-wise); assumes a and * b have the same length. @@ -746,11 +613,11 @@ * @param dst - vector to hold result. If not passed in a new one is created. * @returns The vector of quotients of entries of a and b. */ - function divide$2(a, b, dst) { - dst = dst || new VecType$2(2); - dst[0] = a[0] / b[0]; - dst[1] = a[1] / b[1]; - return dst; + function divide(a, b, dst) { + const newDst = (dst ?? new Ctor(2)); + newDst[0] = a[0] / b[0]; + newDst[1] = a[1] / b[1]; + return newDst; } /** * Divides a vector by another vector (component-wise); assumes a and @@ -760,30 +627,30 @@ * @param dst - vector to hold result. If not passed in a new one is created. * @returns The vector of quotients of entries of a and b. */ - const div$2 = divide$2; + const div = divide; /** * Creates a random unit vector * scale * @param scale - Default 1 * @param dst - vector to hold result. If not passed in a new one is created. * @returns The random vector. */ - function random$1(scale = 1, dst) { - dst = dst || new VecType$2(2); + function random(scale = 1, dst) { + const newDst = (dst ?? new Ctor(2)); const angle = Math.random() * 2 * Math.PI; - dst[0] = Math.cos(angle) * scale; - dst[1] = Math.sin(angle) * scale; - return dst; + newDst[0] = Math.cos(angle) * scale; + newDst[1] = Math.sin(angle) * scale; + return newDst; } /** * Zero's a vector * @param dst - vector to hold result. If not passed in a new one is created. * @returns The zeroed vector. */ - function zero$2(dst) { - dst = dst || new VecType$2(2); - dst[0] = 0; - dst[1] = 0; - return dst; + function zero(dst) { + const newDst = (dst ?? new Ctor(2)); + newDst[0] = 0; + newDst[1] = 0; + return newDst; } /** * transform Vec2 by 4x4 matrix @@ -792,13 +659,13 @@ * @param dst - optional Vec2 to store result. If not passed a new one is created. * @returns the transformed vector */ - function transformMat4$2(v, m, dst) { - dst = dst || new VecType$2(2); + function transformMat4(v, m, dst) { + const newDst = (dst ?? new Ctor(2)); const x = v[0]; const y = v[1]; - dst[0] = x * m[0] + y * m[4] + m[12]; - dst[1] = x * m[1] + y * m[5] + m[13]; - return dst; + newDst[0] = x * m[0] + y * m[4] + m[12]; + newDst[1] = x * m[1] + y * m[5] + m[13]; + return newDst; } /** * Transforms vec4 by 3x3 matrix @@ -808,13 +675,13 @@ * @param dst - optional Vec2 to store result. If not passed a new one is created. * @returns the transformed vector */ - function transformMat3$1(v, m, dst) { - dst = dst || new VecType$2(2); + function transformMat3(v, m, dst) { + const newDst = (dst ?? new Ctor(2)); const x = v[0]; const y = v[1]; - dst[0] = m[0] * x + m[4] * y + m[8]; - dst[1] = m[1] * x + m[5] * y + m[9]; - return dst; + newDst[0] = m[0] * x + m[4] * y + m[8]; + newDst[1] = m[1] * x + m[5] * y + m[9]; + return newDst; } /** * Rotate a 2D vector @@ -824,17 +691,17 @@ * @param rad The angle of rotation in radians * @returns the rotated vector */ - function rotate$2(a, b, rad, dst) { - dst = dst || new VecType$2(2); + function rotate(a, b, rad, dst) { + const newDst = (dst ?? new Ctor(2)); // Translate point to the origin const p0 = a[0] - b[0]; const p1 = a[1] - b[1]; const sinC = Math.sin(rad); const cosC = Math.cos(rad); //perform rotation and translate to correct position - dst[0] = p0 * cosC - p1 * sinC + b[0]; - dst[1] = p0 * sinC + p1 * cosC + b[1]; - return dst; + newDst[0] = p0 * cosC - p1 * sinC + b[0]; + newDst[1] = p0 * sinC + p1 * cosC + b[1]; + return newDst; } /** * Treat a 2D vector as a direction and set it's length @@ -843,10 +710,10 @@ * @param len The length of the resulting vector * @returns The lengthened vector */ - function setLength$2(a, len, dst) { - dst = dst || new VecType$2(2); - normalize$3(a, dst); - return mulScalar$3(dst, len, dst); + function setLength(a, len, dst) { + const newDst = (dst ?? new Ctor(2)); + normalize(a, newDst); + return mulScalar(newDst, len, newDst); } /** * Ensure a vector is not longer than a max length @@ -855,12 +722,12 @@ * @param maxLen The longest length of the resulting vector * @returns The vector, shortened to maxLen if it's too long */ - function truncate$2(a, maxLen, dst) { - dst = dst || new VecType$2(2); - if (length$3(a) > maxLen) { - return setLength$2(a, maxLen, dst); + function truncate(a, maxLen, dst) { + const newDst = (dst ?? new Ctor(2)); + if (length(a) > maxLen) { + return setLength(a, maxLen, newDst); } - return copy$5(a, dst); + return copy(a, newDst); } /** * Return the vector exactly between 2 endpoint vectors @@ -869,130 +736,98 @@ * @param b Endpoint 2 * @returns The vector exactly residing between endpoints 1 and 2 */ - function midpoint$2(a, b, dst) { - dst = dst || new VecType$2(2); - return lerp$3(a, b, 0.5, dst); - } - - var vec2Impl = { - __proto__: null, - add: add$3, - addScaled: addScaled$2, - angle: angle$2, - ceil: ceil$2, - clamp: clamp$2, - clone: clone$5, - copy: copy$5, - create: create$5, - cross: cross$1, - dist: dist$2, - distSq: distSq$2, - distance: distance$2, - distanceSq: distanceSq$2, - div: div$2, - divScalar: divScalar$3, - divide: divide$2, - dot: dot$3, - equals: equals$5, - equalsApproximately: equalsApproximately$5, - floor: floor$2, - fromValues: fromValues$3, - inverse: inverse$5, - invert: invert$4, - len: len$3, - lenSq: lenSq$3, - length: length$3, - lengthSq: lengthSq$3, - lerp: lerp$3, - lerpV: lerpV$2, - max: max$2, - midpoint: midpoint$2, - min: min$2, - mul: mul$5, - mulScalar: mulScalar$3, - multiply: multiply$5, - negate: negate$4, - normalize: normalize$3, - random: random$1, - rotate: rotate$2, - round: round$2, - scale: scale$5, - set: set$5, - setDefaultType: setDefaultType$6, - setLength: setLength$2, - sub: sub$3, - subtract: subtract$3, - transformMat3: transformMat3$1, - transformMat4: transformMat4$2, - truncate: truncate$2, - zero: zero$2 + function midpoint(a, b, dst) { + const newDst = (dst ?? new Ctor(2)); + return lerp(a, b, 0.5, newDst); + } + return { + create, + fromValues, + set, + ceil, + floor, + round, + clamp, + add, + addScaled, + angle, + subtract, + sub, + equalsApproximately, + equals, + lerp, + lerpV, + max, + min, + mulScalar, + scale, + divScalar, + inverse, + invert, + cross, + dot, + length, + len, + lengthSq, + lenSq, + distance, + dist, + distanceSq, + distSq, + normalize, + negate, + copy, + clone, + multiply, + mul, + divide, + div, + random, + zero, + transformMat4, + transformMat3, + rotate, + setLength, + truncate, + midpoint, }; +} +const cache$5 = new Map(); +function getAPI$5(Ctor) { + let api = cache$5.get(Ctor); + if (!api) { + api = getAPIImpl$5(Ctor); + cache$5.set(Ctor, api); + } + return api; +} - /* - * Copyright 2022 Gregg Tavares - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - /** - * 3x3 Matrix math math functions. - * - * Almost all functions take an optional `dst` argument. If it is not passed in the - * functions will create a new matrix. In other words you can do this - * - * const mat = mat3.translation([1, 2, 3]); // Creates a new translation matrix - * - * or - * - * const mat = mat3.create(); - * mat3.translation([1, 2, 3], mat); // Puts translation matrix in mat. - * - * The first style is often easier but depending on where it's used it generates garbage where - * as there is almost never allocation with the second style. - * - * It is always save to pass any matrix as the destination. So for example - * - * const mat = mat3.identity(); - * const trans = mat3.translation([1, 2, 3]); - * mat3.multiply(mat, trans, mat); // Multiplies mat * trans and puts result in mat. - * - */ - let MatType$1 = Float32Array; - // This mess is because with Mat3 we have 3 unused elements. - // For Float32Array and Float64Array that's not an issue - // but for Array it's troublesome - const ctorMap = new Map([ - [Float32Array, () => new Float32Array(12)], - [Float64Array, () => new Float64Array(12)], - [Array, () => new Array(12).fill(0)], - ]); - let newMat3 = ctorMap.get(Float32Array); - /** - * Sets the type this library creates for a Mat3 - * @param ctor - the constructor for the type. Either `Float32Array`, `Float64Array`, or `Array` - * @returns previous constructor for Mat3 - */ - function setDefaultType$4(ctor) { - const oldType = MatType$1; - MatType$1 = ctor; - newMat3 = ctorMap.get(ctor); - return oldType; - } +/* + * Copyright 2022 Gregg Tavares + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ +/** + * Generates a typed API for Mat3 + * */ +function getAPIImpl$4(Ctor) { + const vec2 = getAPI$5(Ctor); /** * Create a Mat3 from values * @@ -1005,17 +840,6 @@ * const m = mat3.clone(someJSArray); * ``` * - * Note: a consequence of the implementation is if your Mat3Type = `Array` - * instead of `Float32Array` or `Float64Array` then any values you - * don't pass in will be undefined. Usually this is not an issue since - * (a) using `Array` is rare and (b) using `mat3.create` is usually used - * to create a Mat3 to be filled out as in - * - * ``` - * const m = mat3.create(); - * mat3.perspective(fov, aspect, near, far, m); - * ``` - * * @param v0 - value for element 0 * @param v1 - value for element 1 * @param v2 - value for element 2 @@ -1027,30 +851,30 @@ * @param v8 - value for element 8 * @returns matrix created from values. */ - function create$3(v0, v1, v2, v3, v4, v5, v6, v7, v8) { - const dst = newMat3(); + function create(v0, v1, v2, v3, v4, v5, v6, v7, v8) { + const newDst = new Ctor(12); // to make the array homogenous - dst[3] = 0; - dst[7] = 0; - dst[11] = 0; + newDst[3] = 0; + newDst[7] = 0; + newDst[11] = 0; if (v0 !== undefined) { - dst[0] = v0; + newDst[0] = v0; if (v1 !== undefined) { - dst[1] = v1; + newDst[1] = v1; if (v2 !== undefined) { - dst[2] = v2; + newDst[2] = v2; if (v3 !== undefined) { - dst[4] = v3; + newDst[4] = v3; if (v4 !== undefined) { - dst[5] = v4; + newDst[5] = v4; if (v5 !== undefined) { - dst[6] = v5; + newDst[6] = v5; if (v6 !== undefined) { - dst[8] = v6; + newDst[8] = v6; if (v7 !== undefined) { - dst[9] = v7; + newDst[9] = v7; if (v8 !== undefined) { - dst[10] = v8; + newDst[10] = v8; } } } @@ -1060,7 +884,7 @@ } } } - return dst; + return newDst; } /** * Sets the values of a Mat3 @@ -1078,21 +902,21 @@ * @param dst - matrix to hold result. If not passed a new one is created. * @returns Mat3 set from values. */ - function set$4(v0, v1, v2, v3, v4, v5, v6, v7, v8, dst) { - dst = dst || newMat3(); - dst[0] = v0; - dst[1] = v1; - dst[2] = v2; - dst[3] = 0; - dst[4] = v3; - dst[5] = v4; - dst[6] = v5; - dst[7] = 0; - dst[8] = v6; - dst[9] = v7; - dst[10] = v8; - dst[11] = 0; - return dst; + function set(v0, v1, v2, v3, v4, v5, v6, v7, v8, dst) { + const newDst = (dst ?? new Ctor(12)); + newDst[0] = v0; + newDst[1] = v1; + newDst[2] = v2; + newDst[3] = 0; + newDst[4] = v3; + newDst[5] = v4; + newDst[6] = v5; + newDst[7] = 0; + newDst[8] = v6; + newDst[9] = v7; + newDst[10] = v8; + newDst[11] = 0; + return newDst; } /** * Creates a Mat3 from the upper left 3x3 part of a Mat4 @@ -1101,20 +925,20 @@ * @returns Mat3 made from m4 */ function fromMat4(m4, dst) { - dst = dst || newMat3(); - dst[0] = m4[0]; - dst[1] = m4[1]; - dst[2] = m4[2]; - dst[3] = 0; - dst[4] = m4[4]; - dst[5] = m4[5]; - dst[6] = m4[6]; - dst[7] = 0; - dst[8] = m4[8]; - dst[9] = m4[9]; - dst[10] = m4[10]; - dst[11] = 0; - return dst; + const newDst = (dst ?? new Ctor(12)); + newDst[0] = m4[0]; + newDst[1] = m4[1]; + newDst[2] = m4[2]; + newDst[3] = 0; + newDst[4] = m4[4]; + newDst[5] = m4[5]; + newDst[6] = m4[6]; + newDst[7] = 0; + newDst[8] = m4[8]; + newDst[9] = m4[9]; + newDst[10] = m4[10]; + newDst[11] = 0; + return newDst; } /** * Creates a Mat3 rotation matrix from a quaternion @@ -1122,8 +946,8 @@ * @param dst - matrix to hold result. If not passed a new one is created. * @returns Mat3 made from q */ - function fromQuat$1(q, dst) { - dst = dst || newMat3(); + function fromQuat(q, dst) { + const newDst = (dst ?? new Ctor(12)); const x = q[0]; const y = q[1]; const z = q[2]; @@ -1140,19 +964,19 @@ const wx = w * x2; const wy = w * y2; const wz = w * z2; - dst[0] = 1 - yy - zz; - dst[1] = yx + wz; - dst[2] = zx - wy; - dst[3] = 0; - dst[4] = yx - wz; - dst[5] = 1 - xx - zz; - dst[6] = zy + wx; - dst[7] = 0; - dst[8] = zx + wy; - dst[9] = zy - wx; - dst[10] = 1 - xx - yy; - dst[11] = 0; - return dst; + newDst[0] = 1 - yy - zz; + newDst[1] = yx + wz; + newDst[2] = zx - wy; + newDst[3] = 0; + newDst[4] = yx - wz; + newDst[5] = 1 - xx - zz; + newDst[6] = zy + wx; + newDst[7] = 0; + newDst[8] = zx + wy; + newDst[9] = zy - wx; + newDst[10] = 1 - xx - yy; + newDst[11] = 0; + return newDst; } /** * Negates a matrix. @@ -1160,18 +984,18 @@ * @param dst - matrix to hold result. If not passed a new one is created. * @returns -m. */ - function negate$3(m, dst) { - dst = dst || newMat3(); - dst[0] = -m[0]; - dst[1] = -m[1]; - dst[2] = -m[2]; - dst[4] = -m[4]; - dst[5] = -m[5]; - dst[6] = -m[6]; - dst[8] = -m[8]; - dst[9] = -m[9]; - dst[10] = -m[10]; - return dst; + function negate(m, dst) { + const newDst = (dst ?? new Ctor(12)); + newDst[0] = -m[0]; + newDst[1] = -m[1]; + newDst[2] = -m[2]; + newDst[4] = -m[4]; + newDst[5] = -m[5]; + newDst[6] = -m[6]; + newDst[8] = -m[8]; + newDst[9] = -m[9]; + newDst[10] = -m[10]; + return newDst; } /** * Copies a matrix. (same as {@link mat3.clone}) @@ -1180,18 +1004,18 @@ * @param dst - The matrix. If not passed a new one is created. * @returns A copy of m. */ - function copy$4(m, dst) { - dst = dst || newMat3(); - dst[0] = m[0]; - dst[1] = m[1]; - dst[2] = m[2]; - dst[4] = m[4]; - dst[5] = m[5]; - dst[6] = m[6]; - dst[8] = m[8]; - dst[9] = m[9]; - dst[10] = m[10]; - return dst; + function copy(m, dst) { + const newDst = (dst ?? new Ctor(12)); + newDst[0] = m[0]; + newDst[1] = m[1]; + newDst[2] = m[2]; + newDst[4] = m[4]; + newDst[5] = m[5]; + newDst[6] = m[6]; + newDst[8] = m[8]; + newDst[9] = m[9]; + newDst[10] = m[10]; + return newDst; } /** * Copies a matrix (same as {@link mat3.copy}) @@ -1200,14 +1024,14 @@ * @param dst - The matrix. If not passed a new one is created. * @returns A copy of m. */ - const clone$4 = copy$4; + const clone = copy; /** * Check if 2 matrices are approximately equal * @param a Operand matrix. * @param b Operand matrix. * @returns true if matrices are approximately equal */ - function equalsApproximately$4(a, b) { + function equalsApproximately(a, b) { return Math.abs(a[0] - b[0]) < EPSILON && Math.abs(a[1] - b[1]) < EPSILON && Math.abs(a[2] - b[2]) < EPSILON && @@ -1224,7 +1048,7 @@ * @param b Operand matrix. * @returns true if matrices are exactly equal */ - function equals$4(a, b) { + function equals(a, b) { return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && @@ -1241,18 +1065,18 @@ * @param dst - matrix to hold result. If not passed a new one is created. * @returns A 3-by-3 identity matrix. */ - function identity$2(dst) { - dst = dst || newMat3(); - dst[0] = 1; - dst[1] = 0; - dst[2] = 0; - dst[4] = 0; - dst[5] = 1; - dst[6] = 0; - dst[8] = 0; - dst[9] = 0; - dst[10] = 1; - return dst; + function identity(dst) { + const newDst = (dst ?? new Ctor(12)); + newDst[0] = 1; + newDst[1] = 0; + newDst[2] = 0; + newDst[4] = 0; + newDst[5] = 1; + newDst[6] = 0; + newDst[8] = 0; + newDst[9] = 0; + newDst[10] = 1; + return newDst; } /** * Takes the transpose of a matrix. @@ -1260,9 +1084,9 @@ * @param dst - matrix to hold result. If not passed a new one is created. * @returns The transpose of m. */ - function transpose$1(m, dst) { - dst = dst || newMat3(); - if (dst === m) { + function transpose(m, dst) { + const newDst = (dst ?? new Ctor(12)); + if (newDst === m) { let t; // 0 1 2 // 4 5 6 @@ -1276,7 +1100,7 @@ t = m[6]; m[6] = m[9]; m[9] = t; - return dst; + return newDst; } const m00 = m[0 * 4 + 0]; const m01 = m[0 * 4 + 1]; @@ -1287,16 +1111,16 @@ const m20 = m[2 * 4 + 0]; const m21 = m[2 * 4 + 1]; const m22 = m[2 * 4 + 2]; - dst[0] = m00; - dst[1] = m10; - dst[2] = m20; - dst[4] = m01; - dst[5] = m11; - dst[6] = m21; - dst[8] = m02; - dst[9] = m12; - dst[10] = m22; - return dst; + newDst[0] = m00; + newDst[1] = m10; + newDst[2] = m20; + newDst[4] = m01; + newDst[5] = m11; + newDst[6] = m21; + newDst[8] = m02; + newDst[9] = m12; + newDst[10] = m22; + return newDst; } /** * Computes the inverse of a 3-by-3 matrix. @@ -1304,8 +1128,8 @@ * @param dst - matrix to hold result. If not passed a new one is created. * @returns The inverse of m. */ - function inverse$4(m, dst) { - dst = dst || newMat3(); + function inverse(m, dst) { + const newDst = (dst ?? new Ctor(12)); const m00 = m[0 * 4 + 0]; const m01 = m[0 * 4 + 1]; const m02 = m[0 * 4 + 2]; @@ -1319,23 +1143,23 @@ const b11 = -m22 * m10 + m12 * m20; const b21 = m21 * m10 - m11 * m20; const invDet = 1 / (m00 * b01 + m01 * b11 + m02 * b21); - dst[0] = b01 * invDet; - dst[1] = (-m22 * m01 + m02 * m21) * invDet; - dst[2] = (m12 * m01 - m02 * m11) * invDet; - dst[4] = b11 * invDet; - dst[5] = (m22 * m00 - m02 * m20) * invDet; - dst[6] = (-m12 * m00 + m02 * m10) * invDet; - dst[8] = b21 * invDet; - dst[9] = (-m21 * m00 + m01 * m20) * invDet; - dst[10] = (m11 * m00 - m01 * m10) * invDet; - return dst; + newDst[0] = b01 * invDet; + newDst[1] = (-m22 * m01 + m02 * m21) * invDet; + newDst[2] = (m12 * m01 - m02 * m11) * invDet; + newDst[4] = b11 * invDet; + newDst[5] = (m22 * m00 - m02 * m20) * invDet; + newDst[6] = (-m12 * m00 + m02 * m10) * invDet; + newDst[8] = b21 * invDet; + newDst[9] = (-m21 * m00 + m01 * m20) * invDet; + newDst[10] = (m11 * m00 - m01 * m10) * invDet; + return newDst; } /** * Compute the determinant of a matrix * @param m - the matrix * @returns the determinant */ - function determinant$1(m) { + function determinant(m) { const m00 = m[0 * 4 + 0]; const m01 = m[0 * 4 + 1]; const m02 = m[0 * 4 + 2]; @@ -1355,7 +1179,7 @@ * @param dst - matrix to hold result. If not passed a new one is created. * @returns The inverse of m. */ - const invert$3 = inverse$4; + const invert = inverse; /** * Multiplies two 3-by-3 matrices with a on the left and b on the right * @param a - The matrix on the left. @@ -1363,8 +1187,8 @@ * @param dst - matrix to hold result. If not passed a new one is created. * @returns The matrix product of a and b. */ - function multiply$4(a, b, dst) { - dst = dst || newMat3(); + function multiply(a, b, dst) { + const newDst = (dst ?? new Ctor(12)); const a00 = a[0]; const a01 = a[1]; const a02 = a[2]; @@ -1383,16 +1207,16 @@ const b20 = b[8 + 0]; const b21 = b[8 + 1]; const b22 = b[8 + 2]; - dst[0] = a00 * b00 + a10 * b01 + a20 * b02; - dst[1] = a01 * b00 + a11 * b01 + a21 * b02; - dst[2] = a02 * b00 + a12 * b01 + a22 * b02; - dst[4] = a00 * b10 + a10 * b11 + a20 * b12; - dst[5] = a01 * b10 + a11 * b11 + a21 * b12; - dst[6] = a02 * b10 + a12 * b11 + a22 * b12; - dst[8] = a00 * b20 + a10 * b21 + a20 * b22; - dst[9] = a01 * b20 + a11 * b21 + a21 * b22; - dst[10] = a02 * b20 + a12 * b21 + a22 * b22; - return dst; + newDst[0] = a00 * b00 + a10 * b01 + a20 * b02; + newDst[1] = a01 * b00 + a11 * b01 + a21 * b02; + newDst[2] = a02 * b00 + a12 * b01 + a22 * b02; + newDst[4] = a00 * b10 + a10 * b11 + a20 * b12; + newDst[5] = a01 * b10 + a11 * b11 + a21 * b12; + newDst[6] = a02 * b10 + a12 * b11 + a22 * b12; + newDst[8] = a00 * b20 + a10 * b21 + a20 * b22; + newDst[9] = a01 * b20 + a11 * b21 + a21 * b22; + newDst[10] = a02 * b20 + a12 * b21 + a22 * b22; + return newDst; } /** * Multiplies two 3-by-3 matrices with a on the left and b on the right (same as multiply) @@ -1401,7 +1225,7 @@ * @param dst - matrix to hold result. If not passed a new one is created. * @returns The matrix product of a and b. */ - const mul$4 = multiply$4; + const mul = multiply; /** * Sets the translation component of a 3-by-3 matrix to the given * vector. @@ -1410,20 +1234,20 @@ * @param dst - matrix to hold result. If not passed a new one is created. * @returns The matrix with translation set. */ - function setTranslation$1(a, v, dst) { - dst = dst || identity$2(); - if (a !== dst) { - dst[0] = a[0]; - dst[1] = a[1]; - dst[2] = a[2]; - dst[4] = a[4]; - dst[5] = a[5]; - dst[6] = a[6]; + function setTranslation(a, v, dst) { + const newDst = (dst ?? identity()); + if (a !== newDst) { + newDst[0] = a[0]; + newDst[1] = a[1]; + newDst[2] = a[2]; + newDst[4] = a[4]; + newDst[5] = a[5]; + newDst[6] = a[6]; } - dst[8] = v[0]; - dst[9] = v[1]; - dst[10] = 1; - return dst; + newDst[8] = v[0]; + newDst[9] = v[1]; + newDst[10] = 1; + return newDst; } /** * Returns the translation component of a 3-by-3 matrix as a vector with 3 @@ -1432,11 +1256,11 @@ * @param dst - vector to hold result. If not passed a new one is created. * @returns The translation component of m. */ - function getTranslation$2(m, dst) { - dst = dst || create$5(); - dst[0] = m[8]; - dst[1] = m[9]; - return dst; + function getTranslation(m, dst) { + const newDst = (dst ?? vec2.create()); + newDst[0] = m[8]; + newDst[1] = m[9]; + return newDst; } /** * Returns an axis of a 3x3 matrix as a vector with 2 entries @@ -1444,12 +1268,12 @@ * @param axis - The axis 0 = x, 1 = y, * @returns The axis component of m. */ - function getAxis$2(m, axis, dst) { - dst = dst || create$5(); + function getAxis(m, axis, dst) { + const newDst = (dst ?? vec2.create()); const off = axis * 4; - dst[0] = m[off + 0]; - dst[1] = m[off + 1]; - return dst; + newDst[0] = m[off + 0]; + newDst[1] = m[off + 1]; + return newDst; } /** * Sets an axis of a 3x3 matrix as a vector with 2 entries @@ -1459,29 +1283,27 @@ * @param dst - The matrix to set. If not passed a new one is created. * @returns The matrix with axis set. */ - function setAxis$1(m, v, axis, dst) { - if (dst !== m) { - dst = copy$4(m, dst); - } + function setAxis(m, v, axis, dst) { + const newDst = (dst === m ? m : copy(m, dst)); const off = axis * 4; - dst[off + 0] = v[0]; - dst[off + 1] = v[1]; - return dst; - } - /** - * Returns the scaling component of the matrix - * @param m - The Matrix - * @param dst - The vector to set. If not passed a new one is created. - */ - function getScaling$2(m, dst) { - dst = dst || create$5(); + newDst[off + 0] = v[0]; + newDst[off + 1] = v[1]; + return newDst; + } + ///** + // * Returns the scaling component of the matrix + // * @param m - The Matrix + // * @param dst - The vector to set. If not passed a new one is created. + // */ + function getScaling(m, dst) { + const newDst = (dst ?? vec2.create()); const xx = m[0]; const xy = m[1]; const yx = m[4]; const yy = m[5]; - dst[0] = Math.sqrt(xx * xx + xy * xy); - dst[1] = Math.sqrt(yx * yx + yy * yy); - return dst; + newDst[0] = Math.sqrt(xx * xx + xy * xy); + newDst[1] = Math.sqrt(yx * yx + yy * yy); + return newDst; } /** * Creates a 3-by-3 matrix which translates by the given vector v. @@ -1489,18 +1311,18 @@ * @param dst - matrix to hold result. If not passed a new one is created. * @returns The translation matrix. */ - function translation$1(v, dst) { - dst = dst || newMat3(); - dst[0] = 1; - dst[1] = 0; - dst[2] = 0; - dst[4] = 0; - dst[5] = 1; - dst[6] = 0; - dst[8] = v[0]; - dst[9] = v[1]; - dst[10] = 1; - return dst; + function translation(v, dst) { + const newDst = (dst ?? new Ctor(12)); + newDst[0] = 1; + newDst[1] = 0; + newDst[2] = 0; + newDst[4] = 0; + newDst[5] = 1; + newDst[6] = 0; + newDst[8] = v[0]; + newDst[9] = v[1]; + newDst[10] = 1; + return newDst; } /** * Translates the given 3-by-3 matrix by the given vector v. @@ -1509,8 +1331,8 @@ * @param dst - matrix to hold result. If not passed a new one is created. * @returns The translated matrix. */ - function translate$1(m, v, dst) { - dst = dst || newMat3(); + function translate(m, v, dst) { + const newDst = (dst ?? new Ctor(12)); const v0 = v[0]; const v1 = v[1]; const m00 = m[0]; @@ -1522,18 +1344,18 @@ const m20 = m[2 * 4 + 0]; const m21 = m[2 * 4 + 1]; const m22 = m[2 * 4 + 2]; - if (m !== dst) { - dst[0] = m00; - dst[1] = m01; - dst[2] = m02; - dst[4] = m10; - dst[5] = m11; - dst[6] = m12; + if (m !== newDst) { + newDst[0] = m00; + newDst[1] = m01; + newDst[2] = m02; + newDst[4] = m10; + newDst[5] = m11; + newDst[6] = m12; } - dst[8] = m00 * v0 + m10 * v1 + m20; - dst[9] = m01 * v0 + m11 * v1 + m21; - dst[10] = m02 * v0 + m12 * v1 + m22; - return dst; + newDst[8] = m00 * v0 + m10 * v1 + m20; + newDst[9] = m01 * v0 + m11 * v1 + m21; + newDst[10] = m02 * v0 + m12 * v1 + m22; + return newDst; } /** * Creates a 3-by-3 matrix which rotates by the given angle. @@ -1541,20 +1363,20 @@ * @param dst - matrix to hold result. If not passed a new one is created. * @returns The rotation matrix. */ - function rotation$1(angleInRadians, dst) { - dst = dst || newMat3(); + function rotation(angleInRadians, dst) { + const newDst = (dst ?? new Ctor(12)); const c = Math.cos(angleInRadians); const s = Math.sin(angleInRadians); - dst[0] = c; - dst[1] = s; - dst[2] = 0; - dst[4] = -s; - dst[5] = c; - dst[6] = 0; - dst[8] = 0; - dst[9] = 0; - dst[10] = 1; - return dst; + newDst[0] = c; + newDst[1] = s; + newDst[2] = 0; + newDst[4] = -s; + newDst[5] = c; + newDst[6] = 0; + newDst[8] = 0; + newDst[9] = 0; + newDst[10] = 1; + return newDst; } /** * Rotates the given 3-by-3 matrix by the given angle. @@ -1563,8 +1385,8 @@ * @param dst - matrix to hold result. If not passed a new one is created. * @returns The rotated matrix. */ - function rotate$1(m, angleInRadians, dst) { - dst = dst || newMat3(); + function rotate(m, angleInRadians, dst) { + const newDst = (dst ?? new Ctor(12)); const m00 = m[0 * 4 + 0]; const m01 = m[0 * 4 + 1]; const m02 = m[0 * 4 + 2]; @@ -1573,18 +1395,18 @@ const m12 = m[1 * 4 + 2]; const c = Math.cos(angleInRadians); const s = Math.sin(angleInRadians); - dst[0] = c * m00 + s * m10; - dst[1] = c * m01 + s * m11; - dst[2] = c * m02 + s * m12; - dst[4] = c * m10 - s * m00; - dst[5] = c * m11 - s * m01; - dst[6] = c * m12 - s * m02; - if (m !== dst) { - dst[8] = m[8]; - dst[9] = m[9]; - dst[10] = m[10]; + newDst[0] = c * m00 + s * m10; + newDst[1] = c * m01 + s * m11; + newDst[2] = c * m02 + s * m12; + newDst[4] = c * m10 - s * m00; + newDst[5] = c * m11 - s * m01; + newDst[6] = c * m12 - s * m02; + if (m !== newDst) { + newDst[8] = m[8]; + newDst[9] = m[9]; + newDst[10] = m[10]; } - return dst; + return newDst; } /** * Creates a 3-by-3 matrix which scales in each dimension by an amount given by @@ -1595,18 +1417,18 @@ * @param dst - matrix to hold result. If not passed a new one is created. * @returns The scaling matrix. */ - function scaling$1(v, dst) { - dst = dst || newMat3(); - dst[0] = v[0]; - dst[1] = 0; - dst[2] = 0; - dst[4] = 0; - dst[5] = v[1]; - dst[6] = 0; - dst[8] = 0; - dst[9] = 0; - dst[10] = 1; - return dst; + function scaling(v, dst) { + const newDst = (dst ?? new Ctor(12)); + newDst[0] = v[0]; + newDst[1] = 0; + newDst[2] = 0; + newDst[4] = 0; + newDst[5] = v[1]; + newDst[6] = 0; + newDst[8] = 0; + newDst[9] = 0; + newDst[10] = 1; + return newDst; } /** * Scales the given 3-by-3 matrix in each dimension by an amount @@ -1618,22 +1440,22 @@ * @param dst - matrix to hold result. If not passed a new one is created. * @returns The scaled matrix. */ - function scale$4(m, v, dst) { - dst = dst || newMat3(); + function scale(m, v, dst) { + const newDst = (dst ?? new Ctor(12)); const v0 = v[0]; const v1 = v[1]; - dst[0] = v0 * m[0 * 4 + 0]; - dst[1] = v0 * m[0 * 4 + 1]; - dst[2] = v0 * m[0 * 4 + 2]; - dst[4] = v1 * m[1 * 4 + 0]; - dst[5] = v1 * m[1 * 4 + 1]; - dst[6] = v1 * m[1 * 4 + 2]; - if (m !== dst) { - dst[8] = m[8]; - dst[9] = m[9]; - dst[10] = m[10]; + newDst[0] = v0 * m[0 * 4 + 0]; + newDst[1] = v0 * m[0 * 4 + 1]; + newDst[2] = v0 * m[0 * 4 + 2]; + newDst[4] = v1 * m[1 * 4 + 0]; + newDst[5] = v1 * m[1 * 4 + 1]; + newDst[6] = v1 * m[1 * 4 + 2]; + if (m !== newDst) { + newDst[8] = m[8]; + newDst[9] = m[9]; + newDst[10] = m[10]; } - return dst; + return newDst; } /** * Creates a 3-by-3 matrix which scales uniformly in each dimension @@ -1641,18 +1463,18 @@ * @param dst - matrix to hold result. If not passed a new one is created. * @returns The scaling matrix. */ - function uniformScaling$1(s, dst) { - dst = dst || newMat3(); - dst[0] = s; - dst[1] = 0; - dst[2] = 0; - dst[4] = 0; - dst[5] = s; - dst[6] = 0; - dst[8] = 0; - dst[9] = 0; - dst[10] = 1; - return dst; + function uniformScaling(s, dst) { + const newDst = (dst ?? new Ctor(12)); + newDst[0] = s; + newDst[1] = 0; + newDst[2] = 0; + newDst[4] = 0; + newDst[5] = s; + newDst[6] = 0; + newDst[8] = 0; + newDst[9] = 0; + newDst[10] = 1; + return newDst; } /** * Scales the given 3-by-3 matrix in each dimension by an amount @@ -1662,77 +1484,108 @@ * @param dst - matrix to hold result. If not passed a new one is created. * @returns The scaled matrix. */ - function uniformScale$1(m, s, dst) { - dst = dst || newMat3(); - dst[0] = s * m[0 * 4 + 0]; - dst[1] = s * m[0 * 4 + 1]; - dst[2] = s * m[0 * 4 + 2]; - dst[4] = s * m[1 * 4 + 0]; - dst[5] = s * m[1 * 4 + 1]; - dst[6] = s * m[1 * 4 + 2]; - if (m !== dst) { - dst[8] = m[8]; - dst[9] = m[9]; - dst[10] = m[10]; + function uniformScale(m, s, dst) { + const newDst = (dst ?? new Ctor(12)); + newDst[0] = s * m[0 * 4 + 0]; + newDst[1] = s * m[0 * 4 + 1]; + newDst[2] = s * m[0 * 4 + 2]; + newDst[4] = s * m[1 * 4 + 0]; + newDst[5] = s * m[1 * 4 + 1]; + newDst[6] = s * m[1 * 4 + 2]; + if (m !== newDst) { + newDst[8] = m[8]; + newDst[9] = m[9]; + newDst[10] = m[10]; } - return dst; - } - - var mat3Impl = { - __proto__: null, - clone: clone$4, - copy: copy$4, - create: create$3, - determinant: determinant$1, - equals: equals$4, - equalsApproximately: equalsApproximately$4, - fromMat4: fromMat4, - fromQuat: fromQuat$1, - getAxis: getAxis$2, - getScaling: getScaling$2, - getTranslation: getTranslation$2, - identity: identity$2, - inverse: inverse$4, - invert: invert$3, - mul: mul$4, - multiply: multiply$4, - negate: negate$3, - rotate: rotate$1, - rotation: rotation$1, - scale: scale$4, - scaling: scaling$1, - set: set$4, - setAxis: setAxis$1, - setDefaultType: setDefaultType$4, - setTranslation: setTranslation$1, - translate: translate$1, - translation: translation$1, - transpose: transpose$1, - uniformScale: uniformScale$1, - uniformScaling: uniformScaling$1 + return newDst; + } + return { + clone, + create, + set, + fromMat4, + fromQuat, + negate, + copy, + equalsApproximately, + equals, + identity, + transpose, + inverse, + invert, + determinant, + mul, + multiply, + setTranslation, + getTranslation, + getAxis, + setAxis, + getScaling, + translation, + translate, + rotation, + rotate, + scaling, + scale, + uniformScaling, + uniformScale, }; +} +const cache$4 = new Map(); +function getAPI$4(Ctor) { + let api = cache$4.get(Ctor); + if (!api) { + api = getAPIImpl$4(Ctor); + cache$4.set(Ctor, api); + } + return api; +} - /* - * Copyright 2022 Gregg Tavares - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. +/* + * Copyright 2022 Gregg Tavares + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ +/** + * Generates am typed API for Vec3 + * */ +function getAPIImpl$3(Ctor) { + /** + * Creates a vec3; may be called with x, y, z to set initial values. + * @param x - Initial x value. + * @param y - Initial y value. + * @param z - Initial z value. + * @returns the created vector */ + function create(x, y, z) { + const newDst = new Ctor(3); + if (x !== undefined) { + newDst[0] = x; + if (y !== undefined) { + newDst[1] = y; + if (z !== undefined) { + newDst[2] = z; + } + } + } + return newDst; + } /** * Creates a vec3; may be called with x, y, z to set initial values. (same as create) * @param x - Initial x value. @@ -1740,7 +1593,7 @@ * @param z - Initial z value. * @returns the created vector */ - const fromValues$2 = create$4; + const fromValues = create; /** * Sets the values of a Vec3 * Also see {@link vec3.create} and {@link vec3.copy} @@ -1751,12 +1604,12 @@ * @param dst - vector to hold result. If not passed in a new one is created. * @returns A vector with its elements set. */ - function set$3(x, y, z, dst) { - dst = dst || new VecType$1(3); - dst[0] = x; - dst[1] = y; - dst[2] = z; - return dst; + function set(x, y, z, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = x; + newDst[1] = y; + newDst[2] = z; + return newDst; } /** * Applies Math.ceil to each element of vector @@ -1764,12 +1617,12 @@ * @param dst - vector to hold result. If not passed in a new one is created. * @returns A vector that is the ceil of each element of v. */ - function ceil$1(v, dst) { - dst = dst || new VecType$1(3); - dst[0] = Math.ceil(v[0]); - dst[1] = Math.ceil(v[1]); - dst[2] = Math.ceil(v[2]); - return dst; + function ceil(v, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = Math.ceil(v[0]); + newDst[1] = Math.ceil(v[1]); + newDst[2] = Math.ceil(v[2]); + return newDst; } /** * Applies Math.floor to each element of vector @@ -1777,12 +1630,12 @@ * @param dst - vector to hold result. If not passed in a new one is created. * @returns A vector that is the floor of each element of v. */ - function floor$1(v, dst) { - dst = dst || new VecType$1(3); - dst[0] = Math.floor(v[0]); - dst[1] = Math.floor(v[1]); - dst[2] = Math.floor(v[2]); - return dst; + function floor(v, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = Math.floor(v[0]); + newDst[1] = Math.floor(v[1]); + newDst[2] = Math.floor(v[2]); + return newDst; } /** * Applies Math.round to each element of vector @@ -1790,12 +1643,12 @@ * @param dst - vector to hold result. If not passed in a new one is created. * @returns A vector that is the round of each element of v. */ - function round$1(v, dst) { - dst = dst || new VecType$1(3); - dst[0] = Math.round(v[0]); - dst[1] = Math.round(v[1]); - dst[2] = Math.round(v[2]); - return dst; + function round(v, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = Math.round(v[0]); + newDst[1] = Math.round(v[1]); + newDst[2] = Math.round(v[2]); + return newDst; } /** * Clamp each element of vector between min and max @@ -1805,12 +1658,12 @@ * @param dst - vector to hold result. If not passed in a new one is created. * @returns A vector that the clamped value of each element of v. */ - function clamp$1(v, min = 0, max = 1, dst) { - dst = dst || new VecType$1(3); - dst[0] = Math.min(max, Math.max(min, v[0])); - dst[1] = Math.min(max, Math.max(min, v[1])); - dst[2] = Math.min(max, Math.max(min, v[2])); - return dst; + function clamp(v, min = 0, max = 1, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = Math.min(max, Math.max(min, v[0])); + newDst[1] = Math.min(max, Math.max(min, v[1])); + newDst[2] = Math.min(max, Math.max(min, v[2])); + return newDst; } /** * Adds two vectors; assumes a and b have the same dimension. @@ -1819,12 +1672,12 @@ * @param dst - vector to hold result. If not passed in a new one is created. * @returns A vector that is the sum of a and b. */ - function add$2(a, b, dst) { - dst = dst || new VecType$1(3); - dst[0] = a[0] + b[0]; - dst[1] = a[1] + b[1]; - dst[2] = a[2] + b[2]; - return dst; + function add(a, b, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = a[0] + b[0]; + newDst[1] = a[1] + b[1]; + newDst[2] = a[2] + b[2]; + return newDst; } /** * Adds two vectors, scaling the 2nd; assumes a and b have the same dimension. @@ -1834,12 +1687,12 @@ * @param dst - vector to hold result. If not passed in a new one is created. * @returns A vector that is the sum of a + b * scale. */ - function addScaled$1(a, b, scale, dst) { - dst = dst || new VecType$1(3); - dst[0] = a[0] + b[0] * scale; - dst[1] = a[1] + b[1] * scale; - dst[2] = a[2] + b[2] * scale; - return dst; + function addScaled(a, b, scale, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = a[0] + b[0] * scale; + newDst[1] = a[1] + b[1] * scale; + newDst[2] = a[2] + b[2] * scale; + return newDst; } /** * Returns the angle in radians between two vectors. @@ -1847,7 +1700,7 @@ * @param b - Operand vector. * @returns The angle in radians between the 2 vectors. */ - function angle$1(a, b) { + function angle(a, b) { const ax = a[0]; const ay = a[1]; const az = a[2]; @@ -1857,7 +1710,7 @@ const mag1 = Math.sqrt(ax * ax + ay * ay + az * az); const mag2 = Math.sqrt(bx * bx + by * by + bz * bz); const mag = mag1 * mag2; - const cosine = mag && dot$2(a, b) / mag; + const cosine = mag && dot(a, b) / mag; return Math.acos(cosine); } /** @@ -1867,12 +1720,12 @@ * @param dst - vector to hold result. If not passed in a new one is created. * @returns A vector that is the difference of a and b. */ - function subtract$2(a, b, dst) { - dst = dst || new VecType$1(3); - dst[0] = a[0] - b[0]; - dst[1] = a[1] - b[1]; - dst[2] = a[2] - b[2]; - return dst; + function subtract(a, b, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = a[0] - b[0]; + newDst[1] = a[1] - b[1]; + newDst[2] = a[2] - b[2]; + return newDst; } /** * Subtracts two vectors. @@ -1881,14 +1734,14 @@ * @param dst - vector to hold result. If not passed in a new one is created. * @returns A vector that is the difference of a and b. */ - const sub$2 = subtract$2; + const sub = subtract; /** * Check if 2 vectors are approximately equal * @param a - Operand vector. * @param b - Operand vector. * @returns true if vectors are approximately equal */ - function equalsApproximately$3(a, b) { + function equalsApproximately(a, b) { return Math.abs(a[0] - b[0]) < EPSILON && Math.abs(a[1] - b[1]) < EPSILON && Math.abs(a[2] - b[2]) < EPSILON; @@ -1899,7 +1752,7 @@ * @param b - Operand vector. * @returns true if vectors are exactly equal */ - function equals$3(a, b) { + function equals(a, b) { return a[0] === b[0] && a[1] === b[1] && a[2] === b[2]; } /** @@ -1912,12 +1765,12 @@ * @param dst - vector to hold result. If not passed in a new one is created. * @returns The linear interpolated result. */ - function lerp$2(a, b, t, dst) { - dst = dst || new VecType$1(3); - dst[0] = a[0] + t * (b[0] - a[0]); - dst[1] = a[1] + t * (b[1] - a[1]); - dst[2] = a[2] + t * (b[2] - a[2]); - return dst; + function lerp(a, b, t, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = a[0] + t * (b[0] - a[0]); + newDst[1] = a[1] + t * (b[1] - a[1]); + newDst[2] = a[2] + t * (b[2] - a[2]); + return newDst; } /** * Performs linear interpolation on two vectors. @@ -1929,12 +1782,12 @@ * @param dst - vector to hold result. If not passed in a new one is created. * @returns the linear interpolated result. */ - function lerpV$1(a, b, t, dst) { - dst = dst || new VecType$1(3); - dst[0] = a[0] + t[0] * (b[0] - a[0]); - dst[1] = a[1] + t[1] * (b[1] - a[1]); - dst[2] = a[2] + t[2] * (b[2] - a[2]); - return dst; + function lerpV(a, b, t, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = a[0] + t[0] * (b[0] - a[0]); + newDst[1] = a[1] + t[1] * (b[1] - a[1]); + newDst[2] = a[2] + t[2] * (b[2] - a[2]); + return newDst; } /** * Return max values of two vectors. @@ -1945,12 +1798,12 @@ * @param dst - vector to hold result. If not passed in a new one is created. * @returns The max components vector. */ - function max$1(a, b, dst) { - dst = dst || new VecType$1(3); - dst[0] = Math.max(a[0], b[0]); - dst[1] = Math.max(a[1], b[1]); - dst[2] = Math.max(a[2], b[2]); - return dst; + function max(a, b, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = Math.max(a[0], b[0]); + newDst[1] = Math.max(a[1], b[1]); + newDst[2] = Math.max(a[2], b[2]); + return newDst; } /** * Return min values of two vectors. @@ -1961,12 +1814,12 @@ * @param dst - vector to hold result. If not passed in a new one is created. * @returns The min components vector. */ - function min$1(a, b, dst) { - dst = dst || new VecType$1(3); - dst[0] = Math.min(a[0], b[0]); - dst[1] = Math.min(a[1], b[1]); - dst[2] = Math.min(a[2], b[2]); - return dst; + function min(a, b, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = Math.min(a[0], b[0]); + newDst[1] = Math.min(a[1], b[1]); + newDst[2] = Math.min(a[2], b[2]); + return newDst; } /** * Multiplies a vector by a scalar. @@ -1975,12 +1828,12 @@ * @param dst - vector to hold result. If not passed in a new one is created. * @returns The scaled vector. */ - function mulScalar$2(v, k, dst) { - dst = dst || new VecType$1(3); - dst[0] = v[0] * k; - dst[1] = v[1] * k; - dst[2] = v[2] * k; - return dst; + function mulScalar(v, k, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = v[0] * k; + newDst[1] = v[1] * k; + newDst[2] = v[2] * k; + return newDst; } /** * Multiplies a vector by a scalar. (same as mulScalar) @@ -1989,7 +1842,7 @@ * @param dst - vector to hold result. If not passed in a new one is created. * @returns The scaled vector. */ - const scale$3 = mulScalar$2; + const scale = mulScalar; /** * Divides a vector by a scalar. * @param v - The vector. @@ -1997,12 +1850,12 @@ * @param dst - vector to hold result. If not passed in a new one is created. * @returns The scaled vector. */ - function divScalar$2(v, k, dst) { - dst = dst || new VecType$1(3); - dst[0] = v[0] / k; - dst[1] = v[1] / k; - dst[2] = v[2] / k; - return dst; + function divScalar(v, k, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = v[0] / k; + newDst[1] = v[1] / k; + newDst[2] = v[2] / k; + return newDst; } /** * Inverse a vector. @@ -2010,12 +1863,12 @@ * @param dst - vector to hold result. If not passed in a new one is created. * @returns The inverted vector. */ - function inverse$3(v, dst) { - dst = dst || new VecType$1(3); - dst[0] = 1 / v[0]; - dst[1] = 1 / v[1]; - dst[2] = 1 / v[2]; - return dst; + function inverse(v, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = 1 / v[0]; + newDst[1] = 1 / v[1]; + newDst[2] = 1 / v[2]; + return newDst; } /** * Invert a vector. (same as inverse) @@ -2023,7 +1876,7 @@ * @param dst - vector to hold result. If not passed in a new one is created. * @returns The inverted vector. */ - const invert$2 = inverse$3; + const invert = inverse; /** * Computes the cross product of two vectors; assumes both vectors have * three entries. @@ -2033,13 +1886,13 @@ * @returns The vector of a cross b. */ function cross(a, b, dst) { - dst = dst || new VecType$1(3); + const newDst = (dst ?? new Ctor(3)); const t1 = a[2] * b[0] - a[0] * b[2]; const t2 = a[0] * b[1] - a[1] * b[0]; - dst[0] = a[1] * b[2] - a[2] * b[1]; - dst[1] = t1; - dst[2] = t2; - return dst; + newDst[0] = a[1] * b[2] - a[2] * b[1]; + newDst[1] = t1; + newDst[2] = t2; + return newDst; } /** * Computes the dot product of two vectors; assumes both vectors have @@ -2048,7 +1901,7 @@ * @param b - Operand vector. * @returns dot product */ - function dot$2(a, b) { + function dot(a, b) { return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]); } /** @@ -2056,7 +1909,7 @@ * @param v - vector. * @returns length of vector. */ - function length$2(v) { + function length(v) { const v0 = v[0]; const v1 = v[1]; const v2 = v[2]; @@ -2067,13 +1920,13 @@ * @param v - vector. * @returns length of vector. */ - const len$2 = length$2; + const len = length; /** * Computes the square of the length of vector * @param v - vector. * @returns square of the length of vector. */ - function lengthSq$2(v) { + function lengthSq(v) { const v0 = v[0]; const v1 = v[1]; const v2 = v[2]; @@ -2084,14 +1937,14 @@ * @param v - vector. * @returns square of the length of vector. */ - const lenSq$2 = lengthSq$2; + const lenSq = lengthSq; /** * Computes the distance between 2 points * @param a - vector. * @param b - vector. * @returns distance between a and b */ - function distance$1(a, b) { + function distance(a, b) { const dx = a[0] - b[0]; const dy = a[1] - b[1]; const dz = a[2] - b[2]; @@ -2103,14 +1956,14 @@ * @param b - vector. * @returns distance between a and b */ - const dist$1 = distance$1; + const dist = distance; /** * Computes the square of the distance between 2 points * @param a - vector. * @param b - vector. * @returns square of the distance between a and b */ - function distanceSq$1(a, b) { + function distanceSq(a, b) { const dx = a[0] - b[0]; const dy = a[1] - b[1]; const dz = a[2] - b[2]; @@ -2122,30 +1975,30 @@ * @param b - vector. * @returns square of the distance between a and b */ - const distSq$1 = distanceSq$1; + const distSq = distanceSq; /** * Divides a vector by its Euclidean length and returns the quotient. * @param v - The vector. * @param dst - vector to hold result. If not passed in a new one is created. * @returns The normalized vector. */ - function normalize$2(v, dst) { - dst = dst || new VecType$1(3); + function normalize(v, dst) { + const newDst = (dst ?? new Ctor(3)); const v0 = v[0]; const v1 = v[1]; const v2 = v[2]; const len = Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2); if (len > 0.00001) { - dst[0] = v0 / len; - dst[1] = v1 / len; - dst[2] = v2 / len; + newDst[0] = v0 / len; + newDst[1] = v1 / len; + newDst[2] = v2 / len; } else { - dst[0] = 0; - dst[1] = 0; - dst[2] = 0; + newDst[0] = 0; + newDst[1] = 0; + newDst[2] = 0; } - return dst; + return newDst; } /** * Negates a vector. @@ -2153,12 +2006,12 @@ * @param dst - vector to hold result. If not passed in a new one is created. * @returns -v. */ - function negate$2(v, dst) { - dst = dst || new VecType$1(3); - dst[0] = -v[0]; - dst[1] = -v[1]; - dst[2] = -v[2]; - return dst; + function negate(v, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = -v[0]; + newDst[1] = -v[1]; + newDst[2] = -v[2]; + return newDst; } /** * Copies a vector. (same as {@link vec3.clone}) @@ -2167,12 +2020,12 @@ * @param dst - vector to hold result. If not passed in a new one is created. * @returns A copy of v. */ - function copy$3(v, dst) { - dst = dst || new VecType$1(3); - dst[0] = v[0]; - dst[1] = v[1]; - dst[2] = v[2]; - return dst; + function copy(v, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = v[0]; + newDst[1] = v[1]; + newDst[2] = v[2]; + return newDst; } /** * Clones a vector. (same as {@link vec3.copy}) @@ -2181,7 +2034,7 @@ * @param dst - vector to hold result. If not passed in a new one is created. * @returns A copy of v. */ - const clone$3 = copy$3; + const clone = copy; /** * Multiplies a vector by another vector (component-wise); assumes a and * b have the same length. @@ -2190,12 +2043,12 @@ * @param dst - vector to hold result. If not passed in a new one is created. * @returns The vector of products of entries of a and b. */ - function multiply$3(a, b, dst) { - dst = dst || new VecType$1(3); - dst[0] = a[0] * b[0]; - dst[1] = a[1] * b[1]; - dst[2] = a[2] * b[2]; - return dst; + function multiply(a, b, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = a[0] * b[0]; + newDst[1] = a[1] * b[1]; + newDst[2] = a[2] * b[2]; + return newDst; } /** * Multiplies a vector by another vector (component-wise); assumes a and @@ -2205,7 +2058,7 @@ * @param dst - vector to hold result. If not passed in a new one is created. * @returns The vector of products of entries of a and b. */ - const mul$3 = multiply$3; + const mul = multiply; /** * Divides a vector by another vector (component-wise); assumes a and * b have the same length. @@ -2214,12 +2067,12 @@ * @param dst - vector to hold result. If not passed in a new one is created. * @returns The vector of quotients of entries of a and b. */ - function divide$1(a, b, dst) { - dst = dst || new VecType$1(3); - dst[0] = a[0] / b[0]; - dst[1] = a[1] / b[1]; - dst[2] = a[2] / b[2]; - return dst; + function divide(a, b, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = a[0] / b[0]; + newDst[1] = a[1] / b[1]; + newDst[2] = a[2] / b[2]; + return newDst; } /** * Divides a vector by another vector (component-wise); assumes a and @@ -2229,7 +2082,7 @@ * @param dst - vector to hold result. If not passed in a new one is created. * @returns The vector of quotients of entries of a and b. */ - const div$1 = divide$1; + const div = divide; /** * Creates a random vector * @param scale - Default 1 @@ -2237,26 +2090,26 @@ * @returns The random vector. */ function random(scale = 1, dst) { - dst = dst || new VecType$1(3); + const newDst = (dst ?? new Ctor(3)); const angle = Math.random() * 2 * Math.PI; const z = Math.random() * 2 - 1; const zScale = Math.sqrt(1 - z * z) * scale; - dst[0] = Math.cos(angle) * zScale; - dst[1] = Math.sin(angle) * zScale; - dst[2] = z * scale; - return dst; + newDst[0] = Math.cos(angle) * zScale; + newDst[1] = Math.sin(angle) * zScale; + newDst[2] = z * scale; + return newDst; } /** * Zero's a vector * @param dst - vector to hold result. If not passed in a new one is created. * @returns The zeroed vector. */ - function zero$1(dst) { - dst = dst || new VecType$1(3); - dst[0] = 0; - dst[1] = 0; - dst[2] = 0; - return dst; + function zero(dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = 0; + newDst[1] = 0; + newDst[2] = 0; + return newDst; } /** * transform vec3 by 4x4 matrix @@ -2265,33 +2118,33 @@ * @param dst - optional vec3 to store result. If not passed a new one is created. * @returns the transformed vector */ - function transformMat4$1(v, m, dst) { - dst = dst || new VecType$1(3); + function transformMat4(v, m, dst) { + const newDst = (dst ?? new Ctor(3)); const x = v[0]; const y = v[1]; const z = v[2]; const w = (m[3] * x + m[7] * y + m[11] * z + m[15]) || 1; - dst[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w; - dst[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w; - dst[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w; - return dst; + newDst[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w; + newDst[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w; + newDst[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w; + return newDst; } /** - * Transform vec4 by upper 3x3 matrix inside 4x4 matrix. + * Transform vec3 by upper 3x3 matrix inside 4x4 matrix. * @param v - The direction. * @param m - The matrix. - * @param dst - optional Vec3 to store result. If not passed a new one is created. + * @param dst - optional vec3 to store result. If not passed a new one is created. * @returns The transformed vector. */ function transformMat4Upper3x3(v, m, dst) { - dst = dst || new VecType$1(3); + const newDst = (dst ?? new Ctor(3)); const v0 = v[0]; const v1 = v[1]; const v2 = v[2]; - dst[0] = v0 * m[0 * 4 + 0] + v1 * m[1 * 4 + 0] + v2 * m[2 * 4 + 0]; - dst[1] = v0 * m[0 * 4 + 1] + v1 * m[1 * 4 + 1] + v2 * m[2 * 4 + 1]; - dst[2] = v0 * m[0 * 4 + 2] + v1 * m[1 * 4 + 2] + v2 * m[2 * 4 + 2]; - return dst; + newDst[0] = v0 * m[0 * 4 + 0] + v1 * m[1 * 4 + 0] + v2 * m[2 * 4 + 0]; + newDst[1] = v0 * m[0 * 4 + 1] + v1 * m[1 * 4 + 1] + v2 * m[2 * 4 + 1]; + newDst[2] = v0 * m[0 * 4 + 2] + v1 * m[1 * 4 + 2] + v2 * m[2 * 4 + 2]; + return newDst; } /** * Transforms vec3 by 3x3 matrix @@ -2302,14 +2155,14 @@ * @returns the transformed vector */ function transformMat3(v, m, dst) { - dst = dst || new VecType$1(3); + const newDst = (dst ?? new Ctor(3)); const x = v[0]; const y = v[1]; const z = v[2]; - dst[0] = x * m[0] + y * m[4] + z * m[8]; - dst[1] = x * m[1] + y * m[5] + z * m[9]; - dst[2] = x * m[2] + y * m[6] + z * m[10]; - return dst; + newDst[0] = x * m[0] + y * m[4] + z * m[8]; + newDst[1] = x * m[1] + y * m[5] + z * m[9]; + newDst[2] = x * m[2] + y * m[6] + z * m[10]; + return newDst; } /** * Transforms vec3 by Quaternion @@ -2319,7 +2172,7 @@ * @returns the transformed */ function transformQuat(v, q, dst) { - dst = dst || new VecType$1(3); + const newDst = (dst ?? new Ctor(3)); const qx = q[0]; const qy = q[1]; const qz = q[2]; @@ -2330,10 +2183,10 @@ const uvX = qy * z - qz * y; const uvY = qz * x - qx * z; const uvZ = qx * y - qy * x; - dst[0] = x + uvX * w2 + (qy * uvZ - qz * uvY) * 2; - dst[1] = y + uvY * w2 + (qz * uvX - qx * uvZ) * 2; - dst[2] = z + uvZ * w2 + (qx * uvY - qy * uvX) * 2; - return dst; + newDst[0] = x + uvX * w2 + (qy * uvZ - qz * uvY) * 2; + newDst[1] = y + uvY * w2 + (qz * uvX - qx * uvZ) * 2; + newDst[2] = z + uvZ * w2 + (qx * uvY - qy * uvX) * 2; + return newDst; } /** * Returns the translation component of a 4-by-4 matrix as a vector with 3 @@ -2342,12 +2195,12 @@ * @param dst - vector to hold result. If not passed a new one is created. * @returns The translation component of m. */ - function getTranslation$1(m, dst) { - dst = dst || new VecType$1(3); - dst[0] = m[12]; - dst[1] = m[13]; - dst[2] = m[14]; - return dst; + function getTranslation(m, dst) { + const newDst = (dst ?? new Ctor(3)); + newDst[0] = m[12]; + newDst[1] = m[13]; + newDst[2] = m[14]; + return newDst; } /** * Returns an axis of a 4x4 matrix as a vector with 3 entries @@ -2355,21 +2208,21 @@ * @param axis - The axis 0 = x, 1 = y, 2 = z; * @returns The axis component of m. */ - function getAxis$1(m, axis, dst) { - dst = dst || new VecType$1(3); + function getAxis(m, axis, dst) { + const newDst = (dst ?? new Ctor(3)); const off = axis * 4; - dst[0] = m[off + 0]; - dst[1] = m[off + 1]; - dst[2] = m[off + 2]; - return dst; + newDst[0] = m[off + 0]; + newDst[1] = m[off + 1]; + newDst[2] = m[off + 2]; + return newDst; } /** * Returns the scaling component of the matrix * @param m - The Matrix * @param dst - The vector to set. If not passed a new one is created. */ - function getScaling$1(m, dst) { - dst = dst || new VecType$1(3); + function getScaling(m, dst) { + const newDst = (dst ?? new Ctor(3)); const xx = m[0]; const xy = m[1]; const xz = m[2]; @@ -2379,10 +2232,10 @@ const zx = m[8]; const zy = m[9]; const zz = m[10]; - dst[0] = Math.sqrt(xx * xx + xy * xy + xz * xz); - dst[1] = Math.sqrt(yx * yx + yy * yy + yz * yz); - dst[2] = Math.sqrt(zx * zx + zy * zy + zz * zz); - return dst; + newDst[0] = Math.sqrt(xx * xx + xy * xy + xz * xz); + newDst[1] = Math.sqrt(yx * yx + yy * yy + yz * yz); + newDst[2] = Math.sqrt(zx * zx + zy * zy + zz * zz); + return newDst; } /** * Rotate a 3D vector around the x-axis @@ -2393,8 +2246,8 @@ * @param dst - The vector to set. If not passed a new one is created. * @returns the rotated vector */ - function rotateX$2(a, b, rad, dst) { - dst = dst || new VecType$1(3); + function rotateX(a, b, rad, dst) { + const newDst = (dst ?? new Ctor(3)); const p = []; const r = []; //Translate point to the origin @@ -2406,10 +2259,10 @@ r[1] = p[1] * Math.cos(rad) - p[2] * Math.sin(rad); r[2] = p[1] * Math.sin(rad) + p[2] * Math.cos(rad); //translate to correct position - dst[0] = r[0] + b[0]; - dst[1] = r[1] + b[1]; - dst[2] = r[2] + b[2]; - return dst; + newDst[0] = r[0] + b[0]; + newDst[1] = r[1] + b[1]; + newDst[2] = r[2] + b[2]; + return newDst; } /** * Rotate a 3D vector around the y-axis @@ -2420,8 +2273,8 @@ * @param dst - The vector to set. If not passed a new one is created. * @returns the rotated vector */ - function rotateY$2(a, b, rad, dst) { - dst = dst || new VecType$1(3); + function rotateY(a, b, rad, dst) { + const newDst = (dst ?? new Ctor(3)); const p = []; const r = []; // translate point to the origin @@ -2433,10 +2286,10 @@ r[1] = p[1]; r[2] = p[2] * Math.cos(rad) - p[0] * Math.sin(rad); // translate to correct position - dst[0] = r[0] + b[0]; - dst[1] = r[1] + b[1]; - dst[2] = r[2] + b[2]; - return dst; + newDst[0] = r[0] + b[0]; + newDst[1] = r[1] + b[1]; + newDst[2] = r[2] + b[2]; + return newDst; } /** * Rotate a 3D vector around the z-axis @@ -2447,8 +2300,8 @@ * @param dst - The vector to set. If not passed a new one is created. * @returns {vec3} out */ - function rotateZ$2(a, b, rad, dst) { - dst = dst || new VecType$1(3); + function rotateZ(a, b, rad, dst) { + const newDst = (dst ?? new Ctor(3)); const p = []; const r = []; // translate point to the origin @@ -2460,10 +2313,10 @@ r[1] = p[0] * Math.sin(rad) + p[1] * Math.cos(rad); r[2] = p[2]; // translate to correct position - dst[0] = r[0] + b[0]; - dst[1] = r[1] + b[1]; - dst[2] = r[2] + b[2]; - return dst; + newDst[0] = r[0] + b[0]; + newDst[1] = r[1] + b[1]; + newDst[2] = r[2] + b[2]; + return newDst; } /** * Treat a 3D vector as a direction and set it's length @@ -2472,10 +2325,10 @@ * @param len The length of the resulting vector * @returns The lengthened vector */ - function setLength$1(a, len, dst) { - dst = dst || new VecType$1(3); - normalize$2(a, dst); - return mulScalar$2(dst, len, dst); + function setLength(a, len, dst) { + const newDst = (dst ?? new Ctor(3)); + normalize(a, newDst); + return mulScalar(newDst, len, newDst); } /** * Ensure a vector is not longer than a max length @@ -2484,12 +2337,12 @@ * @param maxLen The longest length of the resulting vector * @returns The vector, shortened to maxLen if it's too long */ - function truncate$1(a, maxLen, dst) { - dst = dst || new VecType$1(3); - if (length$2(a) > maxLen) { - return setLength$1(a, maxLen, dst); + function truncate(a, maxLen, dst) { + const newDst = (dst ?? new Ctor(3)); + if (length(a) > maxLen) { + return setLength(a, maxLen, newDst); } - return copy$3(a, dst); + return copy(a, newDst); } /** * Return the vector exactly between 2 endpoint vectors @@ -2498,76 +2351,88 @@ * @param b Endpoint 2 * @returns The vector exactly residing between endpoints 1 and 2 */ - function midpoint$1(a, b, dst) { - dst = dst || new VecType$1(3); - return lerp$2(a, b, 0.5, dst); - } - - var vec3Impl = { - __proto__: null, - add: add$2, - addScaled: addScaled$1, - angle: angle$1, - ceil: ceil$1, - clamp: clamp$1, - clone: clone$3, - copy: copy$3, - create: create$4, - cross: cross, - dist: dist$1, - distSq: distSq$1, - distance: distance$1, - distanceSq: distanceSq$1, - div: div$1, - divScalar: divScalar$2, - divide: divide$1, - dot: dot$2, - equals: equals$3, - equalsApproximately: equalsApproximately$3, - floor: floor$1, - fromValues: fromValues$2, - getAxis: getAxis$1, - getScaling: getScaling$1, - getTranslation: getTranslation$1, - inverse: inverse$3, - invert: invert$2, - len: len$2, - lenSq: lenSq$2, - length: length$2, - lengthSq: lengthSq$2, - lerp: lerp$2, - lerpV: lerpV$1, - max: max$1, - midpoint: midpoint$1, - min: min$1, - mul: mul$3, - mulScalar: mulScalar$2, - multiply: multiply$3, - negate: negate$2, - normalize: normalize$2, - random: random, - rotateX: rotateX$2, - rotateY: rotateY$2, - rotateZ: rotateZ$2, - round: round$1, - scale: scale$3, - set: set$3, - setDefaultType: setDefaultType$5, - setLength: setLength$1, - sub: sub$2, - subtract: subtract$2, - transformMat3: transformMat3, - transformMat4: transformMat4$1, - transformMat4Upper3x3: transformMat4Upper3x3, - transformQuat: transformQuat, - truncate: truncate$1, - zero: zero$1 + function midpoint(a, b, dst) { + const newDst = (dst ?? new Ctor(3)); + return lerp(a, b, 0.5, newDst); + } + return { + create, + fromValues, + set, + ceil, + floor, + round, + clamp, + add, + addScaled, + angle, + subtract, + sub, + equalsApproximately, + equals, + lerp, + lerpV, + max, + min, + mulScalar, + scale, + divScalar, + inverse, + invert, + cross, + dot, + length, + len, + lengthSq, + lenSq, + distance, + dist, + distanceSq, + distSq, + normalize, + negate, + copy, + clone, + multiply, + mul, + divide, + div, + random, + zero, + transformMat4, + transformMat4Upper3x3, + transformMat3, + transformQuat, + getTranslation, + getAxis, + getScaling, + rotateX, + rotateY, + rotateZ, + setLength, + truncate, + midpoint, }; +} +const cache$3 = new Map(); +function getAPI$3(Ctor) { + let api = cache$3.get(Ctor); + if (!api) { + api = getAPIImpl$3(Ctor); + cache$3.set(Ctor, api); + } + return api; +} +/** + * Generates a typed API for Mat4 + * */ +function getAPIImpl$2(Ctor) { + const vec3 = getAPI$3(Ctor); /** * 4x4 Matrix math math functions. * - * Almost all functions take an optional `dst` argument. If it is not passed in the + * Almost all functions take an optional `newDst` argument. If it is not passed in the * functions will create a new matrix. In other words you can do this * * const mat = mat4.translation([1, 2, 3]); // Creates a new translation matrix @@ -2587,17 +2452,6 @@ * mat4.multiply(mat, trans, mat); // Multiplies mat * trans and puts result in mat. * */ - let MatType = Float32Array; - /** - * Sets the type this library creates for a Mat4 - * @param ctor - the constructor for the type. Either `Float32Array`, `Float64Array`, or `Array` - * @returns previous constructor for Mat4 - */ - function setDefaultType$3(ctor) { - const oldType = MatType; - MatType = ctor; - return oldType; - } /** * Create a Mat4 from values * @@ -2610,17 +2464,6 @@ * const m = mat4.clone(someJSArray); * ``` * - * Note: a consequence of the implementation is if your Mat4Type = `Array` - * instead of `Float32Array` or `Float64Array` then any values you - * don't pass in will be undefined. Usually this is not an issue since - * (a) using `Array` is rare and (b) using `mat4.create` is usually used - * to create a Mat4 to be filled out as in - * - * ``` - * const m = mat4.create(); - * mat4.perspective(fov, aspect, near, far, m); - * ``` - * * @param v0 - value for element 0 * @param v1 - value for element 1 * @param v2 - value for element 2 @@ -2639,40 +2482,40 @@ * @param v15 - value for element 15 * @returns created from values. */ - function create$2(v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15) { - const dst = new MatType(16); + function create(v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15) { + const newDst = new Ctor(16); if (v0 !== undefined) { - dst[0] = v0; + newDst[0] = v0; if (v1 !== undefined) { - dst[1] = v1; + newDst[1] = v1; if (v2 !== undefined) { - dst[2] = v2; + newDst[2] = v2; if (v3 !== undefined) { - dst[3] = v3; + newDst[3] = v3; if (v4 !== undefined) { - dst[4] = v4; + newDst[4] = v4; if (v5 !== undefined) { - dst[5] = v5; + newDst[5] = v5; if (v6 !== undefined) { - dst[6] = v6; + newDst[6] = v6; if (v7 !== undefined) { - dst[7] = v7; + newDst[7] = v7; if (v8 !== undefined) { - dst[8] = v8; + newDst[8] = v8; if (v9 !== undefined) { - dst[9] = v9; + newDst[9] = v9; if (v10 !== undefined) { - dst[10] = v10; + newDst[10] = v10; if (v11 !== undefined) { - dst[11] = v11; + newDst[11] = v11; if (v12 !== undefined) { - dst[12] = v12; + newDst[12] = v12; if (v13 !== undefined) { - dst[13] = v13; + newDst[13] = v13; if (v14 !== undefined) { - dst[14] = v14; + newDst[14] = v14; if (v15 !== undefined) { - dst[15] = v15; + newDst[15] = v15; } } } @@ -2689,7 +2532,7 @@ } } } - return dst; + return newDst; } /** * Sets the values of a Mat4 @@ -2714,25 +2557,25 @@ * @param dst - matrix to hold result. If not passed a new one is created. * @returns Mat4 created from values. */ - function set$2(v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, dst) { - dst = dst || new MatType(16); - dst[0] = v0; - dst[1] = v1; - dst[2] = v2; - dst[3] = v3; - dst[4] = v4; - dst[5] = v5; - dst[6] = v6; - dst[7] = v7; - dst[8] = v8; - dst[9] = v9; - dst[10] = v10; - dst[11] = v11; - dst[12] = v12; - dst[13] = v13; - dst[14] = v14; - dst[15] = v15; - return dst; + function set(v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, dst) { + const newDst = (dst ?? new Ctor(16)); + newDst[0] = v0; + newDst[1] = v1; + newDst[2] = v2; + newDst[3] = v3; + newDst[4] = v4; + newDst[5] = v5; + newDst[6] = v6; + newDst[7] = v7; + newDst[8] = v8; + newDst[9] = v9; + newDst[10] = v10; + newDst[11] = v11; + newDst[12] = v12; + newDst[13] = v13; + newDst[14] = v14; + newDst[15] = v15; + return newDst; } /** * Creates a Mat4 from a Mat3 @@ -2741,24 +2584,24 @@ * @returns Mat4 made from m3 */ function fromMat3(m3, dst) { - dst = dst || new MatType(16); - dst[0] = m3[0]; - dst[1] = m3[1]; - dst[2] = m3[2]; - dst[3] = 0; - dst[4] = m3[4]; - dst[5] = m3[5]; - dst[6] = m3[6]; - dst[7] = 0; - dst[8] = m3[8]; - dst[9] = m3[9]; - dst[10] = m3[10]; - dst[11] = 0; - dst[12] = 0; - dst[13] = 0; - dst[14] = 0; - dst[15] = 1; - return dst; + const newDst = (dst ?? new Ctor(16)); + newDst[0] = m3[0]; + newDst[1] = m3[1]; + newDst[2] = m3[2]; + newDst[3] = 0; + newDst[4] = m3[4]; + newDst[5] = m3[5]; + newDst[6] = m3[6]; + newDst[7] = 0; + newDst[8] = m3[8]; + newDst[9] = m3[9]; + newDst[10] = m3[10]; + newDst[11] = 0; + newDst[12] = 0; + newDst[13] = 0; + newDst[14] = 0; + newDst[15] = 1; + return newDst; } /** * Creates a Mat4 rotation matrix from a quaternion @@ -2767,7 +2610,7 @@ * @returns Mat4 made from q */ function fromQuat(q, dst) { - dst = dst || new MatType(16); + const newDst = (dst ?? new Ctor(16)); const x = q[0]; const y = q[1]; const z = q[2]; @@ -2784,23 +2627,23 @@ const wx = w * x2; const wy = w * y2; const wz = w * z2; - dst[0] = 1 - yy - zz; - dst[1] = yx + wz; - dst[2] = zx - wy; - dst[3] = 0; - dst[4] = yx - wz; - dst[5] = 1 - xx - zz; - dst[6] = zy + wx; - dst[7] = 0; - dst[8] = zx + wy; - dst[9] = zy - wx; - dst[10] = 1 - xx - yy; - dst[11] = 0; - dst[12] = 0; - dst[13] = 0; - dst[14] = 0; - dst[15] = 1; - return dst; + newDst[0] = 1 - yy - zz; + newDst[1] = yx + wz; + newDst[2] = zx - wy; + newDst[3] = 0; + newDst[4] = yx - wz; + newDst[5] = 1 - xx - zz; + newDst[6] = zy + wx; + newDst[7] = 0; + newDst[8] = zx + wy; + newDst[9] = zy - wx; + newDst[10] = 1 - xx - yy; + newDst[11] = 0; + newDst[12] = 0; + newDst[13] = 0; + newDst[14] = 0; + newDst[15] = 1; + return newDst; } /** * Negates a matrix. @@ -2808,25 +2651,25 @@ * @param dst - matrix to hold result. If not passed a new one is created. * @returns -m. */ - function negate$1(m, dst) { - dst = dst || new MatType(16); - dst[0] = -m[0]; - dst[1] = -m[1]; - dst[2] = -m[2]; - dst[3] = -m[3]; - dst[4] = -m[4]; - dst[5] = -m[5]; - dst[6] = -m[6]; - dst[7] = -m[7]; - dst[8] = -m[8]; - dst[9] = -m[9]; - dst[10] = -m[10]; - dst[11] = -m[11]; - dst[12] = -m[12]; - dst[13] = -m[13]; - dst[14] = -m[14]; - dst[15] = -m[15]; - return dst; + function negate(m, dst) { + const newDst = (dst ?? new Ctor(16)); + newDst[0] = -m[0]; + newDst[1] = -m[1]; + newDst[2] = -m[2]; + newDst[3] = -m[3]; + newDst[4] = -m[4]; + newDst[5] = -m[5]; + newDst[6] = -m[6]; + newDst[7] = -m[7]; + newDst[8] = -m[8]; + newDst[9] = -m[9]; + newDst[10] = -m[10]; + newDst[11] = -m[11]; + newDst[12] = -m[12]; + newDst[13] = -m[13]; + newDst[14] = -m[14]; + newDst[15] = -m[15]; + return newDst; } /** * Copies a matrix. (same as {@link mat4.clone}) @@ -2835,25 +2678,25 @@ * @param dst - The matrix. If not passed a new one is created. * @returns A copy of m. */ - function copy$2(m, dst) { - dst = dst || new MatType(16); - dst[0] = m[0]; - dst[1] = m[1]; - dst[2] = m[2]; - dst[3] = m[3]; - dst[4] = m[4]; - dst[5] = m[5]; - dst[6] = m[6]; - dst[7] = m[7]; - dst[8] = m[8]; - dst[9] = m[9]; - dst[10] = m[10]; - dst[11] = m[11]; - dst[12] = m[12]; - dst[13] = m[13]; - dst[14] = m[14]; - dst[15] = m[15]; - return dst; + function copy(m, dst) { + const newDst = (dst ?? new Ctor(16)); + newDst[0] = m[0]; + newDst[1] = m[1]; + newDst[2] = m[2]; + newDst[3] = m[3]; + newDst[4] = m[4]; + newDst[5] = m[5]; + newDst[6] = m[6]; + newDst[7] = m[7]; + newDst[8] = m[8]; + newDst[9] = m[9]; + newDst[10] = m[10]; + newDst[11] = m[11]; + newDst[12] = m[12]; + newDst[13] = m[13]; + newDst[14] = m[14]; + newDst[15] = m[15]; + return newDst; } /** * Copies a matrix (same as {@link mat4.copy}) @@ -2862,14 +2705,14 @@ * @param dst - The matrix. If not passed a new one is created. * @returns A copy of m. */ - const clone$2 = copy$2; + const clone = copy; /** * Check if 2 matrices are approximately equal * @param a - Operand matrix. * @param b - Operand matrix. * @returns true if matrices are approximately equal */ - function equalsApproximately$2(a, b) { + function equalsApproximately(a, b) { return Math.abs(a[0] - b[0]) < EPSILON && Math.abs(a[1] - b[1]) < EPSILON && Math.abs(a[2] - b[2]) < EPSILON && @@ -2893,7 +2736,7 @@ * @param b - Operand matrix. * @returns true if matrices are exactly equal */ - function equals$2(a, b) { + function equals(a, b) { return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && @@ -2917,25 +2760,25 @@ * @param dst - matrix to hold result. If not passed a new one is created. * @returns A 4-by-4 identity matrix. */ - function identity$1(dst) { - dst = dst || new MatType(16); - dst[0] = 1; - dst[1] = 0; - dst[2] = 0; - dst[3] = 0; - dst[4] = 0; - dst[5] = 1; - dst[6] = 0; - dst[7] = 0; - dst[8] = 0; - dst[9] = 0; - dst[10] = 1; - dst[11] = 0; - dst[12] = 0; - dst[13] = 0; - dst[14] = 0; - dst[15] = 1; - return dst; + function identity(dst) { + const newDst = (dst ?? new Ctor(16)); + newDst[0] = 1; + newDst[1] = 0; + newDst[2] = 0; + newDst[3] = 0; + newDst[4] = 0; + newDst[5] = 1; + newDst[6] = 0; + newDst[7] = 0; + newDst[8] = 0; + newDst[9] = 0; + newDst[10] = 1; + newDst[11] = 0; + newDst[12] = 0; + newDst[13] = 0; + newDst[14] = 0; + newDst[15] = 1; + return newDst; } /** * Takes the transpose of a matrix. @@ -2944,8 +2787,8 @@ * @returns The transpose of m. */ function transpose(m, dst) { - dst = dst || new MatType(16); - if (dst === m) { + const newDst = (dst ?? new Ctor(16)); + if (newDst === m) { let t; t = m[1]; m[1] = m[4]; @@ -2965,7 +2808,7 @@ t = m[11]; m[11] = m[14]; m[14] = t; - return dst; + return newDst; } const m00 = m[0 * 4 + 0]; const m01 = m[0 * 4 + 1]; @@ -2983,23 +2826,23 @@ const m31 = m[3 * 4 + 1]; const m32 = m[3 * 4 + 2]; const m33 = m[3 * 4 + 3]; - dst[0] = m00; - dst[1] = m10; - dst[2] = m20; - dst[3] = m30; - dst[4] = m01; - dst[5] = m11; - dst[6] = m21; - dst[7] = m31; - dst[8] = m02; - dst[9] = m12; - dst[10] = m22; - dst[11] = m32; - dst[12] = m03; - dst[13] = m13; - dst[14] = m23; - dst[15] = m33; - return dst; + newDst[0] = m00; + newDst[1] = m10; + newDst[2] = m20; + newDst[3] = m30; + newDst[4] = m01; + newDst[5] = m11; + newDst[6] = m21; + newDst[7] = m31; + newDst[8] = m02; + newDst[9] = m12; + newDst[10] = m22; + newDst[11] = m32; + newDst[12] = m03; + newDst[13] = m13; + newDst[14] = m23; + newDst[15] = m33; + return newDst; } /** * Computes the inverse of a 4-by-4 matrix. @@ -3007,8 +2850,8 @@ * @param dst - matrix to hold result. If not passed a new one is created. * @returns The inverse of m. */ - function inverse$2(m, dst) { - dst = dst || new MatType(16); + function inverse(m, dst) { + const newDst = (dst ?? new Ctor(16)); const m00 = m[0 * 4 + 0]; const m01 = m[0 * 4 + 1]; const m02 = m[0 * 4 + 2]; @@ -3058,35 +2901,35 @@ const t3 = (tmp5 * m01 + tmp8 * m11 + tmp11 * m21) - (tmp4 * m01 + tmp9 * m11 + tmp10 * m21); const d = 1 / (m00 * t0 + m10 * t1 + m20 * t2 + m30 * t3); - dst[0] = d * t0; - dst[1] = d * t1; - dst[2] = d * t2; - dst[3] = d * t3; - dst[4] = d * ((tmp1 * m10 + tmp2 * m20 + tmp5 * m30) - + newDst[0] = d * t0; + newDst[1] = d * t1; + newDst[2] = d * t2; + newDst[3] = d * t3; + newDst[4] = d * ((tmp1 * m10 + tmp2 * m20 + tmp5 * m30) - (tmp0 * m10 + tmp3 * m20 + tmp4 * m30)); - dst[5] = d * ((tmp0 * m00 + tmp7 * m20 + tmp8 * m30) - + newDst[5] = d * ((tmp0 * m00 + tmp7 * m20 + tmp8 * m30) - (tmp1 * m00 + tmp6 * m20 + tmp9 * m30)); - dst[6] = d * ((tmp3 * m00 + tmp6 * m10 + tmp11 * m30) - + newDst[6] = d * ((tmp3 * m00 + tmp6 * m10 + tmp11 * m30) - (tmp2 * m00 + tmp7 * m10 + tmp10 * m30)); - dst[7] = d * ((tmp4 * m00 + tmp9 * m10 + tmp10 * m20) - + newDst[7] = d * ((tmp4 * m00 + tmp9 * m10 + tmp10 * m20) - (tmp5 * m00 + tmp8 * m10 + tmp11 * m20)); - dst[8] = d * ((tmp12 * m13 + tmp15 * m23 + tmp16 * m33) - + newDst[8] = d * ((tmp12 * m13 + tmp15 * m23 + tmp16 * m33) - (tmp13 * m13 + tmp14 * m23 + tmp17 * m33)); - dst[9] = d * ((tmp13 * m03 + tmp18 * m23 + tmp21 * m33) - + newDst[9] = d * ((tmp13 * m03 + tmp18 * m23 + tmp21 * m33) - (tmp12 * m03 + tmp19 * m23 + tmp20 * m33)); - dst[10] = d * ((tmp14 * m03 + tmp19 * m13 + tmp22 * m33) - + newDst[10] = d * ((tmp14 * m03 + tmp19 * m13 + tmp22 * m33) - (tmp15 * m03 + tmp18 * m13 + tmp23 * m33)); - dst[11] = d * ((tmp17 * m03 + tmp20 * m13 + tmp23 * m23) - + newDst[11] = d * ((tmp17 * m03 + tmp20 * m13 + tmp23 * m23) - (tmp16 * m03 + tmp21 * m13 + tmp22 * m23)); - dst[12] = d * ((tmp14 * m22 + tmp17 * m32 + tmp13 * m12) - + newDst[12] = d * ((tmp14 * m22 + tmp17 * m32 + tmp13 * m12) - (tmp16 * m32 + tmp12 * m12 + tmp15 * m22)); - dst[13] = d * ((tmp20 * m32 + tmp12 * m02 + tmp19 * m22) - + newDst[13] = d * ((tmp20 * m32 + tmp12 * m02 + tmp19 * m22) - (tmp18 * m22 + tmp21 * m32 + tmp13 * m02)); - dst[14] = d * ((tmp18 * m12 + tmp23 * m32 + tmp15 * m02) - + newDst[14] = d * ((tmp18 * m12 + tmp23 * m32 + tmp15 * m02) - (tmp22 * m32 + tmp14 * m02 + tmp19 * m12)); - dst[15] = d * ((tmp22 * m22 + tmp16 * m02 + tmp21 * m12) - + newDst[15] = d * ((tmp22 * m22 + tmp16 * m02 + tmp21 * m12) - (tmp20 * m12 + tmp23 * m22 + tmp17 * m02)); - return dst; + return newDst; } /** * Compute the determinant of a matrix @@ -3138,7 +2981,7 @@ * @param dst - matrix to hold result. If not passed a new one is created. * @returns The inverse of m. */ - const invert$1 = inverse$2; + const invert = inverse; /** * Multiplies two 4-by-4 matrices with a on the left and b on the right * @param a - The matrix on the left. @@ -3146,8 +2989,8 @@ * @param dst - matrix to hold result. If not passed a new one is created. * @returns The matrix product of a and b. */ - function multiply$2(a, b, dst) { - dst = dst || new MatType(16); + function multiply(a, b, dst) { + const newDst = (dst ?? new Ctor(16)); const a00 = a[0]; const a01 = a[1]; const a02 = a[2]; @@ -3180,23 +3023,23 @@ const b31 = b[12 + 1]; const b32 = b[12 + 2]; const b33 = b[12 + 3]; - dst[0] = a00 * b00 + a10 * b01 + a20 * b02 + a30 * b03; - dst[1] = a01 * b00 + a11 * b01 + a21 * b02 + a31 * b03; - dst[2] = a02 * b00 + a12 * b01 + a22 * b02 + a32 * b03; - dst[3] = a03 * b00 + a13 * b01 + a23 * b02 + a33 * b03; - dst[4] = a00 * b10 + a10 * b11 + a20 * b12 + a30 * b13; - dst[5] = a01 * b10 + a11 * b11 + a21 * b12 + a31 * b13; - dst[6] = a02 * b10 + a12 * b11 + a22 * b12 + a32 * b13; - dst[7] = a03 * b10 + a13 * b11 + a23 * b12 + a33 * b13; - dst[8] = a00 * b20 + a10 * b21 + a20 * b22 + a30 * b23; - dst[9] = a01 * b20 + a11 * b21 + a21 * b22 + a31 * b23; - dst[10] = a02 * b20 + a12 * b21 + a22 * b22 + a32 * b23; - dst[11] = a03 * b20 + a13 * b21 + a23 * b22 + a33 * b23; - dst[12] = a00 * b30 + a10 * b31 + a20 * b32 + a30 * b33; - dst[13] = a01 * b30 + a11 * b31 + a21 * b32 + a31 * b33; - dst[14] = a02 * b30 + a12 * b31 + a22 * b32 + a32 * b33; - dst[15] = a03 * b30 + a13 * b31 + a23 * b32 + a33 * b33; - return dst; + newDst[0] = a00 * b00 + a10 * b01 + a20 * b02 + a30 * b03; + newDst[1] = a01 * b00 + a11 * b01 + a21 * b02 + a31 * b03; + newDst[2] = a02 * b00 + a12 * b01 + a22 * b02 + a32 * b03; + newDst[3] = a03 * b00 + a13 * b01 + a23 * b02 + a33 * b03; + newDst[4] = a00 * b10 + a10 * b11 + a20 * b12 + a30 * b13; + newDst[5] = a01 * b10 + a11 * b11 + a21 * b12 + a31 * b13; + newDst[6] = a02 * b10 + a12 * b11 + a22 * b12 + a32 * b13; + newDst[7] = a03 * b10 + a13 * b11 + a23 * b12 + a33 * b13; + newDst[8] = a00 * b20 + a10 * b21 + a20 * b22 + a30 * b23; + newDst[9] = a01 * b20 + a11 * b21 + a21 * b22 + a31 * b23; + newDst[10] = a02 * b20 + a12 * b21 + a22 * b22 + a32 * b23; + newDst[11] = a03 * b20 + a13 * b21 + a23 * b22 + a33 * b23; + newDst[12] = a00 * b30 + a10 * b31 + a20 * b32 + a30 * b33; + newDst[13] = a01 * b30 + a11 * b31 + a21 * b32 + a31 * b33; + newDst[14] = a02 * b30 + a12 * b31 + a22 * b32 + a32 * b33; + newDst[15] = a03 * b30 + a13 * b31 + a23 * b32 + a33 * b33; + return newDst; } /** * Multiplies two 4-by-4 matrices with a on the left and b on the right (same as multiply) @@ -3205,7 +3048,7 @@ * @param dst - matrix to hold result. If not passed a new one is created. * @returns The matrix product of a and b. */ - const mul$2 = multiply$2; + const mul = multiply; /** * Sets the translation component of a 4-by-4 matrix to the given * vector. @@ -3215,40 +3058,40 @@ * @returns The matrix with translation set. */ function setTranslation(a, v, dst) { - dst = dst || identity$1(); - if (a !== dst) { - dst[0] = a[0]; - dst[1] = a[1]; - dst[2] = a[2]; - dst[3] = a[3]; - dst[4] = a[4]; - dst[5] = a[5]; - dst[6] = a[6]; - dst[7] = a[7]; - dst[8] = a[8]; - dst[9] = a[9]; - dst[10] = a[10]; - dst[11] = a[11]; + const newDst = (dst ?? identity()); + if (a !== newDst) { + newDst[0] = a[0]; + newDst[1] = a[1]; + newDst[2] = a[2]; + newDst[3] = a[3]; + newDst[4] = a[4]; + newDst[5] = a[5]; + newDst[6] = a[6]; + newDst[7] = a[7]; + newDst[8] = a[8]; + newDst[9] = a[9]; + newDst[10] = a[10]; + newDst[11] = a[11]; } - dst[12] = v[0]; - dst[13] = v[1]; - dst[14] = v[2]; - dst[15] = 1; - return dst; - } - /** - * Returns the translation component of a 4-by-4 matrix as a vector with 3 - * entries. - * @param m - The matrix. - * @param dst - vector to hold result. If not passed a new one is created. - * @returns The translation component of m. - */ + newDst[12] = v[0]; + newDst[13] = v[1]; + newDst[14] = v[2]; + newDst[15] = 1; + return newDst; + } + ///** + // * Returns the translation component of a 4-by-4 matrix as a vector with 3 + // * entries. + // * @param m - The matrix. + // * @param dst - vector to hold result. If not passed a new one is created. + // * @returns The translation component of m. + // */ function getTranslation(m, dst) { - dst = dst || create$4(); - dst[0] = m[12]; - dst[1] = m[13]; - dst[2] = m[14]; - return dst; + const newDst = (dst ?? vec3.create()); + newDst[0] = m[12]; + newDst[1] = m[13]; + newDst[2] = m[14]; + return newDst; } /** * Returns an axis of a 4x4 matrix as a vector with 3 entries @@ -3257,12 +3100,12 @@ * @returns The axis component of m. */ function getAxis(m, axis, dst) { - dst = dst || create$4(); + const newDst = (dst ?? vec3.create()); const off = axis * 4; - dst[0] = m[off + 0]; - dst[1] = m[off + 1]; - dst[2] = m[off + 2]; - return dst; + newDst[0] = m[off + 0]; + newDst[1] = m[off + 1]; + newDst[2] = m[off + 2]; + return newDst; } /** * Sets an axis of a 4x4 matrix as a vector with 3 entries @@ -3273,22 +3116,20 @@ * @returns The matrix with axis set. */ function setAxis(m, v, axis, dst) { - if (dst !== m) { - dst = copy$2(m, dst); - } + const newDst = (dst === m) ? dst : copy(m, dst); const off = axis * 4; - dst[off + 0] = v[0]; - dst[off + 1] = v[1]; - dst[off + 2] = v[2]; - return dst; - } - /** - * Returns the scaling component of the matrix - * @param m - The Matrix - * @param dst - The vector to set. If not passed a new one is created. - */ + newDst[off + 0] = v[0]; + newDst[off + 1] = v[1]; + newDst[off + 2] = v[2]; + return newDst; + } + ///** + // * Returns the scaling component of the matrix + // * @param m - The Matrix + // * @param dst - The vector to set. If not passed a new one is created. + // */ function getScaling(m, dst) { - dst = dst || create$4(); + const newDst = (dst ?? vec3.create()); const xx = m[0]; const xy = m[1]; const xz = m[2]; @@ -3298,10 +3139,10 @@ const zx = m[8]; const zy = m[9]; const zz = m[10]; - dst[0] = Math.sqrt(xx * xx + xy * xy + xz * xz); - dst[1] = Math.sqrt(yx * yx + yy * yy + yz * yz); - dst[2] = Math.sqrt(zx * zx + zy * zy + zz * zz); - return dst; + newDst[0] = Math.sqrt(xx * xx + xy * xy + xz * xz); + newDst[1] = Math.sqrt(yx * yx + yy * yy + yz * yz); + newDst[2] = Math.sqrt(zx * zx + zy * zy + zz * zz); + return newDst; } /** * Computes a 4-by-4 perspective transformation matrix given the angular height @@ -3329,32 +3170,32 @@ * @returns The perspective matrix. */ function perspective(fieldOfViewYInRadians, aspect, zNear, zFar, dst) { - dst = dst || new MatType(16); + const newDst = (dst ?? new Ctor(16)); const f = Math.tan(Math.PI * 0.5 - 0.5 * fieldOfViewYInRadians); - dst[0] = f / aspect; - dst[1] = 0; - dst[2] = 0; - dst[3] = 0; - dst[4] = 0; - dst[5] = f; - dst[6] = 0; - dst[7] = 0; - dst[8] = 0; - dst[9] = 0; - dst[11] = -1; - dst[12] = 0; - dst[13] = 0; - dst[15] = 0; + newDst[0] = f / aspect; + newDst[1] = 0; + newDst[2] = 0; + newDst[3] = 0; + newDst[4] = 0; + newDst[5] = f; + newDst[6] = 0; + newDst[7] = 0; + newDst[8] = 0; + newDst[9] = 0; + newDst[11] = -1; + newDst[12] = 0; + newDst[13] = 0; + newDst[15] = 0; if (Number.isFinite(zFar)) { const rangeInv = 1 / (zNear - zFar); - dst[10] = zFar * rangeInv; - dst[14] = zFar * zNear * rangeInv; + newDst[10] = zFar * rangeInv; + newDst[14] = zFar * zNear * rangeInv; } else { - dst[10] = -1; - dst[14] = -zNear; + newDst[10] = -1; + newDst[14] = -zNear; } - return dst; + return newDst; } /** * Computes a 4-by-4 reverse-z perspective transformation matrix given the angular height @@ -3377,32 +3218,32 @@ * @param dst - matrix to hold result. If not passed a new one is created. * @returns The perspective matrix. */ function perspectiveReverseZ(fieldOfViewYInRadians, aspect, zNear, zFar = Infinity, dst) { - dst = dst || new MatType(16); + const newDst = (dst ?? new Ctor(16)); const f = 1 / Math.tan(fieldOfViewYInRadians * 0.5); - dst[0] = f / aspect; - dst[1] = 0; - dst[2] = 0; - dst[3] = 0; - dst[4] = 0; - dst[5] = f; - dst[6] = 0; - dst[7] = 0; - dst[8] = 0; - dst[9] = 0; - dst[11] = -1; - dst[12] = 0; - dst[13] = 0; - dst[15] = 0; + newDst[0] = f / aspect; + newDst[1] = 0; + newDst[2] = 0; + newDst[3] = 0; + newDst[4] = 0; + newDst[5] = f; + newDst[6] = 0; + newDst[7] = 0; + newDst[8] = 0; + newDst[9] = 0; + newDst[11] = -1; + newDst[12] = 0; + newDst[13] = 0; + newDst[15] = 0; if (zFar === Infinity) { - dst[10] = 0; - dst[14] = zNear; + newDst[10] = 0; + newDst[14] = zNear; } else { const rangeInv = 1 / (zFar - zNear); - dst[10] = zNear * rangeInv; - dst[14] = zFar * zNear * rangeInv; + newDst[10] = zNear * rangeInv; + newDst[14] = zFar * zNear * rangeInv; } - return dst; + return newDst; } /** * Computes a 4-by-4 orthogonal transformation matrix that transforms from @@ -3420,24 +3261,24 @@ * @returns The orthographic projection matrix. */ function ortho(left, right, bottom, top, near, far, dst) { - dst = dst || new MatType(16); - dst[0] = 2 / (right - left); - dst[1] = 0; - dst[2] = 0; - dst[3] = 0; - dst[4] = 0; - dst[5] = 2 / (top - bottom); - dst[6] = 0; - dst[7] = 0; - dst[8] = 0; - dst[9] = 0; - dst[10] = 1 / (near - far); - dst[11] = 0; - dst[12] = (right + left) / (left - right); - dst[13] = (top + bottom) / (bottom - top); - dst[14] = near / (near - far); - dst[15] = 1; - return dst; + const newDst = (dst ?? new Ctor(16)); + newDst[0] = 2 / (right - left); + newDst[1] = 0; + newDst[2] = 0; + newDst[3] = 0; + newDst[4] = 0; + newDst[5] = 2 / (top - bottom); + newDst[6] = 0; + newDst[7] = 0; + newDst[8] = 0; + newDst[9] = 0; + newDst[10] = 1 / (near - far); + newDst[11] = 0; + newDst[12] = (right + left) / (left - right); + newDst[13] = (top + bottom) / (bottom - top); + newDst[14] = near / (near - far); + newDst[15] = 1; + return newDst; } /** * Computes a 4-by-4 perspective transformation matrix given the left, right, @@ -3458,27 +3299,27 @@ * @returns The perspective projection matrix. */ function frustum(left, right, bottom, top, near, far, dst) { - dst = dst || new MatType(16); + const newDst = (dst ?? new Ctor(16)); const dx = (right - left); const dy = (top - bottom); const dz = (near - far); - dst[0] = 2 * near / dx; - dst[1] = 0; - dst[2] = 0; - dst[3] = 0; - dst[4] = 0; - dst[5] = 2 * near / dy; - dst[6] = 0; - dst[7] = 0; - dst[8] = (left + right) / dx; - dst[9] = (top + bottom) / dy; - dst[10] = far / dz; - dst[11] = -1; - dst[12] = 0; - dst[13] = 0; - dst[14] = near * far / dz; - dst[15] = 0; - return dst; + newDst[0] = 2 * near / dx; + newDst[1] = 0; + newDst[2] = 0; + newDst[3] = 0; + newDst[4] = 0; + newDst[5] = 2 * near / dy; + newDst[6] = 0; + newDst[7] = 0; + newDst[8] = (left + right) / dx; + newDst[9] = (top + bottom) / dy; + newDst[10] = far / dz; + newDst[11] = -1; + newDst[12] = 0; + newDst[13] = 0; + newDst[14] = near * far / dz; + newDst[15] = 0; + return newDst; } /** * Computes a 4-by-4 reverse-z perspective transformation matrix given the left, right, @@ -3499,37 +3340,37 @@ * @returns The perspective projection matrix. */ function frustumReverseZ(left, right, bottom, top, near, far = Infinity, dst) { - dst = dst || new MatType(16); + const newDst = (dst ?? new Ctor(16)); const dx = (right - left); const dy = (top - bottom); - dst[0] = 2 * near / dx; - dst[1] = 0; - dst[2] = 0; - dst[3] = 0; - dst[4] = 0; - dst[5] = 2 * near / dy; - dst[6] = 0; - dst[7] = 0; - dst[8] = (left + right) / dx; - dst[9] = (top + bottom) / dy; - dst[11] = -1; - dst[12] = 0; - dst[13] = 0; - dst[15] = 0; + newDst[0] = 2 * near / dx; + newDst[1] = 0; + newDst[2] = 0; + newDst[3] = 0; + newDst[4] = 0; + newDst[5] = 2 * near / dy; + newDst[6] = 0; + newDst[7] = 0; + newDst[8] = (left + right) / dx; + newDst[9] = (top + bottom) / dy; + newDst[11] = -1; + newDst[12] = 0; + newDst[13] = 0; + newDst[15] = 0; if (far === Infinity) { - dst[10] = 0; - dst[14] = near; + newDst[10] = 0; + newDst[14] = near; } else { const rangeInv = 1 / (far - near); - dst[10] = near * rangeInv; - dst[14] = far * near * rangeInv; + newDst[10] = near * rangeInv; + newDst[14] = far * near * rangeInv; } - return dst; + return newDst; } - let xAxis; - let yAxis; - let zAxis; + const xAxis = vec3.create(); + const yAxis = vec3.create(); + const zAxis = vec3.create(); /** * Computes a 4-by-4 aim transformation. * @@ -3545,30 +3386,27 @@ * @returns The aim matrix. */ function aim(position, target, up, dst) { - dst = dst || new MatType(16); - xAxis = xAxis || create$4(); - yAxis = yAxis || create$4(); - zAxis = zAxis || create$4(); - normalize$2(subtract$2(target, position, zAxis), zAxis); - normalize$2(cross(up, zAxis, xAxis), xAxis); - normalize$2(cross(zAxis, xAxis, yAxis), yAxis); - dst[0] = xAxis[0]; - dst[1] = xAxis[1]; - dst[2] = xAxis[2]; - dst[3] = 0; - dst[4] = yAxis[0]; - dst[5] = yAxis[1]; - dst[6] = yAxis[2]; - dst[7] = 0; - dst[8] = zAxis[0]; - dst[9] = zAxis[1]; - dst[10] = zAxis[2]; - dst[11] = 0; - dst[12] = position[0]; - dst[13] = position[1]; - dst[14] = position[2]; - dst[15] = 1; - return dst; + const newDst = (dst ?? new Ctor(16)); + vec3.normalize(vec3.subtract(target, position, zAxis), zAxis); + vec3.normalize(vec3.cross(up, zAxis, xAxis), xAxis); + vec3.normalize(vec3.cross(zAxis, xAxis, yAxis), yAxis); + newDst[0] = xAxis[0]; + newDst[1] = xAxis[1]; + newDst[2] = xAxis[2]; + newDst[3] = 0; + newDst[4] = yAxis[0]; + newDst[5] = yAxis[1]; + newDst[6] = yAxis[2]; + newDst[7] = 0; + newDst[8] = zAxis[0]; + newDst[9] = zAxis[1]; + newDst[10] = zAxis[2]; + newDst[11] = 0; + newDst[12] = position[0]; + newDst[13] = position[1]; + newDst[14] = position[2]; + newDst[15] = 1; + return newDst; } /** * Computes a 4-by-4 camera aim transformation. @@ -3585,30 +3423,27 @@ * @returns The aim matrix. */ function cameraAim(eye, target, up, dst) { - dst = dst || new MatType(16); - xAxis = xAxis || create$4(); - yAxis = yAxis || create$4(); - zAxis = zAxis || create$4(); - normalize$2(subtract$2(eye, target, zAxis), zAxis); - normalize$2(cross(up, zAxis, xAxis), xAxis); - normalize$2(cross(zAxis, xAxis, yAxis), yAxis); - dst[0] = xAxis[0]; - dst[1] = xAxis[1]; - dst[2] = xAxis[2]; - dst[3] = 0; - dst[4] = yAxis[0]; - dst[5] = yAxis[1]; - dst[6] = yAxis[2]; - dst[7] = 0; - dst[8] = zAxis[0]; - dst[9] = zAxis[1]; - dst[10] = zAxis[2]; - dst[11] = 0; - dst[12] = eye[0]; - dst[13] = eye[1]; - dst[14] = eye[2]; - dst[15] = 1; - return dst; + const newDst = (dst ?? new Ctor(16)); + vec3.normalize(vec3.subtract(eye, target, zAxis), zAxis); + vec3.normalize(vec3.cross(up, zAxis, xAxis), xAxis); + vec3.normalize(vec3.cross(zAxis, xAxis, yAxis), yAxis); + newDst[0] = xAxis[0]; + newDst[1] = xAxis[1]; + newDst[2] = xAxis[2]; + newDst[3] = 0; + newDst[4] = yAxis[0]; + newDst[5] = yAxis[1]; + newDst[6] = yAxis[2]; + newDst[7] = 0; + newDst[8] = zAxis[0]; + newDst[9] = zAxis[1]; + newDst[10] = zAxis[2]; + newDst[11] = 0; + newDst[12] = eye[0]; + newDst[13] = eye[1]; + newDst[14] = eye[2]; + newDst[15] = 1; + return newDst; } /** * Computes a 4-by-4 view transformation. @@ -3623,30 +3458,27 @@ * @returns The look-at matrix. */ function lookAt(eye, target, up, dst) { - dst = dst || new MatType(16); - xAxis = xAxis || create$4(); - yAxis = yAxis || create$4(); - zAxis = zAxis || create$4(); - normalize$2(subtract$2(eye, target, zAxis), zAxis); - normalize$2(cross(up, zAxis, xAxis), xAxis); - normalize$2(cross(zAxis, xAxis, yAxis), yAxis); - dst[0] = xAxis[0]; - dst[1] = yAxis[0]; - dst[2] = zAxis[0]; - dst[3] = 0; - dst[4] = xAxis[1]; - dst[5] = yAxis[1]; - dst[6] = zAxis[1]; - dst[7] = 0; - dst[8] = xAxis[2]; - dst[9] = yAxis[2]; - dst[10] = zAxis[2]; - dst[11] = 0; - dst[12] = -(xAxis[0] * eye[0] + xAxis[1] * eye[1] + xAxis[2] * eye[2]); - dst[13] = -(yAxis[0] * eye[0] + yAxis[1] * eye[1] + yAxis[2] * eye[2]); - dst[14] = -(zAxis[0] * eye[0] + zAxis[1] * eye[1] + zAxis[2] * eye[2]); - dst[15] = 1; - return dst; + const newDst = (dst ?? new Ctor(16)); + vec3.normalize(vec3.subtract(eye, target, zAxis), zAxis); + vec3.normalize(vec3.cross(up, zAxis, xAxis), xAxis); + vec3.normalize(vec3.cross(zAxis, xAxis, yAxis), yAxis); + newDst[0] = xAxis[0]; + newDst[1] = yAxis[0]; + newDst[2] = zAxis[0]; + newDst[3] = 0; + newDst[4] = xAxis[1]; + newDst[5] = yAxis[1]; + newDst[6] = zAxis[1]; + newDst[7] = 0; + newDst[8] = xAxis[2]; + newDst[9] = yAxis[2]; + newDst[10] = zAxis[2]; + newDst[11] = 0; + newDst[12] = -(xAxis[0] * eye[0] + xAxis[1] * eye[1] + xAxis[2] * eye[2]); + newDst[13] = -(yAxis[0] * eye[0] + yAxis[1] * eye[1] + yAxis[2] * eye[2]); + newDst[14] = -(zAxis[0] * eye[0] + zAxis[1] * eye[1] + zAxis[2] * eye[2]); + newDst[15] = 1; + return newDst; } /** * Creates a 4-by-4 matrix which translates by the given vector v. @@ -3656,24 +3488,24 @@ * @returns The translation matrix. */ function translation(v, dst) { - dst = dst || new MatType(16); - dst[0] = 1; - dst[1] = 0; - dst[2] = 0; - dst[3] = 0; - dst[4] = 0; - dst[5] = 1; - dst[6] = 0; - dst[7] = 0; - dst[8] = 0; - dst[9] = 0; - dst[10] = 1; - dst[11] = 0; - dst[12] = v[0]; - dst[13] = v[1]; - dst[14] = v[2]; - dst[15] = 1; - return dst; + const newDst = (dst ?? new Ctor(16)); + newDst[0] = 1; + newDst[1] = 0; + newDst[2] = 0; + newDst[3] = 0; + newDst[4] = 0; + newDst[5] = 1; + newDst[6] = 0; + newDst[7] = 0; + newDst[8] = 0; + newDst[9] = 0; + newDst[10] = 1; + newDst[11] = 0; + newDst[12] = v[0]; + newDst[13] = v[1]; + newDst[14] = v[2]; + newDst[15] = 1; + return newDst; } /** * Translates the given 4-by-4 matrix by the given vector v. @@ -3684,7 +3516,7 @@ * @returns The translated matrix. */ function translate(m, v, dst) { - dst = dst || new MatType(16); + const newDst = (dst ?? new Ctor(16)); const v0 = v[0]; const v1 = v[1]; const v2 = v[2]; @@ -3704,25 +3536,25 @@ const m31 = m[3 * 4 + 1]; const m32 = m[3 * 4 + 2]; const m33 = m[3 * 4 + 3]; - if (m !== dst) { - dst[0] = m00; - dst[1] = m01; - dst[2] = m02; - dst[3] = m03; - dst[4] = m10; - dst[5] = m11; - dst[6] = m12; - dst[7] = m13; - dst[8] = m20; - dst[9] = m21; - dst[10] = m22; - dst[11] = m23; + if (m !== newDst) { + newDst[0] = m00; + newDst[1] = m01; + newDst[2] = m02; + newDst[3] = m03; + newDst[4] = m10; + newDst[5] = m11; + newDst[6] = m12; + newDst[7] = m13; + newDst[8] = m20; + newDst[9] = m21; + newDst[10] = m22; + newDst[11] = m23; } - dst[12] = m00 * v0 + m10 * v1 + m20 * v2 + m30; - dst[13] = m01 * v0 + m11 * v1 + m21 * v2 + m31; - dst[14] = m02 * v0 + m12 * v1 + m22 * v2 + m32; - dst[15] = m03 * v0 + m13 * v1 + m23 * v2 + m33; - return dst; + newDst[12] = m00 * v0 + m10 * v1 + m20 * v2 + m30; + newDst[13] = m01 * v0 + m11 * v1 + m21 * v2 + m31; + newDst[14] = m02 * v0 + m12 * v1 + m22 * v2 + m32; + newDst[15] = m03 * v0 + m13 * v1 + m23 * v2 + m33; + return newDst; } /** * Creates a 4-by-4 matrix which rotates around the x-axis by the given angle. @@ -3731,26 +3563,26 @@ * @returns The rotation matrix. */ function rotationX(angleInRadians, dst) { - dst = dst || new MatType(16); + const newDst = (dst ?? new Ctor(16)); const c = Math.cos(angleInRadians); const s = Math.sin(angleInRadians); - dst[0] = 1; - dst[1] = 0; - dst[2] = 0; - dst[3] = 0; - dst[4] = 0; - dst[5] = c; - dst[6] = s; - dst[7] = 0; - dst[8] = 0; - dst[9] = -s; - dst[10] = c; - dst[11] = 0; - dst[12] = 0; - dst[13] = 0; - dst[14] = 0; - dst[15] = 1; - return dst; + newDst[0] = 1; + newDst[1] = 0; + newDst[2] = 0; + newDst[3] = 0; + newDst[4] = 0; + newDst[5] = c; + newDst[6] = s; + newDst[7] = 0; + newDst[8] = 0; + newDst[9] = -s; + newDst[10] = c; + newDst[11] = 0; + newDst[12] = 0; + newDst[13] = 0; + newDst[14] = 0; + newDst[15] = 1; + return newDst; } /** * Rotates the given 4-by-4 matrix around the x-axis by the given @@ -3760,8 +3592,8 @@ * @param dst - matrix to hold result. If not passed a new one is created. * @returns The rotated matrix. */ - function rotateX$1(m, angleInRadians, dst) { - dst = dst || new MatType(16); + function rotateX(m, angleInRadians, dst) { + const newDst = (dst ?? new Ctor(16)); const m10 = m[4]; const m11 = m[5]; const m12 = m[6]; @@ -3772,25 +3604,25 @@ const m23 = m[11]; const c = Math.cos(angleInRadians); const s = Math.sin(angleInRadians); - dst[4] = c * m10 + s * m20; - dst[5] = c * m11 + s * m21; - dst[6] = c * m12 + s * m22; - dst[7] = c * m13 + s * m23; - dst[8] = c * m20 - s * m10; - dst[9] = c * m21 - s * m11; - dst[10] = c * m22 - s * m12; - dst[11] = c * m23 - s * m13; - if (m !== dst) { - dst[0] = m[0]; - dst[1] = m[1]; - dst[2] = m[2]; - dst[3] = m[3]; - dst[12] = m[12]; - dst[13] = m[13]; - dst[14] = m[14]; - dst[15] = m[15]; + newDst[4] = c * m10 + s * m20; + newDst[5] = c * m11 + s * m21; + newDst[6] = c * m12 + s * m22; + newDst[7] = c * m13 + s * m23; + newDst[8] = c * m20 - s * m10; + newDst[9] = c * m21 - s * m11; + newDst[10] = c * m22 - s * m12; + newDst[11] = c * m23 - s * m13; + if (m !== newDst) { + newDst[0] = m[0]; + newDst[1] = m[1]; + newDst[2] = m[2]; + newDst[3] = m[3]; + newDst[12] = m[12]; + newDst[13] = m[13]; + newDst[14] = m[14]; + newDst[15] = m[15]; } - return dst; + return newDst; } /** * Creates a 4-by-4 matrix which rotates around the y-axis by the given angle. @@ -3799,26 +3631,26 @@ * @returns The rotation matrix. */ function rotationY(angleInRadians, dst) { - dst = dst || new MatType(16); + const newDst = (dst ?? new Ctor(16)); const c = Math.cos(angleInRadians); const s = Math.sin(angleInRadians); - dst[0] = c; - dst[1] = 0; - dst[2] = -s; - dst[3] = 0; - dst[4] = 0; - dst[5] = 1; - dst[6] = 0; - dst[7] = 0; - dst[8] = s; - dst[9] = 0; - dst[10] = c; - dst[11] = 0; - dst[12] = 0; - dst[13] = 0; - dst[14] = 0; - dst[15] = 1; - return dst; + newDst[0] = c; + newDst[1] = 0; + newDst[2] = -s; + newDst[3] = 0; + newDst[4] = 0; + newDst[5] = 1; + newDst[6] = 0; + newDst[7] = 0; + newDst[8] = s; + newDst[9] = 0; + newDst[10] = c; + newDst[11] = 0; + newDst[12] = 0; + newDst[13] = 0; + newDst[14] = 0; + newDst[15] = 1; + return newDst; } /** * Rotates the given 4-by-4 matrix around the y-axis by the given @@ -3828,8 +3660,8 @@ * @param dst - matrix to hold result. If not passed a new one is created. * @returns The rotated matrix. */ - function rotateY$1(m, angleInRadians, dst) { - dst = dst || new MatType(16); + function rotateY(m, angleInRadians, dst) { + const newDst = (dst ?? new Ctor(16)); const m00 = m[0 * 4 + 0]; const m01 = m[0 * 4 + 1]; const m02 = m[0 * 4 + 2]; @@ -3840,25 +3672,25 @@ const m23 = m[2 * 4 + 3]; const c = Math.cos(angleInRadians); const s = Math.sin(angleInRadians); - dst[0] = c * m00 - s * m20; - dst[1] = c * m01 - s * m21; - dst[2] = c * m02 - s * m22; - dst[3] = c * m03 - s * m23; - dst[8] = c * m20 + s * m00; - dst[9] = c * m21 + s * m01; - dst[10] = c * m22 + s * m02; - dst[11] = c * m23 + s * m03; - if (m !== dst) { - dst[4] = m[4]; - dst[5] = m[5]; - dst[6] = m[6]; - dst[7] = m[7]; - dst[12] = m[12]; - dst[13] = m[13]; - dst[14] = m[14]; - dst[15] = m[15]; + newDst[0] = c * m00 - s * m20; + newDst[1] = c * m01 - s * m21; + newDst[2] = c * m02 - s * m22; + newDst[3] = c * m03 - s * m23; + newDst[8] = c * m20 + s * m00; + newDst[9] = c * m21 + s * m01; + newDst[10] = c * m22 + s * m02; + newDst[11] = c * m23 + s * m03; + if (m !== newDst) { + newDst[4] = m[4]; + newDst[5] = m[5]; + newDst[6] = m[6]; + newDst[7] = m[7]; + newDst[12] = m[12]; + newDst[13] = m[13]; + newDst[14] = m[14]; + newDst[15] = m[15]; } - return dst; + return newDst; } /** * Creates a 4-by-4 matrix which rotates around the z-axis by the given angle. @@ -3867,26 +3699,26 @@ * @returns The rotation matrix. */ function rotationZ(angleInRadians, dst) { - dst = dst || new MatType(16); + const newDst = (dst ?? new Ctor(16)); const c = Math.cos(angleInRadians); const s = Math.sin(angleInRadians); - dst[0] = c; - dst[1] = s; - dst[2] = 0; - dst[3] = 0; - dst[4] = -s; - dst[5] = c; - dst[6] = 0; - dst[7] = 0; - dst[8] = 0; - dst[9] = 0; - dst[10] = 1; - dst[11] = 0; - dst[12] = 0; - dst[13] = 0; - dst[14] = 0; - dst[15] = 1; - return dst; + newDst[0] = c; + newDst[1] = s; + newDst[2] = 0; + newDst[3] = 0; + newDst[4] = -s; + newDst[5] = c; + newDst[6] = 0; + newDst[7] = 0; + newDst[8] = 0; + newDst[9] = 0; + newDst[10] = 1; + newDst[11] = 0; + newDst[12] = 0; + newDst[13] = 0; + newDst[14] = 0; + newDst[15] = 1; + return newDst; } /** * Rotates the given 4-by-4 matrix around the z-axis by the given @@ -3896,8 +3728,8 @@ * @param dst - matrix to hold result. If not passed a new one is created. * @returns The rotated matrix. */ - function rotateZ$1(m, angleInRadians, dst) { - dst = dst || new MatType(16); + function rotateZ(m, angleInRadians, dst) { + const newDst = (dst ?? new Ctor(16)); const m00 = m[0 * 4 + 0]; const m01 = m[0 * 4 + 1]; const m02 = m[0 * 4 + 2]; @@ -3908,25 +3740,25 @@ const m13 = m[1 * 4 + 3]; const c = Math.cos(angleInRadians); const s = Math.sin(angleInRadians); - dst[0] = c * m00 + s * m10; - dst[1] = c * m01 + s * m11; - dst[2] = c * m02 + s * m12; - dst[3] = c * m03 + s * m13; - dst[4] = c * m10 - s * m00; - dst[5] = c * m11 - s * m01; - dst[6] = c * m12 - s * m02; - dst[7] = c * m13 - s * m03; - if (m !== dst) { - dst[8] = m[8]; - dst[9] = m[9]; - dst[10] = m[10]; - dst[11] = m[11]; - dst[12] = m[12]; - dst[13] = m[13]; - dst[14] = m[14]; - dst[15] = m[15]; + newDst[0] = c * m00 + s * m10; + newDst[1] = c * m01 + s * m11; + newDst[2] = c * m02 + s * m12; + newDst[3] = c * m03 + s * m13; + newDst[4] = c * m10 - s * m00; + newDst[5] = c * m11 - s * m01; + newDst[6] = c * m12 - s * m02; + newDst[7] = c * m13 - s * m03; + if (m !== newDst) { + newDst[8] = m[8]; + newDst[9] = m[9]; + newDst[10] = m[10]; + newDst[11] = m[11]; + newDst[12] = m[12]; + newDst[13] = m[13]; + newDst[14] = m[14]; + newDst[15] = m[15]; } - return dst; + return newDst; } /** * Creates a 4-by-4 matrix which rotates around the given axis by the given @@ -3939,7 +3771,7 @@ * around the axis. */ function axisRotation(axis, angleInRadians, dst) { - dst = dst || new MatType(16); + const newDst = (dst ?? new Ctor(16)); let x = axis[0]; let y = axis[1]; let z = axis[2]; @@ -3953,23 +3785,23 @@ const c = Math.cos(angleInRadians); const s = Math.sin(angleInRadians); const oneMinusCosine = 1 - c; - dst[0] = xx + (1 - xx) * c; - dst[1] = x * y * oneMinusCosine + z * s; - dst[2] = x * z * oneMinusCosine - y * s; - dst[3] = 0; - dst[4] = x * y * oneMinusCosine - z * s; - dst[5] = yy + (1 - yy) * c; - dst[6] = y * z * oneMinusCosine + x * s; - dst[7] = 0; - dst[8] = x * z * oneMinusCosine + y * s; - dst[9] = y * z * oneMinusCosine - x * s; - dst[10] = zz + (1 - zz) * c; - dst[11] = 0; - dst[12] = 0; - dst[13] = 0; - dst[14] = 0; - dst[15] = 1; - return dst; + newDst[0] = xx + (1 - xx) * c; + newDst[1] = x * y * oneMinusCosine + z * s; + newDst[2] = x * z * oneMinusCosine - y * s; + newDst[3] = 0; + newDst[4] = x * y * oneMinusCosine - z * s; + newDst[5] = yy + (1 - yy) * c; + newDst[6] = y * z * oneMinusCosine + x * s; + newDst[7] = 0; + newDst[8] = x * z * oneMinusCosine + y * s; + newDst[9] = y * z * oneMinusCosine - x * s; + newDst[10] = zz + (1 - zz) * c; + newDst[11] = 0; + newDst[12] = 0; + newDst[13] = 0; + newDst[14] = 0; + newDst[15] = 1; + return newDst; } /** * Creates a 4-by-4 matrix which rotates around the given axis by the given @@ -3993,7 +3825,7 @@ * @returns The rotated matrix. */ function axisRotate(m, axis, angleInRadians, dst) { - dst = dst || new MatType(16); + const newDst = (dst ?? new Ctor(16)); let x = axis[0]; let y = axis[1]; let z = axis[2]; @@ -4028,25 +3860,25 @@ const m21 = m[9]; const m22 = m[10]; const m23 = m[11]; - dst[0] = r00 * m00 + r01 * m10 + r02 * m20; - dst[1] = r00 * m01 + r01 * m11 + r02 * m21; - dst[2] = r00 * m02 + r01 * m12 + r02 * m22; - dst[3] = r00 * m03 + r01 * m13 + r02 * m23; - dst[4] = r10 * m00 + r11 * m10 + r12 * m20; - dst[5] = r10 * m01 + r11 * m11 + r12 * m21; - dst[6] = r10 * m02 + r11 * m12 + r12 * m22; - dst[7] = r10 * m03 + r11 * m13 + r12 * m23; - dst[8] = r20 * m00 + r21 * m10 + r22 * m20; - dst[9] = r20 * m01 + r21 * m11 + r22 * m21; - dst[10] = r20 * m02 + r21 * m12 + r22 * m22; - dst[11] = r20 * m03 + r21 * m13 + r22 * m23; - if (m !== dst) { - dst[12] = m[12]; - dst[13] = m[13]; - dst[14] = m[14]; - dst[15] = m[15]; + newDst[0] = r00 * m00 + r01 * m10 + r02 * m20; + newDst[1] = r00 * m01 + r01 * m11 + r02 * m21; + newDst[2] = r00 * m02 + r01 * m12 + r02 * m22; + newDst[3] = r00 * m03 + r01 * m13 + r02 * m23; + newDst[4] = r10 * m00 + r11 * m10 + r12 * m20; + newDst[5] = r10 * m01 + r11 * m11 + r12 * m21; + newDst[6] = r10 * m02 + r11 * m12 + r12 * m22; + newDst[7] = r10 * m03 + r11 * m13 + r12 * m23; + newDst[8] = r20 * m00 + r21 * m10 + r22 * m20; + newDst[9] = r20 * m01 + r21 * m11 + r22 * m21; + newDst[10] = r20 * m02 + r21 * m12 + r22 * m22; + newDst[11] = r20 * m03 + r21 * m13 + r22 * m23; + if (m !== newDst) { + newDst[12] = m[12]; + newDst[13] = m[13]; + newDst[14] = m[14]; + newDst[15] = m[15]; } - return dst; + return newDst; } /** * Rotates the given 4-by-4 matrix around the given axis by the @@ -4069,24 +3901,24 @@ * @returns The scaling matrix. */ function scaling(v, dst) { - dst = dst || new MatType(16); - dst[0] = v[0]; - dst[1] = 0; - dst[2] = 0; - dst[3] = 0; - dst[4] = 0; - dst[5] = v[1]; - dst[6] = 0; - dst[7] = 0; - dst[8] = 0; - dst[9] = 0; - dst[10] = v[2]; - dst[11] = 0; - dst[12] = 0; - dst[13] = 0; - dst[14] = 0; - dst[15] = 1; - return dst; + const newDst = (dst ?? new Ctor(16)); + newDst[0] = v[0]; + newDst[1] = 0; + newDst[2] = 0; + newDst[3] = 0; + newDst[4] = 0; + newDst[5] = v[1]; + newDst[6] = 0; + newDst[7] = 0; + newDst[8] = 0; + newDst[9] = 0; + newDst[10] = v[2]; + newDst[11] = 0; + newDst[12] = 0; + newDst[13] = 0; + newDst[14] = 0; + newDst[15] = 1; + return newDst; } /** * Scales the given 4-by-4 matrix in each dimension by an amount @@ -4098,30 +3930,30 @@ * @param dst - matrix to hold result. If not passed a new one is created. * @returns The scaled matrix. */ - function scale$2(m, v, dst) { - dst = dst || new MatType(16); + function scale(m, v, dst) { + const newDst = (dst ?? new Ctor(16)); const v0 = v[0]; const v1 = v[1]; const v2 = v[2]; - dst[0] = v0 * m[0 * 4 + 0]; - dst[1] = v0 * m[0 * 4 + 1]; - dst[2] = v0 * m[0 * 4 + 2]; - dst[3] = v0 * m[0 * 4 + 3]; - dst[4] = v1 * m[1 * 4 + 0]; - dst[5] = v1 * m[1 * 4 + 1]; - dst[6] = v1 * m[1 * 4 + 2]; - dst[7] = v1 * m[1 * 4 + 3]; - dst[8] = v2 * m[2 * 4 + 0]; - dst[9] = v2 * m[2 * 4 + 1]; - dst[10] = v2 * m[2 * 4 + 2]; - dst[11] = v2 * m[2 * 4 + 3]; - if (m !== dst) { - dst[12] = m[12]; - dst[13] = m[13]; - dst[14] = m[14]; - dst[15] = m[15]; + newDst[0] = v0 * m[0 * 4 + 0]; + newDst[1] = v0 * m[0 * 4 + 1]; + newDst[2] = v0 * m[0 * 4 + 2]; + newDst[3] = v0 * m[0 * 4 + 3]; + newDst[4] = v1 * m[1 * 4 + 0]; + newDst[5] = v1 * m[1 * 4 + 1]; + newDst[6] = v1 * m[1 * 4 + 2]; + newDst[7] = v1 * m[1 * 4 + 3]; + newDst[8] = v2 * m[2 * 4 + 0]; + newDst[9] = v2 * m[2 * 4 + 1]; + newDst[10] = v2 * m[2 * 4 + 2]; + newDst[11] = v2 * m[2 * 4 + 3]; + if (m !== newDst) { + newDst[12] = m[12]; + newDst[13] = m[13]; + newDst[14] = m[14]; + newDst[15] = m[15]; } - return dst; + return newDst; } /** * Creates a 4-by-4 matrix which scales a uniform amount in each dimension. @@ -4130,24 +3962,24 @@ * @returns The scaling matrix. */ function uniformScaling(s, dst) { - dst = dst || new MatType(16); - dst[0] = s; - dst[1] = 0; - dst[2] = 0; - dst[3] = 0; - dst[4] = 0; - dst[5] = s; - dst[6] = 0; - dst[7] = 0; - dst[8] = 0; - dst[9] = 0; - dst[10] = s; - dst[11] = 0; - dst[12] = 0; - dst[13] = 0; - dst[14] = 0; - dst[15] = 1; - return dst; + const newDst = (dst ?? new Ctor(16)); + newDst[0] = s; + newDst[1] = 0; + newDst[2] = 0; + newDst[3] = 0; + newDst[4] = 0; + newDst[5] = s; + newDst[6] = 0; + newDst[7] = 0; + newDst[8] = 0; + newDst[9] = 0; + newDst[10] = s; + newDst[11] = 0; + newDst[12] = 0; + newDst[13] = 0; + newDst[14] = 0; + newDst[15] = 1; + return newDst; } /** * Scales the given 4-by-4 matrix in each dimension by a uniform scale. @@ -4157,132 +3989,111 @@ * @returns The scaled matrix. */ function uniformScale(m, s, dst) { - dst = dst || new MatType(16); - dst[0] = s * m[0 * 4 + 0]; - dst[1] = s * m[0 * 4 + 1]; - dst[2] = s * m[0 * 4 + 2]; - dst[3] = s * m[0 * 4 + 3]; - dst[4] = s * m[1 * 4 + 0]; - dst[5] = s * m[1 * 4 + 1]; - dst[6] = s * m[1 * 4 + 2]; - dst[7] = s * m[1 * 4 + 3]; - dst[8] = s * m[2 * 4 + 0]; - dst[9] = s * m[2 * 4 + 1]; - dst[10] = s * m[2 * 4 + 2]; - dst[11] = s * m[2 * 4 + 3]; - if (m !== dst) { - dst[12] = m[12]; - dst[13] = m[13]; - dst[14] = m[14]; - dst[15] = m[15]; + const newDst = (dst ?? new Ctor(16)); + newDst[0] = s * m[0 * 4 + 0]; + newDst[1] = s * m[0 * 4 + 1]; + newDst[2] = s * m[0 * 4 + 2]; + newDst[3] = s * m[0 * 4 + 3]; + newDst[4] = s * m[1 * 4 + 0]; + newDst[5] = s * m[1 * 4 + 1]; + newDst[6] = s * m[1 * 4 + 2]; + newDst[7] = s * m[1 * 4 + 3]; + newDst[8] = s * m[2 * 4 + 0]; + newDst[9] = s * m[2 * 4 + 1]; + newDst[10] = s * m[2 * 4 + 2]; + newDst[11] = s * m[2 * 4 + 3]; + if (m !== newDst) { + newDst[12] = m[12]; + newDst[13] = m[13]; + newDst[14] = m[14]; + newDst[15] = m[15]; } - return dst; - } - - var mat4Impl = { - __proto__: null, - aim: aim, - axisRotate: axisRotate, - axisRotation: axisRotation, - cameraAim: cameraAim, - clone: clone$2, - copy: copy$2, - create: create$2, - determinant: determinant, - equals: equals$2, - equalsApproximately: equalsApproximately$2, - fromMat3: fromMat3, - fromQuat: fromQuat, - frustum: frustum, - frustumReverseZ: frustumReverseZ, - getAxis: getAxis, - getScaling: getScaling, - getTranslation: getTranslation, - identity: identity$1, - inverse: inverse$2, - invert: invert$1, - lookAt: lookAt, - mul: mul$2, - multiply: multiply$2, - negate: negate$1, - ortho: ortho, - perspective: perspective, - perspectiveReverseZ: perspectiveReverseZ, - rotate: rotate, - rotateX: rotateX$1, - rotateY: rotateY$1, - rotateZ: rotateZ$1, - rotation: rotation, - rotationX: rotationX, - rotationY: rotationY, - rotationZ: rotationZ, - scale: scale$2, - scaling: scaling, - set: set$2, - setAxis: setAxis, - setDefaultType: setDefaultType$3, - setTranslation: setTranslation, - translate: translate, - translation: translation, - transpose: transpose, - uniformScale: uniformScale, - uniformScaling: uniformScaling + return newDst; + } + return { + create, + set, + fromMat3, + fromQuat, + negate, + copy, + clone, + equalsApproximately, + equals, + identity, + transpose, + inverse, + determinant, + invert, + multiply, + mul, + setTranslation, + getTranslation, + getAxis, + setAxis, + getScaling, + perspective, + perspectiveReverseZ, + ortho, + frustum, + frustumReverseZ, + aim, + cameraAim, + lookAt, + translation, + translate, + rotationX, + rotateX, + rotationY, + rotateY, + rotationZ, + rotateZ, + axisRotation, + rotation, + axisRotate, + rotate, + scaling, + scale, + uniformScaling, + uniformScale, }; +} +const cache$2 = new Map(); +function getAPI$2(Ctor) { + let api = cache$2.get(Ctor); + if (!api) { + api = getAPIImpl$2(Ctor); + cache$2.set(Ctor, api); + } + return api; +} - /* - * Copyright 2022 Gregg Tavares - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - /** - * - * Quat4 math functions. - * - * Almost all functions take an optional `dst` argument. If it is not passed in the - * functions will create a new `Quat4`. In other words you can do this - * - * const v = quat4.cross(v1, v2); // Creates a new Quat4 with the cross product of v1 x v2. - * - * or - * - * const v = quat4.create(); - * quat4.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v - * - * The first style is often easier but depending on where it's used it generates garbage where - * as there is almost never allocation with the second style. - * - * It is always safe to pass any vector as the destination. So for example - * - * quat4.cross(v1, v2, v1); // Puts the cross product of v1 x v2 in v1 - * - */ - let QuatType = Float32Array; - /** - * Sets the type this library creates for a Quat4 - * @param ctor - the constructor for the type. Either `Float32Array`, `Float64Array`, or `Array` - * @returns previous constructor for Quat4 - */ - function setDefaultType$2(ctor) { - const oldType = QuatType; - QuatType = ctor; - return oldType; - } +/* + * Copyright 2022 Gregg Tavares + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ +/** + * Generates am typed API for Qud + * */ +function getAPIImpl$1(Ctor) { + const vec3 = getAPI$3(Ctor); /** * Creates a quat4; may be called with x, y, z to set initial values. * @param x - Initial x value. @@ -4291,44 +4102,22 @@ * @param w - Initial w value. * @returns the created vector */ - function create$1(x, y, z, w) { - const dst = new QuatType(4); + function create(x, y, z, w) { + const newDst = new Ctor(4); if (x !== undefined) { - dst[0] = x; + newDst[0] = x; if (y !== undefined) { - dst[1] = y; + newDst[1] = y; if (z !== undefined) { - dst[2] = z; + newDst[2] = z; if (w !== undefined) { - dst[3] = w; + newDst[3] = w; } } } } - return dst; + return newDst; } - - /* - * Copyright 2022 Gregg Tavares - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ /** * Creates a Quat; may be called with x, y, z to set initial values. (same as create) * @param x - Initial x value. @@ -4337,7 +4126,7 @@ * @param z - Initial w value. * @returns the created vector */ - const fromValues$1 = create$1; + const fromValues = create; /** * Sets the values of a Quat * Also see {@link quat.create} and {@link quat.copy} @@ -4349,13 +4138,13 @@ * @param dst - vector to hold result. If not passed in a new one is created. * @returns A vector with its elements set. */ - function set$1(x, y, z, w, dst) { - dst = dst || new QuatType(4); - dst[0] = x; - dst[1] = y; - dst[2] = z; - dst[3] = w; - return dst; + function set(x, y, z, w, dst) { + const newDst = (dst ?? new Ctor(4)); + newDst[0] = x; + newDst[1] = y; + newDst[2] = z; + newDst[3] = w; + return newDst; } /** * Sets a quaternion from the given angle and axis, @@ -4367,14 +4156,14 @@ * @returns The quaternion that represents the given axis and angle **/ function fromAxisAngle(axis, angleInRadians, dst) { - dst = dst || new QuatType(4); + const newDst = (dst ?? new Ctor(4)); const halfAngle = angleInRadians * 0.5; const s = Math.sin(halfAngle); - dst[0] = s * axis[0]; - dst[1] = s * axis[1]; - dst[2] = s * axis[2]; - dst[3] = Math.cos(halfAngle); - return dst; + newDst[0] = s * axis[0]; + newDst[1] = s * axis[1]; + newDst[2] = s * axis[2]; + newDst[3] = Math.cos(halfAngle); + return newDst; } /** * Gets the rotation axis and angle @@ -4383,20 +4172,20 @@ * @return angle and axis */ function toAxisAngle(q, dst) { - dst = dst || create$4(4); + const newDst = (dst ?? vec3.create(3)); const angle = Math.acos(q[3]) * 2; const s = Math.sin(angle * 0.5); if (s > EPSILON) { - dst[0] = q[0] / s; - dst[1] = q[1] / s; - dst[2] = q[2] / s; + newDst[0] = q[0] / s; + newDst[1] = q[1] / s; + newDst[2] = q[2] / s; } else { - dst[0] = 1; - dst[1] = 0; - dst[2] = 0; + newDst[0] = 1; + newDst[1] = 0; + newDst[2] = 0; } - return { angle, axis: dst }; + return { angle, axis: newDst }; } /** * Returns the angle in degrees between two rotations a and b. @@ -4405,7 +4194,7 @@ * @return angle in radians between the two quaternions */ function angle(a, b) { - const d = dot$1(a, b); + const d = dot(a, b); return Math.acos(2 * d * d - 1); } /** @@ -4416,8 +4205,8 @@ * @param dst - quaternion to hold result. If not passed in a new one is created. * @returns A quaternion that is the result of a * b */ - function multiply$1(a, b, dst) { - dst = dst || new QuatType(4); + function multiply(a, b, dst) { + const newDst = (dst ?? new Ctor(4)); const ax = a[0]; const ay = a[1]; const az = a[2]; @@ -4426,11 +4215,11 @@ const by = b[1]; const bz = b[2]; const bw = b[3]; - dst[0] = ax * bw + aw * bx + ay * bz - az * by; - dst[1] = ay * bw + aw * by + az * bx - ax * bz; - dst[2] = az * bw + aw * bz + ax * by - ay * bx; - dst[3] = aw * bw - ax * bx - ay * by - az * bz; - return dst; + newDst[0] = ax * bw + aw * bx + ay * bz - az * by; + newDst[1] = ay * bw + aw * by + az * bx - ax * bz; + newDst[2] = az * bw + aw * bz + ax * by - ay * bx; + newDst[3] = aw * bw - ax * bx - ay * by - az * bz; + return newDst; } /** * Multiplies two quaternions @@ -4440,7 +4229,7 @@ * @param dst - quaternion to hold result. If not passed in a new one is created. * @returns A quaternion that is the result of a * b */ - const mul$1 = multiply$1; + const mul = multiply; /** * Rotates the given quaternion around the X axis by the given angle. * @param q - quaternion to rotate @@ -4449,7 +4238,7 @@ * @returns A quaternion that is the result of a * b */ function rotateX(q, angleInRadians, dst) { - dst = dst || new QuatType(4); + const newDst = (dst ?? new Ctor(4)); const halfAngle = angleInRadians * 0.5; const qx = q[0]; const qy = q[1]; @@ -4457,11 +4246,11 @@ const qw = q[3]; const bx = Math.sin(halfAngle); const bw = Math.cos(halfAngle); - dst[0] = qx * bw + qw * bx; - dst[1] = qy * bw + qz * bx; - dst[2] = qz * bw - qy * bx; - dst[3] = qw * bw - qx * bx; - return dst; + newDst[0] = qx * bw + qw * bx; + newDst[1] = qy * bw + qz * bx; + newDst[2] = qz * bw - qy * bx; + newDst[3] = qw * bw - qx * bx; + return newDst; } /** * Rotates the given quaternion around the Y axis by the given angle. @@ -4471,7 +4260,7 @@ * @returns A quaternion that is the result of a * b */ function rotateY(q, angleInRadians, dst) { - dst = dst || new QuatType(4); + const newDst = (dst ?? new Ctor(4)); const halfAngle = angleInRadians * 0.5; const qx = q[0]; const qy = q[1]; @@ -4479,11 +4268,11 @@ const qw = q[3]; const by = Math.sin(halfAngle); const bw = Math.cos(halfAngle); - dst[0] = qx * bw - qz * by; - dst[1] = qy * bw + qw * by; - dst[2] = qz * bw + qx * by; - dst[3] = qw * bw - qy * by; - return dst; + newDst[0] = qx * bw - qz * by; + newDst[1] = qy * bw + qw * by; + newDst[2] = qz * bw + qx * by; + newDst[3] = qw * bw - qy * by; + return newDst; } /** * Rotates the given quaternion around the Z axis by the given angle. @@ -4493,7 +4282,7 @@ * @returns A quaternion that is the result of a * b */ function rotateZ(q, angleInRadians, dst) { - dst = dst || new QuatType(4); + const newDst = (dst ?? new Ctor(4)); const halfAngle = angleInRadians * 0.5; const qx = q[0]; const qy = q[1]; @@ -4501,11 +4290,11 @@ const qw = q[3]; const bz = Math.sin(halfAngle); const bw = Math.cos(halfAngle); - dst[0] = qx * bw + qy * bz; - dst[1] = qy * bw - qx * bz; - dst[2] = qz * bw + qw * bz; - dst[3] = qw * bw - qz * bz; - return dst; + newDst[0] = qx * bw + qy * bz; + newDst[1] = qy * bw - qx * bz; + newDst[2] = qz * bw + qw * bz; + newDst[3] = qw * bw - qz * bz; + return newDst; } /** * Spherically linear interpolate between two quaternions @@ -4517,7 +4306,7 @@ * @returns A quaternion that is the result of a * b */ function slerp(a, b, t, dst) { - dst = dst || new QuatType(4); + const newDst = (dst ?? new Ctor(4)); const ax = a[0]; const ay = a[1]; const az = a[2]; @@ -4546,11 +4335,11 @@ scale0 = 1.0 - t; scale1 = t; } - dst[0] = scale0 * ax + scale1 * bx; - dst[1] = scale0 * ay + scale1 * by; - dst[2] = scale0 * az + scale1 * bz; - dst[3] = scale0 * aw + scale1 * bw; - return dst; + newDst[0] = scale0 * ax + scale1 * bx; + newDst[1] = scale0 * ay + scale1 * by; + newDst[2] = scale0 * az + scale1 * bz; + newDst[3] = scale0 * aw + scale1 * bw; + return newDst; } /** * Compute the inverse of a quaternion @@ -4558,19 +4347,19 @@ * @param q - quaternion to compute the inverse of * @returns A quaternion that is the result of a * b */ - function inverse$1(q, dst) { - dst = dst || new QuatType(4); + function inverse(q, dst) { + const newDst = (dst ?? new Ctor(4)); const a0 = q[0]; const a1 = q[1]; const a2 = q[2]; const a3 = q[3]; const dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3; const invDot = dot ? 1 / dot : 0; - dst[0] = -a0 * invDot; - dst[1] = -a1 * invDot; - dst[2] = -a2 * invDot; - dst[3] = a3 * invDot; - return dst; + newDst[0] = -a0 * invDot; + newDst[1] = -a1 * invDot; + newDst[2] = -a2 * invDot; + newDst[3] = a3 * invDot; + return newDst; } /** * Compute the conjugate of a quaternion @@ -4582,12 +4371,12 @@ * @returns The conjugate of q */ function conjugate(q, dst) { - dst = dst || new QuatType(4); - dst[0] = -q[0]; - dst[1] = -q[1]; - dst[2] = -q[2]; - dst[3] = q[3]; - return dst; + const newDst = (dst ?? new Ctor(4)); + newDst[0] = -q[0]; + newDst[1] = -q[1]; + newDst[2] = -q[2]; + newDst[3] = q[3]; + return newDst; } /** * Creates a quaternion from the given rotation matrix. @@ -4599,7 +4388,7 @@ * @returns the result */ function fromMat(m, dst) { - dst = dst || new QuatType(4); + const newDst = (dst ?? new Ctor(4)); /* 0 1 2 3 4 5 @@ -4615,11 +4404,11 @@ if (trace > 0.0) { // |w| > 1/2, may as well choose w > 1/2 const root = Math.sqrt(trace + 1); // 2w - dst[3] = 0.5 * root; + newDst[3] = 0.5 * root; const invRoot = 0.5 / root; // 1/(4w) - dst[0] = (m[6] - m[9]) * invRoot; - dst[1] = (m[8] - m[2]) * invRoot; - dst[2] = (m[1] - m[4]) * invRoot; + newDst[0] = (m[6] - m[9]) * invRoot; + newDst[1] = (m[8] - m[2]) * invRoot; + newDst[2] = (m[1] - m[4]) * invRoot; } else { // |w| <= 1/2 @@ -4633,13 +4422,13 @@ const j = (i + 1) % 3; const k = (i + 2) % 3; const root = Math.sqrt(m[i * 4 + i] - m[j * 4 + j] - m[k * 4 + k] + 1.0); - dst[i] = 0.5 * root; + newDst[i] = 0.5 * root; const invRoot = 0.5 / root; - dst[3] = (m[j * 4 + k] - m[k * 4 + j]) * invRoot; - dst[j] = (m[j * 4 + i] + m[i * 4 + j]) * invRoot; - dst[k] = (m[k * 4 + i] + m[i * 4 + k]) * invRoot; + newDst[3] = (m[j * 4 + k] - m[k * 4 + j]) * invRoot; + newDst[j] = (m[j * 4 + i] + m[i * 4 + j]) * invRoot; + newDst[k] = (m[k * 4 + i] + m[i * 4 + k]) * invRoot; } - return dst; + return newDst; } /** * Creates a quaternion from the given euler angle x, y, z using the provided intrinsic order for the conversion. @@ -4652,7 +4441,7 @@ * @returns A quaternion representing the same rotation as the euler angles applied in the given order */ function fromEuler(xAngleInRadians, yAngleInRadians, zAngleInRadians, order, dst) { - dst = dst || new QuatType(4); + const newDst = (dst ?? new Ctor(4)); const xHalfAngle = xAngleInRadians * 0.5; const yHalfAngle = yAngleInRadians * 0.5; const zHalfAngle = zAngleInRadians * 0.5; @@ -4664,45 +4453,45 @@ const cz = Math.cos(zHalfAngle); switch (order) { case 'xyz': - dst[0] = sx * cy * cz + cx * sy * sz; - dst[1] = cx * sy * cz - sx * cy * sz; - dst[2] = cx * cy * sz + sx * sy * cz; - dst[3] = cx * cy * cz - sx * sy * sz; + newDst[0] = sx * cy * cz + cx * sy * sz; + newDst[1] = cx * sy * cz - sx * cy * sz; + newDst[2] = cx * cy * sz + sx * sy * cz; + newDst[3] = cx * cy * cz - sx * sy * sz; break; case 'xzy': - dst[0] = sx * cy * cz - cx * sy * sz; - dst[1] = cx * sy * cz - sx * cy * sz; - dst[2] = cx * cy * sz + sx * sy * cz; - dst[3] = cx * cy * cz + sx * sy * sz; + newDst[0] = sx * cy * cz - cx * sy * sz; + newDst[1] = cx * sy * cz - sx * cy * sz; + newDst[2] = cx * cy * sz + sx * sy * cz; + newDst[3] = cx * cy * cz + sx * sy * sz; break; case 'yxz': - dst[0] = sx * cy * cz + cx * sy * sz; - dst[1] = cx * sy * cz - sx * cy * sz; - dst[2] = cx * cy * sz - sx * sy * cz; - dst[3] = cx * cy * cz + sx * sy * sz; + newDst[0] = sx * cy * cz + cx * sy * sz; + newDst[1] = cx * sy * cz - sx * cy * sz; + newDst[2] = cx * cy * sz - sx * sy * cz; + newDst[3] = cx * cy * cz + sx * sy * sz; break; case 'yzx': - dst[0] = sx * cy * cz + cx * sy * sz; - dst[1] = cx * sy * cz + sx * cy * sz; - dst[2] = cx * cy * sz - sx * sy * cz; - dst[3] = cx * cy * cz - sx * sy * sz; + newDst[0] = sx * cy * cz + cx * sy * sz; + newDst[1] = cx * sy * cz + sx * cy * sz; + newDst[2] = cx * cy * sz - sx * sy * cz; + newDst[3] = cx * cy * cz - sx * sy * sz; break; case 'zxy': - dst[0] = sx * cy * cz - cx * sy * sz; - dst[1] = cx * sy * cz + sx * cy * sz; - dst[2] = cx * cy * sz + sx * sy * cz; - dst[3] = cx * cy * cz - sx * sy * sz; + newDst[0] = sx * cy * cz - cx * sy * sz; + newDst[1] = cx * sy * cz + sx * cy * sz; + newDst[2] = cx * cy * sz + sx * sy * cz; + newDst[3] = cx * cy * cz - sx * sy * sz; break; case 'zyx': - dst[0] = sx * cy * cz - cx * sy * sz; - dst[1] = cx * sy * cz + sx * cy * sz; - dst[2] = cx * cy * sz - sx * sy * cz; - dst[3] = cx * cy * cz + sx * sy * sz; + newDst[0] = sx * cy * cz - cx * sy * sz; + newDst[1] = cx * sy * cz + sx * cy * sz; + newDst[2] = cx * cy * sz - sx * sy * cz; + newDst[3] = cx * cy * cz + sx * sy * sz; break; default: throw new Error(`Unknown rotation order: ${order}`); } - return dst; + return newDst; } /** * Copies a quaternion. (same as {@link quat.clone}) @@ -4711,13 +4500,13 @@ * @param dst - quaternion to hold result. If not passed in a new one is created. * @returns A quaternion that is a copy of q */ - function copy$1(q, dst) { - dst = dst || new QuatType(4); - dst[0] = q[0]; - dst[1] = q[1]; - dst[2] = q[2]; - dst[3] = q[3]; - return dst; + function copy(q, dst) { + const newDst = (dst ?? new Ctor(4)); + newDst[0] = q[0]; + newDst[1] = q[1]; + newDst[2] = q[2]; + newDst[3] = q[3]; + return newDst; } /** * Clones a quaternion. (same as {@link quat.copy}) @@ -4726,7 +4515,7 @@ * @param dst - quaternion to hold result. If not passed in a new one is created. * @returns A copy of q. */ - const clone$1 = copy$1; + const clone = copy; /** * Adds two quaternions; assumes a and b have the same dimension. * @param a - Operand quaternion. @@ -4734,13 +4523,13 @@ * @param dst - quaternion to hold result. If not passed in a new one is created. * @returns A quaternion that is the sum of a and b. */ - function add$1(a, b, dst) { - dst = dst || new QuatType(4); - dst[0] = a[0] + b[0]; - dst[1] = a[1] + b[1]; - dst[2] = a[2] + b[2]; - dst[3] = a[3] + b[3]; - return dst; + function add(a, b, dst) { + const newDst = (dst ?? new Ctor(4)); + newDst[0] = a[0] + b[0]; + newDst[1] = a[1] + b[1]; + newDst[2] = a[2] + b[2]; + newDst[3] = a[3] + b[3]; + return newDst; } /** * Subtracts two quaternions. @@ -4749,13 +4538,13 @@ * @param dst - quaternion to hold result. If not passed in a new one is created. * @returns A quaternion that is the difference of a and b. */ - function subtract$1(a, b, dst) { - dst = dst || new QuatType(4); - dst[0] = a[0] - b[0]; - dst[1] = a[1] - b[1]; - dst[2] = a[2] - b[2]; - dst[3] = a[3] - b[3]; - return dst; + function subtract(a, b, dst) { + const newDst = (dst ?? new Ctor(4)); + newDst[0] = a[0] - b[0]; + newDst[1] = a[1] - b[1]; + newDst[2] = a[2] - b[2]; + newDst[3] = a[3] - b[3]; + return newDst; } /** * Subtracts two quaternions. @@ -4764,7 +4553,7 @@ * @param dst - quaternion to hold result. If not passed in a new one is created. * @returns A quaternion that is the difference of a and b. */ - const sub$1 = subtract$1; + const sub = subtract; /** * Multiplies a quaternion by a scalar. * @param v - The quaternion. @@ -4772,13 +4561,13 @@ * @param dst - quaternion to hold result. If not passed in a new one is created. * @returns The scaled quaternion. */ - function mulScalar$1(v, k, dst) { - dst = dst || new QuatType(4); - dst[0] = v[0] * k; - dst[1] = v[1] * k; - dst[2] = v[2] * k; - dst[3] = v[3] * k; - return dst; + function mulScalar(v, k, dst) { + const newDst = (dst ?? new Ctor(4)); + newDst[0] = v[0] * k; + newDst[1] = v[1] * k; + newDst[2] = v[2] * k; + newDst[3] = v[3] * k; + return newDst; } /** * Multiplies a quaternion by a scalar. (same as mulScalar) @@ -4787,7 +4576,7 @@ * @param dst - quaternion to hold result. If not passed in a new one is created. * @returns The scaled quaternion. */ - const scale$1 = mulScalar$1; + const scale = mulScalar; /** * Divides a vector by a scalar. * @param v - The vector. @@ -4795,13 +4584,13 @@ * @param dst - quaternion to hold result. If not passed in a new one is created. * @returns The scaled quaternion. */ - function divScalar$1(v, k, dst) { - dst = dst || new QuatType(4); - dst[0] = v[0] / k; - dst[1] = v[1] / k; - dst[2] = v[2] / k; - dst[3] = v[3] / k; - return dst; + function divScalar(v, k, dst) { + const newDst = (dst ?? new Ctor(4)); + newDst[0] = v[0] / k; + newDst[1] = v[1] / k; + newDst[2] = v[2] / k; + newDst[3] = v[3] / k; + return newDst; } /** * Computes the dot product of two quaternions @@ -4809,7 +4598,7 @@ * @param b - Operand quaternion. * @returns dot product */ - function dot$1(a, b) { + function dot(a, b) { return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]) + (a[3] * b[3]); } /** @@ -4822,20 +4611,20 @@ * @param dst - quaternion to hold result. If not passed in a new one is created. * @returns The linear interpolated result. */ - function lerp$1(a, b, t, dst) { - dst = dst || new QuatType(4); - dst[0] = a[0] + t * (b[0] - a[0]); - dst[1] = a[1] + t * (b[1] - a[1]); - dst[2] = a[2] + t * (b[2] - a[2]); - dst[3] = a[3] + t * (b[3] - a[3]); - return dst; + function lerp(a, b, t, dst) { + const newDst = (dst ?? new Ctor(4)); + newDst[0] = a[0] + t * (b[0] - a[0]); + newDst[1] = a[1] + t * (b[1] - a[1]); + newDst[2] = a[2] + t * (b[2] - a[2]); + newDst[3] = a[3] + t * (b[3] - a[3]); + return newDst; } /** * Computes the length of quaternion * @param v - quaternion. * @returns length of quaternion. */ - function length$1(v) { + function length(v) { const v0 = v[0]; const v1 = v[1]; const v2 = v[2]; @@ -4847,13 +4636,13 @@ * @param v - quaternion. * @returns length of quaternion. */ - const len$1 = length$1; + const len = length; /** * Computes the square of the length of quaternion * @param v - quaternion. * @returns square of the length of quaternion. */ - function lengthSq$1(v) { + function lengthSq(v) { const v0 = v[0]; const v1 = v[1]; const v2 = v[2]; @@ -4865,33 +4654,33 @@ * @param v - quaternion. * @returns square of the length of quaternion. */ - const lenSq$1 = lengthSq$1; + const lenSq = lengthSq; /** * Divides a quaternion by its Euclidean length and returns the quotient. * @param v - The quaternion. * @param dst - quaternion to hold result. If not passed in a new one is created. * @returns The normalized quaternion. */ - function normalize$1(v, dst) { - dst = dst || new QuatType(4); + function normalize(v, dst) { + const newDst = (dst ?? new Ctor(4)); const v0 = v[0]; const v1 = v[1]; const v2 = v[2]; const v3 = v[3]; const len = Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3); if (len > 0.00001) { - dst[0] = v0 / len; - dst[1] = v1 / len; - dst[2] = v2 / len; - dst[3] = v3 / len; + newDst[0] = v0 / len; + newDst[1] = v1 / len; + newDst[2] = v2 / len; + newDst[3] = v3 / len; } else { - dst[0] = 0; - dst[1] = 0; - dst[2] = 0; - dst[3] = 0; + newDst[0] = 0; + newDst[1] = 0; + newDst[2] = 0; + newDst[3] = 0; } - return dst; + return newDst; } /** * Check if 2 quaternions are approximately equal @@ -4899,7 +4688,7 @@ * @param b - Operand quaternion. * @returns true if quaternions are approximately equal */ - function equalsApproximately$1(a, b) { + function equalsApproximately(a, b) { return Math.abs(a[0] - b[0]) < EPSILON && Math.abs(a[1] - b[1]) < EPSILON && Math.abs(a[2] - b[2]) < EPSILON && @@ -4911,7 +4700,7 @@ * @param b - Operand quaternion. * @returns true if quaternions are exactly equal */ - function equals$1(a, b) { + function equals(a, b) { return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3]; } /** @@ -4920,16 +4709,16 @@ * @returns an identity quaternion */ function identity(dst) { - dst = dst || new QuatType(4); - dst[0] = 0; - dst[1] = 0; - dst[2] = 0; - dst[3] = 1; - return dst; + const newDst = (dst ?? new Ctor(4)); + newDst[0] = 0; + newDst[1] = 0; + newDst[2] = 0; + newDst[3] = 1; + return newDst; } - let tempVec3; - let xUnitVec3; - let yUnitVec3; + const tempVec3 = vec3.create(); + const xUnitVec3 = vec3.create(); + const yUnitVec3 = vec3.create(); /** * Computes a quaternion to represent the shortest rotation from one vector to another. * @@ -4939,38 +4728,35 @@ * @returns the result */ function rotationTo(aUnit, bUnit, dst) { - dst = dst || new QuatType(4); - tempVec3 = tempVec3 || create$4(); - xUnitVec3 = xUnitVec3 || create$4(1, 0, 0); - yUnitVec3 = yUnitVec3 || create$4(0, 1, 0); - const dot = dot$2(aUnit, bUnit); + const newDst = (dst ?? new Ctor(4)); + const dot = vec3.dot(aUnit, bUnit); if (dot < -0.999999) { - cross(xUnitVec3, aUnit, tempVec3); - if (len$2(tempVec3) < 0.000001) { - cross(yUnitVec3, aUnit, tempVec3); + vec3.cross(xUnitVec3, aUnit, tempVec3); + if (vec3.len(tempVec3) < 0.000001) { + vec3.cross(yUnitVec3, aUnit, tempVec3); } - normalize$2(tempVec3, tempVec3); - fromAxisAngle(tempVec3, Math.PI, dst); - return dst; + vec3.normalize(tempVec3, tempVec3); + fromAxisAngle(tempVec3, Math.PI, newDst); + return newDst; } else if (dot > 0.999999) { - dst[0] = 0; - dst[1] = 0; - dst[2] = 0; - dst[3] = 1; - return dst; + newDst[0] = 0; + newDst[1] = 0; + newDst[2] = 0; + newDst[3] = 1; + return newDst; } else { - cross(aUnit, bUnit, tempVec3); - dst[0] = tempVec3[0]; - dst[1] = tempVec3[1]; - dst[2] = tempVec3[2]; - dst[3] = 1 + dot; - return normalize$1(dst, dst); + vec3.cross(aUnit, bUnit, tempVec3); + newDst[0] = tempVec3[0]; + newDst[1] = tempVec3[1]; + newDst[2] = tempVec3[2]; + newDst[3] = 1 + dot; + return normalize(newDst, newDst); } } - let tempQuat1; - let tempQuat2; + const tempQuat1 = new Ctor(4); + const tempQuat2 = new Ctor(4); /** * Performs a spherical linear interpolation with two control points * @@ -4982,110 +4768,108 @@ * @returns result */ function sqlerp(a, b, c, d, t, dst) { - dst = dst || new QuatType(4); - tempQuat1 = tempQuat1 || new QuatType(4); - tempQuat2 = tempQuat2 || new QuatType(4); + const newDst = (dst ?? new Ctor(4)); slerp(a, d, t, tempQuat1); slerp(b, c, t, tempQuat2); - slerp(tempQuat1, tempQuat2, 2 * t * (1 - t), dst); - return dst; - } - - var quatImpl = { - __proto__: null, - add: add$1, - angle: angle, - clone: clone$1, - conjugate: conjugate, - copy: copy$1, - create: create$1, - divScalar: divScalar$1, - dot: dot$1, - equals: equals$1, - equalsApproximately: equalsApproximately$1, - fromAxisAngle: fromAxisAngle, - fromEuler: fromEuler, - fromMat: fromMat, - fromValues: fromValues$1, - identity: identity, - inverse: inverse$1, - len: len$1, - lenSq: lenSq$1, - length: length$1, - lengthSq: lengthSq$1, - lerp: lerp$1, - mul: mul$1, - mulScalar: mulScalar$1, - multiply: multiply$1, - normalize: normalize$1, - rotateX: rotateX, - rotateY: rotateY, - rotateZ: rotateZ, - rotationTo: rotationTo, - scale: scale$1, - set: set$1, - setDefaultType: setDefaultType$2, - slerp: slerp, - sqlerp: sqlerp, - sub: sub$1, - subtract: subtract$1, - toAxisAngle: toAxisAngle + slerp(tempQuat1, tempQuat2, 2 * t * (1 - t), newDst); + return newDst; + } + return { + create, + fromValues, + set, + fromAxisAngle, + toAxisAngle, + angle, + multiply, + mul, + rotateX, + rotateY, + rotateZ, + slerp, + inverse, + conjugate, + fromMat, + fromEuler, + copy, + clone, + add, + subtract, + sub, + mulScalar, + scale, + divScalar, + dot, + lerp, + length, + len, + lengthSq, + lenSq, + normalize, + equalsApproximately, + equals, + identity, + rotationTo, + sqlerp, }; +} +const cache$1 = new Map(); +/** + * + * Quat4 math functions. + * + * Almost all functions take an optional `newDst` argument. If it is not passed in the + * functions will create a new `Quat4`. In other words you can do this + * + * const v = quat4.cross(v1, v2); // Creates a new Quat4 with the cross product of v1 x v2. + * + * or + * + * const v = quat4.create(); + * quat4.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v + * + * The first style is often easier but depending on where it's used it generates garbage where + * as there is almost never allocation with the second style. + * + * It is always safe to pass any vector as the destination. So for example + * + * quat4.cross(v1, v2, v1); // Puts the cross product of v1 x v2 in v1 + * + */ +function getAPI$1(Ctor) { + let api = cache$1.get(Ctor); + if (!api) { + api = getAPIImpl$1(Ctor); + cache$1.set(Ctor, api); + } + return api; +} - /* - * Copyright 2022 Gregg Tavares - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - /** - * - * Vec4 math functions. - * - * Almost all functions take an optional `dst` argument. If it is not passed in the - * functions will create a new `Vec4`. In other words you can do this - * - * const v = vec4.cross(v1, v2); // Creates a new Vec4 with the cross product of v1 x v2. - * - * or - * - * const v = vec4.create(); - * vec4.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v - * - * The first style is often easier but depending on where it's used it generates garbage where - * as there is almost never allocation with the second style. - * - * It is always safe to pass any vector as the destination. So for example - * - * vec4.cross(v1, v2, v1); // Puts the cross product of v1 x v2 in v1 - * - */ - let VecType = Float32Array; - /** - * Sets the type this library creates for a Vec4 - * @param ctor - the constructor for the type. Either `Float32Array`, `Float64Array`, or `Array` - * @returns previous constructor for Vec4 - */ - function setDefaultType$1(ctor) { - const oldType = VecType; - VecType = ctor; - return oldType; - } +/* + * Copyright 2022 Gregg Tavares + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ +/** + * Generates am typed API for Vec4 + * */ +function getAPIImpl(Ctor) { /** * Creates a vec4; may be called with x, y, z to set initial values. * @param x - Initial x value. @@ -5095,43 +4879,21 @@ * @returns the created vector */ function create(x, y, z, w) { - const dst = new VecType(4); + const newDst = new Ctor(4); if (x !== undefined) { - dst[0] = x; + newDst[0] = x; if (y !== undefined) { - dst[1] = y; + newDst[1] = y; if (z !== undefined) { - dst[2] = z; + newDst[2] = z; if (w !== undefined) { - dst[3] = w; + newDst[3] = w; } } } } - return dst; + return newDst; } - - /* - * Copyright 2022 Gregg Tavares - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ /** * Creates a vec4; may be called with x, y, z to set initial values. (same as create) * @param x - Initial x value. @@ -5153,12 +4915,12 @@ * @returns A vector with its elements set. */ function set(x, y, z, w, dst) { - dst = dst || new VecType(4); - dst[0] = x; - dst[1] = y; - dst[2] = z; - dst[3] = w; - return dst; + const newDst = (dst ?? new Ctor(4)); + newDst[0] = x; + newDst[1] = y; + newDst[2] = z; + newDst[3] = w; + return newDst; } /** * Applies Math.ceil to each element of vector @@ -5167,12 +4929,12 @@ * @returns A vector that is the ceil of each element of v. */ function ceil(v, dst) { - dst = dst || new VecType(4); - dst[0] = Math.ceil(v[0]); - dst[1] = Math.ceil(v[1]); - dst[2] = Math.ceil(v[2]); - dst[3] = Math.ceil(v[3]); - return dst; + const newDst = (dst ?? new Ctor(4)); + newDst[0] = Math.ceil(v[0]); + newDst[1] = Math.ceil(v[1]); + newDst[2] = Math.ceil(v[2]); + newDst[3] = Math.ceil(v[3]); + return newDst; } /** * Applies Math.floor to each element of vector @@ -5181,12 +4943,12 @@ * @returns A vector that is the floor of each element of v. */ function floor(v, dst) { - dst = dst || new VecType(4); - dst[0] = Math.floor(v[0]); - dst[1] = Math.floor(v[1]); - dst[2] = Math.floor(v[2]); - dst[3] = Math.floor(v[3]); - return dst; + const newDst = (dst ?? new Ctor(4)); + newDst[0] = Math.floor(v[0]); + newDst[1] = Math.floor(v[1]); + newDst[2] = Math.floor(v[2]); + newDst[3] = Math.floor(v[3]); + return newDst; } /** * Applies Math.round to each element of vector @@ -5195,12 +4957,12 @@ * @returns A vector that is the round of each element of v. */ function round(v, dst) { - dst = dst || new VecType(4); - dst[0] = Math.round(v[0]); - dst[1] = Math.round(v[1]); - dst[2] = Math.round(v[2]); - dst[3] = Math.round(v[3]); - return dst; + const newDst = (dst ?? new Ctor(4)); + newDst[0] = Math.round(v[0]); + newDst[1] = Math.round(v[1]); + newDst[2] = Math.round(v[2]); + newDst[3] = Math.round(v[3]); + return newDst; } /** * Clamp each element of vector between min and max @@ -5211,12 +4973,12 @@ * @returns A vector that the clamped value of each element of v. */ function clamp(v, min = 0, max = 1, dst) { - dst = dst || new VecType(4); - dst[0] = Math.min(max, Math.max(min, v[0])); - dst[1] = Math.min(max, Math.max(min, v[1])); - dst[2] = Math.min(max, Math.max(min, v[2])); - dst[3] = Math.min(max, Math.max(min, v[3])); - return dst; + const newDst = (dst ?? new Ctor(4)); + newDst[0] = Math.min(max, Math.max(min, v[0])); + newDst[1] = Math.min(max, Math.max(min, v[1])); + newDst[2] = Math.min(max, Math.max(min, v[2])); + newDst[3] = Math.min(max, Math.max(min, v[3])); + return newDst; } /** * Adds two vectors; assumes a and b have the same dimension. @@ -5226,12 +4988,12 @@ * @returns A vector that is the sum of a and b. */ function add(a, b, dst) { - dst = dst || new VecType(4); - dst[0] = a[0] + b[0]; - dst[1] = a[1] + b[1]; - dst[2] = a[2] + b[2]; - dst[3] = a[3] + b[3]; - return dst; + const newDst = (dst ?? new Ctor(4)); + newDst[0] = a[0] + b[0]; + newDst[1] = a[1] + b[1]; + newDst[2] = a[2] + b[2]; + newDst[3] = a[3] + b[3]; + return newDst; } /** * Adds two vectors, scaling the 2nd; assumes a and b have the same dimension. @@ -5242,12 +5004,12 @@ * @returns A vector that is the sum of a + b * scale. */ function addScaled(a, b, scale, dst) { - dst = dst || new VecType(4); - dst[0] = a[0] + b[0] * scale; - dst[1] = a[1] + b[1] * scale; - dst[2] = a[2] + b[2] * scale; - dst[3] = a[3] + b[3] * scale; - return dst; + const newDst = (dst ?? new Ctor(4)); + newDst[0] = a[0] + b[0] * scale; + newDst[1] = a[1] + b[1] * scale; + newDst[2] = a[2] + b[2] * scale; + newDst[3] = a[3] + b[3] * scale; + return newDst; } /** * Subtracts two vectors. @@ -5257,12 +5019,12 @@ * @returns A vector that is the difference of a and b. */ function subtract(a, b, dst) { - dst = dst || new VecType(4); - dst[0] = a[0] - b[0]; - dst[1] = a[1] - b[1]; - dst[2] = a[2] - b[2]; - dst[3] = a[3] - b[3]; - return dst; + const newDst = (dst ?? new Ctor(4)); + newDst[0] = a[0] - b[0]; + newDst[1] = a[1] - b[1]; + newDst[2] = a[2] - b[2]; + newDst[3] = a[3] - b[3]; + return newDst; } /** * Subtracts two vectors. @@ -5304,12 +5066,12 @@ * @returns The linear interpolated result. */ function lerp(a, b, t, dst) { - dst = dst || new VecType(4); - dst[0] = a[0] + t * (b[0] - a[0]); - dst[1] = a[1] + t * (b[1] - a[1]); - dst[2] = a[2] + t * (b[2] - a[2]); - dst[3] = a[3] + t * (b[3] - a[3]); - return dst; + const newDst = (dst ?? new Ctor(4)); + newDst[0] = a[0] + t * (b[0] - a[0]); + newDst[1] = a[1] + t * (b[1] - a[1]); + newDst[2] = a[2] + t * (b[2] - a[2]); + newDst[3] = a[3] + t * (b[3] - a[3]); + return newDst; } /** * Performs linear interpolation on two vectors. @@ -5322,12 +5084,12 @@ * @returns the linear interpolated result. */ function lerpV(a, b, t, dst) { - dst = dst || new VecType(4); - dst[0] = a[0] + t[0] * (b[0] - a[0]); - dst[1] = a[1] + t[1] * (b[1] - a[1]); - dst[2] = a[2] + t[2] * (b[2] - a[2]); - dst[3] = a[3] + t[3] * (b[3] - a[3]); - return dst; + const newDst = (dst ?? new Ctor(4)); + newDst[0] = a[0] + t[0] * (b[0] - a[0]); + newDst[1] = a[1] + t[1] * (b[1] - a[1]); + newDst[2] = a[2] + t[2] * (b[2] - a[2]); + newDst[3] = a[3] + t[3] * (b[3] - a[3]); + return newDst; } /** * Return max values of two vectors. @@ -5339,12 +5101,12 @@ * @returns The max components vector. */ function max(a, b, dst) { - dst = dst || new VecType(4); - dst[0] = Math.max(a[0], b[0]); - dst[1] = Math.max(a[1], b[1]); - dst[2] = Math.max(a[2], b[2]); - dst[3] = Math.max(a[3], b[3]); - return dst; + const newDst = (dst ?? new Ctor(4)); + newDst[0] = Math.max(a[0], b[0]); + newDst[1] = Math.max(a[1], b[1]); + newDst[2] = Math.max(a[2], b[2]); + newDst[3] = Math.max(a[3], b[3]); + return newDst; } /** * Return min values of two vectors. @@ -5356,12 +5118,12 @@ * @returns The min components vector. */ function min(a, b, dst) { - dst = dst || new VecType(4); - dst[0] = Math.min(a[0], b[0]); - dst[1] = Math.min(a[1], b[1]); - dst[2] = Math.min(a[2], b[2]); - dst[3] = Math.min(a[3], b[3]); - return dst; + const newDst = (dst ?? new Ctor(4)); + newDst[0] = Math.min(a[0], b[0]); + newDst[1] = Math.min(a[1], b[1]); + newDst[2] = Math.min(a[2], b[2]); + newDst[3] = Math.min(a[3], b[3]); + return newDst; } /** * Multiplies a vector by a scalar. @@ -5371,12 +5133,12 @@ * @returns The scaled vector. */ function mulScalar(v, k, dst) { - dst = dst || new VecType(4); - dst[0] = v[0] * k; - dst[1] = v[1] * k; - dst[2] = v[2] * k; - dst[3] = v[3] * k; - return dst; + const newDst = (dst ?? new Ctor(4)); + newDst[0] = v[0] * k; + newDst[1] = v[1] * k; + newDst[2] = v[2] * k; + newDst[3] = v[3] * k; + return newDst; } /** * Multiplies a vector by a scalar. (same as mulScalar) @@ -5394,12 +5156,12 @@ * @returns The scaled vector. */ function divScalar(v, k, dst) { - dst = dst || new VecType(4); - dst[0] = v[0] / k; - dst[1] = v[1] / k; - dst[2] = v[2] / k; - dst[3] = v[3] / k; - return dst; + const newDst = (dst ?? new Ctor(4)); + newDst[0] = v[0] / k; + newDst[1] = v[1] / k; + newDst[2] = v[2] / k; + newDst[3] = v[3] / k; + return newDst; } /** * Inverse a vector. @@ -5408,12 +5170,12 @@ * @returns The inverted vector. */ function inverse(v, dst) { - dst = dst || new VecType(4); - dst[0] = 1 / v[0]; - dst[1] = 1 / v[1]; - dst[2] = 1 / v[2]; - dst[3] = 1 / v[3]; - return dst; + const newDst = (dst ?? new Ctor(4)); + newDst[0] = 1 / v[0]; + newDst[1] = 1 / v[1]; + newDst[2] = 1 / v[2]; + newDst[3] = 1 / v[3]; + return newDst; } /** * Invert a vector. (same as inverse) @@ -5514,25 +5276,25 @@ * @returns The normalized vector. */ function normalize(v, dst) { - dst = dst || new VecType(4); + const newDst = (dst ?? new Ctor(4)); const v0 = v[0]; const v1 = v[1]; const v2 = v[2]; const v3 = v[3]; const len = Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3); if (len > 0.00001) { - dst[0] = v0 / len; - dst[1] = v1 / len; - dst[2] = v2 / len; - dst[3] = v3 / len; + newDst[0] = v0 / len; + newDst[1] = v1 / len; + newDst[2] = v2 / len; + newDst[3] = v3 / len; } else { - dst[0] = 0; - dst[1] = 0; - dst[2] = 0; - dst[3] = 0; + newDst[0] = 0; + newDst[1] = 0; + newDst[2] = 0; + newDst[3] = 0; } - return dst; + return newDst; } /** * Negates a vector. @@ -5541,12 +5303,12 @@ * @returns -v. */ function negate(v, dst) { - dst = dst || new VecType(4); - dst[0] = -v[0]; - dst[1] = -v[1]; - dst[2] = -v[2]; - dst[3] = -v[3]; - return dst; + const newDst = (dst ?? new Ctor(4)); + newDst[0] = -v[0]; + newDst[1] = -v[1]; + newDst[2] = -v[2]; + newDst[3] = -v[3]; + return newDst; } /** * Copies a vector. (same as {@link vec4.clone}) @@ -5556,12 +5318,12 @@ * @returns A copy of v. */ function copy(v, dst) { - dst = dst || new VecType(4); - dst[0] = v[0]; - dst[1] = v[1]; - dst[2] = v[2]; - dst[3] = v[3]; - return dst; + const newDst = (dst ?? new Ctor(4)); + newDst[0] = v[0]; + newDst[1] = v[1]; + newDst[2] = v[2]; + newDst[3] = v[3]; + return newDst; } /** * Clones a vector. (same as {@link vec4.copy}) @@ -5580,12 +5342,12 @@ * @returns The vector of products of entries of a and b. */ function multiply(a, b, dst) { - dst = dst || new VecType(4); - dst[0] = a[0] * b[0]; - dst[1] = a[1] * b[1]; - dst[2] = a[2] * b[2]; - dst[3] = a[3] * b[3]; - return dst; + const newDst = (dst ?? new Ctor(4)); + newDst[0] = a[0] * b[0]; + newDst[1] = a[1] * b[1]; + newDst[2] = a[2] * b[2]; + newDst[3] = a[3] * b[3]; + return newDst; } /** * Multiplies a vector by another vector (component-wise); assumes a and @@ -5605,12 +5367,12 @@ * @returns The vector of quotients of entries of a and b. */ function divide(a, b, dst) { - dst = dst || new VecType(4); - dst[0] = a[0] / b[0]; - dst[1] = a[1] / b[1]; - dst[2] = a[2] / b[2]; - dst[3] = a[3] / b[3]; - return dst; + const newDst = (dst ?? new Ctor(4)); + newDst[0] = a[0] / b[0]; + newDst[1] = a[1] / b[1]; + newDst[2] = a[2] / b[2]; + newDst[3] = a[3] / b[3]; + return newDst; } /** * Divides a vector by another vector (component-wise); assumes a and @@ -5627,12 +5389,12 @@ * @returns The zeroed vector. */ function zero(dst) { - dst = dst || new VecType(4); - dst[0] = 0; - dst[1] = 0; - dst[2] = 0; - dst[3] = 0; - return dst; + const newDst = (dst ?? new Ctor(4)); + newDst[0] = 0; + newDst[1] = 0; + newDst[2] = 0; + newDst[3] = 0; + return newDst; } /** * transform vec4 by 4x4 matrix @@ -5642,16 +5404,16 @@ * @returns the transformed vector */ function transformMat4(v, m, dst) { - dst = dst || new VecType(4); + const newDst = (dst ?? new Ctor(4)); const x = v[0]; const y = v[1]; const z = v[2]; const w = v[3]; - dst[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w; - dst[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w; - dst[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w; - dst[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w; - return dst; + newDst[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w; + newDst[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w; + newDst[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w; + newDst[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w; + return newDst; } /** * Treat a 4D vector as a direction and set it's length @@ -5661,9 +5423,9 @@ * @returns The lengthened vector */ function setLength(a, len, dst) { - dst = dst || new VecType(4); - normalize(a, dst); - return mulScalar(dst, len, dst); + const newDst = (dst ?? new Ctor(4)); + normalize(a, newDst); + return mulScalar(newDst, len, newDst); } /** * Ensure a vector is not longer than a max length @@ -5673,11 +5435,11 @@ * @returns The vector, shortened to maxLen if it's too long */ function truncate(a, maxLen, dst) { - dst = dst || new VecType(4); + const newDst = (dst ?? new Ctor(4)); if (length(a) > maxLen) { - return setLength(a, maxLen, dst); + return setLength(a, maxLen, newDst); } - return copy(a, dst); + return copy(a, newDst); } /** * Return the vector exactly between 2 endpoint vectors @@ -5687,87 +5449,146 @@ * @returns The vector exactly residing between endpoints 1 and 2 */ function midpoint(a, b, dst) { - dst = dst || new VecType(4); - return lerp(a, b, 0.5, dst); - } - - var vec4Impl = { - __proto__: null, - add: add, - addScaled: addScaled, - ceil: ceil, - clamp: clamp, - clone: clone, - copy: copy, - create: create, - dist: dist, - distSq: distSq, - distance: distance, - distanceSq: distanceSq, - div: div, - divScalar: divScalar, - divide: divide, - dot: dot, - equals: equals, - equalsApproximately: equalsApproximately, - floor: floor, - fromValues: fromValues, - inverse: inverse, - invert: invert, - len: len, - lenSq: lenSq, - length: length, - lengthSq: lengthSq, - lerp: lerp, - lerpV: lerpV, - max: max, - midpoint: midpoint, - min: min, - mul: mul, - mulScalar: mulScalar, - multiply: multiply, - negate: negate, - normalize: normalize, - round: round, - scale: scale, - set: set, - setDefaultType: setDefaultType$1, - setLength: setLength, - sub: sub, - subtract: subtract, - transformMat4: transformMat4, - truncate: truncate, - zero: zero + const newDst = (dst ?? new Ctor(4)); + return lerp(a, b, 0.5, newDst); + } + return { + create, + fromValues, + set, + ceil, + floor, + round, + clamp, + add, + addScaled, + subtract, + sub, + equalsApproximately, + equals, + lerp, + lerpV, + max, + min, + mulScalar, + scale, + divScalar, + inverse, + invert, + dot, + length, + len, + lengthSq, + lenSq, + distance, + dist, + distanceSq, + distSq, + normalize, + negate, + copy, + clone, + multiply, + mul, + divide, + div, + zero, + transformMat4, + setLength, + truncate, + midpoint, }; +} +const cache = new Map(); +/** + * + * Vec4 math functions. + * + * Almost all functions take an optional `newDst` argument. If it is not passed in the + * functions will create a new `Vec4`. In other words you can do this + * + * const v = vec4.cross(v1, v2); // Creates a new Vec4 with the cross product of v1 x v2. + * + * or + * + * const v = vec4.create(); + * vec4.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v + * + * The first style is often easier but depending on where it's used it generates garbage where + * as there is almost never allocation with the second style. + * + * It is always safe to pass any vector as the destination. So for example + * + * vec4.cross(v1, v2, v1); // Puts the cross product of v1 x v2 in v1 + * + */ +function getAPI(Ctor) { + let api = cache.get(Ctor); + if (!api) { + api = getAPIImpl(Ctor); + cache.set(Ctor, api); + } + return api; +} - /** - * Sets the type this library creates for all types - * - * example: - * - * ``` - * setDefaultType(Float64Array); - * ``` - * - * @param ctor - the constructor for the type. Either `Float32Array`, `Float64Array`, or `Array` - */ - function setDefaultType(ctor) { - setDefaultType$4(ctor); - setDefaultType$3(ctor); - setDefaultType$2(ctor); - setDefaultType$6(ctor); - setDefaultType$5(ctor); - setDefaultType$1(ctor); - } - - exports.mat3 = mat3Impl; - exports.mat4 = mat4Impl; - exports.quat = quatImpl; - exports.setDefaultType = setDefaultType; - exports.utils = utils; - exports.vec2 = vec2Impl; - exports.vec3 = vec3Impl; - exports.vec4 = vec4Impl; +/** + * Generate wgpu-matrix API for type + */ +function wgpuMatrixAPI(Mat3Ctor, Mat4Ctor, QuatCtor, Vec2Ctor, Vec3Ctor, Vec4Ctor) { + return { + /** @namespace mat4 */ + mat4: getAPI$2(Mat3Ctor), + /** @namespace mat3 */ + mat3: getAPI$4(Mat4Ctor), + /** @namespace quat */ + quat: getAPI$1(QuatCtor), + /** @namespace vec2 */ + vec2: getAPI$5(Vec2Ctor), + /** @namespace vec3 */ + vec3: getAPI$3(Vec3Ctor), + /** @namespace vec4 */ + vec4: getAPI(Vec4Ctor), + }; +} +const { +/** @namespace */ +mat4, +/** @namespace */ +mat3, +/** @namespace */ +quat, +/** @namespace */ +vec2, +/** @namespace */ +vec3, +/** @namespace */ +vec4, } = wgpuMatrixAPI(Float32Array, Float32Array, Float32Array, Float32Array, Float32Array, Float32Array); +const { +/** @namespace */ +mat4: mat4d, +/** @namespace */ +mat3: mat3d, +/** @namespace */ +quat: quatd, +/** @namespace */ +vec2: vec2d, +/** @namespace */ +vec3: vec3d, +/** @namespace */ +vec4: vec4d, } = wgpuMatrixAPI(Float64Array, Float64Array, Float64Array, Float64Array, Float64Array, Float64Array); +const { +/** @namespace */ +mat4: mat4n, +/** @namespace */ +mat3: mat3n, +/** @namespace */ +quat: quatn, +/** @namespace */ +vec2: vec2n, +/** @namespace */ +vec3: vec3n, +/** @namespace */ +vec4: vec4n, } = wgpuMatrixAPI(ZeroArray, Array, Array, Array, Array, Array); -})); -//# sourceMappingURL=wgpu-matrix.js.map +export { mat3, mat3d, mat3n, mat4, mat4d, mat4n, quat, quatd, quatn, utils, vec2, vec2d, vec2n, vec3, vec3d, vec3n, vec4, vec4d, vec4n }; +//# sourceMappingURL=wgpu-matrix.module.js.map diff --git a/dist/3.x/wgpu-matrix.module.js.map b/dist/3.x/wgpu-matrix.module.js.map new file mode 100644 index 0000000..2a37e66 --- /dev/null +++ b/dist/3.x/wgpu-matrix.module.js.map @@ -0,0 +1 @@ +{"version":3,"file":"wgpu-matrix.module.js","sources":["../../../src/types.ts","../../../src/utils.ts","../../../src/vec2-impl.ts","../../../src/mat3-impl.ts","../../../src/vec3-impl.ts","../../../src/mat4-impl.ts","../../../src/quat-impl.ts","../../../src/vec4-impl.ts","../../../src/wgpu-matrix.ts"],"sourcesContent":["/**\n * The types you can pass to most functions that take an\n * array of numbers.\n */\nexport type BaseArgType = Float32Array | Float64Array | number[];\n\nfunction wrapConstructor any>(\n OriginalConstructor: T,\n modifier: (instance: InstanceType) => void\n): T {\n return class extends OriginalConstructor {\n constructor(...args: any[]) {\n super(...args);\n modifier(this as InstanceType);\n }\n } as T; // Type assertion is necessary here\n}\n\nexport const ZeroArray = wrapConstructor(Array, a => a.fill(0));\n\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\n\nexport let EPSILON = 0.000001;\n\n/**\n * Set the value for EPSILON for various checks\n * @param v - Value to use for EPSILON.\n * @returns previous value of EPSILON;\n */\nexport function setEpsilon(v: number): number {\n const old = EPSILON;\n EPSILON = v;\n return old;\n}\n\n/**\n * Convert degrees to radians\n * @param degrees - Angle in degrees\n * @returns angle converted to radians\n */\nexport function degToRad(degrees: number): number {\n return degrees * Math.PI / 180;\n}\n\n/**\n * Convert radians to degrees\n * @param radians - Angle in radians\n * @returns angle converted to degrees\n */\nexport function radToDeg(radians: number): number {\n return radians * 180 / Math.PI;\n}\n\n/**\n * Lerps between a and b via t\n * @param a - starting value\n * @param b - ending value\n * @param t - value where 0 = a and 1 = b\n * @returns a + (b - a) * t\n */\nexport function lerp(a: number, b: number, t: number): number {\n return a + (b - a) * t;\n}\n\n/**\n * Compute the opposite of lerp. Given a and b and a value between\n * a and b returns a value between 0 and 1. 0 if a, 1 if b.\n * Note: no clamping is done.\n * @param a - start value\n * @param b - end value\n * @param v - value between a and b\n * @returns (v - a) / (b - a)\n */\nexport function inverseLerp(a: number, b: number, v: number): number {\n const d = b - a;\n return (Math.abs(b - a) < EPSILON)\n ? a\n : (v - a) / d;\n}\n\n/**\n * Compute the euclidean modulo\n *\n * ```\n * // table for n / 3\n * -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5 <- n\n * ------------------------------------\n * -2 -1 -0 -2 -1 0, 1, 2, 0, 1, 2 <- n % 3\n * 1 2 0 1 2 0, 1, 2, 0, 1, 2 <- euclideanModule(n, 3)\n * ```\n *\n * @param n - dividend\n * @param m - divisor\n * @returns the euclidean modulo of n / m\n */\nexport function euclideanModulo(n: number, m: number) {\n return ((n % m) + m) % m;\n}","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport * as utils from './utils.js';\nimport { Mat3Arg } from './mat3';\nimport { Mat4Arg } from './mat4';\nimport { Vec2Arg, Vec2Type } from './vec2';\nimport { Vec3Arg } from './vec3';\nimport { BaseArgType } from './types';\n\nexport { Vec2Arg, Vec2Type };\n\ntype Vec2Ctor = new (n: number) => T;\n\n/**\n * Generates am typed API for Vec3\n */\nfunction getAPIImpl(Ctor: Vec2Ctor) {\n\n/**\n * Creates a Vec2; may be called with x, y, z to set initial values.\n *\n * Note: Since passing in a raw JavaScript array\n * is valid in all circumstances, if you want to\n * force a JavaScript array into a Vec2's specified type\n * it would be faster to use\n *\n * ```\n * const v = vec2.clone(someJSArray);\n * ```\n *\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @returns the created vector\n */\nfunction create(x = 0, y = 0) {\n const newDst = new Ctor(2);\n if (x !== undefined) {\n newDst[0] = x;\n if (y !== undefined) {\n newDst[1] = y;\n }\n }\n return newDst;\n}\n\n/**\n * Creates a Vec2; may be called with x, y, z to set initial values. (same as create)\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @returns the created vector\n */\nconst fromValues = create;\n\n/**\n * Sets the values of a Vec2\n * Also see {@link vec2.create} and {@link vec2.copy}\n *\n * @param x first value\n * @param y second value\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector with its elements set.\n */\nfunction set(x: number, y: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = x;\n newDst[1] = y;\n\n return newDst;\n}\n\n/**\n * Applies Math.ceil to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the ceil of each element of v.\n */\nfunction ceil(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.ceil(v[0]);\n newDst[1] = Math.ceil(v[1]);\n\n return newDst;\n}\n\n/**\n * Applies Math.floor to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the floor of each element of v.\n */\nfunction floor(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.floor(v[0]);\n newDst[1] = Math.floor(v[1]);\n\n return newDst;\n}\n\n/**\n * Applies Math.round to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the round of each element of v.\n */\nfunction round(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.round(v[0]);\n newDst[1] = Math.round(v[1]);\n\n return newDst;\n}\n\n/**\n * Clamp each element of vector between min and max\n * @param v - Operand vector.\n * @param max - Min value, default 0\n * @param min - Max value, default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that the clamped value of each element of v.\n */\nfunction clamp(v: Vec2Arg, min = 0, max = 1, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.min(max, Math.max(min, v[0]));\n newDst[1] = Math.min(max, Math.max(min, v[1]));\n\n return newDst;\n}\n\n/**\n * Adds two vectors; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a and b.\n */\nfunction add(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] + b[0];\n newDst[1] = a[1] + b[1];\n\n return newDst;\n}\n\n/**\n * Adds two vectors, scaling the 2nd; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param scale - Amount to scale b\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a + b * scale.\n */\nfunction addScaled(a: Vec2Arg, b: Vec2Arg, scale: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] + b[0] * scale;\n newDst[1] = a[1] + b[1] * scale;\n\n return newDst;\n}\n\n/**\n * Returns the angle in radians between two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns The angle in radians between the 2 vectors.\n */\nfunction angle(a: Vec2Arg, b: Vec2Arg): number {\n const ax = a[0];\n const ay = a[1];\n const bx = b[0];\n const by = b[1];\n const mag1 = Math.sqrt(ax * ax + ay * ay);\n const mag2 = Math.sqrt(bx * bx + by * by);\n const mag = mag1 * mag2;\n const cosine = mag && dot(a, b) / mag;\n return Math.acos(cosine);\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nfunction subtract(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] - b[0];\n newDst[1] = a[1] - b[1];\n\n return newDst;\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nconst sub = subtract;\n\n/**\n * Check if 2 vectors are approximately equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are approximately equal\n */\nfunction equalsApproximately(a: Vec2Arg, b: Vec2Arg): boolean {\n return Math.abs(a[0] - b[0]) < utils.EPSILON &&\n Math.abs(a[1] - b[1]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 vectors are exactly equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are exactly equal\n */\nfunction equals(a: Vec2Arg, b: Vec2Arg): boolean {\n return a[0] === b[0] && a[1] === b[1];\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficient.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The linear interpolated result.\n */\nfunction lerp(a: Vec2Arg, b: Vec2Arg, t: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] + t * (b[0] - a[0]);\n newDst[1] = a[1] + t * (b[1] - a[1]);\n\n return newDst;\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient vector t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficients vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns the linear interpolated result.\n */\nfunction lerpV(a: Vec2Arg, b: Vec2Arg, t: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] + t[0] * (b[0] - a[0]);\n newDst[1] = a[1] + t[1] * (b[1] - a[1]);\n\n return newDst;\n}\n\n/**\n * Return max values of two vectors.\n * Given vectors a and b returns\n * [max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The max components vector.\n */\nfunction max(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.max(a[0], b[0]);\n newDst[1] = Math.max(a[1], b[1]);\n\n return newDst;\n}\n\n/**\n * Return min values of two vectors.\n * Given vectors a and b returns\n * [min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The min components vector.\n */\nfunction min(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.min(a[0], b[0]);\n newDst[1] = Math.min(a[1], b[1]);\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction mulScalar(v: Vec2Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = v[0] * k;\n newDst[1] = v[1] * k;\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar. (same as mulScalar)\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nconst scale = mulScalar;\n\n/**\n * Divides a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction divScalar(v: Vec2Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = v[0] / k;\n newDst[1] = v[1] / k;\n\n return newDst;\n}\n\n/**\n * Inverse a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nfunction inverse(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = 1 / v[0];\n newDst[1] = 1 / v[1];\n\n return newDst;\n}\n\n/**\n * Invert a vector. (same as inverse)\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nconst invert = inverse;\n\n/**\n * Computes the cross product of two vectors; assumes both vectors have\n * three entries.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of a cross b.\n */\nfunction cross(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const z = a[0] * b[1] - a[1] * b[0];\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = z;\n\n return newDst;\n}\n\n/**\n * Computes the dot product of two vectors; assumes both vectors have\n * three entries.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns dot product\n */\nfunction dot(a: Vec2Arg, b: Vec2Arg): number {\n return a[0] * b[0] + a[1] * b[1];\n}\n\n/**\n * Computes the length of vector\n * @param v - vector.\n * @returns length of vector.\n */\nfunction length(v: Vec2Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n return Math.sqrt(v0 * v0 + v1 * v1);\n}\n\n/**\n * Computes the length of vector (same as length)\n * @param v - vector.\n * @returns length of vector.\n */\nconst len = length;\n\n/**\n * Computes the square of the length of vector\n * @param v - vector.\n * @returns square of the length of vector.\n */\nfunction lengthSq(v: Vec2Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n return v0 * v0 + v1 * v1;\n}\n\n/**\n * Computes the square of the length of vector (same as lengthSq)\n * @param v - vector.\n * @returns square of the length of vector.\n */\nconst lenSq = lengthSq;\n\n/**\n * Computes the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nfunction distance(a: Vec2Arg, b: Vec2Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n return Math.sqrt(dx * dx + dy * dy);\n}\n\n/**\n * Computes the distance between 2 points (same as distance)\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nconst dist = distance;\n\n/**\n * Computes the square of the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nfunction distanceSq(a: Vec2Arg, b: Vec2Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n return dx * dx + dy * dy;\n}\n\n/**\n * Computes the square of the distance between 2 points (same as distanceSq)\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nconst distSq = distanceSq;\n\n/**\n * Divides a vector by its Euclidean length and returns the quotient.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The normalized vector.\n */\nfunction normalize(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const len = Math.sqrt(v0 * v0 + v1 * v1);\n\n if (len > 0.00001) {\n newDst[0] = v0 / len;\n newDst[1] = v1 / len;\n } else {\n newDst[0] = 0;\n newDst[1] = 0;\n }\n\n return newDst;\n}\n\n/**\n * Negates a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns -v.\n */\nfunction negate(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = -v[0];\n newDst[1] = -v[1];\n\n return newDst;\n}\n\n/**\n * Copies a vector. (same as {@link vec2.clone})\n * Also see {@link vec2.create} and {@link vec2.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nfunction copy(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = v[0];\n newDst[1] = v[1];\n\n return newDst;\n}\n\n/**\n * Clones a vector. (same as {@link vec2.copy})\n * Also see {@link vec2.create} and {@link vec2.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nconst clone = copy;\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nfunction multiply(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] * b[0];\n newDst[1] = a[1] * b[1];\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as mul)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nconst mul = multiply;\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nfunction divide(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] / b[0];\n newDst[1] = a[1] / b[1];\n\n return newDst;\n}\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as divide)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nconst div = divide;\n\n/**\n * Creates a random unit vector * scale\n * @param scale - Default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The random vector.\n */\nfunction random(scale = 1, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n const angle = Math.random() * 2 * Math.PI;\n newDst[0] = Math.cos(angle) * scale;\n newDst[1] = Math.sin(angle) * scale;\n\n return newDst;\n}\n\n/**\n * Zero's a vector\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The zeroed vector.\n */\nfunction zero(dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = 0;\n newDst[1] = 0;\n\n return newDst;\n}\n\n\n/**\n * transform Vec2 by 4x4 matrix\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional Vec2 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nfunction transformMat4(v: Vec2Arg, m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n const x = v[0];\n const y = v[1];\n\n newDst[0] = x * m[0] + y * m[4] + m[12];\n newDst[1] = x * m[1] + y * m[5] + m[13];\n\n return newDst;\n}\n\n/**\n * Transforms vec4 by 3x3 matrix\n *\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional Vec2 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nfunction transformMat3(v: Vec2Arg, m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n const x = v[0];\n const y = v[1];\n\n newDst[0] = m[0] * x + m[4] * y + m[8];\n newDst[1] = m[1] * x + m[5] * y + m[9];\n\n return newDst;\n}\n\n/**\n * Rotate a 2D vector\n *\n * @param a The vec2 point to rotate\n * @param b The origin of the rotation\n * @param rad The angle of rotation in radians\n * @returns the rotated vector\n */\nfunction rotate(a: Vec2Arg, b: Vec2Arg, rad: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n // Translate point to the origin\n const p0 = a[0] - b[0];\n const p1 = a[1] - b[1];\n const sinC = Math.sin(rad);\n const cosC = Math.cos(rad);\n\n //perform rotation and translate to correct position\n newDst[0] = p0 * cosC - p1 * sinC + b[0];\n newDst[1] = p0 * sinC + p1 * cosC + b[1];\n\n return newDst;\n}\n\n/**\n * Treat a 2D vector as a direction and set it's length\n *\n * @param a The vec2 to lengthen\n * @param len The length of the resulting vector\n * @returns The lengthened vector\n */\nfunction setLength(a: Vec2Arg, len: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n normalize(a, newDst);\n return mulScalar(newDst, len, newDst);\n}\n\n/**\n * Ensure a vector is not longer than a max length\n *\n * @param a The vec2 to limit\n * @param maxLen The longest length of the resulting vector\n * @returns The vector, shortened to maxLen if it's too long\n */\nfunction truncate(a: Vec2Arg, maxLen: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n if (length(a) > maxLen) {\n return setLength(a, maxLen, newDst);\n }\n\n return copy(a, newDst);\n}\n\n/**\n * Return the vector exactly between 2 endpoint vectors\n *\n * @param a Endpoint 1\n * @param b Endpoint 2\n * @returns The vector exactly residing between endpoints 1 and 2\n */\nfunction midpoint(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n return lerp(a, b, 0.5, newDst);\n}\n\nreturn {\n create,\n fromValues,\n set,\n ceil,\n floor,\n round,\n clamp,\n add,\n addScaled,\n angle,\n subtract,\n sub,\n equalsApproximately,\n equals,\n lerp,\n lerpV,\n max,\n min,\n mulScalar,\n scale,\n divScalar,\n inverse,\n invert,\n cross,\n dot,\n length,\n len,\n lengthSq,\n lenSq,\n distance,\n dist,\n distanceSq,\n distSq,\n normalize,\n negate,\n copy,\n clone,\n multiply,\n mul,\n divide,\n div,\n random,\n zero,\n transformMat4,\n transformMat3,\n rotate,\n setLength,\n truncate,\n midpoint,\n};\n}\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\nexport function getAPI(Ctor: Vec2Ctor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\n\nimport * as utils from './utils.js';\nimport { QuatArg } from './quat';\nimport { Mat3Arg, Mat3Type } from './mat3';\nimport { Mat4Arg } from './mat4';\nimport { Vec2Arg } from './vec2';\nimport { getAPI as getVec2API } from './vec2-impl';\nimport { BaseArgType } from './types';\n\nexport { Mat3Arg, Mat3Type };\n\ntype Mat3Ctor = new (n: number) => T;\n\n/**\n * Generates a typed API for Mat3\n * */\nfunction getAPIImpl(Ctor: Mat3Ctor) {\n const vec2 = getVec2API(Ctor);\n\n/**\n * Create a Mat3 from values\n *\n * Note: Since passing in a raw JavaScript array\n * is valid in all circumstances, if you want to\n * force a JavaScript array into a Mat3's specified type\n * it would be faster to use\n *\n * ```\n * const m = mat3.clone(someJSArray);\n * ```\n *\n * @param v0 - value for element 0\n * @param v1 - value for element 1\n * @param v2 - value for element 2\n * @param v3 - value for element 3\n * @param v4 - value for element 4\n * @param v5 - value for element 5\n * @param v6 - value for element 6\n * @param v7 - value for element 7\n * @param v8 - value for element 8\n * @returns matrix created from values.\n */\nfunction create(\n v0?: number, v1?: number, v2?: number,\n v3?: number, v4?: number, v5?: number,\n v6?: number, v7?: number, v8?: number) {\n const newDst = new Ctor(12);\n // to make the array homogenous\n newDst[3] = 0;\n newDst[7] = 0;\n newDst[11] = 0;\n\n if (v0 !== undefined) {\n newDst[0] = v0;\n if (v1 !== undefined) {\n newDst[1] = v1;\n if (v2 !== undefined) {\n newDst[2] = v2;\n if (v3 !== undefined) {\n newDst[4] = v3;\n if (v4 !== undefined) {\n newDst[5] = v4;\n if (v5 !== undefined) {\n newDst[6] = v5;\n if (v6 !== undefined) {\n newDst[8] = v6;\n if (v7 !== undefined) {\n newDst[9] = v7;\n if (v8 !== undefined) {\n newDst[10] = v8;\n }\n }\n }\n }\n }\n }\n }\n }\n }\n\n return newDst;\n}\n\n/**\n * Sets the values of a Mat3\n * Also see {@link mat3.create} and {@link mat3.copy}\n *\n * @param v0 - value for element 0\n * @param v1 - value for element 1\n * @param v2 - value for element 2\n * @param v3 - value for element 3\n * @param v4 - value for element 4\n * @param v5 - value for element 5\n * @param v6 - value for element 6\n * @param v7 - value for element 7\n * @param v8 - value for element 8\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat3 set from values.\n */\nfunction set(\n v0: number, v1: number, v2: number,\n v3: number, v4: number, v5: number,\n v6: number, v7: number, v8: number, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[0] = v0; newDst[1] = v1; newDst[ 2] = v2; newDst[ 3] = 0;\n newDst[4] = v3; newDst[5] = v4; newDst[ 6] = v5; newDst[ 7] = 0;\n newDst[8] = v6; newDst[9] = v7; newDst[10] = v8; newDst[11] = 0;\n\n return newDst;\n}\n\n/**\n * Creates a Mat3 from the upper left 3x3 part of a Mat4\n * @param m4 - source matrix\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat3 made from m4\n */\nfunction fromMat4(m4: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n newDst[0] = m4[0]; newDst[1] = m4[1]; newDst[ 2] = m4[ 2]; newDst[ 3] = 0;\n newDst[4] = m4[4]; newDst[5] = m4[5]; newDst[ 6] = m4[ 6]; newDst[ 7] = 0;\n newDst[8] = m4[8]; newDst[9] = m4[9]; newDst[10] = m4[10]; newDst[11] = 0;\n return newDst;\n}\n\n/**\n * Creates a Mat3 rotation matrix from a quaternion\n * @param q - quaternion to create matrix from\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat3 made from q\n */\nfunction fromQuat(q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const x = q[0]; const y = q[1]; const z = q[2]; const w = q[3];\n const x2 = x + x; const y2 = y + y; const z2 = z + z;\n\n const xx = x * x2;\n const yx = y * x2;\n const yy = y * y2;\n const zx = z * x2;\n const zy = z * y2;\n const zz = z * z2;\n const wx = w * x2;\n const wy = w * y2;\n const wz = w * z2;\n\n newDst[ 0] = 1 - yy - zz; newDst[ 1] = yx + wz; newDst[ 2] = zx - wy; newDst[ 3] = 0;\n newDst[ 4] = yx - wz; newDst[ 5] = 1 - xx - zz; newDst[ 6] = zy + wx; newDst[ 7] = 0;\n newDst[ 8] = zx + wy; newDst[ 9] = zy - wx; newDst[10] = 1 - xx - yy; newDst[11] = 0;\n\n return newDst;\n}\n\n/**\n * Negates a matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns -m.\n */\nfunction negate(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = -m[ 0]; newDst[ 1] = -m[ 1]; newDst[ 2] = -m[ 2];\n newDst[ 4] = -m[ 4]; newDst[ 5] = -m[ 5]; newDst[ 6] = -m[ 6];\n newDst[ 8] = -m[ 8]; newDst[ 9] = -m[ 9]; newDst[10] = -m[10];\n\n return newDst;\n}\n\n/**\n * Copies a matrix. (same as {@link mat3.clone})\n * Also see {@link mat3.create} and {@link mat3.set}\n * @param m - The matrix.\n * @param dst - The matrix. If not passed a new one is created.\n * @returns A copy of m.\n */\nfunction copy(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = m[ 0]; newDst[ 1] = m[ 1]; newDst[ 2] = m[ 2];\n newDst[ 4] = m[ 4]; newDst[ 5] = m[ 5]; newDst[ 6] = m[ 6];\n newDst[ 8] = m[ 8]; newDst[ 9] = m[ 9]; newDst[10] = m[10];\n\n return newDst;\n}\n\n/**\n * Copies a matrix (same as {@link mat3.copy})\n * Also see {@link mat3.create} and {@link mat3.set}\n * @param m - The matrix.\n * @param dst - The matrix. If not passed a new one is created.\n * @returns A copy of m.\n */\nconst clone = copy;\n\n/**\n * Check if 2 matrices are approximately equal\n * @param a Operand matrix.\n * @param b Operand matrix.\n * @returns true if matrices are approximately equal\n */\nfunction equalsApproximately(a: Mat3Arg, b: Mat3Arg): boolean {\n return Math.abs(a[ 0] - b[ 0]) < utils.EPSILON &&\n Math.abs(a[ 1] - b[ 1]) < utils.EPSILON &&\n Math.abs(a[ 2] - b[ 2]) < utils.EPSILON &&\n Math.abs(a[ 4] - b[ 4]) < utils.EPSILON &&\n Math.abs(a[ 5] - b[ 5]) < utils.EPSILON &&\n Math.abs(a[ 6] - b[ 6]) < utils.EPSILON &&\n Math.abs(a[ 8] - b[ 8]) < utils.EPSILON &&\n Math.abs(a[ 9] - b[ 9]) < utils.EPSILON &&\n Math.abs(a[10] - b[10]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 matrices are exactly equal\n * @param a Operand matrix.\n * @param b Operand matrix.\n * @returns true if matrices are exactly equal\n */\nfunction equals(a: Mat3Arg, b: Mat3Arg): boolean {\n return a[ 0] === b[ 0] &&\n a[ 1] === b[ 1] &&\n a[ 2] === b[ 2] &&\n a[ 4] === b[ 4] &&\n a[ 5] === b[ 5] &&\n a[ 6] === b[ 6] &&\n a[ 8] === b[ 8] &&\n a[ 9] === b[ 9] &&\n a[10] === b[10];\n}\n\n/**\n * Creates a 3-by-3 identity matrix.\n *\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns A 3-by-3 identity matrix.\n */\nfunction identity(dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = 1; newDst[ 1] = 0; newDst[ 2] = 0;\n newDst[ 4] = 0; newDst[ 5] = 1; newDst[ 6] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1;\n\n return newDst;\n}\n\n/**\n * Takes the transpose of a matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The transpose of m.\n */\nfunction transpose(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n if (newDst === m) {\n let t: number;\n\n // 0 1 2\n // 4 5 6\n // 8 9 10\n\n t = m[1];\n m[1] = m[4];\n m[4] = t;\n\n t = m[2];\n m[2] = m[8];\n m[8] = t;\n\n t = m[6];\n m[6] = m[9];\n m[9] = t;\n\n return newDst;\n }\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n\n newDst[ 0] = m00; newDst[ 1] = m10; newDst[ 2] = m20;\n newDst[ 4] = m01; newDst[ 5] = m11; newDst[ 6] = m21;\n newDst[ 8] = m02; newDst[ 9] = m12; newDst[10] = m22;\n\n return newDst;\n}\n\n/**\n * Computes the inverse of a 3-by-3 matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The inverse of m.\n */\nfunction inverse(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n\n const b01 = m22 * m11 - m12 * m21;\n const b11 = -m22 * m10 + m12 * m20;\n const b21 = m21 * m10 - m11 * m20;\n\n const invDet = 1 / (m00 * b01 + m01 * b11 + m02 * b21);\n\n newDst[ 0] = b01 * invDet;\n newDst[ 1] = (-m22 * m01 + m02 * m21) * invDet;\n newDst[ 2] = ( m12 * m01 - m02 * m11) * invDet;\n newDst[ 4] = b11 * invDet;\n newDst[ 5] = ( m22 * m00 - m02 * m20) * invDet;\n newDst[ 6] = (-m12 * m00 + m02 * m10) * invDet;\n newDst[ 8] = b21 * invDet;\n newDst[ 9] = (-m21 * m00 + m01 * m20) * invDet;\n newDst[10] = ( m11 * m00 - m01 * m10) * invDet;\n\n return newDst;\n}\n\n/**\n * Compute the determinant of a matrix\n * @param m - the matrix\n * @returns the determinant\n */\nfunction determinant(m: Mat3Arg): number {\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n\n return m00 * (m11 * m22 - m21 * m12) -\n m10 * (m01 * m22 - m21 * m02) +\n m20 * (m01 * m12 - m11 * m02);\n}\n\n/**\n * Computes the inverse of a 3-by-3 matrix. (same as inverse)\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The inverse of m.\n */\nconst invert = inverse;\n\n/**\n * Multiplies two 3-by-3 matrices with a on the left and b on the right\n * @param a - The matrix on the left.\n * @param b - The matrix on the right.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix product of a and b.\n */\nfunction multiply(a: Mat3Arg, b: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a10 = a[ 4 + 0];\n const a11 = a[ 4 + 1];\n const a12 = a[ 4 + 2];\n const a20 = a[ 8 + 0];\n const a21 = a[ 8 + 1];\n const a22 = a[ 8 + 2];\n const b00 = b[0];\n const b01 = b[1];\n const b02 = b[2];\n const b10 = b[ 4 + 0];\n const b11 = b[ 4 + 1];\n const b12 = b[ 4 + 2];\n const b20 = b[ 8 + 0];\n const b21 = b[ 8 + 1];\n const b22 = b[ 8 + 2];\n\n newDst[ 0] = a00 * b00 + a10 * b01 + a20 * b02;\n newDst[ 1] = a01 * b00 + a11 * b01 + a21 * b02;\n newDst[ 2] = a02 * b00 + a12 * b01 + a22 * b02;\n newDst[ 4] = a00 * b10 + a10 * b11 + a20 * b12;\n newDst[ 5] = a01 * b10 + a11 * b11 + a21 * b12;\n newDst[ 6] = a02 * b10 + a12 * b11 + a22 * b12;\n newDst[ 8] = a00 * b20 + a10 * b21 + a20 * b22;\n newDst[ 9] = a01 * b20 + a11 * b21 + a21 * b22;\n newDst[10] = a02 * b20 + a12 * b21 + a22 * b22;\n\n return newDst;\n}\n\n/**\n * Multiplies two 3-by-3 matrices with a on the left and b on the right (same as multiply)\n * @param a - The matrix on the left.\n * @param b - The matrix on the right.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix product of a and b.\n */\nconst mul = multiply;\n\n/**\n * Sets the translation component of a 3-by-3 matrix to the given\n * vector.\n * @param a - The matrix.\n * @param v - The vector.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix with translation set.\n */\nfunction setTranslation(a: Mat3Arg, v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? identity()) as T;\n if (a !== newDst) {\n newDst[ 0] = a[ 0];\n newDst[ 1] = a[ 1];\n newDst[ 2] = a[ 2];\n newDst[ 4] = a[ 4];\n newDst[ 5] = a[ 5];\n newDst[ 6] = a[ 6];\n }\n newDst[ 8] = v[0];\n newDst[ 9] = v[1];\n newDst[10] = 1;\n return newDst;\n}\n\n/**\n * Returns the translation component of a 3-by-3 matrix as a vector with 3\n * entries.\n * @param m - The matrix.\n * @param dst - vector to hold result. If not passed a new one is created.\n * @returns The translation component of m.\n */\nfunction getTranslation(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? vec2.create()) as T;\n newDst[0] = m[8];\n newDst[1] = m[9];\n return newDst;\n}\n\n/**\n * Returns an axis of a 3x3 matrix as a vector with 2 entries\n * @param m - The matrix.\n * @param axis - The axis 0 = x, 1 = y,\n * @returns The axis component of m.\n */\nfunction getAxis(m: Mat3Arg, axis: number, dst?: T) {\n const newDst = (dst ?? vec2.create()) as T;\n const off = axis * 4;\n newDst[0] = m[off + 0];\n newDst[1] = m[off + 1];\n return newDst;\n}\n\n/**\n * Sets an axis of a 3x3 matrix as a vector with 2 entries\n * @param m - The matrix.\n * @param v - the axis vector\n * @param axis - The axis 0 = x, 1 = y;\n * @param dst - The matrix to set. If not passed a new one is created.\n * @returns The matrix with axis set.\n */\nfunction setAxis(m: Mat3Arg, v: Vec2Arg, axis: number, dst?: T) {\n const newDst = (dst === m ? m : copy(m, dst)) as T;\n\n const off = axis * 4;\n newDst[off + 0] = v[0];\n newDst[off + 1] = v[1];\n return newDst;\n}\n\n///**\n// * Returns the scaling component of the matrix\n// * @param m - The Matrix\n// * @param dst - The vector to set. If not passed a new one is created.\n// */\nfunction getScaling(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? vec2.create());\n\n const xx = m[0];\n const xy = m[1];\n const yx = m[4];\n const yy = m[5];\n\n newDst[0] = Math.sqrt(xx * xx + xy * xy);\n newDst[1] = Math.sqrt(yx * yx + yy * yy);\n\n return newDst;\n}\n\n/**\n * Creates a 3-by-3 matrix which translates by the given vector v.\n * @param v - The vector by which to translate.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The translation matrix.\n */\nfunction translation(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = 1; newDst[ 1] = 0; newDst[ 2] = 0;\n newDst[ 4] = 0; newDst[ 5] = 1; newDst[ 6] = 0;\n newDst[ 8] = v[0]; newDst[ 9] = v[1]; newDst[10] = 1;\n\n return newDst;\n}\n\n/**\n * Translates the given 3-by-3 matrix by the given vector v.\n * @param m - The matrix.\n * @param v - The vector by which to translate.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The translated matrix.\n */\nfunction translate(m: Mat3Arg, v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n\n const m00 = m[0];\n const m01 = m[1];\n const m02 = m[2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n\n if (m !== newDst) {\n newDst[ 0] = m00;\n newDst[ 1] = m01;\n newDst[ 2] = m02;\n newDst[ 4] = m10;\n newDst[ 5] = m11;\n newDst[ 6] = m12;\n }\n\n newDst[ 8] = m00 * v0 + m10 * v1 + m20;\n newDst[ 9] = m01 * v0 + m11 * v1 + m21;\n newDst[10] = m02 * v0 + m12 * v1 + m22;\n\n return newDst;\n}\n\n/**\n * Creates a 3-by-3 matrix which rotates by the given angle.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotation matrix.\n */\nfunction rotation(angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c; newDst[ 1] = s; newDst[ 2] = 0;\n newDst[ 4] = -s; newDst[ 5] = c; newDst[ 6] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1;\n\n return newDst;\n}\n\n/**\n * Rotates the given 3-by-3 matrix by the given angle.\n * @param m - The matrix.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nfunction rotate(m: Mat3Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c * m00 + s * m10;\n newDst[ 1] = c * m01 + s * m11;\n newDst[ 2] = c * m02 + s * m12;\n\n newDst[ 4] = c * m10 - s * m00;\n newDst[ 5] = c * m11 - s * m01;\n newDst[ 6] = c * m12 - s * m02;\n\n\n if (m !== newDst) {\n newDst[ 8] = m[ 8];\n newDst[ 9] = m[ 9];\n newDst[10] = m[10];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 3-by-3 matrix which scales in each dimension by an amount given by\n * the corresponding entry in the given vector; assumes the vector has three\n * entries.\n * @param v - A vector of\n * 2 entries specifying the factor by which to scale in each dimension.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaling matrix.\n */\nfunction scaling(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = v[0]; newDst[ 1] = 0; newDst[ 2] = 0;\n newDst[ 4] = 0; newDst[ 5] = v[1]; newDst[ 6] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1;\n\n return newDst;\n}\n\n/**\n * Scales the given 3-by-3 matrix in each dimension by an amount\n * given by the corresponding entry in the given vector; assumes the vector has\n * three entries.\n * @param m - The matrix to be modified.\n * @param v - A vector of 2 entries specifying the\n * factor by which to scale in each dimension.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaled matrix.\n */\nfunction scale(m: Mat3Arg, v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n\n newDst[ 0] = v0 * m[0 * 4 + 0];\n newDst[ 1] = v0 * m[0 * 4 + 1];\n newDst[ 2] = v0 * m[0 * 4 + 2];\n\n newDst[ 4] = v1 * m[1 * 4 + 0];\n newDst[ 5] = v1 * m[1 * 4 + 1];\n newDst[ 6] = v1 * m[1 * 4 + 2];\n\n if (m !== newDst) {\n newDst[ 8] = m[ 8];\n newDst[ 9] = m[ 9];\n newDst[10] = m[10];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 3-by-3 matrix which scales uniformly in each dimension\n * @param s - Amount to scale\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaling matrix.\n */\nfunction uniformScaling(s: number, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = s; newDst[ 1] = 0; newDst[ 2] = 0;\n newDst[ 4] = 0; newDst[ 5] = s; newDst[ 6] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1;\n\n return newDst;\n}\n\n/**\n * Scales the given 3-by-3 matrix in each dimension by an amount\n * given.\n * @param m - The matrix to be modified.\n * @param s - Amount to scale.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaled matrix.\n */\nfunction uniformScale(m: Mat3Arg, s: number, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = s * m[0 * 4 + 0];\n newDst[ 1] = s * m[0 * 4 + 1];\n newDst[ 2] = s * m[0 * 4 + 2];\n\n newDst[ 4] = s * m[1 * 4 + 0];\n newDst[ 5] = s * m[1 * 4 + 1];\n newDst[ 6] = s * m[1 * 4 + 2];\n\n if (m !== newDst) {\n newDst[ 8] = m[ 8];\n newDst[ 9] = m[ 9];\n newDst[10] = m[10];\n }\n\n return newDst;\n}\n\nreturn {\n clone,\n create,\n set,\n fromMat4,\n fromQuat,\n negate,\n copy,\n equalsApproximately,\n equals,\n identity,\n transpose,\n inverse,\n invert,\n determinant,\n mul,\n multiply,\n setTranslation,\n getTranslation,\n getAxis,\n setAxis,\n getScaling,\n translation,\n translate,\n rotation,\n rotate,\n scaling,\n scale,\n uniformScaling,\n uniformScale,\n};\n\n}\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\nexport function getAPI(Ctor: Mat3Ctor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport * as utils from './utils.js';\nimport { Vec3Arg, Vec3Type } from './vec3';\nimport { Mat3Arg } from './mat3';\nimport { Mat4Arg } from './mat4';\nimport { QuatArg } from './quat';\nimport { BaseArgType } from './types';\n\nexport { Vec3Arg, Vec3Type };\n\ntype Vec3Ctor = new (n: number) => T;\n\n/**\n * Generates am typed API for Vec3\n * */\nfunction getAPIImpl(Ctor: Vec3Ctor) {\n\n/**\n * Creates a vec3; may be called with x, y, z to set initial values.\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @returns the created vector\n */\nfunction create(x?: number, y?: number, z?: number) {\n const newDst = new Ctor(3);\n if (x !== undefined) {\n newDst[0] = x;\n if (y !== undefined) {\n newDst[1] = y;\n if (z !== undefined) {\n newDst[2] = z;\n }\n }\n }\n return newDst;\n}\n\n/**\n * Creates a vec3; may be called with x, y, z to set initial values. (same as create)\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @returns the created vector\n */\nconst fromValues = create;\n\n/**\n * Sets the values of a Vec3\n * Also see {@link vec3.create} and {@link vec3.copy}\n *\n * @param x first value\n * @param y second value\n * @param z third value\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector with its elements set.\n */\nfunction set(x: number, y: number, z: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = x;\n newDst[1] = y;\n newDst[2] = z;\n\n return newDst;\n}\n\n/**\n * Applies Math.ceil to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the ceil of each element of v.\n */\nfunction ceil(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.ceil(v[0]);\n newDst[1] = Math.ceil(v[1]);\n newDst[2] = Math.ceil(v[2]);\n\n return newDst;\n}\n\n/**\n * Applies Math.floor to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the floor of each element of v.\n */\nfunction floor(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.floor(v[0]);\n newDst[1] = Math.floor(v[1]);\n newDst[2] = Math.floor(v[2]);\n\n return newDst;\n}\n\n/**\n * Applies Math.round to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the round of each element of v.\n */\nfunction round(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.round(v[0]);\n newDst[1] = Math.round(v[1]);\n newDst[2] = Math.round(v[2]);\n\n return newDst;\n}\n\n/**\n * Clamp each element of vector between min and max\n * @param v - Operand vector.\n * @param max - Min value, default 0\n * @param min - Max value, default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that the clamped value of each element of v.\n */\nfunction clamp(v: Vec3Arg, min = 0, max = 1, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.min(max, Math.max(min, v[0]));\n newDst[1] = Math.min(max, Math.max(min, v[1]));\n newDst[2] = Math.min(max, Math.max(min, v[2]));\n\n return newDst;\n}\n\n/**\n * Adds two vectors; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a and b.\n */\nfunction add(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] + b[0];\n newDst[1] = a[1] + b[1];\n newDst[2] = a[2] + b[2];\n\n return newDst;\n}\n\n/**\n * Adds two vectors, scaling the 2nd; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param scale - Amount to scale b\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a + b * scale.\n */\nfunction addScaled(a: Vec3Arg, b: Vec3Arg, scale: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] + b[0] * scale;\n newDst[1] = a[1] + b[1] * scale;\n newDst[2] = a[2] + b[2] * scale;\n\n return newDst;\n}\n\n/**\n * Returns the angle in radians between two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns The angle in radians between the 2 vectors.\n */\nfunction angle(a: Vec3Arg, b: Vec3Arg): number {\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const bx = b[0];\n const by = b[1];\n const bz = b[2];\n const mag1 = Math.sqrt(ax * ax + ay * ay + az * az);\n const mag2 = Math.sqrt(bx * bx + by * by + bz * bz);\n const mag = mag1 * mag2;\n const cosine = mag && dot(a, b) / mag;\n return Math.acos(cosine);\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nfunction subtract(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] - b[0];\n newDst[1] = a[1] - b[1];\n newDst[2] = a[2] - b[2];\n\n return newDst;\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nconst sub = subtract;\n\n/**\n * Check if 2 vectors are approximately equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are approximately equal\n */\nfunction equalsApproximately(a: Vec3Arg, b: Vec3Arg): boolean {\n return Math.abs(a[0] - b[0]) < utils.EPSILON &&\n Math.abs(a[1] - b[1]) < utils.EPSILON &&\n Math.abs(a[2] - b[2]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 vectors are exactly equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are exactly equal\n */\nfunction equals(a: Vec3Arg, b: Vec3Arg): boolean {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2];\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficient.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The linear interpolated result.\n */\nfunction lerp(a: Vec3Arg, b: Vec3Arg, t: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] + t * (b[0] - a[0]);\n newDst[1] = a[1] + t * (b[1] - a[1]);\n newDst[2] = a[2] + t * (b[2] - a[2]);\n\n return newDst;\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient vector t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficients vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns the linear interpolated result.\n */\nfunction lerpV(a: Vec3Arg, b: Vec3Arg, t: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] + t[0] * (b[0] - a[0]);\n newDst[1] = a[1] + t[1] * (b[1] - a[1]);\n newDst[2] = a[2] + t[2] * (b[2] - a[2]);\n\n return newDst;\n}\n\n/**\n * Return max values of two vectors.\n * Given vectors a and b returns\n * [max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The max components vector.\n */\nfunction max(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.max(a[0], b[0]);\n newDst[1] = Math.max(a[1], b[1]);\n newDst[2] = Math.max(a[2], b[2]);\n\n return newDst;\n}\n\n/**\n * Return min values of two vectors.\n * Given vectors a and b returns\n * [min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The min components vector.\n */\nfunction min(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.min(a[0], b[0]);\n newDst[1] = Math.min(a[1], b[1]);\n newDst[2] = Math.min(a[2], b[2]);\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction mulScalar(v: Vec3Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = v[0] * k;\n newDst[1] = v[1] * k;\n newDst[2] = v[2] * k;\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar. (same as mulScalar)\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nconst scale = mulScalar;\n\n/**\n * Divides a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction divScalar(v: Vec3Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = v[0] / k;\n newDst[1] = v[1] / k;\n newDst[2] = v[2] / k;\n\n return newDst;\n}\n\n/**\n * Inverse a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nfunction inverse(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = 1 / v[0];\n newDst[1] = 1 / v[1];\n newDst[2] = 1 / v[2];\n\n return newDst;\n}\n\n/**\n * Invert a vector. (same as inverse)\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nconst invert = inverse;\n\n/**\n * Computes the cross product of two vectors; assumes both vectors have\n * three entries.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of a cross b.\n */\nfunction cross(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const t1 = a[2] * b[0] - a[0] * b[2];\n const t2 = a[0] * b[1] - a[1] * b[0];\n newDst[0] = a[1] * b[2] - a[2] * b[1];\n newDst[1] = t1;\n newDst[2] = t2;\n\n return newDst;\n}\n\n/**\n * Computes the dot product of two vectors; assumes both vectors have\n * three entries.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns dot product\n */\nfunction dot(a: Vec3Arg, b: Vec3Arg): number {\n return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]);\n}\n\n/**\n * Computes the length of vector\n * @param v - vector.\n * @returns length of vector.\n */\nfunction length(v: Vec3Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n return Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2);\n}\n\n/**\n * Computes the length of vector (same as length)\n * @param v - vector.\n * @returns length of vector.\n */\nconst len = length;\n\n/**\n * Computes the square of the length of vector\n * @param v - vector.\n * @returns square of the length of vector.\n */\nfunction lengthSq(v: Vec3Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n return v0 * v0 + v1 * v1 + v2 * v2;\n}\n\n/**\n * Computes the square of the length of vector (same as lengthSq)\n * @param v - vector.\n * @returns square of the length of vector.\n */\nconst lenSq = lengthSq;\n\n/**\n * Computes the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nfunction distance(a: Vec3Arg, b: Vec3Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n const dz = a[2] - b[2];\n return Math.sqrt(dx * dx + dy * dy + dz * dz);\n}\n\n/**\n * Computes the distance between 2 points (same as distance)\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nconst dist = distance;\n\n/**\n * Computes the square of the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nfunction distanceSq(a: Vec3Arg, b: Vec3Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n const dz = a[2] - b[2];\n return dx * dx + dy * dy + dz * dz;\n}\n\n/**\n * Computes the square of the distance between 2 points (same as distanceSq)\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nconst distSq = distanceSq;\n\n/**\n * Divides a vector by its Euclidean length and returns the quotient.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The normalized vector.\n */\nfunction normalize(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const len = Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2);\n\n if (len > 0.00001) {\n newDst[0] = v0 / len;\n newDst[1] = v1 / len;\n newDst[2] = v2 / len;\n } else {\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n }\n\n\n return newDst;\n}\n\n/**\n * Negates a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns -v.\n */\nfunction negate(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = -v[0];\n newDst[1] = -v[1];\n newDst[2] = -v[2];\n\n return newDst;\n}\n\n/**\n * Copies a vector. (same as {@link vec3.clone})\n * Also see {@link vec3.create} and {@link vec3.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nfunction copy(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = v[0];\n newDst[1] = v[1];\n newDst[2] = v[2];\n\n return newDst;\n}\n\n/**\n * Clones a vector. (same as {@link vec3.copy})\n * Also see {@link vec3.create} and {@link vec3.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nconst clone = copy;\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nfunction multiply(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] * b[0];\n newDst[1] = a[1] * b[1];\n newDst[2] = a[2] * b[2];\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as mul)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nconst mul = multiply;\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nfunction divide(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] / b[0];\n newDst[1] = a[1] / b[1];\n newDst[2] = a[2] / b[2];\n\n return newDst;\n}\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as divide)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nconst div = divide;\n\n/**\n * Creates a random vector\n * @param scale - Default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The random vector.\n */\nfunction random(scale = 1, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const angle = Math.random() * 2 * Math.PI;\n const z = Math.random() * 2 - 1;\n const zScale = Math.sqrt(1 - z * z) * scale;\n newDst[0] = Math.cos(angle) * zScale;\n newDst[1] = Math.sin(angle) * zScale;\n newDst[2] = z * scale;\n\n return newDst;\n}\n\n/**\n * Zero's a vector\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The zeroed vector.\n */\nfunction zero(dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n\n return newDst;\n}\n\n\n/**\n * transform vec3 by 4x4 matrix\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional vec3 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nfunction transformMat4(v: Vec3Arg, m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const x = v[0];\n const y = v[1];\n const z = v[2];\n const w = (m[3] * x + m[7] * y + m[11] * z + m[15]) || 1;\n\n newDst[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;\n newDst[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;\n newDst[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;\n\n return newDst;\n}\n\n/**\n * Transform vec3 by upper 3x3 matrix inside 4x4 matrix.\n * @param v - The direction.\n * @param m - The matrix.\n * @param dst - optional vec3 to store result. If not passed a new one is created.\n * @returns The transformed vector.\n */\nfunction transformMat4Upper3x3(v: Vec3Arg, m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n\n newDst[0] = v0 * m[0 * 4 + 0] + v1 * m[1 * 4 + 0] + v2 * m[2 * 4 + 0];\n newDst[1] = v0 * m[0 * 4 + 1] + v1 * m[1 * 4 + 1] + v2 * m[2 * 4 + 1];\n newDst[2] = v0 * m[0 * 4 + 2] + v1 * m[1 * 4 + 2] + v2 * m[2 * 4 + 2];\n\n return newDst;\n}\n\n/**\n * Transforms vec3 by 3x3 matrix\n *\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional vec3 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nfunction transformMat3(v: Vec3Arg, m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const x = v[0];\n const y = v[1];\n const z = v[2];\n\n newDst[0] = x * m[0] + y * m[4] + z * m[8];\n newDst[1] = x * m[1] + y * m[5] + z * m[9];\n newDst[2] = x * m[2] + y * m[6] + z * m[10];\n\n return newDst;\n}\n\n/**\n * Transforms vec3 by Quaternion\n * @param v - the vector to transform\n * @param q - the quaternion to transform by\n * @param dst - optional vec3 to store result. If not passed a new one is created.\n * @returns the transformed\n */\nfunction transformQuat(v: Vec3Arg, q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const w2 = q[3] * 2;\n\n const x = v[0];\n const y = v[1];\n const z = v[2];\n\n const uvX = qy * z - qz * y;\n const uvY = qz * x - qx * z;\n const uvZ = qx * y - qy * x;\n\n newDst[0] = x + uvX * w2 + (qy * uvZ - qz * uvY) * 2;\n newDst[1] = y + uvY * w2 + (qz * uvX - qx * uvZ) * 2;\n newDst[2] = z + uvZ * w2 + (qx * uvY - qy * uvX) * 2;\n\n return newDst;\n}\n\n/**\n * Returns the translation component of a 4-by-4 matrix as a vector with 3\n * entries.\n * @param m - The matrix.\n * @param dst - vector to hold result. If not passed a new one is created.\n * @returns The translation component of m.\n */\nfunction getTranslation(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n newDst[0] = m[12];\n newDst[1] = m[13];\n newDst[2] = m[14];\n return newDst;\n}\n/**\n * Returns an axis of a 4x4 matrix as a vector with 3 entries\n * @param m - The matrix.\n * @param axis - The axis 0 = x, 1 = y, 2 = z;\n * @returns The axis component of m.\n */\nfunction getAxis(m: Mat4Arg, axis: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const off = axis * 4;\n newDst[0] = m[off + 0];\n newDst[1] = m[off + 1];\n newDst[2] = m[off + 2];\n return newDst;\n}\n/**\n * Returns the scaling component of the matrix\n * @param m - The Matrix\n * @param dst - The vector to set. If not passed a new one is created.\n */\nfunction getScaling(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const xx = m[0];\n const xy = m[1];\n const xz = m[2];\n const yx = m[4];\n const yy = m[5];\n const yz = m[6];\n const zx = m[8];\n const zy = m[9];\n const zz = m[10];\n newDst[0] = Math.sqrt(xx * xx + xy * xy + xz * xz);\n newDst[1] = Math.sqrt(yx * yx + yy * yy + yz * yz);\n newDst[2] = Math.sqrt(zx * zx + zy * zy + zz * zz);\n return newDst;\n}\n\n/**\n * Rotate a 3D vector around the x-axis\n *\n * @param {ReadonlyVec3} a The vec3 point to rotate\n * @param {ReadonlyVec3} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @param dst - The vector to set. If not passed a new one is created.\n * @returns the rotated vector\n */\nfunction rotateX(a: Vec3Arg, b: Vec3Arg, rad: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const p = [];\n const r = [];\n\n //Translate point to the origin\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2];\n\n //perform rotation\n r[0] = p[0];\n r[1] = p[1] * Math.cos(rad) - p[2] * Math.sin(rad);\n r[2] = p[1] * Math.sin(rad) + p[2] * Math.cos(rad);\n\n //translate to correct position\n newDst[0] = r[0] + b[0];\n newDst[1] = r[1] + b[1];\n newDst[2] = r[2] + b[2];\n\n return newDst;\n}\n\n/**\n * Rotate a 3D vector around the y-axis\n *\n * @param {ReadonlyVec3} a The vec3 point to rotate\n * @param {ReadonlyVec3} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @param dst - The vector to set. If not passed a new one is created.\n * @returns the rotated vector\n */\nfunction rotateY(a: Vec3Arg, b: Vec3Arg, rad: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const p = [];\n const r = [];\n\n // translate point to the origin\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2];\n\n // perform rotation\n r[0] = p[2] * Math.sin(rad) + p[0] * Math.cos(rad);\n r[1] = p[1];\n r[2] = p[2] * Math.cos(rad) - p[0] * Math.sin(rad);\n\n // translate to correct position\n newDst[0] = r[0] + b[0];\n newDst[1] = r[1] + b[1];\n newDst[2] = r[2] + b[2];\n\n return newDst;\n}\n\n/**\n * Rotate a 3D vector around the z-axis\n *\n * @param {ReadonlyVec3} a The vec3 point to rotate\n * @param {ReadonlyVec3} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @param dst - The vector to set. If not passed a new one is created.\n * @returns {vec3} out\n */\nfunction rotateZ(a: Vec3Arg, b: Vec3Arg, rad: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const p = [];\n const r = [];\n\n // translate point to the origin\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2];\n\n // perform rotation\n r[0] = p[0] * Math.cos(rad) - p[1] * Math.sin(rad);\n r[1] = p[0] * Math.sin(rad) + p[1] * Math.cos(rad);\n r[2] = p[2];\n\n // translate to correct position\n newDst[0] = r[0] + b[0];\n newDst[1] = r[1] + b[1];\n newDst[2] = r[2] + b[2];\n\n return newDst;\n}\n\n/**\n * Treat a 3D vector as a direction and set it's length\n *\n * @param a The vec3 to lengthen\n * @param len The length of the resulting vector\n * @returns The lengthened vector\n */\nfunction setLength(a: Vec3Arg, len: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n normalize(a, newDst);\n return mulScalar(newDst, len, newDst);\n}\n\n/**\n * Ensure a vector is not longer than a max length\n *\n * @param a The vec3 to limit\n * @param maxLen The longest length of the resulting vector\n * @returns The vector, shortened to maxLen if it's too long\n */\nfunction truncate(a: Vec3Arg, maxLen: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n if (length(a) > maxLen) {\n return setLength(a, maxLen, newDst);\n }\n\n return copy(a, newDst);\n}\n\n/**\n * Return the vector exactly between 2 endpoint vectors\n *\n * @param a Endpoint 1\n * @param b Endpoint 2\n * @returns The vector exactly residing between endpoints 1 and 2\n */\nfunction midpoint(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n return lerp(a, b, 0.5, newDst);\n}\n\nreturn {\n create,\n fromValues,\n set,\n ceil,\n floor,\n round,\n clamp,\n add,\n addScaled,\n angle,\n subtract,\n sub,\n equalsApproximately,\n equals,\n lerp,\n lerpV,\n max,\n min,\n mulScalar,\n scale,\n divScalar,\n inverse,\n invert,\n cross,\n dot,\n length,\n len,\n lengthSq,\n lenSq,\n distance,\n dist,\n distanceSq,\n distSq,\n normalize,\n negate,\n copy,\n clone,\n multiply,\n mul,\n divide,\n div,\n random,\n zero,\n transformMat4,\n transformMat4Upper3x3,\n transformMat3,\n transformQuat,\n getTranslation,\n getAxis,\n getScaling,\n rotateX,\n rotateY,\n rotateZ,\n setLength,\n truncate,\n midpoint,\n};\n\n}\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\nexport function getAPI(Ctor: Vec3Ctor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n","import { Mat4Arg, Mat4Type } from './mat4';\nimport { Mat3Arg } from './mat3';\nimport { QuatArg } from './quat';\nimport { Vec3Arg } from './vec3';\nimport { getAPI as getVec3API } from './vec3-impl';\nimport { BaseArgType } from './types';\nimport * as utils from './utils';\n\nexport { Mat4Arg, Mat4Type };\n\ntype Mat4Ctor = new (n: number) => T;\n\n/**\n * Generates a typed API for Mat4\n * */\nfunction getAPIImpl(Ctor: Mat4Ctor) {\n const vec3 = getVec3API(Ctor);\n\n/**\n * 4x4 Matrix math math functions.\n *\n * Almost all functions take an optional `newDst` argument. If it is not passed in the\n * functions will create a new matrix. In other words you can do this\n *\n * const mat = mat4.translation([1, 2, 3]); // Creates a new translation matrix\n *\n * or\n *\n * const mat = mat4.create();\n * mat4.translation([1, 2, 3], mat); // Puts translation matrix in mat.\n *\n * The first style is often easier but depending on where it's used it generates garbage where\n * as there is almost never allocation with the second style.\n *\n * It is always save to pass any matrix as the destination. So for example\n *\n * const mat = mat4.identity();\n * const trans = mat4.translation([1, 2, 3]);\n * mat4.multiply(mat, trans, mat); // Multiplies mat * trans and puts result in mat.\n *\n */\n\n\n/**\n * Create a Mat4 from values\n *\n * Note: Since passing in a raw JavaScript array\n * is valid in all circumstances, if you want to\n * force a JavaScript array into a Mat4's specified type\n * it would be faster to use\n *\n * ```\n * const m = mat4.clone(someJSArray);\n * ```\n *\n * @param v0 - value for element 0\n * @param v1 - value for element 1\n * @param v2 - value for element 2\n * @param v3 - value for element 3\n * @param v4 - value for element 4\n * @param v5 - value for element 5\n * @param v6 - value for element 6\n * @param v7 - value for element 7\n * @param v8 - value for element 8\n * @param v9 - value for element 9\n * @param v10 - value for element 10\n * @param v11 - value for element 11\n * @param v12 - value for element 12\n * @param v13 - value for element 13\n * @param v14 - value for element 14\n * @param v15 - value for element 15\n * @returns created from values.\n */\nfunction create(\n v0?: number, v1?: number, v2?: number, v3?: number,\n v4?: number, v5?: number, v6?: number, v7?: number,\n v8?: number, v9?: number, v10?: number, v11?: number,\n v12?: number, v13?: number, v14?: number, v15?: number) {\n const newDst = new Ctor(16);\n if (v0 !== undefined) {\n newDst[0] = v0;\n if (v1 !== undefined) {\n newDst[1] = v1;\n if (v2 !== undefined) {\n newDst[2] = v2;\n if (v3 !== undefined) {\n newDst[3] = v3;\n if (v4 !== undefined) {\n newDst[4] = v4;\n if (v5 !== undefined) {\n newDst[5] = v5;\n if (v6 !== undefined) {\n newDst[6] = v6;\n if (v7 !== undefined) {\n newDst[7] = v7;\n if (v8 !== undefined) {\n newDst[8] = v8;\n if (v9 !== undefined) {\n newDst[9] = v9;\n if (v10 !== undefined) {\n newDst[10] = v10;\n if (v11 !== undefined) {\n newDst[11] = v11;\n if (v12 !== undefined) {\n newDst[12] = v12;\n if (v13 !== undefined) {\n newDst[13] = v13;\n if (v14 !== undefined) {\n newDst[14] = v14;\n if (v15 !== undefined) {\n newDst[15] = v15;\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n return newDst;\n}\n\n/**\n * Sets the values of a Mat4\n * Also see {@link mat4.create} and {@link mat4.copy}\n *\n * @param v0 - value for element 0\n * @param v1 - value for element 1\n * @param v2 - value for element 2\n * @param v3 - value for element 3\n * @param v4 - value for element 4\n * @param v5 - value for element 5\n * @param v6 - value for element 6\n * @param v7 - value for element 7\n * @param v8 - value for element 8\n * @param v9 - value for element 9\n * @param v10 - value for element 10\n * @param v11 - value for element 11\n * @param v12 - value for element 12\n * @param v13 - value for element 13\n * @param v14 - value for element 14\n * @param v15 - value for element 15\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat4 created from values.\n */\nfunction set(\n v0: number, v1: number, v2: number, v3: number,\n v4: number, v5: number, v6: number, v7: number,\n v8: number, v9: number, v10: number, v11: number,\n v12: number, v13: number, v14: number, v15: number,\n dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = v0; newDst[ 1] = v1; newDst[ 2] = v2; newDst[ 3] = v3;\n newDst[ 4] = v4; newDst[ 5] = v5; newDst[ 6] = v6; newDst[ 7] = v7;\n newDst[ 8] = v8; newDst[ 9] = v9; newDst[10] = v10; newDst[11] = v11;\n newDst[12] = v12; newDst[13] = v13; newDst[14] = v14; newDst[15] = v15;\n\n return newDst;\n}\n\n/**\n * Creates a Mat4 from a Mat3\n * @param m3 - source matrix\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat4 made from m3\n */\nfunction fromMat3(m3: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = m3[0]; newDst[ 1] = m3[1]; newDst[ 2] = m3[ 2]; newDst[ 3] = 0;\n newDst[ 4] = m3[4]; newDst[ 5] = m3[5]; newDst[ 6] = m3[ 6]; newDst[ 7] = 0;\n newDst[ 8] = m3[8]; newDst[ 9] = m3[9]; newDst[10] = m3[10]; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Creates a Mat4 rotation matrix from a quaternion\n * @param q - quaternion to create matrix from\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat4 made from q\n */\nfunction fromQuat(q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const x = q[0]; const y = q[1]; const z = q[2]; const w = q[3];\n const x2 = x + x; const y2 = y + y; const z2 = z + z;\n\n const xx = x * x2;\n const yx = y * x2;\n const yy = y * y2;\n const zx = z * x2;\n const zy = z * y2;\n const zz = z * z2;\n const wx = w * x2;\n const wy = w * y2;\n const wz = w * z2;\n\n newDst[ 0] = 1 - yy - zz; newDst[ 1] = yx + wz; newDst[ 2] = zx - wy; newDst[ 3] = 0;\n newDst[ 4] = yx - wz; newDst[ 5] = 1 - xx - zz; newDst[ 6] = zy + wx; newDst[ 7] = 0;\n newDst[ 8] = zx + wy; newDst[ 9] = zy - wx; newDst[10] = 1 - xx - yy; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Negates a matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns -m.\n */\nfunction negate(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = -m[ 0]; newDst[ 1] = -m[ 1]; newDst[ 2] = -m[ 2]; newDst[ 3] = -m[ 3];\n newDst[ 4] = -m[ 4]; newDst[ 5] = -m[ 5]; newDst[ 6] = -m[ 6]; newDst[ 7] = -m[ 7];\n newDst[ 8] = -m[ 8]; newDst[ 9] = -m[ 9]; newDst[10] = -m[10]; newDst[11] = -m[11];\n newDst[12] = -m[12]; newDst[13] = -m[13]; newDst[14] = -m[14]; newDst[15] = -m[15];\n\n return newDst;\n}\n\n/**\n * Copies a matrix. (same as {@link mat4.clone})\n * Also see {@link mat4.create} and {@link mat4.set}\n * @param m - The matrix.\n * @param dst - The matrix. If not passed a new one is created.\n * @returns A copy of m.\n */\nfunction copy(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = m[ 0]; newDst[ 1] = m[ 1]; newDst[ 2] = m[ 2]; newDst[ 3] = m[ 3];\n newDst[ 4] = m[ 4]; newDst[ 5] = m[ 5]; newDst[ 6] = m[ 6]; newDst[ 7] = m[ 7];\n newDst[ 8] = m[ 8]; newDst[ 9] = m[ 9]; newDst[10] = m[10]; newDst[11] = m[11];\n newDst[12] = m[12]; newDst[13] = m[13]; newDst[14] = m[14]; newDst[15] = m[15];\n\n return newDst;\n}\n\n/**\n * Copies a matrix (same as {@link mat4.copy})\n * Also see {@link mat4.create} and {@link mat4.set}\n * @param m - The matrix.\n * @param dst - The matrix. If not passed a new one is created.\n * @returns A copy of m.\n */\nconst clone = copy;\n\n/**\n * Check if 2 matrices are approximately equal\n * @param a - Operand matrix.\n * @param b - Operand matrix.\n * @returns true if matrices are approximately equal\n */\nfunction equalsApproximately(a: Mat4Arg, b: Mat4Arg): boolean {\n return Math.abs(a[ 0] - b[ 0]) < utils.EPSILON &&\n Math.abs(a[ 1] - b[ 1]) < utils.EPSILON &&\n Math.abs(a[ 2] - b[ 2]) < utils.EPSILON &&\n Math.abs(a[ 3] - b[ 3]) < utils.EPSILON &&\n Math.abs(a[ 4] - b[ 4]) < utils.EPSILON &&\n Math.abs(a[ 5] - b[ 5]) < utils.EPSILON &&\n Math.abs(a[ 6] - b[ 6]) < utils.EPSILON &&\n Math.abs(a[ 7] - b[ 7]) < utils.EPSILON &&\n Math.abs(a[ 8] - b[ 8]) < utils.EPSILON &&\n Math.abs(a[ 9] - b[ 9]) < utils.EPSILON &&\n Math.abs(a[10] - b[10]) < utils.EPSILON &&\n Math.abs(a[11] - b[11]) < utils.EPSILON &&\n Math.abs(a[12] - b[12]) < utils.EPSILON &&\n Math.abs(a[13] - b[13]) < utils.EPSILON &&\n Math.abs(a[14] - b[14]) < utils.EPSILON &&\n Math.abs(a[15] - b[15]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 matrices are exactly equal\n * @param a - Operand matrix.\n * @param b - Operand matrix.\n * @returns true if matrices are exactly equal\n */\nfunction equals(a: Mat4Arg, b: Mat4Arg): boolean {\n return a[ 0] === b[ 0] &&\n a[ 1] === b[ 1] &&\n a[ 2] === b[ 2] &&\n a[ 3] === b[ 3] &&\n a[ 4] === b[ 4] &&\n a[ 5] === b[ 5] &&\n a[ 6] === b[ 6] &&\n a[ 7] === b[ 7] &&\n a[ 8] === b[ 8] &&\n a[ 9] === b[ 9] &&\n a[10] === b[10] &&\n a[11] === b[11] &&\n a[12] === b[12] &&\n a[13] === b[13] &&\n a[14] === b[14] &&\n a[15] === b[15];\n}\n\n/**\n * Creates a 4-by-4 identity matrix.\n *\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns A 4-by-4 identity matrix.\n */\nfunction identity(dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = 1; newDst[ 1] = 0; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = 1; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Takes the transpose of a matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The transpose of m.\n */\nfunction transpose(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n if (newDst === m) {\n let t;\n\n t = m[1];\n m[1] = m[4];\n m[4] = t;\n\n t = m[2];\n m[2] = m[8];\n m[8] = t;\n\n t = m[3];\n m[3] = m[12];\n m[12] = t;\n\n t = m[6];\n m[6] = m[9];\n m[9] = t;\n\n t = m[7];\n m[7] = m[13];\n m[13] = t;\n\n t = m[11];\n m[11] = m[14];\n m[14] = t;\n return newDst;\n }\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const m30 = m[3 * 4 + 0];\n const m31 = m[3 * 4 + 1];\n const m32 = m[3 * 4 + 2];\n const m33 = m[3 * 4 + 3];\n\n newDst[ 0] = m00; newDst[ 1] = m10; newDst[ 2] = m20; newDst[ 3] = m30;\n newDst[ 4] = m01; newDst[ 5] = m11; newDst[ 6] = m21; newDst[ 7] = m31;\n newDst[ 8] = m02; newDst[ 9] = m12; newDst[10] = m22; newDst[11] = m32;\n newDst[12] = m03; newDst[13] = m13; newDst[14] = m23; newDst[15] = m33;\n\n return newDst;\n}\n\n/**\n * Computes the inverse of a 4-by-4 matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The inverse of m.\n */\nfunction inverse(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const m30 = m[3 * 4 + 0];\n const m31 = m[3 * 4 + 1];\n const m32 = m[3 * 4 + 2];\n const m33 = m[3 * 4 + 3];\n const tmp0 = m22 * m33;\n const tmp1 = m32 * m23;\n const tmp2 = m12 * m33;\n const tmp3 = m32 * m13;\n const tmp4 = m12 * m23;\n const tmp5 = m22 * m13;\n const tmp6 = m02 * m33;\n const tmp7 = m32 * m03;\n const tmp8 = m02 * m23;\n const tmp9 = m22 * m03;\n const tmp10 = m02 * m13;\n const tmp11 = m12 * m03;\n const tmp12 = m20 * m31;\n const tmp13 = m30 * m21;\n const tmp14 = m10 * m31;\n const tmp15 = m30 * m11;\n const tmp16 = m10 * m21;\n const tmp17 = m20 * m11;\n const tmp18 = m00 * m31;\n const tmp19 = m30 * m01;\n const tmp20 = m00 * m21;\n const tmp21 = m20 * m01;\n const tmp22 = m00 * m11;\n const tmp23 = m10 * m01;\n\n const t0 = (tmp0 * m11 + tmp3 * m21 + tmp4 * m31) -\n (tmp1 * m11 + tmp2 * m21 + tmp5 * m31);\n const t1 = (tmp1 * m01 + tmp6 * m21 + tmp9 * m31) -\n (tmp0 * m01 + tmp7 * m21 + tmp8 * m31);\n const t2 = (tmp2 * m01 + tmp7 * m11 + tmp10 * m31) -\n (tmp3 * m01 + tmp6 * m11 + tmp11 * m31);\n const t3 = (tmp5 * m01 + tmp8 * m11 + tmp11 * m21) -\n (tmp4 * m01 + tmp9 * m11 + tmp10 * m21);\n\n const d = 1 / (m00 * t0 + m10 * t1 + m20 * t2 + m30 * t3);\n\n newDst[ 0] = d * t0;\n newDst[ 1] = d * t1;\n newDst[ 2] = d * t2;\n newDst[ 3] = d * t3;\n newDst[ 4] = d * ((tmp1 * m10 + tmp2 * m20 + tmp5 * m30) -\n (tmp0 * m10 + tmp3 * m20 + tmp4 * m30));\n newDst[ 5] = d * ((tmp0 * m00 + tmp7 * m20 + tmp8 * m30) -\n (tmp1 * m00 + tmp6 * m20 + tmp9 * m30));\n newDst[ 6] = d * ((tmp3 * m00 + tmp6 * m10 + tmp11 * m30) -\n (tmp2 * m00 + tmp7 * m10 + tmp10 * m30));\n newDst[ 7] = d * ((tmp4 * m00 + tmp9 * m10 + tmp10 * m20) -\n (tmp5 * m00 + tmp8 * m10 + tmp11 * m20));\n newDst[ 8] = d * ((tmp12 * m13 + tmp15 * m23 + tmp16 * m33) -\n (tmp13 * m13 + tmp14 * m23 + tmp17 * m33));\n newDst[ 9] = d * ((tmp13 * m03 + tmp18 * m23 + tmp21 * m33) -\n (tmp12 * m03 + tmp19 * m23 + tmp20 * m33));\n newDst[10] = d * ((tmp14 * m03 + tmp19 * m13 + tmp22 * m33) -\n (tmp15 * m03 + tmp18 * m13 + tmp23 * m33));\n newDst[11] = d * ((tmp17 * m03 + tmp20 * m13 + tmp23 * m23) -\n (tmp16 * m03 + tmp21 * m13 + tmp22 * m23));\n newDst[12] = d * ((tmp14 * m22 + tmp17 * m32 + tmp13 * m12) -\n (tmp16 * m32 + tmp12 * m12 + tmp15 * m22));\n newDst[13] = d * ((tmp20 * m32 + tmp12 * m02 + tmp19 * m22) -\n (tmp18 * m22 + tmp21 * m32 + tmp13 * m02));\n newDst[14] = d * ((tmp18 * m12 + tmp23 * m32 + tmp15 * m02) -\n (tmp22 * m32 + tmp14 * m02 + tmp19 * m12));\n newDst[15] = d * ((tmp22 * m22 + tmp16 * m02 + tmp21 * m12) -\n (tmp20 * m12 + tmp23 * m22 + tmp17 * m02));\n\n return newDst;\n}\n\n/**\n * Compute the determinant of a matrix\n * @param m - the matrix\n * @returns the determinant\n */\nfunction determinant(m: Mat4Arg): number {\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const m30 = m[3 * 4 + 0];\n const m31 = m[3 * 4 + 1];\n const m32 = m[3 * 4 + 2];\n const m33 = m[3 * 4 + 3];\n\n const tmp0 = m22 * m33;\n const tmp1 = m32 * m23;\n const tmp2 = m12 * m33;\n const tmp3 = m32 * m13;\n const tmp4 = m12 * m23;\n const tmp5 = m22 * m13;\n const tmp6 = m02 * m33;\n const tmp7 = m32 * m03;\n const tmp8 = m02 * m23;\n const tmp9 = m22 * m03;\n const tmp10 = m02 * m13;\n const tmp11 = m12 * m03;\n\n const t0 = (tmp0 * m11 + tmp3 * m21 + tmp4 * m31) -\n (tmp1 * m11 + tmp2 * m21 + tmp5 * m31);\n const t1 = (tmp1 * m01 + tmp6 * m21 + tmp9 * m31) -\n (tmp0 * m01 + tmp7 * m21 + tmp8 * m31);\n const t2 = (tmp2 * m01 + tmp7 * m11 + tmp10 * m31) -\n (tmp3 * m01 + tmp6 * m11 + tmp11 * m31);\n const t3 = (tmp5 * m01 + tmp8 * m11 + tmp11 * m21) -\n (tmp4 * m01 + tmp9 * m11 + tmp10 * m21);\n\n return m00 * t0 + m10 * t1 + m20 * t2 + m30 * t3;\n}\n\n/**\n * Computes the inverse of a 4-by-4 matrix. (same as inverse)\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The inverse of m.\n */\nconst invert = inverse;\n\n/**\n * Multiplies two 4-by-4 matrices with a on the left and b on the right\n * @param a - The matrix on the left.\n * @param b - The matrix on the right.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix product of a and b.\n */\nfunction multiply(a: Mat4Arg, b: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a03 = a[3];\n const a10 = a[ 4 + 0];\n const a11 = a[ 4 + 1];\n const a12 = a[ 4 + 2];\n const a13 = a[ 4 + 3];\n const a20 = a[ 8 + 0];\n const a21 = a[ 8 + 1];\n const a22 = a[ 8 + 2];\n const a23 = a[ 8 + 3];\n const a30 = a[12 + 0];\n const a31 = a[12 + 1];\n const a32 = a[12 + 2];\n const a33 = a[12 + 3];\n const b00 = b[0];\n const b01 = b[1];\n const b02 = b[2];\n const b03 = b[3];\n const b10 = b[ 4 + 0];\n const b11 = b[ 4 + 1];\n const b12 = b[ 4 + 2];\n const b13 = b[ 4 + 3];\n const b20 = b[ 8 + 0];\n const b21 = b[ 8 + 1];\n const b22 = b[ 8 + 2];\n const b23 = b[ 8 + 3];\n const b30 = b[12 + 0];\n const b31 = b[12 + 1];\n const b32 = b[12 + 2];\n const b33 = b[12 + 3];\n\n newDst[ 0] = a00 * b00 + a10 * b01 + a20 * b02 + a30 * b03;\n newDst[ 1] = a01 * b00 + a11 * b01 + a21 * b02 + a31 * b03;\n newDst[ 2] = a02 * b00 + a12 * b01 + a22 * b02 + a32 * b03;\n newDst[ 3] = a03 * b00 + a13 * b01 + a23 * b02 + a33 * b03;\n newDst[ 4] = a00 * b10 + a10 * b11 + a20 * b12 + a30 * b13;\n newDst[ 5] = a01 * b10 + a11 * b11 + a21 * b12 + a31 * b13;\n newDst[ 6] = a02 * b10 + a12 * b11 + a22 * b12 + a32 * b13;\n newDst[ 7] = a03 * b10 + a13 * b11 + a23 * b12 + a33 * b13;\n newDst[ 8] = a00 * b20 + a10 * b21 + a20 * b22 + a30 * b23;\n newDst[ 9] = a01 * b20 + a11 * b21 + a21 * b22 + a31 * b23;\n newDst[10] = a02 * b20 + a12 * b21 + a22 * b22 + a32 * b23;\n newDst[11] = a03 * b20 + a13 * b21 + a23 * b22 + a33 * b23;\n newDst[12] = a00 * b30 + a10 * b31 + a20 * b32 + a30 * b33;\n newDst[13] = a01 * b30 + a11 * b31 + a21 * b32 + a31 * b33;\n newDst[14] = a02 * b30 + a12 * b31 + a22 * b32 + a32 * b33;\n newDst[15] = a03 * b30 + a13 * b31 + a23 * b32 + a33 * b33;\n\n return newDst;\n}\n\n/**\n * Multiplies two 4-by-4 matrices with a on the left and b on the right (same as multiply)\n * @param a - The matrix on the left.\n * @param b - The matrix on the right.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix product of a and b.\n */\nconst mul = multiply;\n\n/**\n * Sets the translation component of a 4-by-4 matrix to the given\n * vector.\n * @param a - The matrix.\n * @param v - The vector.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix with translation set.\n */\nfunction setTranslation(a: Mat4Arg, v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? identity()) as T;\n if (a !== newDst) {\n newDst[ 0] = a[ 0];\n newDst[ 1] = a[ 1];\n newDst[ 2] = a[ 2];\n newDst[ 3] = a[ 3];\n newDst[ 4] = a[ 4];\n newDst[ 5] = a[ 5];\n newDst[ 6] = a[ 6];\n newDst[ 7] = a[ 7];\n newDst[ 8] = a[ 8];\n newDst[ 9] = a[ 9];\n newDst[10] = a[10];\n newDst[11] = a[11];\n }\n newDst[12] = v[0];\n newDst[13] = v[1];\n newDst[14] = v[2];\n newDst[15] = 1;\n return newDst;\n}\n\n///**\n// * Returns the translation component of a 4-by-4 matrix as a vector with 3\n// * entries.\n// * @param m - The matrix.\n// * @param dst - vector to hold result. If not passed a new one is created.\n// * @returns The translation component of m.\n// */\nfunction getTranslation(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? vec3.create()) as T;\n newDst[0] = m[12];\n newDst[1] = m[13];\n newDst[2] = m[14];\n return newDst;\n}\n\n/**\n * Returns an axis of a 4x4 matrix as a vector with 3 entries\n * @param m - The matrix.\n * @param axis - The axis 0 = x, 1 = y, 2 = z;\n * @returns The axis component of m.\n */\nfunction getAxis(m: Mat4Arg, axis: number, dst?: T) {\n const newDst = (dst ?? vec3.create());\n const off = axis * 4;\n newDst[0] = m[off + 0];\n newDst[1] = m[off + 1];\n newDst[2] = m[off + 2];\n return newDst;\n}\n\n/**\n * Sets an axis of a 4x4 matrix as a vector with 3 entries\n * @param m - The matrix.\n * @param v - the axis vector\n * @param axis - The axis 0 = x, 1 = y, 2 = z;\n * @param dst - The matrix to set. If not passed a new one is created.\n * @returns The matrix with axis set.\n */\nfunction setAxis(m: Mat4Arg, v: Vec3Arg, axis: number, dst: T) {\n const newDst = (dst === m) ? dst : copy(m, dst);\n\n const off = axis * 4;\n newDst[off + 0] = v[0];\n newDst[off + 1] = v[1];\n newDst[off + 2] = v[2];\n return newDst;\n}\n\n///**\n// * Returns the scaling component of the matrix\n// * @param m - The Matrix\n// * @param dst - The vector to set. If not passed a new one is created.\n// */\nfunction getScaling(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? vec3.create()) as T;\n\n const xx = m[0];\n const xy = m[1];\n const xz = m[2];\n const yx = m[4];\n const yy = m[5];\n const yz = m[6];\n const zx = m[8];\n const zy = m[9];\n const zz = m[10];\n\n newDst[0] = Math.sqrt(xx * xx + xy * xy + xz * xz);\n newDst[1] = Math.sqrt(yx * yx + yy * yy + yz * yz);\n newDst[2] = Math.sqrt(zx * zx + zy * zy + zz * zz);\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 perspective transformation matrix given the angular height\n * of the frustum, the aspect ratio, and the near and far clipping planes. The\n * arguments define a frustum extending in the negative z direction. The given\n * angle is the vertical angle of the frustum, and the horizontal angle is\n * determined to produce the given aspect ratio. The arguments near and far are\n * the distances to the near and far clipping planes. Note that near and far\n * are not z coordinates, but rather they are distances along the negative\n * z-axis. The matrix generated sends the viewing frustum to the unit box.\n * We assume a unit box extending from -1 to 1 in the x and y dimensions and\n * from 0 to 1 in the z dimension.\n *\n * Note: If you pass `Infinity` for zFar then it will produce a projection matrix\n * returns -Infinity for Z when transforming coordinates with Z <= 0 and +Infinity for Z\n * otherwise.\n *\n * @param fieldOfViewYInRadians - The camera angle from top to bottom (in radians).\n * @param aspect - The aspect ratio width / height.\n * @param zNear - The depth (negative z coordinate)\n * of the near clipping plane.\n * @param zFar - The depth (negative z coordinate)\n * of the far clipping plane.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The perspective matrix.\n */\nfunction perspective(fieldOfViewYInRadians: number, aspect: number, zNear: number, zFar: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const f = Math.tan(Math.PI * 0.5 - 0.5 * fieldOfViewYInRadians);\n\n newDst[0] = f / aspect;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 0;\n\n newDst[4] = 0;\n newDst[5] = f;\n newDst[6] = 0;\n newDst[7] = 0;\n\n newDst[8] = 0;\n newDst[9] = 0;\n newDst[11] = -1;\n\n newDst[12] = 0;\n newDst[13] = 0;\n newDst[15] = 0;\n\n if (Number.isFinite(zFar)) {\n const rangeInv = 1 / (zNear - zFar);\n newDst[10] = zFar * rangeInv;\n newDst[14] = zFar * zNear * rangeInv;\n } else {\n newDst[10] = -1;\n newDst[14] = -zNear;\n }\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 reverse-z perspective transformation matrix given the angular height\n * of the frustum, the aspect ratio, and the near and far clipping planes. The\n * arguments define a frustum extending in the negative z direction. The given\n * angle is the vertical angle of the frustum, and the horizontal angle is\n * determined to produce the given aspect ratio. The arguments near and far are\n * the distances to the near and far clipping planes. Note that near and far\n * are not z coordinates, but rather they are distances along the negative\n * z-axis. The matrix generated sends the viewing frustum to the unit box.\n * We assume a unit box extending from -1 to 1 in the x and y dimensions and\n * from 1 (at -zNear) to 0 (at -zFar) in the z dimension.\n *\n * @param fieldOfViewYInRadians - The camera angle from top to bottom (in radians).\n * @param aspect - The aspect ratio width / height.\n * @param zNear - The depth (negative z coordinate)\n * of the near clipping plane.\n * @param zFar - The depth (negative z coordinate)\n * of the far clipping plane. (default = Infinity)\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The perspective matrix.\n */function perspectiveReverseZ(fieldOfViewYInRadians: number, aspect: number, zNear: number, zFar = Infinity, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const f = 1 / Math.tan(fieldOfViewYInRadians * 0.5);\n\n newDst[ 0] = f / aspect;\n newDst[ 1] = 0;\n newDst[ 2] = 0;\n newDst[ 3] = 0;\n\n newDst[ 4] = 0;\n newDst[ 5] = f;\n newDst[ 6] = 0;\n newDst[ 7] = 0;\n\n newDst[ 8] = 0;\n newDst[ 9] = 0;\n newDst[11] = -1;\n\n newDst[12] = 0;\n newDst[13] = 0;\n newDst[15] = 0;\n\n if (zFar === Infinity) {\n newDst[10] = 0;\n newDst[14] = zNear;\n } else {\n const rangeInv = 1 / (zFar - zNear);\n newDst[10] = zNear * rangeInv;\n newDst[14] = zFar * zNear * rangeInv;\n }\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 orthogonal transformation matrix that transforms from\n * the given the left, right, bottom, and top dimensions to -1 +1 in x, and y\n * and 0 to +1 in z.\n * @param left - Left side of the near clipping plane viewport.\n * @param right - Right side of the near clipping plane viewport.\n * @param bottom - Bottom of the near clipping plane viewport.\n * @param top - Top of the near clipping plane viewport.\n * @param near - The depth (negative z coordinate)\n * of the near clipping plane.\n * @param far - The depth (negative z coordinate)\n * of the far clipping plane.\n * @param dst - Output matrix. If not passed a new one is created.\n * @returns The orthographic projection matrix.\n */\nfunction ortho(left: number, right: number, bottom: number, top: number, near: number, far: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[0] = 2 / (right - left);\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 0;\n\n newDst[4] = 0;\n newDst[5] = 2 / (top - bottom);\n newDst[6] = 0;\n newDst[7] = 0;\n\n newDst[8] = 0;\n newDst[9] = 0;\n newDst[10] = 1 / (near - far);\n newDst[11] = 0;\n\n newDst[12] = (right + left) / (left - right);\n newDst[13] = (top + bottom) / (bottom - top);\n newDst[14] = near / (near - far);\n newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 perspective transformation matrix given the left, right,\n * top, bottom, near and far clipping planes. The arguments define a frustum\n * extending in the negative z direction. The arguments near and far are the\n * distances to the near and far clipping planes. Note that near and far are not\n * z coordinates, but rather they are distances along the negative z-axis. The\n * matrix generated sends the viewing frustum to the unit box. We assume a unit\n * box extending from -1 to 1 in the x and y dimensions and from 0 to 1 in the z\n * dimension.\n * @param left - The x coordinate of the left plane of the box.\n * @param right - The x coordinate of the right plane of the box.\n * @param bottom - The y coordinate of the bottom plane of the box.\n * @param top - The y coordinate of the right plane of the box.\n * @param near - The negative z coordinate of the near plane of the box.\n * @param far - The negative z coordinate of the far plane of the box.\n * @param dst - Output matrix. If not passed a new one is created.\n * @returns The perspective projection matrix.\n */\nfunction frustum(left: number, right: number, bottom: number, top: number, near: number, far: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const dx = (right - left);\n const dy = (top - bottom);\n const dz = (near - far);\n\n newDst[ 0] = 2 * near / dx;\n newDst[ 1] = 0;\n newDst[ 2] = 0;\n newDst[ 3] = 0;\n newDst[ 4] = 0;\n newDst[ 5] = 2 * near / dy;\n newDst[ 6] = 0;\n newDst[ 7] = 0;\n newDst[ 8] = (left + right) / dx;\n newDst[ 9] = (top + bottom) / dy;\n newDst[10] = far / dz;\n newDst[11] = -1;\n newDst[12] = 0;\n newDst[13] = 0;\n newDst[14] = near * far / dz;\n newDst[15] = 0;\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 reverse-z perspective transformation matrix given the left, right,\n * top, bottom, near and far clipping planes. The arguments define a frustum\n * extending in the negative z direction. The arguments near and far are the\n * distances to the near and far clipping planes. Note that near and far are not\n * z coordinates, but rather they are distances along the negative z-axis. The\n * matrix generated sends the viewing frustum to the unit box. We assume a unit\n * box extending from -1 to 1 in the x and y dimensions and from 1 (-near) to 0 (-far) in the z\n * dimension.\n * @param left - The x coordinate of the left plane of the box.\n * @param right - The x coordinate of the right plane of the box.\n * @param bottom - The y coordinate of the bottom plane of the box.\n * @param top - The y coordinate of the right plane of the box.\n * @param near - The negative z coordinate of the near plane of the box.\n * @param far - The negative z coordinate of the far plane of the box.\n * @param dst - Output matrix. If not passed a new one is created.\n * @returns The perspective projection matrix.\n */\nfunction frustumReverseZ(left: number, right: number, bottom: number, top: number, near: number, far = Infinity, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const dx = (right - left);\n const dy = (top - bottom);\n\n newDst[ 0] = 2 * near / dx;\n newDst[ 1] = 0;\n newDst[ 2] = 0;\n newDst[ 3] = 0;\n newDst[ 4] = 0;\n newDst[ 5] = 2 * near / dy;\n newDst[ 6] = 0;\n newDst[ 7] = 0;\n newDst[ 8] = (left + right) / dx;\n newDst[ 9] = (top + bottom) / dy;\n newDst[11] = -1;\n newDst[12] = 0;\n newDst[13] = 0;\n newDst[15] = 0;\n\n if (far === Infinity) {\n newDst[10] = 0;\n newDst[14] = near;\n } else {\n const rangeInv = 1 / (far - near);\n newDst[10] = near * rangeInv;\n newDst[14] = far * near * rangeInv;\n }\n\n return newDst;\n}\n\nconst xAxis = vec3.create();\nconst yAxis = vec3.create();\nconst zAxis = vec3.create();\n\n/**\n * Computes a 4-by-4 aim transformation.\n *\n * This is a matrix which positions an object aiming down positive Z.\n * toward the target.\n *\n * Note: this is **NOT** the inverse of lookAt as lookAt looks at negative Z.\n *\n * @param position - The position of the object.\n * @param target - The position meant to be aimed at.\n * @param up - A vector pointing up.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The aim matrix.\n */\nfunction aim(position: Vec3Arg, target: Vec3Arg, up: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n vec3.normalize(vec3.subtract(target, position, zAxis), zAxis);\n vec3.normalize(vec3.cross(up, zAxis, xAxis), xAxis);\n vec3.normalize(vec3.cross(zAxis, xAxis, yAxis), yAxis);\n\n newDst[ 0] = xAxis[0]; newDst[ 1] = xAxis[1]; newDst[ 2] = xAxis[2]; newDst[ 3] = 0;\n newDst[ 4] = yAxis[0]; newDst[ 5] = yAxis[1]; newDst[ 6] = yAxis[2]; newDst[ 7] = 0;\n newDst[ 8] = zAxis[0]; newDst[ 9] = zAxis[1]; newDst[10] = zAxis[2]; newDst[11] = 0;\n newDst[12] = position[0]; newDst[13] = position[1]; newDst[14] = position[2]; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 camera aim transformation.\n *\n * This is a matrix which positions an object aiming down negative Z.\n * toward the target.\n *\n * Note: this is the inverse of `lookAt`\n *\n * @param eye - The position of the object.\n * @param target - The position meant to be aimed at.\n * @param up - A vector pointing up.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The aim matrix.\n */\nfunction cameraAim(eye: Vec3Arg, target: Vec3Arg, up: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n vec3.normalize(vec3.subtract(eye, target, zAxis), zAxis);\n vec3.normalize(vec3.cross(up, zAxis, xAxis), xAxis);\n vec3.normalize(vec3.cross(zAxis, xAxis, yAxis), yAxis);\n\n newDst[ 0] = xAxis[0]; newDst[ 1] = xAxis[1]; newDst[ 2] = xAxis[2]; newDst[ 3] = 0;\n newDst[ 4] = yAxis[0]; newDst[ 5] = yAxis[1]; newDst[ 6] = yAxis[2]; newDst[ 7] = 0;\n newDst[ 8] = zAxis[0]; newDst[ 9] = zAxis[1]; newDst[10] = zAxis[2]; newDst[11] = 0;\n newDst[12] = eye[0]; newDst[13] = eye[1]; newDst[14] = eye[2]; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 view transformation.\n *\n * This is a view matrix which transforms all other objects\n * to be in the space of the view defined by the parameters.\n *\n * @param eye - The position of the object.\n * @param target - The position meant to be aimed at.\n * @param up - A vector pointing up.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The look-at matrix.\n */\nfunction lookAt(eye: Vec3Arg, target: Vec3Arg, up: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n vec3.normalize(vec3.subtract(eye, target, zAxis), zAxis);\n vec3.normalize(vec3.cross(up, zAxis, xAxis), xAxis);\n vec3.normalize(vec3.cross(zAxis, xAxis, yAxis), yAxis);\n\n newDst[ 0] = xAxis[0]; newDst[ 1] = yAxis[0]; newDst[ 2] = zAxis[0]; newDst[ 3] = 0;\n newDst[ 4] = xAxis[1]; newDst[ 5] = yAxis[1]; newDst[ 6] = zAxis[1]; newDst[ 7] = 0;\n newDst[ 8] = xAxis[2]; newDst[ 9] = yAxis[2]; newDst[10] = zAxis[2]; newDst[11] = 0;\n\n newDst[12] = -(xAxis[0] * eye[0] + xAxis[1] * eye[1] + xAxis[2] * eye[2]);\n newDst[13] = -(yAxis[0] * eye[0] + yAxis[1] * eye[1] + yAxis[2] * eye[2]);\n newDst[14] = -(zAxis[0] * eye[0] + zAxis[1] * eye[1] + zAxis[2] * eye[2]);\n newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which translates by the given vector v.\n * @param v - The vector by\n * which to translate.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The translation matrix.\n */\nfunction translation(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = 1; newDst[ 1] = 0; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = 1; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1; newDst[11] = 0;\n newDst[12] = v[0]; newDst[13] = v[1]; newDst[14] = v[2]; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Translates the given 4-by-4 matrix by the given vector v.\n * @param m - The matrix.\n * @param v - The vector by\n * which to translate.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The translated matrix.\n */\nfunction translate(m: Mat4Arg, v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const m00 = m[0];\n const m01 = m[1];\n const m02 = m[2];\n const m03 = m[3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const m30 = m[3 * 4 + 0];\n const m31 = m[3 * 4 + 1];\n const m32 = m[3 * 4 + 2];\n const m33 = m[3 * 4 + 3];\n\n if (m !== newDst) {\n newDst[ 0] = m00;\n newDst[ 1] = m01;\n newDst[ 2] = m02;\n newDst[ 3] = m03;\n newDst[ 4] = m10;\n newDst[ 5] = m11;\n newDst[ 6] = m12;\n newDst[ 7] = m13;\n newDst[ 8] = m20;\n newDst[ 9] = m21;\n newDst[10] = m22;\n newDst[11] = m23;\n }\n\n newDst[12] = m00 * v0 + m10 * v1 + m20 * v2 + m30;\n newDst[13] = m01 * v0 + m11 * v1 + m21 * v2 + m31;\n newDst[14] = m02 * v0 + m12 * v1 + m22 * v2 + m32;\n newDst[15] = m03 * v0 + m13 * v1 + m23 * v2 + m33;\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the x-axis by the given angle.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotation matrix.\n */\nfunction rotationX(angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = 1; newDst[ 1] = 0; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = c; newDst[ 6] = s; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = -s; newDst[10] = c; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Rotates the given 4-by-4 matrix around the x-axis by the given\n * angle.\n * @param m - The matrix.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nfunction rotateX(m: Mat4Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const m10 = m[4];\n const m11 = m[5];\n const m12 = m[6];\n const m13 = m[7];\n const m20 = m[8];\n const m21 = m[9];\n const m22 = m[10];\n const m23 = m[11];\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[4] = c * m10 + s * m20;\n newDst[5] = c * m11 + s * m21;\n newDst[6] = c * m12 + s * m22;\n newDst[7] = c * m13 + s * m23;\n newDst[8] = c * m20 - s * m10;\n newDst[9] = c * m21 - s * m11;\n newDst[10] = c * m22 - s * m12;\n newDst[11] = c * m23 - s * m13;\n\n if (m !== newDst) {\n newDst[ 0] = m[ 0];\n newDst[ 1] = m[ 1];\n newDst[ 2] = m[ 2];\n newDst[ 3] = m[ 3];\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the y-axis by the given angle.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotation matrix.\n */\nfunction rotationY(angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c; newDst[ 1] = 0; newDst[ 2] = -s; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = 1; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = s; newDst[ 9] = 0; newDst[10] = c; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Rotates the given 4-by-4 matrix around the y-axis by the given\n * angle.\n * @param m - The matrix.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nfunction rotateY(m: Mat4Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c * m00 - s * m20;\n newDst[ 1] = c * m01 - s * m21;\n newDst[ 2] = c * m02 - s * m22;\n newDst[ 3] = c * m03 - s * m23;\n newDst[ 8] = c * m20 + s * m00;\n newDst[ 9] = c * m21 + s * m01;\n newDst[10] = c * m22 + s * m02;\n newDst[11] = c * m23 + s * m03;\n\n if (m !== newDst) {\n newDst[ 4] = m[ 4];\n newDst[ 5] = m[ 5];\n newDst[ 6] = m[ 6];\n newDst[ 7] = m[ 7];\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the z-axis by the given angle.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotation matrix.\n */\nfunction rotationZ(angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c; newDst[ 1] = s; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = -s; newDst[ 5] = c; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Rotates the given 4-by-4 matrix around the z-axis by the given\n * angle.\n * @param m - The matrix.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nfunction rotateZ(m: Mat4Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c * m00 + s * m10;\n newDst[ 1] = c * m01 + s * m11;\n newDst[ 2] = c * m02 + s * m12;\n newDst[ 3] = c * m03 + s * m13;\n newDst[ 4] = c * m10 - s * m00;\n newDst[ 5] = c * m11 - s * m01;\n newDst[ 6] = c * m12 - s * m02;\n newDst[ 7] = c * m13 - s * m03;\n\n if (m !== newDst) {\n newDst[ 8] = m[ 8];\n newDst[ 9] = m[ 9];\n newDst[10] = m[10];\n newDst[11] = m[11];\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the given axis by the given\n * angle.\n * @param axis - The axis\n * about which to rotate.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns A matrix which rotates angle radians\n * around the axis.\n */\nfunction axisRotation(axis: Vec3Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n let x = axis[0];\n let y = axis[1];\n let z = axis[2];\n const n = Math.sqrt(x * x + y * y + z * z);\n x /= n;\n y /= n;\n z /= n;\n const xx = x * x;\n const yy = y * y;\n const zz = z * z;\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n const oneMinusCosine = 1 - c;\n\n newDst[ 0] = xx + (1 - xx) * c;\n newDst[ 1] = x * y * oneMinusCosine + z * s;\n newDst[ 2] = x * z * oneMinusCosine - y * s;\n newDst[ 3] = 0;\n newDst[ 4] = x * y * oneMinusCosine - z * s;\n newDst[ 5] = yy + (1 - yy) * c;\n newDst[ 6] = y * z * oneMinusCosine + x * s;\n newDst[ 7] = 0;\n newDst[ 8] = x * z * oneMinusCosine + y * s;\n newDst[ 9] = y * z * oneMinusCosine - x * s;\n newDst[10] = zz + (1 - zz) * c;\n newDst[11] = 0;\n newDst[12] = 0;\n newDst[13] = 0;\n newDst[14] = 0;\n newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the given axis by the given\n * angle. (same as axisRotation)\n * @param axis - The axis\n * about which to rotate.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns A matrix which rotates angle radians\n * around the axis.\n */\nconst rotation = axisRotation;\n\n/**\n * Rotates the given 4-by-4 matrix around the given axis by the\n * given angle.\n * @param m - The matrix.\n * @param axis - The axis\n * about which to rotate.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nfunction axisRotate(m: Mat4Arg, axis: Vec3Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n let x = axis[0];\n let y = axis[1];\n let z = axis[2];\n const n = Math.sqrt(x * x + y * y + z * z);\n x /= n;\n y /= n;\n z /= n;\n const xx = x * x;\n const yy = y * y;\n const zz = z * z;\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n const oneMinusCosine = 1 - c;\n\n const r00 = xx + (1 - xx) * c;\n const r01 = x * y * oneMinusCosine + z * s;\n const r02 = x * z * oneMinusCosine - y * s;\n const r10 = x * y * oneMinusCosine - z * s;\n const r11 = yy + (1 - yy) * c;\n const r12 = y * z * oneMinusCosine + x * s;\n const r20 = x * z * oneMinusCosine + y * s;\n const r21 = y * z * oneMinusCosine - x * s;\n const r22 = zz + (1 - zz) * c;\n\n const m00 = m[0];\n const m01 = m[1];\n const m02 = m[2];\n const m03 = m[3];\n const m10 = m[4];\n const m11 = m[5];\n const m12 = m[6];\n const m13 = m[7];\n const m20 = m[8];\n const m21 = m[9];\n const m22 = m[10];\n const m23 = m[11];\n\n newDst[ 0] = r00 * m00 + r01 * m10 + r02 * m20;\n newDst[ 1] = r00 * m01 + r01 * m11 + r02 * m21;\n newDst[ 2] = r00 * m02 + r01 * m12 + r02 * m22;\n newDst[ 3] = r00 * m03 + r01 * m13 + r02 * m23;\n newDst[ 4] = r10 * m00 + r11 * m10 + r12 * m20;\n newDst[ 5] = r10 * m01 + r11 * m11 + r12 * m21;\n newDst[ 6] = r10 * m02 + r11 * m12 + r12 * m22;\n newDst[ 7] = r10 * m03 + r11 * m13 + r12 * m23;\n newDst[ 8] = r20 * m00 + r21 * m10 + r22 * m20;\n newDst[ 9] = r20 * m01 + r21 * m11 + r22 * m21;\n newDst[10] = r20 * m02 + r21 * m12 + r22 * m22;\n newDst[11] = r20 * m03 + r21 * m13 + r22 * m23;\n\n if (m !== newDst) {\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\n/**\n * Rotates the given 4-by-4 matrix around the given axis by the\n * given angle. (same as rotate)\n * @param m - The matrix.\n * @param axis - The axis\n * about which to rotate.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nconst rotate = axisRotate;\n\n/**\n * Creates a 4-by-4 matrix which scales in each dimension by an amount given by\n * the corresponding entry in the given vector; assumes the vector has three\n * entries.\n * @param v - A vector of\n * three entries specifying the factor by which to scale in each dimension.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaling matrix.\n */\nfunction scaling(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = v[0]; newDst[ 1] = 0; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = v[1]; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = v[2]; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Scales the given 4-by-4 matrix in each dimension by an amount\n * given by the corresponding entry in the given vector; assumes the vector has\n * three entries.\n * @param m - The matrix to be modified.\n * @param v - A vector of three entries specifying the\n * factor by which to scale in each dimension.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaled matrix.\n */\nfunction scale(m: Mat4Arg, v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n\n newDst[ 0] = v0 * m[0 * 4 + 0];\n newDst[ 1] = v0 * m[0 * 4 + 1];\n newDst[ 2] = v0 * m[0 * 4 + 2];\n newDst[ 3] = v0 * m[0 * 4 + 3];\n newDst[ 4] = v1 * m[1 * 4 + 0];\n newDst[ 5] = v1 * m[1 * 4 + 1];\n newDst[ 6] = v1 * m[1 * 4 + 2];\n newDst[ 7] = v1 * m[1 * 4 + 3];\n newDst[ 8] = v2 * m[2 * 4 + 0];\n newDst[ 9] = v2 * m[2 * 4 + 1];\n newDst[10] = v2 * m[2 * 4 + 2];\n newDst[11] = v2 * m[2 * 4 + 3];\n\n if (m !== newDst) {\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which scales a uniform amount in each dimension.\n * @param s - the amount to scale\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaling matrix.\n */\nfunction uniformScaling(s: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = s; newDst[ 1] = 0; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = s; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = s; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Scales the given 4-by-4 matrix in each dimension by a uniform scale.\n * @param m - The matrix to be modified.\n * @param s - The amount to scale.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaled matrix.\n */\nfunction uniformScale(m: Mat4Arg, s: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = s * m[0 * 4 + 0];\n newDst[ 1] = s * m[0 * 4 + 1];\n newDst[ 2] = s * m[0 * 4 + 2];\n newDst[ 3] = s * m[0 * 4 + 3];\n newDst[ 4] = s * m[1 * 4 + 0];\n newDst[ 5] = s * m[1 * 4 + 1];\n newDst[ 6] = s * m[1 * 4 + 2];\n newDst[ 7] = s * m[1 * 4 + 3];\n newDst[ 8] = s * m[2 * 4 + 0];\n newDst[ 9] = s * m[2 * 4 + 1];\n newDst[10] = s * m[2 * 4 + 2];\n newDst[11] = s * m[2 * 4 + 3];\n\n if (m !== newDst) {\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\nreturn {\n create,\n set,\n fromMat3,\n fromQuat,\n negate,\n copy,\n clone,\n equalsApproximately,\n equals,\n identity,\n transpose,\n inverse,\n determinant,\n invert,\n multiply,\n mul,\n setTranslation,\n getTranslation,\n getAxis,\n setAxis,\n getScaling,\n perspective,\n perspectiveReverseZ,\n ortho,\n frustum,\n frustumReverseZ,\n aim,\n cameraAim,\n lookAt,\n translation,\n translate,\n rotationX,\n rotateX,\n rotationY,\n rotateY,\n rotationZ,\n rotateZ,\n axisRotation,\n rotation,\n axisRotate,\n rotate,\n scaling,\n scale,\n uniformScaling,\n uniformScale,\n};\n\n}\n\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\nexport function getAPI(Ctor: Mat4Ctor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport * as utils from './utils.js';\nimport { QuatArg, QuatType } from './quat';\nimport { Mat3Arg } from './mat3.js';\nimport { Mat4Arg } from './mat4.js';\nimport { Vec3Arg } from './vec3.js';\nimport { getAPI as getVec3API } from './vec3-impl';\nimport { BaseArgType } from './types';\n\nexport { QuatArg, QuatType };\n\ntype QuatCtor = new (n: number) => T;\n\nexport type RotationOrder = 'xyz' | 'xzy' | 'yxz' | 'yzx' | 'zxy' | 'zyx';\n\n/**\n * Generates am typed API for Qud\n * */\nfunction getAPIImpl(Ctor: QuatCtor) {\n const vec3 = getVec3API(Ctor);\n\n/**\n * Creates a quat4; may be called with x, y, z to set initial values.\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @param w - Initial w value.\n * @returns the created vector\n */\nfunction create(x?: number, y?: number, z?: number, w?: number) {\n const newDst = new Ctor(4);\n if (x !== undefined) {\n newDst[0] = x;\n if (y !== undefined) {\n newDst[1] = y;\n if (z !== undefined) {\n newDst[2] = z;\n if (w !== undefined) {\n newDst[3] = w;\n }\n }\n }\n }\n return newDst;\n}\n\n/**\n * Creates a Quat; may be called with x, y, z to set initial values. (same as create)\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @param z - Initial w value.\n * @returns the created vector\n */\nconst fromValues = create;\n\n/**\n * Sets the values of a Quat\n * Also see {@link quat.create} and {@link quat.copy}\n *\n * @param x first value\n * @param y second value\n * @param z third value\n * @param w fourth value\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector with its elements set.\n */\nfunction set(x: number, y: number, z: number, w: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = x;\n newDst[1] = y;\n newDst[2] = z;\n newDst[3] = w;\n\n return newDst;\n}\n\n/**\n * Sets a quaternion from the given angle and axis,\n * then returns it.\n *\n * @param axis - the axis to rotate around\n * @param angleInRadians - the angle\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The quaternion that represents the given axis and angle\n **/\nfunction fromAxisAngle(axis: Vec3Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const halfAngle = angleInRadians * 0.5;\n const s = Math.sin(halfAngle);\n\n newDst[0] = s * axis[0];\n newDst[1] = s * axis[1];\n newDst[2] = s * axis[2];\n newDst[3] = Math.cos(halfAngle);\n\n return newDst;\n}\n\n/**\n * Gets the rotation axis and angle\n * @param q - quaternion to compute from\n * @param dst - Vec3 to hold result. If not passed in a new one is created.\n * @return angle and axis\n */\nfunction toAxisAngle(q: QuatArg, dst?: T): { angle: number, axis: T } {\n const newDst = (dst ?? vec3.create(3)) as T;\n\n const angle = Math.acos(q[3]) * 2;\n const s = Math.sin(angle * 0.5);\n if (s > utils.EPSILON) {\n newDst[0] = q[0] / s;\n newDst[1] = q[1] / s;\n newDst[2] = q[2] / s;\n } else {\n newDst[0] = 1;\n newDst[1] = 0;\n newDst[2] = 0;\n }\n\n return { angle, axis: newDst };\n}\n\n/**\n * Returns the angle in degrees between two rotations a and b.\n * @param a - quaternion a\n * @param b - quaternion b\n * @return angle in radians between the two quaternions\n */\nfunction angle(a: QuatArg, b: QuatArg) {\n const d = dot(a, b);\n return Math.acos(2 * d * d - 1);\n}\n\n/**\n * Multiplies two quaternions\n *\n * @param a - the first quaternion\n * @param b - the second quaternion\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nfunction multiply(a: QuatArg, b: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const aw = a[3];\n\n const bx = b[0];\n const by = b[1];\n const bz = b[2];\n const bw = b[3];\n\n newDst[0] = ax * bw + aw * bx + ay * bz - az * by;\n newDst[1] = ay * bw + aw * by + az * bx - ax * bz;\n newDst[2] = az * bw + aw * bz + ax * by - ay * bx;\n newDst[3] = aw * bw - ax * bx - ay * by - az * bz;\n\n return newDst;\n}\n\n/**\n * Multiplies two quaternions\n *\n * @param a - the first quaternion\n * @param b - the second quaternion\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nconst mul = multiply;\n\n/**\n * Rotates the given quaternion around the X axis by the given angle.\n * @param q - quaternion to rotate\n * @param angleInRadians - The angle by which to rotate\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nfunction rotateX(q: QuatArg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const halfAngle = angleInRadians * 0.5;\n\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const qw = q[3];\n\n const bx = Math.sin(halfAngle);\n const bw = Math.cos(halfAngle);\n\n newDst[0] = qx * bw + qw * bx;\n newDst[1] = qy * bw + qz * bx;\n newDst[2] = qz * bw - qy * bx;\n newDst[3] = qw * bw - qx * bx;\n\n return newDst;\n}\n\n/**\n * Rotates the given quaternion around the Y axis by the given angle.\n * @param q - quaternion to rotate\n * @param angleInRadians - The angle by which to rotate\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nfunction rotateY(q: QuatArg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const halfAngle = angleInRadians * 0.5;\n\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const qw = q[3];\n\n const by = Math.sin(halfAngle);\n const bw = Math.cos(halfAngle);\n\n newDst[0] = qx * bw - qz * by;\n newDst[1] = qy * bw + qw * by;\n newDst[2] = qz * bw + qx * by;\n newDst[3] = qw * bw - qy * by;\n\n return newDst;\n}\n\n/**\n * Rotates the given quaternion around the Z axis by the given angle.\n * @param q - quaternion to rotate\n * @param angleInRadians - The angle by which to rotate\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nfunction rotateZ(q: QuatArg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const halfAngle = angleInRadians * 0.5;\n\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const qw = q[3];\n\n const bz = Math.sin(halfAngle);\n const bw = Math.cos(halfAngle);\n\n newDst[0] = qx * bw + qy * bz;\n newDst[1] = qy * bw - qx * bz;\n newDst[2] = qz * bw + qw * bz;\n newDst[3] = qw * bw - qz * bz;\n\n return newDst;\n}\n\n/**\n * Spherically linear interpolate between two quaternions\n *\n * @param a - starting value\n * @param b - ending value\n * @param t - value where 0 = a and 1 = b\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nfunction slerp(a: QuatArg, b: QuatArg, t: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const aw = a[3];\n\n let bx = b[0];\n let by = b[1];\n let bz = b[2];\n let bw = b[3];\n\n let cosOmega = ax * bx + ay * by + az * bz + aw * bw;\n\n if (cosOmega < 0) {\n cosOmega = -cosOmega;\n bx = -bx;\n by = -by;\n bz = -bz;\n bw = -bw;\n }\n\n let scale0;\n let scale1;\n\n if (1.0 - cosOmega > utils.EPSILON) {\n const omega = Math.acos(cosOmega);\n const sinOmega = Math.sin(omega);\n scale0 = Math.sin((1 - t) * omega) / sinOmega;\n scale1 = Math.sin(t * omega) / sinOmega;\n } else {\n scale0 = 1.0 - t;\n scale1 = t;\n }\n\n newDst[0] = scale0 * ax + scale1 * bx;\n newDst[1] = scale0 * ay + scale1 * by;\n newDst[2] = scale0 * az + scale1 * bz;\n newDst[3] = scale0 * aw + scale1 * bw;\n\n return newDst;\n}\n\n/**\n * Compute the inverse of a quaternion\n *\n * @param q - quaternion to compute the inverse of\n * @returns A quaternion that is the result of a * b\n */\nfunction inverse(q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const a0 = q[0];\n const a1 = q[1];\n const a2 = q[2];\n const a3 = q[3];\n\n const dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3;\n const invDot = dot ? 1 / dot : 0;\n\n newDst[0] = -a0 * invDot;\n newDst[1] = -a1 * invDot;\n newDst[2] = -a2 * invDot;\n newDst[3] = a3 * invDot;\n\n return newDst;\n}\n\n/**\n * Compute the conjugate of a quaternion\n * For quaternions with a magnitude of 1 (a unit quaternion)\n * this returns the same as the inverse but is faster to calculate.\n *\n * @param q - quaternion to compute the conjugate of.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The conjugate of q\n */\nfunction conjugate(q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = -q[0];\n newDst[1] = -q[1];\n newDst[2] = -q[2];\n newDst[3] = q[3];\n\n return newDst;\n}\n\n/**\n * Creates a quaternion from the given rotation matrix.\n *\n * The created quaternion is not normalized.\n *\n * @param m - rotation matrix\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns the result\n */\nfunction fromMat(m: Mat3Arg | Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n /*\n 0 1 2\n 3 4 5\n 6 7 8\n\n 0 1 2\n 4 5 6\n 8 9 10\n */\n\n // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes\n // article \"Quaternion Calculus and Fast Animation\".\n const trace = m[0] + m[5] + m[10];\n\n if (trace > 0.0) {\n // |w| > 1/2, may as well choose w > 1/2\n const root = Math.sqrt(trace + 1); // 2w\n newDst[3] = 0.5 * root;\n const invRoot = 0.5 / root; // 1/(4w)\n\n newDst[0] = (m[6] - m[9]) * invRoot;\n newDst[1] = (m[8] - m[2]) * invRoot;\n newDst[2] = (m[1] - m[4]) * invRoot;\n } else {\n // |w| <= 1/2\n let i = 0;\n\n if (m[5] > m[0]) {\n i = 1;\n }\n if (m[10] > m[i * 4 + i]) {\n i = 2;\n }\n\n const j = (i + 1) % 3;\n const k = (i + 2) % 3;\n\n const root = Math.sqrt(m[i * 4 + i] - m[j * 4 + j] - m[k * 4 + k] + 1.0);\n newDst[i] = 0.5 * root;\n\n const invRoot = 0.5 / root;\n\n newDst[3] = (m[j * 4 + k] - m[k * 4 + j]) * invRoot;\n newDst[j] = (m[j * 4 + i] + m[i * 4 + j]) * invRoot;\n newDst[k] = (m[k * 4 + i] + m[i * 4 + k]) * invRoot;\n }\n\n return newDst;\n}\n\n/**\n * Creates a quaternion from the given euler angle x, y, z using the provided intrinsic order for the conversion.\n *\n * @param xAngleInRadians - angle to rotate around X axis in radians.\n * @param yAngleInRadians - angle to rotate around Y axis in radians.\n * @param zAngleInRadians - angle to rotate around Z axis in radians.\n * @param order - order to apply euler angles\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion representing the same rotation as the euler angles applied in the given order\n */\nfunction fromEuler(\n xAngleInRadians: number,\n yAngleInRadians: number,\n zAngleInRadians: number,\n order: RotationOrder,\n dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const xHalfAngle = xAngleInRadians * 0.5;\n const yHalfAngle = yAngleInRadians * 0.5;\n const zHalfAngle = zAngleInRadians * 0.5;\n\n const sx = Math.sin(xHalfAngle);\n const cx = Math.cos(xHalfAngle);\n const sy = Math.sin(yHalfAngle);\n const cy = Math.cos(yHalfAngle);\n const sz = Math.sin(zHalfAngle);\n const cz = Math.cos(zHalfAngle);\n\n switch (order) {\n case 'xyz':\n newDst[0] = sx * cy * cz + cx * sy * sz;\n newDst[1] = cx * sy * cz - sx * cy * sz;\n newDst[2] = cx * cy * sz + sx * sy * cz;\n newDst[3] = cx * cy * cz - sx * sy * sz;\n break;\n\n case 'xzy':\n newDst[0] = sx * cy * cz - cx * sy * sz;\n newDst[1] = cx * sy * cz - sx * cy * sz;\n newDst[2] = cx * cy * sz + sx * sy * cz;\n newDst[3] = cx * cy * cz + sx * sy * sz;\n break;\n\n case 'yxz':\n newDst[0] = sx * cy * cz + cx * sy * sz;\n newDst[1] = cx * sy * cz - sx * cy * sz;\n newDst[2] = cx * cy * sz - sx * sy * cz;\n newDst[3] = cx * cy * cz + sx * sy * sz;\n break;\n\n case 'yzx':\n newDst[0] = sx * cy * cz + cx * sy * sz;\n newDst[1] = cx * sy * cz + sx * cy * sz;\n newDst[2] = cx * cy * sz - sx * sy * cz;\n newDst[3] = cx * cy * cz - sx * sy * sz;\n break;\n\n case 'zxy':\n newDst[0] = sx * cy * cz - cx * sy * sz;\n newDst[1] = cx * sy * cz + sx * cy * sz;\n newDst[2] = cx * cy * sz + sx * sy * cz;\n newDst[3] = cx * cy * cz - sx * sy * sz;\n break;\n\n case 'zyx':\n newDst[0] = sx * cy * cz - cx * sy * sz;\n newDst[1] = cx * sy * cz + sx * cy * sz;\n newDst[2] = cx * cy * sz - sx * sy * cz;\n newDst[3] = cx * cy * cz + sx * sy * sz;\n break;\n\n default:\n throw new Error(`Unknown rotation order: ${order}`);\n }\n\n return newDst;\n}\n\n/**\n * Copies a quaternion. (same as {@link quat.clone})\n * Also see {@link quat.create} and {@link quat.set}\n * @param q - The quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is a copy of q\n */\nfunction copy(q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = q[0];\n newDst[1] = q[1];\n newDst[2] = q[2];\n newDst[3] = q[3];\n\n return newDst;\n}\n\n/**\n * Clones a quaternion. (same as {@link quat.copy})\n * Also see {@link quat.create} and {@link quat.set}\n * @param q - The quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A copy of q.\n */\nconst clone = copy;\n\n/**\n * Adds two quaternions; assumes a and b have the same dimension.\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the sum of a and b.\n */\nfunction add(a: QuatArg, b: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + b[0];\n newDst[1] = a[1] + b[1];\n newDst[2] = a[2] + b[2];\n newDst[3] = a[3] + b[3];\n\n return newDst;\n}\n\n/**\n * Subtracts two quaternions.\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the difference of a and b.\n */\nfunction subtract(a: QuatArg, b: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] - b[0];\n newDst[1] = a[1] - b[1];\n newDst[2] = a[2] - b[2];\n newDst[3] = a[3] - b[3];\n\n return newDst;\n}\n\n/**\n * Subtracts two quaternions.\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the difference of a and b.\n */\nconst sub = subtract;\n\n/**\n * Multiplies a quaternion by a scalar.\n * @param v - The quaternion.\n * @param k - The scalar.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The scaled quaternion.\n */\nfunction mulScalar(v: QuatArg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = v[0] * k;\n newDst[1] = v[1] * k;\n newDst[2] = v[2] * k;\n newDst[3] = v[3] * k;\n\n return newDst;\n}\n\n/**\n * Multiplies a quaternion by a scalar. (same as mulScalar)\n * @param v - The quaternion.\n * @param k - The scalar.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The scaled quaternion.\n */\nconst scale = mulScalar;\n\n/**\n * Divides a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The scaled quaternion.\n */\nfunction divScalar(v: QuatArg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = v[0] / k;\n newDst[1] = v[1] / k;\n newDst[2] = v[2] / k;\n newDst[3] = v[3] / k;\n\n return newDst;\n}\n\n/**\n * Computes the dot product of two quaternions\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @returns dot product\n */\nfunction dot(a: QuatArg, b: QuatArg): number {\n return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]) + (a[3] * b[3]);\n}\n\n/**\n * Performs linear interpolation on two quaternions.\n * Given quaternions a and b and interpolation coefficient t, returns\n * a + t * (b - a).\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @param t - Interpolation coefficient.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The linear interpolated result.\n */\nfunction lerp(a: QuatArg, b: QuatArg, t: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + t * (b[0] - a[0]);\n newDst[1] = a[1] + t * (b[1] - a[1]);\n newDst[2] = a[2] + t * (b[2] - a[2]);\n newDst[3] = a[3] + t * (b[3] - a[3]);\n\n return newDst;\n}\n\n/**\n * Computes the length of quaternion\n * @param v - quaternion.\n * @returns length of quaternion.\n */\nfunction length(v: QuatArg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n return Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3);\n}\n\n/**\n * Computes the length of quaternion (same as length)\n * @param v - quaternion.\n * @returns length of quaternion.\n */\nconst len = length;\n\n/**\n * Computes the square of the length of quaternion\n * @param v - quaternion.\n * @returns square of the length of quaternion.\n */\nfunction lengthSq(v: QuatArg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n return v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3;\n}\n\n/**\n * Computes the square of the length of quaternion (same as lengthSq)\n * @param v - quaternion.\n * @returns square of the length of quaternion.\n */\nconst lenSq = lengthSq;\n\n/**\n * Divides a quaternion by its Euclidean length and returns the quotient.\n * @param v - The quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The normalized quaternion.\n */\nfunction normalize(v: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n const len = Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3);\n\n if (len > 0.00001) {\n newDst[0] = v0 / len;\n newDst[1] = v1 / len;\n newDst[2] = v2 / len;\n newDst[3] = v3 / len;\n } else {\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 0;\n }\n\n return newDst;\n}\n\n/**\n * Check if 2 quaternions are approximately equal\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @returns true if quaternions are approximately equal\n */\nfunction equalsApproximately(a: QuatArg, b: QuatArg): boolean {\n return Math.abs(a[0] - b[0]) < utils.EPSILON &&\n Math.abs(a[1] - b[1]) < utils.EPSILON &&\n Math.abs(a[2] - b[2]) < utils.EPSILON &&\n Math.abs(a[3] - b[3]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 quaternions are exactly equal\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @returns true if quaternions are exactly equal\n */\nfunction equals(a: QuatArg, b: QuatArg): boolean {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];\n}\n\n/**\n * Creates an identity quaternion\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns an identity quaternion\n */\nfunction identity(dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 1;\n\n return newDst;\n}\n\nconst tempVec3 = vec3.create();\nconst xUnitVec3 = vec3.create();\nconst yUnitVec3 = vec3.create();\n\n/**\n * Computes a quaternion to represent the shortest rotation from one vector to another.\n *\n * @param aUnit - the start vector\n * @param bUnit - the end vector\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns the result\n */\nfunction rotationTo(aUnit: Vec3Arg, bUnit: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const dot = vec3.dot(aUnit, bUnit);\n if (dot < -0.999999) {\n vec3.cross(xUnitVec3, aUnit, tempVec3);\n if (vec3.len(tempVec3) < 0.000001) {\n vec3.cross(yUnitVec3, aUnit, tempVec3);\n }\n\n vec3.normalize(tempVec3, tempVec3);\n fromAxisAngle(tempVec3, Math.PI, newDst);\n\n return newDst;\n } else if (dot > 0.999999) {\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 1;\n\n return newDst;\n } else {\n vec3.cross(aUnit, bUnit, tempVec3);\n\n newDst[0] = tempVec3[0];\n newDst[1] = tempVec3[1];\n newDst[2] = tempVec3[2];\n newDst[3] = 1 + dot;\n\n return normalize(newDst, newDst);\n }\n}\n\nconst tempQuat1 = new Ctor(4);\nconst tempQuat2 = new Ctor(4);\n\n/**\n * Performs a spherical linear interpolation with two control points\n *\n * @param a - the first quaternion\n * @param b - the second quaternion\n * @param c - the third quaternion\n * @param d - the fourth quaternion\n * @param t - Interpolation coefficient 0 to 1\n * @returns result\n */\nfunction sqlerp(\n a: QuatArg,\n b: QuatArg,\n c: QuatArg,\n d: QuatArg,\n t: number,\n dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n slerp(a, d, t, tempQuat1);\n slerp(b, c, t, tempQuat2);\n slerp(tempQuat1, tempQuat2, 2 * t * (1 - t), newDst);\n\n return newDst;\n}\n\nreturn {\n create,\n fromValues,\n set,\n fromAxisAngle,\n toAxisAngle,\n angle,\n multiply,\n mul,\n rotateX,\n rotateY,\n rotateZ,\n slerp,\n inverse,\n conjugate,\n fromMat,\n fromEuler,\n copy,\n clone,\n add,\n subtract,\n sub,\n mulScalar,\n scale,\n divScalar,\n dot,\n lerp,\n length,\n len,\n lengthSq,\n lenSq,\n normalize,\n equalsApproximately,\n equals,\n identity,\n rotationTo,\n sqlerp,\n};\n\n}\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\n/**\n *\n * Quat4 math functions.\n *\n * Almost all functions take an optional `newDst` argument. If it is not passed in the\n * functions will create a new `Quat4`. In other words you can do this\n *\n * const v = quat4.cross(v1, v2); // Creates a new Quat4 with the cross product of v1 x v2.\n *\n * or\n *\n * const v = quat4.create();\n * quat4.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v\n *\n * The first style is often easier but depending on where it's used it generates garbage where\n * as there is almost never allocation with the second style.\n *\n * It is always safe to pass any vector as the destination. So for example\n *\n * quat4.cross(v1, v2, v1); // Puts the cross product of v1 x v2 in v1\n *\n */\nexport function getAPI(Ctor: QuatCtor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport * as utils from './utils.js';\nimport { Vec4Arg, Vec4Type } from './vec4';\nimport { Mat4Arg } from './mat4';\nimport { BaseArgType } from './types';\n\nexport { Vec4Arg, Vec4Type };\n\ntype Vec4Ctor = new (n: number) => T;\n\n/**\n * Generates am typed API for Vec4\n * */\nfunction getAPIImpl(Ctor: Vec4Ctor) {\n\n/**\n * Creates a vec4; may be called with x, y, z to set initial values.\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @param w - Initial w value.\n * @returns the created vector\n */\nfunction create(x?: number, y?: number, z?: number, w?: number) {\n const newDst = new Ctor(4);\n if (x !== undefined) {\n newDst[0] = x;\n if (y !== undefined) {\n newDst[1] = y;\n if (z !== undefined) {\n newDst[2] = z;\n if (w !== undefined) {\n newDst[3] = w;\n }\n }\n }\n }\n return newDst;\n}\n\n/**\n * Creates a vec4; may be called with x, y, z to set initial values. (same as create)\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @param z - Initial w value.\n * @returns the created vector\n */\nconst fromValues = create;\n\n/**\n * Sets the values of a Vec4\n * Also see {@link vec4.create} and {@link vec4.copy}\n *\n * @param x first value\n * @param y second value\n * @param z third value\n * @param w fourth value\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector with its elements set.\n */\nfunction set(x: number, y: number, z: number, w: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = x;\n newDst[1] = y;\n newDst[2] = z;\n newDst[3] = w;\n\n return newDst;\n}\n\n/**\n * Applies Math.ceil to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the ceil of each element of v.\n */\nfunction ceil(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.ceil(v[0]);\n newDst[1] = Math.ceil(v[1]);\n newDst[2] = Math.ceil(v[2]);\n newDst[3] = Math.ceil(v[3]);\n\n return newDst;\n}\n\n/**\n * Applies Math.floor to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the floor of each element of v.\n */\nfunction floor(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.floor(v[0]);\n newDst[1] = Math.floor(v[1]);\n newDst[2] = Math.floor(v[2]);\n newDst[3] = Math.floor(v[3]);\n\n return newDst;\n}\n\n/**\n * Applies Math.round to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the round of each element of v.\n */\nfunction round(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.round(v[0]);\n newDst[1] = Math.round(v[1]);\n newDst[2] = Math.round(v[2]);\n newDst[3] = Math.round(v[3]);\n\n return newDst;\n}\n\n/**\n * Clamp each element of vector between min and max\n * @param v - Operand vector.\n * @param max - Min value, default 0\n * @param min - Max value, default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that the clamped value of each element of v.\n */\nfunction clamp(v: Vec4Arg, min = 0, max = 1, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.min(max, Math.max(min, v[0]));\n newDst[1] = Math.min(max, Math.max(min, v[1]));\n newDst[2] = Math.min(max, Math.max(min, v[2]));\n newDst[3] = Math.min(max, Math.max(min, v[3]));\n\n return newDst;\n}\n\n/**\n * Adds two vectors; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a and b.\n */\nfunction add(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + b[0];\n newDst[1] = a[1] + b[1];\n newDst[2] = a[2] + b[2];\n newDst[3] = a[3] + b[3];\n\n return newDst;\n}\n\n/**\n * Adds two vectors, scaling the 2nd; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param scale - Amount to scale b\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a + b * scale.\n */\nfunction addScaled(a: Vec4Arg, b: Vec4Arg, scale: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + b[0] * scale;\n newDst[1] = a[1] + b[1] * scale;\n newDst[2] = a[2] + b[2] * scale;\n newDst[3] = a[3] + b[3] * scale;\n\n return newDst;\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nfunction subtract(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] - b[0];\n newDst[1] = a[1] - b[1];\n newDst[2] = a[2] - b[2];\n newDst[3] = a[3] - b[3];\n\n return newDst;\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nconst sub = subtract;\n\n/**\n * Check if 2 vectors are approximately equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are approximately equal\n */\nfunction equalsApproximately(a: Vec4Arg, b: Vec4Arg): boolean {\n return Math.abs(a[0] - b[0]) < utils.EPSILON &&\n Math.abs(a[1] - b[1]) < utils.EPSILON &&\n Math.abs(a[2] - b[2]) < utils.EPSILON &&\n Math.abs(a[3] - b[3]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 vectors are exactly equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are exactly equal\n */\nfunction equals(a: Vec4Arg, b: Vec4Arg): boolean {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficient.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The linear interpolated result.\n */\nfunction lerp(a: Vec4Arg, b: Vec4Arg, t: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + t * (b[0] - a[0]);\n newDst[1] = a[1] + t * (b[1] - a[1]);\n newDst[2] = a[2] + t * (b[2] - a[2]);\n newDst[3] = a[3] + t * (b[3] - a[3]);\n\n return newDst;\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient vector t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficients vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns the linear interpolated result.\n */\nfunction lerpV(a: Vec4Arg, b: Vec4Arg, t: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + t[0] * (b[0] - a[0]);\n newDst[1] = a[1] + t[1] * (b[1] - a[1]);\n newDst[2] = a[2] + t[2] * (b[2] - a[2]);\n newDst[3] = a[3] + t[3] * (b[3] - a[3]);\n\n return newDst;\n}\n\n/**\n * Return max values of two vectors.\n * Given vectors a and b returns\n * [max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The max components vector.\n */\nfunction max(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.max(a[0], b[0]);\n newDst[1] = Math.max(a[1], b[1]);\n newDst[2] = Math.max(a[2], b[2]);\n newDst[3] = Math.max(a[3], b[3]);\n\n return newDst;\n}\n\n/**\n * Return min values of two vectors.\n * Given vectors a and b returns\n * [min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The min components vector.\n */\nfunction min(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.min(a[0], b[0]);\n newDst[1] = Math.min(a[1], b[1]);\n newDst[2] = Math.min(a[2], b[2]);\n newDst[3] = Math.min(a[3], b[3]);\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction mulScalar(v: Vec4Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = v[0] * k;\n newDst[1] = v[1] * k;\n newDst[2] = v[2] * k;\n newDst[3] = v[3] * k;\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar. (same as mulScalar)\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nconst scale = mulScalar;\n\n/**\n * Divides a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction divScalar(v: Vec4Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = v[0] / k;\n newDst[1] = v[1] / k;\n newDst[2] = v[2] / k;\n newDst[3] = v[3] / k;\n\n return newDst;\n}\n\n/**\n * Inverse a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nfunction inverse(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = 1 / v[0];\n newDst[1] = 1 / v[1];\n newDst[2] = 1 / v[2];\n newDst[3] = 1 / v[3];\n\n return newDst;\n}\n\n/**\n * Invert a vector. (same as inverse)\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nconst invert = inverse;\n\n/**\n * Computes the dot product of two vectors\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns dot product\n */\nfunction dot(a: Vec4Arg, b: Vec4Arg): number {\n return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]) + (a[3] * b[3]);\n}\n\n/**\n * Computes the length of vector\n * @param v - vector.\n * @returns length of vector.\n */\nfunction length(v: Vec4Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n return Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3);\n}\n\n/**\n * Computes the length of vector (same as length)\n * @param v - vector.\n * @returns length of vector.\n */\nconst len = length;\n\n/**\n * Computes the square of the length of vector\n * @param v - vector.\n * @returns square of the length of vector.\n */\nfunction lengthSq(v: Vec4Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n return v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3;\n}\n\n/**\n * Computes the square of the length of vector (same as lengthSq)\n * @param v - vector.\n * @returns square of the length of vector.\n */\nconst lenSq = lengthSq;\n\n/**\n * Computes the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nfunction distance(a: Vec4Arg, b: Vec4Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n const dz = a[2] - b[2];\n const dw = a[3] - b[3];\n return Math.sqrt(dx * dx + dy * dy + dz * dz + dw * dw);\n}\n\n/**\n * Computes the distance between 2 points (same as distance)\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nconst dist = distance;\n\n/**\n * Computes the square of the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nfunction distanceSq(a: Vec4Arg, b: Vec4Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n const dz = a[2] - b[2];\n const dw = a[3] - b[3];\n return dx * dx + dy * dy + dz * dz + dw * dw;\n}\n\n/**\n * Computes the square of the distance between 2 points (same as distanceSq)\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nconst distSq = distanceSq;\n\n/**\n * Divides a vector by its Euclidean length and returns the quotient.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The normalized vector.\n */\nfunction normalize(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n const len = Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3);\n\n if (len > 0.00001) {\n newDst[0] = v0 / len;\n newDst[1] = v1 / len;\n newDst[2] = v2 / len;\n newDst[3] = v3 / len;\n } else {\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 0;\n }\n\n return newDst;\n}\n\n/**\n * Negates a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns -v.\n */\nfunction negate(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = -v[0];\n newDst[1] = -v[1];\n newDst[2] = -v[2];\n newDst[3] = -v[3];\n\n return newDst;\n}\n\n/**\n * Copies a vector. (same as {@link vec4.clone})\n * Also see {@link vec4.create} and {@link vec4.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nfunction copy(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = v[0];\n newDst[1] = v[1];\n newDst[2] = v[2];\n newDst[3] = v[3];\n\n return newDst;\n}\n\n/**\n * Clones a vector. (same as {@link vec4.copy})\n * Also see {@link vec4.create} and {@link vec4.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nconst clone = copy;\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nfunction multiply(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] * b[0];\n newDst[1] = a[1] * b[1];\n newDst[2] = a[2] * b[2];\n newDst[3] = a[3] * b[3];\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as mul)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nconst mul = multiply;\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nfunction divide(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] / b[0];\n newDst[1] = a[1] / b[1];\n newDst[2] = a[2] / b[2];\n newDst[3] = a[3] / b[3];\n\n return newDst;\n}\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as divide)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nconst div = divide;\n\n/**\n * Zero's a vector\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The zeroed vector.\n */\nfunction zero(dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 0;\n\n return newDst;\n}\n\n\n/**\n * transform vec4 by 4x4 matrix\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional vec4 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nfunction transformMat4(v: Vec4Arg, m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const x = v[0];\n const y = v[1];\n const z = v[2];\n const w = v[3];\n\n newDst[0] = m[0] * x + m[4] * y + m[ 8] * z + m[12] * w;\n newDst[1] = m[1] * x + m[5] * y + m[ 9] * z + m[13] * w;\n newDst[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;\n newDst[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;\n\n return newDst;\n}\n\n\n/**\n * Treat a 4D vector as a direction and set it's length\n *\n * @param a The vec4 to lengthen\n * @param len The length of the resulting vector\n * @returns The lengthened vector\n */\nfunction setLength(a: Vec4Arg, len: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n normalize(a, newDst);\n return mulScalar(newDst, len, newDst);\n}\n\n/**\n * Ensure a vector is not longer than a max length\n *\n * @param a The vec4 to limit\n * @param maxLen The longest length of the resulting vector\n * @returns The vector, shortened to maxLen if it's too long\n */\nfunction truncate(a: Vec4Arg, maxLen: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n if (length(a) > maxLen) {\n return setLength(a, maxLen, newDst);\n }\n\n return copy(a, newDst);\n}\n\n/**\n * Return the vector exactly between 2 endpoint vectors\n *\n * @param a Endpoint 1\n * @param b Endpoint 2\n * @returns The vector exactly residing between endpoints 1 and 2\n */\nfunction midpoint(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n return lerp(a, b, 0.5, newDst);\n}\n\nreturn {\n create,\n fromValues,\n set,\n ceil,\n floor,\n round,\n clamp,\n add,\n addScaled,\n subtract,\n sub,\n equalsApproximately,\n equals,\n lerp,\n lerpV,\n max,\n min,\n mulScalar,\n scale,\n divScalar,\n inverse,\n invert,\n dot,\n length,\n len,\n lengthSq,\n lenSq,\n distance,\n dist,\n distanceSq,\n distSq,\n normalize,\n negate,\n copy,\n clone,\n multiply,\n mul,\n divide,\n div,\n zero,\n transformMat4,\n setLength,\n truncate,\n midpoint,\n};\n}\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\n/**\n *\n * Vec4 math functions.\n *\n * Almost all functions take an optional `newDst` argument. If it is not passed in the\n * functions will create a new `Vec4`. In other words you can do this\n *\n * const v = vec4.cross(v1, v2); // Creates a new Vec4 with the cross product of v1 x v2.\n *\n * or\n *\n * const v = vec4.create();\n * vec4.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v\n *\n * The first style is often easier but depending on where it's used it generates garbage where\n * as there is almost never allocation with the second style.\n *\n * It is always safe to pass any vector as the destination. So for example\n *\n * vec4.cross(v1, v2, v1); // Puts the cross product of v1 x v2 in v1\n *\n */\nexport function getAPI(Ctor: Vec4Ctor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n\n","import {BaseArgType, ZeroArray} from './types';\nimport {Mat3Arg, Mat3Type, getAPI as getMat3API} from './mat3-impl';\nimport {Mat4Arg, Mat4Type, getAPI as getMat4API} from './mat4-impl';\nimport {QuatArg, QuatType, getAPI as getQuatAPI, RotationOrder} from './quat-impl';\nimport {Vec2Arg, Vec2Type, getAPI as getVec2API} from './vec2-impl';\nimport {Vec3Arg, Vec3Type, getAPI as getVec3API} from './vec3-impl';\nimport {Vec4Arg, Vec4Type, getAPI as getVec4API} from './vec4-impl';\nimport * as utils from './utils';\n\nexport {\n RotationOrder,\n utils,\n\n BaseArgType,\n\n Mat3Arg,\n Mat4Arg,\n QuatArg,\n Vec2Arg,\n Vec3Arg,\n Vec4Arg,\n\n Mat3Type,\n Mat4Type,\n QuatType,\n Vec2Type,\n Vec3Type,\n Vec4Type,\n};\n\nexport type BaseCtor = new (n: number) => T;\n\nexport type Mat3 = Mat3Type;\nexport type Mat4 = Mat4Type;\nexport type Quat = QuatType;\nexport type Vec2 = Vec2Type;\nexport type Vec3 = Vec3Type;\nexport type Vec4 = Vec4Type;\n\nexport type Mat3d = Mat3Type;\nexport type Mat4d = Mat4Type;\nexport type Quatd = QuatType;\nexport type Vec2d = Vec2Type;\nexport type Vec3d = Vec3Type;\nexport type Vec4d = Vec4Type;\n\nexport type Mat3n = Mat3Type;\nexport type Mat4n = Mat4Type;\nexport type Quatn = QuatType;\nexport type Vec2n = Vec2Type;\nexport type Vec3n = Vec3Type;\nexport type Vec4n = Vec4Type;\n\n/**\n * Generate wgpu-matrix API for type\n */\nfunction wgpuMatrixAPI<\n Mat3 extends BaseArgType,\n Mat4 extends BaseArgType,\n Quat extends BaseArgType,\n Vec2 extends BaseArgType,\n Vec3 extends BaseArgType,\n Vec4 extends BaseArgType,\n>(\n Mat3Ctor: BaseCtor,\n Mat4Ctor: BaseCtor,\n QuatCtor: BaseCtor,\n Vec2Ctor: BaseCtor,\n Vec3Ctor: BaseCtor,\n Vec4Ctor: BaseCtor,\n) {\n return {\n /** @namespace mat4 */\n mat4: getMat4API(Mat3Ctor),\n /** @namespace mat3 */\n mat3: getMat3API(Mat4Ctor),\n /** @namespace quat */\n quat: getQuatAPI(QuatCtor),\n /** @namespace vec2 */\n vec2: getVec2API(Vec2Ctor),\n /** @namespace vec3 */\n vec3: getVec3API(Vec3Ctor),\n /** @namespace vec4 */\n vec4: getVec4API(Vec4Ctor),\n };\n}\n\nexport const {\n /** @namespace */\n mat4,\n /** @namespace */\n mat3,\n /** @namespace */\n quat,\n /** @namespace */\n vec2,\n /** @namespace */\n vec3,\n /** @namespace */\n vec4,\n} = wgpuMatrixAPI<\n Mat3, Mat4, Quat, Vec2, Vec3, Vec4>(\n Float32Array, Float32Array, Float32Array, Float32Array, Float32Array, Float32Array);\n\nexport const {\n /** @namespace */\n mat4: mat4d,\n /** @namespace */\n mat3: mat3d,\n /** @namespace */\n quat: quatd,\n /** @namespace */\n vec2: vec2d,\n /** @namespace */\n vec3: vec3d,\n /** @namespace */\n vec4: vec4d,\n} = wgpuMatrixAPI<\n Mat3d, Mat4d, Quatd, Vec2d, Vec3d, Vec4d>(\n Float64Array, Float64Array, Float64Array, Float64Array, Float64Array, Float64Array);\n\nexport const {\n /** @namespace */\n mat4: mat4n,\n /** @namespace */\n mat3: mat3n,\n /** @namespace */\n quat: quatn,\n /** @namespace */\n vec2: vec2n,\n /** @namespace */\n vec3: vec3n,\n /** @namespace */\n vec4: vec4n,\n} = wgpuMatrixAPI<\n Mat3n, Mat4n, Quatn, Vec2n, Vec3n, Vec4n>(\n ZeroArray, Array, Array, Array, Array, Array);\n"],"names":["getAPIImpl","utils.EPSILON","cache","getAPI","getVec2API","getVec3API","getMat4API","getMat3API","getQuatAPI","getVec4API"],"mappings":";AAMA,SAAS,eAAe,CACtB,mBAAsB,EACtB,QAA6C,EAAA;IAE7C,OAAO,cAAc,mBAAmB,CAAA;AACtC,QAAA,WAAA,CAAY,GAAG,IAAW,EAAA;AACxB,YAAA,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;YACf,QAAQ,CAAC,IAAuB,CAAC,CAAC;SACnC;AACG,KAAA,CAAC;AACT,CAAC;AAEM,MAAM,SAAS,GAAG,eAAe,EAAC,KAAa,GAAE,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;;AClBvE;;;;;;;;;;;;;;;;;;;;AAoBG;AAEI,IAAI,OAAO,GAAG,QAAQ,CAAC;AAE9B;;;;AAIG;AACG,SAAU,UAAU,CAAC,CAAS,EAAA;IAClC,MAAM,GAAG,GAAG,OAAO,CAAC;IACpB,OAAO,GAAG,CAAC,CAAC;AACZ,IAAA,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;;;AAIG;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,IAAI,EAAE,KAAK,GACZ,GAAG,aAAa,CAEb,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK;;;;"} \ No newline at end of file diff --git a/dist/3.x/wgpu-matrix.module.min.js b/dist/3.x/wgpu-matrix.module.min.js new file mode 100644 index 0000000..0125bb1 --- /dev/null +++ b/dist/3.x/wgpu-matrix.module.min.js @@ -0,0 +1,2 @@ +const n=(t=Array,r=n=>n.fill(0),class extends t{constructor(...n){super(...n),r(this)}});var t,r;let e=1e-6;var o={__proto__:null,get EPSILON(){return e},degToRad:function(n){return n*Math.PI/180},euclideanModulo:function(n,t){return(n%t+t)%t},inverseLerp:function(n,t,r){const o=t-n;return Math.abs(t-n)1e-5?(e[0]=o/u,e[1]=c/u):(e[0]=0,e[1]=0),e}function l(t,r){const e=r??new n(2);return e[0]=t[0],e[1]=t[1],e}function w(t,r,e){const o=e??new n(2);return o[0]=t[0]*r[0],o[1]=t[1]*r[1],o}function m(t,r,e){const o=e??new n(2);return o[0]=t[0]/r[0],o[1]=t[1]/r[1],o}function d(t,r,e){const o=e??new n(2);return h(t,o),c(o,r,o)}return{create:t,fromValues:t,set:function(t,r,e){const o=e??new n(2);return o[0]=t,o[1]=r,o},ceil:function(t,r){const e=r??new n(2);return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e},floor:function(t,r){const e=r??new n(2);return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e},round:function(t,r){const e=r??new n(2);return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e},clamp:function(t,r=0,e=1,o){const c=o??new n(2);return c[0]=Math.min(e,Math.max(r,t[0])),c[1]=Math.min(e,Math.max(r,t[1])),c},add:function(t,r,e){const o=e??new n(2);return o[0]=t[0]+r[0],o[1]=t[1]+r[1],o},addScaled:function(t,r,e,o){const c=o??new n(2);return c[0]=t[0]+r[0]*e,c[1]=t[1]+r[1]*e,c},angle:function(n,t){const r=n[0],e=n[1],o=t[0],c=t[1],u=Math.sqrt(r*r+e*e)*Math.sqrt(o*o+c*c),s=u&&a(n,t)/u;return Math.acos(s)},subtract:r,sub:r,equalsApproximately:function(n,t){return Math.abs(n[0]-t[0])r?d(t,r,o):l(t,o)},midpoint:function(t,r,e){return o(t,r,.5,e??new n(2))}}}(n),c.set(n,t)),t}const a=new Map;function s(n){let t=a.get(n);return t||(t=function(n){const t=u(n);function r(t,r){const e=r??new n(12);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[8]=t[8],e[9]=t[9],e[10]=t[10],e}function o(t){const r=t??new n(12);return r[0]=1,r[1]=0,r[2]=0,r[4]=0,r[5]=1,r[6]=0,r[8]=0,r[9]=0,r[10]=1,r}function c(t,r){const e=r??new n(12),o=t[0],c=t[1],u=t[2],a=t[4],s=t[5],i=t[6],f=t[8],M=t[9],h=t[10],l=h*s-i*M,w=-h*a+i*f,m=M*a-s*f,d=1/(o*l+c*w+u*m);return e[0]=l*d,e[1]=(-h*c+u*M)*d,e[2]=(i*c-u*s)*d,e[4]=w*d,e[5]=(h*o-u*f)*d,e[6]=(-i*o+u*a)*d,e[8]=m*d,e[9]=(-M*o+c*f)*d,e[10]=(s*o-c*a)*d,e}function a(t,r,e){const o=e??new n(12),c=t[0],u=t[1],a=t[2],s=t[4],i=t[5],f=t[6],M=t[8],h=t[9],l=t[10],w=r[0],m=r[1],d=r[2],v=r[4],p=r[5],q=r[6],b=r[8],g=r[9],x=r[10];return o[0]=c*w+s*m+M*d,o[1]=u*w+i*m+h*d,o[2]=a*w+f*m+l*d,o[4]=c*v+s*p+M*q,o[5]=u*v+i*p+h*q,o[6]=a*v+f*p+l*q,o[8]=c*b+s*g+M*x,o[9]=u*b+i*g+h*x,o[10]=a*b+f*g+l*x,o}return{clone:r,create:function(t,r,e,o,c,u,a,s,i){const f=new n(12);return f[3]=0,f[7]=0,f[11]=0,void 0!==t&&(f[0]=t,void 0!==r&&(f[1]=r,void 0!==e&&(f[2]=e,void 0!==o&&(f[4]=o,void 0!==c&&(f[5]=c,void 0!==u&&(f[6]=u,void 0!==a&&(f[8]=a,void 0!==s&&(f[9]=s,void 0!==i&&(f[10]=i))))))))),f},set:function(t,r,e,o,c,u,a,s,i,f){const M=f??new n(12);return M[0]=t,M[1]=r,M[2]=e,M[3]=0,M[4]=o,M[5]=c,M[6]=u,M[7]=0,M[8]=a,M[9]=s,M[10]=i,M[11]=0,M},fromMat4:function(t,r){const e=r??new n(12);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=0,e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=0,e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=0,e},fromQuat:function(t,r){const e=r??new n(12),o=t[0],c=t[1],u=t[2],a=t[3],s=o+o,i=c+c,f=u+u,M=o*s,h=c*s,l=c*i,w=u*s,m=u*i,d=u*f,v=a*s,p=a*i,q=a*f;return e[0]=1-l-d,e[1]=h+q,e[2]=w-p,e[3]=0,e[4]=h-q,e[5]=1-M-d,e[6]=m+v,e[7]=0,e[8]=w+p,e[9]=m-v,e[10]=1-M-l,e[11]=0,e},negate:function(t,r){const e=r??new n(12);return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[4]=-t[4],e[5]=-t[5],e[6]=-t[6],e[8]=-t[8],e[9]=-t[9],e[10]=-t[10],e},copy:r,equalsApproximately:function(n,t){return Math.abs(n[0]-t[0])1e-5?(e[0]=o/a,e[1]=c/a,e[2]=u/a):(e[0]=0,e[1]=0,e[2]=0),e}function l(t,r){const e=r??new n(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function w(t,r,e){const o=e??new n(3);return o[0]=t[0]*r[0],o[1]=t[1]*r[1],o[2]=t[2]*r[2],o}function m(t,r,e){const o=e??new n(3);return o[0]=t[0]/r[0],o[1]=t[1]/r[1],o[2]=t[2]/r[2],o}function d(t,r,e){const o=e??new n(3);return h(t,o),c(o,r,o)}return{create:t,fromValues:t,set:function(t,r,e,o){const c=o??new n(3);return c[0]=t,c[1]=r,c[2]=e,c},ceil:function(t,r){const e=r??new n(3);return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e},floor:function(t,r){const e=r??new n(3);return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e},round:function(t,r){const e=r??new n(3);return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e[2]=Math.round(t[2]),e},clamp:function(t,r=0,e=1,o){const c=o??new n(3);return c[0]=Math.min(e,Math.max(r,t[0])),c[1]=Math.min(e,Math.max(r,t[1])),c[2]=Math.min(e,Math.max(r,t[2])),c},add:function(t,r,e){const o=e??new n(3);return o[0]=t[0]+r[0],o[1]=t[1]+r[1],o[2]=t[2]+r[2],o},addScaled:function(t,r,e,o){const c=o??new n(3);return c[0]=t[0]+r[0]*e,c[1]=t[1]+r[1]*e,c[2]=t[2]+r[2]*e,c},angle:function(n,t){const r=n[0],e=n[1],o=n[2],c=t[0],u=t[1],s=t[2],i=Math.sqrt(r*r+e*e+o*o)*Math.sqrt(c*c+u*u+s*s),f=i&&a(n,t)/i;return Math.acos(f)},subtract:r,sub:r,equalsApproximately:function(n,t){return Math.abs(n[0]-t[0])r?d(t,r,o):l(t,o)},midpoint:function(t,r,e){return o(t,r,.5,e??new n(3))}}}(n),i.set(n,t)),t}const M=new Map;function h(n){let t=M.get(n);return t||(t=function(n){const t=f(n);function r(t,r){const e=r??new n(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}const o=r;function c(t){const r=t??new n(16);return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function u(t,r){const e=r??new n(16),o=t[0],c=t[1],u=t[2],a=t[3],s=t[4],i=t[5],f=t[6],M=t[7],h=t[8],l=t[9],w=t[10],m=t[11],d=t[12],v=t[13],p=t[14],q=t[15],b=w*q,g=p*m,x=f*q,y=p*M,A=f*m,S=w*M,z=u*q,F=p*a,k=u*m,T=w*a,I=u*M,P=f*a,V=h*v,Z=d*l,L=s*v,R=d*i,E=s*l,X=h*i,Y=o*v,_=d*c,Q=o*l,N=h*c,U=o*i,j=s*c,D=b*i+y*l+A*v-(g*i+x*l+S*v),O=g*c+z*l+T*v-(b*c+F*l+k*v),$=x*c+F*i+I*v-(y*c+z*i+P*v),B=S*c+k*i+P*l-(A*c+T*i+I*l),C=1/(o*D+s*O+h*$+d*B);return e[0]=C*D,e[1]=C*O,e[2]=C*$,e[3]=C*B,e[4]=C*(g*s+x*h+S*d-(b*s+y*h+A*d)),e[5]=C*(b*o+F*h+k*d-(g*o+z*h+T*d)),e[6]=C*(y*o+z*s+P*d-(x*o+F*s+I*d)),e[7]=C*(A*o+T*s+I*h-(S*o+k*s+P*h)),e[8]=C*(V*M+R*m+E*q-(Z*M+L*m+X*q)),e[9]=C*(Z*a+Y*m+N*q-(V*a+_*m+Q*q)),e[10]=C*(L*a+_*M+U*q-(R*a+Y*M+j*q)),e[11]=C*(X*a+Q*M+j*m-(E*a+N*M+U*m)),e[12]=C*(L*w+X*p+Z*f-(E*p+V*f+R*w)),e[13]=C*(Q*p+V*u+_*w-(Y*w+N*p+Z*u)),e[14]=C*(Y*f+j*p+R*u-(U*p+L*u+_*f)),e[15]=C*(U*w+E*u+N*f-(Q*f+j*w+X*u)),e}const a=u;function s(t,r,e){const o=e??new n(16),c=t[0],u=t[1],a=t[2],s=t[3],i=t[4],f=t[5],M=t[6],h=t[7],l=t[8],w=t[9],m=t[10],d=t[11],v=t[12],p=t[13],q=t[14],b=t[15],g=r[0],x=r[1],y=r[2],A=r[3],S=r[4],z=r[5],F=r[6],k=r[7],T=r[8],I=r[9],P=r[10],V=r[11],Z=r[12],L=r[13],R=r[14],E=r[15];return o[0]=c*g+i*x+l*y+v*A,o[1]=u*g+f*x+w*y+p*A,o[2]=a*g+M*x+m*y+q*A,o[3]=s*g+h*x+d*y+b*A,o[4]=c*S+i*z+l*F+v*k,o[5]=u*S+f*z+w*F+p*k,o[6]=a*S+M*z+m*F+q*k,o[7]=s*S+h*z+d*F+b*k,o[8]=c*T+i*I+l*P+v*V,o[9]=u*T+f*I+w*P+p*V,o[10]=a*T+M*I+m*P+q*V,o[11]=s*T+h*I+d*P+b*V,o[12]=c*Z+i*L+l*R+v*E,o[13]=u*Z+f*L+w*R+p*E,o[14]=a*Z+M*L+m*R+q*E,o[15]=s*Z+h*L+d*R+b*E,o}const i=s,M=t.create(),h=t.create(),l=t.create();function w(t,r,e){const o=e??new n(16);let c=t[0],u=t[1],a=t[2];const s=Math.sqrt(c*c+u*u+a*a);c/=s,u/=s,a/=s;const i=c*c,f=u*u,M=a*a,h=Math.cos(r),l=Math.sin(r),w=1-h;return o[0]=i+(1-i)*h,o[1]=c*u*w+a*l,o[2]=c*a*w-u*l,o[3]=0,o[4]=c*u*w-a*l,o[5]=f+(1-f)*h,o[6]=u*a*w+c*l,o[7]=0,o[8]=c*a*w+u*l,o[9]=u*a*w-c*l,o[10]=M+(1-M)*h,o[11]=0,o[12]=0,o[13]=0,o[14]=0,o[15]=1,o}function m(t,r,e,o){const c=o??new n(16);let u=r[0],a=r[1],s=r[2];const i=Math.sqrt(u*u+a*a+s*s);u/=i,a/=i,s/=i;const f=u*u,M=a*a,h=s*s,l=Math.cos(e),w=Math.sin(e),m=1-l,d=f+(1-f)*l,v=u*a*m+s*w,p=u*s*m-a*w,q=u*a*m-s*w,b=M+(1-M)*l,g=a*s*m+u*w,x=u*s*m+a*w,y=a*s*m-u*w,A=h+(1-h)*l,S=t[0],z=t[1],F=t[2],k=t[3],T=t[4],I=t[5],P=t[6],V=t[7],Z=t[8],L=t[9],R=t[10],E=t[11];return c[0]=d*S+v*T+p*Z,c[1]=d*z+v*I+p*L,c[2]=d*F+v*P+p*R,c[3]=d*k+v*V+p*E,c[4]=q*S+b*T+g*Z,c[5]=q*z+b*I+g*L,c[6]=q*F+b*P+g*R,c[7]=q*k+b*V+g*E,c[8]=x*S+y*T+A*Z,c[9]=x*z+y*I+A*L,c[10]=x*F+y*P+A*R,c[11]=x*k+y*V+A*E,t!==c&&(c[12]=t[12],c[13]=t[13],c[14]=t[14],c[15]=t[15]),c}return{create:function(t,r,e,o,c,u,a,s,i,f,M,h,l,w,m,d){const v=new n(16);return void 0!==t&&(v[0]=t,void 0!==r&&(v[1]=r,void 0!==e&&(v[2]=e,void 0!==o&&(v[3]=o,void 0!==c&&(v[4]=c,void 0!==u&&(v[5]=u,void 0!==a&&(v[6]=a,void 0!==s&&(v[7]=s,void 0!==i&&(v[8]=i,void 0!==f&&(v[9]=f,void 0!==M&&(v[10]=M,void 0!==h&&(v[11]=h,void 0!==l&&(v[12]=l,void 0!==w&&(v[13]=w,void 0!==m&&(v[14]=m,void 0!==d&&(v[15]=d)))))))))))))))),v},set:function(t,r,e,o,c,u,a,s,i,f,M,h,l,w,m,d,v){const p=v??new n(16);return p[0]=t,p[1]=r,p[2]=e,p[3]=o,p[4]=c,p[5]=u,p[6]=a,p[7]=s,p[8]=i,p[9]=f,p[10]=M,p[11]=h,p[12]=l,p[13]=w,p[14]=m,p[15]=d,p},fromMat3:function(t,r){const e=r??new n(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=0,e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=0,e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},fromQuat:function(t,r){const e=r??new n(16),o=t[0],c=t[1],u=t[2],a=t[3],s=o+o,i=c+c,f=u+u,M=o*s,h=c*s,l=c*i,w=u*s,m=u*i,d=u*f,v=a*s,p=a*i,q=a*f;return e[0]=1-l-d,e[1]=h+q,e[2]=w-p,e[3]=0,e[4]=h-q,e[5]=1-M-d,e[6]=m+v,e[7]=0,e[8]=w+p,e[9]=m-v,e[10]=1-M-l,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},negate:function(t,r){const e=r??new n(16);return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=-t[3],e[4]=-t[4],e[5]=-t[5],e[6]=-t[6],e[7]=-t[7],e[8]=-t[8],e[9]=-t[9],e[10]=-t[10],e[11]=-t[11],e[12]=-t[12],e[13]=-t[13],e[14]=-t[14],e[15]=-t[15],e},copy:r,clone:o,equalsApproximately:function(n,t){return Math.abs(n[0]-t[0])e){const n=Math.acos(v),t=Math.sin(n);M=Math.sin((1-o)*n)/t,h=Math.sin(o*n)/t}else M=1-o,h=o;return u[0]=M*a+h*l,u[1]=M*s+h*w,u[2]=M*i+h*m,u[3]=M*f+h*d,u}function i(t,r){const e=r??new n(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}const M=i;function h(t,r,e){const o=e??new n(4);return o[0]=t[0]-r[0],o[1]=t[1]-r[1],o[2]=t[2]-r[2],o[3]=t[3]-r[3],o}const l=h;function w(t,r,e){const o=e??new n(4);return o[0]=t[0]*r,o[1]=t[1]*r,o[2]=t[2]*r,o[3]=t[3]*r,o}const m=w;function d(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]+n[3]*t[3]}function v(n){const t=n[0],r=n[1],e=n[2],o=n[3];return Math.sqrt(t*t+r*r+e*e+o*o)}const p=v;function q(n){const t=n[0],r=n[1],e=n[2],o=n[3];return t*t+r*r+e*e+o*o}const b=q;function g(t,r){const e=r??new n(4),o=t[0],c=t[1],u=t[2],a=t[3],s=Math.sqrt(o*o+c*c+u*u+a*a);return s>1e-5?(e[0]=o/s,e[1]=c/s,e[2]=u/s,e[3]=a/s):(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}const x=t.create(),y=t.create(),A=t.create(),S=new n(4),z=new n(4);return{create:r,fromValues:o,set:function(t,r,e,o,c){const u=c??new n(4);return u[0]=t,u[1]=r,u[2]=e,u[3]=o,u},fromAxisAngle:c,toAxisAngle:function(n,r){const o=r??t.create(3),c=2*Math.acos(n[3]),u=Math.sin(.5*c);return u>e?(o[0]=n[0]/u,o[1]=n[1]/u,o[2]=n[2]/u):(o[0]=1,o[1]=0,o[2]=0),{angle:c,axis:o}},angle:function(n,t){const r=d(n,t);return Math.acos(2*r*r-1)},multiply:u,mul:a,rotateX:function(t,r,e){const o=e??new n(4),c=.5*r,u=t[0],a=t[1],s=t[2],i=t[3],f=Math.sin(c),M=Math.cos(c);return o[0]=u*M+i*f,o[1]=a*M+s*f,o[2]=s*M-a*f,o[3]=i*M-u*f,o},rotateY:function(t,r,e){const o=e??new n(4),c=.5*r,u=t[0],a=t[1],s=t[2],i=t[3],f=Math.sin(c),M=Math.cos(c);return o[0]=u*M-s*f,o[1]=a*M+i*f,o[2]=s*M+u*f,o[3]=i*M-a*f,o},rotateZ:function(t,r,e){const o=e??new n(4),c=.5*r,u=t[0],a=t[1],s=t[2],i=t[3],f=Math.sin(c),M=Math.cos(c);return o[0]=u*M+a*f,o[1]=a*M-u*f,o[2]=s*M+i*f,o[3]=i*M-s*f,o},slerp:s,inverse:function(t,r){const e=r??new n(4),o=t[0],c=t[1],u=t[2],a=t[3],s=o*o+c*c+u*u+a*a,i=s?1/s:0;return e[0]=-o*i,e[1]=-c*i,e[2]=-u*i,e[3]=a*i,e},conjugate:function(t,r){const e=r??new n(4);return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e},fromMat:function(t,r){const e=r??new n(4),o=t[0]+t[5]+t[10];if(o>0){const n=Math.sqrt(o+1);e[3]=.5*n;const r=.5/n;e[0]=(t[6]-t[9])*r,e[1]=(t[8]-t[2])*r,e[2]=(t[1]-t[4])*r}else{let n=0;t[5]>t[0]&&(n=1),t[10]>t[4*n+n]&&(n=2);const r=(n+1)%3,o=(n+2)%3,c=Math.sqrt(t[4*n+n]-t[4*r+r]-t[4*o+o]+1);e[n]=.5*c;const u=.5/c;e[3]=(t[4*r+o]-t[4*o+r])*u,e[r]=(t[4*r+n]+t[4*n+r])*u,e[o]=(t[4*o+n]+t[4*n+o])*u}return e},fromEuler:function(t,r,e,o,c){const u=c??new n(4),a=.5*t,s=.5*r,i=.5*e,f=Math.sin(a),M=Math.cos(a),h=Math.sin(s),l=Math.cos(s),w=Math.sin(i),m=Math.cos(i);switch(o){case"xyz":u[0]=f*l*m+M*h*w,u[1]=M*h*m-f*l*w,u[2]=M*l*w+f*h*m,u[3]=M*l*m-f*h*w;break;case"xzy":u[0]=f*l*m-M*h*w,u[1]=M*h*m-f*l*w,u[2]=M*l*w+f*h*m,u[3]=M*l*m+f*h*w;break;case"yxz":u[0]=f*l*m+M*h*w,u[1]=M*h*m-f*l*w,u[2]=M*l*w-f*h*m,u[3]=M*l*m+f*h*w;break;case"yzx":u[0]=f*l*m+M*h*w,u[1]=M*h*m+f*l*w,u[2]=M*l*w-f*h*m,u[3]=M*l*m-f*h*w;break;case"zxy":u[0]=f*l*m-M*h*w,u[1]=M*h*m+f*l*w,u[2]=M*l*w+f*h*m,u[3]=M*l*m-f*h*w;break;case"zyx":u[0]=f*l*m-M*h*w,u[1]=M*h*m+f*l*w,u[2]=M*l*w-f*h*m,u[3]=M*l*m+f*h*w;break;default:throw new Error(`Unknown rotation order: ${o}`)}return u},copy:i,clone:M,add:function(t,r,e){const o=e??new n(4);return o[0]=t[0]+r[0],o[1]=t[1]+r[1],o[2]=t[2]+r[2],o[3]=t[3]+r[3],o},subtract:h,sub:l,mulScalar:w,scale:m,divScalar:function(t,r,e){const o=e??new n(4);return o[0]=t[0]/r,o[1]=t[1]/r,o[2]=t[2]/r,o[3]=t[3]/r,o},dot:d,lerp:function(t,r,e,o){const c=o??new n(4);return c[0]=t[0]+e*(r[0]-t[0]),c[1]=t[1]+e*(r[1]-t[1]),c[2]=t[2]+e*(r[2]-t[2]),c[3]=t[3]+e*(r[3]-t[3]),c},length:v,len:p,lengthSq:q,lenSq:b,normalize:g,equalsApproximately:function(n,t){return Math.abs(n[0]-t[0]).999999?(u[0]=0,u[1]=0,u[2]=0,u[3]=1,u):(t.cross(r,e,x),u[0]=x[0],u[1]=x[1],u[2]=x[2],u[3]=1+a,g(u,u))},sqlerp:function(t,r,e,o,c,u){const a=u??new n(4);return s(t,o,c,S),s(r,e,c,z),s(S,z,2*c*(1-c),a),a}}}(n),l.set(n,t)),t}const m=new Map;function d(n){let t=m.get(n);return t||(t=function(n){function t(t,r,e,o){const c=new n(4);return void 0!==t&&(c[0]=t,void 0!==r&&(c[1]=r,void 0!==e&&(c[2]=e,void 0!==o&&(c[3]=o)))),c}function r(t,r,e){const o=e??new n(4);return o[0]=t[0]-r[0],o[1]=t[1]-r[1],o[2]=t[2]-r[2],o[3]=t[3]-r[3],o}function o(t,r,e,o){const c=o??new n(4);return c[0]=t[0]+e*(r[0]-t[0]),c[1]=t[1]+e*(r[1]-t[1]),c[2]=t[2]+e*(r[2]-t[2]),c[3]=t[3]+e*(r[3]-t[3]),c}function c(t,r,e){const o=e??new n(4);return o[0]=t[0]*r,o[1]=t[1]*r,o[2]=t[2]*r,o[3]=t[3]*r,o}function u(t,r){const e=r??new n(4);return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e[3]=1/t[3],e}function a(n){const t=n[0],r=n[1],e=n[2],o=n[3];return Math.sqrt(t*t+r*r+e*e+o*o)}function s(n){const t=n[0],r=n[1],e=n[2],o=n[3];return t*t+r*r+e*e+o*o}function i(n,t){const r=n[0]-t[0],e=n[1]-t[1],o=n[2]-t[2],c=n[3]-t[3];return Math.sqrt(r*r+e*e+o*o+c*c)}function f(n,t){const r=n[0]-t[0],e=n[1]-t[1],o=n[2]-t[2],c=n[3]-t[3];return r*r+e*e+o*o+c*c}function M(t,r){const e=r??new n(4),o=t[0],c=t[1],u=t[2],a=t[3],s=Math.sqrt(o*o+c*c+u*u+a*a);return s>1e-5?(e[0]=o/s,e[1]=c/s,e[2]=u/s,e[3]=a/s):(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function h(t,r){const e=r??new n(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function l(t,r,e){const o=e??new n(4);return o[0]=t[0]*r[0],o[1]=t[1]*r[1],o[2]=t[2]*r[2],o[3]=t[3]*r[3],o}function w(t,r,e){const o=e??new n(4);return o[0]=t[0]/r[0],o[1]=t[1]/r[1],o[2]=t[2]/r[2],o[3]=t[3]/r[3],o}function m(t,r,e){const o=e??new n(4);return M(t,o),c(o,r,o)}return{create:t,fromValues:t,set:function(t,r,e,o,c){const u=c??new n(4);return u[0]=t,u[1]=r,u[2]=e,u[3]=o,u},ceil:function(t,r){const e=r??new n(4);return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e[3]=Math.ceil(t[3]),e},floor:function(t,r){const e=r??new n(4);return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e[3]=Math.floor(t[3]),e},round:function(t,r){const e=r??new n(4);return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e[2]=Math.round(t[2]),e[3]=Math.round(t[3]),e},clamp:function(t,r=0,e=1,o){const c=o??new n(4);return c[0]=Math.min(e,Math.max(r,t[0])),c[1]=Math.min(e,Math.max(r,t[1])),c[2]=Math.min(e,Math.max(r,t[2])),c[3]=Math.min(e,Math.max(r,t[3])),c},add:function(t,r,e){const o=e??new n(4);return o[0]=t[0]+r[0],o[1]=t[1]+r[1],o[2]=t[2]+r[2],o[3]=t[3]+r[3],o},addScaled:function(t,r,e,o){const c=o??new n(4);return c[0]=t[0]+r[0]*e,c[1]=t[1]+r[1]*e,c[2]=t[2]+r[2]*e,c[3]=t[3]+r[3]*e,c},subtract:r,sub:r,equalsApproximately:function(n,t){return Math.abs(n[0]-t[0])r?m(t,r,o):h(t,o)},midpoint:function(t,r,e){return o(t,r,.5,e??new n(4))}}}(n),m.set(n,t)),t}function v(n,t,r,e,o,c){return{mat4:h(n),mat3:s(t),quat:w(r),vec2:u(e),vec3:f(o),vec4:d(c)}}const{mat4:p,mat3:q,quat:b,vec2:g,vec3:x,vec4:y}=v(Float32Array,Float32Array,Float32Array,Float32Array,Float32Array,Float32Array),{mat4:A,mat3:S,quat:z,vec2:F,vec3:k,vec4:T}=v(Float64Array,Float64Array,Float64Array,Float64Array,Float64Array,Float64Array),{mat4:I,mat3:P,quat:V,vec2:Z,vec3:L,vec4:R}=v(n,Array,Array,Array,Array,Array);export{q as mat3,S as mat3d,P as mat3n,p as mat4,A as mat4d,I as mat4n,b as quat,z as quatd,V as quatn,o as utils,g as vec2,F as vec2d,Z as vec2n,x as vec3,k as vec3d,L as vec3n,y as vec4,T as vec4d,R as vec4n}; +//# sourceMappingURL=wgpu-matrix.module.min.js.map diff --git a/dist/3.x/wgpu-matrix.module.min.js.map b/dist/3.x/wgpu-matrix.module.min.js.map new file mode 100644 index 0000000..39e55e2 --- /dev/null +++ b/dist/3.x/wgpu-matrix.module.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"wgpu-matrix.module.min.js","sources":["../../../src/types.ts","../../../src/utils.ts","../../../src/vec2-impl.ts","../../../src/mat3-impl.ts","../../../src/vec3-impl.ts","../../../src/mat4-impl.ts","../../../src/quat-impl.ts","../../../src/vec4-impl.ts","../../../src/wgpu-matrix.ts"],"sourcesContent":["/**\n * The types you can pass to most functions that take an\n * array of numbers.\n */\nexport type BaseArgType = Float32Array | Float64Array | number[];\n\nfunction wrapConstructor any>(\n OriginalConstructor: T,\n modifier: (instance: InstanceType) => void\n): T {\n return class extends OriginalConstructor {\n constructor(...args: any[]) {\n super(...args);\n modifier(this as InstanceType);\n }\n } as T; // Type assertion is necessary here\n}\n\nexport const ZeroArray = wrapConstructor(Array, a => a.fill(0));\n\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\n\nexport let EPSILON = 0.000001;\n\n/**\n * Set the value for EPSILON for various checks\n * @param v - Value to use for EPSILON.\n * @returns previous value of EPSILON;\n */\nexport function setEpsilon(v: number): number {\n const old = EPSILON;\n EPSILON = v;\n return old;\n}\n\n/**\n * Convert degrees to radians\n * @param degrees - Angle in degrees\n * @returns angle converted to radians\n */\nexport function degToRad(degrees: number): number {\n return degrees * Math.PI / 180;\n}\n\n/**\n * Convert radians to degrees\n * @param radians - Angle in radians\n * @returns angle converted to degrees\n */\nexport function radToDeg(radians: number): number {\n return radians * 180 / Math.PI;\n}\n\n/**\n * Lerps between a and b via t\n * @param a - starting value\n * @param b - ending value\n * @param t - value where 0 = a and 1 = b\n * @returns a + (b - a) * t\n */\nexport function lerp(a: number, b: number, t: number): number {\n return a + (b - a) * t;\n}\n\n/**\n * Compute the opposite of lerp. Given a and b and a value between\n * a and b returns a value between 0 and 1. 0 if a, 1 if b.\n * Note: no clamping is done.\n * @param a - start value\n * @param b - end value\n * @param v - value between a and b\n * @returns (v - a) / (b - a)\n */\nexport function inverseLerp(a: number, b: number, v: number): number {\n const d = b - a;\n return (Math.abs(b - a) < EPSILON)\n ? a\n : (v - a) / d;\n}\n\n/**\n * Compute the euclidean modulo\n *\n * ```\n * // table for n / 3\n * -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5 <- n\n * ------------------------------------\n * -2 -1 -0 -2 -1 0, 1, 2, 0, 1, 2 <- n % 3\n * 1 2 0 1 2 0, 1, 2, 0, 1, 2 <- euclideanModule(n, 3)\n * ```\n *\n * @param n - dividend\n * @param m - divisor\n * @returns the euclidean modulo of n / m\n */\nexport function euclideanModulo(n: number, m: number) {\n return ((n % m) + m) % m;\n}","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport * as utils from './utils.js';\nimport { Mat3Arg } from './mat3';\nimport { Mat4Arg } from './mat4';\nimport { Vec2Arg, Vec2Type } from './vec2';\nimport { Vec3Arg } from './vec3';\nimport { BaseArgType } from './types';\n\nexport { Vec2Arg, Vec2Type };\n\ntype Vec2Ctor = new (n: number) => T;\n\n/**\n * Generates am typed API for Vec3\n */\nfunction getAPIImpl(Ctor: Vec2Ctor) {\n\n/**\n * Creates a Vec2; may be called with x, y, z to set initial values.\n *\n * Note: Since passing in a raw JavaScript array\n * is valid in all circumstances, if you want to\n * force a JavaScript array into a Vec2's specified type\n * it would be faster to use\n *\n * ```\n * const v = vec2.clone(someJSArray);\n * ```\n *\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @returns the created vector\n */\nfunction create(x = 0, y = 0) {\n const newDst = new Ctor(2);\n if (x !== undefined) {\n newDst[0] = x;\n if (y !== undefined) {\n newDst[1] = y;\n }\n }\n return newDst;\n}\n\n/**\n * Creates a Vec2; may be called with x, y, z to set initial values. (same as create)\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @returns the created vector\n */\nconst fromValues = create;\n\n/**\n * Sets the values of a Vec2\n * Also see {@link vec2.create} and {@link vec2.copy}\n *\n * @param x first value\n * @param y second value\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector with its elements set.\n */\nfunction set(x: number, y: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = x;\n newDst[1] = y;\n\n return newDst;\n}\n\n/**\n * Applies Math.ceil to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the ceil of each element of v.\n */\nfunction ceil(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.ceil(v[0]);\n newDst[1] = Math.ceil(v[1]);\n\n return newDst;\n}\n\n/**\n * Applies Math.floor to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the floor of each element of v.\n */\nfunction floor(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.floor(v[0]);\n newDst[1] = Math.floor(v[1]);\n\n return newDst;\n}\n\n/**\n * Applies Math.round to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the round of each element of v.\n */\nfunction round(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.round(v[0]);\n newDst[1] = Math.round(v[1]);\n\n return newDst;\n}\n\n/**\n * Clamp each element of vector between min and max\n * @param v - Operand vector.\n * @param max - Min value, default 0\n * @param min - Max value, default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that the clamped value of each element of v.\n */\nfunction clamp(v: Vec2Arg, min = 0, max = 1, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.min(max, Math.max(min, v[0]));\n newDst[1] = Math.min(max, Math.max(min, v[1]));\n\n return newDst;\n}\n\n/**\n * Adds two vectors; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a and b.\n */\nfunction add(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] + b[0];\n newDst[1] = a[1] + b[1];\n\n return newDst;\n}\n\n/**\n * Adds two vectors, scaling the 2nd; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param scale - Amount to scale b\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a + b * scale.\n */\nfunction addScaled(a: Vec2Arg, b: Vec2Arg, scale: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] + b[0] * scale;\n newDst[1] = a[1] + b[1] * scale;\n\n return newDst;\n}\n\n/**\n * Returns the angle in radians between two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns The angle in radians between the 2 vectors.\n */\nfunction angle(a: Vec2Arg, b: Vec2Arg): number {\n const ax = a[0];\n const ay = a[1];\n const bx = b[0];\n const by = b[1];\n const mag1 = Math.sqrt(ax * ax + ay * ay);\n const mag2 = Math.sqrt(bx * bx + by * by);\n const mag = mag1 * mag2;\n const cosine = mag && dot(a, b) / mag;\n return Math.acos(cosine);\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nfunction subtract(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] - b[0];\n newDst[1] = a[1] - b[1];\n\n return newDst;\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nconst sub = subtract;\n\n/**\n * Check if 2 vectors are approximately equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are approximately equal\n */\nfunction equalsApproximately(a: Vec2Arg, b: Vec2Arg): boolean {\n return Math.abs(a[0] - b[0]) < utils.EPSILON &&\n Math.abs(a[1] - b[1]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 vectors are exactly equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are exactly equal\n */\nfunction equals(a: Vec2Arg, b: Vec2Arg): boolean {\n return a[0] === b[0] && a[1] === b[1];\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficient.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The linear interpolated result.\n */\nfunction lerp(a: Vec2Arg, b: Vec2Arg, t: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] + t * (b[0] - a[0]);\n newDst[1] = a[1] + t * (b[1] - a[1]);\n\n return newDst;\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient vector t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficients vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns the linear interpolated result.\n */\nfunction lerpV(a: Vec2Arg, b: Vec2Arg, t: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] + t[0] * (b[0] - a[0]);\n newDst[1] = a[1] + t[1] * (b[1] - a[1]);\n\n return newDst;\n}\n\n/**\n * Return max values of two vectors.\n * Given vectors a and b returns\n * [max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The max components vector.\n */\nfunction max(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.max(a[0], b[0]);\n newDst[1] = Math.max(a[1], b[1]);\n\n return newDst;\n}\n\n/**\n * Return min values of two vectors.\n * Given vectors a and b returns\n * [min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The min components vector.\n */\nfunction min(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = Math.min(a[0], b[0]);\n newDst[1] = Math.min(a[1], b[1]);\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction mulScalar(v: Vec2Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = v[0] * k;\n newDst[1] = v[1] * k;\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar. (same as mulScalar)\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nconst scale = mulScalar;\n\n/**\n * Divides a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction divScalar(v: Vec2Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = v[0] / k;\n newDst[1] = v[1] / k;\n\n return newDst;\n}\n\n/**\n * Inverse a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nfunction inverse(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = 1 / v[0];\n newDst[1] = 1 / v[1];\n\n return newDst;\n}\n\n/**\n * Invert a vector. (same as inverse)\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nconst invert = inverse;\n\n/**\n * Computes the cross product of two vectors; assumes both vectors have\n * three entries.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of a cross b.\n */\nfunction cross(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const z = a[0] * b[1] - a[1] * b[0];\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = z;\n\n return newDst;\n}\n\n/**\n * Computes the dot product of two vectors; assumes both vectors have\n * three entries.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns dot product\n */\nfunction dot(a: Vec2Arg, b: Vec2Arg): number {\n return a[0] * b[0] + a[1] * b[1];\n}\n\n/**\n * Computes the length of vector\n * @param v - vector.\n * @returns length of vector.\n */\nfunction length(v: Vec2Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n return Math.sqrt(v0 * v0 + v1 * v1);\n}\n\n/**\n * Computes the length of vector (same as length)\n * @param v - vector.\n * @returns length of vector.\n */\nconst len = length;\n\n/**\n * Computes the square of the length of vector\n * @param v - vector.\n * @returns square of the length of vector.\n */\nfunction lengthSq(v: Vec2Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n return v0 * v0 + v1 * v1;\n}\n\n/**\n * Computes the square of the length of vector (same as lengthSq)\n * @param v - vector.\n * @returns square of the length of vector.\n */\nconst lenSq = lengthSq;\n\n/**\n * Computes the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nfunction distance(a: Vec2Arg, b: Vec2Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n return Math.sqrt(dx * dx + dy * dy);\n}\n\n/**\n * Computes the distance between 2 points (same as distance)\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nconst dist = distance;\n\n/**\n * Computes the square of the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nfunction distanceSq(a: Vec2Arg, b: Vec2Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n return dx * dx + dy * dy;\n}\n\n/**\n * Computes the square of the distance between 2 points (same as distanceSq)\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nconst distSq = distanceSq;\n\n/**\n * Divides a vector by its Euclidean length and returns the quotient.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The normalized vector.\n */\nfunction normalize(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const len = Math.sqrt(v0 * v0 + v1 * v1);\n\n if (len > 0.00001) {\n newDst[0] = v0 / len;\n newDst[1] = v1 / len;\n } else {\n newDst[0] = 0;\n newDst[1] = 0;\n }\n\n return newDst;\n}\n\n/**\n * Negates a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns -v.\n */\nfunction negate(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = -v[0];\n newDst[1] = -v[1];\n\n return newDst;\n}\n\n/**\n * Copies a vector. (same as {@link vec2.clone})\n * Also see {@link vec2.create} and {@link vec2.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nfunction copy(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = v[0];\n newDst[1] = v[1];\n\n return newDst;\n}\n\n/**\n * Clones a vector. (same as {@link vec2.copy})\n * Also see {@link vec2.create} and {@link vec2.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nconst clone = copy;\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nfunction multiply(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] * b[0];\n newDst[1] = a[1] * b[1];\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as mul)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nconst mul = multiply;\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nfunction divide(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = a[0] / b[0];\n newDst[1] = a[1] / b[1];\n\n return newDst;\n}\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as divide)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nconst div = divide;\n\n/**\n * Creates a random unit vector * scale\n * @param scale - Default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The random vector.\n */\nfunction random(scale = 1, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n const angle = Math.random() * 2 * Math.PI;\n newDst[0] = Math.cos(angle) * scale;\n newDst[1] = Math.sin(angle) * scale;\n\n return newDst;\n}\n\n/**\n * Zero's a vector\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The zeroed vector.\n */\nfunction zero(dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n newDst[0] = 0;\n newDst[1] = 0;\n\n return newDst;\n}\n\n\n/**\n * transform Vec2 by 4x4 matrix\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional Vec2 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nfunction transformMat4(v: Vec2Arg, m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n const x = v[0];\n const y = v[1];\n\n newDst[0] = x * m[0] + y * m[4] + m[12];\n newDst[1] = x * m[1] + y * m[5] + m[13];\n\n return newDst;\n}\n\n/**\n * Transforms vec4 by 3x3 matrix\n *\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional Vec2 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nfunction transformMat3(v: Vec2Arg, m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n const x = v[0];\n const y = v[1];\n\n newDst[0] = m[0] * x + m[4] * y + m[8];\n newDst[1] = m[1] * x + m[5] * y + m[9];\n\n return newDst;\n}\n\n/**\n * Rotate a 2D vector\n *\n * @param a The vec2 point to rotate\n * @param b The origin of the rotation\n * @param rad The angle of rotation in radians\n * @returns the rotated vector\n */\nfunction rotate(a: Vec2Arg, b: Vec2Arg, rad: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n // Translate point to the origin\n const p0 = a[0] - b[0];\n const p1 = a[1] - b[1];\n const sinC = Math.sin(rad);\n const cosC = Math.cos(rad);\n\n //perform rotation and translate to correct position\n newDst[0] = p0 * cosC - p1 * sinC + b[0];\n newDst[1] = p0 * sinC + p1 * cosC + b[1];\n\n return newDst;\n}\n\n/**\n * Treat a 2D vector as a direction and set it's length\n *\n * @param a The vec2 to lengthen\n * @param len The length of the resulting vector\n * @returns The lengthened vector\n */\nfunction setLength(a: Vec2Arg, len: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n normalize(a, newDst);\n return mulScalar(newDst, len, newDst);\n}\n\n/**\n * Ensure a vector is not longer than a max length\n *\n * @param a The vec2 to limit\n * @param maxLen The longest length of the resulting vector\n * @returns The vector, shortened to maxLen if it's too long\n */\nfunction truncate(a: Vec2Arg, maxLen: number, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n\n if (length(a) > maxLen) {\n return setLength(a, maxLen, newDst);\n }\n\n return copy(a, newDst);\n}\n\n/**\n * Return the vector exactly between 2 endpoint vectors\n *\n * @param a Endpoint 1\n * @param b Endpoint 2\n * @returns The vector exactly residing between endpoints 1 and 2\n */\nfunction midpoint(a: Vec2Arg, b: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(2)) as T;\n return lerp(a, b, 0.5, newDst);\n}\n\nreturn {\n create,\n fromValues,\n set,\n ceil,\n floor,\n round,\n clamp,\n add,\n addScaled,\n angle,\n subtract,\n sub,\n equalsApproximately,\n equals,\n lerp,\n lerpV,\n max,\n min,\n mulScalar,\n scale,\n divScalar,\n inverse,\n invert,\n cross,\n dot,\n length,\n len,\n lengthSq,\n lenSq,\n distance,\n dist,\n distanceSq,\n distSq,\n normalize,\n negate,\n copy,\n clone,\n multiply,\n mul,\n divide,\n div,\n random,\n zero,\n transformMat4,\n transformMat3,\n rotate,\n setLength,\n truncate,\n midpoint,\n};\n}\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\nexport function getAPI(Ctor: Vec2Ctor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\n\nimport * as utils from './utils.js';\nimport { QuatArg } from './quat';\nimport { Mat3Arg, Mat3Type } from './mat3';\nimport { Mat4Arg } from './mat4';\nimport { Vec2Arg } from './vec2';\nimport { getAPI as getVec2API } from './vec2-impl';\nimport { BaseArgType } from './types';\n\nexport { Mat3Arg, Mat3Type };\n\ntype Mat3Ctor = new (n: number) => T;\n\n/**\n * Generates a typed API for Mat3\n * */\nfunction getAPIImpl(Ctor: Mat3Ctor) {\n const vec2 = getVec2API(Ctor);\n\n/**\n * Create a Mat3 from values\n *\n * Note: Since passing in a raw JavaScript array\n * is valid in all circumstances, if you want to\n * force a JavaScript array into a Mat3's specified type\n * it would be faster to use\n *\n * ```\n * const m = mat3.clone(someJSArray);\n * ```\n *\n * @param v0 - value for element 0\n * @param v1 - value for element 1\n * @param v2 - value for element 2\n * @param v3 - value for element 3\n * @param v4 - value for element 4\n * @param v5 - value for element 5\n * @param v6 - value for element 6\n * @param v7 - value for element 7\n * @param v8 - value for element 8\n * @returns matrix created from values.\n */\nfunction create(\n v0?: number, v1?: number, v2?: number,\n v3?: number, v4?: number, v5?: number,\n v6?: number, v7?: number, v8?: number) {\n const newDst = new Ctor(12);\n // to make the array homogenous\n newDst[3] = 0;\n newDst[7] = 0;\n newDst[11] = 0;\n\n if (v0 !== undefined) {\n newDst[0] = v0;\n if (v1 !== undefined) {\n newDst[1] = v1;\n if (v2 !== undefined) {\n newDst[2] = v2;\n if (v3 !== undefined) {\n newDst[4] = v3;\n if (v4 !== undefined) {\n newDst[5] = v4;\n if (v5 !== undefined) {\n newDst[6] = v5;\n if (v6 !== undefined) {\n newDst[8] = v6;\n if (v7 !== undefined) {\n newDst[9] = v7;\n if (v8 !== undefined) {\n newDst[10] = v8;\n }\n }\n }\n }\n }\n }\n }\n }\n }\n\n return newDst;\n}\n\n/**\n * Sets the values of a Mat3\n * Also see {@link mat3.create} and {@link mat3.copy}\n *\n * @param v0 - value for element 0\n * @param v1 - value for element 1\n * @param v2 - value for element 2\n * @param v3 - value for element 3\n * @param v4 - value for element 4\n * @param v5 - value for element 5\n * @param v6 - value for element 6\n * @param v7 - value for element 7\n * @param v8 - value for element 8\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat3 set from values.\n */\nfunction set(\n v0: number, v1: number, v2: number,\n v3: number, v4: number, v5: number,\n v6: number, v7: number, v8: number, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[0] = v0; newDst[1] = v1; newDst[ 2] = v2; newDst[ 3] = 0;\n newDst[4] = v3; newDst[5] = v4; newDst[ 6] = v5; newDst[ 7] = 0;\n newDst[8] = v6; newDst[9] = v7; newDst[10] = v8; newDst[11] = 0;\n\n return newDst;\n}\n\n/**\n * Creates a Mat3 from the upper left 3x3 part of a Mat4\n * @param m4 - source matrix\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat3 made from m4\n */\nfunction fromMat4(m4: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n newDst[0] = m4[0]; newDst[1] = m4[1]; newDst[ 2] = m4[ 2]; newDst[ 3] = 0;\n newDst[4] = m4[4]; newDst[5] = m4[5]; newDst[ 6] = m4[ 6]; newDst[ 7] = 0;\n newDst[8] = m4[8]; newDst[9] = m4[9]; newDst[10] = m4[10]; newDst[11] = 0;\n return newDst;\n}\n\n/**\n * Creates a Mat3 rotation matrix from a quaternion\n * @param q - quaternion to create matrix from\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat3 made from q\n */\nfunction fromQuat(q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const x = q[0]; const y = q[1]; const z = q[2]; const w = q[3];\n const x2 = x + x; const y2 = y + y; const z2 = z + z;\n\n const xx = x * x2;\n const yx = y * x2;\n const yy = y * y2;\n const zx = z * x2;\n const zy = z * y2;\n const zz = z * z2;\n const wx = w * x2;\n const wy = w * y2;\n const wz = w * z2;\n\n newDst[ 0] = 1 - yy - zz; newDst[ 1] = yx + wz; newDst[ 2] = zx - wy; newDst[ 3] = 0;\n newDst[ 4] = yx - wz; newDst[ 5] = 1 - xx - zz; newDst[ 6] = zy + wx; newDst[ 7] = 0;\n newDst[ 8] = zx + wy; newDst[ 9] = zy - wx; newDst[10] = 1 - xx - yy; newDst[11] = 0;\n\n return newDst;\n}\n\n/**\n * Negates a matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns -m.\n */\nfunction negate(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = -m[ 0]; newDst[ 1] = -m[ 1]; newDst[ 2] = -m[ 2];\n newDst[ 4] = -m[ 4]; newDst[ 5] = -m[ 5]; newDst[ 6] = -m[ 6];\n newDst[ 8] = -m[ 8]; newDst[ 9] = -m[ 9]; newDst[10] = -m[10];\n\n return newDst;\n}\n\n/**\n * Copies a matrix. (same as {@link mat3.clone})\n * Also see {@link mat3.create} and {@link mat3.set}\n * @param m - The matrix.\n * @param dst - The matrix. If not passed a new one is created.\n * @returns A copy of m.\n */\nfunction copy(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = m[ 0]; newDst[ 1] = m[ 1]; newDst[ 2] = m[ 2];\n newDst[ 4] = m[ 4]; newDst[ 5] = m[ 5]; newDst[ 6] = m[ 6];\n newDst[ 8] = m[ 8]; newDst[ 9] = m[ 9]; newDst[10] = m[10];\n\n return newDst;\n}\n\n/**\n * Copies a matrix (same as {@link mat3.copy})\n * Also see {@link mat3.create} and {@link mat3.set}\n * @param m - The matrix.\n * @param dst - The matrix. If not passed a new one is created.\n * @returns A copy of m.\n */\nconst clone = copy;\n\n/**\n * Check if 2 matrices are approximately equal\n * @param a Operand matrix.\n * @param b Operand matrix.\n * @returns true if matrices are approximately equal\n */\nfunction equalsApproximately(a: Mat3Arg, b: Mat3Arg): boolean {\n return Math.abs(a[ 0] - b[ 0]) < utils.EPSILON &&\n Math.abs(a[ 1] - b[ 1]) < utils.EPSILON &&\n Math.abs(a[ 2] - b[ 2]) < utils.EPSILON &&\n Math.abs(a[ 4] - b[ 4]) < utils.EPSILON &&\n Math.abs(a[ 5] - b[ 5]) < utils.EPSILON &&\n Math.abs(a[ 6] - b[ 6]) < utils.EPSILON &&\n Math.abs(a[ 8] - b[ 8]) < utils.EPSILON &&\n Math.abs(a[ 9] - b[ 9]) < utils.EPSILON &&\n Math.abs(a[10] - b[10]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 matrices are exactly equal\n * @param a Operand matrix.\n * @param b Operand matrix.\n * @returns true if matrices are exactly equal\n */\nfunction equals(a: Mat3Arg, b: Mat3Arg): boolean {\n return a[ 0] === b[ 0] &&\n a[ 1] === b[ 1] &&\n a[ 2] === b[ 2] &&\n a[ 4] === b[ 4] &&\n a[ 5] === b[ 5] &&\n a[ 6] === b[ 6] &&\n a[ 8] === b[ 8] &&\n a[ 9] === b[ 9] &&\n a[10] === b[10];\n}\n\n/**\n * Creates a 3-by-3 identity matrix.\n *\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns A 3-by-3 identity matrix.\n */\nfunction identity(dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = 1; newDst[ 1] = 0; newDst[ 2] = 0;\n newDst[ 4] = 0; newDst[ 5] = 1; newDst[ 6] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1;\n\n return newDst;\n}\n\n/**\n * Takes the transpose of a matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The transpose of m.\n */\nfunction transpose(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n if (newDst === m) {\n let t: number;\n\n // 0 1 2\n // 4 5 6\n // 8 9 10\n\n t = m[1];\n m[1] = m[4];\n m[4] = t;\n\n t = m[2];\n m[2] = m[8];\n m[8] = t;\n\n t = m[6];\n m[6] = m[9];\n m[9] = t;\n\n return newDst;\n }\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n\n newDst[ 0] = m00; newDst[ 1] = m10; newDst[ 2] = m20;\n newDst[ 4] = m01; newDst[ 5] = m11; newDst[ 6] = m21;\n newDst[ 8] = m02; newDst[ 9] = m12; newDst[10] = m22;\n\n return newDst;\n}\n\n/**\n * Computes the inverse of a 3-by-3 matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The inverse of m.\n */\nfunction inverse(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n\n const b01 = m22 * m11 - m12 * m21;\n const b11 = -m22 * m10 + m12 * m20;\n const b21 = m21 * m10 - m11 * m20;\n\n const invDet = 1 / (m00 * b01 + m01 * b11 + m02 * b21);\n\n newDst[ 0] = b01 * invDet;\n newDst[ 1] = (-m22 * m01 + m02 * m21) * invDet;\n newDst[ 2] = ( m12 * m01 - m02 * m11) * invDet;\n newDst[ 4] = b11 * invDet;\n newDst[ 5] = ( m22 * m00 - m02 * m20) * invDet;\n newDst[ 6] = (-m12 * m00 + m02 * m10) * invDet;\n newDst[ 8] = b21 * invDet;\n newDst[ 9] = (-m21 * m00 + m01 * m20) * invDet;\n newDst[10] = ( m11 * m00 - m01 * m10) * invDet;\n\n return newDst;\n}\n\n/**\n * Compute the determinant of a matrix\n * @param m - the matrix\n * @returns the determinant\n */\nfunction determinant(m: Mat3Arg): number {\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n\n return m00 * (m11 * m22 - m21 * m12) -\n m10 * (m01 * m22 - m21 * m02) +\n m20 * (m01 * m12 - m11 * m02);\n}\n\n/**\n * Computes the inverse of a 3-by-3 matrix. (same as inverse)\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The inverse of m.\n */\nconst invert = inverse;\n\n/**\n * Multiplies two 3-by-3 matrices with a on the left and b on the right\n * @param a - The matrix on the left.\n * @param b - The matrix on the right.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix product of a and b.\n */\nfunction multiply(a: Mat3Arg, b: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a10 = a[ 4 + 0];\n const a11 = a[ 4 + 1];\n const a12 = a[ 4 + 2];\n const a20 = a[ 8 + 0];\n const a21 = a[ 8 + 1];\n const a22 = a[ 8 + 2];\n const b00 = b[0];\n const b01 = b[1];\n const b02 = b[2];\n const b10 = b[ 4 + 0];\n const b11 = b[ 4 + 1];\n const b12 = b[ 4 + 2];\n const b20 = b[ 8 + 0];\n const b21 = b[ 8 + 1];\n const b22 = b[ 8 + 2];\n\n newDst[ 0] = a00 * b00 + a10 * b01 + a20 * b02;\n newDst[ 1] = a01 * b00 + a11 * b01 + a21 * b02;\n newDst[ 2] = a02 * b00 + a12 * b01 + a22 * b02;\n newDst[ 4] = a00 * b10 + a10 * b11 + a20 * b12;\n newDst[ 5] = a01 * b10 + a11 * b11 + a21 * b12;\n newDst[ 6] = a02 * b10 + a12 * b11 + a22 * b12;\n newDst[ 8] = a00 * b20 + a10 * b21 + a20 * b22;\n newDst[ 9] = a01 * b20 + a11 * b21 + a21 * b22;\n newDst[10] = a02 * b20 + a12 * b21 + a22 * b22;\n\n return newDst;\n}\n\n/**\n * Multiplies two 3-by-3 matrices with a on the left and b on the right (same as multiply)\n * @param a - The matrix on the left.\n * @param b - The matrix on the right.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix product of a and b.\n */\nconst mul = multiply;\n\n/**\n * Sets the translation component of a 3-by-3 matrix to the given\n * vector.\n * @param a - The matrix.\n * @param v - The vector.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix with translation set.\n */\nfunction setTranslation(a: Mat3Arg, v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? identity()) as T;\n if (a !== newDst) {\n newDst[ 0] = a[ 0];\n newDst[ 1] = a[ 1];\n newDst[ 2] = a[ 2];\n newDst[ 4] = a[ 4];\n newDst[ 5] = a[ 5];\n newDst[ 6] = a[ 6];\n }\n newDst[ 8] = v[0];\n newDst[ 9] = v[1];\n newDst[10] = 1;\n return newDst;\n}\n\n/**\n * Returns the translation component of a 3-by-3 matrix as a vector with 3\n * entries.\n * @param m - The matrix.\n * @param dst - vector to hold result. If not passed a new one is created.\n * @returns The translation component of m.\n */\nfunction getTranslation(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? vec2.create()) as T;\n newDst[0] = m[8];\n newDst[1] = m[9];\n return newDst;\n}\n\n/**\n * Returns an axis of a 3x3 matrix as a vector with 2 entries\n * @param m - The matrix.\n * @param axis - The axis 0 = x, 1 = y,\n * @returns The axis component of m.\n */\nfunction getAxis(m: Mat3Arg, axis: number, dst?: T) {\n const newDst = (dst ?? vec2.create()) as T;\n const off = axis * 4;\n newDst[0] = m[off + 0];\n newDst[1] = m[off + 1];\n return newDst;\n}\n\n/**\n * Sets an axis of a 3x3 matrix as a vector with 2 entries\n * @param m - The matrix.\n * @param v - the axis vector\n * @param axis - The axis 0 = x, 1 = y;\n * @param dst - The matrix to set. If not passed a new one is created.\n * @returns The matrix with axis set.\n */\nfunction setAxis(m: Mat3Arg, v: Vec2Arg, axis: number, dst?: T) {\n const newDst = (dst === m ? m : copy(m, dst)) as T;\n\n const off = axis * 4;\n newDst[off + 0] = v[0];\n newDst[off + 1] = v[1];\n return newDst;\n}\n\n///**\n// * Returns the scaling component of the matrix\n// * @param m - The Matrix\n// * @param dst - The vector to set. If not passed a new one is created.\n// */\nfunction getScaling(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? vec2.create());\n\n const xx = m[0];\n const xy = m[1];\n const yx = m[4];\n const yy = m[5];\n\n newDst[0] = Math.sqrt(xx * xx + xy * xy);\n newDst[1] = Math.sqrt(yx * yx + yy * yy);\n\n return newDst;\n}\n\n/**\n * Creates a 3-by-3 matrix which translates by the given vector v.\n * @param v - The vector by which to translate.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The translation matrix.\n */\nfunction translation(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = 1; newDst[ 1] = 0; newDst[ 2] = 0;\n newDst[ 4] = 0; newDst[ 5] = 1; newDst[ 6] = 0;\n newDst[ 8] = v[0]; newDst[ 9] = v[1]; newDst[10] = 1;\n\n return newDst;\n}\n\n/**\n * Translates the given 3-by-3 matrix by the given vector v.\n * @param m - The matrix.\n * @param v - The vector by which to translate.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The translated matrix.\n */\nfunction translate(m: Mat3Arg, v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n\n const m00 = m[0];\n const m01 = m[1];\n const m02 = m[2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n\n if (m !== newDst) {\n newDst[ 0] = m00;\n newDst[ 1] = m01;\n newDst[ 2] = m02;\n newDst[ 4] = m10;\n newDst[ 5] = m11;\n newDst[ 6] = m12;\n }\n\n newDst[ 8] = m00 * v0 + m10 * v1 + m20;\n newDst[ 9] = m01 * v0 + m11 * v1 + m21;\n newDst[10] = m02 * v0 + m12 * v1 + m22;\n\n return newDst;\n}\n\n/**\n * Creates a 3-by-3 matrix which rotates by the given angle.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotation matrix.\n */\nfunction rotation(angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c; newDst[ 1] = s; newDst[ 2] = 0;\n newDst[ 4] = -s; newDst[ 5] = c; newDst[ 6] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1;\n\n return newDst;\n}\n\n/**\n * Rotates the given 3-by-3 matrix by the given angle.\n * @param m - The matrix.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nfunction rotate(m: Mat3Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c * m00 + s * m10;\n newDst[ 1] = c * m01 + s * m11;\n newDst[ 2] = c * m02 + s * m12;\n\n newDst[ 4] = c * m10 - s * m00;\n newDst[ 5] = c * m11 - s * m01;\n newDst[ 6] = c * m12 - s * m02;\n\n\n if (m !== newDst) {\n newDst[ 8] = m[ 8];\n newDst[ 9] = m[ 9];\n newDst[10] = m[10];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 3-by-3 matrix which scales in each dimension by an amount given by\n * the corresponding entry in the given vector; assumes the vector has three\n * entries.\n * @param v - A vector of\n * 2 entries specifying the factor by which to scale in each dimension.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaling matrix.\n */\nfunction scaling(v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = v[0]; newDst[ 1] = 0; newDst[ 2] = 0;\n newDst[ 4] = 0; newDst[ 5] = v[1]; newDst[ 6] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1;\n\n return newDst;\n}\n\n/**\n * Scales the given 3-by-3 matrix in each dimension by an amount\n * given by the corresponding entry in the given vector; assumes the vector has\n * three entries.\n * @param m - The matrix to be modified.\n * @param v - A vector of 2 entries specifying the\n * factor by which to scale in each dimension.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaled matrix.\n */\nfunction scale(m: Mat3Arg, v: Vec2Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n\n newDst[ 0] = v0 * m[0 * 4 + 0];\n newDst[ 1] = v0 * m[0 * 4 + 1];\n newDst[ 2] = v0 * m[0 * 4 + 2];\n\n newDst[ 4] = v1 * m[1 * 4 + 0];\n newDst[ 5] = v1 * m[1 * 4 + 1];\n newDst[ 6] = v1 * m[1 * 4 + 2];\n\n if (m !== newDst) {\n newDst[ 8] = m[ 8];\n newDst[ 9] = m[ 9];\n newDst[10] = m[10];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 3-by-3 matrix which scales uniformly in each dimension\n * @param s - Amount to scale\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaling matrix.\n */\nfunction uniformScaling(s: number, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = s; newDst[ 1] = 0; newDst[ 2] = 0;\n newDst[ 4] = 0; newDst[ 5] = s; newDst[ 6] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1;\n\n return newDst;\n}\n\n/**\n * Scales the given 3-by-3 matrix in each dimension by an amount\n * given.\n * @param m - The matrix to be modified.\n * @param s - Amount to scale.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaled matrix.\n */\nfunction uniformScale(m: Mat3Arg, s: number, dst?: T) {\n const newDst = (dst ?? new Ctor(12)) as T;\n\n newDst[ 0] = s * m[0 * 4 + 0];\n newDst[ 1] = s * m[0 * 4 + 1];\n newDst[ 2] = s * m[0 * 4 + 2];\n\n newDst[ 4] = s * m[1 * 4 + 0];\n newDst[ 5] = s * m[1 * 4 + 1];\n newDst[ 6] = s * m[1 * 4 + 2];\n\n if (m !== newDst) {\n newDst[ 8] = m[ 8];\n newDst[ 9] = m[ 9];\n newDst[10] = m[10];\n }\n\n return newDst;\n}\n\nreturn {\n clone,\n create,\n set,\n fromMat4,\n fromQuat,\n negate,\n copy,\n equalsApproximately,\n equals,\n identity,\n transpose,\n inverse,\n invert,\n determinant,\n mul,\n multiply,\n setTranslation,\n getTranslation,\n getAxis,\n setAxis,\n getScaling,\n translation,\n translate,\n rotation,\n rotate,\n scaling,\n scale,\n uniformScaling,\n uniformScale,\n};\n\n}\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\nexport function getAPI(Ctor: Mat3Ctor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport * as utils from './utils.js';\nimport { Vec3Arg, Vec3Type } from './vec3';\nimport { Mat3Arg } from './mat3';\nimport { Mat4Arg } from './mat4';\nimport { QuatArg } from './quat';\nimport { BaseArgType } from './types';\n\nexport { Vec3Arg, Vec3Type };\n\ntype Vec3Ctor = new (n: number) => T;\n\n/**\n * Generates am typed API for Vec3\n * */\nfunction getAPIImpl(Ctor: Vec3Ctor) {\n\n/**\n * Creates a vec3; may be called with x, y, z to set initial values.\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @returns the created vector\n */\nfunction create(x?: number, y?: number, z?: number) {\n const newDst = new Ctor(3);\n if (x !== undefined) {\n newDst[0] = x;\n if (y !== undefined) {\n newDst[1] = y;\n if (z !== undefined) {\n newDst[2] = z;\n }\n }\n }\n return newDst;\n}\n\n/**\n * Creates a vec3; may be called with x, y, z to set initial values. (same as create)\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @returns the created vector\n */\nconst fromValues = create;\n\n/**\n * Sets the values of a Vec3\n * Also see {@link vec3.create} and {@link vec3.copy}\n *\n * @param x first value\n * @param y second value\n * @param z third value\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector with its elements set.\n */\nfunction set(x: number, y: number, z: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = x;\n newDst[1] = y;\n newDst[2] = z;\n\n return newDst;\n}\n\n/**\n * Applies Math.ceil to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the ceil of each element of v.\n */\nfunction ceil(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.ceil(v[0]);\n newDst[1] = Math.ceil(v[1]);\n newDst[2] = Math.ceil(v[2]);\n\n return newDst;\n}\n\n/**\n * Applies Math.floor to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the floor of each element of v.\n */\nfunction floor(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.floor(v[0]);\n newDst[1] = Math.floor(v[1]);\n newDst[2] = Math.floor(v[2]);\n\n return newDst;\n}\n\n/**\n * Applies Math.round to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the round of each element of v.\n */\nfunction round(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.round(v[0]);\n newDst[1] = Math.round(v[1]);\n newDst[2] = Math.round(v[2]);\n\n return newDst;\n}\n\n/**\n * Clamp each element of vector between min and max\n * @param v - Operand vector.\n * @param max - Min value, default 0\n * @param min - Max value, default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that the clamped value of each element of v.\n */\nfunction clamp(v: Vec3Arg, min = 0, max = 1, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.min(max, Math.max(min, v[0]));\n newDst[1] = Math.min(max, Math.max(min, v[1]));\n newDst[2] = Math.min(max, Math.max(min, v[2]));\n\n return newDst;\n}\n\n/**\n * Adds two vectors; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a and b.\n */\nfunction add(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] + b[0];\n newDst[1] = a[1] + b[1];\n newDst[2] = a[2] + b[2];\n\n return newDst;\n}\n\n/**\n * Adds two vectors, scaling the 2nd; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param scale - Amount to scale b\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a + b * scale.\n */\nfunction addScaled(a: Vec3Arg, b: Vec3Arg, scale: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] + b[0] * scale;\n newDst[1] = a[1] + b[1] * scale;\n newDst[2] = a[2] + b[2] * scale;\n\n return newDst;\n}\n\n/**\n * Returns the angle in radians between two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns The angle in radians between the 2 vectors.\n */\nfunction angle(a: Vec3Arg, b: Vec3Arg): number {\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const bx = b[0];\n const by = b[1];\n const bz = b[2];\n const mag1 = Math.sqrt(ax * ax + ay * ay + az * az);\n const mag2 = Math.sqrt(bx * bx + by * by + bz * bz);\n const mag = mag1 * mag2;\n const cosine = mag && dot(a, b) / mag;\n return Math.acos(cosine);\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nfunction subtract(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] - b[0];\n newDst[1] = a[1] - b[1];\n newDst[2] = a[2] - b[2];\n\n return newDst;\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nconst sub = subtract;\n\n/**\n * Check if 2 vectors are approximately equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are approximately equal\n */\nfunction equalsApproximately(a: Vec3Arg, b: Vec3Arg): boolean {\n return Math.abs(a[0] - b[0]) < utils.EPSILON &&\n Math.abs(a[1] - b[1]) < utils.EPSILON &&\n Math.abs(a[2] - b[2]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 vectors are exactly equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are exactly equal\n */\nfunction equals(a: Vec3Arg, b: Vec3Arg): boolean {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2];\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficient.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The linear interpolated result.\n */\nfunction lerp(a: Vec3Arg, b: Vec3Arg, t: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] + t * (b[0] - a[0]);\n newDst[1] = a[1] + t * (b[1] - a[1]);\n newDst[2] = a[2] + t * (b[2] - a[2]);\n\n return newDst;\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient vector t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficients vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns the linear interpolated result.\n */\nfunction lerpV(a: Vec3Arg, b: Vec3Arg, t: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] + t[0] * (b[0] - a[0]);\n newDst[1] = a[1] + t[1] * (b[1] - a[1]);\n newDst[2] = a[2] + t[2] * (b[2] - a[2]);\n\n return newDst;\n}\n\n/**\n * Return max values of two vectors.\n * Given vectors a and b returns\n * [max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The max components vector.\n */\nfunction max(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.max(a[0], b[0]);\n newDst[1] = Math.max(a[1], b[1]);\n newDst[2] = Math.max(a[2], b[2]);\n\n return newDst;\n}\n\n/**\n * Return min values of two vectors.\n * Given vectors a and b returns\n * [min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The min components vector.\n */\nfunction min(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = Math.min(a[0], b[0]);\n newDst[1] = Math.min(a[1], b[1]);\n newDst[2] = Math.min(a[2], b[2]);\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction mulScalar(v: Vec3Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = v[0] * k;\n newDst[1] = v[1] * k;\n newDst[2] = v[2] * k;\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar. (same as mulScalar)\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nconst scale = mulScalar;\n\n/**\n * Divides a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction divScalar(v: Vec3Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = v[0] / k;\n newDst[1] = v[1] / k;\n newDst[2] = v[2] / k;\n\n return newDst;\n}\n\n/**\n * Inverse a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nfunction inverse(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = 1 / v[0];\n newDst[1] = 1 / v[1];\n newDst[2] = 1 / v[2];\n\n return newDst;\n}\n\n/**\n * Invert a vector. (same as inverse)\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nconst invert = inverse;\n\n/**\n * Computes the cross product of two vectors; assumes both vectors have\n * three entries.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of a cross b.\n */\nfunction cross(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const t1 = a[2] * b[0] - a[0] * b[2];\n const t2 = a[0] * b[1] - a[1] * b[0];\n newDst[0] = a[1] * b[2] - a[2] * b[1];\n newDst[1] = t1;\n newDst[2] = t2;\n\n return newDst;\n}\n\n/**\n * Computes the dot product of two vectors; assumes both vectors have\n * three entries.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns dot product\n */\nfunction dot(a: Vec3Arg, b: Vec3Arg): number {\n return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]);\n}\n\n/**\n * Computes the length of vector\n * @param v - vector.\n * @returns length of vector.\n */\nfunction length(v: Vec3Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n return Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2);\n}\n\n/**\n * Computes the length of vector (same as length)\n * @param v - vector.\n * @returns length of vector.\n */\nconst len = length;\n\n/**\n * Computes the square of the length of vector\n * @param v - vector.\n * @returns square of the length of vector.\n */\nfunction lengthSq(v: Vec3Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n return v0 * v0 + v1 * v1 + v2 * v2;\n}\n\n/**\n * Computes the square of the length of vector (same as lengthSq)\n * @param v - vector.\n * @returns square of the length of vector.\n */\nconst lenSq = lengthSq;\n\n/**\n * Computes the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nfunction distance(a: Vec3Arg, b: Vec3Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n const dz = a[2] - b[2];\n return Math.sqrt(dx * dx + dy * dy + dz * dz);\n}\n\n/**\n * Computes the distance between 2 points (same as distance)\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nconst dist = distance;\n\n/**\n * Computes the square of the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nfunction distanceSq(a: Vec3Arg, b: Vec3Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n const dz = a[2] - b[2];\n return dx * dx + dy * dy + dz * dz;\n}\n\n/**\n * Computes the square of the distance between 2 points (same as distanceSq)\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nconst distSq = distanceSq;\n\n/**\n * Divides a vector by its Euclidean length and returns the quotient.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The normalized vector.\n */\nfunction normalize(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const len = Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2);\n\n if (len > 0.00001) {\n newDst[0] = v0 / len;\n newDst[1] = v1 / len;\n newDst[2] = v2 / len;\n } else {\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n }\n\n\n return newDst;\n}\n\n/**\n * Negates a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns -v.\n */\nfunction negate(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = -v[0];\n newDst[1] = -v[1];\n newDst[2] = -v[2];\n\n return newDst;\n}\n\n/**\n * Copies a vector. (same as {@link vec3.clone})\n * Also see {@link vec3.create} and {@link vec3.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nfunction copy(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = v[0];\n newDst[1] = v[1];\n newDst[2] = v[2];\n\n return newDst;\n}\n\n/**\n * Clones a vector. (same as {@link vec3.copy})\n * Also see {@link vec3.create} and {@link vec3.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nconst clone = copy;\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nfunction multiply(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] * b[0];\n newDst[1] = a[1] * b[1];\n newDst[2] = a[2] * b[2];\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as mul)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nconst mul = multiply;\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nfunction divide(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = a[0] / b[0];\n newDst[1] = a[1] / b[1];\n newDst[2] = a[2] / b[2];\n\n return newDst;\n}\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as divide)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nconst div = divide;\n\n/**\n * Creates a random vector\n * @param scale - Default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The random vector.\n */\nfunction random(scale = 1, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const angle = Math.random() * 2 * Math.PI;\n const z = Math.random() * 2 - 1;\n const zScale = Math.sqrt(1 - z * z) * scale;\n newDst[0] = Math.cos(angle) * zScale;\n newDst[1] = Math.sin(angle) * zScale;\n newDst[2] = z * scale;\n\n return newDst;\n}\n\n/**\n * Zero's a vector\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The zeroed vector.\n */\nfunction zero(dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n\n return newDst;\n}\n\n\n/**\n * transform vec3 by 4x4 matrix\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional vec3 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nfunction transformMat4(v: Vec3Arg, m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const x = v[0];\n const y = v[1];\n const z = v[2];\n const w = (m[3] * x + m[7] * y + m[11] * z + m[15]) || 1;\n\n newDst[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;\n newDst[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;\n newDst[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;\n\n return newDst;\n}\n\n/**\n * Transform vec3 by upper 3x3 matrix inside 4x4 matrix.\n * @param v - The direction.\n * @param m - The matrix.\n * @param dst - optional vec3 to store result. If not passed a new one is created.\n * @returns The transformed vector.\n */\nfunction transformMat4Upper3x3(v: Vec3Arg, m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n\n newDst[0] = v0 * m[0 * 4 + 0] + v1 * m[1 * 4 + 0] + v2 * m[2 * 4 + 0];\n newDst[1] = v0 * m[0 * 4 + 1] + v1 * m[1 * 4 + 1] + v2 * m[2 * 4 + 1];\n newDst[2] = v0 * m[0 * 4 + 2] + v1 * m[1 * 4 + 2] + v2 * m[2 * 4 + 2];\n\n return newDst;\n}\n\n/**\n * Transforms vec3 by 3x3 matrix\n *\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional vec3 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nfunction transformMat3(v: Vec3Arg, m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const x = v[0];\n const y = v[1];\n const z = v[2];\n\n newDst[0] = x * m[0] + y * m[4] + z * m[8];\n newDst[1] = x * m[1] + y * m[5] + z * m[9];\n newDst[2] = x * m[2] + y * m[6] + z * m[10];\n\n return newDst;\n}\n\n/**\n * Transforms vec3 by Quaternion\n * @param v - the vector to transform\n * @param q - the quaternion to transform by\n * @param dst - optional vec3 to store result. If not passed a new one is created.\n * @returns the transformed\n */\nfunction transformQuat(v: Vec3Arg, q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const w2 = q[3] * 2;\n\n const x = v[0];\n const y = v[1];\n const z = v[2];\n\n const uvX = qy * z - qz * y;\n const uvY = qz * x - qx * z;\n const uvZ = qx * y - qy * x;\n\n newDst[0] = x + uvX * w2 + (qy * uvZ - qz * uvY) * 2;\n newDst[1] = y + uvY * w2 + (qz * uvX - qx * uvZ) * 2;\n newDst[2] = z + uvZ * w2 + (qx * uvY - qy * uvX) * 2;\n\n return newDst;\n}\n\n/**\n * Returns the translation component of a 4-by-4 matrix as a vector with 3\n * entries.\n * @param m - The matrix.\n * @param dst - vector to hold result. If not passed a new one is created.\n * @returns The translation component of m.\n */\nfunction getTranslation(m: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n newDst[0] = m[12];\n newDst[1] = m[13];\n newDst[2] = m[14];\n return newDst;\n}\n/**\n * Returns an axis of a 4x4 matrix as a vector with 3 entries\n * @param m - The matrix.\n * @param axis - The axis 0 = x, 1 = y, 2 = z;\n * @returns The axis component of m.\n */\nfunction getAxis(m: Mat4Arg, axis: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const off = axis * 4;\n newDst[0] = m[off + 0];\n newDst[1] = m[off + 1];\n newDst[2] = m[off + 2];\n return newDst;\n}\n/**\n * Returns the scaling component of the matrix\n * @param m - The Matrix\n * @param dst - The vector to set. If not passed a new one is created.\n */\nfunction getScaling(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const xx = m[0];\n const xy = m[1];\n const xz = m[2];\n const yx = m[4];\n const yy = m[5];\n const yz = m[6];\n const zx = m[8];\n const zy = m[9];\n const zz = m[10];\n newDst[0] = Math.sqrt(xx * xx + xy * xy + xz * xz);\n newDst[1] = Math.sqrt(yx * yx + yy * yy + yz * yz);\n newDst[2] = Math.sqrt(zx * zx + zy * zy + zz * zz);\n return newDst;\n}\n\n/**\n * Rotate a 3D vector around the x-axis\n *\n * @param {ReadonlyVec3} a The vec3 point to rotate\n * @param {ReadonlyVec3} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @param dst - The vector to set. If not passed a new one is created.\n * @returns the rotated vector\n */\nfunction rotateX(a: Vec3Arg, b: Vec3Arg, rad: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const p = [];\n const r = [];\n\n //Translate point to the origin\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2];\n\n //perform rotation\n r[0] = p[0];\n r[1] = p[1] * Math.cos(rad) - p[2] * Math.sin(rad);\n r[2] = p[1] * Math.sin(rad) + p[2] * Math.cos(rad);\n\n //translate to correct position\n newDst[0] = r[0] + b[0];\n newDst[1] = r[1] + b[1];\n newDst[2] = r[2] + b[2];\n\n return newDst;\n}\n\n/**\n * Rotate a 3D vector around the y-axis\n *\n * @param {ReadonlyVec3} a The vec3 point to rotate\n * @param {ReadonlyVec3} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @param dst - The vector to set. If not passed a new one is created.\n * @returns the rotated vector\n */\nfunction rotateY(a: Vec3Arg, b: Vec3Arg, rad: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const p = [];\n const r = [];\n\n // translate point to the origin\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2];\n\n // perform rotation\n r[0] = p[2] * Math.sin(rad) + p[0] * Math.cos(rad);\n r[1] = p[1];\n r[2] = p[2] * Math.cos(rad) - p[0] * Math.sin(rad);\n\n // translate to correct position\n newDst[0] = r[0] + b[0];\n newDst[1] = r[1] + b[1];\n newDst[2] = r[2] + b[2];\n\n return newDst;\n}\n\n/**\n * Rotate a 3D vector around the z-axis\n *\n * @param {ReadonlyVec3} a The vec3 point to rotate\n * @param {ReadonlyVec3} b The origin of the rotation\n * @param {Number} rad The angle of rotation in radians\n * @param dst - The vector to set. If not passed a new one is created.\n * @returns {vec3} out\n */\nfunction rotateZ(a: Vec3Arg, b: Vec3Arg, rad: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n const p = [];\n const r = [];\n\n // translate point to the origin\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2];\n\n // perform rotation\n r[0] = p[0] * Math.cos(rad) - p[1] * Math.sin(rad);\n r[1] = p[0] * Math.sin(rad) + p[1] * Math.cos(rad);\n r[2] = p[2];\n\n // translate to correct position\n newDst[0] = r[0] + b[0];\n newDst[1] = r[1] + b[1];\n newDst[2] = r[2] + b[2];\n\n return newDst;\n}\n\n/**\n * Treat a 3D vector as a direction and set it's length\n *\n * @param a The vec3 to lengthen\n * @param len The length of the resulting vector\n * @returns The lengthened vector\n */\nfunction setLength(a: Vec3Arg, len: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n normalize(a, newDst);\n return mulScalar(newDst, len, newDst);\n}\n\n/**\n * Ensure a vector is not longer than a max length\n *\n * @param a The vec3 to limit\n * @param maxLen The longest length of the resulting vector\n * @returns The vector, shortened to maxLen if it's too long\n */\nfunction truncate(a: Vec3Arg, maxLen: number, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n\n if (length(a) > maxLen) {\n return setLength(a, maxLen, newDst);\n }\n\n return copy(a, newDst);\n}\n\n/**\n * Return the vector exactly between 2 endpoint vectors\n *\n * @param a Endpoint 1\n * @param b Endpoint 2\n * @returns The vector exactly residing between endpoints 1 and 2\n */\nfunction midpoint(a: Vec3Arg, b: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(3)) as T;\n return lerp(a, b, 0.5, newDst);\n}\n\nreturn {\n create,\n fromValues,\n set,\n ceil,\n floor,\n round,\n clamp,\n add,\n addScaled,\n angle,\n subtract,\n sub,\n equalsApproximately,\n equals,\n lerp,\n lerpV,\n max,\n min,\n mulScalar,\n scale,\n divScalar,\n inverse,\n invert,\n cross,\n dot,\n length,\n len,\n lengthSq,\n lenSq,\n distance,\n dist,\n distanceSq,\n distSq,\n normalize,\n negate,\n copy,\n clone,\n multiply,\n mul,\n divide,\n div,\n random,\n zero,\n transformMat4,\n transformMat4Upper3x3,\n transformMat3,\n transformQuat,\n getTranslation,\n getAxis,\n getScaling,\n rotateX,\n rotateY,\n rotateZ,\n setLength,\n truncate,\n midpoint,\n};\n\n}\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\nexport function getAPI(Ctor: Vec3Ctor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n","import { Mat4Arg, Mat4Type } from './mat4';\nimport { Mat3Arg } from './mat3';\nimport { QuatArg } from './quat';\nimport { Vec3Arg } from './vec3';\nimport { getAPI as getVec3API } from './vec3-impl';\nimport { BaseArgType } from './types';\nimport * as utils from './utils';\n\nexport { Mat4Arg, Mat4Type };\n\ntype Mat4Ctor = new (n: number) => T;\n\n/**\n * Generates a typed API for Mat4\n * */\nfunction getAPIImpl(Ctor: Mat4Ctor) {\n const vec3 = getVec3API(Ctor);\n\n/**\n * 4x4 Matrix math math functions.\n *\n * Almost all functions take an optional `newDst` argument. If it is not passed in the\n * functions will create a new matrix. In other words you can do this\n *\n * const mat = mat4.translation([1, 2, 3]); // Creates a new translation matrix\n *\n * or\n *\n * const mat = mat4.create();\n * mat4.translation([1, 2, 3], mat); // Puts translation matrix in mat.\n *\n * The first style is often easier but depending on where it's used it generates garbage where\n * as there is almost never allocation with the second style.\n *\n * It is always save to pass any matrix as the destination. So for example\n *\n * const mat = mat4.identity();\n * const trans = mat4.translation([1, 2, 3]);\n * mat4.multiply(mat, trans, mat); // Multiplies mat * trans and puts result in mat.\n *\n */\n\n\n/**\n * Create a Mat4 from values\n *\n * Note: Since passing in a raw JavaScript array\n * is valid in all circumstances, if you want to\n * force a JavaScript array into a Mat4's specified type\n * it would be faster to use\n *\n * ```\n * const m = mat4.clone(someJSArray);\n * ```\n *\n * @param v0 - value for element 0\n * @param v1 - value for element 1\n * @param v2 - value for element 2\n * @param v3 - value for element 3\n * @param v4 - value for element 4\n * @param v5 - value for element 5\n * @param v6 - value for element 6\n * @param v7 - value for element 7\n * @param v8 - value for element 8\n * @param v9 - value for element 9\n * @param v10 - value for element 10\n * @param v11 - value for element 11\n * @param v12 - value for element 12\n * @param v13 - value for element 13\n * @param v14 - value for element 14\n * @param v15 - value for element 15\n * @returns created from values.\n */\nfunction create(\n v0?: number, v1?: number, v2?: number, v3?: number,\n v4?: number, v5?: number, v6?: number, v7?: number,\n v8?: number, v9?: number, v10?: number, v11?: number,\n v12?: number, v13?: number, v14?: number, v15?: number) {\n const newDst = new Ctor(16);\n if (v0 !== undefined) {\n newDst[0] = v0;\n if (v1 !== undefined) {\n newDst[1] = v1;\n if (v2 !== undefined) {\n newDst[2] = v2;\n if (v3 !== undefined) {\n newDst[3] = v3;\n if (v4 !== undefined) {\n newDst[4] = v4;\n if (v5 !== undefined) {\n newDst[5] = v5;\n if (v6 !== undefined) {\n newDst[6] = v6;\n if (v7 !== undefined) {\n newDst[7] = v7;\n if (v8 !== undefined) {\n newDst[8] = v8;\n if (v9 !== undefined) {\n newDst[9] = v9;\n if (v10 !== undefined) {\n newDst[10] = v10;\n if (v11 !== undefined) {\n newDst[11] = v11;\n if (v12 !== undefined) {\n newDst[12] = v12;\n if (v13 !== undefined) {\n newDst[13] = v13;\n if (v14 !== undefined) {\n newDst[14] = v14;\n if (v15 !== undefined) {\n newDst[15] = v15;\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n return newDst;\n}\n\n/**\n * Sets the values of a Mat4\n * Also see {@link mat4.create} and {@link mat4.copy}\n *\n * @param v0 - value for element 0\n * @param v1 - value for element 1\n * @param v2 - value for element 2\n * @param v3 - value for element 3\n * @param v4 - value for element 4\n * @param v5 - value for element 5\n * @param v6 - value for element 6\n * @param v7 - value for element 7\n * @param v8 - value for element 8\n * @param v9 - value for element 9\n * @param v10 - value for element 10\n * @param v11 - value for element 11\n * @param v12 - value for element 12\n * @param v13 - value for element 13\n * @param v14 - value for element 14\n * @param v15 - value for element 15\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat4 created from values.\n */\nfunction set(\n v0: number, v1: number, v2: number, v3: number,\n v4: number, v5: number, v6: number, v7: number,\n v8: number, v9: number, v10: number, v11: number,\n v12: number, v13: number, v14: number, v15: number,\n dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = v0; newDst[ 1] = v1; newDst[ 2] = v2; newDst[ 3] = v3;\n newDst[ 4] = v4; newDst[ 5] = v5; newDst[ 6] = v6; newDst[ 7] = v7;\n newDst[ 8] = v8; newDst[ 9] = v9; newDst[10] = v10; newDst[11] = v11;\n newDst[12] = v12; newDst[13] = v13; newDst[14] = v14; newDst[15] = v15;\n\n return newDst;\n}\n\n/**\n * Creates a Mat4 from a Mat3\n * @param m3 - source matrix\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat4 made from m3\n */\nfunction fromMat3(m3: Mat3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = m3[0]; newDst[ 1] = m3[1]; newDst[ 2] = m3[ 2]; newDst[ 3] = 0;\n newDst[ 4] = m3[4]; newDst[ 5] = m3[5]; newDst[ 6] = m3[ 6]; newDst[ 7] = 0;\n newDst[ 8] = m3[8]; newDst[ 9] = m3[9]; newDst[10] = m3[10]; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Creates a Mat4 rotation matrix from a quaternion\n * @param q - quaternion to create matrix from\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns Mat4 made from q\n */\nfunction fromQuat(q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const x = q[0]; const y = q[1]; const z = q[2]; const w = q[3];\n const x2 = x + x; const y2 = y + y; const z2 = z + z;\n\n const xx = x * x2;\n const yx = y * x2;\n const yy = y * y2;\n const zx = z * x2;\n const zy = z * y2;\n const zz = z * z2;\n const wx = w * x2;\n const wy = w * y2;\n const wz = w * z2;\n\n newDst[ 0] = 1 - yy - zz; newDst[ 1] = yx + wz; newDst[ 2] = zx - wy; newDst[ 3] = 0;\n newDst[ 4] = yx - wz; newDst[ 5] = 1 - xx - zz; newDst[ 6] = zy + wx; newDst[ 7] = 0;\n newDst[ 8] = zx + wy; newDst[ 9] = zy - wx; newDst[10] = 1 - xx - yy; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Negates a matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns -m.\n */\nfunction negate(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = -m[ 0]; newDst[ 1] = -m[ 1]; newDst[ 2] = -m[ 2]; newDst[ 3] = -m[ 3];\n newDst[ 4] = -m[ 4]; newDst[ 5] = -m[ 5]; newDst[ 6] = -m[ 6]; newDst[ 7] = -m[ 7];\n newDst[ 8] = -m[ 8]; newDst[ 9] = -m[ 9]; newDst[10] = -m[10]; newDst[11] = -m[11];\n newDst[12] = -m[12]; newDst[13] = -m[13]; newDst[14] = -m[14]; newDst[15] = -m[15];\n\n return newDst;\n}\n\n/**\n * Copies a matrix. (same as {@link mat4.clone})\n * Also see {@link mat4.create} and {@link mat4.set}\n * @param m - The matrix.\n * @param dst - The matrix. If not passed a new one is created.\n * @returns A copy of m.\n */\nfunction copy(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = m[ 0]; newDst[ 1] = m[ 1]; newDst[ 2] = m[ 2]; newDst[ 3] = m[ 3];\n newDst[ 4] = m[ 4]; newDst[ 5] = m[ 5]; newDst[ 6] = m[ 6]; newDst[ 7] = m[ 7];\n newDst[ 8] = m[ 8]; newDst[ 9] = m[ 9]; newDst[10] = m[10]; newDst[11] = m[11];\n newDst[12] = m[12]; newDst[13] = m[13]; newDst[14] = m[14]; newDst[15] = m[15];\n\n return newDst;\n}\n\n/**\n * Copies a matrix (same as {@link mat4.copy})\n * Also see {@link mat4.create} and {@link mat4.set}\n * @param m - The matrix.\n * @param dst - The matrix. If not passed a new one is created.\n * @returns A copy of m.\n */\nconst clone = copy;\n\n/**\n * Check if 2 matrices are approximately equal\n * @param a - Operand matrix.\n * @param b - Operand matrix.\n * @returns true if matrices are approximately equal\n */\nfunction equalsApproximately(a: Mat4Arg, b: Mat4Arg): boolean {\n return Math.abs(a[ 0] - b[ 0]) < utils.EPSILON &&\n Math.abs(a[ 1] - b[ 1]) < utils.EPSILON &&\n Math.abs(a[ 2] - b[ 2]) < utils.EPSILON &&\n Math.abs(a[ 3] - b[ 3]) < utils.EPSILON &&\n Math.abs(a[ 4] - b[ 4]) < utils.EPSILON &&\n Math.abs(a[ 5] - b[ 5]) < utils.EPSILON &&\n Math.abs(a[ 6] - b[ 6]) < utils.EPSILON &&\n Math.abs(a[ 7] - b[ 7]) < utils.EPSILON &&\n Math.abs(a[ 8] - b[ 8]) < utils.EPSILON &&\n Math.abs(a[ 9] - b[ 9]) < utils.EPSILON &&\n Math.abs(a[10] - b[10]) < utils.EPSILON &&\n Math.abs(a[11] - b[11]) < utils.EPSILON &&\n Math.abs(a[12] - b[12]) < utils.EPSILON &&\n Math.abs(a[13] - b[13]) < utils.EPSILON &&\n Math.abs(a[14] - b[14]) < utils.EPSILON &&\n Math.abs(a[15] - b[15]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 matrices are exactly equal\n * @param a - Operand matrix.\n * @param b - Operand matrix.\n * @returns true if matrices are exactly equal\n */\nfunction equals(a: Mat4Arg, b: Mat4Arg): boolean {\n return a[ 0] === b[ 0] &&\n a[ 1] === b[ 1] &&\n a[ 2] === b[ 2] &&\n a[ 3] === b[ 3] &&\n a[ 4] === b[ 4] &&\n a[ 5] === b[ 5] &&\n a[ 6] === b[ 6] &&\n a[ 7] === b[ 7] &&\n a[ 8] === b[ 8] &&\n a[ 9] === b[ 9] &&\n a[10] === b[10] &&\n a[11] === b[11] &&\n a[12] === b[12] &&\n a[13] === b[13] &&\n a[14] === b[14] &&\n a[15] === b[15];\n}\n\n/**\n * Creates a 4-by-4 identity matrix.\n *\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns A 4-by-4 identity matrix.\n */\nfunction identity(dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = 1; newDst[ 1] = 0; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = 1; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Takes the transpose of a matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The transpose of m.\n */\nfunction transpose(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n if (newDst === m) {\n let t;\n\n t = m[1];\n m[1] = m[4];\n m[4] = t;\n\n t = m[2];\n m[2] = m[8];\n m[8] = t;\n\n t = m[3];\n m[3] = m[12];\n m[12] = t;\n\n t = m[6];\n m[6] = m[9];\n m[9] = t;\n\n t = m[7];\n m[7] = m[13];\n m[13] = t;\n\n t = m[11];\n m[11] = m[14];\n m[14] = t;\n return newDst;\n }\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const m30 = m[3 * 4 + 0];\n const m31 = m[3 * 4 + 1];\n const m32 = m[3 * 4 + 2];\n const m33 = m[3 * 4 + 3];\n\n newDst[ 0] = m00; newDst[ 1] = m10; newDst[ 2] = m20; newDst[ 3] = m30;\n newDst[ 4] = m01; newDst[ 5] = m11; newDst[ 6] = m21; newDst[ 7] = m31;\n newDst[ 8] = m02; newDst[ 9] = m12; newDst[10] = m22; newDst[11] = m32;\n newDst[12] = m03; newDst[13] = m13; newDst[14] = m23; newDst[15] = m33;\n\n return newDst;\n}\n\n/**\n * Computes the inverse of a 4-by-4 matrix.\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The inverse of m.\n */\nfunction inverse(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const m30 = m[3 * 4 + 0];\n const m31 = m[3 * 4 + 1];\n const m32 = m[3 * 4 + 2];\n const m33 = m[3 * 4 + 3];\n const tmp0 = m22 * m33;\n const tmp1 = m32 * m23;\n const tmp2 = m12 * m33;\n const tmp3 = m32 * m13;\n const tmp4 = m12 * m23;\n const tmp5 = m22 * m13;\n const tmp6 = m02 * m33;\n const tmp7 = m32 * m03;\n const tmp8 = m02 * m23;\n const tmp9 = m22 * m03;\n const tmp10 = m02 * m13;\n const tmp11 = m12 * m03;\n const tmp12 = m20 * m31;\n const tmp13 = m30 * m21;\n const tmp14 = m10 * m31;\n const tmp15 = m30 * m11;\n const tmp16 = m10 * m21;\n const tmp17 = m20 * m11;\n const tmp18 = m00 * m31;\n const tmp19 = m30 * m01;\n const tmp20 = m00 * m21;\n const tmp21 = m20 * m01;\n const tmp22 = m00 * m11;\n const tmp23 = m10 * m01;\n\n const t0 = (tmp0 * m11 + tmp3 * m21 + tmp4 * m31) -\n (tmp1 * m11 + tmp2 * m21 + tmp5 * m31);\n const t1 = (tmp1 * m01 + tmp6 * m21 + tmp9 * m31) -\n (tmp0 * m01 + tmp7 * m21 + tmp8 * m31);\n const t2 = (tmp2 * m01 + tmp7 * m11 + tmp10 * m31) -\n (tmp3 * m01 + tmp6 * m11 + tmp11 * m31);\n const t3 = (tmp5 * m01 + tmp8 * m11 + tmp11 * m21) -\n (tmp4 * m01 + tmp9 * m11 + tmp10 * m21);\n\n const d = 1 / (m00 * t0 + m10 * t1 + m20 * t2 + m30 * t3);\n\n newDst[ 0] = d * t0;\n newDst[ 1] = d * t1;\n newDst[ 2] = d * t2;\n newDst[ 3] = d * t3;\n newDst[ 4] = d * ((tmp1 * m10 + tmp2 * m20 + tmp5 * m30) -\n (tmp0 * m10 + tmp3 * m20 + tmp4 * m30));\n newDst[ 5] = d * ((tmp0 * m00 + tmp7 * m20 + tmp8 * m30) -\n (tmp1 * m00 + tmp6 * m20 + tmp9 * m30));\n newDst[ 6] = d * ((tmp3 * m00 + tmp6 * m10 + tmp11 * m30) -\n (tmp2 * m00 + tmp7 * m10 + tmp10 * m30));\n newDst[ 7] = d * ((tmp4 * m00 + tmp9 * m10 + tmp10 * m20) -\n (tmp5 * m00 + tmp8 * m10 + tmp11 * m20));\n newDst[ 8] = d * ((tmp12 * m13 + tmp15 * m23 + tmp16 * m33) -\n (tmp13 * m13 + tmp14 * m23 + tmp17 * m33));\n newDst[ 9] = d * ((tmp13 * m03 + tmp18 * m23 + tmp21 * m33) -\n (tmp12 * m03 + tmp19 * m23 + tmp20 * m33));\n newDst[10] = d * ((tmp14 * m03 + tmp19 * m13 + tmp22 * m33) -\n (tmp15 * m03 + tmp18 * m13 + tmp23 * m33));\n newDst[11] = d * ((tmp17 * m03 + tmp20 * m13 + tmp23 * m23) -\n (tmp16 * m03 + tmp21 * m13 + tmp22 * m23));\n newDst[12] = d * ((tmp14 * m22 + tmp17 * m32 + tmp13 * m12) -\n (tmp16 * m32 + tmp12 * m12 + tmp15 * m22));\n newDst[13] = d * ((tmp20 * m32 + tmp12 * m02 + tmp19 * m22) -\n (tmp18 * m22 + tmp21 * m32 + tmp13 * m02));\n newDst[14] = d * ((tmp18 * m12 + tmp23 * m32 + tmp15 * m02) -\n (tmp22 * m32 + tmp14 * m02 + tmp19 * m12));\n newDst[15] = d * ((tmp22 * m22 + tmp16 * m02 + tmp21 * m12) -\n (tmp20 * m12 + tmp23 * m22 + tmp17 * m02));\n\n return newDst;\n}\n\n/**\n * Compute the determinant of a matrix\n * @param m - the matrix\n * @returns the determinant\n */\nfunction determinant(m: Mat4Arg): number {\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const m30 = m[3 * 4 + 0];\n const m31 = m[3 * 4 + 1];\n const m32 = m[3 * 4 + 2];\n const m33 = m[3 * 4 + 3];\n\n const tmp0 = m22 * m33;\n const tmp1 = m32 * m23;\n const tmp2 = m12 * m33;\n const tmp3 = m32 * m13;\n const tmp4 = m12 * m23;\n const tmp5 = m22 * m13;\n const tmp6 = m02 * m33;\n const tmp7 = m32 * m03;\n const tmp8 = m02 * m23;\n const tmp9 = m22 * m03;\n const tmp10 = m02 * m13;\n const tmp11 = m12 * m03;\n\n const t0 = (tmp0 * m11 + tmp3 * m21 + tmp4 * m31) -\n (tmp1 * m11 + tmp2 * m21 + tmp5 * m31);\n const t1 = (tmp1 * m01 + tmp6 * m21 + tmp9 * m31) -\n (tmp0 * m01 + tmp7 * m21 + tmp8 * m31);\n const t2 = (tmp2 * m01 + tmp7 * m11 + tmp10 * m31) -\n (tmp3 * m01 + tmp6 * m11 + tmp11 * m31);\n const t3 = (tmp5 * m01 + tmp8 * m11 + tmp11 * m21) -\n (tmp4 * m01 + tmp9 * m11 + tmp10 * m21);\n\n return m00 * t0 + m10 * t1 + m20 * t2 + m30 * t3;\n}\n\n/**\n * Computes the inverse of a 4-by-4 matrix. (same as inverse)\n * @param m - The matrix.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The inverse of m.\n */\nconst invert = inverse;\n\n/**\n * Multiplies two 4-by-4 matrices with a on the left and b on the right\n * @param a - The matrix on the left.\n * @param b - The matrix on the right.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix product of a and b.\n */\nfunction multiply(a: Mat4Arg, b: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const a00 = a[0];\n const a01 = a[1];\n const a02 = a[2];\n const a03 = a[3];\n const a10 = a[ 4 + 0];\n const a11 = a[ 4 + 1];\n const a12 = a[ 4 + 2];\n const a13 = a[ 4 + 3];\n const a20 = a[ 8 + 0];\n const a21 = a[ 8 + 1];\n const a22 = a[ 8 + 2];\n const a23 = a[ 8 + 3];\n const a30 = a[12 + 0];\n const a31 = a[12 + 1];\n const a32 = a[12 + 2];\n const a33 = a[12 + 3];\n const b00 = b[0];\n const b01 = b[1];\n const b02 = b[2];\n const b03 = b[3];\n const b10 = b[ 4 + 0];\n const b11 = b[ 4 + 1];\n const b12 = b[ 4 + 2];\n const b13 = b[ 4 + 3];\n const b20 = b[ 8 + 0];\n const b21 = b[ 8 + 1];\n const b22 = b[ 8 + 2];\n const b23 = b[ 8 + 3];\n const b30 = b[12 + 0];\n const b31 = b[12 + 1];\n const b32 = b[12 + 2];\n const b33 = b[12 + 3];\n\n newDst[ 0] = a00 * b00 + a10 * b01 + a20 * b02 + a30 * b03;\n newDst[ 1] = a01 * b00 + a11 * b01 + a21 * b02 + a31 * b03;\n newDst[ 2] = a02 * b00 + a12 * b01 + a22 * b02 + a32 * b03;\n newDst[ 3] = a03 * b00 + a13 * b01 + a23 * b02 + a33 * b03;\n newDst[ 4] = a00 * b10 + a10 * b11 + a20 * b12 + a30 * b13;\n newDst[ 5] = a01 * b10 + a11 * b11 + a21 * b12 + a31 * b13;\n newDst[ 6] = a02 * b10 + a12 * b11 + a22 * b12 + a32 * b13;\n newDst[ 7] = a03 * b10 + a13 * b11 + a23 * b12 + a33 * b13;\n newDst[ 8] = a00 * b20 + a10 * b21 + a20 * b22 + a30 * b23;\n newDst[ 9] = a01 * b20 + a11 * b21 + a21 * b22 + a31 * b23;\n newDst[10] = a02 * b20 + a12 * b21 + a22 * b22 + a32 * b23;\n newDst[11] = a03 * b20 + a13 * b21 + a23 * b22 + a33 * b23;\n newDst[12] = a00 * b30 + a10 * b31 + a20 * b32 + a30 * b33;\n newDst[13] = a01 * b30 + a11 * b31 + a21 * b32 + a31 * b33;\n newDst[14] = a02 * b30 + a12 * b31 + a22 * b32 + a32 * b33;\n newDst[15] = a03 * b30 + a13 * b31 + a23 * b32 + a33 * b33;\n\n return newDst;\n}\n\n/**\n * Multiplies two 4-by-4 matrices with a on the left and b on the right (same as multiply)\n * @param a - The matrix on the left.\n * @param b - The matrix on the right.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix product of a and b.\n */\nconst mul = multiply;\n\n/**\n * Sets the translation component of a 4-by-4 matrix to the given\n * vector.\n * @param a - The matrix.\n * @param v - The vector.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The matrix with translation set.\n */\nfunction setTranslation(a: Mat4Arg, v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? identity()) as T;\n if (a !== newDst) {\n newDst[ 0] = a[ 0];\n newDst[ 1] = a[ 1];\n newDst[ 2] = a[ 2];\n newDst[ 3] = a[ 3];\n newDst[ 4] = a[ 4];\n newDst[ 5] = a[ 5];\n newDst[ 6] = a[ 6];\n newDst[ 7] = a[ 7];\n newDst[ 8] = a[ 8];\n newDst[ 9] = a[ 9];\n newDst[10] = a[10];\n newDst[11] = a[11];\n }\n newDst[12] = v[0];\n newDst[13] = v[1];\n newDst[14] = v[2];\n newDst[15] = 1;\n return newDst;\n}\n\n///**\n// * Returns the translation component of a 4-by-4 matrix as a vector with 3\n// * entries.\n// * @param m - The matrix.\n// * @param dst - vector to hold result. If not passed a new one is created.\n// * @returns The translation component of m.\n// */\nfunction getTranslation(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? vec3.create()) as T;\n newDst[0] = m[12];\n newDst[1] = m[13];\n newDst[2] = m[14];\n return newDst;\n}\n\n/**\n * Returns an axis of a 4x4 matrix as a vector with 3 entries\n * @param m - The matrix.\n * @param axis - The axis 0 = x, 1 = y, 2 = z;\n * @returns The axis component of m.\n */\nfunction getAxis(m: Mat4Arg, axis: number, dst?: T) {\n const newDst = (dst ?? vec3.create());\n const off = axis * 4;\n newDst[0] = m[off + 0];\n newDst[1] = m[off + 1];\n newDst[2] = m[off + 2];\n return newDst;\n}\n\n/**\n * Sets an axis of a 4x4 matrix as a vector with 3 entries\n * @param m - The matrix.\n * @param v - the axis vector\n * @param axis - The axis 0 = x, 1 = y, 2 = z;\n * @param dst - The matrix to set. If not passed a new one is created.\n * @returns The matrix with axis set.\n */\nfunction setAxis(m: Mat4Arg, v: Vec3Arg, axis: number, dst: T) {\n const newDst = (dst === m) ? dst : copy(m, dst);\n\n const off = axis * 4;\n newDst[off + 0] = v[0];\n newDst[off + 1] = v[1];\n newDst[off + 2] = v[2];\n return newDst;\n}\n\n///**\n// * Returns the scaling component of the matrix\n// * @param m - The Matrix\n// * @param dst - The vector to set. If not passed a new one is created.\n// */\nfunction getScaling(m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? vec3.create()) as T;\n\n const xx = m[0];\n const xy = m[1];\n const xz = m[2];\n const yx = m[4];\n const yy = m[5];\n const yz = m[6];\n const zx = m[8];\n const zy = m[9];\n const zz = m[10];\n\n newDst[0] = Math.sqrt(xx * xx + xy * xy + xz * xz);\n newDst[1] = Math.sqrt(yx * yx + yy * yy + yz * yz);\n newDst[2] = Math.sqrt(zx * zx + zy * zy + zz * zz);\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 perspective transformation matrix given the angular height\n * of the frustum, the aspect ratio, and the near and far clipping planes. The\n * arguments define a frustum extending in the negative z direction. The given\n * angle is the vertical angle of the frustum, and the horizontal angle is\n * determined to produce the given aspect ratio. The arguments near and far are\n * the distances to the near and far clipping planes. Note that near and far\n * are not z coordinates, but rather they are distances along the negative\n * z-axis. The matrix generated sends the viewing frustum to the unit box.\n * We assume a unit box extending from -1 to 1 in the x and y dimensions and\n * from 0 to 1 in the z dimension.\n *\n * Note: If you pass `Infinity` for zFar then it will produce a projection matrix\n * returns -Infinity for Z when transforming coordinates with Z <= 0 and +Infinity for Z\n * otherwise.\n *\n * @param fieldOfViewYInRadians - The camera angle from top to bottom (in radians).\n * @param aspect - The aspect ratio width / height.\n * @param zNear - The depth (negative z coordinate)\n * of the near clipping plane.\n * @param zFar - The depth (negative z coordinate)\n * of the far clipping plane.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The perspective matrix.\n */\nfunction perspective(fieldOfViewYInRadians: number, aspect: number, zNear: number, zFar: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const f = Math.tan(Math.PI * 0.5 - 0.5 * fieldOfViewYInRadians);\n\n newDst[0] = f / aspect;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 0;\n\n newDst[4] = 0;\n newDst[5] = f;\n newDst[6] = 0;\n newDst[7] = 0;\n\n newDst[8] = 0;\n newDst[9] = 0;\n newDst[11] = -1;\n\n newDst[12] = 0;\n newDst[13] = 0;\n newDst[15] = 0;\n\n if (Number.isFinite(zFar)) {\n const rangeInv = 1 / (zNear - zFar);\n newDst[10] = zFar * rangeInv;\n newDst[14] = zFar * zNear * rangeInv;\n } else {\n newDst[10] = -1;\n newDst[14] = -zNear;\n }\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 reverse-z perspective transformation matrix given the angular height\n * of the frustum, the aspect ratio, and the near and far clipping planes. The\n * arguments define a frustum extending in the negative z direction. The given\n * angle is the vertical angle of the frustum, and the horizontal angle is\n * determined to produce the given aspect ratio. The arguments near and far are\n * the distances to the near and far clipping planes. Note that near and far\n * are not z coordinates, but rather they are distances along the negative\n * z-axis. The matrix generated sends the viewing frustum to the unit box.\n * We assume a unit box extending from -1 to 1 in the x and y dimensions and\n * from 1 (at -zNear) to 0 (at -zFar) in the z dimension.\n *\n * @param fieldOfViewYInRadians - The camera angle from top to bottom (in radians).\n * @param aspect - The aspect ratio width / height.\n * @param zNear - The depth (negative z coordinate)\n * of the near clipping plane.\n * @param zFar - The depth (negative z coordinate)\n * of the far clipping plane. (default = Infinity)\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The perspective matrix.\n */function perspectiveReverseZ(fieldOfViewYInRadians: number, aspect: number, zNear: number, zFar = Infinity, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const f = 1 / Math.tan(fieldOfViewYInRadians * 0.5);\n\n newDst[ 0] = f / aspect;\n newDst[ 1] = 0;\n newDst[ 2] = 0;\n newDst[ 3] = 0;\n\n newDst[ 4] = 0;\n newDst[ 5] = f;\n newDst[ 6] = 0;\n newDst[ 7] = 0;\n\n newDst[ 8] = 0;\n newDst[ 9] = 0;\n newDst[11] = -1;\n\n newDst[12] = 0;\n newDst[13] = 0;\n newDst[15] = 0;\n\n if (zFar === Infinity) {\n newDst[10] = 0;\n newDst[14] = zNear;\n } else {\n const rangeInv = 1 / (zFar - zNear);\n newDst[10] = zNear * rangeInv;\n newDst[14] = zFar * zNear * rangeInv;\n }\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 orthogonal transformation matrix that transforms from\n * the given the left, right, bottom, and top dimensions to -1 +1 in x, and y\n * and 0 to +1 in z.\n * @param left - Left side of the near clipping plane viewport.\n * @param right - Right side of the near clipping plane viewport.\n * @param bottom - Bottom of the near clipping plane viewport.\n * @param top - Top of the near clipping plane viewport.\n * @param near - The depth (negative z coordinate)\n * of the near clipping plane.\n * @param far - The depth (negative z coordinate)\n * of the far clipping plane.\n * @param dst - Output matrix. If not passed a new one is created.\n * @returns The orthographic projection matrix.\n */\nfunction ortho(left: number, right: number, bottom: number, top: number, near: number, far: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[0] = 2 / (right - left);\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 0;\n\n newDst[4] = 0;\n newDst[5] = 2 / (top - bottom);\n newDst[6] = 0;\n newDst[7] = 0;\n\n newDst[8] = 0;\n newDst[9] = 0;\n newDst[10] = 1 / (near - far);\n newDst[11] = 0;\n\n newDst[12] = (right + left) / (left - right);\n newDst[13] = (top + bottom) / (bottom - top);\n newDst[14] = near / (near - far);\n newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 perspective transformation matrix given the left, right,\n * top, bottom, near and far clipping planes. The arguments define a frustum\n * extending in the negative z direction. The arguments near and far are the\n * distances to the near and far clipping planes. Note that near and far are not\n * z coordinates, but rather they are distances along the negative z-axis. The\n * matrix generated sends the viewing frustum to the unit box. We assume a unit\n * box extending from -1 to 1 in the x and y dimensions and from 0 to 1 in the z\n * dimension.\n * @param left - The x coordinate of the left plane of the box.\n * @param right - The x coordinate of the right plane of the box.\n * @param bottom - The y coordinate of the bottom plane of the box.\n * @param top - The y coordinate of the right plane of the box.\n * @param near - The negative z coordinate of the near plane of the box.\n * @param far - The negative z coordinate of the far plane of the box.\n * @param dst - Output matrix. If not passed a new one is created.\n * @returns The perspective projection matrix.\n */\nfunction frustum(left: number, right: number, bottom: number, top: number, near: number, far: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const dx = (right - left);\n const dy = (top - bottom);\n const dz = (near - far);\n\n newDst[ 0] = 2 * near / dx;\n newDst[ 1] = 0;\n newDst[ 2] = 0;\n newDst[ 3] = 0;\n newDst[ 4] = 0;\n newDst[ 5] = 2 * near / dy;\n newDst[ 6] = 0;\n newDst[ 7] = 0;\n newDst[ 8] = (left + right) / dx;\n newDst[ 9] = (top + bottom) / dy;\n newDst[10] = far / dz;\n newDst[11] = -1;\n newDst[12] = 0;\n newDst[13] = 0;\n newDst[14] = near * far / dz;\n newDst[15] = 0;\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 reverse-z perspective transformation matrix given the left, right,\n * top, bottom, near and far clipping planes. The arguments define a frustum\n * extending in the negative z direction. The arguments near and far are the\n * distances to the near and far clipping planes. Note that near and far are not\n * z coordinates, but rather they are distances along the negative z-axis. The\n * matrix generated sends the viewing frustum to the unit box. We assume a unit\n * box extending from -1 to 1 in the x and y dimensions and from 1 (-near) to 0 (-far) in the z\n * dimension.\n * @param left - The x coordinate of the left plane of the box.\n * @param right - The x coordinate of the right plane of the box.\n * @param bottom - The y coordinate of the bottom plane of the box.\n * @param top - The y coordinate of the right plane of the box.\n * @param near - The negative z coordinate of the near plane of the box.\n * @param far - The negative z coordinate of the far plane of the box.\n * @param dst - Output matrix. If not passed a new one is created.\n * @returns The perspective projection matrix.\n */\nfunction frustumReverseZ(left: number, right: number, bottom: number, top: number, near: number, far = Infinity, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const dx = (right - left);\n const dy = (top - bottom);\n\n newDst[ 0] = 2 * near / dx;\n newDst[ 1] = 0;\n newDst[ 2] = 0;\n newDst[ 3] = 0;\n newDst[ 4] = 0;\n newDst[ 5] = 2 * near / dy;\n newDst[ 6] = 0;\n newDst[ 7] = 0;\n newDst[ 8] = (left + right) / dx;\n newDst[ 9] = (top + bottom) / dy;\n newDst[11] = -1;\n newDst[12] = 0;\n newDst[13] = 0;\n newDst[15] = 0;\n\n if (far === Infinity) {\n newDst[10] = 0;\n newDst[14] = near;\n } else {\n const rangeInv = 1 / (far - near);\n newDst[10] = near * rangeInv;\n newDst[14] = far * near * rangeInv;\n }\n\n return newDst;\n}\n\nconst xAxis = vec3.create();\nconst yAxis = vec3.create();\nconst zAxis = vec3.create();\n\n/**\n * Computes a 4-by-4 aim transformation.\n *\n * This is a matrix which positions an object aiming down positive Z.\n * toward the target.\n *\n * Note: this is **NOT** the inverse of lookAt as lookAt looks at negative Z.\n *\n * @param position - The position of the object.\n * @param target - The position meant to be aimed at.\n * @param up - A vector pointing up.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The aim matrix.\n */\nfunction aim(position: Vec3Arg, target: Vec3Arg, up: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n vec3.normalize(vec3.subtract(target, position, zAxis), zAxis);\n vec3.normalize(vec3.cross(up, zAxis, xAxis), xAxis);\n vec3.normalize(vec3.cross(zAxis, xAxis, yAxis), yAxis);\n\n newDst[ 0] = xAxis[0]; newDst[ 1] = xAxis[1]; newDst[ 2] = xAxis[2]; newDst[ 3] = 0;\n newDst[ 4] = yAxis[0]; newDst[ 5] = yAxis[1]; newDst[ 6] = yAxis[2]; newDst[ 7] = 0;\n newDst[ 8] = zAxis[0]; newDst[ 9] = zAxis[1]; newDst[10] = zAxis[2]; newDst[11] = 0;\n newDst[12] = position[0]; newDst[13] = position[1]; newDst[14] = position[2]; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 camera aim transformation.\n *\n * This is a matrix which positions an object aiming down negative Z.\n * toward the target.\n *\n * Note: this is the inverse of `lookAt`\n *\n * @param eye - The position of the object.\n * @param target - The position meant to be aimed at.\n * @param up - A vector pointing up.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The aim matrix.\n */\nfunction cameraAim(eye: Vec3Arg, target: Vec3Arg, up: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n vec3.normalize(vec3.subtract(eye, target, zAxis), zAxis);\n vec3.normalize(vec3.cross(up, zAxis, xAxis), xAxis);\n vec3.normalize(vec3.cross(zAxis, xAxis, yAxis), yAxis);\n\n newDst[ 0] = xAxis[0]; newDst[ 1] = xAxis[1]; newDst[ 2] = xAxis[2]; newDst[ 3] = 0;\n newDst[ 4] = yAxis[0]; newDst[ 5] = yAxis[1]; newDst[ 6] = yAxis[2]; newDst[ 7] = 0;\n newDst[ 8] = zAxis[0]; newDst[ 9] = zAxis[1]; newDst[10] = zAxis[2]; newDst[11] = 0;\n newDst[12] = eye[0]; newDst[13] = eye[1]; newDst[14] = eye[2]; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Computes a 4-by-4 view transformation.\n *\n * This is a view matrix which transforms all other objects\n * to be in the space of the view defined by the parameters.\n *\n * @param eye - The position of the object.\n * @param target - The position meant to be aimed at.\n * @param up - A vector pointing up.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The look-at matrix.\n */\nfunction lookAt(eye: Vec3Arg, target: Vec3Arg, up: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n vec3.normalize(vec3.subtract(eye, target, zAxis), zAxis);\n vec3.normalize(vec3.cross(up, zAxis, xAxis), xAxis);\n vec3.normalize(vec3.cross(zAxis, xAxis, yAxis), yAxis);\n\n newDst[ 0] = xAxis[0]; newDst[ 1] = yAxis[0]; newDst[ 2] = zAxis[0]; newDst[ 3] = 0;\n newDst[ 4] = xAxis[1]; newDst[ 5] = yAxis[1]; newDst[ 6] = zAxis[1]; newDst[ 7] = 0;\n newDst[ 8] = xAxis[2]; newDst[ 9] = yAxis[2]; newDst[10] = zAxis[2]; newDst[11] = 0;\n\n newDst[12] = -(xAxis[0] * eye[0] + xAxis[1] * eye[1] + xAxis[2] * eye[2]);\n newDst[13] = -(yAxis[0] * eye[0] + yAxis[1] * eye[1] + yAxis[2] * eye[2]);\n newDst[14] = -(zAxis[0] * eye[0] + zAxis[1] * eye[1] + zAxis[2] * eye[2]);\n newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which translates by the given vector v.\n * @param v - The vector by\n * which to translate.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The translation matrix.\n */\nfunction translation(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = 1; newDst[ 1] = 0; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = 1; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1; newDst[11] = 0;\n newDst[12] = v[0]; newDst[13] = v[1]; newDst[14] = v[2]; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Translates the given 4-by-4 matrix by the given vector v.\n * @param m - The matrix.\n * @param v - The vector by\n * which to translate.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The translated matrix.\n */\nfunction translate(m: Mat4Arg, v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const m00 = m[0];\n const m01 = m[1];\n const m02 = m[2];\n const m03 = m[3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const m30 = m[3 * 4 + 0];\n const m31 = m[3 * 4 + 1];\n const m32 = m[3 * 4 + 2];\n const m33 = m[3 * 4 + 3];\n\n if (m !== newDst) {\n newDst[ 0] = m00;\n newDst[ 1] = m01;\n newDst[ 2] = m02;\n newDst[ 3] = m03;\n newDst[ 4] = m10;\n newDst[ 5] = m11;\n newDst[ 6] = m12;\n newDst[ 7] = m13;\n newDst[ 8] = m20;\n newDst[ 9] = m21;\n newDst[10] = m22;\n newDst[11] = m23;\n }\n\n newDst[12] = m00 * v0 + m10 * v1 + m20 * v2 + m30;\n newDst[13] = m01 * v0 + m11 * v1 + m21 * v2 + m31;\n newDst[14] = m02 * v0 + m12 * v1 + m22 * v2 + m32;\n newDst[15] = m03 * v0 + m13 * v1 + m23 * v2 + m33;\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the x-axis by the given angle.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotation matrix.\n */\nfunction rotationX(angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = 1; newDst[ 1] = 0; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = c; newDst[ 6] = s; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = -s; newDst[10] = c; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Rotates the given 4-by-4 matrix around the x-axis by the given\n * angle.\n * @param m - The matrix.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nfunction rotateX(m: Mat4Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const m10 = m[4];\n const m11 = m[5];\n const m12 = m[6];\n const m13 = m[7];\n const m20 = m[8];\n const m21 = m[9];\n const m22 = m[10];\n const m23 = m[11];\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[4] = c * m10 + s * m20;\n newDst[5] = c * m11 + s * m21;\n newDst[6] = c * m12 + s * m22;\n newDst[7] = c * m13 + s * m23;\n newDst[8] = c * m20 - s * m10;\n newDst[9] = c * m21 - s * m11;\n newDst[10] = c * m22 - s * m12;\n newDst[11] = c * m23 - s * m13;\n\n if (m !== newDst) {\n newDst[ 0] = m[ 0];\n newDst[ 1] = m[ 1];\n newDst[ 2] = m[ 2];\n newDst[ 3] = m[ 3];\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the y-axis by the given angle.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotation matrix.\n */\nfunction rotationY(angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c; newDst[ 1] = 0; newDst[ 2] = -s; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = 1; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = s; newDst[ 9] = 0; newDst[10] = c; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Rotates the given 4-by-4 matrix around the y-axis by the given\n * angle.\n * @param m - The matrix.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nfunction rotateY(m: Mat4Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m20 = m[2 * 4 + 0];\n const m21 = m[2 * 4 + 1];\n const m22 = m[2 * 4 + 2];\n const m23 = m[2 * 4 + 3];\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c * m00 - s * m20;\n newDst[ 1] = c * m01 - s * m21;\n newDst[ 2] = c * m02 - s * m22;\n newDst[ 3] = c * m03 - s * m23;\n newDst[ 8] = c * m20 + s * m00;\n newDst[ 9] = c * m21 + s * m01;\n newDst[10] = c * m22 + s * m02;\n newDst[11] = c * m23 + s * m03;\n\n if (m !== newDst) {\n newDst[ 4] = m[ 4];\n newDst[ 5] = m[ 5];\n newDst[ 6] = m[ 6];\n newDst[ 7] = m[ 7];\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the z-axis by the given angle.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotation matrix.\n */\nfunction rotationZ(angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c; newDst[ 1] = s; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = -s; newDst[ 5] = c; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Rotates the given 4-by-4 matrix around the z-axis by the given\n * angle.\n * @param m - The matrix.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nfunction rotateZ(m: Mat4Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const m00 = m[0 * 4 + 0];\n const m01 = m[0 * 4 + 1];\n const m02 = m[0 * 4 + 2];\n const m03 = m[0 * 4 + 3];\n const m10 = m[1 * 4 + 0];\n const m11 = m[1 * 4 + 1];\n const m12 = m[1 * 4 + 2];\n const m13 = m[1 * 4 + 3];\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n\n newDst[ 0] = c * m00 + s * m10;\n newDst[ 1] = c * m01 + s * m11;\n newDst[ 2] = c * m02 + s * m12;\n newDst[ 3] = c * m03 + s * m13;\n newDst[ 4] = c * m10 - s * m00;\n newDst[ 5] = c * m11 - s * m01;\n newDst[ 6] = c * m12 - s * m02;\n newDst[ 7] = c * m13 - s * m03;\n\n if (m !== newDst) {\n newDst[ 8] = m[ 8];\n newDst[ 9] = m[ 9];\n newDst[10] = m[10];\n newDst[11] = m[11];\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the given axis by the given\n * angle.\n * @param axis - The axis\n * about which to rotate.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns A matrix which rotates angle radians\n * around the axis.\n */\nfunction axisRotation(axis: Vec3Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n let x = axis[0];\n let y = axis[1];\n let z = axis[2];\n const n = Math.sqrt(x * x + y * y + z * z);\n x /= n;\n y /= n;\n z /= n;\n const xx = x * x;\n const yy = y * y;\n const zz = z * z;\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n const oneMinusCosine = 1 - c;\n\n newDst[ 0] = xx + (1 - xx) * c;\n newDst[ 1] = x * y * oneMinusCosine + z * s;\n newDst[ 2] = x * z * oneMinusCosine - y * s;\n newDst[ 3] = 0;\n newDst[ 4] = x * y * oneMinusCosine - z * s;\n newDst[ 5] = yy + (1 - yy) * c;\n newDst[ 6] = y * z * oneMinusCosine + x * s;\n newDst[ 7] = 0;\n newDst[ 8] = x * z * oneMinusCosine + y * s;\n newDst[ 9] = y * z * oneMinusCosine - x * s;\n newDst[10] = zz + (1 - zz) * c;\n newDst[11] = 0;\n newDst[12] = 0;\n newDst[13] = 0;\n newDst[14] = 0;\n newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which rotates around the given axis by the given\n * angle. (same as axisRotation)\n * @param axis - The axis\n * about which to rotate.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns A matrix which rotates angle radians\n * around the axis.\n */\nconst rotation = axisRotation;\n\n/**\n * Rotates the given 4-by-4 matrix around the given axis by the\n * given angle.\n * @param m - The matrix.\n * @param axis - The axis\n * about which to rotate.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nfunction axisRotate(m: Mat4Arg, axis: Vec3Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n let x = axis[0];\n let y = axis[1];\n let z = axis[2];\n const n = Math.sqrt(x * x + y * y + z * z);\n x /= n;\n y /= n;\n z /= n;\n const xx = x * x;\n const yy = y * y;\n const zz = z * z;\n const c = Math.cos(angleInRadians);\n const s = Math.sin(angleInRadians);\n const oneMinusCosine = 1 - c;\n\n const r00 = xx + (1 - xx) * c;\n const r01 = x * y * oneMinusCosine + z * s;\n const r02 = x * z * oneMinusCosine - y * s;\n const r10 = x * y * oneMinusCosine - z * s;\n const r11 = yy + (1 - yy) * c;\n const r12 = y * z * oneMinusCosine + x * s;\n const r20 = x * z * oneMinusCosine + y * s;\n const r21 = y * z * oneMinusCosine - x * s;\n const r22 = zz + (1 - zz) * c;\n\n const m00 = m[0];\n const m01 = m[1];\n const m02 = m[2];\n const m03 = m[3];\n const m10 = m[4];\n const m11 = m[5];\n const m12 = m[6];\n const m13 = m[7];\n const m20 = m[8];\n const m21 = m[9];\n const m22 = m[10];\n const m23 = m[11];\n\n newDst[ 0] = r00 * m00 + r01 * m10 + r02 * m20;\n newDst[ 1] = r00 * m01 + r01 * m11 + r02 * m21;\n newDst[ 2] = r00 * m02 + r01 * m12 + r02 * m22;\n newDst[ 3] = r00 * m03 + r01 * m13 + r02 * m23;\n newDst[ 4] = r10 * m00 + r11 * m10 + r12 * m20;\n newDst[ 5] = r10 * m01 + r11 * m11 + r12 * m21;\n newDst[ 6] = r10 * m02 + r11 * m12 + r12 * m22;\n newDst[ 7] = r10 * m03 + r11 * m13 + r12 * m23;\n newDst[ 8] = r20 * m00 + r21 * m10 + r22 * m20;\n newDst[ 9] = r20 * m01 + r21 * m11 + r22 * m21;\n newDst[10] = r20 * m02 + r21 * m12 + r22 * m22;\n newDst[11] = r20 * m03 + r21 * m13 + r22 * m23;\n\n if (m !== newDst) {\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\n/**\n * Rotates the given 4-by-4 matrix around the given axis by the\n * given angle. (same as rotate)\n * @param m - The matrix.\n * @param axis - The axis\n * about which to rotate.\n * @param angleInRadians - The angle by which to rotate (in radians).\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The rotated matrix.\n */\nconst rotate = axisRotate;\n\n/**\n * Creates a 4-by-4 matrix which scales in each dimension by an amount given by\n * the corresponding entry in the given vector; assumes the vector has three\n * entries.\n * @param v - A vector of\n * three entries specifying the factor by which to scale in each dimension.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaling matrix.\n */\nfunction scaling(v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = v[0]; newDst[ 1] = 0; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = v[1]; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = v[2]; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Scales the given 4-by-4 matrix in each dimension by an amount\n * given by the corresponding entry in the given vector; assumes the vector has\n * three entries.\n * @param m - The matrix to be modified.\n * @param v - A vector of three entries specifying the\n * factor by which to scale in each dimension.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaled matrix.\n */\nfunction scale(m: Mat4Arg, v: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n\n newDst[ 0] = v0 * m[0 * 4 + 0];\n newDst[ 1] = v0 * m[0 * 4 + 1];\n newDst[ 2] = v0 * m[0 * 4 + 2];\n newDst[ 3] = v0 * m[0 * 4 + 3];\n newDst[ 4] = v1 * m[1 * 4 + 0];\n newDst[ 5] = v1 * m[1 * 4 + 1];\n newDst[ 6] = v1 * m[1 * 4 + 2];\n newDst[ 7] = v1 * m[1 * 4 + 3];\n newDst[ 8] = v2 * m[2 * 4 + 0];\n newDst[ 9] = v2 * m[2 * 4 + 1];\n newDst[10] = v2 * m[2 * 4 + 2];\n newDst[11] = v2 * m[2 * 4 + 3];\n\n if (m !== newDst) {\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\n/**\n * Creates a 4-by-4 matrix which scales a uniform amount in each dimension.\n * @param s - the amount to scale\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaling matrix.\n */\nfunction uniformScaling(s: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = s; newDst[ 1] = 0; newDst[ 2] = 0; newDst[ 3] = 0;\n newDst[ 4] = 0; newDst[ 5] = s; newDst[ 6] = 0; newDst[ 7] = 0;\n newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = s; newDst[11] = 0;\n newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1;\n\n return newDst;\n}\n\n/**\n * Scales the given 4-by-4 matrix in each dimension by a uniform scale.\n * @param m - The matrix to be modified.\n * @param s - The amount to scale.\n * @param dst - matrix to hold result. If not passed a new one is created.\n * @returns The scaled matrix.\n */\nfunction uniformScale(m: Mat4Arg, s: number, dst?: T) {\n const newDst = (dst ?? new Ctor(16)) as T;\n\n newDst[ 0] = s * m[0 * 4 + 0];\n newDst[ 1] = s * m[0 * 4 + 1];\n newDst[ 2] = s * m[0 * 4 + 2];\n newDst[ 3] = s * m[0 * 4 + 3];\n newDst[ 4] = s * m[1 * 4 + 0];\n newDst[ 5] = s * m[1 * 4 + 1];\n newDst[ 6] = s * m[1 * 4 + 2];\n newDst[ 7] = s * m[1 * 4 + 3];\n newDst[ 8] = s * m[2 * 4 + 0];\n newDst[ 9] = s * m[2 * 4 + 1];\n newDst[10] = s * m[2 * 4 + 2];\n newDst[11] = s * m[2 * 4 + 3];\n\n if (m !== newDst) {\n newDst[12] = m[12];\n newDst[13] = m[13];\n newDst[14] = m[14];\n newDst[15] = m[15];\n }\n\n return newDst;\n}\n\nreturn {\n create,\n set,\n fromMat3,\n fromQuat,\n negate,\n copy,\n clone,\n equalsApproximately,\n equals,\n identity,\n transpose,\n inverse,\n determinant,\n invert,\n multiply,\n mul,\n setTranslation,\n getTranslation,\n getAxis,\n setAxis,\n getScaling,\n perspective,\n perspectiveReverseZ,\n ortho,\n frustum,\n frustumReverseZ,\n aim,\n cameraAim,\n lookAt,\n translation,\n translate,\n rotationX,\n rotateX,\n rotationY,\n rotateY,\n rotationZ,\n rotateZ,\n axisRotation,\n rotation,\n axisRotate,\n rotate,\n scaling,\n scale,\n uniformScaling,\n uniformScale,\n};\n\n}\n\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\nexport function getAPI(Ctor: Mat4Ctor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport * as utils from './utils.js';\nimport { QuatArg, QuatType } from './quat';\nimport { Mat3Arg } from './mat3.js';\nimport { Mat4Arg } from './mat4.js';\nimport { Vec3Arg } from './vec3.js';\nimport { getAPI as getVec3API } from './vec3-impl';\nimport { BaseArgType } from './types';\n\nexport { QuatArg, QuatType };\n\ntype QuatCtor = new (n: number) => T;\n\nexport type RotationOrder = 'xyz' | 'xzy' | 'yxz' | 'yzx' | 'zxy' | 'zyx';\n\n/**\n * Generates am typed API for Qud\n * */\nfunction getAPIImpl(Ctor: QuatCtor) {\n const vec3 = getVec3API(Ctor);\n\n/**\n * Creates a quat4; may be called with x, y, z to set initial values.\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @param w - Initial w value.\n * @returns the created vector\n */\nfunction create(x?: number, y?: number, z?: number, w?: number) {\n const newDst = new Ctor(4);\n if (x !== undefined) {\n newDst[0] = x;\n if (y !== undefined) {\n newDst[1] = y;\n if (z !== undefined) {\n newDst[2] = z;\n if (w !== undefined) {\n newDst[3] = w;\n }\n }\n }\n }\n return newDst;\n}\n\n/**\n * Creates a Quat; may be called with x, y, z to set initial values. (same as create)\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @param z - Initial w value.\n * @returns the created vector\n */\nconst fromValues = create;\n\n/**\n * Sets the values of a Quat\n * Also see {@link quat.create} and {@link quat.copy}\n *\n * @param x first value\n * @param y second value\n * @param z third value\n * @param w fourth value\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector with its elements set.\n */\nfunction set(x: number, y: number, z: number, w: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = x;\n newDst[1] = y;\n newDst[2] = z;\n newDst[3] = w;\n\n return newDst;\n}\n\n/**\n * Sets a quaternion from the given angle and axis,\n * then returns it.\n *\n * @param axis - the axis to rotate around\n * @param angleInRadians - the angle\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The quaternion that represents the given axis and angle\n **/\nfunction fromAxisAngle(axis: Vec3Arg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const halfAngle = angleInRadians * 0.5;\n const s = Math.sin(halfAngle);\n\n newDst[0] = s * axis[0];\n newDst[1] = s * axis[1];\n newDst[2] = s * axis[2];\n newDst[3] = Math.cos(halfAngle);\n\n return newDst;\n}\n\n/**\n * Gets the rotation axis and angle\n * @param q - quaternion to compute from\n * @param dst - Vec3 to hold result. If not passed in a new one is created.\n * @return angle and axis\n */\nfunction toAxisAngle(q: QuatArg, dst?: T): { angle: number, axis: T } {\n const newDst = (dst ?? vec3.create(3)) as T;\n\n const angle = Math.acos(q[3]) * 2;\n const s = Math.sin(angle * 0.5);\n if (s > utils.EPSILON) {\n newDst[0] = q[0] / s;\n newDst[1] = q[1] / s;\n newDst[2] = q[2] / s;\n } else {\n newDst[0] = 1;\n newDst[1] = 0;\n newDst[2] = 0;\n }\n\n return { angle, axis: newDst };\n}\n\n/**\n * Returns the angle in degrees between two rotations a and b.\n * @param a - quaternion a\n * @param b - quaternion b\n * @return angle in radians between the two quaternions\n */\nfunction angle(a: QuatArg, b: QuatArg) {\n const d = dot(a, b);\n return Math.acos(2 * d * d - 1);\n}\n\n/**\n * Multiplies two quaternions\n *\n * @param a - the first quaternion\n * @param b - the second quaternion\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nfunction multiply(a: QuatArg, b: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const aw = a[3];\n\n const bx = b[0];\n const by = b[1];\n const bz = b[2];\n const bw = b[3];\n\n newDst[0] = ax * bw + aw * bx + ay * bz - az * by;\n newDst[1] = ay * bw + aw * by + az * bx - ax * bz;\n newDst[2] = az * bw + aw * bz + ax * by - ay * bx;\n newDst[3] = aw * bw - ax * bx - ay * by - az * bz;\n\n return newDst;\n}\n\n/**\n * Multiplies two quaternions\n *\n * @param a - the first quaternion\n * @param b - the second quaternion\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nconst mul = multiply;\n\n/**\n * Rotates the given quaternion around the X axis by the given angle.\n * @param q - quaternion to rotate\n * @param angleInRadians - The angle by which to rotate\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nfunction rotateX(q: QuatArg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const halfAngle = angleInRadians * 0.5;\n\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const qw = q[3];\n\n const bx = Math.sin(halfAngle);\n const bw = Math.cos(halfAngle);\n\n newDst[0] = qx * bw + qw * bx;\n newDst[1] = qy * bw + qz * bx;\n newDst[2] = qz * bw - qy * bx;\n newDst[3] = qw * bw - qx * bx;\n\n return newDst;\n}\n\n/**\n * Rotates the given quaternion around the Y axis by the given angle.\n * @param q - quaternion to rotate\n * @param angleInRadians - The angle by which to rotate\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nfunction rotateY(q: QuatArg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const halfAngle = angleInRadians * 0.5;\n\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const qw = q[3];\n\n const by = Math.sin(halfAngle);\n const bw = Math.cos(halfAngle);\n\n newDst[0] = qx * bw - qz * by;\n newDst[1] = qy * bw + qw * by;\n newDst[2] = qz * bw + qx * by;\n newDst[3] = qw * bw - qy * by;\n\n return newDst;\n}\n\n/**\n * Rotates the given quaternion around the Z axis by the given angle.\n * @param q - quaternion to rotate\n * @param angleInRadians - The angle by which to rotate\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nfunction rotateZ(q: QuatArg, angleInRadians: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const halfAngle = angleInRadians * 0.5;\n\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const qw = q[3];\n\n const bz = Math.sin(halfAngle);\n const bw = Math.cos(halfAngle);\n\n newDst[0] = qx * bw + qy * bz;\n newDst[1] = qy * bw - qx * bz;\n newDst[2] = qz * bw + qw * bz;\n newDst[3] = qw * bw - qz * bz;\n\n return newDst;\n}\n\n/**\n * Spherically linear interpolate between two quaternions\n *\n * @param a - starting value\n * @param b - ending value\n * @param t - value where 0 = a and 1 = b\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the result of a * b\n */\nfunction slerp(a: QuatArg, b: QuatArg, t: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n const aw = a[3];\n\n let bx = b[0];\n let by = b[1];\n let bz = b[2];\n let bw = b[3];\n\n let cosOmega = ax * bx + ay * by + az * bz + aw * bw;\n\n if (cosOmega < 0) {\n cosOmega = -cosOmega;\n bx = -bx;\n by = -by;\n bz = -bz;\n bw = -bw;\n }\n\n let scale0;\n let scale1;\n\n if (1.0 - cosOmega > utils.EPSILON) {\n const omega = Math.acos(cosOmega);\n const sinOmega = Math.sin(omega);\n scale0 = Math.sin((1 - t) * omega) / sinOmega;\n scale1 = Math.sin(t * omega) / sinOmega;\n } else {\n scale0 = 1.0 - t;\n scale1 = t;\n }\n\n newDst[0] = scale0 * ax + scale1 * bx;\n newDst[1] = scale0 * ay + scale1 * by;\n newDst[2] = scale0 * az + scale1 * bz;\n newDst[3] = scale0 * aw + scale1 * bw;\n\n return newDst;\n}\n\n/**\n * Compute the inverse of a quaternion\n *\n * @param q - quaternion to compute the inverse of\n * @returns A quaternion that is the result of a * b\n */\nfunction inverse(q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const a0 = q[0];\n const a1 = q[1];\n const a2 = q[2];\n const a3 = q[3];\n\n const dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3;\n const invDot = dot ? 1 / dot : 0;\n\n newDst[0] = -a0 * invDot;\n newDst[1] = -a1 * invDot;\n newDst[2] = -a2 * invDot;\n newDst[3] = a3 * invDot;\n\n return newDst;\n}\n\n/**\n * Compute the conjugate of a quaternion\n * For quaternions with a magnitude of 1 (a unit quaternion)\n * this returns the same as the inverse but is faster to calculate.\n *\n * @param q - quaternion to compute the conjugate of.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The conjugate of q\n */\nfunction conjugate(q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = -q[0];\n newDst[1] = -q[1];\n newDst[2] = -q[2];\n newDst[3] = q[3];\n\n return newDst;\n}\n\n/**\n * Creates a quaternion from the given rotation matrix.\n *\n * The created quaternion is not normalized.\n *\n * @param m - rotation matrix\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns the result\n */\nfunction fromMat(m: Mat3Arg | Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n /*\n 0 1 2\n 3 4 5\n 6 7 8\n\n 0 1 2\n 4 5 6\n 8 9 10\n */\n\n // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes\n // article \"Quaternion Calculus and Fast Animation\".\n const trace = m[0] + m[5] + m[10];\n\n if (trace > 0.0) {\n // |w| > 1/2, may as well choose w > 1/2\n const root = Math.sqrt(trace + 1); // 2w\n newDst[3] = 0.5 * root;\n const invRoot = 0.5 / root; // 1/(4w)\n\n newDst[0] = (m[6] - m[9]) * invRoot;\n newDst[1] = (m[8] - m[2]) * invRoot;\n newDst[2] = (m[1] - m[4]) * invRoot;\n } else {\n // |w| <= 1/2\n let i = 0;\n\n if (m[5] > m[0]) {\n i = 1;\n }\n if (m[10] > m[i * 4 + i]) {\n i = 2;\n }\n\n const j = (i + 1) % 3;\n const k = (i + 2) % 3;\n\n const root = Math.sqrt(m[i * 4 + i] - m[j * 4 + j] - m[k * 4 + k] + 1.0);\n newDst[i] = 0.5 * root;\n\n const invRoot = 0.5 / root;\n\n newDst[3] = (m[j * 4 + k] - m[k * 4 + j]) * invRoot;\n newDst[j] = (m[j * 4 + i] + m[i * 4 + j]) * invRoot;\n newDst[k] = (m[k * 4 + i] + m[i * 4 + k]) * invRoot;\n }\n\n return newDst;\n}\n\n/**\n * Creates a quaternion from the given euler angle x, y, z using the provided intrinsic order for the conversion.\n *\n * @param xAngleInRadians - angle to rotate around X axis in radians.\n * @param yAngleInRadians - angle to rotate around Y axis in radians.\n * @param zAngleInRadians - angle to rotate around Z axis in radians.\n * @param order - order to apply euler angles\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion representing the same rotation as the euler angles applied in the given order\n */\nfunction fromEuler(\n xAngleInRadians: number,\n yAngleInRadians: number,\n zAngleInRadians: number,\n order: RotationOrder,\n dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const xHalfAngle = xAngleInRadians * 0.5;\n const yHalfAngle = yAngleInRadians * 0.5;\n const zHalfAngle = zAngleInRadians * 0.5;\n\n const sx = Math.sin(xHalfAngle);\n const cx = Math.cos(xHalfAngle);\n const sy = Math.sin(yHalfAngle);\n const cy = Math.cos(yHalfAngle);\n const sz = Math.sin(zHalfAngle);\n const cz = Math.cos(zHalfAngle);\n\n switch (order) {\n case 'xyz':\n newDst[0] = sx * cy * cz + cx * sy * sz;\n newDst[1] = cx * sy * cz - sx * cy * sz;\n newDst[2] = cx * cy * sz + sx * sy * cz;\n newDst[3] = cx * cy * cz - sx * sy * sz;\n break;\n\n case 'xzy':\n newDst[0] = sx * cy * cz - cx * sy * sz;\n newDst[1] = cx * sy * cz - sx * cy * sz;\n newDst[2] = cx * cy * sz + sx * sy * cz;\n newDst[3] = cx * cy * cz + sx * sy * sz;\n break;\n\n case 'yxz':\n newDst[0] = sx * cy * cz + cx * sy * sz;\n newDst[1] = cx * sy * cz - sx * cy * sz;\n newDst[2] = cx * cy * sz - sx * sy * cz;\n newDst[3] = cx * cy * cz + sx * sy * sz;\n break;\n\n case 'yzx':\n newDst[0] = sx * cy * cz + cx * sy * sz;\n newDst[1] = cx * sy * cz + sx * cy * sz;\n newDst[2] = cx * cy * sz - sx * sy * cz;\n newDst[3] = cx * cy * cz - sx * sy * sz;\n break;\n\n case 'zxy':\n newDst[0] = sx * cy * cz - cx * sy * sz;\n newDst[1] = cx * sy * cz + sx * cy * sz;\n newDst[2] = cx * cy * sz + sx * sy * cz;\n newDst[3] = cx * cy * cz - sx * sy * sz;\n break;\n\n case 'zyx':\n newDst[0] = sx * cy * cz - cx * sy * sz;\n newDst[1] = cx * sy * cz + sx * cy * sz;\n newDst[2] = cx * cy * sz - sx * sy * cz;\n newDst[3] = cx * cy * cz + sx * sy * sz;\n break;\n\n default:\n throw new Error(`Unknown rotation order: ${order}`);\n }\n\n return newDst;\n}\n\n/**\n * Copies a quaternion. (same as {@link quat.clone})\n * Also see {@link quat.create} and {@link quat.set}\n * @param q - The quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is a copy of q\n */\nfunction copy(q: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = q[0];\n newDst[1] = q[1];\n newDst[2] = q[2];\n newDst[3] = q[3];\n\n return newDst;\n}\n\n/**\n * Clones a quaternion. (same as {@link quat.copy})\n * Also see {@link quat.create} and {@link quat.set}\n * @param q - The quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A copy of q.\n */\nconst clone = copy;\n\n/**\n * Adds two quaternions; assumes a and b have the same dimension.\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the sum of a and b.\n */\nfunction add(a: QuatArg, b: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + b[0];\n newDst[1] = a[1] + b[1];\n newDst[2] = a[2] + b[2];\n newDst[3] = a[3] + b[3];\n\n return newDst;\n}\n\n/**\n * Subtracts two quaternions.\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the difference of a and b.\n */\nfunction subtract(a: QuatArg, b: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] - b[0];\n newDst[1] = a[1] - b[1];\n newDst[2] = a[2] - b[2];\n newDst[3] = a[3] - b[3];\n\n return newDst;\n}\n\n/**\n * Subtracts two quaternions.\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns A quaternion that is the difference of a and b.\n */\nconst sub = subtract;\n\n/**\n * Multiplies a quaternion by a scalar.\n * @param v - The quaternion.\n * @param k - The scalar.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The scaled quaternion.\n */\nfunction mulScalar(v: QuatArg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = v[0] * k;\n newDst[1] = v[1] * k;\n newDst[2] = v[2] * k;\n newDst[3] = v[3] * k;\n\n return newDst;\n}\n\n/**\n * Multiplies a quaternion by a scalar. (same as mulScalar)\n * @param v - The quaternion.\n * @param k - The scalar.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The scaled quaternion.\n */\nconst scale = mulScalar;\n\n/**\n * Divides a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The scaled quaternion.\n */\nfunction divScalar(v: QuatArg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = v[0] / k;\n newDst[1] = v[1] / k;\n newDst[2] = v[2] / k;\n newDst[3] = v[3] / k;\n\n return newDst;\n}\n\n/**\n * Computes the dot product of two quaternions\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @returns dot product\n */\nfunction dot(a: QuatArg, b: QuatArg): number {\n return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]) + (a[3] * b[3]);\n}\n\n/**\n * Performs linear interpolation on two quaternions.\n * Given quaternions a and b and interpolation coefficient t, returns\n * a + t * (b - a).\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @param t - Interpolation coefficient.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The linear interpolated result.\n */\nfunction lerp(a: QuatArg, b: QuatArg, t: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + t * (b[0] - a[0]);\n newDst[1] = a[1] + t * (b[1] - a[1]);\n newDst[2] = a[2] + t * (b[2] - a[2]);\n newDst[3] = a[3] + t * (b[3] - a[3]);\n\n return newDst;\n}\n\n/**\n * Computes the length of quaternion\n * @param v - quaternion.\n * @returns length of quaternion.\n */\nfunction length(v: QuatArg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n return Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3);\n}\n\n/**\n * Computes the length of quaternion (same as length)\n * @param v - quaternion.\n * @returns length of quaternion.\n */\nconst len = length;\n\n/**\n * Computes the square of the length of quaternion\n * @param v - quaternion.\n * @returns square of the length of quaternion.\n */\nfunction lengthSq(v: QuatArg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n return v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3;\n}\n\n/**\n * Computes the square of the length of quaternion (same as lengthSq)\n * @param v - quaternion.\n * @returns square of the length of quaternion.\n */\nconst lenSq = lengthSq;\n\n/**\n * Divides a quaternion by its Euclidean length and returns the quotient.\n * @param v - The quaternion.\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns The normalized quaternion.\n */\nfunction normalize(v: QuatArg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n const len = Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3);\n\n if (len > 0.00001) {\n newDst[0] = v0 / len;\n newDst[1] = v1 / len;\n newDst[2] = v2 / len;\n newDst[3] = v3 / len;\n } else {\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 0;\n }\n\n return newDst;\n}\n\n/**\n * Check if 2 quaternions are approximately equal\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @returns true if quaternions are approximately equal\n */\nfunction equalsApproximately(a: QuatArg, b: QuatArg): boolean {\n return Math.abs(a[0] - b[0]) < utils.EPSILON &&\n Math.abs(a[1] - b[1]) < utils.EPSILON &&\n Math.abs(a[2] - b[2]) < utils.EPSILON &&\n Math.abs(a[3] - b[3]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 quaternions are exactly equal\n * @param a - Operand quaternion.\n * @param b - Operand quaternion.\n * @returns true if quaternions are exactly equal\n */\nfunction equals(a: QuatArg, b: QuatArg): boolean {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];\n}\n\n/**\n * Creates an identity quaternion\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns an identity quaternion\n */\nfunction identity(dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 1;\n\n return newDst;\n}\n\nconst tempVec3 = vec3.create();\nconst xUnitVec3 = vec3.create();\nconst yUnitVec3 = vec3.create();\n\n/**\n * Computes a quaternion to represent the shortest rotation from one vector to another.\n *\n * @param aUnit - the start vector\n * @param bUnit - the end vector\n * @param dst - quaternion to hold result. If not passed in a new one is created.\n * @returns the result\n */\nfunction rotationTo(aUnit: Vec3Arg, bUnit: Vec3Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const dot = vec3.dot(aUnit, bUnit);\n if (dot < -0.999999) {\n vec3.cross(xUnitVec3, aUnit, tempVec3);\n if (vec3.len(tempVec3) < 0.000001) {\n vec3.cross(yUnitVec3, aUnit, tempVec3);\n }\n\n vec3.normalize(tempVec3, tempVec3);\n fromAxisAngle(tempVec3, Math.PI, newDst);\n\n return newDst;\n } else if (dot > 0.999999) {\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 1;\n\n return newDst;\n } else {\n vec3.cross(aUnit, bUnit, tempVec3);\n\n newDst[0] = tempVec3[0];\n newDst[1] = tempVec3[1];\n newDst[2] = tempVec3[2];\n newDst[3] = 1 + dot;\n\n return normalize(newDst, newDst);\n }\n}\n\nconst tempQuat1 = new Ctor(4);\nconst tempQuat2 = new Ctor(4);\n\n/**\n * Performs a spherical linear interpolation with two control points\n *\n * @param a - the first quaternion\n * @param b - the second quaternion\n * @param c - the third quaternion\n * @param d - the fourth quaternion\n * @param t - Interpolation coefficient 0 to 1\n * @returns result\n */\nfunction sqlerp(\n a: QuatArg,\n b: QuatArg,\n c: QuatArg,\n d: QuatArg,\n t: number,\n dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n slerp(a, d, t, tempQuat1);\n slerp(b, c, t, tempQuat2);\n slerp(tempQuat1, tempQuat2, 2 * t * (1 - t), newDst);\n\n return newDst;\n}\n\nreturn {\n create,\n fromValues,\n set,\n fromAxisAngle,\n toAxisAngle,\n angle,\n multiply,\n mul,\n rotateX,\n rotateY,\n rotateZ,\n slerp,\n inverse,\n conjugate,\n fromMat,\n fromEuler,\n copy,\n clone,\n add,\n subtract,\n sub,\n mulScalar,\n scale,\n divScalar,\n dot,\n lerp,\n length,\n len,\n lengthSq,\n lenSq,\n normalize,\n equalsApproximately,\n equals,\n identity,\n rotationTo,\n sqlerp,\n};\n\n}\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\n/**\n *\n * Quat4 math functions.\n *\n * Almost all functions take an optional `newDst` argument. If it is not passed in the\n * functions will create a new `Quat4`. In other words you can do this\n *\n * const v = quat4.cross(v1, v2); // Creates a new Quat4 with the cross product of v1 x v2.\n *\n * or\n *\n * const v = quat4.create();\n * quat4.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v\n *\n * The first style is often easier but depending on where it's used it generates garbage where\n * as there is almost never allocation with the second style.\n *\n * It is always safe to pass any vector as the destination. So for example\n *\n * quat4.cross(v1, v2, v1); // Puts the cross product of v1 x v2 in v1\n *\n */\nexport function getAPI(Ctor: QuatCtor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n","/*\n * Copyright 2022 Gregg Tavares\n *\n * Permission is hereby granted, free of charge, to any person obtaining a\n * copy of this software and associated documentation files (the \"Software\"),\n * to deal in the Software without restriction, including without limitation\n * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n * and/or sell copies of the Software, and to permit persons to whom the\n * Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n * DEALINGS IN THE SOFTWARE.\n */\nimport * as utils from './utils.js';\nimport { Vec4Arg, Vec4Type } from './vec4';\nimport { Mat4Arg } from './mat4';\nimport { BaseArgType } from './types';\n\nexport { Vec4Arg, Vec4Type };\n\ntype Vec4Ctor = new (n: number) => T;\n\n/**\n * Generates am typed API for Vec4\n * */\nfunction getAPIImpl(Ctor: Vec4Ctor) {\n\n/**\n * Creates a vec4; may be called with x, y, z to set initial values.\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @param w - Initial w value.\n * @returns the created vector\n */\nfunction create(x?: number, y?: number, z?: number, w?: number) {\n const newDst = new Ctor(4);\n if (x !== undefined) {\n newDst[0] = x;\n if (y !== undefined) {\n newDst[1] = y;\n if (z !== undefined) {\n newDst[2] = z;\n if (w !== undefined) {\n newDst[3] = w;\n }\n }\n }\n }\n return newDst;\n}\n\n/**\n * Creates a vec4; may be called with x, y, z to set initial values. (same as create)\n * @param x - Initial x value.\n * @param y - Initial y value.\n * @param z - Initial z value.\n * @param z - Initial w value.\n * @returns the created vector\n */\nconst fromValues = create;\n\n/**\n * Sets the values of a Vec4\n * Also see {@link vec4.create} and {@link vec4.copy}\n *\n * @param x first value\n * @param y second value\n * @param z third value\n * @param w fourth value\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector with its elements set.\n */\nfunction set(x: number, y: number, z: number, w: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = x;\n newDst[1] = y;\n newDst[2] = z;\n newDst[3] = w;\n\n return newDst;\n}\n\n/**\n * Applies Math.ceil to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the ceil of each element of v.\n */\nfunction ceil(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.ceil(v[0]);\n newDst[1] = Math.ceil(v[1]);\n newDst[2] = Math.ceil(v[2]);\n newDst[3] = Math.ceil(v[3]);\n\n return newDst;\n}\n\n/**\n * Applies Math.floor to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the floor of each element of v.\n */\nfunction floor(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.floor(v[0]);\n newDst[1] = Math.floor(v[1]);\n newDst[2] = Math.floor(v[2]);\n newDst[3] = Math.floor(v[3]);\n\n return newDst;\n}\n\n/**\n * Applies Math.round to each element of vector\n * @param v - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the round of each element of v.\n */\nfunction round(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.round(v[0]);\n newDst[1] = Math.round(v[1]);\n newDst[2] = Math.round(v[2]);\n newDst[3] = Math.round(v[3]);\n\n return newDst;\n}\n\n/**\n * Clamp each element of vector between min and max\n * @param v - Operand vector.\n * @param max - Min value, default 0\n * @param min - Max value, default 1\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that the clamped value of each element of v.\n */\nfunction clamp(v: Vec4Arg, min = 0, max = 1, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.min(max, Math.max(min, v[0]));\n newDst[1] = Math.min(max, Math.max(min, v[1]));\n newDst[2] = Math.min(max, Math.max(min, v[2]));\n newDst[3] = Math.min(max, Math.max(min, v[3]));\n\n return newDst;\n}\n\n/**\n * Adds two vectors; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a and b.\n */\nfunction add(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + b[0];\n newDst[1] = a[1] + b[1];\n newDst[2] = a[2] + b[2];\n newDst[3] = a[3] + b[3];\n\n return newDst;\n}\n\n/**\n * Adds two vectors, scaling the 2nd; assumes a and b have the same dimension.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param scale - Amount to scale b\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the sum of a + b * scale.\n */\nfunction addScaled(a: Vec4Arg, b: Vec4Arg, scale: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + b[0] * scale;\n newDst[1] = a[1] + b[1] * scale;\n newDst[2] = a[2] + b[2] * scale;\n newDst[3] = a[3] + b[3] * scale;\n\n return newDst;\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nfunction subtract(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] - b[0];\n newDst[1] = a[1] - b[1];\n newDst[2] = a[2] - b[2];\n newDst[3] = a[3] - b[3];\n\n return newDst;\n}\n\n/**\n * Subtracts two vectors.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A vector that is the difference of a and b.\n */\nconst sub = subtract;\n\n/**\n * Check if 2 vectors are approximately equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are approximately equal\n */\nfunction equalsApproximately(a: Vec4Arg, b: Vec4Arg): boolean {\n return Math.abs(a[0] - b[0]) < utils.EPSILON &&\n Math.abs(a[1] - b[1]) < utils.EPSILON &&\n Math.abs(a[2] - b[2]) < utils.EPSILON &&\n Math.abs(a[3] - b[3]) < utils.EPSILON;\n}\n\n/**\n * Check if 2 vectors are exactly equal\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns true if vectors are exactly equal\n */\nfunction equals(a: Vec4Arg, b: Vec4Arg): boolean {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficient.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The linear interpolated result.\n */\nfunction lerp(a: Vec4Arg, b: Vec4Arg, t: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + t * (b[0] - a[0]);\n newDst[1] = a[1] + t * (b[1] - a[1]);\n newDst[2] = a[2] + t * (b[2] - a[2]);\n newDst[3] = a[3] + t * (b[3] - a[3]);\n\n return newDst;\n}\n\n/**\n * Performs linear interpolation on two vectors.\n * Given vectors a and b and interpolation coefficient vector t, returns\n * a + t * (b - a).\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param t - Interpolation coefficients vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns the linear interpolated result.\n */\nfunction lerpV(a: Vec4Arg, b: Vec4Arg, t: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] + t[0] * (b[0] - a[0]);\n newDst[1] = a[1] + t[1] * (b[1] - a[1]);\n newDst[2] = a[2] + t[2] * (b[2] - a[2]);\n newDst[3] = a[3] + t[3] * (b[3] - a[3]);\n\n return newDst;\n}\n\n/**\n * Return max values of two vectors.\n * Given vectors a and b returns\n * [max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The max components vector.\n */\nfunction max(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.max(a[0], b[0]);\n newDst[1] = Math.max(a[1], b[1]);\n newDst[2] = Math.max(a[2], b[2]);\n newDst[3] = Math.max(a[3], b[3]);\n\n return newDst;\n}\n\n/**\n * Return min values of two vectors.\n * Given vectors a and b returns\n * [min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])].\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The min components vector.\n */\nfunction min(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = Math.min(a[0], b[0]);\n newDst[1] = Math.min(a[1], b[1]);\n newDst[2] = Math.min(a[2], b[2]);\n newDst[3] = Math.min(a[3], b[3]);\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction mulScalar(v: Vec4Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = v[0] * k;\n newDst[1] = v[1] * k;\n newDst[2] = v[2] * k;\n newDst[3] = v[3] * k;\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by a scalar. (same as mulScalar)\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nconst scale = mulScalar;\n\n/**\n * Divides a vector by a scalar.\n * @param v - The vector.\n * @param k - The scalar.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The scaled vector.\n */\nfunction divScalar(v: Vec4Arg, k: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = v[0] / k;\n newDst[1] = v[1] / k;\n newDst[2] = v[2] / k;\n newDst[3] = v[3] / k;\n\n return newDst;\n}\n\n/**\n * Inverse a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nfunction inverse(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = 1 / v[0];\n newDst[1] = 1 / v[1];\n newDst[2] = 1 / v[2];\n newDst[3] = 1 / v[3];\n\n return newDst;\n}\n\n/**\n * Invert a vector. (same as inverse)\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The inverted vector.\n */\nconst invert = inverse;\n\n/**\n * Computes the dot product of two vectors\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @returns dot product\n */\nfunction dot(a: Vec4Arg, b: Vec4Arg): number {\n return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]) + (a[3] * b[3]);\n}\n\n/**\n * Computes the length of vector\n * @param v - vector.\n * @returns length of vector.\n */\nfunction length(v: Vec4Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n return Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3);\n}\n\n/**\n * Computes the length of vector (same as length)\n * @param v - vector.\n * @returns length of vector.\n */\nconst len = length;\n\n/**\n * Computes the square of the length of vector\n * @param v - vector.\n * @returns square of the length of vector.\n */\nfunction lengthSq(v: Vec4Arg): number {\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n return v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3;\n}\n\n/**\n * Computes the square of the length of vector (same as lengthSq)\n * @param v - vector.\n * @returns square of the length of vector.\n */\nconst lenSq = lengthSq;\n\n/**\n * Computes the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nfunction distance(a: Vec4Arg, b: Vec4Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n const dz = a[2] - b[2];\n const dw = a[3] - b[3];\n return Math.sqrt(dx * dx + dy * dy + dz * dz + dw * dw);\n}\n\n/**\n * Computes the distance between 2 points (same as distance)\n * @param a - vector.\n * @param b - vector.\n * @returns distance between a and b\n */\nconst dist = distance;\n\n/**\n * Computes the square of the distance between 2 points\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nfunction distanceSq(a: Vec4Arg, b: Vec4Arg): number {\n const dx = a[0] - b[0];\n const dy = a[1] - b[1];\n const dz = a[2] - b[2];\n const dw = a[3] - b[3];\n return dx * dx + dy * dy + dz * dz + dw * dw;\n}\n\n/**\n * Computes the square of the distance between 2 points (same as distanceSq)\n * @param a - vector.\n * @param b - vector.\n * @returns square of the distance between a and b\n */\nconst distSq = distanceSq;\n\n/**\n * Divides a vector by its Euclidean length and returns the quotient.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The normalized vector.\n */\nfunction normalize(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const v0 = v[0];\n const v1 = v[1];\n const v2 = v[2];\n const v3 = v[3];\n const len = Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3);\n\n if (len > 0.00001) {\n newDst[0] = v0 / len;\n newDst[1] = v1 / len;\n newDst[2] = v2 / len;\n newDst[3] = v3 / len;\n } else {\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 0;\n }\n\n return newDst;\n}\n\n/**\n * Negates a vector.\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns -v.\n */\nfunction negate(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = -v[0];\n newDst[1] = -v[1];\n newDst[2] = -v[2];\n newDst[3] = -v[3];\n\n return newDst;\n}\n\n/**\n * Copies a vector. (same as {@link vec4.clone})\n * Also see {@link vec4.create} and {@link vec4.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nfunction copy(v: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = v[0];\n newDst[1] = v[1];\n newDst[2] = v[2];\n newDst[3] = v[3];\n\n return newDst;\n}\n\n/**\n * Clones a vector. (same as {@link vec4.copy})\n * Also see {@link vec4.create} and {@link vec4.set}\n * @param v - The vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns A copy of v.\n */\nconst clone = copy;\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nfunction multiply(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] * b[0];\n newDst[1] = a[1] * b[1];\n newDst[2] = a[2] * b[2];\n newDst[3] = a[3] * b[3];\n\n return newDst;\n}\n\n/**\n * Multiplies a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as mul)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of products of entries of a and b.\n */\nconst mul = multiply;\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length.\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nfunction divide(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = a[0] / b[0];\n newDst[1] = a[1] / b[1];\n newDst[2] = a[2] / b[2];\n newDst[3] = a[3] / b[3];\n\n return newDst;\n}\n\n/**\n * Divides a vector by another vector (component-wise); assumes a and\n * b have the same length. (same as divide)\n * @param a - Operand vector.\n * @param b - Operand vector.\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The vector of quotients of entries of a and b.\n */\nconst div = divide;\n\n/**\n * Zero's a vector\n * @param dst - vector to hold result. If not passed in a new one is created.\n * @returns The zeroed vector.\n */\nfunction zero(dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n newDst[0] = 0;\n newDst[1] = 0;\n newDst[2] = 0;\n newDst[3] = 0;\n\n return newDst;\n}\n\n\n/**\n * transform vec4 by 4x4 matrix\n * @param v - the vector\n * @param m - The matrix.\n * @param dst - optional vec4 to store result. If not passed a new one is created.\n * @returns the transformed vector\n */\nfunction transformMat4(v: Vec4Arg, m: Mat4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n const x = v[0];\n const y = v[1];\n const z = v[2];\n const w = v[3];\n\n newDst[0] = m[0] * x + m[4] * y + m[ 8] * z + m[12] * w;\n newDst[1] = m[1] * x + m[5] * y + m[ 9] * z + m[13] * w;\n newDst[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;\n newDst[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;\n\n return newDst;\n}\n\n\n/**\n * Treat a 4D vector as a direction and set it's length\n *\n * @param a The vec4 to lengthen\n * @param len The length of the resulting vector\n * @returns The lengthened vector\n */\nfunction setLength(a: Vec4Arg, len: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n normalize(a, newDst);\n return mulScalar(newDst, len, newDst);\n}\n\n/**\n * Ensure a vector is not longer than a max length\n *\n * @param a The vec4 to limit\n * @param maxLen The longest length of the resulting vector\n * @returns The vector, shortened to maxLen if it's too long\n */\nfunction truncate(a: Vec4Arg, maxLen: number, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n\n if (length(a) > maxLen) {\n return setLength(a, maxLen, newDst);\n }\n\n return copy(a, newDst);\n}\n\n/**\n * Return the vector exactly between 2 endpoint vectors\n *\n * @param a Endpoint 1\n * @param b Endpoint 2\n * @returns The vector exactly residing between endpoints 1 and 2\n */\nfunction midpoint(a: Vec4Arg, b: Vec4Arg, dst?: T) {\n const newDst = (dst ?? new Ctor(4)) as T;\n return lerp(a, b, 0.5, newDst);\n}\n\nreturn {\n create,\n fromValues,\n set,\n ceil,\n floor,\n round,\n clamp,\n add,\n addScaled,\n subtract,\n sub,\n equalsApproximately,\n equals,\n lerp,\n lerpV,\n max,\n min,\n mulScalar,\n scale,\n divScalar,\n inverse,\n invert,\n dot,\n length,\n len,\n lengthSq,\n lenSq,\n distance,\n dist,\n distanceSq,\n distSq,\n normalize,\n negate,\n copy,\n clone,\n multiply,\n mul,\n divide,\n div,\n zero,\n transformMat4,\n setLength,\n truncate,\n midpoint,\n};\n}\n\ntype API = ReturnType>;\n\nconst cache = new Map();\n\n/**\n *\n * Vec4 math functions.\n *\n * Almost all functions take an optional `newDst` argument. If it is not passed in the\n * functions will create a new `Vec4`. In other words you can do this\n *\n * const v = vec4.cross(v1, v2); // Creates a new Vec4 with the cross product of v1 x v2.\n *\n * or\n *\n * const v = vec4.create();\n * vec4.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v\n *\n * The first style is often easier but depending on where it's used it generates garbage where\n * as there is almost never allocation with the second style.\n *\n * It is always safe to pass any vector as the destination. So for example\n *\n * vec4.cross(v1, v2, v1); // Puts the cross product of v1 x v2 in v1\n *\n */\nexport function getAPI(Ctor: Vec4Ctor) {\n let api = cache.get(Ctor);\n if (!api) {\n api = getAPIImpl(Ctor);\n cache.set(Ctor, api);\n }\n return api as API;\n}\n\n","import {BaseArgType, ZeroArray} from './types';\nimport {Mat3Arg, Mat3Type, getAPI as getMat3API} from './mat3-impl';\nimport {Mat4Arg, Mat4Type, getAPI as getMat4API} from './mat4-impl';\nimport {QuatArg, QuatType, getAPI as getQuatAPI, RotationOrder} from './quat-impl';\nimport {Vec2Arg, Vec2Type, getAPI as getVec2API} from './vec2-impl';\nimport {Vec3Arg, Vec3Type, getAPI as getVec3API} from './vec3-impl';\nimport {Vec4Arg, Vec4Type, getAPI as getVec4API} from './vec4-impl';\nimport * as utils from './utils';\n\nexport {\n RotationOrder,\n utils,\n\n BaseArgType,\n\n Mat3Arg,\n Mat4Arg,\n QuatArg,\n Vec2Arg,\n Vec3Arg,\n Vec4Arg,\n\n Mat3Type,\n Mat4Type,\n QuatType,\n Vec2Type,\n Vec3Type,\n Vec4Type,\n};\n\nexport type BaseCtor = new (n: number) => T;\n\nexport type Mat3 = Mat3Type;\nexport type Mat4 = Mat4Type;\nexport type Quat = QuatType;\nexport type Vec2 = Vec2Type;\nexport type Vec3 = Vec3Type;\nexport type Vec4 = Vec4Type;\n\nexport type Mat3d = Mat3Type;\nexport type Mat4d = Mat4Type;\nexport type Quatd = QuatType;\nexport type Vec2d = Vec2Type;\nexport type Vec3d = Vec3Type;\nexport type Vec4d = Vec4Type;\n\nexport type Mat3n = Mat3Type;\nexport type Mat4n = Mat4Type;\nexport type Quatn = QuatType;\nexport type Vec2n = Vec2Type;\nexport type Vec3n = Vec3Type;\nexport type Vec4n = Vec4Type;\n\n/**\n * Generate wgpu-matrix API for type\n */\nfunction wgpuMatrixAPI<\n Mat3 extends BaseArgType,\n Mat4 extends BaseArgType,\n Quat extends BaseArgType,\n Vec2 extends BaseArgType,\n Vec3 extends BaseArgType,\n Vec4 extends BaseArgType,\n>(\n Mat3Ctor: BaseCtor,\n Mat4Ctor: BaseCtor,\n QuatCtor: BaseCtor,\n Vec2Ctor: BaseCtor,\n Vec3Ctor: BaseCtor,\n Vec4Ctor: BaseCtor,\n) {\n return {\n /** @namespace mat4 */\n mat4: getMat4API(Mat3Ctor),\n /** @namespace mat3 */\n mat3: getMat3API(Mat4Ctor),\n /** @namespace quat */\n quat: getQuatAPI(QuatCtor),\n /** @namespace vec2 */\n vec2: getVec2API(Vec2Ctor),\n /** @namespace vec3 */\n vec3: getVec3API(Vec3Ctor),\n /** @namespace vec4 */\n vec4: getVec4API(Vec4Ctor),\n };\n}\n\nexport const {\n /** @namespace */\n mat4,\n /** @namespace */\n mat3,\n /** @namespace */\n quat,\n /** @namespace */\n vec2,\n /** @namespace */\n vec3,\n /** @namespace */\n vec4,\n} = wgpuMatrixAPI<\n Mat3, Mat4, Quat, Vec2, Vec3, Vec4>(\n Float32Array, Float32Array, Float32Array, Float32Array, Float32Array, Float32Array);\n\nexport const {\n /** @namespace */\n mat4: mat4d,\n /** @namespace */\n mat3: mat3d,\n /** @namespace */\n quat: quatd,\n /** @namespace */\n vec2: vec2d,\n /** @namespace */\n vec3: vec3d,\n /** @namespace */\n vec4: vec4d,\n} = wgpuMatrixAPI<\n Mat3d, Mat4d, Quatd, Vec2d, Vec3d, Vec4d>(\n Float64Array, Float64Array, Float64Array, Float64Array, Float64Array, Float64Array);\n\nexport const {\n /** @namespace */\n mat4: mat4n,\n /** @namespace */\n mat3: mat3n,\n /** @namespace */\n quat: quatn,\n /** @namespace */\n vec2: vec2n,\n /** @namespace */\n vec3: vec3n,\n /** @namespace */\n vec4: vec4n,\n} = wgpuMatrixAPI<\n Mat3n, Mat4n, Quatn, Vec2n, Vec3n, Vec4n>(\n ZeroArray, Array, Array, Array, Array, Array);\n"],"names":["ZeroArray","OriginalConstructor","modifier","a","fill","constructor","args","super","this","EPSILON","degrees","Math","PI","n","m","b","v","d","abs","t","radians","old","cache","Map","getAPI","Ctor","api","get","create","x","y","newDst","undefined","subtract","dst","lerp","mulScalar","k","inverse","dot","length","v0","v1","sqrt","lengthSq","distance","dx","dy","distanceSq","normalize","len","copy","multiply","divide","setLength","fromValues","set","ceil","floor","round","clamp","min","max","add","addScaled","scale","angle","ax","ay","bx","by","mag","cosine","acos","sub","equalsApproximately","utils.EPSILON","equals","lerpV","divScalar","invert","cross","z","lenSq","dist","distSq","negate","clone","mul","div","random","cos","sin","zero","transformMat4","transformMat3","rotate","rad","p0","p1","sinC","cosC","truncate","maxLen","midpoint","getAPIImpl","vec2","getVec2API","identity","m00","m01","m02","m10","m11","m12","m20","m21","m22","b01","b11","b21","invDet","a00","a01","a02","a10","a11","a12","a20","a21","a22","b00","b02","b10","b12","b20","b22","v2","v3","v4","v5","v6","v7","v8","fromMat4","m4","fromQuat","q","w","x2","y2","z2","xx","yx","yy","zx","zy","zz","wx","wy","wz","transpose","determinant","setTranslation","getTranslation","getAxis","axis","off","setAxis","getScaling","xy","translation","translate","rotation","angleInRadians","c","s","scaling","uniformScaling","uniformScale","dz","az","bz","t1","t2","zScale","transformMat4Upper3x3","transformQuat","qx","qy","qz","w2","uvX","uvY","uvZ","xz","yz","rotateX","p","r","rotateY","rotateZ","vec3","getVec3API","m03","m13","m23","m30","m31","m32","m33","tmp0","tmp1","tmp2","tmp3","tmp4","tmp5","tmp6","tmp7","tmp8","tmp9","tmp10","tmp11","tmp12","tmp13","tmp14","tmp15","tmp16","tmp17","tmp18","tmp19","tmp20","tmp21","tmp22","tmp23","t0","t3","a03","a13","a23","a30","a31","a32","a33","b03","b13","b23","b30","b31","b32","b33","xAxis","yAxis","zAxis","axisRotation","oneMinusCosine","axisRotate","r00","r01","r02","r10","r11","r12","r20","r21","r22","v9","v10","v11","v12","v13","v14","v15","fromMat3","m3","perspective","fieldOfViewYInRadians","aspect","zNear","zFar","f","tan","Number","isFinite","rangeInv","perspectiveReverseZ","Infinity","ortho","left","right","bottom","top","near","far","frustum","frustumReverseZ","aim","position","target","up","cameraAim","eye","lookAt","rotationX","rotationY","rotationZ","fromAxisAngle","halfAngle","aw","bw","slerp","scale0","scale1","cosOmega","omega","sinOmega","tempVec3","xUnitVec3","yUnitVec3","tempQuat1","tempQuat2","toAxisAngle","qw","a0","a1","a2","a3","invDot","conjugate","fromMat","trace","root","invRoot","i","j","fromEuler","xAngleInRadians","yAngleInRadians","zAngleInRadians","order","xHalfAngle","yHalfAngle","zHalfAngle","sx","cx","sy","cy","sz","cz","Error","rotationTo","aUnit","bUnit","sqlerp","dw","wgpuMatrixAPI","Mat3Ctor","Mat4Ctor","QuatCtor","Vec2Ctor","Vec3Ctor","Vec4Ctor","mat4","getMat4API","mat3","getMat3API","quat","getQuatAPI","vec4","getVec4API","Float32Array","mat4d","mat3d","quatd","vec2d","vec3d","vec4d","Float64Array","mat4n","mat3n","quatn","vec2n","vec3n","vec4n","Array"],"mappings":"AAkBO,MAAMA,GAXXC,EAWsC,MAVtCC,EAUsDC,GAAKA,EAAEC,KAAK,GAR3D,cAAcH,EACnB,WAAAI,IAAeC,GACbC,SAASD,GACTJ,EAASM,KACV,IARL,IACEP,EACAC,ECcK,IAAIO,EAAU,4DAkBf,SAAmBC,GACvB,OAAOA,EAAUC,KAAKC,GAAK,GAC7B,kBAqDgB,SAAgBC,EAAWC,GACzC,OAASD,EAAIC,EAAKA,GAAKA,CACzB,uBAxB4BX,EAAWY,EAAWC,GAChD,MAAMC,EAAIF,EAAIZ,EACd,OAAQQ,KAAKO,IAAIH,EAAIZ,GAAKM,EACrBN,GACCa,EAAIb,GAAKc,CACjB,gBAlBqBd,EAAWY,EAAWI,GACzC,OAAOhB,GAAKY,EAAIZ,GAAKgB,CACvB,WAbM,SAAmBC,GACvB,OAAiB,IAAVA,EAAgBT,KAAKC,EAC9B,aAtBM,SAAqBI,GACzB,MAAMK,EAAMZ,EAEZ,OADAA,EAAUO,EACHK,CACT,GCgwBA,MAAMC,EAAQ,IAAIC,IAEZ,SAAUC,EAAyCC,GACvD,IAAIC,EAAMJ,EAAMK,IAAIF,GAKpB,OAJKC,IACHA,EAnwBJ,SAA4DD,GAkB5D,SAASG,EAAOC,EAAI,EAAGC,EAAI,GACzB,MAAMC,EAAS,IAAIN,EAAK,GAOxB,YANUO,IAANH,IACFE,EAAO,GAAKF,OACFG,IAANF,IACFC,EAAO,GAAKD,IAGTC,CACR,CAoJD,SAASE,EAAsC9B,EAAYY,EAAYmB,GACrE,MAAMH,EAAUG,GAAO,IAAIT,EAAK,GAKhC,OAHAM,EAAO,GAAK5B,EAAE,GAAKY,EAA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C,EAAiBR,GAE3B,CAEa,MAAAC,KAEXA,EAAIE,KAEJA,EAAIE,KAEJA,EAAIpQ,KAEJA,EAAIgG,KAEJA,EAAIsK,KAEJA,GACEb,EAEAe,aAAcA,aAAcA,aAAcA,aAAcA,aAAcA,eAIxER,KAAMS,EAENP,KAAMQ,EAENN,KAAMO,EAEN3Q,KAAM4Q,EAEN5K,KAAM6K,EAENP,KAAMQ,GACJrB,EAEAsB,aAAcA,aAAcA,aAAcA,aAAcA,aAAcA,eAIxEf,KAAMgB,EAENd,KAAMe,EAENb,KAAMc,EAENlR,KAAMmR,EAENnL,KAAMoL,EAENd,KAAMe,GACJ5B,EAEAnW,EAAWgY,MAAOA,MAAOA,MAAOA,MAAOA"} \ No newline at end of file diff --git a/docs/assets/highlight.css b/docs/assets/highlight.css index a886fb5..6f2ae55 100644 --- a/docs/assets/highlight.css +++ b/docs/assets/highlight.css @@ -29,6 +29,8 @@ --dark-hl-13: #CE9178; --light-hl-14: #000000; --dark-hl-14: #C8C8C8; + --light-hl-15: #267F99; + --dark-hl-15: #4EC9B0; --light-code-background: #FFFFFF; --dark-code-background: #1E1E1E; } @@ -49,6 +51,7 @@ --hl-12: var(--light-hl-12); --hl-13: var(--light-hl-13); --hl-14: var(--light-hl-14); + --hl-15: var(--light-hl-15); --code-background: var(--light-code-background); } } @@ -68,6 +71,7 @@ --hl-12: var(--dark-hl-12); --hl-13: var(--dark-hl-13); --hl-14: var(--dark-hl-14); + --hl-15: var(--dark-hl-15); --code-background: var(--dark-code-background); } } @@ -87,6 +91,7 @@ --hl-12: var(--light-hl-12); --hl-13: var(--light-hl-13); --hl-14: var(--light-hl-14); + --hl-15: var(--light-hl-15); --code-background: var(--light-code-background); } @@ -106,6 +111,7 @@ --hl-12: var(--dark-hl-12); --hl-13: var(--dark-hl-13); --hl-14: var(--dark-hl-14); + --hl-15: var(--dark-hl-15); --code-background: var(--dark-code-background); } @@ -124,4 +130,5 @@ .hl-12 { color: var(--hl-12); } .hl-13 { color: var(--hl-13); } .hl-14 { color: var(--hl-14); } +.hl-15 { color: var(--hl-15); } pre, code { background: var(--code-background); } diff --git a/docs/assets/icons.js b/docs/assets/icons.js index b79c9e8..975b806 100644 --- a/docs/assets/icons.js +++ b/docs/assets/icons.js @@ -1,5 +1,5 @@ (function(svg) { - svg.innerHTML = ``; + svg.innerHTML = ``; svg.style.display = 'none'; if (location.protocol === 'file:') { if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', updateUseElements); diff --git a/docs/assets/icons.svg b/docs/assets/icons.svg index 7dead61..e371b8b 100644 --- a/docs/assets/icons.svg +++ b/docs/assets/icons.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/docs/assets/main.js b/docs/assets/main.js index d6f1388..84b91b2 100644 --- a/docs/assets/main.js +++ b/docs/assets/main.js @@ -1,8 +1,8 @@ "use strict"; -"use strict";(()=>{var Ce=Object.create;var ne=Object.defineProperty;var Pe=Object.getOwnPropertyDescriptor;var Oe=Object.getOwnPropertyNames;var _e=Object.getPrototypeOf,Re=Object.prototype.hasOwnProperty;var Me=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var Fe=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Oe(e))!Re.call(t,i)&&i!==n&&ne(t,i,{get:()=>e[i],enumerable:!(r=Pe(e,i))||r.enumerable});return t};var De=(t,e,n)=>(n=t!=null?Ce(_e(t)):{},Fe(e||!t||!t.__esModule?ne(n,"default",{value:t,enumerable:!0}):n,t));var ae=Me((se,oe)=>{(function(){var t=function(e){var n=new t.Builder;return n.pipeline.add(t.trimmer,t.stopWordFilter,t.stemmer),n.searchPipeline.add(t.stemmer),e.call(n,n),n.build()};t.version="2.3.9";t.utils={},t.utils.warn=function(e){return function(n){e.console&&console.warn&&console.warn(n)}}(this),t.utils.asString=function(e){return e==null?"":e.toString()},t.utils.clone=function(e){if(e==null)return e;for(var n=Object.create(null),r=Object.keys(e),i=0;i0){var d=t.utils.clone(n)||{};d.position=[a,u],d.index=s.length,s.push(new t.Token(r.slice(a,o),d))}a=o+1}}return s},t.tokenizer.separator=/[\s\-]+/;t.Pipeline=function(){this._stack=[]},t.Pipeline.registeredFunctions=Object.create(null),t.Pipeline.registerFunction=function(e,n){n in this.registeredFunctions&&t.utils.warn("Overwriting existing registered function: "+n),e.label=n,t.Pipeline.registeredFunctions[e.label]=e},t.Pipeline.warnIfFunctionNotRegistered=function(e){var n=e.label&&e.label in this.registeredFunctions;n||t.utils.warn(`Function is not registered with pipeline. This may cause problems when serialising the index. -`,e)},t.Pipeline.load=function(e){var n=new t.Pipeline;return e.forEach(function(r){var i=t.Pipeline.registeredFunctions[r];if(i)n.add(i);else throw new Error("Cannot load unregistered function: "+r)}),n},t.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach(function(n){t.Pipeline.warnIfFunctionNotRegistered(n),this._stack.push(n)},this)},t.Pipeline.prototype.after=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var r=this._stack.indexOf(e);if(r==-1)throw new Error("Cannot find existingFn");r=r+1,this._stack.splice(r,0,n)},t.Pipeline.prototype.before=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var r=this._stack.indexOf(e);if(r==-1)throw new Error("Cannot find existingFn");this._stack.splice(r,0,n)},t.Pipeline.prototype.remove=function(e){var n=this._stack.indexOf(e);n!=-1&&this._stack.splice(n,1)},t.Pipeline.prototype.run=function(e){for(var n=this._stack.length,r=0;r1&&(oe&&(r=s),o!=e);)i=r-n,s=n+Math.floor(i/2),o=this.elements[s*2];if(o==e||o>e)return s*2;if(ol?d+=2:a==l&&(n+=r[u+1]*i[d+1],u+=2,d+=2);return n},t.Vector.prototype.similarity=function(e){return this.dot(e)/this.magnitude()||0},t.Vector.prototype.toArray=function(){for(var e=new Array(this.elements.length/2),n=1,r=0;n0){var o=s.str.charAt(0),a;o in s.node.edges?a=s.node.edges[o]:(a=new t.TokenSet,s.node.edges[o]=a),s.str.length==1&&(a.final=!0),i.push({node:a,editsRemaining:s.editsRemaining,str:s.str.slice(1)})}if(s.editsRemaining!=0){if("*"in s.node.edges)var l=s.node.edges["*"];else{var l=new t.TokenSet;s.node.edges["*"]=l}if(s.str.length==0&&(l.final=!0),i.push({node:l,editsRemaining:s.editsRemaining-1,str:s.str}),s.str.length>1&&i.push({node:s.node,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)}),s.str.length==1&&(s.node.final=!0),s.str.length>=1){if("*"in s.node.edges)var u=s.node.edges["*"];else{var u=new t.TokenSet;s.node.edges["*"]=u}s.str.length==1&&(u.final=!0),i.push({node:u,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)})}if(s.str.length>1){var d=s.str.charAt(0),y=s.str.charAt(1),p;y in s.node.edges?p=s.node.edges[y]:(p=new t.TokenSet,s.node.edges[y]=p),s.str.length==1&&(p.final=!0),i.push({node:p,editsRemaining:s.editsRemaining-1,str:d+s.str.slice(2)})}}}return r},t.TokenSet.fromString=function(e){for(var n=new t.TokenSet,r=n,i=0,s=e.length;i=e;n--){var r=this.uncheckedNodes[n],i=r.child.toString();i in this.minimizedNodes?r.parent.edges[r.char]=this.minimizedNodes[i]:(r.child._str=i,this.minimizedNodes[i]=r.child),this.uncheckedNodes.pop()}};t.Index=function(e){this.invertedIndex=e.invertedIndex,this.fieldVectors=e.fieldVectors,this.tokenSet=e.tokenSet,this.fields=e.fields,this.pipeline=e.pipeline},t.Index.prototype.search=function(e){return this.query(function(n){var r=new t.QueryParser(e,n);r.parse()})},t.Index.prototype.query=function(e){for(var n=new t.Query(this.fields),r=Object.create(null),i=Object.create(null),s=Object.create(null),o=Object.create(null),a=Object.create(null),l=0;l1?this._b=1:this._b=e},t.Builder.prototype.k1=function(e){this._k1=e},t.Builder.prototype.add=function(e,n){var r=e[this._ref],i=Object.keys(this._fields);this._documents[r]=n||{},this.documentCount+=1;for(var s=0;s=this.length)return t.QueryLexer.EOS;var e=this.str.charAt(this.pos);return this.pos+=1,e},t.QueryLexer.prototype.width=function(){return this.pos-this.start},t.QueryLexer.prototype.ignore=function(){this.start==this.pos&&(this.pos+=1),this.start=this.pos},t.QueryLexer.prototype.backup=function(){this.pos-=1},t.QueryLexer.prototype.acceptDigitRun=function(){var e,n;do e=this.next(),n=e.charCodeAt(0);while(n>47&&n<58);e!=t.QueryLexer.EOS&&this.backup()},t.QueryLexer.prototype.more=function(){return this.pos1&&(e.backup(),e.emit(t.QueryLexer.TERM)),e.ignore(),e.more())return t.QueryLexer.lexText},t.QueryLexer.lexEditDistance=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.EDIT_DISTANCE),t.QueryLexer.lexText},t.QueryLexer.lexBoost=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.BOOST),t.QueryLexer.lexText},t.QueryLexer.lexEOS=function(e){e.width()>0&&e.emit(t.QueryLexer.TERM)},t.QueryLexer.termSeparator=t.tokenizer.separator,t.QueryLexer.lexText=function(e){for(;;){var n=e.next();if(n==t.QueryLexer.EOS)return t.QueryLexer.lexEOS;if(n.charCodeAt(0)==92){e.escapeCharacter();continue}if(n==":")return t.QueryLexer.lexField;if(n=="~")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexEditDistance;if(n=="^")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexBoost;if(n=="+"&&e.width()===1||n=="-"&&e.width()===1)return e.emit(t.QueryLexer.PRESENCE),t.QueryLexer.lexText;if(n.match(t.QueryLexer.termSeparator))return t.QueryLexer.lexTerm}},t.QueryParser=function(e,n){this.lexer=new t.QueryLexer(e),this.query=n,this.currentClause={},this.lexemeIdx=0},t.QueryParser.prototype.parse=function(){this.lexer.run(),this.lexemes=this.lexer.lexemes;for(var e=t.QueryParser.parseClause;e;)e=e(this);return this.query},t.QueryParser.prototype.peekLexeme=function(){return this.lexemes[this.lexemeIdx]},t.QueryParser.prototype.consumeLexeme=function(){var e=this.peekLexeme();return this.lexemeIdx+=1,e},t.QueryParser.prototype.nextClause=function(){var e=this.currentClause;this.query.clause(e),this.currentClause={}},t.QueryParser.parseClause=function(e){var n=e.peekLexeme();if(n!=null)switch(n.type){case t.QueryLexer.PRESENCE:return t.QueryParser.parsePresence;case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var r="expected either a field or a term, found "+n.type;throw n.str.length>=1&&(r+=" with value '"+n.str+"'"),new t.QueryParseError(r,n.start,n.end)}},t.QueryParser.parsePresence=function(e){var n=e.consumeLexeme();if(n!=null){switch(n.str){case"-":e.currentClause.presence=t.Query.presence.PROHIBITED;break;case"+":e.currentClause.presence=t.Query.presence.REQUIRED;break;default:var r="unrecognised presence operator'"+n.str+"'";throw new t.QueryParseError(r,n.start,n.end)}var i=e.peekLexeme();if(i==null){var r="expecting term or field, found nothing";throw new t.QueryParseError(r,n.start,n.end)}switch(i.type){case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var r="expecting term or field, found '"+i.type+"'";throw new t.QueryParseError(r,i.start,i.end)}}},t.QueryParser.parseField=function(e){var n=e.consumeLexeme();if(n!=null){if(e.query.allFields.indexOf(n.str)==-1){var r=e.query.allFields.map(function(o){return"'"+o+"'"}).join(", "),i="unrecognised field '"+n.str+"', possible fields: "+r;throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.fields=[n.str];var s=e.peekLexeme();if(s==null){var i="expecting term, found nothing";throw new t.QueryParseError(i,n.start,n.end)}switch(s.type){case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var i="expecting term, found '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseTerm=function(e){var n=e.consumeLexeme();if(n!=null){e.currentClause.term=n.str.toLowerCase(),n.str.indexOf("*")!=-1&&(e.currentClause.usePipeline=!1);var r=e.peekLexeme();if(r==null){e.nextClause();return}switch(r.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+r.type+"'";throw new t.QueryParseError(i,r.start,r.end)}}},t.QueryParser.parseEditDistance=function(e){var n=e.consumeLexeme();if(n!=null){var r=parseInt(n.str,10);if(isNaN(r)){var i="edit distance must be numeric";throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.editDistance=r;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseBoost=function(e){var n=e.consumeLexeme();if(n!=null){var r=parseInt(n.str,10);if(isNaN(r)){var i="boost must be numeric";throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.boost=r;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},function(e,n){typeof define=="function"&&define.amd?define(n):typeof se=="object"?oe.exports=n():e.lunr=n()}(this,function(){return t})})()});var re=[];function G(t,e){re.push({selector:e,constructor:t})}var U=class{constructor(){this.alwaysVisibleMember=null;this.createComponents(document.body),this.ensureFocusedElementVisible(),this.listenForCodeCopies(),window.addEventListener("hashchange",()=>this.ensureFocusedElementVisible()),document.body.style.display||(this.ensureFocusedElementVisible(),this.updateIndexVisibility(),this.scrollToHash())}createComponents(e){re.forEach(n=>{e.querySelectorAll(n.selector).forEach(r=>{r.dataset.hasInstance||(new n.constructor({el:r,app:this}),r.dataset.hasInstance=String(!0))})})}filterChanged(){this.ensureFocusedElementVisible()}showPage(){document.body.style.display&&(console.log("Show page"),document.body.style.removeProperty("display"),this.ensureFocusedElementVisible(),this.updateIndexVisibility(),this.scrollToHash())}scrollToHash(){if(location.hash){console.log("Scorlling");let e=document.getElementById(location.hash.substring(1));if(!e)return;e.scrollIntoView({behavior:"instant",block:"start"})}}ensureActivePageVisible(){let e=document.querySelector(".tsd-navigation .current"),n=e?.parentElement;for(;n&&!n.classList.contains(".tsd-navigation");)n instanceof HTMLDetailsElement&&(n.open=!0),n=n.parentElement;if(e&&!e.checkVisibility()){let r=e.getBoundingClientRect().top-document.documentElement.clientHeight/4;document.querySelector(".site-menu").scrollTop=r}}updateIndexVisibility(){let e=document.querySelector(".tsd-index-content"),n=e?.open;e&&(e.open=!0),document.querySelectorAll(".tsd-index-section").forEach(r=>{r.style.display="block";let i=Array.from(r.querySelectorAll(".tsd-index-link")).every(s=>s.offsetParent==null);r.style.display=i?"none":"block"}),e&&(e.open=n)}ensureFocusedElementVisible(){if(this.alwaysVisibleMember&&(this.alwaysVisibleMember.classList.remove("always-visible"),this.alwaysVisibleMember.firstElementChild.remove(),this.alwaysVisibleMember=null),!location.hash)return;let e=document.getElementById(location.hash.substring(1));if(!e)return;let n=e.parentElement;for(;n&&n.tagName!=="SECTION";)n=n.parentElement;if(n&&n.offsetParent==null){this.alwaysVisibleMember=n,n.classList.add("always-visible");let r=document.createElement("p");r.classList.add("warning"),r.textContent="This member is normally hidden due to your filter settings.",n.prepend(r)}}listenForCodeCopies(){document.querySelectorAll("pre > button").forEach(e=>{let n;e.addEventListener("click",()=>{e.previousElementSibling instanceof HTMLElement&&navigator.clipboard.writeText(e.previousElementSibling.innerText.trim()),e.textContent="Copied!",e.classList.add("visible"),clearTimeout(n),n=setTimeout(()=>{e.classList.remove("visible"),n=setTimeout(()=>{e.textContent="Copy"},100)},1e3)})})}};var ie=(t,e=100)=>{let n;return()=>{clearTimeout(n),n=setTimeout(()=>t(),e)}};var de=De(ae());async function le(t,e){if(!window.searchData)return;let n=await fetch(window.searchData),r=new Blob([await n.arrayBuffer()]).stream().pipeThrough(new DecompressionStream("gzip")),i=await new Response(r).json();t.data=i,t.index=de.Index.load(i.index),e.classList.remove("loading"),e.classList.add("ready")}function he(){let t=document.getElementById("tsd-search");if(!t)return;let e={base:t.dataset.base+"/"},n=document.getElementById("tsd-search-script");t.classList.add("loading"),n&&(n.addEventListener("error",()=>{t.classList.remove("loading"),t.classList.add("failure")}),n.addEventListener("load",()=>{le(e,t)}),le(e,t));let r=document.querySelector("#tsd-search input"),i=document.querySelector("#tsd-search .results");if(!r||!i)throw new Error("The input field or the result list wrapper was not found");let s=!1;i.addEventListener("mousedown",()=>s=!0),i.addEventListener("mouseup",()=>{s=!1,t.classList.remove("has-focus")}),r.addEventListener("focus",()=>t.classList.add("has-focus")),r.addEventListener("blur",()=>{s||(s=!1,t.classList.remove("has-focus"))}),Ae(t,i,r,e)}function Ae(t,e,n,r){n.addEventListener("input",ie(()=>{Ve(t,e,n,r)},200));let i=!1;n.addEventListener("keydown",s=>{i=!0,s.key=="Enter"?Ne(e,n):s.key=="Escape"?n.blur():s.key=="ArrowUp"?ue(e,-1):s.key==="ArrowDown"?ue(e,1):i=!1}),n.addEventListener("keypress",s=>{i&&s.preventDefault()}),document.body.addEventListener("keydown",s=>{s.altKey||s.ctrlKey||s.metaKey||!n.matches(":focus")&&s.key==="/"&&(n.focus(),s.preventDefault())})}function Ve(t,e,n,r){if(!r.index||!r.data)return;e.textContent="";let i=n.value.trim(),s;if(i){let o=i.split(" ").map(a=>a.length?`*${a}*`:"").join(" ");s=r.index.search(o)}else s=[];for(let o=0;oa.score-o.score);for(let o=0,a=Math.min(10,s.length);o`,d=ce(l.name,i);globalThis.DEBUG_SEARCH_WEIGHTS&&(d+=` (score: ${s[o].score.toFixed(2)})`),l.parent&&(d=` - ${ce(l.parent,i)}.${d}`);let y=document.createElement("li");y.classList.value=l.classes??"";let p=document.createElement("a");p.href=r.base+l.url,p.innerHTML=u+d,y.append(p),e.appendChild(y)}}function ue(t,e){let n=t.querySelector(".current");if(!n)n=t.querySelector(e==1?"li:first-child":"li:last-child"),n&&n.classList.add("current");else{let r=n;if(e===1)do r=r.nextElementSibling??void 0;while(r instanceof HTMLElement&&r.offsetParent==null);else do r=r.previousElementSibling??void 0;while(r instanceof HTMLElement&&r.offsetParent==null);r&&(n.classList.remove("current"),r.classList.add("current"))}}function Ne(t,e){let n=t.querySelector(".current");if(n||(n=t.querySelector("li:first-child")),n){let r=n.querySelector("a");r&&(window.location.href=r.href),e.blur()}}function ce(t,e){if(e==="")return t;let n=t.toLocaleLowerCase(),r=e.toLocaleLowerCase(),i=[],s=0,o=n.indexOf(r);for(;o!=-1;)i.push(K(t.substring(s,o)),`${K(t.substring(o,o+r.length))}`),s=o+r.length,o=n.indexOf(r,s);return i.push(K(t.substring(s))),i.join("")}var He={"&":"&","<":"<",">":">","'":"'",'"':"""};function K(t){return t.replace(/[&<>"'"]/g,e=>He[e])}var I=class{constructor(e){this.el=e.el,this.app=e.app}};var F="mousedown",fe="mousemove",H="mouseup",J={x:0,y:0},pe=!1,ee=!1,Be=!1,D=!1,me=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);document.documentElement.classList.add(me?"is-mobile":"not-mobile");me&&"ontouchstart"in document.documentElement&&(Be=!0,F="touchstart",fe="touchmove",H="touchend");document.addEventListener(F,t=>{ee=!0,D=!1;let e=F=="touchstart"?t.targetTouches[0]:t;J.y=e.pageY||0,J.x=e.pageX||0});document.addEventListener(fe,t=>{if(ee&&!D){let e=F=="touchstart"?t.targetTouches[0]:t,n=J.x-(e.pageX||0),r=J.y-(e.pageY||0);D=Math.sqrt(n*n+r*r)>10}});document.addEventListener(H,()=>{ee=!1});document.addEventListener("click",t=>{pe&&(t.preventDefault(),t.stopImmediatePropagation(),pe=!1)});var X=class extends I{constructor(e){super(e),this.className=this.el.dataset.toggle||"",this.el.addEventListener(H,n=>this.onPointerUp(n)),this.el.addEventListener("click",n=>n.preventDefault()),document.addEventListener(F,n=>this.onDocumentPointerDown(n)),document.addEventListener(H,n=>this.onDocumentPointerUp(n))}setActive(e){if(this.active==e)return;this.active=e,document.documentElement.classList.toggle("has-"+this.className,e),this.el.classList.toggle("active",e);let n=(this.active?"to-has-":"from-has-")+this.className;document.documentElement.classList.add(n),setTimeout(()=>document.documentElement.classList.remove(n),500)}onPointerUp(e){D||(this.setActive(!0),e.preventDefault())}onDocumentPointerDown(e){if(this.active){if(e.target.closest(".col-sidebar, .tsd-filter-group"))return;this.setActive(!1)}}onDocumentPointerUp(e){if(!D&&this.active&&e.target.closest(".col-sidebar")){let n=e.target.closest("a");if(n){let r=window.location.href;r.indexOf("#")!=-1&&(r=r.substring(0,r.indexOf("#"))),n.href.substring(0,r.length)==r&&setTimeout(()=>this.setActive(!1),250)}}}};var te;try{te=localStorage}catch{te={getItem(){return null},setItem(){}}}var Q=te;var ye=document.head.appendChild(document.createElement("style"));ye.dataset.for="filters";var Y=class extends I{constructor(e){super(e),this.key=`filter-${this.el.name}`,this.value=this.el.checked,this.el.addEventListener("change",()=>{this.setLocalStorage(this.el.checked)}),this.setLocalStorage(this.fromLocalStorage()),ye.innerHTML+=`html:not(.${this.key}) .tsd-is-${this.el.name} { display: none; } -`,this.app.updateIndexVisibility()}fromLocalStorage(){let e=Q.getItem(this.key);return e?e==="true":this.el.checked}setLocalStorage(e){Q.setItem(this.key,e.toString()),this.value=e,this.handleValueChange()}handleValueChange(){this.el.checked=this.value,document.documentElement.classList.toggle(this.key,this.value),this.app.filterChanged(),this.app.updateIndexVisibility()}};var Z=class extends I{constructor(e){super(e),this.summary=this.el.querySelector(".tsd-accordion-summary"),this.icon=this.summary.querySelector("svg"),this.key=`tsd-accordion-${this.summary.dataset.key??this.summary.textContent.trim().replace(/\s+/g,"-").toLowerCase()}`;let n=Q.getItem(this.key);this.el.open=n?n==="true":this.el.open,this.el.addEventListener("toggle",()=>this.update());let r=this.summary.querySelector("a");r&&r.addEventListener("click",()=>{location.assign(r.href)}),this.update()}update(){this.icon.style.transform=`rotate(${this.el.open?0:-90}deg)`,Q.setItem(this.key,this.el.open.toString())}};function ge(t){let e=Q.getItem("tsd-theme")||"os";t.value=e,ve(e),t.addEventListener("change",()=>{Q.setItem("tsd-theme",t.value),ve(t.value)})}function ve(t){document.documentElement.dataset.theme=t}var Le;function be(){let t=document.getElementById("tsd-nav-script");t&&(t.addEventListener("load",xe),xe())}async function xe(){let t=document.getElementById("tsd-nav-container");if(!t||!window.navigationData)return;let n=await(await fetch(window.navigationData)).arrayBuffer(),r=new Blob([n]).stream().pipeThrough(new DecompressionStream("gzip")),i=await new Response(r).json();Le=t.dataset.base+"/",t.innerHTML="";for(let s of i)we(s,t,[]);window.app.createComponents(t),window.app.showPage(),window.app.ensureActivePageVisible()}function we(t,e,n){let r=e.appendChild(document.createElement("li"));if(t.children){let i=[...n,t.text],s=r.appendChild(document.createElement("details"));s.className=t.class?`${t.class} tsd-index-accordion`:"tsd-index-accordion",s.dataset.key=i.join("$");let o=s.appendChild(document.createElement("summary"));o.className="tsd-accordion-summary",o.innerHTML='',Ee(t,o);let a=s.appendChild(document.createElement("div"));a.className="tsd-accordion-details";let l=a.appendChild(document.createElement("ul"));l.className="tsd-nested-navigation";for(let u of t.children)we(u,l,i)}else Ee(t,r,t.class)}function Ee(t,e,n){if(t.path){let r=e.appendChild(document.createElement("a"));r.href=Le+t.path,n&&(r.className=n),location.pathname===r.pathname&&r.classList.add("current"),t.kind&&(r.innerHTML=``),r.appendChild(document.createElement("span")).textContent=t.text}else e.appendChild(document.createElement("span")).textContent=t.text}G(X,"a[data-toggle]");G(Z,".tsd-index-accordion");G(Y,".tsd-filter-item input[type=checkbox]");var Se=document.getElementById("tsd-theme");Se&&ge(Se);var je=new U;Object.defineProperty(window,"app",{value:je});he();be();})(); +"use strict";(()=>{var Pe=Object.create;var re=Object.defineProperty;var Oe=Object.getOwnPropertyDescriptor;var _e=Object.getOwnPropertyNames;var Re=Object.getPrototypeOf,Me=Object.prototype.hasOwnProperty;var Fe=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var De=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of _e(e))!Me.call(t,i)&&i!==n&&re(t,i,{get:()=>e[i],enumerable:!(r=Oe(e,i))||r.enumerable});return t};var Ae=(t,e,n)=>(n=t!=null?Pe(Re(t)):{},De(e||!t||!t.__esModule?re(n,"default",{value:t,enumerable:!0}):n,t));var le=Fe((oe,ae)=>{(function(){var t=function(e){var n=new t.Builder;return n.pipeline.add(t.trimmer,t.stopWordFilter,t.stemmer),n.searchPipeline.add(t.stemmer),e.call(n,n),n.build()};t.version="2.3.9";t.utils={},t.utils.warn=function(e){return function(n){e.console&&console.warn&&console.warn(n)}}(this),t.utils.asString=function(e){return e==null?"":e.toString()},t.utils.clone=function(e){if(e==null)return e;for(var n=Object.create(null),r=Object.keys(e),i=0;i0){var d=t.utils.clone(n)||{};d.position=[a,u],d.index=s.length,s.push(new t.Token(r.slice(a,o),d))}a=o+1}}return s},t.tokenizer.separator=/[\s\-]+/;t.Pipeline=function(){this._stack=[]},t.Pipeline.registeredFunctions=Object.create(null),t.Pipeline.registerFunction=function(e,n){n in this.registeredFunctions&&t.utils.warn("Overwriting existing registered function: "+n),e.label=n,t.Pipeline.registeredFunctions[e.label]=e},t.Pipeline.warnIfFunctionNotRegistered=function(e){var n=e.label&&e.label in this.registeredFunctions;n||t.utils.warn(`Function is not registered with pipeline. This may cause problems when serialising the index. +`,e)},t.Pipeline.load=function(e){var n=new t.Pipeline;return e.forEach(function(r){var i=t.Pipeline.registeredFunctions[r];if(i)n.add(i);else throw new Error("Cannot load unregistered function: "+r)}),n},t.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach(function(n){t.Pipeline.warnIfFunctionNotRegistered(n),this._stack.push(n)},this)},t.Pipeline.prototype.after=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var r=this._stack.indexOf(e);if(r==-1)throw new Error("Cannot find existingFn");r=r+1,this._stack.splice(r,0,n)},t.Pipeline.prototype.before=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var r=this._stack.indexOf(e);if(r==-1)throw new Error("Cannot find existingFn");this._stack.splice(r,0,n)},t.Pipeline.prototype.remove=function(e){var n=this._stack.indexOf(e);n!=-1&&this._stack.splice(n,1)},t.Pipeline.prototype.run=function(e){for(var n=this._stack.length,r=0;r1&&(oe&&(r=s),o!=e);)i=r-n,s=n+Math.floor(i/2),o=this.elements[s*2];if(o==e||o>e)return s*2;if(ol?d+=2:a==l&&(n+=r[u+1]*i[d+1],u+=2,d+=2);return n},t.Vector.prototype.similarity=function(e){return this.dot(e)/this.magnitude()||0},t.Vector.prototype.toArray=function(){for(var e=new Array(this.elements.length/2),n=1,r=0;n0){var o=s.str.charAt(0),a;o in s.node.edges?a=s.node.edges[o]:(a=new t.TokenSet,s.node.edges[o]=a),s.str.length==1&&(a.final=!0),i.push({node:a,editsRemaining:s.editsRemaining,str:s.str.slice(1)})}if(s.editsRemaining!=0){if("*"in s.node.edges)var l=s.node.edges["*"];else{var l=new t.TokenSet;s.node.edges["*"]=l}if(s.str.length==0&&(l.final=!0),i.push({node:l,editsRemaining:s.editsRemaining-1,str:s.str}),s.str.length>1&&i.push({node:s.node,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)}),s.str.length==1&&(s.node.final=!0),s.str.length>=1){if("*"in s.node.edges)var u=s.node.edges["*"];else{var u=new t.TokenSet;s.node.edges["*"]=u}s.str.length==1&&(u.final=!0),i.push({node:u,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)})}if(s.str.length>1){var d=s.str.charAt(0),m=s.str.charAt(1),p;m in s.node.edges?p=s.node.edges[m]:(p=new t.TokenSet,s.node.edges[m]=p),s.str.length==1&&(p.final=!0),i.push({node:p,editsRemaining:s.editsRemaining-1,str:d+s.str.slice(2)})}}}return r},t.TokenSet.fromString=function(e){for(var n=new t.TokenSet,r=n,i=0,s=e.length;i=e;n--){var r=this.uncheckedNodes[n],i=r.child.toString();i in this.minimizedNodes?r.parent.edges[r.char]=this.minimizedNodes[i]:(r.child._str=i,this.minimizedNodes[i]=r.child),this.uncheckedNodes.pop()}};t.Index=function(e){this.invertedIndex=e.invertedIndex,this.fieldVectors=e.fieldVectors,this.tokenSet=e.tokenSet,this.fields=e.fields,this.pipeline=e.pipeline},t.Index.prototype.search=function(e){return this.query(function(n){var r=new t.QueryParser(e,n);r.parse()})},t.Index.prototype.query=function(e){for(var n=new t.Query(this.fields),r=Object.create(null),i=Object.create(null),s=Object.create(null),o=Object.create(null),a=Object.create(null),l=0;l1?this._b=1:this._b=e},t.Builder.prototype.k1=function(e){this._k1=e},t.Builder.prototype.add=function(e,n){var r=e[this._ref],i=Object.keys(this._fields);this._documents[r]=n||{},this.documentCount+=1;for(var s=0;s=this.length)return t.QueryLexer.EOS;var e=this.str.charAt(this.pos);return this.pos+=1,e},t.QueryLexer.prototype.width=function(){return this.pos-this.start},t.QueryLexer.prototype.ignore=function(){this.start==this.pos&&(this.pos+=1),this.start=this.pos},t.QueryLexer.prototype.backup=function(){this.pos-=1},t.QueryLexer.prototype.acceptDigitRun=function(){var e,n;do e=this.next(),n=e.charCodeAt(0);while(n>47&&n<58);e!=t.QueryLexer.EOS&&this.backup()},t.QueryLexer.prototype.more=function(){return this.pos1&&(e.backup(),e.emit(t.QueryLexer.TERM)),e.ignore(),e.more())return t.QueryLexer.lexText},t.QueryLexer.lexEditDistance=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.EDIT_DISTANCE),t.QueryLexer.lexText},t.QueryLexer.lexBoost=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.BOOST),t.QueryLexer.lexText},t.QueryLexer.lexEOS=function(e){e.width()>0&&e.emit(t.QueryLexer.TERM)},t.QueryLexer.termSeparator=t.tokenizer.separator,t.QueryLexer.lexText=function(e){for(;;){var n=e.next();if(n==t.QueryLexer.EOS)return t.QueryLexer.lexEOS;if(n.charCodeAt(0)==92){e.escapeCharacter();continue}if(n==":")return t.QueryLexer.lexField;if(n=="~")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexEditDistance;if(n=="^")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexBoost;if(n=="+"&&e.width()===1||n=="-"&&e.width()===1)return e.emit(t.QueryLexer.PRESENCE),t.QueryLexer.lexText;if(n.match(t.QueryLexer.termSeparator))return t.QueryLexer.lexTerm}},t.QueryParser=function(e,n){this.lexer=new t.QueryLexer(e),this.query=n,this.currentClause={},this.lexemeIdx=0},t.QueryParser.prototype.parse=function(){this.lexer.run(),this.lexemes=this.lexer.lexemes;for(var e=t.QueryParser.parseClause;e;)e=e(this);return this.query},t.QueryParser.prototype.peekLexeme=function(){return this.lexemes[this.lexemeIdx]},t.QueryParser.prototype.consumeLexeme=function(){var e=this.peekLexeme();return this.lexemeIdx+=1,e},t.QueryParser.prototype.nextClause=function(){var e=this.currentClause;this.query.clause(e),this.currentClause={}},t.QueryParser.parseClause=function(e){var n=e.peekLexeme();if(n!=null)switch(n.type){case t.QueryLexer.PRESENCE:return t.QueryParser.parsePresence;case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var r="expected either a field or a term, found "+n.type;throw n.str.length>=1&&(r+=" with value '"+n.str+"'"),new t.QueryParseError(r,n.start,n.end)}},t.QueryParser.parsePresence=function(e){var n=e.consumeLexeme();if(n!=null){switch(n.str){case"-":e.currentClause.presence=t.Query.presence.PROHIBITED;break;case"+":e.currentClause.presence=t.Query.presence.REQUIRED;break;default:var r="unrecognised presence operator'"+n.str+"'";throw new t.QueryParseError(r,n.start,n.end)}var i=e.peekLexeme();if(i==null){var r="expecting term or field, found nothing";throw new t.QueryParseError(r,n.start,n.end)}switch(i.type){case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var r="expecting term or field, found '"+i.type+"'";throw new t.QueryParseError(r,i.start,i.end)}}},t.QueryParser.parseField=function(e){var n=e.consumeLexeme();if(n!=null){if(e.query.allFields.indexOf(n.str)==-1){var r=e.query.allFields.map(function(o){return"'"+o+"'"}).join(", "),i="unrecognised field '"+n.str+"', possible fields: "+r;throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.fields=[n.str];var s=e.peekLexeme();if(s==null){var i="expecting term, found nothing";throw new t.QueryParseError(i,n.start,n.end)}switch(s.type){case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var i="expecting term, found '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseTerm=function(e){var n=e.consumeLexeme();if(n!=null){e.currentClause.term=n.str.toLowerCase(),n.str.indexOf("*")!=-1&&(e.currentClause.usePipeline=!1);var r=e.peekLexeme();if(r==null){e.nextClause();return}switch(r.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+r.type+"'";throw new t.QueryParseError(i,r.start,r.end)}}},t.QueryParser.parseEditDistance=function(e){var n=e.consumeLexeme();if(n!=null){var r=parseInt(n.str,10);if(isNaN(r)){var i="edit distance must be numeric";throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.editDistance=r;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseBoost=function(e){var n=e.consumeLexeme();if(n!=null){var r=parseInt(n.str,10);if(isNaN(r)){var i="boost must be numeric";throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.boost=r;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},function(e,n){typeof define=="function"&&define.amd?define(n):typeof oe=="object"?ae.exports=n():e.lunr=n()}(this,function(){return t})})()});var ie=[];function G(t,e){ie.push({selector:e,constructor:t})}var U=class{constructor(){this.alwaysVisibleMember=null;this.createComponents(document.body),this.ensureFocusedElementVisible(),this.listenForCodeCopies(),window.addEventListener("hashchange",()=>this.ensureFocusedElementVisible()),document.body.style.display||(this.ensureFocusedElementVisible(),this.updateIndexVisibility(),this.scrollToHash())}createComponents(e){ie.forEach(n=>{e.querySelectorAll(n.selector).forEach(r=>{r.dataset.hasInstance||(new n.constructor({el:r,app:this}),r.dataset.hasInstance=String(!0))})})}filterChanged(){this.ensureFocusedElementVisible()}showPage(){document.body.style.display&&(document.body.style.removeProperty("display"),this.ensureFocusedElementVisible(),this.updateIndexVisibility(),this.scrollToHash())}scrollToHash(){if(location.hash){console.log("Scorlling");let e=document.getElementById(location.hash.substring(1));if(!e)return;e.scrollIntoView({behavior:"instant",block:"start"})}}ensureActivePageVisible(){let e=document.querySelector(".tsd-navigation .current"),n=e?.parentElement;for(;n&&!n.classList.contains(".tsd-navigation");)n instanceof HTMLDetailsElement&&(n.open=!0),n=n.parentElement;if(e&&!e.checkVisibility()){let r=e.getBoundingClientRect().top-document.documentElement.clientHeight/4;document.querySelector(".site-menu").scrollTop=r}}updateIndexVisibility(){let e=document.querySelector(".tsd-index-content"),n=e?.open;e&&(e.open=!0),document.querySelectorAll(".tsd-index-section").forEach(r=>{r.style.display="block";let i=Array.from(r.querySelectorAll(".tsd-index-link")).every(s=>s.offsetParent==null);r.style.display=i?"none":"block"}),e&&(e.open=n)}ensureFocusedElementVisible(){if(this.alwaysVisibleMember&&(this.alwaysVisibleMember.classList.remove("always-visible"),this.alwaysVisibleMember.firstElementChild.remove(),this.alwaysVisibleMember=null),!location.hash)return;let e=document.getElementById(location.hash.substring(1));if(!e)return;let n=e.parentElement;for(;n&&n.tagName!=="SECTION";)n=n.parentElement;if(n&&n.offsetParent==null){this.alwaysVisibleMember=n,n.classList.add("always-visible");let r=document.createElement("p");r.classList.add("warning"),r.textContent="This member is normally hidden due to your filter settings.",n.prepend(r)}}listenForCodeCopies(){document.querySelectorAll("pre > button").forEach(e=>{let n;e.addEventListener("click",()=>{e.previousElementSibling instanceof HTMLElement&&navigator.clipboard.writeText(e.previousElementSibling.innerText.trim()),e.textContent="Copied!",e.classList.add("visible"),clearTimeout(n),n=setTimeout(()=>{e.classList.remove("visible"),n=setTimeout(()=>{e.textContent="Copy"},100)},1e3)})})}};var se=(t,e=100)=>{let n;return()=>{clearTimeout(n),n=setTimeout(()=>t(),e)}};var he=Ae(le());async function ue(t,e){if(!window.searchData)return;let n=await fetch(window.searchData),r=new Blob([await n.arrayBuffer()]).stream().pipeThrough(new DecompressionStream("gzip")),i=await new Response(r).json();t.data=i,t.index=he.Index.load(i.index),e.classList.remove("loading"),e.classList.add("ready")}function pe(){let t=document.getElementById("tsd-search");if(!t)return;let e={base:t.dataset.base+"/"},n=document.getElementById("tsd-search-script");t.classList.add("loading"),n&&(n.addEventListener("error",()=>{t.classList.remove("loading"),t.classList.add("failure")}),n.addEventListener("load",()=>{ue(e,t)}),ue(e,t));let r=document.querySelector("#tsd-search input"),i=document.querySelector("#tsd-search .results");if(!r||!i)throw new Error("The input field or the result list wrapper was not found");i.addEventListener("mouseup",()=>{ee(t)}),r.addEventListener("focus",()=>t.classList.add("has-focus")),Ve(t,i,r,e)}function Ve(t,e,n,r){n.addEventListener("input",se(()=>{Ne(t,e,n,r)},200)),n.addEventListener("keydown",i=>{i.key=="Enter"?He(e,t):i.key=="ArrowUp"?(ce(e,n,-1),i.preventDefault()):i.key==="ArrowDown"&&(ce(e,n,1),i.preventDefault())}),document.body.addEventListener("keypress",i=>{i.altKey||i.ctrlKey||i.metaKey||!n.matches(":focus")&&i.key==="/"&&(i.preventDefault(),n.focus())}),document.body.addEventListener("keyup",i=>{t.classList.contains("has-focus")&&(i.key==="Escape"||!e.matches(":focus-within")&&!n.matches(":focus"))&&(n.blur(),ee(t))})}function ee(t){t.classList.remove("has-focus")}function Ne(t,e,n,r){if(!r.index||!r.data)return;e.textContent="";let i=n.value.trim(),s;if(i){let o=i.split(" ").map(a=>a.length?`*${a}*`:"").join(" ");s=r.index.search(o)}else s=[];for(let o=0;oa.score-o.score);for(let o=0,a=Math.min(10,s.length);o`,d=de(l.name,i);globalThis.DEBUG_SEARCH_WEIGHTS&&(d+=` (score: ${s[o].score.toFixed(2)})`),l.parent&&(d=` + ${de(l.parent,i)}.${d}`);let m=document.createElement("li");m.classList.value=l.classes??"";let p=document.createElement("a");p.href=r.base+l.url,p.innerHTML=u+d,m.append(p),p.addEventListener("focus",()=>{e.querySelector(".current")?.classList.remove("current"),m.classList.add("current")}),e.appendChild(m)}}function ce(t,e,n){let r=t.querySelector(".current");if(!r)r=t.querySelector(n==1?"li:first-child":"li:last-child"),r&&r.classList.add("current");else{let i=r;if(n===1)do i=i.nextElementSibling??void 0;while(i instanceof HTMLElement&&i.offsetParent==null);else do i=i.previousElementSibling??void 0;while(i instanceof HTMLElement&&i.offsetParent==null);i?(r.classList.remove("current"),i.classList.add("current")):n===-1&&(r.classList.remove("current"),e.focus())}}function He(t,e){let n=t.querySelector(".current");if(n||(n=t.querySelector("li:first-child")),n){let r=n.querySelector("a");r&&(window.location.href=r.href),ee(e)}}function de(t,e){if(e==="")return t;let n=t.toLocaleLowerCase(),r=e.toLocaleLowerCase(),i=[],s=0,o=n.indexOf(r);for(;o!=-1;)i.push(K(t.substring(s,o)),`${K(t.substring(o,o+r.length))}`),s=o+r.length,o=n.indexOf(r,s);return i.push(K(t.substring(s))),i.join("")}var Be={"&":"&","<":"<",">":">","'":"'",'"':"""};function K(t){return t.replace(/[&<>"'"]/g,e=>Be[e])}var I=class{constructor(e){this.el=e.el,this.app=e.app}};var F="mousedown",me="mousemove",H="mouseup",J={x:0,y:0},fe=!1,te=!1,je=!1,D=!1,ye=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);document.documentElement.classList.add(ye?"is-mobile":"not-mobile");ye&&"ontouchstart"in document.documentElement&&(je=!0,F="touchstart",me="touchmove",H="touchend");document.addEventListener(F,t=>{te=!0,D=!1;let e=F=="touchstart"?t.targetTouches[0]:t;J.y=e.pageY||0,J.x=e.pageX||0});document.addEventListener(me,t=>{if(te&&!D){let e=F=="touchstart"?t.targetTouches[0]:t,n=J.x-(e.pageX||0),r=J.y-(e.pageY||0);D=Math.sqrt(n*n+r*r)>10}});document.addEventListener(H,()=>{te=!1});document.addEventListener("click",t=>{fe&&(t.preventDefault(),t.stopImmediatePropagation(),fe=!1)});var X=class extends I{constructor(e){super(e),this.className=this.el.dataset.toggle||"",this.el.addEventListener(H,n=>this.onPointerUp(n)),this.el.addEventListener("click",n=>n.preventDefault()),document.addEventListener(F,n=>this.onDocumentPointerDown(n)),document.addEventListener(H,n=>this.onDocumentPointerUp(n))}setActive(e){if(this.active==e)return;this.active=e,document.documentElement.classList.toggle("has-"+this.className,e),this.el.classList.toggle("active",e);let n=(this.active?"to-has-":"from-has-")+this.className;document.documentElement.classList.add(n),setTimeout(()=>document.documentElement.classList.remove(n),500)}onPointerUp(e){D||(this.setActive(!0),e.preventDefault())}onDocumentPointerDown(e){if(this.active){if(e.target.closest(".col-sidebar, .tsd-filter-group"))return;this.setActive(!1)}}onDocumentPointerUp(e){if(!D&&this.active&&e.target.closest(".col-sidebar")){let n=e.target.closest("a");if(n){let r=window.location.href;r.indexOf("#")!=-1&&(r=r.substring(0,r.indexOf("#"))),n.href.substring(0,r.length)==r&&setTimeout(()=>this.setActive(!1),250)}}}};var ne;try{ne=localStorage}catch{ne={getItem(){return null},setItem(){}}}var Q=ne;var ve=document.head.appendChild(document.createElement("style"));ve.dataset.for="filters";var Y=class extends I{constructor(e){super(e),this.key=`filter-${this.el.name}`,this.value=this.el.checked,this.el.addEventListener("change",()=>{this.setLocalStorage(this.el.checked)}),this.setLocalStorage(this.fromLocalStorage()),ve.innerHTML+=`html:not(.${this.key}) .tsd-is-${this.el.name} { display: none; } +`,this.app.updateIndexVisibility()}fromLocalStorage(){let e=Q.getItem(this.key);return e?e==="true":this.el.checked}setLocalStorage(e){Q.setItem(this.key,e.toString()),this.value=e,this.handleValueChange()}handleValueChange(){this.el.checked=this.value,document.documentElement.classList.toggle(this.key,this.value),this.app.filterChanged(),this.app.updateIndexVisibility()}};var Z=class extends I{constructor(e){super(e),this.summary=this.el.querySelector(".tsd-accordion-summary"),this.icon=this.summary.querySelector("svg"),this.key=`tsd-accordion-${this.summary.dataset.key??this.summary.textContent.trim().replace(/\s+/g,"-").toLowerCase()}`;let n=Q.getItem(this.key);this.el.open=n?n==="true":this.el.open,this.el.addEventListener("toggle",()=>this.update());let r=this.summary.querySelector("a");r&&r.addEventListener("click",()=>{location.assign(r.href)}),this.update()}update(){this.icon.style.transform=`rotate(${this.el.open?0:-90}deg)`,Q.setItem(this.key,this.el.open.toString())}};function xe(t){let e=Q.getItem("tsd-theme")||"os";t.value=e,ge(e),t.addEventListener("change",()=>{Q.setItem("tsd-theme",t.value),ge(t.value)})}function ge(t){document.documentElement.dataset.theme=t}var be;function we(){let t=document.getElementById("tsd-nav-script");t&&(t.addEventListener("load",Ee),Ee())}async function Ee(){let t=document.getElementById("tsd-nav-container");if(!t||!window.navigationData)return;let n=await(await fetch(window.navigationData)).arrayBuffer(),r=new Blob([n]).stream().pipeThrough(new DecompressionStream("gzip")),i=await new Response(r).json();be=t.dataset.base+"/",t.innerHTML="";for(let s of i)Se(s,t,[]);window.app.createComponents(t),window.app.showPage(),window.app.ensureActivePageVisible()}function Se(t,e,n){let r=e.appendChild(document.createElement("li"));if(t.children){let i=[...n,t.text],s=r.appendChild(document.createElement("details"));s.className=t.class?`${t.class} tsd-index-accordion`:"tsd-index-accordion",s.dataset.key=i.join("$");let o=s.appendChild(document.createElement("summary"));o.className="tsd-accordion-summary",o.innerHTML='',Le(t,o);let a=s.appendChild(document.createElement("div"));a.className="tsd-accordion-details";let l=a.appendChild(document.createElement("ul"));l.className="tsd-nested-navigation";for(let u of t.children)Se(u,l,i)}else Le(t,r,t.class)}function Le(t,e,n){if(t.path){let r=e.appendChild(document.createElement("a"));r.href=be+t.path,n&&(r.className=n),location.pathname===r.pathname&&r.classList.add("current"),t.kind&&(r.innerHTML=``),r.appendChild(document.createElement("span")).textContent=t.text}else e.appendChild(document.createElement("span")).textContent=t.text}G(X,"a[data-toggle]");G(Z,".tsd-index-accordion");G(Y,".tsd-filter-item input[type=checkbox]");var Te=document.getElementById("tsd-theme");Te&&xe(Te);var qe=new U;Object.defineProperty(window,"app",{value:qe});pe();we();})(); /*! Bundled license information: lunr/lunr.js: diff --git a/docs/assets/navigation.js b/docs/assets/navigation.js index 18c3aae..4fc2484 100644 --- a/docs/assets/navigation.js +++ b/docs/assets/navigation.js @@ -1 +1 @@ -window.navigationData = "data:application/octet-stream;base64,H4sIAAAAAAAAA62bT2/cNhDFv8v26rpJOG2R3IwmhwJ208aukTTIgZHoNRv9W4larFPkuxciJa2UFWe4HB0tvvespShpfqDm438bow5m82qTSyM2F5tKmsfurzJtM9X81B29fDR5trnYfNFFunkFF5vkUWdprYrNq4+jPVUPss0MkvDDUdInPX8J4hl8uxhDbqQR1/qL+s2U9THJPFVDzlQwP60Xz17++vznF5OwJCsLdUx5aIvE6LLok+zoPOKX6akkZfXkN5fVE+atlTTIv7bDiD9VRtW5LmRhvCETDZKkdq3MGm+IGyb9V1VVlwedS6My/6QsaJHkh7rMb6QBb9wgIDL+aqV/kgYBkrFV5uqg/VPUj+MJt4nMdLHFQnoJnnNXy6LJZOfEsiYyJE+nqjDa+C/YIMAyir2qG/9S7sepBP8VcsOIP28zrzlvM9xpdIUs2EGAZBRqi93Jbhjx16XB/G6Y8mOrYRAgGU0iM/8p2FHCjS3thlzXjfJf/kZh174h7s2GvDcbZV67t87dU4VMwkyG54Xco03oPWp6lf/URkVACnZKJvx8qhK540cFktIW+qGs81t04U1FYVnYMpzLTvI+TZ8Ls7fOpEz57lUTUejAGYUOIIUOXE4FVKEjde6ZF7iUOkcmVx508w57RMHlURKS41+BkyR8CSYyV7W8Qn7TqMBSkOIPOMUfsIo/WKP4gzWKP1iz+IO44k944wZBfPEHIcXfQ902pvWvtH6cTninbB30D5U06KILUlijIIUVC1JYrSAFfkEK3IIU6II0K8svV36/G44qaIFX0AK7oAW6oC1r81h67XYUcVeqbiqVGL33n8JEE5ZE3nsL2tiSHQJLdvWeCHhPJnwgEj6QCf4Z6cfjwQNCwGOQEHPRKQJSiPnoFAEpxJx0ikiUAiZKAQulgIVSsBZKwcooBeuhFK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sEn5sEh5sEh5vW63SZhK3BTYLPTSKMm5DPCm0I97PCIWSNzwqHrMDPClEi5PWoHAPiiFAwiFDwiFCwiVAwiVBwiFAwiFDwiFDwiFBEE2FARxPxjF6BCJl9UTaBTYSCT4QilAgX91xdAGfPdZIQuec6ScD3XP1cKlhcGtAd5uXSgN4umkvP68xCuVQwuVTwuFSsxaViVS4VZ3DpRPd3ValaHMLOcVSHpPs6OuapRFsHwdCCydAiiKEXesy6o2yGDu4x8zM0MBkaghgaoWDgUDCwKDi++cuZGRQc0vzl51hgcSywORZW4VjgciwwORb4HAscjgUOx67XtDcJW4Njgc+xsMb+H68B7BgQR3vAoD3g0R6waQ+YtAcc2gMG7QGP9oBHexBNewHtfsSTbAXaYzYN2gQ27UHgF7J+zgEW5wS0bnk5J6Dxiuac89qmUM4BJucAj3PgXM7xkQmstWMGzGof6Gp/jmuu86g79uPzue2022g+AaMTaOcclJyzO0Y772ffRTpndyzIefI7u2NBzpPf2R2jnfT9Q9w6n/4H5X0ML+NMAAA=" \ No newline at end of file +window.navigationData = "data:application/octet-stream;base64,H4sIAAAAAAAAA7WdQZPbxhFG/8ueFTtWd5KKb5tEh1TJcSIpKjsuH+BtaIWYbHBBcGvllP97CgDBBUVMT3O+9lHAdAscgtjv1TwOf/jfTV8/9Tdf32yrnm5e3Oyq/uPwr1YOm3r/5XD0i4/9dnPz4ubnRuXma35xc/ex2UhX683XP5zK7zat1s/1Hw561zetHjuMZ8/7/JF/ffFc3e4+pYvb3Sertqur3vivx9NGvdR93W0brbRPNlmMMTrVD4dqs082mU5n6293u659arZVX2/Sk7Iy1uj8oWu331Q9J9vNAzI9/nWo0pM0DzB63Nf97VOTnqLjebvD27tq0+i91eQ4xO7zrqt0v6mGSqvXYpjRr5Fa+6ZPv2HzAKuHPtbdPn0rH8/nOqTfoem0Ub89bJLF28PGruybnXHDzgOMHlrfW5/k6bRR37W9VT+dztVbd8M8wOixv6s26UsYz2aqrVt7n72v93X67d/X1nu/z3w299nP5t73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2ayV+qfX3b3b/7tFtcRv9pV++/XJw6b/Hy93/+01d/ePlZl7/2y7+Wzy2G47n6c2dpqh2O/e4rT+Vtd79WfNvde6rXXvp83FMva8Xiu3Jdq1VXLa+Usq9yfb7YN1+cmC92zhevzRf75ovX5osd83WuhU2lwzFf5cp8HQ97qtfmaz7uqb+Yr/Gg78ov5ms8mK99c/yx9W87qS8+1Gcnc53en/0s89RgOJa/hmHUyswfD3uq12Z+Pu6pv5j58aDvyi9mfjzoqr14Eg7HfJXr8+V5Eg7DEvPlehK+P9+A5rnYN1+XT8LxoKv24kk4HPNVrs+X50k4DEvMl+tJ+P58Ffq52Ddfl0/C8WCq9sf/A7RSHgkj2gAA" \ No newline at end of file diff --git a/docs/assets/search.js b/docs/assets/search.js index 3507f1a..0c02a2b 100644 --- a/docs/assets/search.js +++ b/docs/assets/search.js @@ -1 +1 @@ -window.searchData = "data:application/octet-stream;base64,H4sIAAAAAAAAA62d3ZLjNpKF30W+1baFBPjXd44dX0yEvbM79jp2tsLh0FTRZY1VUrWk6m3b4XffQJJQAVl5QJDqK7dFMBNEApkHnyjUH6vT8f/Oq/d3f6x+3R0eVu9rt14dtk/96v3q3F/+0v+8fdlfvv/tuV+tVy+n/er96ueXw/1ldzycv0wbvPvl8rRfrVf3++353J9X71erP9fBLG26xlR0tf3t9mKvFi+/PffnL/1H/2ayVl779hTf/3R8eNn35y/9h9n75zwcG5t8wvXqeXvqD5fQJdXX/anfXqCP4epS2+f+kun8Uqs/n45P324vDpkO12+x/18vW9j1cH2p/UP/mBnx4eriaB6ff4OxPD7/ttRu/+Fluz9/9fx8On7aPW0v/R66UZre5jXvaKnt3UN/uOwu8DHC9aX2L6ft4fx8PMNAXxssfoLDx/6E7Y+Xl1p/6C/96Wl32B7gQoiaLPXy9LK/7J7xZArXb8hA3/tx3m+90Uwyilot9fVY5Ovxc/n66tMOLo3x8g2jlrN+vs36Y3/57n673x0eM90fW9y0+vKBuNwehWAiv8b3N+Tz0/GSfYhw/Sb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floNIUYTsD8l9ZERm/KgchnUGv054uexShtzEOQFyKv7D03FJjBd3KBIGQsfhD0vHQxl77a6gFgV0+PMgcSzjKXXdMlZoUg3nSUfyNE7qQYNRKJfUqtnjx/Xqeffc73eHfvX+7sc///x/l3dzvj/EAAA="; \ No newline at end of file +window.searchData = "data:application/octet-stream;base64,H4sIAAAAAAAAA62dXZPjynGm/0v7tnfE+gbPnbzrC0dY611LVqx3QqGgmtSo7W6yT3/MHumE/vsGCkw0kHgzkQWeq5lokllAIVGVmU9VvT/fvV7+39vdD19/vvuvx/Px7ge/2xeX/P3d+fB8uvvh7h8Pb6f//n55vbu/+3h9uvvh7v2vL6e3X9Gfv/zl/fnp7v7u4enw9nZ6u/vh7u7v92QruU87f/xj/0PNyj+MX5kYu797Obyezu/TK/lsgF/sbw7vgTXR/+m/OfUygZW4tBIbrfzvj8M7s9L/qdHK708Pnlnp/9RuhfdL/6d2K7xf+j+19244god03PCUgJ3Yaqd/KNxO/duGJ8Xt1L9teFbATnP/9I8G2Gnun/7ZnMHzOm94XsBObLXTPxtup/5tw/PidurfNjwvYKe5f/pnA+ys9k8cLTxPx63ny/Hj6fT2q/6P6u/zp4GH19Ph/XOM/vPH+eH98XK+Ghk+BbYmY3S9BGj77fQuGX47vW+1+ufXy/Ns0Gem6fNb7M8GcmC//3yr/fPpm9Ljw6dbbT9cXv4qPsvLy1832326nGUn6T/cavn048fh6e3XLy+vl58enw/vpyfxBsBXb2tVb2ir7cfj6fz++C7eBn2+1f776+H89nJ5E5/H+IXNd3D+fnqV7V8/3mr9eHo/vT4/ng9n8RWbfOWmexAbGD7davv54+n98UV2VPr8BvuK6RtG49/1nvF06O0pA/PkW1vb+mZq69sv1davf3oUX+brxzf0mmb97Tbr307vv304PD2evymXf/3G1jZeTq9vL6eH98fv4hs9+cov0Mq/ner48H8NrdFXt7Z6eX3/y0Vqp364PQr4eHv/eJaDgPrxjdbXeop9bWtrh0fxPg6Pm+/h4fB8ej38WrY9fmFrC0+Xy3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YL42YxuHkJ46ybUcRoSdfCmPhiSp3kRhAGlfuUoSVySMKIYTS2Z7/+wUvPpk+rXHt6bjkNNi8oLr0ny+vi9Uc/Uk/k3eNsvuR09AMl0YqQxNbybaBd9p0nDc9fRDdGAuOr/lYGiFX2Y+v+Vj/oFgwj6+5zTFmV/Xx8nJ6DT/NO8ZNZ4iRBY7ALzd2PE92+xOSJvbH1Qljbc3oNdexar5LZpIVjXBqJCNjMjQikjEHsgUmwvgYJ7POiO7GvSXjrDNuMhlnHVsUXFt9uTCKP7nTcc/WuPyf7vRzaT/dqXHZ/vvrx/mBdW6/OXvitlTjo/qiH3fAfa6moHeIBr/yuZqC5hHj1PtxfuydaRkaTpI9Gpw+94zQQPa5H4SGLeM6vUmzPGqbBPREcMdtFzSKhM8tFeN2RNtr+vH+OF826qbsqjM67PfTg5+9HxNHvY76xgpRb2lRaZrGPcbxuLfDti9MJyWak21vRm9sHopNx/QxD7F5WG9sWWmabl6Ltnfn++lhNqBOBnuqlBu3U/WWFp0+3e1h3Nva25l3+mzJBb225k5nUHUWtNKLbu70JVSd7kLpovmqZnPsxBHGHUTmx7ekqtM6YbBNUL2deadPF+SMJM82DvXG5p0+HYvHkN9+ZctOn9Znom14+dvpdb4UejclqxSwe0qfPYWIcVwZRTFnotm6UKhZaDTvLGnEH+7vXh5fTk+P59PdD1//8Pe//3+GYLB9pUkCAA=="; \ No newline at end of file diff --git a/docs/assets/style.css b/docs/assets/style.css index 778b949..cb62f61 100644 --- a/docs/assets/style.css +++ b/docs/assets/style.css @@ -10,6 +10,7 @@ --light-color-text: #222; --light-color-text-aside: #6e6e6e; --light-color-link: #1f70c2; + --light-color-focus-outline: #3584e4; --light-color-ts-keyword: #056bd6; --light-color-ts-project: #b111c9; @@ -35,6 +36,7 @@ --light-color-ts-set-signature: var(--light-color-ts-accessor); --light-color-ts-type-alias: #d51270; /* reference not included as links will be colored with the kind that it points to */ + --light-color-document: #000000; --light-external-icon: url("data:image/svg+xml;utf8,"); --light-color-scheme: light; @@ -50,6 +52,7 @@ --dark-color-text: #f5f5f5; --dark-color-text-aside: #dddddd; --dark-color-link: #00aff4; + --dark-color-focus-outline: #4c97f2; --dark-color-ts-keyword: #3399ff; --dark-color-ts-project: #e358ff; @@ -75,6 +78,7 @@ --dark-color-ts-set-signature: var(--dark-color-ts-accessor); --dark-color-ts-type-alias: #ff6492; /* reference not included as links will be colored with the kind that it points to */ + --dark-color-document: #ffffff; --dark-external-icon: url("data:image/svg+xml;utf8,"); --dark-color-scheme: dark; @@ -92,6 +96,7 @@ --color-text: var(--light-color-text); --color-text-aside: var(--light-color-text-aside); --color-link: var(--light-color-link); + --color-focus-outline: var(--light-color-focus-outline); --color-ts-keyword: var(--light-color-ts-keyword); --color-ts-module: var(--light-color-ts-module); @@ -116,6 +121,7 @@ --color-ts-get-signature: var(--light-color-ts-get-signature); --color-ts-set-signature: var(--light-color-ts-set-signature); --color-ts-type-alias: var(--light-color-ts-type-alias); + --color-document: var(--light-color-document); --external-icon: var(--light-external-icon); --color-scheme: var(--light-color-scheme); @@ -134,6 +140,7 @@ --color-text: var(--dark-color-text); --color-text-aside: var(--dark-color-text-aside); --color-link: var(--dark-color-link); + --color-focus-outline: var(--dark-color-focus-outline); --color-ts-keyword: var(--dark-color-ts-keyword); --color-ts-module: var(--dark-color-ts-module); @@ -158,6 +165,7 @@ --color-ts-get-signature: var(--dark-color-ts-get-signature); --color-ts-set-signature: var(--dark-color-ts-set-signature); --color-ts-type-alias: var(--dark-color-ts-type-alias); + --color-document: var(--dark-color-document); --external-icon: var(--dark-external-icon); --color-scheme: var(--dark-color-scheme); @@ -183,6 +191,7 @@ body { --color-text: var(--light-color-text); --color-text-aside: var(--light-color-text-aside); --color-link: var(--light-color-link); + --color-focus-outline: var(--light-color-focus-outline); --color-ts-keyword: var(--light-color-ts-keyword); --color-ts-module: var(--light-color-ts-module); @@ -207,6 +216,7 @@ body { --color-ts-get-signature: var(--light-color-ts-get-signature); --color-ts-set-signature: var(--light-color-ts-set-signature); --color-ts-type-alias: var(--light-color-ts-type-alias); + --color-document: var(--light-color-document); --external-icon: var(--light-external-icon); --color-scheme: var(--light-color-scheme); @@ -223,6 +233,7 @@ body { --color-text: var(--dark-color-text); --color-text-aside: var(--dark-color-text-aside); --color-link: var(--dark-color-link); + --color-focus-outline: var(--dark-color-focus-outline); --color-ts-keyword: var(--dark-color-ts-keyword); --color-ts-module: var(--dark-color-ts-module); @@ -247,11 +258,17 @@ body { --color-ts-get-signature: var(--dark-color-ts-get-signature); --color-ts-set-signature: var(--dark-color-ts-set-signature); --color-ts-type-alias: var(--dark-color-ts-type-alias); + --color-document: var(--dark-color-document); --external-icon: var(--dark-external-icon); --color-scheme: var(--dark-color-scheme); } +*:focus-visible, +.tsd-accordion-summary:focus-visible svg { + outline: 2px solid var(--color-focus-outline); +} + .always-visible, .always-visible .tsd-signatures { display: inherit !important; @@ -266,16 +283,6 @@ h6 { line-height: 1.2; } -h1 > a:not(.link), -h2 > a:not(.link), -h3 > a:not(.link), -h4 > a:not(.link), -h5 > a:not(.link), -h6 > a:not(.link) { - text-decoration: none; - color: var(--color-text); -} - h1 { font-size: 1.875rem; margin: 0.67rem 0; @@ -306,10 +313,6 @@ h6 { margin: 2.33rem 0; } -.uppercase { - text-transform: uppercase; -} - dl, menu, ol, @@ -333,7 +336,7 @@ footer { padding-bottom: 1rem; max-height: 3.5rem; } -.tsd-generator { +footer > p { margin: 0 1em; } @@ -421,6 +424,9 @@ a.external[target="_blank"] { background-repeat: no-repeat; padding-right: 13px; } +a.tsd-anchor-link { + color: var(--color-text); +} code, pre { @@ -580,13 +586,13 @@ dl.tsd-comment-tag-group p { } .tsd-filter-input { display: flex; - width: fit-content; width: -moz-fit-content; + width: fit-content; align-items: center; - user-select: none; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; + user-select: none; cursor: pointer; } .tsd-filter-input input[type="checkbox"] { @@ -609,11 +615,8 @@ dl.tsd-comment-tag-group p { Don't remove unless you know what you're doing. */ opacity: 0.99; } -.tsd-filter-input input[type="checkbox"]:focus + svg { - transform: scale(0.95); -} -.tsd-filter-input input[type="checkbox"]:focus:not(:focus-visible) + svg { - transform: scale(1); +.tsd-filter-input input[type="checkbox"]:focus-visible + svg { + outline: 2px solid var(--color-focus-outline); } .tsd-checkbox-background { fill: var(--color-accent); @@ -630,13 +633,18 @@ input[type="checkbox"]:checked ~ svg .tsd-checkbox-checkmark { stroke: var(--color-accent); } -.tsd-theme-toggle { - padding-top: 0.75rem; +.settings-label { + font-weight: bold; + text-transform: uppercase; + display: inline-block; } -.tsd-theme-toggle > h4 { - display: inline; - vertical-align: middle; - margin-right: 0.75rem; + +.tsd-filter-visibility .settings-label { + margin: 0.75rem 0 0.5rem 0; +} + +.tsd-theme-toggle .settings-label { + margin: 0.75rem 0.75rem 0 0; } .tsd-hierarchy { @@ -769,6 +777,9 @@ input[type="checkbox"]:checked ~ svg .tsd-checkbox-checkmark { padding: 0; max-width: 100%; } +.tsd-navigation .tsd-nav-link { + display: none; +} .tsd-nested-navigation { margin-left: 3rem; } @@ -812,10 +823,10 @@ a.tsd-index-link { } .tsd-accordion-summary, .tsd-accordion-summary a { - user-select: none; -moz-user-select: none; -webkit-user-select: none; -ms-user-select: none; + user-select: none; cursor: pointer; } @@ -1347,6 +1358,12 @@ img { .has-menu .tsd-navigation { max-height: 100%; } + #tsd-toolbar-links { + display: none; + } + .tsd-navigation .tsd-nav-link { + display: flex; + } } /* one sidebar */ diff --git a/docs/functions/mat3.clone.html b/docs/functions/mat3.clone.html index 0a3e13f..07cdefa 100644 --- a/docs/functions/mat3.clone.html +++ b/docs/functions/mat3.clone.html @@ -1,6 +1,6 @@ -clone | wgpu-matrix

Function clone

\ No newline at end of file +clone | wgpu-matrix

Function clone

\ No newline at end of file diff --git a/docs/functions/mat3.copy.html b/docs/functions/mat3.copy.html index 4a08163..ac41466 100644 --- a/docs/functions/mat3.copy.html +++ b/docs/functions/mat3.copy.html @@ -1,6 +1,6 @@ -copy | wgpu-matrix

Function copy

\ No newline at end of file +copy | wgpu-matrix

Function copy

\ No newline at end of file diff --git a/docs/functions/mat3.create.html b/docs/functions/mat3.create.html index 250672d..d993110 100644 --- a/docs/functions/mat3.create.html +++ b/docs/functions/mat3.create.html @@ -1,17 +1,11 @@ -create | wgpu-matrix

Function create

  • Create a Mat3 from values

    +create | wgpu-matrix

    Function create

    • Create a Mat3 from values

      Note: Since passing in a raw JavaScript array is valid in all circumstances, if you want to -force a JavaScript array into a Mat3's specified type +force a JavaScript array into a Mat3's specified type it would be faster to use

      const m = mat3.clone(someJSArray);
       
      -

      Note: a consequence of the implementation is if your Mat3Type = Array -instead of Float32Array or Float64Array then any values you -don't pass in will be undefined. Usually this is not an issue since -(a) using Array is rare and (b) using mat3.create is usually used -to create a Mat3 to be filled out as in

      -
      const m = mat3.create();
      mat3.perspective(fov, aspect, near, far, m); -
      +

      Parameters

      • Optional v0: number

        value for element 0

      • Optional v1: number

        value for element 1

      • Optional v2: number

        value for element 2

        @@ -21,5 +15,5 @@
      • Optional v6: number

        value for element 6

      • Optional v7: number

        value for element 7

      • Optional v8: number

        value for element 8

        -

      Returns Mat3

      matrix created from values.

      -
    \ No newline at end of file +

Returns Float32Array

matrix created from values.

+
\ No newline at end of file diff --git a/docs/functions/mat3.determinant.html b/docs/functions/mat3.determinant.html index fe629ae..3b0c23d 100644 --- a/docs/functions/mat3.determinant.html +++ b/docs/functions/mat3.determinant.html @@ -1,4 +1,4 @@ -determinant | wgpu-matrix

Function determinant

  • Compute the determinant of a matrix

    -

    Parameters

    • m: Mat3

      the matrix

      +determinant | wgpu-matrix

      Function determinant

      • Compute the determinant of a matrix

        +

        Parameters

        Returns number

        the determinant

        -
      \ No newline at end of file +
\ No newline at end of file diff --git a/docs/functions/mat3.equals.html b/docs/functions/mat3.equals.html index 0c94fae..5e81ac5 100644 --- a/docs/functions/mat3.equals.html +++ b/docs/functions/mat3.equals.html @@ -1,5 +1,5 @@ -equals | wgpu-matrix

Function equals

  • Check if 2 matrices are exactly equal

    -

    Parameters

    • a: Mat3

      Operand matrix.

      -
    • b: Mat3

      Operand matrix.

      +equals | wgpu-matrix

      Function equals

      • Check if 2 matrices are exactly equal

        +

        Parameters

        Returns boolean

        true if matrices are exactly equal

        -
      \ No newline at end of file +
\ No newline at end of file diff --git a/docs/functions/mat3.equalsApproximately.html b/docs/functions/mat3.equalsApproximately.html index ed7c4da..a216579 100644 --- a/docs/functions/mat3.equalsApproximately.html +++ b/docs/functions/mat3.equalsApproximately.html @@ -1,5 +1,5 @@ -equalsApproximately | wgpu-matrix

Function equalsApproximately

  • Check if 2 matrices are approximately equal

    -

    Parameters

    • a: Mat3

      Operand matrix.

      -
    • b: Mat3

      Operand matrix.

      +equalsApproximately | wgpu-matrix

      Function equalsApproximately

      • Check if 2 matrices are approximately equal

        +

        Parameters

        Returns boolean

        true if matrices are approximately equal

        -
      \ No newline at end of file +
\ No newline at end of file diff --git a/docs/functions/mat3.fromMat4.html b/docs/functions/mat3.fromMat4.html index e587fcb..62434bd 100644 --- a/docs/functions/mat3.fromMat4.html +++ b/docs/functions/mat3.fromMat4.html @@ -1,5 +1,5 @@ -fromMat4 | wgpu-matrix

Function fromMat4

  • Creates a Mat3 from the upper left 3x3 part of a Mat4

    -

    Parameters

    • m4: Mat4

      source matrix

      -
    • Optional dst: Mat3

      matrix to hold result. If not passed a new one is created.

      -

    Returns Mat3

    Mat3 made from m4

    -
\ No newline at end of file +fromMat4 | wgpu-matrix

Function fromMat4

  • Creates a Mat3 from the upper left 3x3 part of a Mat4

    +

    Type Parameters

    Parameters

    • m4: BaseArgType

      source matrix

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    Mat3 made from m4

    +
\ No newline at end of file diff --git a/docs/functions/mat3.fromQuat.html b/docs/functions/mat3.fromQuat.html index 0ddc226..cea2985 100644 --- a/docs/functions/mat3.fromQuat.html +++ b/docs/functions/mat3.fromQuat.html @@ -1,5 +1,5 @@ -fromQuat | wgpu-matrix

Function fromQuat

  • Creates a Mat3 rotation matrix from a quaternion

    -

    Parameters

    • q: Quat

      quaternion to create matrix from

      -
    • Optional dst: Mat3

      matrix to hold result. If not passed a new one is created.

      -

    Returns Mat3

    Mat3 made from q

    -
\ No newline at end of file +fromQuat | wgpu-matrix

Function fromQuat

  • Creates a Mat3 rotation matrix from a quaternion

    +

    Type Parameters

    Parameters

    • q: BaseArgType

      quaternion to create matrix from

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    Mat3 made from q

    +
\ No newline at end of file diff --git a/docs/functions/mat3.getAxis.html b/docs/functions/mat3.getAxis.html index 067fd18..e1c9e70 100644 --- a/docs/functions/mat3.getAxis.html +++ b/docs/functions/mat3.getAxis.html @@ -1,5 +1,5 @@ -getAxis | wgpu-matrix

Function getAxis

  • Returns an axis of a 3x3 matrix as a vector with 2 entries

    -

    Parameters

    • m: Mat3

      The matrix.

      +getAxis | wgpu-matrix

      Function getAxis

      • Returns an axis of a 3x3 matrix as a vector with 2 entries

        +

        Type Parameters

        Parameters

        • m: BaseArgType

          The matrix.

        • axis: number

          The axis 0 = x, 1 = y,

          -
        • Optional dst: Vec2

        Returns Vec2

        The axis component of m.

        -
      \ No newline at end of file +
    • Optional dst: T

    Returns T

    The axis component of m.

    +
\ No newline at end of file diff --git a/docs/functions/mat3.getScaling.html b/docs/functions/mat3.getScaling.html index 5df8a59..3e0046b 100644 --- a/docs/functions/mat3.getScaling.html +++ b/docs/functions/mat3.getScaling.html @@ -1,4 +1 @@ -getScaling | wgpu-matrix

Function getScaling

  • Returns the scaling component of the matrix

    -

    Parameters

    • m: Mat3

      The Matrix

      -
    • Optional dst: Vec2

      The vector to set. If not passed a new one is created.

      -

    Returns Vec2

\ No newline at end of file +getScaling | wgpu-matrix

Function getScaling

  • Type Parameters

    Parameters

    Returns Float32Array | T

\ No newline at end of file diff --git a/docs/functions/mat3.getTranslation.html b/docs/functions/mat3.getTranslation.html index ae5e1c6..a8bb210 100644 --- a/docs/functions/mat3.getTranslation.html +++ b/docs/functions/mat3.getTranslation.html @@ -1,6 +1,6 @@ -getTranslation | wgpu-matrix

Function getTranslation

  • Returns the translation component of a 3-by-3 matrix as a vector with 3 +getTranslation | wgpu-matrix

    Function getTranslation

    • Returns the translation component of a 3-by-3 matrix as a vector with 3 entries.

      -

      Parameters

      • m: Mat3

        The matrix.

        -
      • Optional dst: Vec2

        vector to hold result. If not passed a new one is created.

        -

      Returns Vec2

      The translation component of m.

      -
    \ No newline at end of file +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix.

      +
    • Optional dst: T

      vector to hold result. If not passed a new one is created.

      +

    Returns T

    The translation component of m.

    +
\ No newline at end of file diff --git a/docs/functions/mat3.identity.html b/docs/functions/mat3.identity.html index 9f36b2d..02eba45 100644 --- a/docs/functions/mat3.identity.html +++ b/docs/functions/mat3.identity.html @@ -1,4 +1,4 @@ -identity | wgpu-matrix

Function identity

  • Creates a 3-by-3 identity matrix.

    -

    Parameters

    • Optional dst: Mat3

      matrix to hold result. If not passed a new one is created.

      -

    Returns Mat3

    A 3-by-3 identity matrix.

    -
\ No newline at end of file +identity | wgpu-matrix

Function identity

  • Creates a 3-by-3 identity matrix.

    +

    Type Parameters

    Parameters

    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    A 3-by-3 identity matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat3.inverse.html b/docs/functions/mat3.inverse.html index 0ff055e..0fe0782 100644 --- a/docs/functions/mat3.inverse.html +++ b/docs/functions/mat3.inverse.html @@ -1,5 +1,5 @@ -inverse | wgpu-matrix

Function inverse

  • Computes the inverse of a 3-by-3 matrix.

    -

    Parameters

    • m: Mat3

      The matrix.

      -
    • Optional dst: Mat3

      matrix to hold result. If not passed a new one is created.

      -

    Returns Mat3

    The inverse of m.

    -
\ No newline at end of file +inverse | wgpu-matrix

Function inverse

  • Computes the inverse of a 3-by-3 matrix.

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The inverse of m.

    +
\ No newline at end of file diff --git a/docs/functions/mat3.invert.html b/docs/functions/mat3.invert.html index 7309ddb..daa1965 100644 --- a/docs/functions/mat3.invert.html +++ b/docs/functions/mat3.invert.html @@ -1,5 +1,5 @@ -invert | wgpu-matrix

Function invert

  • Computes the inverse of a 3-by-3 matrix. (same as inverse)

    -

    Parameters

    • m: Mat3

      The matrix.

      -
    • Optional dst: Mat3

      matrix to hold result. If not passed a new one is created.

      -

    Returns Mat3

    The inverse of m.

    -
\ No newline at end of file +invert | wgpu-matrix

Function invert

  • Computes the inverse of a 3-by-3 matrix.

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The inverse of m.

    +
\ No newline at end of file diff --git a/docs/functions/mat3.mul.html b/docs/functions/mat3.mul.html index 4c3598e..b3e1c10 100644 --- a/docs/functions/mat3.mul.html +++ b/docs/functions/mat3.mul.html @@ -1,6 +1,6 @@ -mul | wgpu-matrix

Function mul

  • Multiplies two 3-by-3 matrices with a on the left and b on the right (same as multiply)

    -

    Parameters

    • a: Mat3

      The matrix on the left.

      -
    • b: Mat3

      The matrix on the right.

      -
    • Optional dst: Mat3

      matrix to hold result. If not passed a new one is created.

      -

    Returns Mat3

    The matrix product of a and b.

    -
\ No newline at end of file +mul | wgpu-matrix

Function mul

  • Multiplies two 3-by-3 matrices with a on the left and b on the right

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      The matrix on the left.

      +
    • b: BaseArgType

      The matrix on the right.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The matrix product of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/mat3.multiply.html b/docs/functions/mat3.multiply.html index dc29f85..42d014a 100644 --- a/docs/functions/mat3.multiply.html +++ b/docs/functions/mat3.multiply.html @@ -1,6 +1,6 @@ -multiply | wgpu-matrix

Function multiply

  • Multiplies two 3-by-3 matrices with a on the left and b on the right

    -

    Parameters

    • a: Mat3

      The matrix on the left.

      -
    • b: Mat3

      The matrix on the right.

      -
    • Optional dst: Mat3

      matrix to hold result. If not passed a new one is created.

      -

    Returns Mat3

    The matrix product of a and b.

    -
\ No newline at end of file +multiply | wgpu-matrix

Function multiply

  • Multiplies two 3-by-3 matrices with a on the left and b on the right

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      The matrix on the left.

      +
    • b: BaseArgType

      The matrix on the right.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The matrix product of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/mat3.negate.html b/docs/functions/mat3.negate.html index 5e38698..f02f1a7 100644 --- a/docs/functions/mat3.negate.html +++ b/docs/functions/mat3.negate.html @@ -1,5 +1,5 @@ -negate | wgpu-matrix

Function negate

  • Negates a matrix.

    -

    Parameters

    • m: Mat3

      The matrix.

      -
    • Optional dst: Mat3

      matrix to hold result. If not passed a new one is created.

      -

    Returns Mat3

    -m.

    -
\ No newline at end of file +negate | wgpu-matrix

Function negate

  • Negates a matrix.

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    -m.

    +
\ No newline at end of file diff --git a/docs/functions/mat3.rotate.html b/docs/functions/mat3.rotate.html index c382fb9..eaf1566 100644 --- a/docs/functions/mat3.rotate.html +++ b/docs/functions/mat3.rotate.html @@ -1,6 +1,6 @@ -rotate | wgpu-matrix

Function rotate

  • Rotates the given 3-by-3 matrix by the given angle.

    -

    Parameters

    • m: Mat3

      The matrix.

      +rotate | wgpu-matrix

      Function rotate

      • Rotates the given 3-by-3 matrix by the given angle.

        +

        Type Parameters

        Parameters

        • m: BaseArgType

          The matrix.

        • angleInRadians: number

          The angle by which to rotate (in radians).

          -
        • Optional dst: Mat3

          matrix to hold result. If not passed a new one is created.

          -

        Returns Mat3

        The rotated matrix.

        -
      \ No newline at end of file +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The rotated matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat3.rotation.html b/docs/functions/mat3.rotation.html index 0d0799a..d291140 100644 --- a/docs/functions/mat3.rotation.html +++ b/docs/functions/mat3.rotation.html @@ -1,5 +1,5 @@ -rotation | wgpu-matrix

Function rotation

  • Creates a 3-by-3 matrix which rotates by the given angle.

    -

    Parameters

    • angleInRadians: number

      The angle by which to rotate (in radians).

      -
    • Optional dst: Mat3

      matrix to hold result. If not passed a new one is created.

      -

    Returns Mat3

    The rotation matrix.

    -
\ No newline at end of file +rotation | wgpu-matrix

Function rotation

  • Creates a 3-by-3 matrix which rotates by the given angle.

    +

    Type Parameters

    Parameters

    • angleInRadians: number

      The angle by which to rotate (in radians).

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The rotation matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat3.scale.html b/docs/functions/mat3.scale.html index eb63dee..3eef542 100644 --- a/docs/functions/mat3.scale.html +++ b/docs/functions/mat3.scale.html @@ -1,9 +1,9 @@ -scale | wgpu-matrix

Function scale

  • Scales the given 3-by-3 matrix in each dimension by an amount +scale | wgpu-matrix

    Function scale

    • Scales the given 3-by-3 matrix in each dimension by an amount given by the corresponding entry in the given vector; assumes the vector has three entries.

      -

      Parameters

      • m: Mat3

        The matrix to be modified.

        -
      • v: Vec2

        A vector of 2 entries specifying the - factor by which to scale in each dimension.

        -
      • Optional dst: Mat3

        matrix to hold result. If not passed a new one is created.

        -

      Returns Mat3

      The scaled matrix.

      -
    \ No newline at end of file +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix to be modified.

      +
    • v: BaseArgType

      A vector of 2 entries specifying the +factor by which to scale in each dimension.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The scaled matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat3.scaling.html b/docs/functions/mat3.scaling.html index 5bdaf25..236246d 100644 --- a/docs/functions/mat3.scaling.html +++ b/docs/functions/mat3.scaling.html @@ -1,8 +1,8 @@ -scaling | wgpu-matrix

Function scaling

  • Creates a 3-by-3 matrix which scales in each dimension by an amount given by +scaling | wgpu-matrix

    Function scaling

    • Creates a 3-by-3 matrix which scales in each dimension by an amount given by the corresponding entry in the given vector; assumes the vector has three entries.

      -

      Parameters

      • v: Vec2

        A vector of - 2 entries specifying the factor by which to scale in each dimension.

        -
      • Optional dst: Mat3

        matrix to hold result. If not passed a new one is created.

        -

      Returns Mat3

      The scaling matrix.

      -
    \ No newline at end of file +

    Type Parameters

    Parameters

    • v: BaseArgType

      A vector of +2 entries specifying the factor by which to scale in each dimension.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The scaling matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat3.set.html b/docs/functions/mat3.set.html index b5ca735..cf5fe56 100644 --- a/docs/functions/mat3.set.html +++ b/docs/functions/mat3.set.html @@ -1,6 +1,6 @@ -set | wgpu-matrix

Function set

  • Sets the values of a Mat3 -Also see mat3.create and mat3.copy

    -

    Parameters

    • v0: number

      value for element 0

      +set | wgpu-matrix

      Function set

      • Sets the values of a Mat3 +Also see mat3.create and mat3.copy

        +

        Type Parameters

        Parameters

        • v0: number

          value for element 0

        • v1: number

          value for element 1

        • v2: number

          value for element 2

        • v3: number

          value for element 3

          @@ -9,6 +9,6 @@
        • v6: number

          value for element 6

        • v7: number

          value for element 7

        • v8: number

          value for element 8

          -
        • Optional dst: Mat3

          matrix to hold result. If not passed a new one is created.

          -

        Returns Mat3

        Mat3 set from values.

        -
      \ No newline at end of file +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    Mat3 set from values.

    +
\ No newline at end of file diff --git a/docs/functions/mat3.setAxis.html b/docs/functions/mat3.setAxis.html index 1c53911..c90879d 100644 --- a/docs/functions/mat3.setAxis.html +++ b/docs/functions/mat3.setAxis.html @@ -1,7 +1,7 @@ -setAxis | wgpu-matrix

Function setAxis

  • Sets an axis of a 3x3 matrix as a vector with 2 entries

    -

    Parameters

    • m: Mat3

      The matrix.

      -
    • v: Vec2

      the axis vector

      +setAxis | wgpu-matrix

      Function setAxis

      • Sets an axis of a 3x3 matrix as a vector with 2 entries

        +

        Type Parameters

        Parameters

        • m: BaseArgType

          The matrix.

          +
        • v: BaseArgType

          the axis vector

        • axis: number

          The axis 0 = x, 1 = y;

          -
        • Optional dst: Mat3

          The matrix to set. If not passed a new one is created.

          -

        Returns Mat3

        The matrix with axis set.

        -
      \ No newline at end of file +
    • Optional dst: T

      The matrix to set. If not passed a new one is created.

      +

    Returns T

    The matrix with axis set.

    +
\ No newline at end of file diff --git a/docs/functions/mat3.setDefaultType.html b/docs/functions/mat3.setDefaultType.html deleted file mode 100644 index 63d1466..0000000 --- a/docs/functions/mat3.setDefaultType.html +++ /dev/null @@ -1,4 +0,0 @@ -setDefaultType | wgpu-matrix

Function setDefaultType

  • Sets the type this library creates for a Mat3

    -

    Parameters

    • ctor: (new (n) => Mat3)

      the constructor for the type. Either Float32Array, Float64Array, or Array

      -
        • new (n): Mat3
        • Parameters

          • n: number

          Returns Mat3

    Returns Mat3LikeCtor

    previous constructor for Mat3

    -
\ No newline at end of file diff --git a/docs/functions/mat3.setTranslation.html b/docs/functions/mat3.setTranslation.html index cec759f..9297722 100644 --- a/docs/functions/mat3.setTranslation.html +++ b/docs/functions/mat3.setTranslation.html @@ -1,7 +1,7 @@ -setTranslation | wgpu-matrix

Function setTranslation

  • Sets the translation component of a 3-by-3 matrix to the given +setTranslation | wgpu-matrix

    Function setTranslation

    • Sets the translation component of a 3-by-3 matrix to the given vector.

      -

      Parameters

      • a: Mat3

        The matrix.

        -
      • v: Vec2

        The vector.

        -
      • Optional dst: Mat3

        matrix to hold result. If not passed a new one is created.

        -

      Returns Mat3

      The matrix with translation set.

      -
    \ No newline at end of file +

    Type Parameters

    Parameters

    • a: BaseArgType

      The matrix.

      +
    • v: BaseArgType

      The vector.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The matrix with translation set.

    +
\ No newline at end of file diff --git a/docs/functions/mat3.translate.html b/docs/functions/mat3.translate.html index 99c1f0e..35d42be 100644 --- a/docs/functions/mat3.translate.html +++ b/docs/functions/mat3.translate.html @@ -1,6 +1,6 @@ -translate | wgpu-matrix

Function translate

  • Translates the given 3-by-3 matrix by the given vector v.

    -

    Parameters

    • m: Mat3

      The matrix.

      -
    • v: Vec2

      The vector by which to translate.

      -
    • Optional dst: Mat3

      matrix to hold result. If not passed a new one is created.

      -

    Returns Mat3

    The translated matrix.

    -
\ No newline at end of file +translate | wgpu-matrix

Function translate

  • Translates the given 3-by-3 matrix by the given vector v.

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix.

      +
    • v: BaseArgType

      The vector by which to translate.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The translated matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat3.translation.html b/docs/functions/mat3.translation.html index 12f5605..c9268b6 100644 --- a/docs/functions/mat3.translation.html +++ b/docs/functions/mat3.translation.html @@ -1,5 +1,5 @@ -translation | wgpu-matrix

Function translation

  • Creates a 3-by-3 matrix which translates by the given vector v.

    -

    Parameters

    • v: Vec2

      The vector by which to translate.

      -
    • Optional dst: Mat3

      matrix to hold result. If not passed a new one is created.

      -

    Returns Mat3

    The translation matrix.

    -
\ No newline at end of file +translation | wgpu-matrix

Function translation

  • Creates a 3-by-3 matrix which translates by the given vector v.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector by which to translate.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The translation matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat3.transpose.html b/docs/functions/mat3.transpose.html index c925384..c514e82 100644 --- a/docs/functions/mat3.transpose.html +++ b/docs/functions/mat3.transpose.html @@ -1,5 +1,5 @@ -transpose | wgpu-matrix

Function transpose

  • Takes the transpose of a matrix.

    -

    Parameters

    • m: Mat3

      The matrix.

      -
    • Optional dst: Mat3

      matrix to hold result. If not passed a new one is created.

      -

    Returns Mat3

    The transpose of m.

    -
\ No newline at end of file +transpose | wgpu-matrix

Function transpose

  • Takes the transpose of a matrix.

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The transpose of m.

    +
\ No newline at end of file diff --git a/docs/functions/mat3.uniformScale.html b/docs/functions/mat3.uniformScale.html index 3badb9d..186410e 100644 --- a/docs/functions/mat3.uniformScale.html +++ b/docs/functions/mat3.uniformScale.html @@ -1,7 +1,7 @@ -uniformScale | wgpu-matrix

Function uniformScale

  • Scales the given 3-by-3 matrix in each dimension by an amount +uniformScale | wgpu-matrix

    Function uniformScale

    • Scales the given 3-by-3 matrix in each dimension by an amount given.

      -

      Parameters

      • m: Mat3

        The matrix to be modified.

        +

        Type Parameters

        Parameters

        • m: BaseArgType

          The matrix to be modified.

        • s: number

          Amount to scale.

          -
        • Optional dst: Mat3

          matrix to hold result. If not passed a new one is created.

          -

        Returns Mat3

        The scaled matrix.

        -
    \ No newline at end of file +
  • Optional dst: T

    matrix to hold result. If not passed a new one is created.

    +

Returns T

The scaled matrix.

+
\ No newline at end of file diff --git a/docs/functions/mat3.uniformScaling.html b/docs/functions/mat3.uniformScaling.html index 14fd331..c5c3535 100644 --- a/docs/functions/mat3.uniformScaling.html +++ b/docs/functions/mat3.uniformScaling.html @@ -1,5 +1,5 @@ -uniformScaling | wgpu-matrix

Function uniformScaling

  • Creates a 3-by-3 matrix which scales uniformly in each dimension

    -

    Parameters

    • s: number

      Amount to scale

      -
    • Optional dst: Mat3

      matrix to hold result. If not passed a new one is created.

      -

    Returns Mat3

    The scaling matrix.

    -
\ No newline at end of file +uniformScaling | wgpu-matrix

Function uniformScaling

  • Creates a 3-by-3 matrix which scales uniformly in each dimension

    +

    Type Parameters

    Parameters

    • s: number

      Amount to scale

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The scaling matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat3d.clone.html b/docs/functions/mat3d.clone.html new file mode 100644 index 0000000..b70113b --- /dev/null +++ b/docs/functions/mat3d.clone.html @@ -0,0 +1,6 @@ +clone | wgpu-matrix

Function clone

\ No newline at end of file diff --git a/docs/functions/mat3d.copy.html b/docs/functions/mat3d.copy.html new file mode 100644 index 0000000..4d7294b --- /dev/null +++ b/docs/functions/mat3d.copy.html @@ -0,0 +1,6 @@ +copy | wgpu-matrix
\ No newline at end of file diff --git a/docs/functions/mat3d.create.html b/docs/functions/mat3d.create.html new file mode 100644 index 0000000..8636b28 --- /dev/null +++ b/docs/functions/mat3d.create.html @@ -0,0 +1,19 @@ +create | wgpu-matrix

Function create

  • Create a Mat3 from values

    +

    Note: Since passing in a raw JavaScript array +is valid in all circumstances, if you want to +force a JavaScript array into a Mat3's specified type +it would be faster to use

    +
    const m = mat3.clone(someJSArray);
    +
    + +

    Parameters

    • Optional v0: number

      value for element 0

      +
    • Optional v1: number

      value for element 1

      +
    • Optional v2: number

      value for element 2

      +
    • Optional v3: number

      value for element 3

      +
    • Optional v4: number

      value for element 4

      +
    • Optional v5: number

      value for element 5

      +
    • Optional v6: number

      value for element 6

      +
    • Optional v7: number

      value for element 7

      +
    • Optional v8: number

      value for element 8

      +

    Returns Float64Array

    matrix created from values.

    +
\ No newline at end of file diff --git a/docs/functions/mat3d.determinant.html b/docs/functions/mat3d.determinant.html new file mode 100644 index 0000000..f27e2c2 --- /dev/null +++ b/docs/functions/mat3d.determinant.html @@ -0,0 +1,4 @@ +determinant | wgpu-matrix

Function determinant

  • Compute the determinant of a matrix

    +

    Parameters

    Returns number

    the determinant

    +
\ No newline at end of file diff --git a/docs/functions/mat3d.equals.html b/docs/functions/mat3d.equals.html new file mode 100644 index 0000000..0af305e --- /dev/null +++ b/docs/functions/mat3d.equals.html @@ -0,0 +1,5 @@ +equals | wgpu-matrix

Function equals

  • Check if 2 matrices are exactly equal

    +

    Parameters

    Returns boolean

    true if matrices are exactly equal

    +
\ No newline at end of file diff --git a/docs/functions/mat3d.equalsApproximately.html b/docs/functions/mat3d.equalsApproximately.html new file mode 100644 index 0000000..54370fb --- /dev/null +++ b/docs/functions/mat3d.equalsApproximately.html @@ -0,0 +1,5 @@ +equalsApproximately | wgpu-matrix

Function equalsApproximately

  • Check if 2 matrices are approximately equal

    +

    Parameters

    Returns boolean

    true if matrices are approximately equal

    +
\ No newline at end of file diff --git a/docs/functions/mat3d.fromMat4.html b/docs/functions/mat3d.fromMat4.html new file mode 100644 index 0000000..99ea65c --- /dev/null +++ b/docs/functions/mat3d.fromMat4.html @@ -0,0 +1,5 @@ +fromMat4 | wgpu-matrix

Function fromMat4

  • Creates a Mat3 from the upper left 3x3 part of a Mat4

    +

    Type Parameters

    Parameters

    • m4: BaseArgType

      source matrix

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    Mat3 made from m4

    +
\ No newline at end of file diff --git a/docs/functions/mat3d.fromQuat.html b/docs/functions/mat3d.fromQuat.html new file mode 100644 index 0000000..bb9add6 --- /dev/null +++ b/docs/functions/mat3d.fromQuat.html @@ -0,0 +1,5 @@ +fromQuat | wgpu-matrix

Function fromQuat

  • Creates a Mat3 rotation matrix from a quaternion

    +

    Type Parameters

    Parameters

    • q: BaseArgType

      quaternion to create matrix from

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    Mat3 made from q

    +
\ No newline at end of file diff --git a/docs/functions/mat3d.getAxis.html b/docs/functions/mat3d.getAxis.html new file mode 100644 index 0000000..88f91c3 --- /dev/null +++ b/docs/functions/mat3d.getAxis.html @@ -0,0 +1,5 @@ +getAxis | wgpu-matrix

Function getAxis

  • Returns an axis of a 3x3 matrix as a vector with 2 entries

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix.

      +
    • axis: number

      The axis 0 = x, 1 = y,

      +
    • Optional dst: T

    Returns T

    The axis component of m.

    +
\ No newline at end of file diff --git a/docs/functions/mat3d.getScaling.html b/docs/functions/mat3d.getScaling.html new file mode 100644 index 0000000..40c6969 --- /dev/null +++ b/docs/functions/mat3d.getScaling.html @@ -0,0 +1 @@ +getScaling | wgpu-matrix

Function getScaling

  • Type Parameters

    Parameters

    Returns Float64Array | T

\ No newline at end of file diff --git a/docs/functions/mat3d.getTranslation.html b/docs/functions/mat3d.getTranslation.html new file mode 100644 index 0000000..ebbc6c7 --- /dev/null +++ b/docs/functions/mat3d.getTranslation.html @@ -0,0 +1,6 @@ +getTranslation | wgpu-matrix

Function getTranslation

  • Returns the translation component of a 3-by-3 matrix as a vector with 3 +entries.

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix.

      +
    • Optional dst: T

      vector to hold result. If not passed a new one is created.

      +

    Returns T

    The translation component of m.

    +
\ No newline at end of file diff --git a/docs/functions/mat3d.identity.html b/docs/functions/mat3d.identity.html new file mode 100644 index 0000000..51c2e16 --- /dev/null +++ b/docs/functions/mat3d.identity.html @@ -0,0 +1,4 @@ +identity | wgpu-matrix

Function identity

  • Creates a 3-by-3 identity matrix.

    +

    Type Parameters

    Parameters

    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    A 3-by-3 identity matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat3d.inverse.html b/docs/functions/mat3d.inverse.html new file mode 100644 index 0000000..f87b2bf --- /dev/null +++ b/docs/functions/mat3d.inverse.html @@ -0,0 +1,5 @@ +inverse | wgpu-matrix

Function inverse

  • Computes the inverse of a 3-by-3 matrix.

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The inverse of m.

    +
\ No newline at end of file diff --git a/docs/functions/mat3d.invert.html b/docs/functions/mat3d.invert.html new file mode 100644 index 0000000..a8d8d23 --- /dev/null +++ b/docs/functions/mat3d.invert.html @@ -0,0 +1,5 @@ +invert | wgpu-matrix

Function invert

  • Computes the inverse of a 3-by-3 matrix.

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The inverse of m.

    +
\ No newline at end of file diff --git a/docs/functions/mat3d.mul.html b/docs/functions/mat3d.mul.html new file mode 100644 index 0000000..a3464df --- /dev/null +++ b/docs/functions/mat3d.mul.html @@ -0,0 +1,6 @@ +mul | wgpu-matrix
  • Multiplies two 3-by-3 matrices with a on the left and b on the right

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      The matrix on the left.

      +
    • b: BaseArgType

      The matrix on the right.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The matrix product of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/mat3d.multiply.html b/docs/functions/mat3d.multiply.html new file mode 100644 index 0000000..799da42 --- /dev/null +++ b/docs/functions/mat3d.multiply.html @@ -0,0 +1,6 @@ +multiply | wgpu-matrix

Function multiply

  • Multiplies two 3-by-3 matrices with a on the left and b on the right

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      The matrix on the left.

      +
    • b: BaseArgType

      The matrix on the right.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The matrix product of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/mat3d.negate.html b/docs/functions/mat3d.negate.html new file mode 100644 index 0000000..65e5145 --- /dev/null +++ b/docs/functions/mat3d.negate.html @@ -0,0 +1,5 @@ +negate | wgpu-matrix

Function negate

  • Negates a matrix.

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    -m.

    +
\ No newline at end of file diff --git a/docs/functions/mat3d.rotate.html b/docs/functions/mat3d.rotate.html new file mode 100644 index 0000000..488149b --- /dev/null +++ b/docs/functions/mat3d.rotate.html @@ -0,0 +1,6 @@ +rotate | wgpu-matrix

Function rotate

  • Rotates the given 3-by-3 matrix by the given angle.

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix.

      +
    • angleInRadians: number

      The angle by which to rotate (in radians).

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The rotated matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat3d.rotation.html b/docs/functions/mat3d.rotation.html new file mode 100644 index 0000000..b5716e7 --- /dev/null +++ b/docs/functions/mat3d.rotation.html @@ -0,0 +1,5 @@ +rotation | wgpu-matrix

Function rotation

  • Creates a 3-by-3 matrix which rotates by the given angle.

    +

    Type Parameters

    Parameters

    • angleInRadians: number

      The angle by which to rotate (in radians).

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The rotation matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat3d.scale.html b/docs/functions/mat3d.scale.html new file mode 100644 index 0000000..939e38f --- /dev/null +++ b/docs/functions/mat3d.scale.html @@ -0,0 +1,9 @@ +scale | wgpu-matrix

Function scale

  • Scales the given 3-by-3 matrix in each dimension by an amount +given by the corresponding entry in the given vector; assumes the vector has +three entries.

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix to be modified.

      +
    • v: BaseArgType

      A vector of 2 entries specifying the +factor by which to scale in each dimension.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The scaled matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat3d.scaling.html b/docs/functions/mat3d.scaling.html new file mode 100644 index 0000000..fa0039a --- /dev/null +++ b/docs/functions/mat3d.scaling.html @@ -0,0 +1,8 @@ +scaling | wgpu-matrix

Function scaling

  • Creates a 3-by-3 matrix which scales in each dimension by an amount given by +the corresponding entry in the given vector; assumes the vector has three +entries.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      A vector of +2 entries specifying the factor by which to scale in each dimension.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The scaling matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat3d.set.html b/docs/functions/mat3d.set.html new file mode 100644 index 0000000..5299c67 --- /dev/null +++ b/docs/functions/mat3d.set.html @@ -0,0 +1,14 @@ +set | wgpu-matrix
  • Sets the values of a Mat3 +Also see mat3.create and mat3.copy

    +

    Type Parameters

    Parameters

    • v0: number

      value for element 0

      +
    • v1: number

      value for element 1

      +
    • v2: number

      value for element 2

      +
    • v3: number

      value for element 3

      +
    • v4: number

      value for element 4

      +
    • v5: number

      value for element 5

      +
    • v6: number

      value for element 6

      +
    • v7: number

      value for element 7

      +
    • v8: number

      value for element 8

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    Mat3 set from values.

    +
\ No newline at end of file diff --git a/docs/functions/mat3d.setAxis.html b/docs/functions/mat3d.setAxis.html new file mode 100644 index 0000000..651ee68 --- /dev/null +++ b/docs/functions/mat3d.setAxis.html @@ -0,0 +1,7 @@ +setAxis | wgpu-matrix

Function setAxis

  • Sets an axis of a 3x3 matrix as a vector with 2 entries

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix.

      +
    • v: BaseArgType

      the axis vector

      +
    • axis: number

      The axis 0 = x, 1 = y;

      +
    • Optional dst: T

      The matrix to set. If not passed a new one is created.

      +

    Returns T

    The matrix with axis set.

    +
\ No newline at end of file diff --git a/docs/functions/mat3d.setTranslation.html b/docs/functions/mat3d.setTranslation.html new file mode 100644 index 0000000..2c904f8 --- /dev/null +++ b/docs/functions/mat3d.setTranslation.html @@ -0,0 +1,7 @@ +setTranslation | wgpu-matrix

Function setTranslation

  • Sets the translation component of a 3-by-3 matrix to the given +vector.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      The matrix.

      +
    • v: BaseArgType

      The vector.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The matrix with translation set.

    +
\ No newline at end of file diff --git a/docs/functions/mat3d.translate.html b/docs/functions/mat3d.translate.html new file mode 100644 index 0000000..f719e2f --- /dev/null +++ b/docs/functions/mat3d.translate.html @@ -0,0 +1,6 @@ +translate | wgpu-matrix

Function translate

  • Translates the given 3-by-3 matrix by the given vector v.

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix.

      +
    • v: BaseArgType

      The vector by which to translate.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The translated matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat3d.translation.html b/docs/functions/mat3d.translation.html new file mode 100644 index 0000000..82c8d32 --- /dev/null +++ b/docs/functions/mat3d.translation.html @@ -0,0 +1,5 @@ +translation | wgpu-matrix

Function translation

  • Creates a 3-by-3 matrix which translates by the given vector v.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector by which to translate.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The translation matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat3d.transpose.html b/docs/functions/mat3d.transpose.html new file mode 100644 index 0000000..9d0dde1 --- /dev/null +++ b/docs/functions/mat3d.transpose.html @@ -0,0 +1,5 @@ +transpose | wgpu-matrix

Function transpose

  • Takes the transpose of a matrix.

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The transpose of m.

    +
\ No newline at end of file diff --git a/docs/functions/mat3d.uniformScale.html b/docs/functions/mat3d.uniformScale.html new file mode 100644 index 0000000..9ca932b --- /dev/null +++ b/docs/functions/mat3d.uniformScale.html @@ -0,0 +1,7 @@ +uniformScale | wgpu-matrix

Function uniformScale

  • Scales the given 3-by-3 matrix in each dimension by an amount +given.

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix to be modified.

      +
    • s: number

      Amount to scale.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The scaled matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat3d.uniformScaling.html b/docs/functions/mat3d.uniformScaling.html new file mode 100644 index 0000000..d6971ff --- /dev/null +++ b/docs/functions/mat3d.uniformScaling.html @@ -0,0 +1,5 @@ +uniformScaling | wgpu-matrix

Function uniformScaling

  • Creates a 3-by-3 matrix which scales uniformly in each dimension

    +

    Type Parameters

    Parameters

    • s: number

      Amount to scale

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The scaling matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat3n.clone.html b/docs/functions/mat3n.clone.html new file mode 100644 index 0000000..0a08c10 --- /dev/null +++ b/docs/functions/mat3n.clone.html @@ -0,0 +1,6 @@ +clone | wgpu-matrix

Function clone

\ No newline at end of file diff --git a/docs/functions/mat3n.copy.html b/docs/functions/mat3n.copy.html new file mode 100644 index 0000000..80a63a4 --- /dev/null +++ b/docs/functions/mat3n.copy.html @@ -0,0 +1,6 @@ +copy | wgpu-matrix
\ No newline at end of file diff --git a/docs/functions/mat3n.create.html b/docs/functions/mat3n.create.html new file mode 100644 index 0000000..e3fd6db --- /dev/null +++ b/docs/functions/mat3n.create.html @@ -0,0 +1,19 @@ +create | wgpu-matrix

Function create

  • Create a Mat3 from values

    +

    Note: Since passing in a raw JavaScript array +is valid in all circumstances, if you want to +force a JavaScript array into a Mat3's specified type +it would be faster to use

    +
    const m = mat3.clone(someJSArray);
    +
    + +

    Parameters

    • Optional v0: number

      value for element 0

      +
    • Optional v1: number

      value for element 1

      +
    • Optional v2: number

      value for element 2

      +
    • Optional v3: number

      value for element 3

      +
    • Optional v4: number

      value for element 4

      +
    • Optional v5: number

      value for element 5

      +
    • Optional v6: number

      value for element 6

      +
    • Optional v7: number

      value for element 7

      +
    • Optional v8: number

      value for element 8

      +

    Returns number[]

    matrix created from values.

    +
\ No newline at end of file diff --git a/docs/functions/mat3n.determinant.html b/docs/functions/mat3n.determinant.html new file mode 100644 index 0000000..aac3bc7 --- /dev/null +++ b/docs/functions/mat3n.determinant.html @@ -0,0 +1,4 @@ +determinant | wgpu-matrix

Function determinant

  • Compute the determinant of a matrix

    +

    Parameters

    Returns number

    the determinant

    +
\ No newline at end of file diff --git a/docs/functions/mat3n.equals.html b/docs/functions/mat3n.equals.html new file mode 100644 index 0000000..32ad810 --- /dev/null +++ b/docs/functions/mat3n.equals.html @@ -0,0 +1,5 @@ +equals | wgpu-matrix

Function equals

  • Check if 2 matrices are exactly equal

    +

    Parameters

    Returns boolean

    true if matrices are exactly equal

    +
\ No newline at end of file diff --git a/docs/functions/mat3n.equalsApproximately.html b/docs/functions/mat3n.equalsApproximately.html new file mode 100644 index 0000000..a8a398d --- /dev/null +++ b/docs/functions/mat3n.equalsApproximately.html @@ -0,0 +1,5 @@ +equalsApproximately | wgpu-matrix

Function equalsApproximately

  • Check if 2 matrices are approximately equal

    +

    Parameters

    Returns boolean

    true if matrices are approximately equal

    +
\ No newline at end of file diff --git a/docs/functions/mat3n.fromMat4.html b/docs/functions/mat3n.fromMat4.html new file mode 100644 index 0000000..7ca139c --- /dev/null +++ b/docs/functions/mat3n.fromMat4.html @@ -0,0 +1,5 @@ +fromMat4 | wgpu-matrix

Function fromMat4

  • Creates a Mat3 from the upper left 3x3 part of a Mat4

    +

    Type Parameters

    Parameters

    • m4: BaseArgType

      source matrix

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    Mat3 made from m4

    +
\ No newline at end of file diff --git a/docs/functions/mat3n.fromQuat.html b/docs/functions/mat3n.fromQuat.html new file mode 100644 index 0000000..6cc7306 --- /dev/null +++ b/docs/functions/mat3n.fromQuat.html @@ -0,0 +1,5 @@ +fromQuat | wgpu-matrix

Function fromQuat

  • Creates a Mat3 rotation matrix from a quaternion

    +

    Type Parameters

    Parameters

    • q: BaseArgType

      quaternion to create matrix from

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    Mat3 made from q

    +
\ No newline at end of file diff --git a/docs/functions/mat3n.getAxis.html b/docs/functions/mat3n.getAxis.html new file mode 100644 index 0000000..620bdaf --- /dev/null +++ b/docs/functions/mat3n.getAxis.html @@ -0,0 +1,5 @@ +getAxis | wgpu-matrix

Function getAxis

  • Returns an axis of a 3x3 matrix as a vector with 2 entries

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix.

      +
    • axis: number

      The axis 0 = x, 1 = y,

      +
    • Optional dst: T

    Returns T

    The axis component of m.

    +
\ No newline at end of file diff --git a/docs/functions/mat3n.getScaling.html b/docs/functions/mat3n.getScaling.html new file mode 100644 index 0000000..ab4d506 --- /dev/null +++ b/docs/functions/mat3n.getScaling.html @@ -0,0 +1 @@ +getScaling | wgpu-matrix

Function getScaling

  • Type Parameters

    Parameters

    Returns number[] | T

\ No newline at end of file diff --git a/docs/functions/mat3n.getTranslation.html b/docs/functions/mat3n.getTranslation.html new file mode 100644 index 0000000..677cbc0 --- /dev/null +++ b/docs/functions/mat3n.getTranslation.html @@ -0,0 +1,6 @@ +getTranslation | wgpu-matrix

Function getTranslation

  • Returns the translation component of a 3-by-3 matrix as a vector with 3 +entries.

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix.

      +
    • Optional dst: T

      vector to hold result. If not passed a new one is created.

      +

    Returns T

    The translation component of m.

    +
\ No newline at end of file diff --git a/docs/functions/mat3n.identity.html b/docs/functions/mat3n.identity.html new file mode 100644 index 0000000..824caaa --- /dev/null +++ b/docs/functions/mat3n.identity.html @@ -0,0 +1,4 @@ +identity | wgpu-matrix

Function identity

  • Creates a 3-by-3 identity matrix.

    +

    Type Parameters

    Parameters

    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    A 3-by-3 identity matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat3n.inverse.html b/docs/functions/mat3n.inverse.html new file mode 100644 index 0000000..5853b8f --- /dev/null +++ b/docs/functions/mat3n.inverse.html @@ -0,0 +1,5 @@ +inverse | wgpu-matrix

Function inverse

  • Computes the inverse of a 3-by-3 matrix.

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The inverse of m.

    +
\ No newline at end of file diff --git a/docs/functions/mat3n.invert.html b/docs/functions/mat3n.invert.html new file mode 100644 index 0000000..3924a70 --- /dev/null +++ b/docs/functions/mat3n.invert.html @@ -0,0 +1,5 @@ +invert | wgpu-matrix

Function invert

  • Computes the inverse of a 3-by-3 matrix.

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The inverse of m.

    +
\ No newline at end of file diff --git a/docs/functions/mat3n.mul.html b/docs/functions/mat3n.mul.html new file mode 100644 index 0000000..c820f9b --- /dev/null +++ b/docs/functions/mat3n.mul.html @@ -0,0 +1,6 @@ +mul | wgpu-matrix
  • Multiplies two 3-by-3 matrices with a on the left and b on the right

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      The matrix on the left.

      +
    • b: BaseArgType

      The matrix on the right.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The matrix product of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/mat3n.multiply.html b/docs/functions/mat3n.multiply.html new file mode 100644 index 0000000..fd58c50 --- /dev/null +++ b/docs/functions/mat3n.multiply.html @@ -0,0 +1,6 @@ +multiply | wgpu-matrix

Function multiply

  • Multiplies two 3-by-3 matrices with a on the left and b on the right

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      The matrix on the left.

      +
    • b: BaseArgType

      The matrix on the right.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The matrix product of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/mat3n.negate.html b/docs/functions/mat3n.negate.html new file mode 100644 index 0000000..ae1db33 --- /dev/null +++ b/docs/functions/mat3n.negate.html @@ -0,0 +1,5 @@ +negate | wgpu-matrix

Function negate

  • Negates a matrix.

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    -m.

    +
\ No newline at end of file diff --git a/docs/functions/mat3n.rotate.html b/docs/functions/mat3n.rotate.html new file mode 100644 index 0000000..59d1c62 --- /dev/null +++ b/docs/functions/mat3n.rotate.html @@ -0,0 +1,6 @@ +rotate | wgpu-matrix

Function rotate

  • Rotates the given 3-by-3 matrix by the given angle.

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix.

      +
    • angleInRadians: number

      The angle by which to rotate (in radians).

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The rotated matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat3n.rotation.html b/docs/functions/mat3n.rotation.html new file mode 100644 index 0000000..670d7f3 --- /dev/null +++ b/docs/functions/mat3n.rotation.html @@ -0,0 +1,5 @@ +rotation | wgpu-matrix

Function rotation

  • Creates a 3-by-3 matrix which rotates by the given angle.

    +

    Type Parameters

    Parameters

    • angleInRadians: number

      The angle by which to rotate (in radians).

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The rotation matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat3n.scale.html b/docs/functions/mat3n.scale.html new file mode 100644 index 0000000..3e40c5b --- /dev/null +++ b/docs/functions/mat3n.scale.html @@ -0,0 +1,9 @@ +scale | wgpu-matrix

Function scale

  • Scales the given 3-by-3 matrix in each dimension by an amount +given by the corresponding entry in the given vector; assumes the vector has +three entries.

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix to be modified.

      +
    • v: BaseArgType

      A vector of 2 entries specifying the +factor by which to scale in each dimension.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The scaled matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat3n.scaling.html b/docs/functions/mat3n.scaling.html new file mode 100644 index 0000000..40bc75b --- /dev/null +++ b/docs/functions/mat3n.scaling.html @@ -0,0 +1,8 @@ +scaling | wgpu-matrix

Function scaling

  • Creates a 3-by-3 matrix which scales in each dimension by an amount given by +the corresponding entry in the given vector; assumes the vector has three +entries.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      A vector of +2 entries specifying the factor by which to scale in each dimension.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The scaling matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat3n.set.html b/docs/functions/mat3n.set.html new file mode 100644 index 0000000..718a74c --- /dev/null +++ b/docs/functions/mat3n.set.html @@ -0,0 +1,14 @@ +set | wgpu-matrix
  • Sets the values of a Mat3 +Also see mat3.create and mat3.copy

    +

    Type Parameters

    Parameters

    • v0: number

      value for element 0

      +
    • v1: number

      value for element 1

      +
    • v2: number

      value for element 2

      +
    • v3: number

      value for element 3

      +
    • v4: number

      value for element 4

      +
    • v5: number

      value for element 5

      +
    • v6: number

      value for element 6

      +
    • v7: number

      value for element 7

      +
    • v8: number

      value for element 8

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    Mat3 set from values.

    +
\ No newline at end of file diff --git a/docs/functions/mat3n.setAxis.html b/docs/functions/mat3n.setAxis.html new file mode 100644 index 0000000..a85556d --- /dev/null +++ b/docs/functions/mat3n.setAxis.html @@ -0,0 +1,7 @@ +setAxis | wgpu-matrix

Function setAxis

  • Sets an axis of a 3x3 matrix as a vector with 2 entries

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix.

      +
    • v: BaseArgType

      the axis vector

      +
    • axis: number

      The axis 0 = x, 1 = y;

      +
    • Optional dst: T

      The matrix to set. If not passed a new one is created.

      +

    Returns T

    The matrix with axis set.

    +
\ No newline at end of file diff --git a/docs/functions/mat3n.setTranslation.html b/docs/functions/mat3n.setTranslation.html new file mode 100644 index 0000000..380ab20 --- /dev/null +++ b/docs/functions/mat3n.setTranslation.html @@ -0,0 +1,7 @@ +setTranslation | wgpu-matrix

Function setTranslation

  • Sets the translation component of a 3-by-3 matrix to the given +vector.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      The matrix.

      +
    • v: BaseArgType

      The vector.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The matrix with translation set.

    +
\ No newline at end of file diff --git a/docs/functions/mat3n.translate.html b/docs/functions/mat3n.translate.html new file mode 100644 index 0000000..73846f7 --- /dev/null +++ b/docs/functions/mat3n.translate.html @@ -0,0 +1,6 @@ +translate | wgpu-matrix

Function translate

  • Translates the given 3-by-3 matrix by the given vector v.

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix.

      +
    • v: BaseArgType

      The vector by which to translate.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The translated matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat3n.translation.html b/docs/functions/mat3n.translation.html new file mode 100644 index 0000000..77444b7 --- /dev/null +++ b/docs/functions/mat3n.translation.html @@ -0,0 +1,5 @@ +translation | wgpu-matrix

Function translation

  • Creates a 3-by-3 matrix which translates by the given vector v.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector by which to translate.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The translation matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat3n.transpose.html b/docs/functions/mat3n.transpose.html new file mode 100644 index 0000000..f921543 --- /dev/null +++ b/docs/functions/mat3n.transpose.html @@ -0,0 +1,5 @@ +transpose | wgpu-matrix

Function transpose

  • Takes the transpose of a matrix.

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The transpose of m.

    +
\ No newline at end of file diff --git a/docs/functions/mat3n.uniformScale.html b/docs/functions/mat3n.uniformScale.html new file mode 100644 index 0000000..aa0194e --- /dev/null +++ b/docs/functions/mat3n.uniformScale.html @@ -0,0 +1,7 @@ +uniformScale | wgpu-matrix

Function uniformScale

  • Scales the given 3-by-3 matrix in each dimension by an amount +given.

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix to be modified.

      +
    • s: number

      Amount to scale.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The scaled matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat3n.uniformScaling.html b/docs/functions/mat3n.uniformScaling.html new file mode 100644 index 0000000..3aab7bf --- /dev/null +++ b/docs/functions/mat3n.uniformScaling.html @@ -0,0 +1,5 @@ +uniformScaling | wgpu-matrix

Function uniformScaling

  • Creates a 3-by-3 matrix which scales uniformly in each dimension

    +

    Type Parameters

    Parameters

    • s: number

      Amount to scale

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The scaling matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat4.aim.html b/docs/functions/mat4.aim.html index 3ef3448..a0e38be 100644 --- a/docs/functions/mat4.aim.html +++ b/docs/functions/mat4.aim.html @@ -1,10 +1,10 @@ -aim | wgpu-matrix

Function aim

  • Computes a 4-by-4 aim transformation.

    +aim | wgpu-matrix

    Function aim

    • Computes a 4-by-4 aim transformation.

      This is a matrix which positions an object aiming down positive Z. toward the target.

      Note: this is NOT the inverse of lookAt as lookAt looks at negative Z.

      -

      Parameters

      • position: Vec3

        The position of the object.

        -
      • target: Vec3

        The position meant to be aimed at.

        -
      • up: Vec3

        A vector pointing up.

        -
      • Optional dst: Mat4

        matrix to hold result. If not passed a new one is created.

        -

      Returns Mat4

      The aim matrix.

      -
    \ No newline at end of file +

    Type Parameters

    Parameters

    • position: BaseArgType

      The position of the object.

      +
    • target: BaseArgType

      The position meant to be aimed at.

      +
    • up: BaseArgType

      A vector pointing up.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The aim matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat4.axisRotate.html b/docs/functions/mat4.axisRotate.html index 4a275be..65c26bb 100644 --- a/docs/functions/mat4.axisRotate.html +++ b/docs/functions/mat4.axisRotate.html @@ -1,9 +1,9 @@ -axisRotate | wgpu-matrix

Function axisRotate

  • Rotates the given 4-by-4 matrix around the given axis by the +axisRotate | wgpu-matrix

    Function axisRotate

    • Rotates the given 4-by-4 matrix around the given axis by the given angle.

      -

      Parameters

      • m: Mat4

        The matrix.

        -
      • axis: Vec3

        The axis - about which to rotate.

        +

        Type Parameters

        Parameters

        • m: BaseArgType

          The matrix.

          +
        • axis: BaseArgType

          The axis +about which to rotate.

        • angleInRadians: number

          The angle by which to rotate (in radians).

          -
        • Optional dst: Mat4

          matrix to hold result. If not passed a new one is created.

          -

        Returns Mat4

        The rotated matrix.

        -
    \ No newline at end of file +
  • Optional dst: T

    matrix to hold result. If not passed a new one is created.

    +

Returns T

The rotated matrix.

+
\ No newline at end of file diff --git a/docs/functions/mat4.axisRotation.html b/docs/functions/mat4.axisRotation.html index c464af6..8704da5 100644 --- a/docs/functions/mat4.axisRotation.html +++ b/docs/functions/mat4.axisRotation.html @@ -1,9 +1,9 @@ -axisRotation | wgpu-matrix

Function axisRotation

  • Creates a 4-by-4 matrix which rotates around the given axis by the given +axisRotation | wgpu-matrix

    Function axisRotation

    • Creates a 4-by-4 matrix which rotates around the given axis by the given angle.

      -

      Parameters

      • axis: Vec3

        The axis - about which to rotate.

        +

        Type Parameters

        Parameters

        • axis: BaseArgType

          The axis +about which to rotate.

        • angleInRadians: number

          The angle by which to rotate (in radians).

          -
        • Optional dst: Mat4

          matrix to hold result. If not passed a new one is created.

          -

        Returns Mat4

        A matrix which rotates angle radians - around the axis.

        -
    \ No newline at end of file +
  • Optional dst: T

    matrix to hold result. If not passed a new one is created.

    +

Returns T

A matrix which rotates angle radians +around the axis.

+
\ No newline at end of file diff --git a/docs/functions/mat4.cameraAim.html b/docs/functions/mat4.cameraAim.html index 023bd65..3cea85d 100644 --- a/docs/functions/mat4.cameraAim.html +++ b/docs/functions/mat4.cameraAim.html @@ -1,10 +1,10 @@ -cameraAim | wgpu-matrix

Function cameraAim

  • Computes a 4-by-4 camera aim transformation.

    +cameraAim | wgpu-matrix

    Function cameraAim

    • Computes a 4-by-4 camera aim transformation.

      This is a matrix which positions an object aiming down negative Z. toward the target.

      Note: this is the inverse of lookAt

      -

      Parameters

      • eye: Vec3

        The position of the object.

        -
      • target: Vec3

        The position meant to be aimed at.

        -
      • up: Vec3

        A vector pointing up.

        -
      • Optional dst: Mat4

        matrix to hold result. If not passed a new one is created.

        -

      Returns Mat4

      The aim matrix.

      -
    \ No newline at end of file +

    Type Parameters

    Parameters

    • eye: BaseArgType

      The position of the object.

      +
    • target: BaseArgType

      The position meant to be aimed at.

      +
    • up: BaseArgType

      A vector pointing up.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The aim matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat4.clone.html b/docs/functions/mat4.clone.html index bc7cff8..706198c 100644 --- a/docs/functions/mat4.clone.html +++ b/docs/functions/mat4.clone.html @@ -1,6 +1,6 @@ -clone | wgpu-matrix

Function clone

\ No newline at end of file +clone | wgpu-matrix

Function clone

\ No newline at end of file diff --git a/docs/functions/mat4.copy.html b/docs/functions/mat4.copy.html index f30359b..6827d49 100644 --- a/docs/functions/mat4.copy.html +++ b/docs/functions/mat4.copy.html @@ -1,6 +1,6 @@ -copy | wgpu-matrix

Function copy

\ No newline at end of file +copy | wgpu-matrix

Function copy

\ No newline at end of file diff --git a/docs/functions/mat4.create.html b/docs/functions/mat4.create.html index d19b0ca..dfe6ebc 100644 --- a/docs/functions/mat4.create.html +++ b/docs/functions/mat4.create.html @@ -1,17 +1,11 @@ -create | wgpu-matrix

Function create

  • Create a Mat4 from values

    +create | wgpu-matrix

    Function create

    • Create a Mat4 from values

      Note: Since passing in a raw JavaScript array is valid in all circumstances, if you want to -force a JavaScript array into a Mat4's specified type +force a JavaScript array into a Mat4's specified type it would be faster to use

      const m = mat4.clone(someJSArray);
       
      -

      Note: a consequence of the implementation is if your Mat4Type = Array -instead of Float32Array or Float64Array then any values you -don't pass in will be undefined. Usually this is not an issue since -(a) using Array is rare and (b) using mat4.create is usually used -to create a Mat4 to be filled out as in

      -
      const m = mat4.create();
      mat4.perspective(fov, aspect, near, far, m); -
      +

      Parameters

      • Optional v0: number

        value for element 0

      • Optional v1: number

        value for element 1

      • Optional v2: number

        value for element 2

        @@ -28,5 +22,5 @@
      • Optional v13: number

        value for element 13

      • Optional v14: number

        value for element 14

      • Optional v15: number

        value for element 15

        -

      Returns Mat4

      created from values.

      -
    \ No newline at end of file +

Returns Float32Array

created from values.

+
\ No newline at end of file diff --git a/docs/functions/mat4.determinant.html b/docs/functions/mat4.determinant.html index fa6cf4f..c78877d 100644 --- a/docs/functions/mat4.determinant.html +++ b/docs/functions/mat4.determinant.html @@ -1,4 +1,4 @@ -determinant | wgpu-matrix

Function determinant

  • Compute the determinant of a matrix

    -

    Parameters

    • m: Mat4

      the matrix

      +determinant | wgpu-matrix

      Function determinant

      • Compute the determinant of a matrix

        +

        Parameters

        Returns number

        the determinant

        -
      \ No newline at end of file +
\ No newline at end of file diff --git a/docs/functions/mat4.equals.html b/docs/functions/mat4.equals.html index 508a093..322d4b6 100644 --- a/docs/functions/mat4.equals.html +++ b/docs/functions/mat4.equals.html @@ -1,5 +1,5 @@ -equals | wgpu-matrix

Function equals

  • Check if 2 matrices are exactly equal

    -

    Parameters

    • a: Mat4

      Operand matrix.

      -
    • b: Mat4

      Operand matrix.

      +equals | wgpu-matrix

      Function equals

      • Check if 2 matrices are exactly equal

        +

        Parameters

        Returns boolean

        true if matrices are exactly equal

        -
      \ No newline at end of file +
\ No newline at end of file diff --git a/docs/functions/mat4.equalsApproximately.html b/docs/functions/mat4.equalsApproximately.html index 891fecb..705c6cf 100644 --- a/docs/functions/mat4.equalsApproximately.html +++ b/docs/functions/mat4.equalsApproximately.html @@ -1,5 +1,5 @@ -equalsApproximately | wgpu-matrix

Function equalsApproximately

  • Check if 2 matrices are approximately equal

    -

    Parameters

    • a: Mat4

      Operand matrix.

      -
    • b: Mat4

      Operand matrix.

      +equalsApproximately | wgpu-matrix

      Function equalsApproximately

      • Check if 2 matrices are approximately equal

        +

        Parameters

        Returns boolean

        true if matrices are approximately equal

        -
      \ No newline at end of file +
\ No newline at end of file diff --git a/docs/functions/mat4.fromMat3.html b/docs/functions/mat4.fromMat3.html index 5d383bd..53b3a2e 100644 --- a/docs/functions/mat4.fromMat3.html +++ b/docs/functions/mat4.fromMat3.html @@ -1,5 +1,5 @@ -fromMat3 | wgpu-matrix

Function fromMat3

  • Creates a Mat4 from a Mat3

    -

    Parameters

    • m3: Mat3

      source matrix

      -
    • Optional dst: Mat4

      matrix to hold result. If not passed a new one is created.

      -

    Returns Mat4

    Mat4 made from m3

    -
\ No newline at end of file +fromMat3 | wgpu-matrix

Function fromMat3

  • Creates a Mat4 from a Mat3

    +

    Type Parameters

    Parameters

    • m3: BaseArgType

      source matrix

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    Mat4 made from m3

    +
\ No newline at end of file diff --git a/docs/functions/mat4.fromQuat.html b/docs/functions/mat4.fromQuat.html index f0d9a0e..6583a4c 100644 --- a/docs/functions/mat4.fromQuat.html +++ b/docs/functions/mat4.fromQuat.html @@ -1,5 +1,5 @@ -fromQuat | wgpu-matrix

Function fromQuat

  • Creates a Mat4 rotation matrix from a quaternion

    -

    Parameters

    • q: Quat

      quaternion to create matrix from

      -
    • Optional dst: Mat4

      matrix to hold result. If not passed a new one is created.

      -

    Returns Mat4

    Mat4 made from q

    -
\ No newline at end of file +fromQuat | wgpu-matrix

Function fromQuat

  • Creates a Mat4 rotation matrix from a quaternion

    +

    Type Parameters

    Parameters

    • q: BaseArgType

      quaternion to create matrix from

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    Mat4 made from q

    +
\ No newline at end of file diff --git a/docs/functions/mat4.frustum.html b/docs/functions/mat4.frustum.html index 9139889..c221845 100644 --- a/docs/functions/mat4.frustum.html +++ b/docs/functions/mat4.frustum.html @@ -1,4 +1,4 @@ -frustum | wgpu-matrix

Function frustum

  • Computes a 4-by-4 perspective transformation matrix given the left, right, +frustum | wgpu-matrix

    Function frustum

    • Computes a 4-by-4 perspective transformation matrix given the left, right, top, bottom, near and far clipping planes. The arguments define a frustum extending in the negative z direction. The arguments near and far are the distances to the near and far clipping planes. Note that near and far are not @@ -6,12 +6,12 @@ matrix generated sends the viewing frustum to the unit box. We assume a unit box extending from -1 to 1 in the x and y dimensions and from 0 to 1 in the z dimension.

      -

      Parameters

      • left: number

        The x coordinate of the left plane of the box.

        +

        Type Parameters

        Parameters

        • left: number

          The x coordinate of the left plane of the box.

        • right: number

          The x coordinate of the right plane of the box.

        • bottom: number

          The y coordinate of the bottom plane of the box.

        • top: number

          The y coordinate of the right plane of the box.

        • near: number

          The negative z coordinate of the near plane of the box.

        • far: number

          The negative z coordinate of the far plane of the box.

          -
        • Optional dst: Mat4

          Output matrix. If not passed a new one is created.

          -

        Returns Mat4

        The perspective projection matrix.

        -
    \ No newline at end of file +
  • Optional dst: T

    Output matrix. If not passed a new one is created.

    +

Returns T

The perspective projection matrix.

+
\ No newline at end of file diff --git a/docs/functions/mat4.frustumReverseZ.html b/docs/functions/mat4.frustumReverseZ.html index 1fb81b0..4cb482c 100644 --- a/docs/functions/mat4.frustumReverseZ.html +++ b/docs/functions/mat4.frustumReverseZ.html @@ -1,4 +1,4 @@ -frustumReverseZ | wgpu-matrix

Function frustumReverseZ

  • Computes a 4-by-4 reverse-z perspective transformation matrix given the left, right, +frustumReverseZ | wgpu-matrix

    Function frustumReverseZ

    • Computes a 4-by-4 reverse-z perspective transformation matrix given the left, right, top, bottom, near and far clipping planes. The arguments define a frustum extending in the negative z direction. The arguments near and far are the distances to the near and far clipping planes. Note that near and far are not @@ -6,12 +6,12 @@ matrix generated sends the viewing frustum to the unit box. We assume a unit box extending from -1 to 1 in the x and y dimensions and from 1 (-near) to 0 (-far) in the z dimension.

      -

      Parameters

      • left: number

        The x coordinate of the left plane of the box.

        +

        Type Parameters

        Parameters

        • left: number

          The x coordinate of the left plane of the box.

        • right: number

          The x coordinate of the right plane of the box.

        • bottom: number

          The y coordinate of the bottom plane of the box.

        • top: number

          The y coordinate of the right plane of the box.

        • near: number

          The negative z coordinate of the near plane of the box.

        • far: number = Infinity

          The negative z coordinate of the far plane of the box.

          -
        • Optional dst: Mat4

          Output matrix. If not passed a new one is created.

          -

        Returns Mat4

        The perspective projection matrix.

        -
    \ No newline at end of file +
  • Optional dst: T

    Output matrix. If not passed a new one is created.

    +

Returns T

The perspective projection matrix.

+
\ No newline at end of file diff --git a/docs/functions/mat4.getAxis.html b/docs/functions/mat4.getAxis.html index 280679f..3a94a32 100644 --- a/docs/functions/mat4.getAxis.html +++ b/docs/functions/mat4.getAxis.html @@ -1,5 +1,5 @@ -getAxis | wgpu-matrix

Function getAxis

  • Returns an axis of a 4x4 matrix as a vector with 3 entries

    -

    Parameters

    • m: Mat4

      The matrix.

      +getAxis | wgpu-matrix

      Function getAxis

      • Returns an axis of a 4x4 matrix as a vector with 3 entries

        +

        Type Parameters

        Parameters

        • m: BaseArgType

          The matrix.

        • axis: number

          The axis 0 = x, 1 = y, 2 = z;

          -
        • Optional dst: Vec3

        Returns Vec3

        The axis component of m.

        -
      \ No newline at end of file +
    • Optional dst: T

    Returns Float32Array | T

    The axis component of m.

    +
\ No newline at end of file diff --git a/docs/functions/mat4.getScaling.html b/docs/functions/mat4.getScaling.html index 39dc0a4..62864ed 100644 --- a/docs/functions/mat4.getScaling.html +++ b/docs/functions/mat4.getScaling.html @@ -1,4 +1 @@ -getScaling | wgpu-matrix

Function getScaling

  • Returns the scaling component of the matrix

    -

    Parameters

    • m: Mat4

      The Matrix

      -
    • Optional dst: Vec3

      The vector to set. If not passed a new one is created.

      -

    Returns Vec3

\ No newline at end of file +getScaling | wgpu-matrix

Function getScaling

\ No newline at end of file diff --git a/docs/functions/mat4.getTranslation.html b/docs/functions/mat4.getTranslation.html index 44179da..7a6b52c 100644 --- a/docs/functions/mat4.getTranslation.html +++ b/docs/functions/mat4.getTranslation.html @@ -1,6 +1 @@ -getTranslation | wgpu-matrix

Function getTranslation

  • Returns the translation component of a 4-by-4 matrix as a vector with 3 -entries.

    -

    Parameters

    • m: Mat4

      The matrix.

      -
    • Optional dst: Vec3

      vector to hold result. If not passed a new one is created.

      -

    Returns Vec3

    The translation component of m.

    -
\ No newline at end of file +getTranslation | wgpu-matrix

Function getTranslation

\ No newline at end of file diff --git a/docs/functions/mat4.identity.html b/docs/functions/mat4.identity.html index 8d4c808..d99445f 100644 --- a/docs/functions/mat4.identity.html +++ b/docs/functions/mat4.identity.html @@ -1,4 +1,4 @@ -identity | wgpu-matrix

Function identity

  • Creates a 4-by-4 identity matrix.

    -

    Parameters

    • Optional dst: Mat4

      matrix to hold result. If not passed a new one is created.

      -

    Returns Mat4

    A 4-by-4 identity matrix.

    -
\ No newline at end of file +identity | wgpu-matrix

Function identity

  • Creates a 4-by-4 identity matrix.

    +

    Type Parameters

    Parameters

    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    A 4-by-4 identity matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat4.inverse.html b/docs/functions/mat4.inverse.html index 8ebd063..de6f842 100644 --- a/docs/functions/mat4.inverse.html +++ b/docs/functions/mat4.inverse.html @@ -1,5 +1,5 @@ -inverse | wgpu-matrix

Function inverse

  • Computes the inverse of a 4-by-4 matrix.

    -

    Parameters

    • m: Mat4

      The matrix.

      -
    • Optional dst: Mat4

      matrix to hold result. If not passed a new one is created.

      -

    Returns Mat4

    The inverse of m.

    -
\ No newline at end of file +inverse | wgpu-matrix

Function inverse

  • Computes the inverse of a 4-by-4 matrix.

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The inverse of m.

    +
\ No newline at end of file diff --git a/docs/functions/mat4.invert.html b/docs/functions/mat4.invert.html index 9ace52e..e1abdd9 100644 --- a/docs/functions/mat4.invert.html +++ b/docs/functions/mat4.invert.html @@ -1,5 +1,5 @@ -invert | wgpu-matrix

Function invert

  • Computes the inverse of a 4-by-4 matrix. (same as inverse)

    -

    Parameters

    • m: Mat4

      The matrix.

      -
    • Optional dst: Mat4

      matrix to hold result. If not passed a new one is created.

      -

    Returns Mat4

    The inverse of m.

    -
\ No newline at end of file +invert | wgpu-matrix

Function invert

  • Computes the inverse of a 4-by-4 matrix.

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The inverse of m.

    +
\ No newline at end of file diff --git a/docs/functions/mat4.lookAt.html b/docs/functions/mat4.lookAt.html index 8a0eeeb..d25bbd0 100644 --- a/docs/functions/mat4.lookAt.html +++ b/docs/functions/mat4.lookAt.html @@ -1,9 +1,9 @@ -lookAt | wgpu-matrix

Function lookAt

  • Computes a 4-by-4 view transformation.

    +lookAt | wgpu-matrix

    Function lookAt

    • Computes a 4-by-4 view transformation.

      This is a view matrix which transforms all other objects to be in the space of the view defined by the parameters.

      -

      Parameters

      • eye: Vec3

        The position of the object.

        -
      • target: Vec3

        The position meant to be aimed at.

        -
      • up: Vec3

        A vector pointing up.

        -
      • Optional dst: Mat4

        matrix to hold result. If not passed a new one is created.

        -

      Returns Mat4

      The look-at matrix.

      -
    \ No newline at end of file +

    Type Parameters

    Parameters

    • eye: BaseArgType

      The position of the object.

      +
    • target: BaseArgType

      The position meant to be aimed at.

      +
    • up: BaseArgType

      A vector pointing up.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The look-at matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat4.mul.html b/docs/functions/mat4.mul.html index 14d7735..e24badf 100644 --- a/docs/functions/mat4.mul.html +++ b/docs/functions/mat4.mul.html @@ -1,6 +1,6 @@ -mul | wgpu-matrix

Function mul

  • Multiplies two 4-by-4 matrices with a on the left and b on the right (same as multiply)

    -

    Parameters

    • a: Mat4

      The matrix on the left.

      -
    • b: Mat4

      The matrix on the right.

      -
    • Optional dst: Mat4

      matrix to hold result. If not passed a new one is created.

      -

    Returns Mat4

    The matrix product of a and b.

    -
\ No newline at end of file +mul | wgpu-matrix

Function mul

  • Multiplies two 4-by-4 matrices with a on the left and b on the right

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      The matrix on the left.

      +
    • b: BaseArgType

      The matrix on the right.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The matrix product of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/mat4.multiply.html b/docs/functions/mat4.multiply.html index 3adf283..6a4637d 100644 --- a/docs/functions/mat4.multiply.html +++ b/docs/functions/mat4.multiply.html @@ -1,6 +1,6 @@ -multiply | wgpu-matrix

Function multiply

  • Multiplies two 4-by-4 matrices with a on the left and b on the right

    -

    Parameters

    • a: Mat4

      The matrix on the left.

      -
    • b: Mat4

      The matrix on the right.

      -
    • Optional dst: Mat4

      matrix to hold result. If not passed a new one is created.

      -

    Returns Mat4

    The matrix product of a and b.

    -
\ No newline at end of file +multiply | wgpu-matrix

Function multiply

  • Multiplies two 4-by-4 matrices with a on the left and b on the right

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      The matrix on the left.

      +
    • b: BaseArgType

      The matrix on the right.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The matrix product of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/mat4.negate.html b/docs/functions/mat4.negate.html index 30c5e17..8fd46ed 100644 --- a/docs/functions/mat4.negate.html +++ b/docs/functions/mat4.negate.html @@ -1,5 +1,5 @@ -negate | wgpu-matrix

Function negate

  • Negates a matrix.

    -

    Parameters

    • m: Mat4

      The matrix.

      -
    • Optional dst: Mat4

      matrix to hold result. If not passed a new one is created.

      -

    Returns Mat4

    -m.

    -
\ No newline at end of file +negate | wgpu-matrix

Function negate

  • Negates a matrix.

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    -m.

    +
\ No newline at end of file diff --git a/docs/functions/mat4.ortho.html b/docs/functions/mat4.ortho.html index 0740dd3..cf7fc7e 100644 --- a/docs/functions/mat4.ortho.html +++ b/docs/functions/mat4.ortho.html @@ -1,14 +1,14 @@ -ortho | wgpu-matrix

Function ortho

  • Computes a 4-by-4 orthogonal transformation matrix that transforms from +ortho | wgpu-matrix

    Function ortho

    • Computes a 4-by-4 orthogonal transformation matrix that transforms from the given the left, right, bottom, and top dimensions to -1 +1 in x, and y and 0 to +1 in z.

      -

      Parameters

      • left: number

        Left side of the near clipping plane viewport.

        +

        Type Parameters

        Parameters

        • left: number

          Left side of the near clipping plane viewport.

        • right: number

          Right side of the near clipping plane viewport.

        • bottom: number

          Bottom of the near clipping plane viewport.

        • top: number

          Top of the near clipping plane viewport.

        • near: number

          The depth (negative z coordinate) - of the near clipping plane.

          +of the near clipping plane.

        • far: number

          The depth (negative z coordinate) - of the far clipping plane.

          -
        • Optional dst: Mat4

          Output matrix. If not passed a new one is created.

          -

        Returns Mat4

        The orthographic projection matrix.

        -
    \ No newline at end of file +of the far clipping plane.

    +
  • Optional dst: T

    Output matrix. If not passed a new one is created.

    +

Returns T

The orthographic projection matrix.

+
\ No newline at end of file diff --git a/docs/functions/mat4.perspective.html b/docs/functions/mat4.perspective.html index 9bc6556..5ebe953 100644 --- a/docs/functions/mat4.perspective.html +++ b/docs/functions/mat4.perspective.html @@ -1,4 +1,4 @@ -perspective | wgpu-matrix

Function perspective

  • Computes a 4-by-4 perspective transformation matrix given the angular height +perspective | wgpu-matrix

    Function perspective

    • Computes a 4-by-4 perspective transformation matrix given the angular height of the frustum, the aspect ratio, and the near and far clipping planes. The arguments define a frustum extending in the negative z direction. The given angle is the vertical angle of the frustum, and the horizontal angle is @@ -11,12 +11,12 @@

      Note: If you pass Infinity for zFar then it will produce a projection matrix returns -Infinity for Z when transforming coordinates with Z <= 0 and +Infinity for Z otherwise.

      -

      Parameters

      • fieldOfViewYInRadians: number

        The camera angle from top to bottom (in radians).

        +

        Type Parameters

        Parameters

        • fieldOfViewYInRadians: number

          The camera angle from top to bottom (in radians).

        • aspect: number

          The aspect ratio width / height.

        • zNear: number

          The depth (negative z coordinate) - of the near clipping plane.

          +of the near clipping plane.

        • zFar: number

          The depth (negative z coordinate) - of the far clipping plane.

          -
        • Optional dst: Mat4

          matrix to hold result. If not passed a new one is created.

          -

        Returns Mat4

        The perspective matrix.

        -
    \ No newline at end of file +of the far clipping plane.

    +
  • Optional dst: T

    matrix to hold result. If not passed a new one is created.

    +

Returns T

The perspective matrix.

+
\ No newline at end of file diff --git a/docs/functions/mat4.perspectiveReverseZ.html b/docs/functions/mat4.perspectiveReverseZ.html index a155f89..b260dec 100644 --- a/docs/functions/mat4.perspectiveReverseZ.html +++ b/docs/functions/mat4.perspectiveReverseZ.html @@ -1,4 +1,4 @@ -perspectiveReverseZ | wgpu-matrix

Function perspectiveReverseZ

  • Computes a 4-by-4 reverse-z perspective transformation matrix given the angular height +perspectiveReverseZ | wgpu-matrix

    Function perspectiveReverseZ

    • Computes a 4-by-4 reverse-z perspective transformation matrix given the angular height of the frustum, the aspect ratio, and the near and far clipping planes. The arguments define a frustum extending in the negative z direction. The given angle is the vertical angle of the frustum, and the horizontal angle is @@ -8,12 +8,12 @@ z-axis. The matrix generated sends the viewing frustum to the unit box. We assume a unit box extending from -1 to 1 in the x and y dimensions and from 1 (at -zNear) to 0 (at -zFar) in the z dimension.

      -

      Parameters

      • fieldOfViewYInRadians: number

        The camera angle from top to bottom (in radians).

        +

        Type Parameters

        Parameters

        • fieldOfViewYInRadians: number

          The camera angle from top to bottom (in radians).

        • aspect: number

          The aspect ratio width / height.

        • zNear: number

          The depth (negative z coordinate) - of the near clipping plane.

          +of the near clipping plane.

        • zFar: number = Infinity

          The depth (negative z coordinate) - of the far clipping plane. (default = Infinity)

          -
        • Optional dst: Mat4

          matrix to hold result. If not passed a new one is created.

          -

        Returns Mat4

        The perspective matrix.

        -
    \ No newline at end of file +of the far clipping plane. (default = Infinity)

    +
  • Optional dst: T

    matrix to hold result. If not passed a new one is created.

    +

Returns T

The perspective matrix.

+
\ No newline at end of file diff --git a/docs/functions/mat4.rotate.html b/docs/functions/mat4.rotate.html index f310709..8e4278f 100644 --- a/docs/functions/mat4.rotate.html +++ b/docs/functions/mat4.rotate.html @@ -1,9 +1,9 @@ -rotate | wgpu-matrix

Function rotate

  • Rotates the given 4-by-4 matrix around the given axis by the -given angle. (same as rotate)

    -

    Parameters

    • m: Mat4

      The matrix.

      -
    • axis: Vec3

      The axis - about which to rotate.

      +rotate | wgpu-matrix

      Function rotate

      • Rotates the given 4-by-4 matrix around the given axis by the +given angle.

        +

        Type Parameters

        Parameters

        • m: BaseArgType

          The matrix.

          +
        • axis: BaseArgType

          The axis +about which to rotate.

        • angleInRadians: number

          The angle by which to rotate (in radians).

          -
        • Optional dst: Mat4

          matrix to hold result. If not passed a new one is created.

          -

        Returns Mat4

        The rotated matrix.

        -
      \ No newline at end of file +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The rotated matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat4.rotateX.html b/docs/functions/mat4.rotateX.html index c1f5e54..7a6a0c5 100644 --- a/docs/functions/mat4.rotateX.html +++ b/docs/functions/mat4.rotateX.html @@ -1,7 +1,7 @@ -rotateX | wgpu-matrix

Function rotateX

  • Rotates the given 4-by-4 matrix around the x-axis by the given +rotateX | wgpu-matrix

    Function rotateX

    • Rotates the given 4-by-4 matrix around the x-axis by the given angle.

      -

      Parameters

      • m: Mat4

        The matrix.

        +

        Type Parameters

        Parameters

        • m: BaseArgType

          The matrix.

        • angleInRadians: number

          The angle by which to rotate (in radians).

          -
        • Optional dst: Mat4

          matrix to hold result. If not passed a new one is created.

          -

        Returns Mat4

        The rotated matrix.

        -
    \ No newline at end of file +
  • Optional dst: T

    matrix to hold result. If not passed a new one is created.

    +

Returns T

The rotated matrix.

+
\ No newline at end of file diff --git a/docs/functions/mat4.rotateY.html b/docs/functions/mat4.rotateY.html index cbcf2f3..b12beb6 100644 --- a/docs/functions/mat4.rotateY.html +++ b/docs/functions/mat4.rotateY.html @@ -1,7 +1,7 @@ -rotateY | wgpu-matrix

Function rotateY

  • Rotates the given 4-by-4 matrix around the y-axis by the given +rotateY | wgpu-matrix

    Function rotateY

    • Rotates the given 4-by-4 matrix around the y-axis by the given angle.

      -

      Parameters

      • m: Mat4

        The matrix.

        +

        Type Parameters

        Parameters

        • m: BaseArgType

          The matrix.

        • angleInRadians: number

          The angle by which to rotate (in radians).

          -
        • Optional dst: Mat4

          matrix to hold result. If not passed a new one is created.

          -

        Returns Mat4

        The rotated matrix.

        -
    \ No newline at end of file +
  • Optional dst: T

    matrix to hold result. If not passed a new one is created.

    +

Returns T

The rotated matrix.

+
\ No newline at end of file diff --git a/docs/functions/mat4.rotateZ.html b/docs/functions/mat4.rotateZ.html index 3a1d1f6..e936593 100644 --- a/docs/functions/mat4.rotateZ.html +++ b/docs/functions/mat4.rotateZ.html @@ -1,7 +1,7 @@ -rotateZ | wgpu-matrix

Function rotateZ

  • Rotates the given 4-by-4 matrix around the z-axis by the given +rotateZ | wgpu-matrix

    Function rotateZ

    • Rotates the given 4-by-4 matrix around the z-axis by the given angle.

      -

      Parameters

      • m: Mat4

        The matrix.

        +

        Type Parameters

        Parameters

        • m: BaseArgType

          The matrix.

        • angleInRadians: number

          The angle by which to rotate (in radians).

          -
        • Optional dst: Mat4

          matrix to hold result. If not passed a new one is created.

          -

        Returns Mat4

        The rotated matrix.

        -
    \ No newline at end of file +
  • Optional dst: T

    matrix to hold result. If not passed a new one is created.

    +

Returns T

The rotated matrix.

+
\ No newline at end of file diff --git a/docs/functions/mat4.rotation.html b/docs/functions/mat4.rotation.html index efbef5d..30fb2c6 100644 --- a/docs/functions/mat4.rotation.html +++ b/docs/functions/mat4.rotation.html @@ -1,9 +1,9 @@ -rotation | wgpu-matrix

Function rotation

  • Creates a 4-by-4 matrix which rotates around the given axis by the given -angle. (same as axisRotation)

    -

    Parameters

    • axis: Vec3

      The axis - about which to rotate.

      +rotation | wgpu-matrix

      Function rotation

      • Creates a 4-by-4 matrix which rotates around the given axis by the given +angle.

        +

        Type Parameters

        Parameters

        • axis: BaseArgType

          The axis +about which to rotate.

        • angleInRadians: number

          The angle by which to rotate (in radians).

          -
        • Optional dst: Mat4

          matrix to hold result. If not passed a new one is created.

          -

        Returns Mat4

        A matrix which rotates angle radians - around the axis.

        -
      \ No newline at end of file +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    A matrix which rotates angle radians +around the axis.

    +
\ No newline at end of file diff --git a/docs/functions/mat4.rotationX.html b/docs/functions/mat4.rotationX.html index b93480f..fcfd4ab 100644 --- a/docs/functions/mat4.rotationX.html +++ b/docs/functions/mat4.rotationX.html @@ -1,5 +1,5 @@ -rotationX | wgpu-matrix

Function rotationX

  • Creates a 4-by-4 matrix which rotates around the x-axis by the given angle.

    -

    Parameters

    • angleInRadians: number

      The angle by which to rotate (in radians).

      -
    • Optional dst: Mat4

      matrix to hold result. If not passed a new one is created.

      -

    Returns Mat4

    The rotation matrix.

    -
\ No newline at end of file +rotationX | wgpu-matrix

Function rotationX

  • Creates a 4-by-4 matrix which rotates around the x-axis by the given angle.

    +

    Type Parameters

    Parameters

    • angleInRadians: number

      The angle by which to rotate (in radians).

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The rotation matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat4.rotationY.html b/docs/functions/mat4.rotationY.html index bb13e44..d88b1d7 100644 --- a/docs/functions/mat4.rotationY.html +++ b/docs/functions/mat4.rotationY.html @@ -1,5 +1,5 @@ -rotationY | wgpu-matrix

Function rotationY

  • Creates a 4-by-4 matrix which rotates around the y-axis by the given angle.

    -

    Parameters

    • angleInRadians: number

      The angle by which to rotate (in radians).

      -
    • Optional dst: Mat4

      matrix to hold result. If not passed a new one is created.

      -

    Returns Mat4

    The rotation matrix.

    -
\ No newline at end of file +rotationY | wgpu-matrix

Function rotationY

  • Creates a 4-by-4 matrix which rotates around the y-axis by the given angle.

    +

    Type Parameters

    Parameters

    • angleInRadians: number

      The angle by which to rotate (in radians).

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The rotation matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat4.rotationZ.html b/docs/functions/mat4.rotationZ.html index c54a3af..e7def0e 100644 --- a/docs/functions/mat4.rotationZ.html +++ b/docs/functions/mat4.rotationZ.html @@ -1,5 +1,5 @@ -rotationZ | wgpu-matrix

Function rotationZ

  • Creates a 4-by-4 matrix which rotates around the z-axis by the given angle.

    -

    Parameters

    • angleInRadians: number

      The angle by which to rotate (in radians).

      -
    • Optional dst: Mat4

      matrix to hold result. If not passed a new one is created.

      -

    Returns Mat4

    The rotation matrix.

    -
\ No newline at end of file +rotationZ | wgpu-matrix

Function rotationZ

  • Creates a 4-by-4 matrix which rotates around the z-axis by the given angle.

    +

    Type Parameters

    Parameters

    • angleInRadians: number

      The angle by which to rotate (in radians).

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The rotation matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat4.scale.html b/docs/functions/mat4.scale.html index 3473540..9f1f9e4 100644 --- a/docs/functions/mat4.scale.html +++ b/docs/functions/mat4.scale.html @@ -1,9 +1,9 @@ -scale | wgpu-matrix

Function scale

  • Scales the given 4-by-4 matrix in each dimension by an amount +scale | wgpu-matrix

    Function scale

    • Scales the given 4-by-4 matrix in each dimension by an amount given by the corresponding entry in the given vector; assumes the vector has three entries.

      -

      Parameters

      • m: Mat4

        The matrix to be modified.

        -
      • v: Vec3

        A vector of three entries specifying the - factor by which to scale in each dimension.

        -
      • Optional dst: Mat4

        matrix to hold result. If not passed a new one is created.

        -

      Returns Mat4

      The scaled matrix.

      -
    \ No newline at end of file +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix to be modified.

      +
    • v: BaseArgType

      A vector of three entries specifying the +factor by which to scale in each dimension.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The scaled matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat4.scaling.html b/docs/functions/mat4.scaling.html index 869fce2..3f73beb 100644 --- a/docs/functions/mat4.scaling.html +++ b/docs/functions/mat4.scaling.html @@ -1,8 +1,8 @@ -scaling | wgpu-matrix

Function scaling

  • Creates a 4-by-4 matrix which scales in each dimension by an amount given by +scaling | wgpu-matrix

    Function scaling

    • Creates a 4-by-4 matrix which scales in each dimension by an amount given by the corresponding entry in the given vector; assumes the vector has three entries.

      -

      Parameters

      • v: Vec3

        A vector of - three entries specifying the factor by which to scale in each dimension.

        -
      • Optional dst: Mat4

        matrix to hold result. If not passed a new one is created.

        -

      Returns Mat4

      The scaling matrix.

      -
    \ No newline at end of file +

    Type Parameters

    Parameters

    • v: BaseArgType

      A vector of +three entries specifying the factor by which to scale in each dimension.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The scaling matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat4.set.html b/docs/functions/mat4.set.html index 574c0b8..a4a6dae 100644 --- a/docs/functions/mat4.set.html +++ b/docs/functions/mat4.set.html @@ -1,6 +1,6 @@ -set | wgpu-matrix

Function set

  • Sets the values of a Mat4 -Also see mat4.create and mat4.copy

    -

    Parameters

    • v0: number

      value for element 0

      +set | wgpu-matrix

      Function set

      • Sets the values of a Mat4 +Also see mat4.create and mat4.copy

        +

        Type Parameters

        Parameters

        • v0: number

          value for element 0

        • v1: number

          value for element 1

        • v2: number

          value for element 2

        • v3: number

          value for element 3

          @@ -16,6 +16,6 @@
        • v13: number

          value for element 13

        • v14: number

          value for element 14

        • v15: number

          value for element 15

          -
        • Optional dst: Mat4

          matrix to hold result. If not passed a new one is created.

          -

        Returns Mat4

        Mat4 created from values.

        -
      \ No newline at end of file +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    Mat4 created from values.

    +
\ No newline at end of file diff --git a/docs/functions/mat4.setAxis.html b/docs/functions/mat4.setAxis.html index 27a01c8..4d2b2f8 100644 --- a/docs/functions/mat4.setAxis.html +++ b/docs/functions/mat4.setAxis.html @@ -1,7 +1,7 @@ -setAxis | wgpu-matrix

Function setAxis

  • Sets an axis of a 4x4 matrix as a vector with 3 entries

    -

    Parameters

    • m: Mat4

      The matrix.

      -
    • v: Vec3

      the axis vector

      +setAxis | wgpu-matrix

      Function setAxis

      • Sets an axis of a 4x4 matrix as a vector with 3 entries

        +

        Type Parameters

        Parameters

        • m: BaseArgType

          The matrix.

          +
        • v: BaseArgType

          the axis vector

        • axis: number

          The axis 0 = x, 1 = y, 2 = z;

          -
        • dst: Mat4

          The matrix to set. If not passed a new one is created.

          -

        Returns Mat4

        The matrix with axis set.

        -
      \ No newline at end of file +
    • dst: T

      The matrix to set. If not passed a new one is created.

      +

    Returns T

    The matrix with axis set.

    +
\ No newline at end of file diff --git a/docs/functions/mat4.setDefaultType.html b/docs/functions/mat4.setDefaultType.html deleted file mode 100644 index 5f15b85..0000000 --- a/docs/functions/mat4.setDefaultType.html +++ /dev/null @@ -1,4 +0,0 @@ -setDefaultType | wgpu-matrix

Function setDefaultType

  • Sets the type this library creates for a Mat4

    -

    Parameters

    • ctor: (new (n) => Mat4)

      the constructor for the type. Either Float32Array, Float64Array, or Array

      -
        • new (n): Mat4
        • Parameters

          • n: number

          Returns Mat4

    Returns Mat4LikeCtor

    previous constructor for Mat4

    -
\ No newline at end of file diff --git a/docs/functions/mat4.setTranslation.html b/docs/functions/mat4.setTranslation.html index 27beefa..f8ca34d 100644 --- a/docs/functions/mat4.setTranslation.html +++ b/docs/functions/mat4.setTranslation.html @@ -1,7 +1,7 @@ -setTranslation | wgpu-matrix

Function setTranslation

  • Sets the translation component of a 4-by-4 matrix to the given +setTranslation | wgpu-matrix

    Function setTranslation

    • Sets the translation component of a 4-by-4 matrix to the given vector.

      -

      Parameters

      • a: Mat4

        The matrix.

        -
      • v: Vec3

        The vector.

        -
      • Optional dst: Mat4

        matrix to hold result. If not passed a new one is created.

        -

      Returns Mat4

      The matrix with translation set.

      -
    \ No newline at end of file +

    Type Parameters

    Parameters

    • a: BaseArgType

      The matrix.

      +
    • v: BaseArgType

      The vector.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The matrix with translation set.

    +
\ No newline at end of file diff --git a/docs/functions/mat4.translate.html b/docs/functions/mat4.translate.html index 8e53226..563f806 100644 --- a/docs/functions/mat4.translate.html +++ b/docs/functions/mat4.translate.html @@ -1,7 +1,7 @@ -translate | wgpu-matrix

Function translate

  • Translates the given 4-by-4 matrix by the given vector v.

    -

    Parameters

    • m: Mat4

      The matrix.

      -
    • v: Vec3

      The vector by - which to translate.

      -
    • Optional dst: Mat4

      matrix to hold result. If not passed a new one is created.

      -

    Returns Mat4

    The translated matrix.

    -
\ No newline at end of file +translate | wgpu-matrix

Function translate

  • Translates the given 4-by-4 matrix by the given vector v.

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix.

      +
    • v: BaseArgType

      The vector by +which to translate.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The translated matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat4.translation.html b/docs/functions/mat4.translation.html index 6d6d6d5..0df8191 100644 --- a/docs/functions/mat4.translation.html +++ b/docs/functions/mat4.translation.html @@ -1,6 +1,6 @@ -translation | wgpu-matrix

Function translation

  • Creates a 4-by-4 matrix which translates by the given vector v.

    -

    Parameters

    • v: Vec3

      The vector by - which to translate.

      -
    • Optional dst: Mat4

      matrix to hold result. If not passed a new one is created.

      -

    Returns Mat4

    The translation matrix.

    -
\ No newline at end of file +translation | wgpu-matrix

Function translation

  • Creates a 4-by-4 matrix which translates by the given vector v.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector by +which to translate.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The translation matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat4.transpose.html b/docs/functions/mat4.transpose.html index a88775c..c4c2170 100644 --- a/docs/functions/mat4.transpose.html +++ b/docs/functions/mat4.transpose.html @@ -1,5 +1,5 @@ -transpose | wgpu-matrix

Function transpose

  • Takes the transpose of a matrix.

    -

    Parameters

    • m: Mat4

      The matrix.

      -
    • Optional dst: Mat4

      matrix to hold result. If not passed a new one is created.

      -

    Returns Mat4

    The transpose of m.

    -
\ No newline at end of file +transpose | wgpu-matrix

Function transpose

  • Takes the transpose of a matrix.

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The transpose of m.

    +
\ No newline at end of file diff --git a/docs/functions/mat4.uniformScale.html b/docs/functions/mat4.uniformScale.html index 062162d..f51d476 100644 --- a/docs/functions/mat4.uniformScale.html +++ b/docs/functions/mat4.uniformScale.html @@ -1,6 +1,6 @@ -uniformScale | wgpu-matrix

Function uniformScale

  • Scales the given 4-by-4 matrix in each dimension by a uniform scale.

    -

    Parameters

    • m: Mat4

      The matrix to be modified.

      +uniformScale | wgpu-matrix

      Function uniformScale

      • Scales the given 4-by-4 matrix in each dimension by a uniform scale.

        +

        Type Parameters

        Parameters

        • m: BaseArgType

          The matrix to be modified.

        • s: number

          The amount to scale.

          -
        • Optional dst: Mat4

          matrix to hold result. If not passed a new one is created.

          -

        Returns Mat4

        The scaled matrix.

        -
      \ No newline at end of file +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The scaled matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat4.uniformScaling.html b/docs/functions/mat4.uniformScaling.html index 24a0fbe..3308fea 100644 --- a/docs/functions/mat4.uniformScaling.html +++ b/docs/functions/mat4.uniformScaling.html @@ -1,5 +1,5 @@ -uniformScaling | wgpu-matrix

Function uniformScaling

  • Creates a 4-by-4 matrix which scales a uniform amount in each dimension.

    -

    Parameters

    • s: number

      the amount to scale

      -
    • Optional dst: Mat4

      matrix to hold result. If not passed a new one is created.

      -

    Returns Mat4

    The scaling matrix.

    -
\ No newline at end of file +uniformScaling | wgpu-matrix

Function uniformScaling

  • Creates a 4-by-4 matrix which scales a uniform amount in each dimension.

    +

    Type Parameters

    Parameters

    • s: number

      the amount to scale

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The scaling matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat4d.aim.html b/docs/functions/mat4d.aim.html new file mode 100644 index 0000000..f3cf55c --- /dev/null +++ b/docs/functions/mat4d.aim.html @@ -0,0 +1,10 @@ +aim | wgpu-matrix
  • Computes a 4-by-4 aim transformation.

    +

    This is a matrix which positions an object aiming down positive Z. +toward the target.

    +

    Note: this is NOT the inverse of lookAt as lookAt looks at negative Z.

    +

    Type Parameters

    Parameters

    • position: BaseArgType

      The position of the object.

      +
    • target: BaseArgType

      The position meant to be aimed at.

      +
    • up: BaseArgType

      A vector pointing up.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The aim matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat4d.axisRotate.html b/docs/functions/mat4d.axisRotate.html new file mode 100644 index 0000000..330bf88 --- /dev/null +++ b/docs/functions/mat4d.axisRotate.html @@ -0,0 +1,9 @@ +axisRotate | wgpu-matrix

Function axisRotate

  • Rotates the given 4-by-4 matrix around the given axis by the +given angle.

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix.

      +
    • axis: BaseArgType

      The axis +about which to rotate.

      +
    • angleInRadians: number

      The angle by which to rotate (in radians).

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The rotated matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat4d.axisRotation.html b/docs/functions/mat4d.axisRotation.html new file mode 100644 index 0000000..bae350c --- /dev/null +++ b/docs/functions/mat4d.axisRotation.html @@ -0,0 +1,9 @@ +axisRotation | wgpu-matrix

Function axisRotation

  • Creates a 4-by-4 matrix which rotates around the given axis by the given +angle.

    +

    Type Parameters

    Parameters

    • axis: BaseArgType

      The axis +about which to rotate.

      +
    • angleInRadians: number

      The angle by which to rotate (in radians).

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    A matrix which rotates angle radians +around the axis.

    +
\ No newline at end of file diff --git a/docs/functions/mat4d.cameraAim.html b/docs/functions/mat4d.cameraAim.html new file mode 100644 index 0000000..3e41af5 --- /dev/null +++ b/docs/functions/mat4d.cameraAim.html @@ -0,0 +1,10 @@ +cameraAim | wgpu-matrix

Function cameraAim

  • Computes a 4-by-4 camera aim transformation.

    +

    This is a matrix which positions an object aiming down negative Z. +toward the target.

    +

    Note: this is the inverse of lookAt

    +

    Type Parameters

    Parameters

    • eye: BaseArgType

      The position of the object.

      +
    • target: BaseArgType

      The position meant to be aimed at.

      +
    • up: BaseArgType

      A vector pointing up.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The aim matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat4d.clone.html b/docs/functions/mat4d.clone.html new file mode 100644 index 0000000..6edd17c --- /dev/null +++ b/docs/functions/mat4d.clone.html @@ -0,0 +1,6 @@ +clone | wgpu-matrix

Function clone

\ No newline at end of file diff --git a/docs/functions/mat4d.copy.html b/docs/functions/mat4d.copy.html new file mode 100644 index 0000000..05d5487 --- /dev/null +++ b/docs/functions/mat4d.copy.html @@ -0,0 +1,6 @@ +copy | wgpu-matrix
\ No newline at end of file diff --git a/docs/functions/mat4d.create.html b/docs/functions/mat4d.create.html new file mode 100644 index 0000000..e88c537 --- /dev/null +++ b/docs/functions/mat4d.create.html @@ -0,0 +1,26 @@ +create | wgpu-matrix

Function create

  • Create a Mat4 from values

    +

    Note: Since passing in a raw JavaScript array +is valid in all circumstances, if you want to +force a JavaScript array into a Mat4's specified type +it would be faster to use

    +
    const m = mat4.clone(someJSArray);
    +
    + +

    Parameters

    • Optional v0: number

      value for element 0

      +
    • Optional v1: number

      value for element 1

      +
    • Optional v2: number

      value for element 2

      +
    • Optional v3: number

      value for element 3

      +
    • Optional v4: number

      value for element 4

      +
    • Optional v5: number

      value for element 5

      +
    • Optional v6: number

      value for element 6

      +
    • Optional v7: number

      value for element 7

      +
    • Optional v8: number

      value for element 8

      +
    • Optional v9: number

      value for element 9

      +
    • Optional v10: number

      value for element 10

      +
    • Optional v11: number

      value for element 11

      +
    • Optional v12: number

      value for element 12

      +
    • Optional v13: number

      value for element 13

      +
    • Optional v14: number

      value for element 14

      +
    • Optional v15: number

      value for element 15

      +

    Returns Float64Array

    created from values.

    +
\ No newline at end of file diff --git a/docs/functions/mat4d.determinant.html b/docs/functions/mat4d.determinant.html new file mode 100644 index 0000000..32ef957 --- /dev/null +++ b/docs/functions/mat4d.determinant.html @@ -0,0 +1,4 @@ +determinant | wgpu-matrix

Function determinant

  • Compute the determinant of a matrix

    +

    Parameters

    Returns number

    the determinant

    +
\ No newline at end of file diff --git a/docs/functions/mat4d.equals.html b/docs/functions/mat4d.equals.html new file mode 100644 index 0000000..9612b25 --- /dev/null +++ b/docs/functions/mat4d.equals.html @@ -0,0 +1,5 @@ +equals | wgpu-matrix

Function equals

  • Check if 2 matrices are exactly equal

    +

    Parameters

    Returns boolean

    true if matrices are exactly equal

    +
\ No newline at end of file diff --git a/docs/functions/mat4d.equalsApproximately.html b/docs/functions/mat4d.equalsApproximately.html new file mode 100644 index 0000000..0f23421 --- /dev/null +++ b/docs/functions/mat4d.equalsApproximately.html @@ -0,0 +1,5 @@ +equalsApproximately | wgpu-matrix

Function equalsApproximately

  • Check if 2 matrices are approximately equal

    +

    Parameters

    Returns boolean

    true if matrices are approximately equal

    +
\ No newline at end of file diff --git a/docs/functions/mat4d.fromMat3.html b/docs/functions/mat4d.fromMat3.html new file mode 100644 index 0000000..c26b36d --- /dev/null +++ b/docs/functions/mat4d.fromMat3.html @@ -0,0 +1,5 @@ +fromMat3 | wgpu-matrix

Function fromMat3

  • Creates a Mat4 from a Mat3

    +

    Type Parameters

    Parameters

    • m3: BaseArgType

      source matrix

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    Mat4 made from m3

    +
\ No newline at end of file diff --git a/docs/functions/mat4d.fromQuat.html b/docs/functions/mat4d.fromQuat.html new file mode 100644 index 0000000..22bd0b2 --- /dev/null +++ b/docs/functions/mat4d.fromQuat.html @@ -0,0 +1,5 @@ +fromQuat | wgpu-matrix

Function fromQuat

  • Creates a Mat4 rotation matrix from a quaternion

    +

    Type Parameters

    Parameters

    • q: BaseArgType

      quaternion to create matrix from

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    Mat4 made from q

    +
\ No newline at end of file diff --git a/docs/functions/mat4d.frustum.html b/docs/functions/mat4d.frustum.html new file mode 100644 index 0000000..e78ca0d --- /dev/null +++ b/docs/functions/mat4d.frustum.html @@ -0,0 +1,17 @@ +frustum | wgpu-matrix

Function frustum

  • Computes a 4-by-4 perspective transformation matrix given the left, right, +top, bottom, near and far clipping planes. The arguments define a frustum +extending in the negative z direction. The arguments near and far are the +distances to the near and far clipping planes. Note that near and far are not +z coordinates, but rather they are distances along the negative z-axis. The +matrix generated sends the viewing frustum to the unit box. We assume a unit +box extending from -1 to 1 in the x and y dimensions and from 0 to 1 in the z +dimension.

    +

    Type Parameters

    Parameters

    • left: number

      The x coordinate of the left plane of the box.

      +
    • right: number

      The x coordinate of the right plane of the box.

      +
    • bottom: number

      The y coordinate of the bottom plane of the box.

      +
    • top: number

      The y coordinate of the right plane of the box.

      +
    • near: number

      The negative z coordinate of the near plane of the box.

      +
    • far: number

      The negative z coordinate of the far plane of the box.

      +
    • Optional dst: T

      Output matrix. If not passed a new one is created.

      +

    Returns T

    The perspective projection matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat4d.frustumReverseZ.html b/docs/functions/mat4d.frustumReverseZ.html new file mode 100644 index 0000000..0ed7514 --- /dev/null +++ b/docs/functions/mat4d.frustumReverseZ.html @@ -0,0 +1,17 @@ +frustumReverseZ | wgpu-matrix

Function frustumReverseZ

  • Computes a 4-by-4 reverse-z perspective transformation matrix given the left, right, +top, bottom, near and far clipping planes. The arguments define a frustum +extending in the negative z direction. The arguments near and far are the +distances to the near and far clipping planes. Note that near and far are not +z coordinates, but rather they are distances along the negative z-axis. The +matrix generated sends the viewing frustum to the unit box. We assume a unit +box extending from -1 to 1 in the x and y dimensions and from 1 (-near) to 0 (-far) in the z +dimension.

    +

    Type Parameters

    Parameters

    • left: number

      The x coordinate of the left plane of the box.

      +
    • right: number

      The x coordinate of the right plane of the box.

      +
    • bottom: number

      The y coordinate of the bottom plane of the box.

      +
    • top: number

      The y coordinate of the right plane of the box.

      +
    • near: number

      The negative z coordinate of the near plane of the box.

      +
    • far: number = Infinity

      The negative z coordinate of the far plane of the box.

      +
    • Optional dst: T

      Output matrix. If not passed a new one is created.

      +

    Returns T

    The perspective projection matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat4d.getAxis.html b/docs/functions/mat4d.getAxis.html new file mode 100644 index 0000000..89c2b3c --- /dev/null +++ b/docs/functions/mat4d.getAxis.html @@ -0,0 +1,5 @@ +getAxis | wgpu-matrix

Function getAxis

  • Returns an axis of a 4x4 matrix as a vector with 3 entries

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix.

      +
    • axis: number

      The axis 0 = x, 1 = y, 2 = z;

      +
    • Optional dst: T

    Returns Float64Array | T

    The axis component of m.

    +
\ No newline at end of file diff --git a/docs/functions/mat4d.getScaling.html b/docs/functions/mat4d.getScaling.html new file mode 100644 index 0000000..753d45e --- /dev/null +++ b/docs/functions/mat4d.getScaling.html @@ -0,0 +1 @@ +getScaling | wgpu-matrix

Function getScaling

\ No newline at end of file diff --git a/docs/functions/mat4d.getTranslation.html b/docs/functions/mat4d.getTranslation.html new file mode 100644 index 0000000..3b8d48b --- /dev/null +++ b/docs/functions/mat4d.getTranslation.html @@ -0,0 +1 @@ +getTranslation | wgpu-matrix

Function getTranslation

\ No newline at end of file diff --git a/docs/functions/mat4d.identity.html b/docs/functions/mat4d.identity.html new file mode 100644 index 0000000..cacf120 --- /dev/null +++ b/docs/functions/mat4d.identity.html @@ -0,0 +1,4 @@ +identity | wgpu-matrix

Function identity

  • Creates a 4-by-4 identity matrix.

    +

    Type Parameters

    Parameters

    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    A 4-by-4 identity matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat4d.inverse.html b/docs/functions/mat4d.inverse.html new file mode 100644 index 0000000..b9314d4 --- /dev/null +++ b/docs/functions/mat4d.inverse.html @@ -0,0 +1,5 @@ +inverse | wgpu-matrix

Function inverse

  • Computes the inverse of a 4-by-4 matrix.

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The inverse of m.

    +
\ No newline at end of file diff --git a/docs/functions/mat4d.invert.html b/docs/functions/mat4d.invert.html new file mode 100644 index 0000000..efc63b9 --- /dev/null +++ b/docs/functions/mat4d.invert.html @@ -0,0 +1,5 @@ +invert | wgpu-matrix

Function invert

  • Computes the inverse of a 4-by-4 matrix.

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The inverse of m.

    +
\ No newline at end of file diff --git a/docs/functions/mat4d.lookAt.html b/docs/functions/mat4d.lookAt.html new file mode 100644 index 0000000..f389a70 --- /dev/null +++ b/docs/functions/mat4d.lookAt.html @@ -0,0 +1,9 @@ +lookAt | wgpu-matrix

Function lookAt

  • Computes a 4-by-4 view transformation.

    +

    This is a view matrix which transforms all other objects +to be in the space of the view defined by the parameters.

    +

    Type Parameters

    Parameters

    • eye: BaseArgType

      The position of the object.

      +
    • target: BaseArgType

      The position meant to be aimed at.

      +
    • up: BaseArgType

      A vector pointing up.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The look-at matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat4d.mul.html b/docs/functions/mat4d.mul.html new file mode 100644 index 0000000..d294a04 --- /dev/null +++ b/docs/functions/mat4d.mul.html @@ -0,0 +1,6 @@ +mul | wgpu-matrix
  • Multiplies two 4-by-4 matrices with a on the left and b on the right

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      The matrix on the left.

      +
    • b: BaseArgType

      The matrix on the right.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The matrix product of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/mat4d.multiply.html b/docs/functions/mat4d.multiply.html new file mode 100644 index 0000000..96651e5 --- /dev/null +++ b/docs/functions/mat4d.multiply.html @@ -0,0 +1,6 @@ +multiply | wgpu-matrix

Function multiply

  • Multiplies two 4-by-4 matrices with a on the left and b on the right

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      The matrix on the left.

      +
    • b: BaseArgType

      The matrix on the right.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The matrix product of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/mat4d.negate.html b/docs/functions/mat4d.negate.html new file mode 100644 index 0000000..b6e8568 --- /dev/null +++ b/docs/functions/mat4d.negate.html @@ -0,0 +1,5 @@ +negate | wgpu-matrix

Function negate

  • Negates a matrix.

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    -m.

    +
\ No newline at end of file diff --git a/docs/functions/mat4d.ortho.html b/docs/functions/mat4d.ortho.html new file mode 100644 index 0000000..da08cd7 --- /dev/null +++ b/docs/functions/mat4d.ortho.html @@ -0,0 +1,14 @@ +ortho | wgpu-matrix

Function ortho

  • Computes a 4-by-4 orthogonal transformation matrix that transforms from +the given the left, right, bottom, and top dimensions to -1 +1 in x, and y +and 0 to +1 in z.

    +

    Type Parameters

    Parameters

    • left: number

      Left side of the near clipping plane viewport.

      +
    • right: number

      Right side of the near clipping plane viewport.

      +
    • bottom: number

      Bottom of the near clipping plane viewport.

      +
    • top: number

      Top of the near clipping plane viewport.

      +
    • near: number

      The depth (negative z coordinate) +of the near clipping plane.

      +
    • far: number

      The depth (negative z coordinate) +of the far clipping plane.

      +
    • Optional dst: T

      Output matrix. If not passed a new one is created.

      +

    Returns T

    The orthographic projection matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat4d.perspective.html b/docs/functions/mat4d.perspective.html new file mode 100644 index 0000000..6fe455d --- /dev/null +++ b/docs/functions/mat4d.perspective.html @@ -0,0 +1,22 @@ +perspective | wgpu-matrix

Function perspective

  • Computes a 4-by-4 perspective transformation matrix given the angular height +of the frustum, the aspect ratio, and the near and far clipping planes. The +arguments define a frustum extending in the negative z direction. The given +angle is the vertical angle of the frustum, and the horizontal angle is +determined to produce the given aspect ratio. The arguments near and far are +the distances to the near and far clipping planes. Note that near and far +are not z coordinates, but rather they are distances along the negative +z-axis. The matrix generated sends the viewing frustum to the unit box. +We assume a unit box extending from -1 to 1 in the x and y dimensions and +from 0 to 1 in the z dimension.

    +

    Note: If you pass Infinity for zFar then it will produce a projection matrix +returns -Infinity for Z when transforming coordinates with Z <= 0 and +Infinity for Z +otherwise.

    +

    Type Parameters

    Parameters

    • fieldOfViewYInRadians: number

      The camera angle from top to bottom (in radians).

      +
    • aspect: number

      The aspect ratio width / height.

      +
    • zNear: number

      The depth (negative z coordinate) +of the near clipping plane.

      +
    • zFar: number

      The depth (negative z coordinate) +of the far clipping plane.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The perspective matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat4d.perspectiveReverseZ.html b/docs/functions/mat4d.perspectiveReverseZ.html new file mode 100644 index 0000000..e952d6b --- /dev/null +++ b/docs/functions/mat4d.perspectiveReverseZ.html @@ -0,0 +1,19 @@ +perspectiveReverseZ | wgpu-matrix

Function perspectiveReverseZ

  • Computes a 4-by-4 reverse-z perspective transformation matrix given the angular height +of the frustum, the aspect ratio, and the near and far clipping planes. The +arguments define a frustum extending in the negative z direction. The given +angle is the vertical angle of the frustum, and the horizontal angle is +determined to produce the given aspect ratio. The arguments near and far are +the distances to the near and far clipping planes. Note that near and far +are not z coordinates, but rather they are distances along the negative +z-axis. The matrix generated sends the viewing frustum to the unit box. +We assume a unit box extending from -1 to 1 in the x and y dimensions and +from 1 (at -zNear) to 0 (at -zFar) in the z dimension.

    +

    Type Parameters

    Parameters

    • fieldOfViewYInRadians: number

      The camera angle from top to bottom (in radians).

      +
    • aspect: number

      The aspect ratio width / height.

      +
    • zNear: number

      The depth (negative z coordinate) +of the near clipping plane.

      +
    • zFar: number = Infinity

      The depth (negative z coordinate) +of the far clipping plane. (default = Infinity)

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The perspective matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat4d.rotate.html b/docs/functions/mat4d.rotate.html new file mode 100644 index 0000000..b971448 --- /dev/null +++ b/docs/functions/mat4d.rotate.html @@ -0,0 +1,9 @@ +rotate | wgpu-matrix

Function rotate

  • Rotates the given 4-by-4 matrix around the given axis by the +given angle.

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix.

      +
    • axis: BaseArgType

      The axis +about which to rotate.

      +
    • angleInRadians: number

      The angle by which to rotate (in radians).

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The rotated matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat4d.rotateX.html b/docs/functions/mat4d.rotateX.html new file mode 100644 index 0000000..9ec0895 --- /dev/null +++ b/docs/functions/mat4d.rotateX.html @@ -0,0 +1,7 @@ +rotateX | wgpu-matrix

Function rotateX

  • Rotates the given 4-by-4 matrix around the x-axis by the given +angle.

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix.

      +
    • angleInRadians: number

      The angle by which to rotate (in radians).

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The rotated matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat4d.rotateY.html b/docs/functions/mat4d.rotateY.html new file mode 100644 index 0000000..134574d --- /dev/null +++ b/docs/functions/mat4d.rotateY.html @@ -0,0 +1,7 @@ +rotateY | wgpu-matrix

Function rotateY

  • Rotates the given 4-by-4 matrix around the y-axis by the given +angle.

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix.

      +
    • angleInRadians: number

      The angle by which to rotate (in radians).

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The rotated matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat4d.rotateZ.html b/docs/functions/mat4d.rotateZ.html new file mode 100644 index 0000000..b5bd0e8 --- /dev/null +++ b/docs/functions/mat4d.rotateZ.html @@ -0,0 +1,7 @@ +rotateZ | wgpu-matrix

Function rotateZ

  • Rotates the given 4-by-4 matrix around the z-axis by the given +angle.

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix.

      +
    • angleInRadians: number

      The angle by which to rotate (in radians).

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The rotated matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat4d.rotation.html b/docs/functions/mat4d.rotation.html new file mode 100644 index 0000000..48ef7fb --- /dev/null +++ b/docs/functions/mat4d.rotation.html @@ -0,0 +1,9 @@ +rotation | wgpu-matrix

Function rotation

  • Creates a 4-by-4 matrix which rotates around the given axis by the given +angle.

    +

    Type Parameters

    Parameters

    • axis: BaseArgType

      The axis +about which to rotate.

      +
    • angleInRadians: number

      The angle by which to rotate (in radians).

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    A matrix which rotates angle radians +around the axis.

    +
\ No newline at end of file diff --git a/docs/functions/mat4d.rotationX.html b/docs/functions/mat4d.rotationX.html new file mode 100644 index 0000000..8e241f3 --- /dev/null +++ b/docs/functions/mat4d.rotationX.html @@ -0,0 +1,5 @@ +rotationX | wgpu-matrix

Function rotationX

  • Creates a 4-by-4 matrix which rotates around the x-axis by the given angle.

    +

    Type Parameters

    Parameters

    • angleInRadians: number

      The angle by which to rotate (in radians).

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The rotation matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat4d.rotationY.html b/docs/functions/mat4d.rotationY.html new file mode 100644 index 0000000..c3c3385 --- /dev/null +++ b/docs/functions/mat4d.rotationY.html @@ -0,0 +1,5 @@ +rotationY | wgpu-matrix

Function rotationY

  • Creates a 4-by-4 matrix which rotates around the y-axis by the given angle.

    +

    Type Parameters

    Parameters

    • angleInRadians: number

      The angle by which to rotate (in radians).

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The rotation matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat4d.rotationZ.html b/docs/functions/mat4d.rotationZ.html new file mode 100644 index 0000000..3b0a540 --- /dev/null +++ b/docs/functions/mat4d.rotationZ.html @@ -0,0 +1,5 @@ +rotationZ | wgpu-matrix

Function rotationZ

  • Creates a 4-by-4 matrix which rotates around the z-axis by the given angle.

    +

    Type Parameters

    Parameters

    • angleInRadians: number

      The angle by which to rotate (in radians).

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The rotation matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat4d.scale.html b/docs/functions/mat4d.scale.html new file mode 100644 index 0000000..a3aaa38 --- /dev/null +++ b/docs/functions/mat4d.scale.html @@ -0,0 +1,9 @@ +scale | wgpu-matrix

Function scale

  • Scales the given 4-by-4 matrix in each dimension by an amount +given by the corresponding entry in the given vector; assumes the vector has +three entries.

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix to be modified.

      +
    • v: BaseArgType

      A vector of three entries specifying the +factor by which to scale in each dimension.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The scaled matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat4d.scaling.html b/docs/functions/mat4d.scaling.html new file mode 100644 index 0000000..3687d0c --- /dev/null +++ b/docs/functions/mat4d.scaling.html @@ -0,0 +1,8 @@ +scaling | wgpu-matrix

Function scaling

  • Creates a 4-by-4 matrix which scales in each dimension by an amount given by +the corresponding entry in the given vector; assumes the vector has three +entries.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      A vector of +three entries specifying the factor by which to scale in each dimension.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The scaling matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat4d.set.html b/docs/functions/mat4d.set.html new file mode 100644 index 0000000..a898538 --- /dev/null +++ b/docs/functions/mat4d.set.html @@ -0,0 +1,21 @@ +set | wgpu-matrix
  • Sets the values of a Mat4 +Also see mat4.create and mat4.copy

    +

    Type Parameters

    Parameters

    • v0: number

      value for element 0

      +
    • v1: number

      value for element 1

      +
    • v2: number

      value for element 2

      +
    • v3: number

      value for element 3

      +
    • v4: number

      value for element 4

      +
    • v5: number

      value for element 5

      +
    • v6: number

      value for element 6

      +
    • v7: number

      value for element 7

      +
    • v8: number

      value for element 8

      +
    • v9: number

      value for element 9

      +
    • v10: number

      value for element 10

      +
    • v11: number

      value for element 11

      +
    • v12: number

      value for element 12

      +
    • v13: number

      value for element 13

      +
    • v14: number

      value for element 14

      +
    • v15: number

      value for element 15

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    Mat4 created from values.

    +
\ No newline at end of file diff --git a/docs/functions/mat4d.setAxis.html b/docs/functions/mat4d.setAxis.html new file mode 100644 index 0000000..2715c06 --- /dev/null +++ b/docs/functions/mat4d.setAxis.html @@ -0,0 +1,7 @@ +setAxis | wgpu-matrix

Function setAxis

  • Sets an axis of a 4x4 matrix as a vector with 3 entries

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix.

      +
    • v: BaseArgType

      the axis vector

      +
    • axis: number

      The axis 0 = x, 1 = y, 2 = z;

      +
    • dst: T

      The matrix to set. If not passed a new one is created.

      +

    Returns T

    The matrix with axis set.

    +
\ No newline at end of file diff --git a/docs/functions/mat4d.setTranslation.html b/docs/functions/mat4d.setTranslation.html new file mode 100644 index 0000000..6435bd3 --- /dev/null +++ b/docs/functions/mat4d.setTranslation.html @@ -0,0 +1,7 @@ +setTranslation | wgpu-matrix

Function setTranslation

  • Sets the translation component of a 4-by-4 matrix to the given +vector.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      The matrix.

      +
    • v: BaseArgType

      The vector.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The matrix with translation set.

    +
\ No newline at end of file diff --git a/docs/functions/mat4d.translate.html b/docs/functions/mat4d.translate.html new file mode 100644 index 0000000..b3ceda8 --- /dev/null +++ b/docs/functions/mat4d.translate.html @@ -0,0 +1,7 @@ +translate | wgpu-matrix

Function translate

  • Translates the given 4-by-4 matrix by the given vector v.

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix.

      +
    • v: BaseArgType

      The vector by +which to translate.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The translated matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat4d.translation.html b/docs/functions/mat4d.translation.html new file mode 100644 index 0000000..5ea6d56 --- /dev/null +++ b/docs/functions/mat4d.translation.html @@ -0,0 +1,6 @@ +translation | wgpu-matrix

Function translation

  • Creates a 4-by-4 matrix which translates by the given vector v.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector by +which to translate.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The translation matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat4d.transpose.html b/docs/functions/mat4d.transpose.html new file mode 100644 index 0000000..1afcc8e --- /dev/null +++ b/docs/functions/mat4d.transpose.html @@ -0,0 +1,5 @@ +transpose | wgpu-matrix

Function transpose

  • Takes the transpose of a matrix.

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The transpose of m.

    +
\ No newline at end of file diff --git a/docs/functions/mat4d.uniformScale.html b/docs/functions/mat4d.uniformScale.html new file mode 100644 index 0000000..a8fdd46 --- /dev/null +++ b/docs/functions/mat4d.uniformScale.html @@ -0,0 +1,6 @@ +uniformScale | wgpu-matrix

Function uniformScale

  • Scales the given 4-by-4 matrix in each dimension by a uniform scale.

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix to be modified.

      +
    • s: number

      The amount to scale.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The scaled matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat4d.uniformScaling.html b/docs/functions/mat4d.uniformScaling.html new file mode 100644 index 0000000..d860ab4 --- /dev/null +++ b/docs/functions/mat4d.uniformScaling.html @@ -0,0 +1,5 @@ +uniformScaling | wgpu-matrix

Function uniformScaling

  • Creates a 4-by-4 matrix which scales a uniform amount in each dimension.

    +

    Type Parameters

    Parameters

    • s: number

      the amount to scale

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The scaling matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat4n.aim.html b/docs/functions/mat4n.aim.html new file mode 100644 index 0000000..e92580f --- /dev/null +++ b/docs/functions/mat4n.aim.html @@ -0,0 +1,10 @@ +aim | wgpu-matrix
  • Computes a 4-by-4 aim transformation.

    +

    This is a matrix which positions an object aiming down positive Z. +toward the target.

    +

    Note: this is NOT the inverse of lookAt as lookAt looks at negative Z.

    +

    Type Parameters

    Parameters

    • position: BaseArgType

      The position of the object.

      +
    • target: BaseArgType

      The position meant to be aimed at.

      +
    • up: BaseArgType

      A vector pointing up.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The aim matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat4n.axisRotate.html b/docs/functions/mat4n.axisRotate.html new file mode 100644 index 0000000..7c1f7ff --- /dev/null +++ b/docs/functions/mat4n.axisRotate.html @@ -0,0 +1,9 @@ +axisRotate | wgpu-matrix

Function axisRotate

  • Rotates the given 4-by-4 matrix around the given axis by the +given angle.

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix.

      +
    • axis: BaseArgType

      The axis +about which to rotate.

      +
    • angleInRadians: number

      The angle by which to rotate (in radians).

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The rotated matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat4n.axisRotation.html b/docs/functions/mat4n.axisRotation.html new file mode 100644 index 0000000..a751dbd --- /dev/null +++ b/docs/functions/mat4n.axisRotation.html @@ -0,0 +1,9 @@ +axisRotation | wgpu-matrix

Function axisRotation

  • Creates a 4-by-4 matrix which rotates around the given axis by the given +angle.

    +

    Type Parameters

    Parameters

    • axis: BaseArgType

      The axis +about which to rotate.

      +
    • angleInRadians: number

      The angle by which to rotate (in radians).

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    A matrix which rotates angle radians +around the axis.

    +
\ No newline at end of file diff --git a/docs/functions/mat4n.cameraAim.html b/docs/functions/mat4n.cameraAim.html new file mode 100644 index 0000000..5e85401 --- /dev/null +++ b/docs/functions/mat4n.cameraAim.html @@ -0,0 +1,10 @@ +cameraAim | wgpu-matrix

Function cameraAim

  • Computes a 4-by-4 camera aim transformation.

    +

    This is a matrix which positions an object aiming down negative Z. +toward the target.

    +

    Note: this is the inverse of lookAt

    +

    Type Parameters

    Parameters

    • eye: BaseArgType

      The position of the object.

      +
    • target: BaseArgType

      The position meant to be aimed at.

      +
    • up: BaseArgType

      A vector pointing up.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The aim matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat4n.clone.html b/docs/functions/mat4n.clone.html new file mode 100644 index 0000000..063c93d --- /dev/null +++ b/docs/functions/mat4n.clone.html @@ -0,0 +1,6 @@ +clone | wgpu-matrix

Function clone

\ No newline at end of file diff --git a/docs/functions/mat4n.copy.html b/docs/functions/mat4n.copy.html new file mode 100644 index 0000000..47bbb8f --- /dev/null +++ b/docs/functions/mat4n.copy.html @@ -0,0 +1,6 @@ +copy | wgpu-matrix
\ No newline at end of file diff --git a/docs/functions/mat4n.create.html b/docs/functions/mat4n.create.html new file mode 100644 index 0000000..a58af72 --- /dev/null +++ b/docs/functions/mat4n.create.html @@ -0,0 +1,26 @@ +create | wgpu-matrix

Function create

  • Create a Mat4 from values

    +

    Note: Since passing in a raw JavaScript array +is valid in all circumstances, if you want to +force a JavaScript array into a Mat4's specified type +it would be faster to use

    +
    const m = mat4.clone(someJSArray);
    +
    + +

    Parameters

    • Optional v0: number

      value for element 0

      +
    • Optional v1: number

      value for element 1

      +
    • Optional v2: number

      value for element 2

      +
    • Optional v3: number

      value for element 3

      +
    • Optional v4: number

      value for element 4

      +
    • Optional v5: number

      value for element 5

      +
    • Optional v6: number

      value for element 6

      +
    • Optional v7: number

      value for element 7

      +
    • Optional v8: number

      value for element 8

      +
    • Optional v9: number

      value for element 9

      +
    • Optional v10: number

      value for element 10

      +
    • Optional v11: number

      value for element 11

      +
    • Optional v12: number

      value for element 12

      +
    • Optional v13: number

      value for element 13

      +
    • Optional v14: number

      value for element 14

      +
    • Optional v15: number

      value for element 15

      +

    Returns number[]

    created from values.

    +
\ No newline at end of file diff --git a/docs/functions/mat4n.determinant.html b/docs/functions/mat4n.determinant.html new file mode 100644 index 0000000..d1ab8e7 --- /dev/null +++ b/docs/functions/mat4n.determinant.html @@ -0,0 +1,4 @@ +determinant | wgpu-matrix

Function determinant

  • Compute the determinant of a matrix

    +

    Parameters

    Returns number

    the determinant

    +
\ No newline at end of file diff --git a/docs/functions/mat4n.equals.html b/docs/functions/mat4n.equals.html new file mode 100644 index 0000000..b285e34 --- /dev/null +++ b/docs/functions/mat4n.equals.html @@ -0,0 +1,5 @@ +equals | wgpu-matrix

Function equals

  • Check if 2 matrices are exactly equal

    +

    Parameters

    Returns boolean

    true if matrices are exactly equal

    +
\ No newline at end of file diff --git a/docs/functions/mat4n.equalsApproximately.html b/docs/functions/mat4n.equalsApproximately.html new file mode 100644 index 0000000..d82acb1 --- /dev/null +++ b/docs/functions/mat4n.equalsApproximately.html @@ -0,0 +1,5 @@ +equalsApproximately | wgpu-matrix

Function equalsApproximately

  • Check if 2 matrices are approximately equal

    +

    Parameters

    Returns boolean

    true if matrices are approximately equal

    +
\ No newline at end of file diff --git a/docs/functions/mat4n.fromMat3.html b/docs/functions/mat4n.fromMat3.html new file mode 100644 index 0000000..bec3fc0 --- /dev/null +++ b/docs/functions/mat4n.fromMat3.html @@ -0,0 +1,5 @@ +fromMat3 | wgpu-matrix

Function fromMat3

  • Creates a Mat4 from a Mat3

    +

    Type Parameters

    Parameters

    • m3: BaseArgType

      source matrix

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    Mat4 made from m3

    +
\ No newline at end of file diff --git a/docs/functions/mat4n.fromQuat.html b/docs/functions/mat4n.fromQuat.html new file mode 100644 index 0000000..18d4256 --- /dev/null +++ b/docs/functions/mat4n.fromQuat.html @@ -0,0 +1,5 @@ +fromQuat | wgpu-matrix

Function fromQuat

  • Creates a Mat4 rotation matrix from a quaternion

    +

    Type Parameters

    Parameters

    • q: BaseArgType

      quaternion to create matrix from

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    Mat4 made from q

    +
\ No newline at end of file diff --git a/docs/functions/mat4n.frustum.html b/docs/functions/mat4n.frustum.html new file mode 100644 index 0000000..3d87471 --- /dev/null +++ b/docs/functions/mat4n.frustum.html @@ -0,0 +1,17 @@ +frustum | wgpu-matrix

Function frustum

  • Computes a 4-by-4 perspective transformation matrix given the left, right, +top, bottom, near and far clipping planes. The arguments define a frustum +extending in the negative z direction. The arguments near and far are the +distances to the near and far clipping planes. Note that near and far are not +z coordinates, but rather they are distances along the negative z-axis. The +matrix generated sends the viewing frustum to the unit box. We assume a unit +box extending from -1 to 1 in the x and y dimensions and from 0 to 1 in the z +dimension.

    +

    Type Parameters

    Parameters

    • left: number

      The x coordinate of the left plane of the box.

      +
    • right: number

      The x coordinate of the right plane of the box.

      +
    • bottom: number

      The y coordinate of the bottom plane of the box.

      +
    • top: number

      The y coordinate of the right plane of the box.

      +
    • near: number

      The negative z coordinate of the near plane of the box.

      +
    • far: number

      The negative z coordinate of the far plane of the box.

      +
    • Optional dst: T

      Output matrix. If not passed a new one is created.

      +

    Returns T

    The perspective projection matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat4n.frustumReverseZ.html b/docs/functions/mat4n.frustumReverseZ.html new file mode 100644 index 0000000..56d86ca --- /dev/null +++ b/docs/functions/mat4n.frustumReverseZ.html @@ -0,0 +1,17 @@ +frustumReverseZ | wgpu-matrix

Function frustumReverseZ

  • Computes a 4-by-4 reverse-z perspective transformation matrix given the left, right, +top, bottom, near and far clipping planes. The arguments define a frustum +extending in the negative z direction. The arguments near and far are the +distances to the near and far clipping planes. Note that near and far are not +z coordinates, but rather they are distances along the negative z-axis. The +matrix generated sends the viewing frustum to the unit box. We assume a unit +box extending from -1 to 1 in the x and y dimensions and from 1 (-near) to 0 (-far) in the z +dimension.

    +

    Type Parameters

    Parameters

    • left: number

      The x coordinate of the left plane of the box.

      +
    • right: number

      The x coordinate of the right plane of the box.

      +
    • bottom: number

      The y coordinate of the bottom plane of the box.

      +
    • top: number

      The y coordinate of the right plane of the box.

      +
    • near: number

      The negative z coordinate of the near plane of the box.

      +
    • far: number = Infinity

      The negative z coordinate of the far plane of the box.

      +
    • Optional dst: T

      Output matrix. If not passed a new one is created.

      +

    Returns T

    The perspective projection matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat4n.getAxis.html b/docs/functions/mat4n.getAxis.html new file mode 100644 index 0000000..6b1d8e7 --- /dev/null +++ b/docs/functions/mat4n.getAxis.html @@ -0,0 +1,5 @@ +getAxis | wgpu-matrix

Function getAxis

  • Returns an axis of a 4x4 matrix as a vector with 3 entries

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix.

      +
    • axis: number

      The axis 0 = x, 1 = y, 2 = z;

      +
    • Optional dst: T

    Returns number[] | T

    The axis component of m.

    +
\ No newline at end of file diff --git a/docs/functions/mat4n.getScaling.html b/docs/functions/mat4n.getScaling.html new file mode 100644 index 0000000..a599af7 --- /dev/null +++ b/docs/functions/mat4n.getScaling.html @@ -0,0 +1 @@ +getScaling | wgpu-matrix

Function getScaling

\ No newline at end of file diff --git a/docs/functions/mat4n.getTranslation.html b/docs/functions/mat4n.getTranslation.html new file mode 100644 index 0000000..f0f7f2d --- /dev/null +++ b/docs/functions/mat4n.getTranslation.html @@ -0,0 +1 @@ +getTranslation | wgpu-matrix

Function getTranslation

\ No newline at end of file diff --git a/docs/functions/mat4n.identity.html b/docs/functions/mat4n.identity.html new file mode 100644 index 0000000..033942e --- /dev/null +++ b/docs/functions/mat4n.identity.html @@ -0,0 +1,4 @@ +identity | wgpu-matrix

Function identity

  • Creates a 4-by-4 identity matrix.

    +

    Type Parameters

    Parameters

    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    A 4-by-4 identity matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat4n.inverse.html b/docs/functions/mat4n.inverse.html new file mode 100644 index 0000000..722ad30 --- /dev/null +++ b/docs/functions/mat4n.inverse.html @@ -0,0 +1,5 @@ +inverse | wgpu-matrix

Function inverse

  • Computes the inverse of a 4-by-4 matrix.

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The inverse of m.

    +
\ No newline at end of file diff --git a/docs/functions/mat4n.invert.html b/docs/functions/mat4n.invert.html new file mode 100644 index 0000000..afe2a77 --- /dev/null +++ b/docs/functions/mat4n.invert.html @@ -0,0 +1,5 @@ +invert | wgpu-matrix

Function invert

  • Computes the inverse of a 4-by-4 matrix.

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The inverse of m.

    +
\ No newline at end of file diff --git a/docs/functions/mat4n.lookAt.html b/docs/functions/mat4n.lookAt.html new file mode 100644 index 0000000..13fa231 --- /dev/null +++ b/docs/functions/mat4n.lookAt.html @@ -0,0 +1,9 @@ +lookAt | wgpu-matrix

Function lookAt

  • Computes a 4-by-4 view transformation.

    +

    This is a view matrix which transforms all other objects +to be in the space of the view defined by the parameters.

    +

    Type Parameters

    Parameters

    • eye: BaseArgType

      The position of the object.

      +
    • target: BaseArgType

      The position meant to be aimed at.

      +
    • up: BaseArgType

      A vector pointing up.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The look-at matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat4n.mul.html b/docs/functions/mat4n.mul.html new file mode 100644 index 0000000..56b129b --- /dev/null +++ b/docs/functions/mat4n.mul.html @@ -0,0 +1,6 @@ +mul | wgpu-matrix
  • Multiplies two 4-by-4 matrices with a on the left and b on the right

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      The matrix on the left.

      +
    • b: BaseArgType

      The matrix on the right.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The matrix product of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/mat4n.multiply.html b/docs/functions/mat4n.multiply.html new file mode 100644 index 0000000..75564ee --- /dev/null +++ b/docs/functions/mat4n.multiply.html @@ -0,0 +1,6 @@ +multiply | wgpu-matrix

Function multiply

  • Multiplies two 4-by-4 matrices with a on the left and b on the right

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      The matrix on the left.

      +
    • b: BaseArgType

      The matrix on the right.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The matrix product of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/mat4n.negate.html b/docs/functions/mat4n.negate.html new file mode 100644 index 0000000..0a94cd0 --- /dev/null +++ b/docs/functions/mat4n.negate.html @@ -0,0 +1,5 @@ +negate | wgpu-matrix

Function negate

  • Negates a matrix.

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    -m.

    +
\ No newline at end of file diff --git a/docs/functions/mat4n.ortho.html b/docs/functions/mat4n.ortho.html new file mode 100644 index 0000000..3b91fd3 --- /dev/null +++ b/docs/functions/mat4n.ortho.html @@ -0,0 +1,14 @@ +ortho | wgpu-matrix

Function ortho

  • Computes a 4-by-4 orthogonal transformation matrix that transforms from +the given the left, right, bottom, and top dimensions to -1 +1 in x, and y +and 0 to +1 in z.

    +

    Type Parameters

    Parameters

    • left: number

      Left side of the near clipping plane viewport.

      +
    • right: number

      Right side of the near clipping plane viewport.

      +
    • bottom: number

      Bottom of the near clipping plane viewport.

      +
    • top: number

      Top of the near clipping plane viewport.

      +
    • near: number

      The depth (negative z coordinate) +of the near clipping plane.

      +
    • far: number

      The depth (negative z coordinate) +of the far clipping plane.

      +
    • Optional dst: T

      Output matrix. If not passed a new one is created.

      +

    Returns T

    The orthographic projection matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat4n.perspective.html b/docs/functions/mat4n.perspective.html new file mode 100644 index 0000000..f7b94ea --- /dev/null +++ b/docs/functions/mat4n.perspective.html @@ -0,0 +1,22 @@ +perspective | wgpu-matrix

Function perspective

  • Computes a 4-by-4 perspective transformation matrix given the angular height +of the frustum, the aspect ratio, and the near and far clipping planes. The +arguments define a frustum extending in the negative z direction. The given +angle is the vertical angle of the frustum, and the horizontal angle is +determined to produce the given aspect ratio. The arguments near and far are +the distances to the near and far clipping planes. Note that near and far +are not z coordinates, but rather they are distances along the negative +z-axis. The matrix generated sends the viewing frustum to the unit box. +We assume a unit box extending from -1 to 1 in the x and y dimensions and +from 0 to 1 in the z dimension.

    +

    Note: If you pass Infinity for zFar then it will produce a projection matrix +returns -Infinity for Z when transforming coordinates with Z <= 0 and +Infinity for Z +otherwise.

    +

    Type Parameters

    Parameters

    • fieldOfViewYInRadians: number

      The camera angle from top to bottom (in radians).

      +
    • aspect: number

      The aspect ratio width / height.

      +
    • zNear: number

      The depth (negative z coordinate) +of the near clipping plane.

      +
    • zFar: number

      The depth (negative z coordinate) +of the far clipping plane.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The perspective matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat4n.perspectiveReverseZ.html b/docs/functions/mat4n.perspectiveReverseZ.html new file mode 100644 index 0000000..628d8b7 --- /dev/null +++ b/docs/functions/mat4n.perspectiveReverseZ.html @@ -0,0 +1,19 @@ +perspectiveReverseZ | wgpu-matrix

Function perspectiveReverseZ

  • Computes a 4-by-4 reverse-z perspective transformation matrix given the angular height +of the frustum, the aspect ratio, and the near and far clipping planes. The +arguments define a frustum extending in the negative z direction. The given +angle is the vertical angle of the frustum, and the horizontal angle is +determined to produce the given aspect ratio. The arguments near and far are +the distances to the near and far clipping planes. Note that near and far +are not z coordinates, but rather they are distances along the negative +z-axis. The matrix generated sends the viewing frustum to the unit box. +We assume a unit box extending from -1 to 1 in the x and y dimensions and +from 1 (at -zNear) to 0 (at -zFar) in the z dimension.

    +

    Type Parameters

    Parameters

    • fieldOfViewYInRadians: number

      The camera angle from top to bottom (in radians).

      +
    • aspect: number

      The aspect ratio width / height.

      +
    • zNear: number

      The depth (negative z coordinate) +of the near clipping plane.

      +
    • zFar: number = Infinity

      The depth (negative z coordinate) +of the far clipping plane. (default = Infinity)

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The perspective matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat4n.rotate.html b/docs/functions/mat4n.rotate.html new file mode 100644 index 0000000..afbcba1 --- /dev/null +++ b/docs/functions/mat4n.rotate.html @@ -0,0 +1,9 @@ +rotate | wgpu-matrix

Function rotate

  • Rotates the given 4-by-4 matrix around the given axis by the +given angle.

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix.

      +
    • axis: BaseArgType

      The axis +about which to rotate.

      +
    • angleInRadians: number

      The angle by which to rotate (in radians).

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The rotated matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat4n.rotateX.html b/docs/functions/mat4n.rotateX.html new file mode 100644 index 0000000..5a577e9 --- /dev/null +++ b/docs/functions/mat4n.rotateX.html @@ -0,0 +1,7 @@ +rotateX | wgpu-matrix

Function rotateX

  • Rotates the given 4-by-4 matrix around the x-axis by the given +angle.

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix.

      +
    • angleInRadians: number

      The angle by which to rotate (in radians).

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The rotated matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat4n.rotateY.html b/docs/functions/mat4n.rotateY.html new file mode 100644 index 0000000..b82877d --- /dev/null +++ b/docs/functions/mat4n.rotateY.html @@ -0,0 +1,7 @@ +rotateY | wgpu-matrix

Function rotateY

  • Rotates the given 4-by-4 matrix around the y-axis by the given +angle.

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix.

      +
    • angleInRadians: number

      The angle by which to rotate (in radians).

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The rotated matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat4n.rotateZ.html b/docs/functions/mat4n.rotateZ.html new file mode 100644 index 0000000..106477b --- /dev/null +++ b/docs/functions/mat4n.rotateZ.html @@ -0,0 +1,7 @@ +rotateZ | wgpu-matrix

Function rotateZ

  • Rotates the given 4-by-4 matrix around the z-axis by the given +angle.

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix.

      +
    • angleInRadians: number

      The angle by which to rotate (in radians).

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The rotated matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat4n.rotation.html b/docs/functions/mat4n.rotation.html new file mode 100644 index 0000000..522fbc0 --- /dev/null +++ b/docs/functions/mat4n.rotation.html @@ -0,0 +1,9 @@ +rotation | wgpu-matrix

Function rotation

  • Creates a 4-by-4 matrix which rotates around the given axis by the given +angle.

    +

    Type Parameters

    Parameters

    • axis: BaseArgType

      The axis +about which to rotate.

      +
    • angleInRadians: number

      The angle by which to rotate (in radians).

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    A matrix which rotates angle radians +around the axis.

    +
\ No newline at end of file diff --git a/docs/functions/mat4n.rotationX.html b/docs/functions/mat4n.rotationX.html new file mode 100644 index 0000000..43cc1ff --- /dev/null +++ b/docs/functions/mat4n.rotationX.html @@ -0,0 +1,5 @@ +rotationX | wgpu-matrix

Function rotationX

  • Creates a 4-by-4 matrix which rotates around the x-axis by the given angle.

    +

    Type Parameters

    Parameters

    • angleInRadians: number

      The angle by which to rotate (in radians).

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The rotation matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat4n.rotationY.html b/docs/functions/mat4n.rotationY.html new file mode 100644 index 0000000..66af7f2 --- /dev/null +++ b/docs/functions/mat4n.rotationY.html @@ -0,0 +1,5 @@ +rotationY | wgpu-matrix

Function rotationY

  • Creates a 4-by-4 matrix which rotates around the y-axis by the given angle.

    +

    Type Parameters

    Parameters

    • angleInRadians: number

      The angle by which to rotate (in radians).

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The rotation matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat4n.rotationZ.html b/docs/functions/mat4n.rotationZ.html new file mode 100644 index 0000000..4a5e8bc --- /dev/null +++ b/docs/functions/mat4n.rotationZ.html @@ -0,0 +1,5 @@ +rotationZ | wgpu-matrix

Function rotationZ

  • Creates a 4-by-4 matrix which rotates around the z-axis by the given angle.

    +

    Type Parameters

    Parameters

    • angleInRadians: number

      The angle by which to rotate (in radians).

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The rotation matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat4n.scale.html b/docs/functions/mat4n.scale.html new file mode 100644 index 0000000..54920f1 --- /dev/null +++ b/docs/functions/mat4n.scale.html @@ -0,0 +1,9 @@ +scale | wgpu-matrix

Function scale

  • Scales the given 4-by-4 matrix in each dimension by an amount +given by the corresponding entry in the given vector; assumes the vector has +three entries.

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix to be modified.

      +
    • v: BaseArgType

      A vector of three entries specifying the +factor by which to scale in each dimension.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The scaled matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat4n.scaling.html b/docs/functions/mat4n.scaling.html new file mode 100644 index 0000000..4a2d0d6 --- /dev/null +++ b/docs/functions/mat4n.scaling.html @@ -0,0 +1,8 @@ +scaling | wgpu-matrix

Function scaling

  • Creates a 4-by-4 matrix which scales in each dimension by an amount given by +the corresponding entry in the given vector; assumes the vector has three +entries.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      A vector of +three entries specifying the factor by which to scale in each dimension.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The scaling matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat4n.set.html b/docs/functions/mat4n.set.html new file mode 100644 index 0000000..02626e6 --- /dev/null +++ b/docs/functions/mat4n.set.html @@ -0,0 +1,21 @@ +set | wgpu-matrix
  • Sets the values of a Mat4 +Also see mat4.create and mat4.copy

    +

    Type Parameters

    Parameters

    • v0: number

      value for element 0

      +
    • v1: number

      value for element 1

      +
    • v2: number

      value for element 2

      +
    • v3: number

      value for element 3

      +
    • v4: number

      value for element 4

      +
    • v5: number

      value for element 5

      +
    • v6: number

      value for element 6

      +
    • v7: number

      value for element 7

      +
    • v8: number

      value for element 8

      +
    • v9: number

      value for element 9

      +
    • v10: number

      value for element 10

      +
    • v11: number

      value for element 11

      +
    • v12: number

      value for element 12

      +
    • v13: number

      value for element 13

      +
    • v14: number

      value for element 14

      +
    • v15: number

      value for element 15

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    Mat4 created from values.

    +
\ No newline at end of file diff --git a/docs/functions/mat4n.setAxis.html b/docs/functions/mat4n.setAxis.html new file mode 100644 index 0000000..4d9c248 --- /dev/null +++ b/docs/functions/mat4n.setAxis.html @@ -0,0 +1,7 @@ +setAxis | wgpu-matrix

Function setAxis

  • Sets an axis of a 4x4 matrix as a vector with 3 entries

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix.

      +
    • v: BaseArgType

      the axis vector

      +
    • axis: number

      The axis 0 = x, 1 = y, 2 = z;

      +
    • dst: T

      The matrix to set. If not passed a new one is created.

      +

    Returns T

    The matrix with axis set.

    +
\ No newline at end of file diff --git a/docs/functions/mat4n.setTranslation.html b/docs/functions/mat4n.setTranslation.html new file mode 100644 index 0000000..a25b6d6 --- /dev/null +++ b/docs/functions/mat4n.setTranslation.html @@ -0,0 +1,7 @@ +setTranslation | wgpu-matrix

Function setTranslation

  • Sets the translation component of a 4-by-4 matrix to the given +vector.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      The matrix.

      +
    • v: BaseArgType

      The vector.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The matrix with translation set.

    +
\ No newline at end of file diff --git a/docs/functions/mat4n.translate.html b/docs/functions/mat4n.translate.html new file mode 100644 index 0000000..5e53161 --- /dev/null +++ b/docs/functions/mat4n.translate.html @@ -0,0 +1,7 @@ +translate | wgpu-matrix

Function translate

  • Translates the given 4-by-4 matrix by the given vector v.

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix.

      +
    • v: BaseArgType

      The vector by +which to translate.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The translated matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat4n.translation.html b/docs/functions/mat4n.translation.html new file mode 100644 index 0000000..e457be9 --- /dev/null +++ b/docs/functions/mat4n.translation.html @@ -0,0 +1,6 @@ +translation | wgpu-matrix

Function translation

  • Creates a 4-by-4 matrix which translates by the given vector v.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector by +which to translate.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The translation matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat4n.transpose.html b/docs/functions/mat4n.transpose.html new file mode 100644 index 0000000..f0744f3 --- /dev/null +++ b/docs/functions/mat4n.transpose.html @@ -0,0 +1,5 @@ +transpose | wgpu-matrix

Function transpose

  • Takes the transpose of a matrix.

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The transpose of m.

    +
\ No newline at end of file diff --git a/docs/functions/mat4n.uniformScale.html b/docs/functions/mat4n.uniformScale.html new file mode 100644 index 0000000..a72126d --- /dev/null +++ b/docs/functions/mat4n.uniformScale.html @@ -0,0 +1,6 @@ +uniformScale | wgpu-matrix

Function uniformScale

  • Scales the given 4-by-4 matrix in each dimension by a uniform scale.

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix to be modified.

      +
    • s: number

      The amount to scale.

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The scaled matrix.

    +
\ No newline at end of file diff --git a/docs/functions/mat4n.uniformScaling.html b/docs/functions/mat4n.uniformScaling.html new file mode 100644 index 0000000..a23b947 --- /dev/null +++ b/docs/functions/mat4n.uniformScaling.html @@ -0,0 +1,5 @@ +uniformScaling | wgpu-matrix

Function uniformScaling

  • Creates a 4-by-4 matrix which scales a uniform amount in each dimension.

    +

    Type Parameters

    Parameters

    • s: number

      the amount to scale

      +
    • Optional dst: T

      matrix to hold result. If not passed a new one is created.

      +

    Returns T

    The scaling matrix.

    +
\ No newline at end of file diff --git a/docs/functions/quat.add.html b/docs/functions/quat.add.html index 4d5360b..5705024 100644 --- a/docs/functions/quat.add.html +++ b/docs/functions/quat.add.html @@ -1,6 +1,6 @@ -add | wgpu-matrix

Function add

  • Adds two quaternions; assumes a and b have the same dimension.

    -

    Parameters

    • a: Quat

      Operand quaternion.

      -
    • b: Quat

      Operand quaternion.

      -
    • Optional dst: Quat

      quaternion to hold result. If not passed in a new one is created.

      -

    Returns Quat

    A quaternion that is the sum of a and b.

    -
\ No newline at end of file +add | wgpu-matrix

Function add

  • Adds two quaternions; assumes a and b have the same dimension.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand quaternion.

      +
    • b: BaseArgType

      Operand quaternion.

      +
    • Optional dst: T

      quaternion to hold result. If not passed in a new one is created.

      +

    Returns T

    A quaternion that is the sum of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/quat.angle.html b/docs/functions/quat.angle.html index 27c984d..eebfb58 100644 --- a/docs/functions/quat.angle.html +++ b/docs/functions/quat.angle.html @@ -1,5 +1,5 @@ -angle | wgpu-matrix

Function angle

  • Returns the angle in degrees between two rotations a and b.

    -

    Parameters

    • a: Quat

      quaternion a

      -
    • b: Quat

      quaternion b

      +angle | wgpu-matrix

      Function angle

      • Returns the angle in degrees between two rotations a and b.

        +

        Parameters

        Returns number

        angle in radians between the two quaternions

        -
      \ No newline at end of file +
\ No newline at end of file diff --git a/docs/functions/quat.clone.html b/docs/functions/quat.clone.html index 5837ffe..bf9c2d0 100644 --- a/docs/functions/quat.clone.html +++ b/docs/functions/quat.clone.html @@ -1,6 +1,6 @@ -clone | wgpu-matrix

Function clone

  • Clones a quaternion. (same as quat.copy) -Also see quat.create and quat.set

    -

    Parameters

    • q: Quat

      The quaternion.

      -
    • Optional dst: Quat

      quaternion to hold result. If not passed in a new one is created.

      -

    Returns Quat

    A copy of q.

    -
\ No newline at end of file +clone | wgpu-matrix

Function clone

  • Copies a quaternion. (same as quat.clone) +Also see quat.create and quat.set

    +

    Type Parameters

    Parameters

    • q: BaseArgType

      The quaternion.

      +
    • Optional dst: T

      quaternion to hold result. If not passed in a new one is created.

      +

    Returns T

    A quaternion that is a copy of q

    +
\ No newline at end of file diff --git a/docs/functions/quat.conjugate.html b/docs/functions/quat.conjugate.html index 9c901b4..415d07d 100644 --- a/docs/functions/quat.conjugate.html +++ b/docs/functions/quat.conjugate.html @@ -1,7 +1,7 @@ -conjugate | wgpu-matrix

Function conjugate

  • Compute the conjugate of a quaternion +conjugate | wgpu-matrix

    Function conjugate

    • Compute the conjugate of a quaternion For quaternions with a magnitude of 1 (a unit quaternion) this returns the same as the inverse but is faster to calculate.

      -

      Parameters

      • q: Quat

        quaternion to compute the conjugate of.

        -
      • Optional dst: Quat

        quaternion to hold result. If not passed in a new one is created.

        -

      Returns Quat

      The conjugate of q

      -
    \ No newline at end of file +

    Type Parameters

    Parameters

    • q: BaseArgType

      quaternion to compute the conjugate of.

      +
    • Optional dst: T

      quaternion to hold result. If not passed in a new one is created.

      +

    Returns T

    The conjugate of q

    +
\ No newline at end of file diff --git a/docs/functions/quat.copy.html b/docs/functions/quat.copy.html index efb5d0c..55a899d 100644 --- a/docs/functions/quat.copy.html +++ b/docs/functions/quat.copy.html @@ -1,6 +1,6 @@ -copy | wgpu-matrix

Function copy

  • Copies a quaternion. (same as quat.clone) -Also see quat.create and quat.set

    -

    Parameters

    • q: Quat

      The quaternion.

      -
    • Optional dst: Quat

      quaternion to hold result. If not passed in a new one is created.

      -

    Returns Quat

    A quaternion that is a copy of q

    -
\ No newline at end of file +copy | wgpu-matrix

Function copy

  • Copies a quaternion. (same as quat.clone) +Also see quat.create and quat.set

    +

    Type Parameters

    Parameters

    • q: BaseArgType

      The quaternion.

      +
    • Optional dst: T

      quaternion to hold result. If not passed in a new one is created.

      +

    Returns T

    A quaternion that is a copy of q

    +
\ No newline at end of file diff --git a/docs/functions/quat.create.html b/docs/functions/quat.create.html index d1e9093..237af7c 100644 --- a/docs/functions/quat.create.html +++ b/docs/functions/quat.create.html @@ -1,7 +1,7 @@ -create | wgpu-matrix

Function create

  • Creates a quat4; may be called with x, y, z to set initial values.

    +create | wgpu-matrix

    Function create

    • Creates a quat4; may be called with x, y, z to set initial values.

      Parameters

      • Optional x: number

        Initial x value.

      • Optional y: number

        Initial y value.

      • Optional z: number

        Initial z value.

      • Optional w: number

        Initial w value.

        -

      Returns Quat

      the created vector

      -
    \ No newline at end of file +

Returns Float32Array

the created vector

+
\ No newline at end of file diff --git a/docs/functions/quat.divScalar.html b/docs/functions/quat.divScalar.html index 9d175ba..d549a9a 100644 --- a/docs/functions/quat.divScalar.html +++ b/docs/functions/quat.divScalar.html @@ -1,6 +1,6 @@ -divScalar | wgpu-matrix

Function divScalar

  • Divides a vector by a scalar.

    -

    Parameters

    • v: Quat

      The vector.

      +divScalar | wgpu-matrix

      Function divScalar

      • Divides a vector by a scalar.

        +

        Type Parameters

        Parameters

        • v: BaseArgType

          The vector.

        • k: number

          The scalar.

          -
        • Optional dst: Quat

          quaternion to hold result. If not passed in a new one is created.

          -

        Returns Quat

        The scaled quaternion.

        -
      \ No newline at end of file +
    • Optional dst: T

      quaternion to hold result. If not passed in a new one is created.

      +

    Returns T

    The scaled quaternion.

    +
\ No newline at end of file diff --git a/docs/functions/quat.dot.html b/docs/functions/quat.dot.html index b09b667..46fbc6f 100644 --- a/docs/functions/quat.dot.html +++ b/docs/functions/quat.dot.html @@ -1,5 +1,5 @@ -dot | wgpu-matrix

Function dot

  • Computes the dot product of two quaternions

    -

    Parameters

    • a: Quat

      Operand quaternion.

      -
    • b: Quat

      Operand quaternion.

      +dot | wgpu-matrix

      Function dot

      • Computes the dot product of two quaternions

        +

        Parameters

        Returns number

        dot product

        -
      \ No newline at end of file +
\ No newline at end of file diff --git a/docs/functions/quat.equals.html b/docs/functions/quat.equals.html index f45d052..7bc37fc 100644 --- a/docs/functions/quat.equals.html +++ b/docs/functions/quat.equals.html @@ -1,5 +1,5 @@ -equals | wgpu-matrix

Function equals

  • Check if 2 quaternions are exactly equal

    -

    Parameters

    • a: Quat

      Operand quaternion.

      -
    • b: Quat

      Operand quaternion.

      +equals | wgpu-matrix

      Function equals

      • Check if 2 quaternions are exactly equal

        +

        Parameters

        Returns boolean

        true if quaternions are exactly equal

        -
      \ No newline at end of file +
\ No newline at end of file diff --git a/docs/functions/quat.equalsApproximately.html b/docs/functions/quat.equalsApproximately.html index d8685e8..abb3a7c 100644 --- a/docs/functions/quat.equalsApproximately.html +++ b/docs/functions/quat.equalsApproximately.html @@ -1,5 +1,5 @@ -equalsApproximately | wgpu-matrix

Function equalsApproximately

  • Check if 2 quaternions are approximately equal

    -

    Parameters

    • a: Quat

      Operand quaternion.

      -
    • b: Quat

      Operand quaternion.

      +equalsApproximately | wgpu-matrix

      Function equalsApproximately

      • Check if 2 quaternions are approximately equal

        +

        Parameters

        Returns boolean

        true if quaternions are approximately equal

        -
      \ No newline at end of file +
\ No newline at end of file diff --git a/docs/functions/quat.fromAxisAngle.html b/docs/functions/quat.fromAxisAngle.html index 8f4c30a..3dcef36 100644 --- a/docs/functions/quat.fromAxisAngle.html +++ b/docs/functions/quat.fromAxisAngle.html @@ -1,7 +1,7 @@ -fromAxisAngle | wgpu-matrix

Function fromAxisAngle

  • Sets a quaternion from the given angle and axis, +fromAxisAngle | wgpu-matrix

    Function fromAxisAngle

    • Sets a quaternion from the given angle and axis, then returns it.

      -

      Parameters

      • axis: Vec3

        the axis to rotate around

        +

        Type Parameters

        Parameters

        • axis: BaseArgType

          the axis to rotate around

        • angleInRadians: number

          the angle

          -
        • Optional dst: Quat

          quaternion to hold result. If not passed in a new one is created.

          -

        Returns Quat

        The quaternion that represents the given axis and angle

        -
    \ No newline at end of file +
  • Optional dst: T

    quaternion to hold result. If not passed in a new one is created.

    +

Returns T

The quaternion that represents the given axis and angle

+
\ No newline at end of file diff --git a/docs/functions/quat.fromEuler.html b/docs/functions/quat.fromEuler.html index 972bdfe..e231b94 100644 --- a/docs/functions/quat.fromEuler.html +++ b/docs/functions/quat.fromEuler.html @@ -1,8 +1,8 @@ -fromEuler | wgpu-matrix

Function fromEuler

  • Creates a quaternion from the given euler angle x, y, z using the provided intrinsic order for the conversion.

    -

    Parameters

    • xAngleInRadians: number

      angle to rotate around X axis in radians.

      +fromEuler | wgpu-matrix

      Function fromEuler

      • Creates a quaternion from the given euler angle x, y, z using the provided intrinsic order for the conversion.

        +

        Type Parameters

        Parameters

        • xAngleInRadians: number

          angle to rotate around X axis in radians.

        • yAngleInRadians: number

          angle to rotate around Y axis in radians.

        • zAngleInRadians: number

          angle to rotate around Z axis in radians.

          -
        • order: RotationOrder

          order to apply euler angles

          -
        • Optional dst: Quat

          quaternion to hold result. If not passed in a new one is created.

          -

        Returns Quat

        A quaternion representing the same rotation as the euler angles applied in the given order

        -
      \ No newline at end of file +
    • order: RotationOrder

      order to apply euler angles

      +
    • Optional dst: T

      quaternion to hold result. If not passed in a new one is created.

      +

    Returns T

    A quaternion representing the same rotation as the euler angles applied in the given order

    +
\ No newline at end of file diff --git a/docs/functions/quat.fromMat.html b/docs/functions/quat.fromMat.html index a77900a..db33c68 100644 --- a/docs/functions/quat.fromMat.html +++ b/docs/functions/quat.fromMat.html @@ -1,6 +1,6 @@ -fromMat | wgpu-matrix

Function fromMat

  • Creates a quaternion from the given rotation matrix.

    +fromMat | wgpu-matrix

    Function fromMat

    • Creates a quaternion from the given rotation matrix.

      The created quaternion is not normalized.

      -

      Parameters

      • m: Float32Array | Float64Array | number[]

        rotation matrix

        -
      • Optional dst: Quat

        quaternion to hold result. If not passed in a new one is created.

        -

      Returns Quat

      the result

      -
    \ No newline at end of file +

    Type Parameters

    Parameters

    • m: BaseArgType

      rotation matrix

      +
    • Optional dst: T

      quaternion to hold result. If not passed in a new one is created.

      +

    Returns T

    the result

    +
\ No newline at end of file diff --git a/docs/functions/quat.fromValues.html b/docs/functions/quat.fromValues.html index 54938d2..2621db7 100644 --- a/docs/functions/quat.fromValues.html +++ b/docs/functions/quat.fromValues.html @@ -1,6 +1,7 @@ -fromValues | wgpu-matrix

Function fromValues

  • Creates a Quat; may be called with x, y, z to set initial values. (same as create)

    +fromValues | wgpu-matrix

    Function fromValues

    • Creates a quat4; may be called with x, y, z to set initial values.

      Parameters

      • Optional x: number

        Initial x value.

      • Optional y: number

        Initial y value.

      • Optional z: number

        Initial z value.

        -
      • Optional w: number

      Returns Quat

      the created vector

      -
    \ No newline at end of file +
  • Optional w: number

    Initial w value.

    +

Returns Float32Array

the created vector

+
\ No newline at end of file diff --git a/docs/functions/quat.identity.html b/docs/functions/quat.identity.html index b8d1942..9190e5c 100644 --- a/docs/functions/quat.identity.html +++ b/docs/functions/quat.identity.html @@ -1,4 +1,4 @@ -identity | wgpu-matrix

Function identity

  • Creates an identity quaternion

    -

    Parameters

    • Optional dst: Quat

      quaternion to hold result. If not passed in a new one is created.

      -

    Returns Quat

    an identity quaternion

    -
\ No newline at end of file +identity | wgpu-matrix

Function identity

  • Creates an identity quaternion

    +

    Type Parameters

    Parameters

    • Optional dst: T

      quaternion to hold result. If not passed in a new one is created.

      +

    Returns T

    an identity quaternion

    +
\ No newline at end of file diff --git a/docs/functions/quat.inverse.html b/docs/functions/quat.inverse.html index 04b0918..06ecf6e 100644 --- a/docs/functions/quat.inverse.html +++ b/docs/functions/quat.inverse.html @@ -1,4 +1,4 @@ -inverse | wgpu-matrix

Function inverse

  • Compute the inverse of a quaternion

    -

    Parameters

    • q: Quat

      quaternion to compute the inverse of

      -
    • Optional dst: Quat

    Returns Quat

    A quaternion that is the result of a * b

    -
\ No newline at end of file +inverse | wgpu-matrix

Function inverse

  • Compute the inverse of a quaternion

    +

    Type Parameters

    Parameters

    • q: BaseArgType

      quaternion to compute the inverse of

      +
    • Optional dst: T

    Returns T

    A quaternion that is the result of a * b

    +
\ No newline at end of file diff --git a/docs/functions/quat.len.html b/docs/functions/quat.len.html index 1d64018..937be2d 100644 --- a/docs/functions/quat.len.html +++ b/docs/functions/quat.len.html @@ -1,4 +1,4 @@ -len | wgpu-matrix

Function len

  • Computes the length of quaternion (same as length)

    -

    Parameters

    • v: Quat

      quaternion.

      +len | wgpu-matrix

      Function len

      • Computes the length of quaternion

        +

        Parameters

        Returns number

        length of quaternion.

        -
      \ No newline at end of file +
\ No newline at end of file diff --git a/docs/functions/quat.lenSq.html b/docs/functions/quat.lenSq.html index b81afca..d618eb7 100644 --- a/docs/functions/quat.lenSq.html +++ b/docs/functions/quat.lenSq.html @@ -1,4 +1,4 @@ -lenSq | wgpu-matrix

Function lenSq

  • Computes the square of the length of quaternion (same as lengthSq)

    -

    Parameters

    • v: Quat

      quaternion.

      +lenSq | wgpu-matrix

      Function lenSq

      • Computes the square of the length of quaternion

        +

        Parameters

        Returns number

        square of the length of quaternion.

        -
      \ No newline at end of file +
\ No newline at end of file diff --git a/docs/functions/quat.length.html b/docs/functions/quat.length.html index acdc97a..354618f 100644 --- a/docs/functions/quat.length.html +++ b/docs/functions/quat.length.html @@ -1,4 +1,4 @@ -length | wgpu-matrix

Function length

  • Computes the length of quaternion

    -

    Parameters

    • v: Quat

      quaternion.

      +length | wgpu-matrix

      Function length

      • Computes the length of quaternion

        +

        Parameters

        Returns number

        length of quaternion.

        -
      \ No newline at end of file +
\ No newline at end of file diff --git a/docs/functions/quat.lengthSq.html b/docs/functions/quat.lengthSq.html index 0331857..0f2e092 100644 --- a/docs/functions/quat.lengthSq.html +++ b/docs/functions/quat.lengthSq.html @@ -1,4 +1,4 @@ -lengthSq | wgpu-matrix

Function lengthSq

  • Computes the square of the length of quaternion

    -

    Parameters

    • v: Quat

      quaternion.

      +lengthSq | wgpu-matrix

      Function lengthSq

      • Computes the square of the length of quaternion

        +

        Parameters

        Returns number

        square of the length of quaternion.

        -
      \ No newline at end of file +
\ No newline at end of file diff --git a/docs/functions/quat.lerp.html b/docs/functions/quat.lerp.html index 0ab7209..0ca9647 100644 --- a/docs/functions/quat.lerp.html +++ b/docs/functions/quat.lerp.html @@ -1,9 +1,9 @@ -lerp | wgpu-matrix

Function lerp

  • Performs linear interpolation on two quaternions. +lerp | wgpu-matrix

    Function lerp

    • Performs linear interpolation on two quaternions. Given quaternions a and b and interpolation coefficient t, returns a + t * (b - a).

      -

      Parameters

      • a: Quat

        Operand quaternion.

        -
      • b: Quat

        Operand quaternion.

        +

        Type Parameters

        Parameters

        • a: BaseArgType

          Operand quaternion.

          +
        • b: BaseArgType

          Operand quaternion.

        • t: number

          Interpolation coefficient.

          -
        • Optional dst: Quat

          quaternion to hold result. If not passed in a new one is created.

          -

        Returns Quat

        The linear interpolated result.

        -
    \ No newline at end of file +
  • Optional dst: T

    quaternion to hold result. If not passed in a new one is created.

    +

Returns T

The linear interpolated result.

+
\ No newline at end of file diff --git a/docs/functions/quat.mul.html b/docs/functions/quat.mul.html index 9906b5b..c662306 100644 --- a/docs/functions/quat.mul.html +++ b/docs/functions/quat.mul.html @@ -1,6 +1,6 @@ -mul | wgpu-matrix

Function mul

  • Multiplies two quaternions

    -

    Parameters

    • a: Quat

      the first quaternion

      -
    • b: Quat

      the second quaternion

      -
    • Optional dst: Quat

      quaternion to hold result. If not passed in a new one is created.

      -

    Returns Quat

    A quaternion that is the result of a * b

    -
\ No newline at end of file +mul | wgpu-matrix

Function mul

  • Multiplies two quaternions

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      the first quaternion

      +
    • b: BaseArgType

      the second quaternion

      +
    • Optional dst: T

      quaternion to hold result. If not passed in a new one is created.

      +

    Returns T

    A quaternion that is the result of a * b

    +
\ No newline at end of file diff --git a/docs/functions/quat.mulScalar.html b/docs/functions/quat.mulScalar.html index 7e1da11..a9e2411 100644 --- a/docs/functions/quat.mulScalar.html +++ b/docs/functions/quat.mulScalar.html @@ -1,6 +1,6 @@ -mulScalar | wgpu-matrix

Function mulScalar

  • Multiplies a quaternion by a scalar.

    -

    Parameters

    • v: Quat

      The quaternion.

      +mulScalar | wgpu-matrix

      Function mulScalar

      • Multiplies a quaternion by a scalar.

        +

        Type Parameters

        Parameters

        • v: BaseArgType

          The quaternion.

        • k: number

          The scalar.

          -
        • Optional dst: Quat

          quaternion to hold result. If not passed in a new one is created.

          -

        Returns Quat

        The scaled quaternion.

        -
      \ No newline at end of file +
    • Optional dst: T

      quaternion to hold result. If not passed in a new one is created.

      +

    Returns T

    The scaled quaternion.

    +
\ No newline at end of file diff --git a/docs/functions/quat.multiply.html b/docs/functions/quat.multiply.html index e9eb91c..50476f6 100644 --- a/docs/functions/quat.multiply.html +++ b/docs/functions/quat.multiply.html @@ -1,6 +1,6 @@ -multiply | wgpu-matrix

Function multiply

  • Multiplies two quaternions

    -

    Parameters

    • a: Quat

      the first quaternion

      -
    • b: Quat

      the second quaternion

      -
    • Optional dst: Quat

      quaternion to hold result. If not passed in a new one is created.

      -

    Returns Quat

    A quaternion that is the result of a * b

    -
\ No newline at end of file +multiply | wgpu-matrix

Function multiply

  • Multiplies two quaternions

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      the first quaternion

      +
    • b: BaseArgType

      the second quaternion

      +
    • Optional dst: T

      quaternion to hold result. If not passed in a new one is created.

      +

    Returns T

    A quaternion that is the result of a * b

    +
\ No newline at end of file diff --git a/docs/functions/quat.normalize.html b/docs/functions/quat.normalize.html index e91fb9a..62feae6 100644 --- a/docs/functions/quat.normalize.html +++ b/docs/functions/quat.normalize.html @@ -1,5 +1,5 @@ -normalize | wgpu-matrix

Function normalize

  • Divides a quaternion by its Euclidean length and returns the quotient.

    -

    Parameters

    • v: Quat

      The quaternion.

      -
    • Optional dst: Quat

      quaternion to hold result. If not passed in a new one is created.

      -

    Returns Quat

    The normalized quaternion.

    -
\ No newline at end of file +normalize | wgpu-matrix

Function normalize

  • Divides a quaternion by its Euclidean length and returns the quotient.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The quaternion.

      +
    • Optional dst: T

      quaternion to hold result. If not passed in a new one is created.

      +

    Returns T

    The normalized quaternion.

    +
\ No newline at end of file diff --git a/docs/functions/quat.rotateX.html b/docs/functions/quat.rotateX.html index 52c96da..a48fe2e 100644 --- a/docs/functions/quat.rotateX.html +++ b/docs/functions/quat.rotateX.html @@ -1,6 +1,6 @@ -rotateX | wgpu-matrix

Function rotateX

  • Rotates the given quaternion around the X axis by the given angle.

    -

    Parameters

    • q: Quat

      quaternion to rotate

      +rotateX | wgpu-matrix

      Function rotateX

      • Rotates the given quaternion around the X axis by the given angle.

        +

        Type Parameters

        Parameters

        • q: BaseArgType

          quaternion to rotate

        • angleInRadians: number

          The angle by which to rotate

          -
        • Optional dst: Quat

          quaternion to hold result. If not passed in a new one is created.

          -

        Returns Quat

        A quaternion that is the result of a * b

        -
      \ No newline at end of file +
    • Optional dst: T

      quaternion to hold result. If not passed in a new one is created.

      +

    Returns T

    A quaternion that is the result of a * b

    +
\ No newline at end of file diff --git a/docs/functions/quat.rotateY.html b/docs/functions/quat.rotateY.html index a992ea3..df7c4e5 100644 --- a/docs/functions/quat.rotateY.html +++ b/docs/functions/quat.rotateY.html @@ -1,6 +1,6 @@ -rotateY | wgpu-matrix

Function rotateY

  • Rotates the given quaternion around the Y axis by the given angle.

    -

    Parameters

    • q: Quat

      quaternion to rotate

      +rotateY | wgpu-matrix

      Function rotateY

      • Rotates the given quaternion around the Y axis by the given angle.

        +

        Type Parameters

        Parameters

        • q: BaseArgType

          quaternion to rotate

        • angleInRadians: number

          The angle by which to rotate

          -
        • Optional dst: Quat

          quaternion to hold result. If not passed in a new one is created.

          -

        Returns Quat

        A quaternion that is the result of a * b

        -
      \ No newline at end of file +
    • Optional dst: T

      quaternion to hold result. If not passed in a new one is created.

      +

    Returns T

    A quaternion that is the result of a * b

    +
\ No newline at end of file diff --git a/docs/functions/quat.rotateZ.html b/docs/functions/quat.rotateZ.html index f1fd38b..2f848b8 100644 --- a/docs/functions/quat.rotateZ.html +++ b/docs/functions/quat.rotateZ.html @@ -1,6 +1,6 @@ -rotateZ | wgpu-matrix

Function rotateZ

  • Rotates the given quaternion around the Z axis by the given angle.

    -

    Parameters

    • q: Quat

      quaternion to rotate

      +rotateZ | wgpu-matrix

      Function rotateZ

      • Rotates the given quaternion around the Z axis by the given angle.

        +

        Type Parameters

        Parameters

        • q: BaseArgType

          quaternion to rotate

        • angleInRadians: number

          The angle by which to rotate

          -
        • Optional dst: Quat

          quaternion to hold result. If not passed in a new one is created.

          -

        Returns Quat

        A quaternion that is the result of a * b

        -
      \ No newline at end of file +
    • Optional dst: T

      quaternion to hold result. If not passed in a new one is created.

      +

    Returns T

    A quaternion that is the result of a * b

    +
\ No newline at end of file diff --git a/docs/functions/quat.rotationTo.html b/docs/functions/quat.rotationTo.html index 6a40874..adf9d22 100644 --- a/docs/functions/quat.rotationTo.html +++ b/docs/functions/quat.rotationTo.html @@ -1,6 +1,6 @@ -rotationTo | wgpu-matrix

Function rotationTo

  • Computes a quaternion to represent the shortest rotation from one vector to another.

    -

    Parameters

    • aUnit: Vec3

      the start vector

      -
    • bUnit: Vec3

      the end vector

      -
    • Optional dst: Quat

      quaternion to hold result. If not passed in a new one is created.

      -

    Returns Quat

    the result

    -
\ No newline at end of file +rotationTo | wgpu-matrix

Function rotationTo

  • Computes a quaternion to represent the shortest rotation from one vector to another.

    +

    Type Parameters

    Parameters

    • aUnit: BaseArgType

      the start vector

      +
    • bUnit: BaseArgType

      the end vector

      +
    • Optional dst: T

      quaternion to hold result. If not passed in a new one is created.

      +

    Returns T

    the result

    +
\ No newline at end of file diff --git a/docs/functions/quat.scale.html b/docs/functions/quat.scale.html index 6c7e745..e3b1541 100644 --- a/docs/functions/quat.scale.html +++ b/docs/functions/quat.scale.html @@ -1,6 +1,6 @@ -scale | wgpu-matrix

Function scale

  • Multiplies a quaternion by a scalar. (same as mulScalar)

    -

    Parameters

    • v: Quat

      The quaternion.

      +scale | wgpu-matrix

      Function scale

      • Multiplies a quaternion by a scalar.

        +

        Type Parameters

        Parameters

        • v: BaseArgType

          The quaternion.

        • k: number

          The scalar.

          -
        • Optional dst: Quat

          quaternion to hold result. If not passed in a new one is created.

          -

        Returns Quat

        The scaled quaternion.

        -
      \ No newline at end of file +
    • Optional dst: T

      quaternion to hold result. If not passed in a new one is created.

      +

    Returns T

    The scaled quaternion.

    +
\ No newline at end of file diff --git a/docs/functions/quat.set.html b/docs/functions/quat.set.html index ec178f5..7a93fec 100644 --- a/docs/functions/quat.set.html +++ b/docs/functions/quat.set.html @@ -1,9 +1,9 @@ -set | wgpu-matrix

Function set

  • Sets the values of a Quat -Also see quat.create and quat.copy

    -

    Parameters

    • x: number

      first value

      +set | wgpu-matrix

      Function set

      • Sets the values of a Quat +Also see quat.create and quat.copy

        +

        Type Parameters

        Parameters

        • x: number

          first value

        • y: number

          second value

        • z: number

          third value

        • w: number

          fourth value

          -
        • Optional dst: Quat

          vector to hold result. If not passed in a new one is created.

          -

        Returns Quat

        A vector with its elements set.

        -
      \ No newline at end of file +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector with its elements set.

    +
\ No newline at end of file diff --git a/docs/functions/quat.setDefaultType.html b/docs/functions/quat.setDefaultType.html deleted file mode 100644 index f064e3d..0000000 --- a/docs/functions/quat.setDefaultType.html +++ /dev/null @@ -1,17 +0,0 @@ -setDefaultType | wgpu-matrix

Function setDefaultType

  • Sets the type this library creates for a Quat4

    -

    Parameters

    • ctor: (new (n) => Quat)

      the constructor for the type. Either Float32Array, Float64Array, or Array

      -
        • new (n): Quat
        • Parameters

          • n: number

          Returns Quat

    Returns (new (n) => Quat)

    previous constructor for Quat4

    -
      • new (n): Quat
      • Quat4 math functions.

        -

        Almost all functions take an optional dst argument. If it is not passed in the -functions will create a new Quat4. In other words you can do this

        -
        const v = quat4.cross(v1, v2);  // Creates a new Quat4 with the cross product of v1 x v2.
        -
        -

        or

        -
        const v = quat4.create();
        quat4.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v -
        -

        The first style is often easier but depending on where it's used it generates garbage where -as there is almost never allocation with the second style.

        -

        It is always safe to pass any vector as the destination. So for example

        -
        quat4.cross(v1, v2, v1);  // Puts the cross product of v1 x v2 in v1
        -
        -

        Parameters

        • n: number

        Returns Quat

\ No newline at end of file diff --git a/docs/functions/quat.slerp.html b/docs/functions/quat.slerp.html index 096484c..6e045a5 100644 --- a/docs/functions/quat.slerp.html +++ b/docs/functions/quat.slerp.html @@ -1,7 +1,7 @@ -slerp | wgpu-matrix

Function slerp

  • Spherically linear interpolate between two quaternions

    -

    Parameters

    • a: Quat

      starting value

      -
    • b: Quat

      ending value

      +slerp | wgpu-matrix

      Function slerp

      • Spherically linear interpolate between two quaternions

        +

        Type Parameters

        Parameters

        • a: BaseArgType

          starting value

          +
        • b: BaseArgType

          ending value

        • t: number

          value where 0 = a and 1 = b

          -
        • Optional dst: Quat

          quaternion to hold result. If not passed in a new one is created.

          -

        Returns Quat

        A quaternion that is the result of a * b

        -
      \ No newline at end of file +
    • Optional dst: T

      quaternion to hold result. If not passed in a new one is created.

      +

    Returns T

    A quaternion that is the result of a * b

    +
\ No newline at end of file diff --git a/docs/functions/quat.sqlerp.html b/docs/functions/quat.sqlerp.html index 4d65ef0..90f43a4 100644 --- a/docs/functions/quat.sqlerp.html +++ b/docs/functions/quat.sqlerp.html @@ -1,8 +1,8 @@ -sqlerp | wgpu-matrix

Function sqlerp

  • Performs a spherical linear interpolation with two control points

    -

    Parameters

    • a: Quat

      the first quaternion

      -
    • b: Quat

      the second quaternion

      -
    • c: Quat

      the third quaternion

      -
    • d: Quat

      the fourth quaternion

      +sqlerp | wgpu-matrix

      Function sqlerp

      • Performs a spherical linear interpolation with two control points

        +

        Type Parameters

        Parameters

        Returns Quat

        result

        -
      \ No newline at end of file +
    • Optional dst: T

    Returns T

    result

    +
\ No newline at end of file diff --git a/docs/functions/quat.sub.html b/docs/functions/quat.sub.html index d506194..f4ba0b9 100644 --- a/docs/functions/quat.sub.html +++ b/docs/functions/quat.sub.html @@ -1,6 +1,6 @@ -sub | wgpu-matrix

Function sub

  • Subtracts two quaternions.

    -

    Parameters

    • a: Quat

      Operand quaternion.

      -
    • b: Quat

      Operand quaternion.

      -
    • Optional dst: Quat

      quaternion to hold result. If not passed in a new one is created.

      -

    Returns Quat

    A quaternion that is the difference of a and b.

    -
\ No newline at end of file +sub | wgpu-matrix

Function sub

  • Subtracts two quaternions.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand quaternion.

      +
    • b: BaseArgType

      Operand quaternion.

      +
    • Optional dst: T

      quaternion to hold result. If not passed in a new one is created.

      +

    Returns T

    A quaternion that is the difference of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/quat.subtract.html b/docs/functions/quat.subtract.html index 7e9a100..5dea459 100644 --- a/docs/functions/quat.subtract.html +++ b/docs/functions/quat.subtract.html @@ -1,6 +1,6 @@ -subtract | wgpu-matrix

Function subtract

  • Subtracts two quaternions.

    -

    Parameters

    • a: Quat

      Operand quaternion.

      -
    • b: Quat

      Operand quaternion.

      -
    • Optional dst: Quat

      quaternion to hold result. If not passed in a new one is created.

      -

    Returns Quat

    A quaternion that is the difference of a and b.

    -
\ No newline at end of file +subtract | wgpu-matrix

Function subtract

  • Subtracts two quaternions.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand quaternion.

      +
    • b: BaseArgType

      Operand quaternion.

      +
    • Optional dst: T

      quaternion to hold result. If not passed in a new one is created.

      +

    Returns T

    A quaternion that is the difference of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/quat.toAxisAngle.html b/docs/functions/quat.toAxisAngle.html index 831de66..ef503ec 100644 --- a/docs/functions/quat.toAxisAngle.html +++ b/docs/functions/quat.toAxisAngle.html @@ -1,5 +1,5 @@ -toAxisAngle | wgpu-matrix

Function toAxisAngle

  • Gets the rotation axis and angle

    -

    Parameters

    • q: Quat

      quaternion to compute from

      -
    • Optional dst: Vec3

      Vec3 to hold result. If not passed in a new one is created.

      -

    Returns {
        angle: number;
        axis: Vec3;
    }

    angle and axis

    -
    • angle: number
    • axis: Vec3
\ No newline at end of file +toAxisAngle | wgpu-matrix

Function toAxisAngle

  • Gets the rotation axis and angle

    +

    Type Parameters

    Parameters

    • q: BaseArgType

      quaternion to compute from

      +
    • Optional dst: T

      Vec3 to hold result. If not passed in a new one is created.

      +

    Returns {
        angle: number;
        axis: T;
    }

    angle and axis

    +
    • angle: number
    • axis: T
\ No newline at end of file diff --git a/docs/functions/quatd.add.html b/docs/functions/quatd.add.html new file mode 100644 index 0000000..fd4732b --- /dev/null +++ b/docs/functions/quatd.add.html @@ -0,0 +1,6 @@ +add | wgpu-matrix
  • Adds two quaternions; assumes a and b have the same dimension.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand quaternion.

      +
    • b: BaseArgType

      Operand quaternion.

      +
    • Optional dst: T

      quaternion to hold result. If not passed in a new one is created.

      +

    Returns T

    A quaternion that is the sum of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/quatd.angle.html b/docs/functions/quatd.angle.html new file mode 100644 index 0000000..a96636a --- /dev/null +++ b/docs/functions/quatd.angle.html @@ -0,0 +1,5 @@ +angle | wgpu-matrix

Function angle

  • Returns the angle in degrees between two rotations a and b.

    +

    Parameters

    Returns number

    angle in radians between the two quaternions

    +
\ No newline at end of file diff --git a/docs/functions/quatd.clone.html b/docs/functions/quatd.clone.html new file mode 100644 index 0000000..a6f5f38 --- /dev/null +++ b/docs/functions/quatd.clone.html @@ -0,0 +1,6 @@ +clone | wgpu-matrix

Function clone

  • Copies a quaternion. (same as quat.clone) +Also see quat.create and quat.set

    +

    Type Parameters

    Parameters

    • q: BaseArgType

      The quaternion.

      +
    • Optional dst: T

      quaternion to hold result. If not passed in a new one is created.

      +

    Returns T

    A quaternion that is a copy of q

    +
\ No newline at end of file diff --git a/docs/functions/quatd.conjugate.html b/docs/functions/quatd.conjugate.html new file mode 100644 index 0000000..5942cbe --- /dev/null +++ b/docs/functions/quatd.conjugate.html @@ -0,0 +1,7 @@ +conjugate | wgpu-matrix

Function conjugate

  • Compute the conjugate of a quaternion +For quaternions with a magnitude of 1 (a unit quaternion) +this returns the same as the inverse but is faster to calculate.

    +

    Type Parameters

    Parameters

    • q: BaseArgType

      quaternion to compute the conjugate of.

      +
    • Optional dst: T

      quaternion to hold result. If not passed in a new one is created.

      +

    Returns T

    The conjugate of q

    +
\ No newline at end of file diff --git a/docs/functions/quatd.copy.html b/docs/functions/quatd.copy.html new file mode 100644 index 0000000..9fba39a --- /dev/null +++ b/docs/functions/quatd.copy.html @@ -0,0 +1,6 @@ +copy | wgpu-matrix
  • Copies a quaternion. (same as quat.clone) +Also see quat.create and quat.set

    +

    Type Parameters

    Parameters

    • q: BaseArgType

      The quaternion.

      +
    • Optional dst: T

      quaternion to hold result. If not passed in a new one is created.

      +

    Returns T

    A quaternion that is a copy of q

    +
\ No newline at end of file diff --git a/docs/functions/quatd.create.html b/docs/functions/quatd.create.html new file mode 100644 index 0000000..bcc0d23 --- /dev/null +++ b/docs/functions/quatd.create.html @@ -0,0 +1,7 @@ +create | wgpu-matrix

Function create

  • Creates a quat4; may be called with x, y, z to set initial values.

    +

    Parameters

    • Optional x: number

      Initial x value.

      +
    • Optional y: number

      Initial y value.

      +
    • Optional z: number

      Initial z value.

      +
    • Optional w: number

      Initial w value.

      +

    Returns Float64Array

    the created vector

    +
\ No newline at end of file diff --git a/docs/functions/quatd.divScalar.html b/docs/functions/quatd.divScalar.html new file mode 100644 index 0000000..38db24b --- /dev/null +++ b/docs/functions/quatd.divScalar.html @@ -0,0 +1,6 @@ +divScalar | wgpu-matrix

Function divScalar

  • Divides a vector by a scalar.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • k: number

      The scalar.

      +
    • Optional dst: T

      quaternion to hold result. If not passed in a new one is created.

      +

    Returns T

    The scaled quaternion.

    +
\ No newline at end of file diff --git a/docs/functions/quatd.dot.html b/docs/functions/quatd.dot.html new file mode 100644 index 0000000..14cab9e --- /dev/null +++ b/docs/functions/quatd.dot.html @@ -0,0 +1,5 @@ +dot | wgpu-matrix
  • Computes the dot product of two quaternions

    +

    Parameters

    Returns number

    dot product

    +
\ No newline at end of file diff --git a/docs/functions/quatd.equals.html b/docs/functions/quatd.equals.html new file mode 100644 index 0000000..2201608 --- /dev/null +++ b/docs/functions/quatd.equals.html @@ -0,0 +1,5 @@ +equals | wgpu-matrix

Function equals

  • Check if 2 quaternions are exactly equal

    +

    Parameters

    Returns boolean

    true if quaternions are exactly equal

    +
\ No newline at end of file diff --git a/docs/functions/quatd.equalsApproximately.html b/docs/functions/quatd.equalsApproximately.html new file mode 100644 index 0000000..b65ef90 --- /dev/null +++ b/docs/functions/quatd.equalsApproximately.html @@ -0,0 +1,5 @@ +equalsApproximately | wgpu-matrix

Function equalsApproximately

  • Check if 2 quaternions are approximately equal

    +

    Parameters

    Returns boolean

    true if quaternions are approximately equal

    +
\ No newline at end of file diff --git a/docs/functions/quatd.fromAxisAngle.html b/docs/functions/quatd.fromAxisAngle.html new file mode 100644 index 0000000..56f2a6e --- /dev/null +++ b/docs/functions/quatd.fromAxisAngle.html @@ -0,0 +1,7 @@ +fromAxisAngle | wgpu-matrix

Function fromAxisAngle

  • Sets a quaternion from the given angle and axis, +then returns it.

    +

    Type Parameters

    Parameters

    • axis: BaseArgType

      the axis to rotate around

      +
    • angleInRadians: number

      the angle

      +
    • Optional dst: T

      quaternion to hold result. If not passed in a new one is created.

      +

    Returns T

    The quaternion that represents the given axis and angle

    +
\ No newline at end of file diff --git a/docs/functions/quatd.fromEuler.html b/docs/functions/quatd.fromEuler.html new file mode 100644 index 0000000..e4c8e37 --- /dev/null +++ b/docs/functions/quatd.fromEuler.html @@ -0,0 +1,8 @@ +fromEuler | wgpu-matrix

Function fromEuler

  • Creates a quaternion from the given euler angle x, y, z using the provided intrinsic order for the conversion.

    +

    Type Parameters

    Parameters

    • xAngleInRadians: number

      angle to rotate around X axis in radians.

      +
    • yAngleInRadians: number

      angle to rotate around Y axis in radians.

      +
    • zAngleInRadians: number

      angle to rotate around Z axis in radians.

      +
    • order: RotationOrder

      order to apply euler angles

      +
    • Optional dst: T

      quaternion to hold result. If not passed in a new one is created.

      +

    Returns T

    A quaternion representing the same rotation as the euler angles applied in the given order

    +
\ No newline at end of file diff --git a/docs/functions/quatd.fromMat.html b/docs/functions/quatd.fromMat.html new file mode 100644 index 0000000..14e8bc6 --- /dev/null +++ b/docs/functions/quatd.fromMat.html @@ -0,0 +1,6 @@ +fromMat | wgpu-matrix

Function fromMat

  • Creates a quaternion from the given rotation matrix.

    +

    The created quaternion is not normalized.

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      rotation matrix

      +
    • Optional dst: T

      quaternion to hold result. If not passed in a new one is created.

      +

    Returns T

    the result

    +
\ No newline at end of file diff --git a/docs/functions/quatd.fromValues.html b/docs/functions/quatd.fromValues.html new file mode 100644 index 0000000..c7e25b7 --- /dev/null +++ b/docs/functions/quatd.fromValues.html @@ -0,0 +1,7 @@ +fromValues | wgpu-matrix

Function fromValues

  • Creates a quat4; may be called with x, y, z to set initial values.

    +

    Parameters

    • Optional x: number

      Initial x value.

      +
    • Optional y: number

      Initial y value.

      +
    • Optional z: number

      Initial z value.

      +
    • Optional w: number

      Initial w value.

      +

    Returns Float64Array

    the created vector

    +
\ No newline at end of file diff --git a/docs/functions/quatd.identity.html b/docs/functions/quatd.identity.html new file mode 100644 index 0000000..226292f --- /dev/null +++ b/docs/functions/quatd.identity.html @@ -0,0 +1,4 @@ +identity | wgpu-matrix

Function identity

  • Creates an identity quaternion

    +

    Type Parameters

    Parameters

    • Optional dst: T

      quaternion to hold result. If not passed in a new one is created.

      +

    Returns T

    an identity quaternion

    +
\ No newline at end of file diff --git a/docs/functions/quatd.inverse.html b/docs/functions/quatd.inverse.html new file mode 100644 index 0000000..20509e9 --- /dev/null +++ b/docs/functions/quatd.inverse.html @@ -0,0 +1,4 @@ +inverse | wgpu-matrix

Function inverse

  • Compute the inverse of a quaternion

    +

    Type Parameters

    Parameters

    • q: BaseArgType

      quaternion to compute the inverse of

      +
    • Optional dst: T

    Returns T

    A quaternion that is the result of a * b

    +
\ No newline at end of file diff --git a/docs/functions/quatd.len.html b/docs/functions/quatd.len.html new file mode 100644 index 0000000..cf1a098 --- /dev/null +++ b/docs/functions/quatd.len.html @@ -0,0 +1,4 @@ +len | wgpu-matrix
  • Computes the length of quaternion

    +

    Parameters

    Returns number

    length of quaternion.

    +
\ No newline at end of file diff --git a/docs/functions/quatd.lenSq.html b/docs/functions/quatd.lenSq.html new file mode 100644 index 0000000..b18e028 --- /dev/null +++ b/docs/functions/quatd.lenSq.html @@ -0,0 +1,4 @@ +lenSq | wgpu-matrix

Function lenSq

  • Computes the square of the length of quaternion

    +

    Parameters

    Returns number

    square of the length of quaternion.

    +
\ No newline at end of file diff --git a/docs/functions/quatd.length.html b/docs/functions/quatd.length.html new file mode 100644 index 0000000..c8a617d --- /dev/null +++ b/docs/functions/quatd.length.html @@ -0,0 +1,4 @@ +length | wgpu-matrix

Function length

  • Computes the length of quaternion

    +

    Parameters

    Returns number

    length of quaternion.

    +
\ No newline at end of file diff --git a/docs/functions/quatd.lengthSq.html b/docs/functions/quatd.lengthSq.html new file mode 100644 index 0000000..79ba77a --- /dev/null +++ b/docs/functions/quatd.lengthSq.html @@ -0,0 +1,4 @@ +lengthSq | wgpu-matrix

Function lengthSq

  • Computes the square of the length of quaternion

    +

    Parameters

    Returns number

    square of the length of quaternion.

    +
\ No newline at end of file diff --git a/docs/functions/quatd.lerp.html b/docs/functions/quatd.lerp.html new file mode 100644 index 0000000..b47f3ea --- /dev/null +++ b/docs/functions/quatd.lerp.html @@ -0,0 +1,9 @@ +lerp | wgpu-matrix
  • Performs linear interpolation on two quaternions. +Given quaternions a and b and interpolation coefficient t, returns +a + t * (b - a).

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand quaternion.

      +
    • b: BaseArgType

      Operand quaternion.

      +
    • t: number

      Interpolation coefficient.

      +
    • Optional dst: T

      quaternion to hold result. If not passed in a new one is created.

      +

    Returns T

    The linear interpolated result.

    +
\ No newline at end of file diff --git a/docs/functions/quatd.mul.html b/docs/functions/quatd.mul.html new file mode 100644 index 0000000..0446411 --- /dev/null +++ b/docs/functions/quatd.mul.html @@ -0,0 +1,6 @@ +mul | wgpu-matrix
  • Multiplies two quaternions

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      the first quaternion

      +
    • b: BaseArgType

      the second quaternion

      +
    • Optional dst: T

      quaternion to hold result. If not passed in a new one is created.

      +

    Returns T

    A quaternion that is the result of a * b

    +
\ No newline at end of file diff --git a/docs/functions/quatd.mulScalar.html b/docs/functions/quatd.mulScalar.html new file mode 100644 index 0000000..7925396 --- /dev/null +++ b/docs/functions/quatd.mulScalar.html @@ -0,0 +1,6 @@ +mulScalar | wgpu-matrix

Function mulScalar

  • Multiplies a quaternion by a scalar.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The quaternion.

      +
    • k: number

      The scalar.

      +
    • Optional dst: T

      quaternion to hold result. If not passed in a new one is created.

      +

    Returns T

    The scaled quaternion.

    +
\ No newline at end of file diff --git a/docs/functions/quatd.multiply.html b/docs/functions/quatd.multiply.html new file mode 100644 index 0000000..b86a406 --- /dev/null +++ b/docs/functions/quatd.multiply.html @@ -0,0 +1,6 @@ +multiply | wgpu-matrix

Function multiply

  • Multiplies two quaternions

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      the first quaternion

      +
    • b: BaseArgType

      the second quaternion

      +
    • Optional dst: T

      quaternion to hold result. If not passed in a new one is created.

      +

    Returns T

    A quaternion that is the result of a * b

    +
\ No newline at end of file diff --git a/docs/functions/quatd.normalize.html b/docs/functions/quatd.normalize.html new file mode 100644 index 0000000..0f2824d --- /dev/null +++ b/docs/functions/quatd.normalize.html @@ -0,0 +1,5 @@ +normalize | wgpu-matrix

Function normalize

  • Divides a quaternion by its Euclidean length and returns the quotient.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The quaternion.

      +
    • Optional dst: T

      quaternion to hold result. If not passed in a new one is created.

      +

    Returns T

    The normalized quaternion.

    +
\ No newline at end of file diff --git a/docs/functions/quatd.rotateX.html b/docs/functions/quatd.rotateX.html new file mode 100644 index 0000000..74b4255 --- /dev/null +++ b/docs/functions/quatd.rotateX.html @@ -0,0 +1,6 @@ +rotateX | wgpu-matrix

Function rotateX

  • Rotates the given quaternion around the X axis by the given angle.

    +

    Type Parameters

    Parameters

    • q: BaseArgType

      quaternion to rotate

      +
    • angleInRadians: number

      The angle by which to rotate

      +
    • Optional dst: T

      quaternion to hold result. If not passed in a new one is created.

      +

    Returns T

    A quaternion that is the result of a * b

    +
\ No newline at end of file diff --git a/docs/functions/quatd.rotateY.html b/docs/functions/quatd.rotateY.html new file mode 100644 index 0000000..8e4b001 --- /dev/null +++ b/docs/functions/quatd.rotateY.html @@ -0,0 +1,6 @@ +rotateY | wgpu-matrix

Function rotateY

  • Rotates the given quaternion around the Y axis by the given angle.

    +

    Type Parameters

    Parameters

    • q: BaseArgType

      quaternion to rotate

      +
    • angleInRadians: number

      The angle by which to rotate

      +
    • Optional dst: T

      quaternion to hold result. If not passed in a new one is created.

      +

    Returns T

    A quaternion that is the result of a * b

    +
\ No newline at end of file diff --git a/docs/functions/quatd.rotateZ.html b/docs/functions/quatd.rotateZ.html new file mode 100644 index 0000000..5746213 --- /dev/null +++ b/docs/functions/quatd.rotateZ.html @@ -0,0 +1,6 @@ +rotateZ | wgpu-matrix

Function rotateZ

  • Rotates the given quaternion around the Z axis by the given angle.

    +

    Type Parameters

    Parameters

    • q: BaseArgType

      quaternion to rotate

      +
    • angleInRadians: number

      The angle by which to rotate

      +
    • Optional dst: T

      quaternion to hold result. If not passed in a new one is created.

      +

    Returns T

    A quaternion that is the result of a * b

    +
\ No newline at end of file diff --git a/docs/functions/quatd.rotationTo.html b/docs/functions/quatd.rotationTo.html new file mode 100644 index 0000000..ec05eb7 --- /dev/null +++ b/docs/functions/quatd.rotationTo.html @@ -0,0 +1,6 @@ +rotationTo | wgpu-matrix

Function rotationTo

  • Computes a quaternion to represent the shortest rotation from one vector to another.

    +

    Type Parameters

    Parameters

    • aUnit: BaseArgType

      the start vector

      +
    • bUnit: BaseArgType

      the end vector

      +
    • Optional dst: T

      quaternion to hold result. If not passed in a new one is created.

      +

    Returns T

    the result

    +
\ No newline at end of file diff --git a/docs/functions/quatd.scale.html b/docs/functions/quatd.scale.html new file mode 100644 index 0000000..416f64d --- /dev/null +++ b/docs/functions/quatd.scale.html @@ -0,0 +1,6 @@ +scale | wgpu-matrix

Function scale

  • Multiplies a quaternion by a scalar.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The quaternion.

      +
    • k: number

      The scalar.

      +
    • Optional dst: T

      quaternion to hold result. If not passed in a new one is created.

      +

    Returns T

    The scaled quaternion.

    +
\ No newline at end of file diff --git a/docs/functions/quatd.set.html b/docs/functions/quatd.set.html new file mode 100644 index 0000000..85c2ea5 --- /dev/null +++ b/docs/functions/quatd.set.html @@ -0,0 +1,9 @@ +set | wgpu-matrix
  • Sets the values of a Quat +Also see quat.create and quat.copy

    +

    Type Parameters

    Parameters

    • x: number

      first value

      +
    • y: number

      second value

      +
    • z: number

      third value

      +
    • w: number

      fourth value

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector with its elements set.

    +
\ No newline at end of file diff --git a/docs/functions/quatd.slerp.html b/docs/functions/quatd.slerp.html new file mode 100644 index 0000000..84fceae --- /dev/null +++ b/docs/functions/quatd.slerp.html @@ -0,0 +1,7 @@ +slerp | wgpu-matrix

Function slerp

  • Spherically linear interpolate between two quaternions

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      starting value

      +
    • b: BaseArgType

      ending value

      +
    • t: number

      value where 0 = a and 1 = b

      +
    • Optional dst: T

      quaternion to hold result. If not passed in a new one is created.

      +

    Returns T

    A quaternion that is the result of a * b

    +
\ No newline at end of file diff --git a/docs/functions/quatd.sqlerp.html b/docs/functions/quatd.sqlerp.html new file mode 100644 index 0000000..933bcf7 --- /dev/null +++ b/docs/functions/quatd.sqlerp.html @@ -0,0 +1,8 @@ +sqlerp | wgpu-matrix

Function sqlerp

  • Performs a spherical linear interpolation with two control points

    +

    Type Parameters

    Parameters

    Returns T

    result

    +
\ No newline at end of file diff --git a/docs/functions/quatd.sub.html b/docs/functions/quatd.sub.html new file mode 100644 index 0000000..aedcbcc --- /dev/null +++ b/docs/functions/quatd.sub.html @@ -0,0 +1,6 @@ +sub | wgpu-matrix
  • Subtracts two quaternions.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand quaternion.

      +
    • b: BaseArgType

      Operand quaternion.

      +
    • Optional dst: T

      quaternion to hold result. If not passed in a new one is created.

      +

    Returns T

    A quaternion that is the difference of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/quatd.subtract.html b/docs/functions/quatd.subtract.html new file mode 100644 index 0000000..883adf3 --- /dev/null +++ b/docs/functions/quatd.subtract.html @@ -0,0 +1,6 @@ +subtract | wgpu-matrix

Function subtract

  • Subtracts two quaternions.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand quaternion.

      +
    • b: BaseArgType

      Operand quaternion.

      +
    • Optional dst: T

      quaternion to hold result. If not passed in a new one is created.

      +

    Returns T

    A quaternion that is the difference of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/quatd.toAxisAngle.html b/docs/functions/quatd.toAxisAngle.html new file mode 100644 index 0000000..0732157 --- /dev/null +++ b/docs/functions/quatd.toAxisAngle.html @@ -0,0 +1,5 @@ +toAxisAngle | wgpu-matrix

Function toAxisAngle

  • Gets the rotation axis and angle

    +

    Type Parameters

    Parameters

    • q: BaseArgType

      quaternion to compute from

      +
    • Optional dst: T

      Vec3 to hold result. If not passed in a new one is created.

      +

    Returns {
        angle: number;
        axis: T;
    }

    angle and axis

    +
    • angle: number
    • axis: T
\ No newline at end of file diff --git a/docs/functions/quatn.add.html b/docs/functions/quatn.add.html new file mode 100644 index 0000000..0fa953b --- /dev/null +++ b/docs/functions/quatn.add.html @@ -0,0 +1,6 @@ +add | wgpu-matrix
  • Adds two quaternions; assumes a and b have the same dimension.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand quaternion.

      +
    • b: BaseArgType

      Operand quaternion.

      +
    • Optional dst: T

      quaternion to hold result. If not passed in a new one is created.

      +

    Returns T

    A quaternion that is the sum of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/quatn.angle.html b/docs/functions/quatn.angle.html new file mode 100644 index 0000000..710e87c --- /dev/null +++ b/docs/functions/quatn.angle.html @@ -0,0 +1,5 @@ +angle | wgpu-matrix

Function angle

  • Returns the angle in degrees between two rotations a and b.

    +

    Parameters

    Returns number

    angle in radians between the two quaternions

    +
\ No newline at end of file diff --git a/docs/functions/quatn.clone.html b/docs/functions/quatn.clone.html new file mode 100644 index 0000000..be59f76 --- /dev/null +++ b/docs/functions/quatn.clone.html @@ -0,0 +1,6 @@ +clone | wgpu-matrix

Function clone

  • Copies a quaternion. (same as quat.clone) +Also see quat.create and quat.set

    +

    Type Parameters

    Parameters

    • q: BaseArgType

      The quaternion.

      +
    • Optional dst: T

      quaternion to hold result. If not passed in a new one is created.

      +

    Returns T

    A quaternion that is a copy of q

    +
\ No newline at end of file diff --git a/docs/functions/quatn.conjugate.html b/docs/functions/quatn.conjugate.html new file mode 100644 index 0000000..3a2ee14 --- /dev/null +++ b/docs/functions/quatn.conjugate.html @@ -0,0 +1,7 @@ +conjugate | wgpu-matrix

Function conjugate

  • Compute the conjugate of a quaternion +For quaternions with a magnitude of 1 (a unit quaternion) +this returns the same as the inverse but is faster to calculate.

    +

    Type Parameters

    Parameters

    • q: BaseArgType

      quaternion to compute the conjugate of.

      +
    • Optional dst: T

      quaternion to hold result. If not passed in a new one is created.

      +

    Returns T

    The conjugate of q

    +
\ No newline at end of file diff --git a/docs/functions/quatn.copy.html b/docs/functions/quatn.copy.html new file mode 100644 index 0000000..8134b12 --- /dev/null +++ b/docs/functions/quatn.copy.html @@ -0,0 +1,6 @@ +copy | wgpu-matrix
  • Copies a quaternion. (same as quat.clone) +Also see quat.create and quat.set

    +

    Type Parameters

    Parameters

    • q: BaseArgType

      The quaternion.

      +
    • Optional dst: T

      quaternion to hold result. If not passed in a new one is created.

      +

    Returns T

    A quaternion that is a copy of q

    +
\ No newline at end of file diff --git a/docs/functions/quatn.create.html b/docs/functions/quatn.create.html new file mode 100644 index 0000000..0ac77f4 --- /dev/null +++ b/docs/functions/quatn.create.html @@ -0,0 +1,7 @@ +create | wgpu-matrix

Function create

  • Creates a quat4; may be called with x, y, z to set initial values.

    +

    Parameters

    • Optional x: number

      Initial x value.

      +
    • Optional y: number

      Initial y value.

      +
    • Optional z: number

      Initial z value.

      +
    • Optional w: number

      Initial w value.

      +

    Returns number[]

    the created vector

    +
\ No newline at end of file diff --git a/docs/functions/quatn.divScalar.html b/docs/functions/quatn.divScalar.html new file mode 100644 index 0000000..ce20125 --- /dev/null +++ b/docs/functions/quatn.divScalar.html @@ -0,0 +1,6 @@ +divScalar | wgpu-matrix

Function divScalar

  • Divides a vector by a scalar.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • k: number

      The scalar.

      +
    • Optional dst: T

      quaternion to hold result. If not passed in a new one is created.

      +

    Returns T

    The scaled quaternion.

    +
\ No newline at end of file diff --git a/docs/functions/quatn.dot.html b/docs/functions/quatn.dot.html new file mode 100644 index 0000000..c60c64c --- /dev/null +++ b/docs/functions/quatn.dot.html @@ -0,0 +1,5 @@ +dot | wgpu-matrix
  • Computes the dot product of two quaternions

    +

    Parameters

    Returns number

    dot product

    +
\ No newline at end of file diff --git a/docs/functions/quatn.equals.html b/docs/functions/quatn.equals.html new file mode 100644 index 0000000..ce7619f --- /dev/null +++ b/docs/functions/quatn.equals.html @@ -0,0 +1,5 @@ +equals | wgpu-matrix

Function equals

  • Check if 2 quaternions are exactly equal

    +

    Parameters

    Returns boolean

    true if quaternions are exactly equal

    +
\ No newline at end of file diff --git a/docs/functions/quatn.equalsApproximately.html b/docs/functions/quatn.equalsApproximately.html new file mode 100644 index 0000000..f25607b --- /dev/null +++ b/docs/functions/quatn.equalsApproximately.html @@ -0,0 +1,5 @@ +equalsApproximately | wgpu-matrix

Function equalsApproximately

  • Check if 2 quaternions are approximately equal

    +

    Parameters

    Returns boolean

    true if quaternions are approximately equal

    +
\ No newline at end of file diff --git a/docs/functions/quatn.fromAxisAngle.html b/docs/functions/quatn.fromAxisAngle.html new file mode 100644 index 0000000..e3dbb63 --- /dev/null +++ b/docs/functions/quatn.fromAxisAngle.html @@ -0,0 +1,7 @@ +fromAxisAngle | wgpu-matrix

Function fromAxisAngle

  • Sets a quaternion from the given angle and axis, +then returns it.

    +

    Type Parameters

    Parameters

    • axis: BaseArgType

      the axis to rotate around

      +
    • angleInRadians: number

      the angle

      +
    • Optional dst: T

      quaternion to hold result. If not passed in a new one is created.

      +

    Returns T

    The quaternion that represents the given axis and angle

    +
\ No newline at end of file diff --git a/docs/functions/quatn.fromEuler.html b/docs/functions/quatn.fromEuler.html new file mode 100644 index 0000000..b1da34c --- /dev/null +++ b/docs/functions/quatn.fromEuler.html @@ -0,0 +1,8 @@ +fromEuler | wgpu-matrix

Function fromEuler

  • Creates a quaternion from the given euler angle x, y, z using the provided intrinsic order for the conversion.

    +

    Type Parameters

    Parameters

    • xAngleInRadians: number

      angle to rotate around X axis in radians.

      +
    • yAngleInRadians: number

      angle to rotate around Y axis in radians.

      +
    • zAngleInRadians: number

      angle to rotate around Z axis in radians.

      +
    • order: RotationOrder

      order to apply euler angles

      +
    • Optional dst: T

      quaternion to hold result. If not passed in a new one is created.

      +

    Returns T

    A quaternion representing the same rotation as the euler angles applied in the given order

    +
\ No newline at end of file diff --git a/docs/functions/quatn.fromMat.html b/docs/functions/quatn.fromMat.html new file mode 100644 index 0000000..23e44b3 --- /dev/null +++ b/docs/functions/quatn.fromMat.html @@ -0,0 +1,6 @@ +fromMat | wgpu-matrix

Function fromMat

  • Creates a quaternion from the given rotation matrix.

    +

    The created quaternion is not normalized.

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      rotation matrix

      +
    • Optional dst: T

      quaternion to hold result. If not passed in a new one is created.

      +

    Returns T

    the result

    +
\ No newline at end of file diff --git a/docs/functions/quatn.fromValues.html b/docs/functions/quatn.fromValues.html new file mode 100644 index 0000000..342bdec --- /dev/null +++ b/docs/functions/quatn.fromValues.html @@ -0,0 +1,7 @@ +fromValues | wgpu-matrix

Function fromValues

  • Creates a quat4; may be called with x, y, z to set initial values.

    +

    Parameters

    • Optional x: number

      Initial x value.

      +
    • Optional y: number

      Initial y value.

      +
    • Optional z: number

      Initial z value.

      +
    • Optional w: number

      Initial w value.

      +

    Returns number[]

    the created vector

    +
\ No newline at end of file diff --git a/docs/functions/quatn.identity.html b/docs/functions/quatn.identity.html new file mode 100644 index 0000000..a46d27e --- /dev/null +++ b/docs/functions/quatn.identity.html @@ -0,0 +1,4 @@ +identity | wgpu-matrix

Function identity

  • Creates an identity quaternion

    +

    Type Parameters

    Parameters

    • Optional dst: T

      quaternion to hold result. If not passed in a new one is created.

      +

    Returns T

    an identity quaternion

    +
\ No newline at end of file diff --git a/docs/functions/quatn.inverse.html b/docs/functions/quatn.inverse.html new file mode 100644 index 0000000..cc9c0e3 --- /dev/null +++ b/docs/functions/quatn.inverse.html @@ -0,0 +1,4 @@ +inverse | wgpu-matrix

Function inverse

  • Compute the inverse of a quaternion

    +

    Type Parameters

    Parameters

    • q: BaseArgType

      quaternion to compute the inverse of

      +
    • Optional dst: T

    Returns T

    A quaternion that is the result of a * b

    +
\ No newline at end of file diff --git a/docs/functions/quatn.len.html b/docs/functions/quatn.len.html new file mode 100644 index 0000000..974ec1f --- /dev/null +++ b/docs/functions/quatn.len.html @@ -0,0 +1,4 @@ +len | wgpu-matrix
  • Computes the length of quaternion

    +

    Parameters

    Returns number

    length of quaternion.

    +
\ No newline at end of file diff --git a/docs/functions/quatn.lenSq.html b/docs/functions/quatn.lenSq.html new file mode 100644 index 0000000..fff827b --- /dev/null +++ b/docs/functions/quatn.lenSq.html @@ -0,0 +1,4 @@ +lenSq | wgpu-matrix

Function lenSq

  • Computes the square of the length of quaternion

    +

    Parameters

    Returns number

    square of the length of quaternion.

    +
\ No newline at end of file diff --git a/docs/functions/quatn.length.html b/docs/functions/quatn.length.html new file mode 100644 index 0000000..8e8ebdd --- /dev/null +++ b/docs/functions/quatn.length.html @@ -0,0 +1,4 @@ +length | wgpu-matrix

Function length

  • Computes the length of quaternion

    +

    Parameters

    Returns number

    length of quaternion.

    +
\ No newline at end of file diff --git a/docs/functions/quatn.lengthSq.html b/docs/functions/quatn.lengthSq.html new file mode 100644 index 0000000..82d5d0b --- /dev/null +++ b/docs/functions/quatn.lengthSq.html @@ -0,0 +1,4 @@ +lengthSq | wgpu-matrix

Function lengthSq

  • Computes the square of the length of quaternion

    +

    Parameters

    Returns number

    square of the length of quaternion.

    +
\ No newline at end of file diff --git a/docs/functions/quatn.lerp.html b/docs/functions/quatn.lerp.html new file mode 100644 index 0000000..6eed605 --- /dev/null +++ b/docs/functions/quatn.lerp.html @@ -0,0 +1,9 @@ +lerp | wgpu-matrix
  • Performs linear interpolation on two quaternions. +Given quaternions a and b and interpolation coefficient t, returns +a + t * (b - a).

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand quaternion.

      +
    • b: BaseArgType

      Operand quaternion.

      +
    • t: number

      Interpolation coefficient.

      +
    • Optional dst: T

      quaternion to hold result. If not passed in a new one is created.

      +

    Returns T

    The linear interpolated result.

    +
\ No newline at end of file diff --git a/docs/functions/quatn.mul.html b/docs/functions/quatn.mul.html new file mode 100644 index 0000000..2edfba7 --- /dev/null +++ b/docs/functions/quatn.mul.html @@ -0,0 +1,6 @@ +mul | wgpu-matrix
  • Multiplies two quaternions

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      the first quaternion

      +
    • b: BaseArgType

      the second quaternion

      +
    • Optional dst: T

      quaternion to hold result. If not passed in a new one is created.

      +

    Returns T

    A quaternion that is the result of a * b

    +
\ No newline at end of file diff --git a/docs/functions/quatn.mulScalar.html b/docs/functions/quatn.mulScalar.html new file mode 100644 index 0000000..4178b83 --- /dev/null +++ b/docs/functions/quatn.mulScalar.html @@ -0,0 +1,6 @@ +mulScalar | wgpu-matrix

Function mulScalar

  • Multiplies a quaternion by a scalar.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The quaternion.

      +
    • k: number

      The scalar.

      +
    • Optional dst: T

      quaternion to hold result. If not passed in a new one is created.

      +

    Returns T

    The scaled quaternion.

    +
\ No newline at end of file diff --git a/docs/functions/quatn.multiply.html b/docs/functions/quatn.multiply.html new file mode 100644 index 0000000..9497329 --- /dev/null +++ b/docs/functions/quatn.multiply.html @@ -0,0 +1,6 @@ +multiply | wgpu-matrix

Function multiply

  • Multiplies two quaternions

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      the first quaternion

      +
    • b: BaseArgType

      the second quaternion

      +
    • Optional dst: T

      quaternion to hold result. If not passed in a new one is created.

      +

    Returns T

    A quaternion that is the result of a * b

    +
\ No newline at end of file diff --git a/docs/functions/quatn.normalize.html b/docs/functions/quatn.normalize.html new file mode 100644 index 0000000..a4fc2dd --- /dev/null +++ b/docs/functions/quatn.normalize.html @@ -0,0 +1,5 @@ +normalize | wgpu-matrix

Function normalize

  • Divides a quaternion by its Euclidean length and returns the quotient.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The quaternion.

      +
    • Optional dst: T

      quaternion to hold result. If not passed in a new one is created.

      +

    Returns T

    The normalized quaternion.

    +
\ No newline at end of file diff --git a/docs/functions/quatn.rotateX.html b/docs/functions/quatn.rotateX.html new file mode 100644 index 0000000..e658863 --- /dev/null +++ b/docs/functions/quatn.rotateX.html @@ -0,0 +1,6 @@ +rotateX | wgpu-matrix

Function rotateX

  • Rotates the given quaternion around the X axis by the given angle.

    +

    Type Parameters

    Parameters

    • q: BaseArgType

      quaternion to rotate

      +
    • angleInRadians: number

      The angle by which to rotate

      +
    • Optional dst: T

      quaternion to hold result. If not passed in a new one is created.

      +

    Returns T

    A quaternion that is the result of a * b

    +
\ No newline at end of file diff --git a/docs/functions/quatn.rotateY.html b/docs/functions/quatn.rotateY.html new file mode 100644 index 0000000..b116078 --- /dev/null +++ b/docs/functions/quatn.rotateY.html @@ -0,0 +1,6 @@ +rotateY | wgpu-matrix

Function rotateY

  • Rotates the given quaternion around the Y axis by the given angle.

    +

    Type Parameters

    Parameters

    • q: BaseArgType

      quaternion to rotate

      +
    • angleInRadians: number

      The angle by which to rotate

      +
    • Optional dst: T

      quaternion to hold result. If not passed in a new one is created.

      +

    Returns T

    A quaternion that is the result of a * b

    +
\ No newline at end of file diff --git a/docs/functions/quatn.rotateZ.html b/docs/functions/quatn.rotateZ.html new file mode 100644 index 0000000..1cdae59 --- /dev/null +++ b/docs/functions/quatn.rotateZ.html @@ -0,0 +1,6 @@ +rotateZ | wgpu-matrix

Function rotateZ

  • Rotates the given quaternion around the Z axis by the given angle.

    +

    Type Parameters

    Parameters

    • q: BaseArgType

      quaternion to rotate

      +
    • angleInRadians: number

      The angle by which to rotate

      +
    • Optional dst: T

      quaternion to hold result. If not passed in a new one is created.

      +

    Returns T

    A quaternion that is the result of a * b

    +
\ No newline at end of file diff --git a/docs/functions/quatn.rotationTo.html b/docs/functions/quatn.rotationTo.html new file mode 100644 index 0000000..bd59d29 --- /dev/null +++ b/docs/functions/quatn.rotationTo.html @@ -0,0 +1,6 @@ +rotationTo | wgpu-matrix

Function rotationTo

  • Computes a quaternion to represent the shortest rotation from one vector to another.

    +

    Type Parameters

    Parameters

    • aUnit: BaseArgType

      the start vector

      +
    • bUnit: BaseArgType

      the end vector

      +
    • Optional dst: T

      quaternion to hold result. If not passed in a new one is created.

      +

    Returns T

    the result

    +
\ No newline at end of file diff --git a/docs/functions/quatn.scale.html b/docs/functions/quatn.scale.html new file mode 100644 index 0000000..53d1644 --- /dev/null +++ b/docs/functions/quatn.scale.html @@ -0,0 +1,6 @@ +scale | wgpu-matrix

Function scale

  • Multiplies a quaternion by a scalar.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The quaternion.

      +
    • k: number

      The scalar.

      +
    • Optional dst: T

      quaternion to hold result. If not passed in a new one is created.

      +

    Returns T

    The scaled quaternion.

    +
\ No newline at end of file diff --git a/docs/functions/quatn.set.html b/docs/functions/quatn.set.html new file mode 100644 index 0000000..3a645b3 --- /dev/null +++ b/docs/functions/quatn.set.html @@ -0,0 +1,9 @@ +set | wgpu-matrix
  • Sets the values of a Quat +Also see quat.create and quat.copy

    +

    Type Parameters

    Parameters

    • x: number

      first value

      +
    • y: number

      second value

      +
    • z: number

      third value

      +
    • w: number

      fourth value

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector with its elements set.

    +
\ No newline at end of file diff --git a/docs/functions/quatn.slerp.html b/docs/functions/quatn.slerp.html new file mode 100644 index 0000000..e7e8f1c --- /dev/null +++ b/docs/functions/quatn.slerp.html @@ -0,0 +1,7 @@ +slerp | wgpu-matrix

Function slerp

  • Spherically linear interpolate between two quaternions

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      starting value

      +
    • b: BaseArgType

      ending value

      +
    • t: number

      value where 0 = a and 1 = b

      +
    • Optional dst: T

      quaternion to hold result. If not passed in a new one is created.

      +

    Returns T

    A quaternion that is the result of a * b

    +
\ No newline at end of file diff --git a/docs/functions/quatn.sqlerp.html b/docs/functions/quatn.sqlerp.html new file mode 100644 index 0000000..1b53f0c --- /dev/null +++ b/docs/functions/quatn.sqlerp.html @@ -0,0 +1,8 @@ +sqlerp | wgpu-matrix

Function sqlerp

  • Performs a spherical linear interpolation with two control points

    +

    Type Parameters

    Parameters

    Returns T

    result

    +
\ No newline at end of file diff --git a/docs/functions/quatn.sub.html b/docs/functions/quatn.sub.html new file mode 100644 index 0000000..051252c --- /dev/null +++ b/docs/functions/quatn.sub.html @@ -0,0 +1,6 @@ +sub | wgpu-matrix
  • Subtracts two quaternions.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand quaternion.

      +
    • b: BaseArgType

      Operand quaternion.

      +
    • Optional dst: T

      quaternion to hold result. If not passed in a new one is created.

      +

    Returns T

    A quaternion that is the difference of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/quatn.subtract.html b/docs/functions/quatn.subtract.html new file mode 100644 index 0000000..472ba3a --- /dev/null +++ b/docs/functions/quatn.subtract.html @@ -0,0 +1,6 @@ +subtract | wgpu-matrix

Function subtract

  • Subtracts two quaternions.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand quaternion.

      +
    • b: BaseArgType

      Operand quaternion.

      +
    • Optional dst: T

      quaternion to hold result. If not passed in a new one is created.

      +

    Returns T

    A quaternion that is the difference of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/quatn.toAxisAngle.html b/docs/functions/quatn.toAxisAngle.html new file mode 100644 index 0000000..aca9b3b --- /dev/null +++ b/docs/functions/quatn.toAxisAngle.html @@ -0,0 +1,5 @@ +toAxisAngle | wgpu-matrix

Function toAxisAngle

  • Gets the rotation axis and angle

    +

    Type Parameters

    Parameters

    • q: BaseArgType

      quaternion to compute from

      +
    • Optional dst: T

      Vec3 to hold result. If not passed in a new one is created.

      +

    Returns {
        angle: number;
        axis: T;
    }

    angle and axis

    +
    • angle: number
    • axis: T
\ No newline at end of file diff --git a/docs/functions/setDefaultType.html b/docs/functions/setDefaultType.html deleted file mode 100644 index 357d601..0000000 --- a/docs/functions/setDefaultType.html +++ /dev/null @@ -1,6 +0,0 @@ -setDefaultType | wgpu-matrix

Function setDefaultType

  • Sets the type this library creates for all types

    -

    example:

    -
    setDefaultType(Float64Array);
    -
    -

    Parameters

    • ctor: (new (n) => Float32Array | Float64Array | number[])

      the constructor for the type. Either Float32Array, Float64Array, or Array

      -
        • new (n): Float32Array | Float64Array | number[]
        • Parameters

          • n: number

          Returns Float32Array | Float64Array | number[]

    Returns void

\ No newline at end of file diff --git a/docs/functions/utils.degToRad.html b/docs/functions/utils.degToRad.html index 26c129a..98f4947 100644 --- a/docs/functions/utils.degToRad.html +++ b/docs/functions/utils.degToRad.html @@ -1,4 +1,4 @@ -degToRad | wgpu-matrix

Function degToRad

  • Convert degrees to radians

    +degToRad | wgpu-matrix

    Function degToRad

    • Convert degrees to radians

      Parameters

      • degrees: number

        Angle in degrees

      Returns number

      angle converted to radians

      -
    \ No newline at end of file +
\ No newline at end of file diff --git a/docs/functions/utils.euclideanModulo.html b/docs/functions/utils.euclideanModulo.html index 0d823a5..40569bf 100644 --- a/docs/functions/utils.euclideanModulo.html +++ b/docs/functions/utils.euclideanModulo.html @@ -1,7 +1,8 @@ -euclideanModulo | wgpu-matrix

Function euclideanModulo

  • Compute the euclidean modulo

    +euclideanModulo | wgpu-matrix

    Function euclideanModulo

    • Compute the euclidean modulo

      // table for n / 3
      -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5 <- n
      ------------------------------------
      -2 -1 -0 -2 -1 0, 1, 2, 0, 1, 2 <- n % 3
      1 2 0 1 2 0, 1, 2, 0, 1, 2 <- euclideanModule(n, 3)
      +

      Parameters

      • n: number

        dividend

      • m: number

        divisor

      Returns number

      the euclidean modulo of n / m

      -
    \ No newline at end of file +
\ No newline at end of file diff --git a/docs/functions/utils.inverseLerp.html b/docs/functions/utils.inverseLerp.html index 89b2af3..264a334 100644 --- a/docs/functions/utils.inverseLerp.html +++ b/docs/functions/utils.inverseLerp.html @@ -1,8 +1,8 @@ -inverseLerp | wgpu-matrix

Function inverseLerp

  • Compute the opposite of lerp. Given a and b and a value between +inverseLerp | wgpu-matrix

    Function inverseLerp

    • Compute the opposite of lerp. Given a and b and a value between a and b returns a value between 0 and 1. 0 if a, 1 if b. Note: no clamping is done.

      Parameters

      • a: number

        start value

      • b: number

        end value

      • v: number

        value between a and b

      Returns number

      (v - a) / (b - a)

      -
    \ No newline at end of file +
\ No newline at end of file diff --git a/docs/functions/utils.lerp.html b/docs/functions/utils.lerp.html index 9b62f22..6ae0aca 100644 --- a/docs/functions/utils.lerp.html +++ b/docs/functions/utils.lerp.html @@ -1,6 +1,6 @@ -lerp | wgpu-matrix
  • Lerps between a and b via t

    +lerp | wgpu-matrix
    • Lerps between a and b via t

      Parameters

      • a: number

        starting value

      • b: number

        ending value

      • t: number

        value where 0 = a and 1 = b

      Returns number

      a + (b - a) * t

      -
    \ No newline at end of file +
\ No newline at end of file diff --git a/docs/functions/utils.radToDeg.html b/docs/functions/utils.radToDeg.html index 3cb65b7..0cf4696 100644 --- a/docs/functions/utils.radToDeg.html +++ b/docs/functions/utils.radToDeg.html @@ -1,4 +1,4 @@ -radToDeg | wgpu-matrix

Function radToDeg

  • Convert radians to degrees

    +radToDeg | wgpu-matrix

    Function radToDeg

    • Convert radians to degrees

      Parameters

      • radians: number

        Angle in radians

      Returns number

      angle converted to degrees

      -
    \ No newline at end of file +
\ No newline at end of file diff --git a/docs/functions/utils.setEpsilon.html b/docs/functions/utils.setEpsilon.html index 0cbf71d..96f1f03 100644 --- a/docs/functions/utils.setEpsilon.html +++ b/docs/functions/utils.setEpsilon.html @@ -1,4 +1,4 @@ -setEpsilon | wgpu-matrix

Function setEpsilon

  • Set the value for EPSILON for various checks

    +setEpsilon | wgpu-matrix

    Function setEpsilon

    • Set the value for EPSILON for various checks

      Parameters

      • v: number

        Value to use for EPSILON.

      Returns number

      previous value of EPSILON;

      -
    \ No newline at end of file +
\ No newline at end of file diff --git a/docs/functions/vec2.add.html b/docs/functions/vec2.add.html index ed098fd..36294ce 100644 --- a/docs/functions/vec2.add.html +++ b/docs/functions/vec2.add.html @@ -1,6 +1,6 @@ -add | wgpu-matrix

Function add

  • Adds two vectors; assumes a and b have the same dimension.

    -

    Parameters

    • a: Vec2

      Operand vector.

      -
    • b: Vec2

      Operand vector.

      -
    • Optional dst: Vec2

      vector to hold result. If not passed in a new one is created.

      -

    Returns Vec2

    A vector that is the sum of a and b.

    -
\ No newline at end of file +add | wgpu-matrix

Function add

  • Adds two vectors; assumes a and b have the same dimension.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that is the sum of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/vec2.addScaled.html b/docs/functions/vec2.addScaled.html index db5353c..ac202bf 100644 --- a/docs/functions/vec2.addScaled.html +++ b/docs/functions/vec2.addScaled.html @@ -1,7 +1,7 @@ -addScaled | wgpu-matrix

Function addScaled

  • Adds two vectors, scaling the 2nd; assumes a and b have the same dimension.

    -

    Parameters

    • a: Vec2

      Operand vector.

      -
    • b: Vec2

      Operand vector.

      +addScaled | wgpu-matrix

      Function addScaled

      • Adds two vectors, scaling the 2nd; assumes a and b have the same dimension.

        +

        Type Parameters

        Parameters

        • a: BaseArgType

          Operand vector.

          +
        • b: BaseArgType

          Operand vector.

        • scale: number

          Amount to scale b

          -
        • Optional dst: Vec2

          vector to hold result. If not passed in a new one is created.

          -

        Returns Vec2

        A vector that is the sum of a + b * scale.

        -
      \ No newline at end of file +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that is the sum of a + b * scale.

    +
\ No newline at end of file diff --git a/docs/functions/vec2.angle.html b/docs/functions/vec2.angle.html index 58020de..eee59bb 100644 --- a/docs/functions/vec2.angle.html +++ b/docs/functions/vec2.angle.html @@ -1,5 +1,5 @@ -angle | wgpu-matrix

Function angle

  • Returns the angle in radians between two vectors.

    -

    Parameters

    • a: Vec2

      Operand vector.

      -
    • b: Vec2

      Operand vector.

      +angle | wgpu-matrix

      Function angle

      • Returns the angle in radians between two vectors.

        +

        Parameters

        Returns number

        The angle in radians between the 2 vectors.

        -
      \ No newline at end of file +
\ No newline at end of file diff --git a/docs/functions/vec2.ceil.html b/docs/functions/vec2.ceil.html index d0fc9e0..97c7126 100644 --- a/docs/functions/vec2.ceil.html +++ b/docs/functions/vec2.ceil.html @@ -1,5 +1,5 @@ -ceil | wgpu-matrix

Function ceil

  • Applies Math.ceil to each element of vector

    -

    Parameters

    • v: Vec2

      Operand vector.

      -
    • Optional dst: Vec2

      vector to hold result. If not passed in a new one is created.

      -

    Returns Vec2

    A vector that is the ceil of each element of v.

    -
\ No newline at end of file +ceil | wgpu-matrix

Function ceil

  • Applies Math.ceil to each element of vector

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that is the ceil of each element of v.

    +
\ No newline at end of file diff --git a/docs/functions/vec2.clamp.html b/docs/functions/vec2.clamp.html index 758ab4d..318248e 100644 --- a/docs/functions/vec2.clamp.html +++ b/docs/functions/vec2.clamp.html @@ -1,7 +1,7 @@ -clamp | wgpu-matrix

Function clamp

  • Clamp each element of vector between min and max

    -

    Parameters

    • v: Vec2

      Operand vector.

      +clamp | wgpu-matrix

      Function clamp

      • Clamp each element of vector between min and max

        +

        Type Parameters

        Parameters

        • v: BaseArgType

          Operand vector.

        • min: number = 0

          Max value, default 1

        • max: number = 1

          Min value, default 0

          -
        • Optional dst: Vec2

          vector to hold result. If not passed in a new one is created.

          -

        Returns Vec2

        A vector that the clamped value of each element of v.

        -
      \ No newline at end of file +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that the clamped value of each element of v.

    +
\ No newline at end of file diff --git a/docs/functions/vec2.clone.html b/docs/functions/vec2.clone.html index 79438ff..36351cf 100644 --- a/docs/functions/vec2.clone.html +++ b/docs/functions/vec2.clone.html @@ -1,6 +1,6 @@ -clone | wgpu-matrix

Function clone

  • Clones a vector. (same as vec2.copy) -Also see vec2.create and vec2.set

    -

    Parameters

    • v: Vec2

      The vector.

      -
    • Optional dst: Vec2

      vector to hold result. If not passed in a new one is created.

      -

    Returns Vec2

    A copy of v.

    -
\ No newline at end of file +clone | wgpu-matrix

Function clone

  • Copies a vector. (same as vec2.clone) +Also see vec2.create and vec2.set

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A copy of v.

    +
\ No newline at end of file diff --git a/docs/functions/vec2.copy.html b/docs/functions/vec2.copy.html index 9641e39..8c56ca3 100644 --- a/docs/functions/vec2.copy.html +++ b/docs/functions/vec2.copy.html @@ -1,6 +1,6 @@ -copy | wgpu-matrix

Function copy

  • Copies a vector. (same as vec2.clone) -Also see vec2.create and vec2.set

    -

    Parameters

    • v: Vec2

      The vector.

      -
    • Optional dst: Vec2

      vector to hold result. If not passed in a new one is created.

      -

    Returns Vec2

    A copy of v.

    -
\ No newline at end of file +copy | wgpu-matrix

Function copy

  • Copies a vector. (same as vec2.clone) +Also see vec2.create and vec2.set

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A copy of v.

    +
\ No newline at end of file diff --git a/docs/functions/vec2.create.html b/docs/functions/vec2.create.html index 8295d68..a7c2e0a 100644 --- a/docs/functions/vec2.create.html +++ b/docs/functions/vec2.create.html @@ -1,18 +1,12 @@ -create | wgpu-matrix

Function create

  • Creates a Vec2; may be called with x, y, z to set initial values.

    +create | wgpu-matrix

    Function create

    • Creates a Vec2; may be called with x, y, z to set initial values.

      Note: Since passing in a raw JavaScript array is valid in all circumstances, if you want to -force a JavaScript array into a Vec2's specified type +force a JavaScript array into a Vec2's specified type it would be faster to use

      const v = vec2.clone(someJSArray);
       
      -

      Note: a consequence of the implementation is if your Vec2Type = Array -instead of Float32Array or Float64Array then any values you -don't pass in will be undefined. Usually this is not an issue since -(a) using Array is rare and (b) using vec2.create is usually used -to create a Vec2 to be filled out as in

      -
      const sum = vec2.create();
      vec2.add(v1, v2, sum); -
      +

      Parameters

      • x: number = 0

        Initial x value.

      • y: number = 0

        Initial y value.

        -

      Returns Vec2

      the created vector

      -
    \ No newline at end of file +

Returns Float32Array

the created vector

+
\ No newline at end of file diff --git a/docs/functions/vec2.cross.html b/docs/functions/vec2.cross.html index 6e25132..054f6c6 100644 --- a/docs/functions/vec2.cross.html +++ b/docs/functions/vec2.cross.html @@ -1,7 +1,7 @@ -cross | wgpu-matrix

Function cross

  • Computes the cross product of two vectors; assumes both vectors have +cross | wgpu-matrix

    Function cross

    • Computes the cross product of two vectors; assumes both vectors have three entries.

      -

      Parameters

      • a: Vec2

        Operand vector.

        -
      • b: Vec2

        Operand vector.

        -
      • Optional dst: Vec3

        vector to hold result. If not passed in a new one is created.

        -

      Returns Vec3

      The vector of a cross b.

      -
    \ No newline at end of file +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The vector of a cross b.

    +
\ No newline at end of file diff --git a/docs/functions/vec2.dist.html b/docs/functions/vec2.dist.html index 7bdb617..d135988 100644 --- a/docs/functions/vec2.dist.html +++ b/docs/functions/vec2.dist.html @@ -1,5 +1,5 @@ -dist | wgpu-matrix

Function dist

  • Computes the distance between 2 points (same as distance)

    -

    Parameters

    • a: Vec2

      vector.

      -
    • b: Vec2

      vector.

      +dist | wgpu-matrix

      Function dist

      • Computes the distance between 2 points

        +

        Parameters

        Returns number

        distance between a and b

        -
      \ No newline at end of file +
\ No newline at end of file diff --git a/docs/functions/vec2.distSq.html b/docs/functions/vec2.distSq.html index 0a00684..e979a2f 100644 --- a/docs/functions/vec2.distSq.html +++ b/docs/functions/vec2.distSq.html @@ -1,5 +1,5 @@ -distSq | wgpu-matrix

Function distSq

  • Computes the square of the distance between 2 points (same as distanceSq)

    -

    Parameters

    • a: Vec2

      vector.

      -
    • b: Vec2

      vector.

      +distSq | wgpu-matrix

      Function distSq

      • Computes the square of the distance between 2 points

        +

        Parameters

        Returns number

        square of the distance between a and b

        -
      \ No newline at end of file +
\ No newline at end of file diff --git a/docs/functions/vec2.distance.html b/docs/functions/vec2.distance.html index 932fc6c..23d3d09 100644 --- a/docs/functions/vec2.distance.html +++ b/docs/functions/vec2.distance.html @@ -1,5 +1,5 @@ -distance | wgpu-matrix

Function distance

  • Computes the distance between 2 points

    -

    Parameters

    • a: Vec2

      vector.

      -
    • b: Vec2

      vector.

      +distance | wgpu-matrix

      Function distance

      • Computes the distance between 2 points

        +

        Parameters

        Returns number

        distance between a and b

        -
      \ No newline at end of file +
\ No newline at end of file diff --git a/docs/functions/vec2.distanceSq.html b/docs/functions/vec2.distanceSq.html index 0bb7910..00f6d52 100644 --- a/docs/functions/vec2.distanceSq.html +++ b/docs/functions/vec2.distanceSq.html @@ -1,5 +1,5 @@ -distanceSq | wgpu-matrix

Function distanceSq

  • Computes the square of the distance between 2 points

    -

    Parameters

    • a: Vec2

      vector.

      -
    • b: Vec2

      vector.

      +distanceSq | wgpu-matrix

      Function distanceSq

      • Computes the square of the distance between 2 points

        +

        Parameters

        Returns number

        square of the distance between a and b

        -
      \ No newline at end of file +
\ No newline at end of file diff --git a/docs/functions/vec2.div.html b/docs/functions/vec2.div.html index bfc7960..b266fcc 100644 --- a/docs/functions/vec2.div.html +++ b/docs/functions/vec2.div.html @@ -1,7 +1,7 @@ -div | wgpu-matrix

Function div

  • Divides a vector by another vector (component-wise); assumes a and -b have the same length. (same as divide)

    -

    Parameters

    • a: Vec2

      Operand vector.

      -
    • b: Vec2

      Operand vector.

      -
    • Optional dst: Vec2

      vector to hold result. If not passed in a new one is created.

      -

    Returns Vec2

    The vector of quotients of entries of a and b.

    -
\ No newline at end of file +div | wgpu-matrix

Function div

  • Divides a vector by another vector (component-wise); assumes a and +b have the same length.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The vector of quotients of entries of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/vec2.divScalar.html b/docs/functions/vec2.divScalar.html index 57a5bcb..6940a06 100644 --- a/docs/functions/vec2.divScalar.html +++ b/docs/functions/vec2.divScalar.html @@ -1,6 +1,6 @@ -divScalar | wgpu-matrix

Function divScalar

  • Divides a vector by a scalar.

    -

    Parameters

    • v: Vec2

      The vector.

      +divScalar | wgpu-matrix

      Function divScalar

      • Divides a vector by a scalar.

        +

        Type Parameters

        Parameters

        • v: BaseArgType

          The vector.

        • k: number

          The scalar.

          -
        • Optional dst: Vec2

          vector to hold result. If not passed in a new one is created.

          -

        Returns Vec2

        The scaled vector.

        -
      \ No newline at end of file +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The scaled vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec2.divide.html b/docs/functions/vec2.divide.html index a51760a..7823714 100644 --- a/docs/functions/vec2.divide.html +++ b/docs/functions/vec2.divide.html @@ -1,7 +1,7 @@ -divide | wgpu-matrix

Function divide

  • Divides a vector by another vector (component-wise); assumes a and +divide | wgpu-matrix

    Function divide

    • Divides a vector by another vector (component-wise); assumes a and b have the same length.

      -

      Parameters

      • a: Vec2

        Operand vector.

        -
      • b: Vec2

        Operand vector.

        -
      • Optional dst: Vec2

        vector to hold result. If not passed in a new one is created.

        -

      Returns Vec2

      The vector of quotients of entries of a and b.

      -
    \ No newline at end of file +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The vector of quotients of entries of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/vec2.dot.html b/docs/functions/vec2.dot.html index 406c07e..97fa6c1 100644 --- a/docs/functions/vec2.dot.html +++ b/docs/functions/vec2.dot.html @@ -1,6 +1,6 @@ -dot | wgpu-matrix

Function dot

  • Computes the dot product of two vectors; assumes both vectors have +dot | wgpu-matrix

    Function dot

    • Computes the dot product of two vectors; assumes both vectors have three entries.

      -

      Parameters

    \ No newline at end of file +
\ No newline at end of file diff --git a/docs/functions/vec2.equals.html b/docs/functions/vec2.equals.html index 96bdd43..2e50624 100644 --- a/docs/functions/vec2.equals.html +++ b/docs/functions/vec2.equals.html @@ -1,5 +1,5 @@ -equals | wgpu-matrix

Function equals

  • Check if 2 vectors are exactly equal

    -

    Parameters

    • a: Vec2

      Operand vector.

      -
    • b: Vec2

      Operand vector.

      +equals | wgpu-matrix

      Function equals

      • Check if 2 vectors are exactly equal

        +

        Parameters

        Returns boolean

        true if vectors are exactly equal

        -
      \ No newline at end of file +
\ No newline at end of file diff --git a/docs/functions/vec2.equalsApproximately.html b/docs/functions/vec2.equalsApproximately.html index 0a8629b..205a7a7 100644 --- a/docs/functions/vec2.equalsApproximately.html +++ b/docs/functions/vec2.equalsApproximately.html @@ -1,5 +1,5 @@ -equalsApproximately | wgpu-matrix

Function equalsApproximately

  • Check if 2 vectors are approximately equal

    -

    Parameters

    • a: Vec2

      Operand vector.

      -
    • b: Vec2

      Operand vector.

      +equalsApproximately | wgpu-matrix

      Function equalsApproximately

      • Check if 2 vectors are approximately equal

        +

        Parameters

        Returns boolean

        true if vectors are approximately equal

        -
      \ No newline at end of file +
\ No newline at end of file diff --git a/docs/functions/vec2.floor.html b/docs/functions/vec2.floor.html index 9cae25d..f2e7db8 100644 --- a/docs/functions/vec2.floor.html +++ b/docs/functions/vec2.floor.html @@ -1,5 +1,5 @@ -floor | wgpu-matrix

Function floor

  • Applies Math.floor to each element of vector

    -

    Parameters

    • v: Vec2

      Operand vector.

      -
    • Optional dst: Vec2

      vector to hold result. If not passed in a new one is created.

      -

    Returns Vec2

    A vector that is the floor of each element of v.

    -
\ No newline at end of file +floor | wgpu-matrix

Function floor

  • Applies Math.floor to each element of vector

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that is the floor of each element of v.

    +
\ No newline at end of file diff --git a/docs/functions/vec2.fromValues.html b/docs/functions/vec2.fromValues.html index d358662..70d1137 100644 --- a/docs/functions/vec2.fromValues.html +++ b/docs/functions/vec2.fromValues.html @@ -1,5 +1,12 @@ -fromValues | wgpu-matrix

Function fromValues

  • Creates a Vec2; may be called with x, y, z to set initial values. (same as create)

    +fromValues | wgpu-matrix

    Function fromValues

    • Creates a Vec2; may be called with x, y, z to set initial values.

      +

      Note: Since passing in a raw JavaScript array +is valid in all circumstances, if you want to +force a JavaScript array into a Vec2's specified type +it would be faster to use

      +
      const v = vec2.clone(someJSArray);
      +
      +

      Parameters

      • x: number = 0

        Initial x value.

      • y: number = 0

        Initial y value.

        -

      Returns Vec2

      the created vector

      -
    \ No newline at end of file +

Returns Float32Array

the created vector

+
\ No newline at end of file diff --git a/docs/functions/vec2.inverse.html b/docs/functions/vec2.inverse.html index a1d0b44..fc6aa0e 100644 --- a/docs/functions/vec2.inverse.html +++ b/docs/functions/vec2.inverse.html @@ -1,5 +1,5 @@ -inverse | wgpu-matrix

Function inverse

  • Inverse a vector.

    -

    Parameters

    • v: Vec2

      The vector.

      -
    • Optional dst: Vec2

      vector to hold result. If not passed in a new one is created.

      -

    Returns Vec2

    The inverted vector.

    -
\ No newline at end of file +inverse | wgpu-matrix

Function inverse

  • Inverse a vector.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The inverted vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec2.invert.html b/docs/functions/vec2.invert.html index 47f8ea2..2e2579b 100644 --- a/docs/functions/vec2.invert.html +++ b/docs/functions/vec2.invert.html @@ -1,5 +1,5 @@ -invert | wgpu-matrix

Function invert

  • Invert a vector. (same as inverse)

    -

    Parameters

    • v: Vec2

      The vector.

      -
    • Optional dst: Vec2

      vector to hold result. If not passed in a new one is created.

      -

    Returns Vec2

    The inverted vector.

    -
\ No newline at end of file +invert | wgpu-matrix

Function invert

  • Inverse a vector.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The inverted vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec2.len.html b/docs/functions/vec2.len.html index b0ba4f7..766714b 100644 --- a/docs/functions/vec2.len.html +++ b/docs/functions/vec2.len.html @@ -1,4 +1,4 @@ -len | wgpu-matrix

Function len

  • Computes the length of vector (same as length)

    -

    Parameters

    • v: Vec2

      vector.

      +len | wgpu-matrix

      Function len

      • Computes the length of vector

        +

        Parameters

        Returns number

        length of vector.

        -
      \ No newline at end of file +
\ No newline at end of file diff --git a/docs/functions/vec2.lenSq.html b/docs/functions/vec2.lenSq.html index e2f64e0..7c16a8c 100644 --- a/docs/functions/vec2.lenSq.html +++ b/docs/functions/vec2.lenSq.html @@ -1,4 +1,4 @@ -lenSq | wgpu-matrix

Function lenSq

  • Computes the square of the length of vector (same as lengthSq)

    -

    Parameters

    • v: Vec2

      vector.

      +lenSq | wgpu-matrix

      Function lenSq

      • Computes the square of the length of vector

        +

        Parameters

        Returns number

        square of the length of vector.

        -
      \ No newline at end of file +
\ No newline at end of file diff --git a/docs/functions/vec2.length.html b/docs/functions/vec2.length.html index cdadc3e..60fb218 100644 --- a/docs/functions/vec2.length.html +++ b/docs/functions/vec2.length.html @@ -1,4 +1,4 @@ -length | wgpu-matrix

Function length

  • Computes the length of vector

    -

    Parameters

    • v: Vec2

      vector.

      +length | wgpu-matrix

      Function length

      • Computes the length of vector

        +

        Parameters

        Returns number

        length of vector.

        -
      \ No newline at end of file +
\ No newline at end of file diff --git a/docs/functions/vec2.lengthSq.html b/docs/functions/vec2.lengthSq.html index 6884069..5d442e5 100644 --- a/docs/functions/vec2.lengthSq.html +++ b/docs/functions/vec2.lengthSq.html @@ -1,4 +1,4 @@ -lengthSq | wgpu-matrix

Function lengthSq

  • Computes the square of the length of vector

    -

    Parameters

    • v: Vec2

      vector.

      +lengthSq | wgpu-matrix

      Function lengthSq

      • Computes the square of the length of vector

        +

        Parameters

        Returns number

        square of the length of vector.

        -
      \ No newline at end of file +
\ No newline at end of file diff --git a/docs/functions/vec2.lerp.html b/docs/functions/vec2.lerp.html index ec4005f..382611e 100644 --- a/docs/functions/vec2.lerp.html +++ b/docs/functions/vec2.lerp.html @@ -1,9 +1,9 @@ -lerp | wgpu-matrix

Function lerp

  • Performs linear interpolation on two vectors. +lerp | wgpu-matrix

    Function lerp

    • Performs linear interpolation on two vectors. Given vectors a and b and interpolation coefficient t, returns a + t * (b - a).

      -

      Parameters

      • a: Vec2

        Operand vector.

        -
      • b: Vec2

        Operand vector.

        +

        Type Parameters

        Parameters

        • a: BaseArgType

          Operand vector.

          +
        • b: BaseArgType

          Operand vector.

        • t: number

          Interpolation coefficient.

          -
        • Optional dst: Vec2

          vector to hold result. If not passed in a new one is created.

          -

        Returns Vec2

        The linear interpolated result.

        -
    \ No newline at end of file +
  • Optional dst: T

    vector to hold result. If not passed in a new one is created.

    +

Returns T

The linear interpolated result.

+
\ No newline at end of file diff --git a/docs/functions/vec2.lerpV.html b/docs/functions/vec2.lerpV.html index 64e0097..b06af5a 100644 --- a/docs/functions/vec2.lerpV.html +++ b/docs/functions/vec2.lerpV.html @@ -1,9 +1,9 @@ -lerpV | wgpu-matrix

Function lerpV

  • Performs linear interpolation on two vectors. +lerpV | wgpu-matrix

    Function lerpV

    • Performs linear interpolation on two vectors. Given vectors a and b and interpolation coefficient vector t, returns a + t * (b - a).

      -

      Parameters

      • a: Vec2

        Operand vector.

        -
      • b: Vec2

        Operand vector.

        -
      • t: Vec2

        Interpolation coefficients vector.

        -
      • Optional dst: Vec2

        vector to hold result. If not passed in a new one is created.

        -

      Returns Vec2

      the linear interpolated result.

      -
    \ No newline at end of file +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • t: BaseArgType

      Interpolation coefficients vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    the linear interpolated result.

    +
\ No newline at end of file diff --git a/docs/functions/vec2.max.html b/docs/functions/vec2.max.html index 5729e79..f8f912f 100644 --- a/docs/functions/vec2.max.html +++ b/docs/functions/vec2.max.html @@ -1,8 +1,8 @@ -max | wgpu-matrix

Function max

  • Return max values of two vectors. +max | wgpu-matrix

    Function max

    • Return max values of two vectors. Given vectors a and b returns [max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])].

      -

      Parameters

      • a: Vec2

        Operand vector.

        -
      • b: Vec2

        Operand vector.

        -
      • Optional dst: Vec2

        vector to hold result. If not passed in a new one is created.

        -

      Returns Vec2

      The max components vector.

      -
    \ No newline at end of file +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The max components vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec2.midpoint.html b/docs/functions/vec2.midpoint.html index d76d5f3..44bc700 100644 --- a/docs/functions/vec2.midpoint.html +++ b/docs/functions/vec2.midpoint.html @@ -1,5 +1,5 @@ -midpoint | wgpu-matrix

Function midpoint

  • Return the vector exactly between 2 endpoint vectors

    -

    Parameters

    Returns Vec2

    The vector exactly residing between endpoints 1 and 2

    -
\ No newline at end of file +midpoint | wgpu-matrix

Function midpoint

  • Return the vector exactly between 2 endpoint vectors

    +

    Type Parameters

    Parameters

    Returns T

    The vector exactly residing between endpoints 1 and 2

    +
\ No newline at end of file diff --git a/docs/functions/vec2.min.html b/docs/functions/vec2.min.html index e31aac0..ed7bfff 100644 --- a/docs/functions/vec2.min.html +++ b/docs/functions/vec2.min.html @@ -1,8 +1,8 @@ -min | wgpu-matrix

Function min

  • Return min values of two vectors. +min | wgpu-matrix

    Function min

    • Return min values of two vectors. Given vectors a and b returns [min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])].

      -

      Parameters

      • a: Vec2

        Operand vector.

        -
      • b: Vec2

        Operand vector.

        -
      • Optional dst: Vec2

        vector to hold result. If not passed in a new one is created.

        -

      Returns Vec2

      The min components vector.

      -
    \ No newline at end of file +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The min components vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec2.mul.html b/docs/functions/vec2.mul.html index ac1ac58..9423f8d 100644 --- a/docs/functions/vec2.mul.html +++ b/docs/functions/vec2.mul.html @@ -1,7 +1,7 @@ -mul | wgpu-matrix

Function mul

  • Multiplies a vector by another vector (component-wise); assumes a and -b have the same length. (same as mul)

    -

    Parameters

    • a: Vec2

      Operand vector.

      -
    • b: Vec2

      Operand vector.

      -
    • Optional dst: Vec2

      vector to hold result. If not passed in a new one is created.

      -

    Returns Vec2

    The vector of products of entries of a and b.

    -
\ No newline at end of file +mul | wgpu-matrix

Function mul

  • Multiplies a vector by another vector (component-wise); assumes a and +b have the same length.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The vector of products of entries of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/vec2.mulScalar.html b/docs/functions/vec2.mulScalar.html index f4ff18b..aeab730 100644 --- a/docs/functions/vec2.mulScalar.html +++ b/docs/functions/vec2.mulScalar.html @@ -1,6 +1,6 @@ -mulScalar | wgpu-matrix

Function mulScalar

  • Multiplies a vector by a scalar.

    -

    Parameters

    • v: Vec2

      The vector.

      +mulScalar | wgpu-matrix

      Function mulScalar

      • Multiplies a vector by a scalar.

        +

        Type Parameters

        Parameters

        • v: BaseArgType

          The vector.

        • k: number

          The scalar.

          -
        • Optional dst: Vec2

          vector to hold result. If not passed in a new one is created.

          -

        Returns Vec2

        The scaled vector.

        -
      \ No newline at end of file +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The scaled vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec2.multiply.html b/docs/functions/vec2.multiply.html index 20441af..9224702 100644 --- a/docs/functions/vec2.multiply.html +++ b/docs/functions/vec2.multiply.html @@ -1,7 +1,7 @@ -multiply | wgpu-matrix

Function multiply

  • Multiplies a vector by another vector (component-wise); assumes a and +multiply | wgpu-matrix

    Function multiply

    • Multiplies a vector by another vector (component-wise); assumes a and b have the same length.

      -

      Parameters

      • a: Vec2

        Operand vector.

        -
      • b: Vec2

        Operand vector.

        -
      • Optional dst: Vec2

        vector to hold result. If not passed in a new one is created.

        -

      Returns Vec2

      The vector of products of entries of a and b.

      -
    \ No newline at end of file +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The vector of products of entries of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/vec2.negate.html b/docs/functions/vec2.negate.html index f9c06ee..97d23d1 100644 --- a/docs/functions/vec2.negate.html +++ b/docs/functions/vec2.negate.html @@ -1,5 +1,5 @@ -negate | wgpu-matrix

Function negate

  • Negates a vector.

    -

    Parameters

    • v: Vec2

      The vector.

      -
    • Optional dst: Vec2

      vector to hold result. If not passed in a new one is created.

      -

    Returns Vec2

    -v.

    -
\ No newline at end of file +negate | wgpu-matrix

Function negate

  • Negates a vector.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    -v.

    +
\ No newline at end of file diff --git a/docs/functions/vec2.normalize.html b/docs/functions/vec2.normalize.html index 506847b..f8d32e0 100644 --- a/docs/functions/vec2.normalize.html +++ b/docs/functions/vec2.normalize.html @@ -1,5 +1,5 @@ -normalize | wgpu-matrix

Function normalize

  • Divides a vector by its Euclidean length and returns the quotient.

    -

    Parameters

    • v: Vec2

      The vector.

      -
    • Optional dst: Vec2

      vector to hold result. If not passed in a new one is created.

      -

    Returns Vec2

    The normalized vector.

    -
\ No newline at end of file +normalize | wgpu-matrix

Function normalize

  • Divides a vector by its Euclidean length and returns the quotient.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The normalized vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec2.random.html b/docs/functions/vec2.random.html index 502d586..57bda5f 100644 --- a/docs/functions/vec2.random.html +++ b/docs/functions/vec2.random.html @@ -1,5 +1,5 @@ -random | wgpu-matrix

Function random

  • Creates a random unit vector * scale

    -

    Parameters

    • scale: number = 1

      Default 1

      -
    • Optional dst: Vec2

      vector to hold result. If not passed in a new one is created.

      -

    Returns Vec2

    The random vector.

    -
\ No newline at end of file +random | wgpu-matrix

Function random

  • Creates a random unit vector * scale

    +

    Type Parameters

    Parameters

    • scale: number = 1

      Default 1

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The random vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec2.rotate.html b/docs/functions/vec2.rotate.html index e842813..165e17c 100644 --- a/docs/functions/vec2.rotate.html +++ b/docs/functions/vec2.rotate.html @@ -1,6 +1,6 @@ -rotate | wgpu-matrix

Function rotate

  • Rotate a 2D vector

    -

    Parameters

    • a: Vec2

      The vec2 point to rotate

      -
    • b: Vec2

      The origin of the rotation

      +rotate | wgpu-matrix

      Function rotate

      • Rotate a 2D vector

        +

        Type Parameters

        Parameters

        • a: BaseArgType

          The vec2 point to rotate

          +
        • b: BaseArgType

          The origin of the rotation

        • rad: number

          The angle of rotation in radians

          -
        • Optional dst: Vec2

        Returns Vec2

        the rotated vector

        -
      \ No newline at end of file +
    • Optional dst: T

    Returns T

    the rotated vector

    +
\ No newline at end of file diff --git a/docs/functions/vec2.round.html b/docs/functions/vec2.round.html index c40e677..20a1795 100644 --- a/docs/functions/vec2.round.html +++ b/docs/functions/vec2.round.html @@ -1,5 +1,5 @@ -round | wgpu-matrix

Function round

  • Applies Math.round to each element of vector

    -

    Parameters

    • v: Vec2

      Operand vector.

      -
    • Optional dst: Vec2

      vector to hold result. If not passed in a new one is created.

      -

    Returns Vec2

    A vector that is the round of each element of v.

    -
\ No newline at end of file +round | wgpu-matrix

Function round

  • Applies Math.round to each element of vector

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that is the round of each element of v.

    +
\ No newline at end of file diff --git a/docs/functions/vec2.scale.html b/docs/functions/vec2.scale.html index f113332..38f98b9 100644 --- a/docs/functions/vec2.scale.html +++ b/docs/functions/vec2.scale.html @@ -1,6 +1,6 @@ -scale | wgpu-matrix

Function scale

  • Multiplies a vector by a scalar. (same as mulScalar)

    -

    Parameters

    • v: Vec2

      The vector.

      +scale | wgpu-matrix

      Function scale

      • Multiplies a vector by a scalar.

        +

        Type Parameters

        Parameters

        • v: BaseArgType

          The vector.

        • k: number

          The scalar.

          -
        • Optional dst: Vec2

          vector to hold result. If not passed in a new one is created.

          -

        Returns Vec2

        The scaled vector.

        -
      \ No newline at end of file +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The scaled vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec2.set.html b/docs/functions/vec2.set.html index f992649..0d7215c 100644 --- a/docs/functions/vec2.set.html +++ b/docs/functions/vec2.set.html @@ -1,7 +1,7 @@ -set | wgpu-matrix

Function set

  • Sets the values of a Vec2 -Also see vec2.create and vec2.copy

    -

    Parameters

    • x: number

      first value

      +set | wgpu-matrix

      Function set

      • Sets the values of a Vec2 +Also see vec2.create and vec2.copy

        +

        Type Parameters

        Parameters

        • x: number

          first value

        • y: number

          second value

          -
        • Optional dst: Vec2

          vector to hold result. If not passed in a new one is created.

          -

        Returns Vec2

        A vector with its elements set.

        -
      \ No newline at end of file +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector with its elements set.

    +
\ No newline at end of file diff --git a/docs/functions/vec2.setDefaultType.html b/docs/functions/vec2.setDefaultType.html deleted file mode 100644 index d8cb578..0000000 --- a/docs/functions/vec2.setDefaultType.html +++ /dev/null @@ -1,17 +0,0 @@ -setDefaultType | wgpu-matrix

Function setDefaultType

  • Sets the type this library creates for a Vec2

    -

    Parameters

    • ctor: (new (n) => Vec2)

      the constructor for the type. Either Float32Array, Float64Array, or Array

      -
        • new (n): Vec2
        • Parameters

          • n: number

          Returns Vec2

    Returns (new (n) => Vec2)

    previous constructor for Vec2

    -
      • new (n): Vec2
      • Vec2 math functions.

        -

        Almost all functions take an optional dst argument. If it is not passed in the -functions will create a new Vec2. In other words you can do this

        -
        const v = vec2.cross(v1, v2);  // Creates a new Vec2 with the cross product of v1 x v2.
        -
        -

        or

        -
        const v = vec2.create();
        vec2.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v -
        -

        The first style is often easier but depending on where it's used it generates garbage where -as there is almost never allocation with the second style.

        -

        It is always safe to pass any vector as the destination. So for example

        -
        vec2.cross(v1, v2, v1);  // Puts the cross product of v1 x v2 in v1
        -
        -

        Parameters

        • n: number

        Returns Vec2

\ No newline at end of file diff --git a/docs/functions/vec2.setLength.html b/docs/functions/vec2.setLength.html index 0bd76b3..096c0e6 100644 --- a/docs/functions/vec2.setLength.html +++ b/docs/functions/vec2.setLength.html @@ -1,5 +1,5 @@ -setLength | wgpu-matrix

Function setLength

  • Treat a 2D vector as a direction and set it's length

    -

    Parameters

    • a: Vec2

      The vec2 to lengthen

      +setLength | wgpu-matrix

      Function setLength

      • Treat a 2D vector as a direction and set it's length

        +

        Type Parameters

        Parameters

        • a: BaseArgType

          The vec2 to lengthen

        • len: number

          The length of the resulting vector

          -
        • Optional dst: Vec2

        Returns Vec2

        The lengthened vector

        -
      \ No newline at end of file +
    • Optional dst: T

    Returns T

    The lengthened vector

    +
\ No newline at end of file diff --git a/docs/functions/vec2.sub.html b/docs/functions/vec2.sub.html index d9c8233..67b5115 100644 --- a/docs/functions/vec2.sub.html +++ b/docs/functions/vec2.sub.html @@ -1,6 +1,6 @@ -sub | wgpu-matrix

Function sub

  • Subtracts two vectors.

    -

    Parameters

    • a: Vec2

      Operand vector.

      -
    • b: Vec2

      Operand vector.

      -
    • Optional dst: Vec2

      vector to hold result. If not passed in a new one is created.

      -

    Returns Vec2

    A vector that is the difference of a and b.

    -
\ No newline at end of file +sub | wgpu-matrix

Function sub

  • Subtracts two vectors.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that is the difference of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/vec2.subtract.html b/docs/functions/vec2.subtract.html index 69d8fad..8baec20 100644 --- a/docs/functions/vec2.subtract.html +++ b/docs/functions/vec2.subtract.html @@ -1,6 +1,6 @@ -subtract | wgpu-matrix

Function subtract

  • Subtracts two vectors.

    -

    Parameters

    • a: Vec2

      Operand vector.

      -
    • b: Vec2

      Operand vector.

      -
    • Optional dst: Vec2

      vector to hold result. If not passed in a new one is created.

      -

    Returns Vec2

    A vector that is the difference of a and b.

    -
\ No newline at end of file +subtract | wgpu-matrix

Function subtract

  • Subtracts two vectors.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that is the difference of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/vec2.transformMat3.html b/docs/functions/vec2.transformMat3.html index 631abd2..6b7c65d 100644 --- a/docs/functions/vec2.transformMat3.html +++ b/docs/functions/vec2.transformMat3.html @@ -1,6 +1,6 @@ -transformMat3 | wgpu-matrix

Function transformMat3

  • Transforms vec4 by 3x3 matrix

    -

    Parameters

    • v: Vec2

      the vector

      -
    • m: Mat3

      The matrix.

      -
    • Optional dst: Vec2

      optional Vec2 to store result. If not passed a new one is created.

      -

    Returns Vec2

    the transformed vector

    -
\ No newline at end of file +transformMat3 | wgpu-matrix

Function transformMat3

  • Transforms vec4 by 3x3 matrix

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      the vector

      +
    • m: BaseArgType

      The matrix.

      +
    • Optional dst: T

      optional Vec2 to store result. If not passed a new one is created.

      +

    Returns T

    the transformed vector

    +
\ No newline at end of file diff --git a/docs/functions/vec2.transformMat4.html b/docs/functions/vec2.transformMat4.html index 94d0f3e..cb6e9a3 100644 --- a/docs/functions/vec2.transformMat4.html +++ b/docs/functions/vec2.transformMat4.html @@ -1,6 +1,6 @@ -transformMat4 | wgpu-matrix

Function transformMat4

  • transform Vec2 by 4x4 matrix

    -

    Parameters

    • v: Vec2

      the vector

      -
    • m: Mat4

      The matrix.

      -
    • Optional dst: Vec2

      optional Vec2 to store result. If not passed a new one is created.

      -

    Returns Vec2

    the transformed vector

    -
\ No newline at end of file +transformMat4 | wgpu-matrix

Function transformMat4

  • transform Vec2 by 4x4 matrix

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      the vector

      +
    • m: BaseArgType

      The matrix.

      +
    • Optional dst: T

      optional Vec2 to store result. If not passed a new one is created.

      +

    Returns T

    the transformed vector

    +
\ No newline at end of file diff --git a/docs/functions/vec2.truncate.html b/docs/functions/vec2.truncate.html index 7179604..f22e8e8 100644 --- a/docs/functions/vec2.truncate.html +++ b/docs/functions/vec2.truncate.html @@ -1,5 +1,5 @@ -truncate | wgpu-matrix

Function truncate

  • Ensure a vector is not longer than a max length

    -

    Parameters

    • a: Vec2

      The vec2 to limit

      +truncate | wgpu-matrix

      Function truncate

      • Ensure a vector is not longer than a max length

        +

        Type Parameters

        Parameters

        • a: BaseArgType

          The vec2 to limit

        • maxLen: number

          The longest length of the resulting vector

          -
        • Optional dst: Vec2

        Returns Vec2

        The vector, shortened to maxLen if it's too long

        -
      \ No newline at end of file +
    • Optional dst: T

    Returns T

    The vector, shortened to maxLen if it's too long

    +
\ No newline at end of file diff --git a/docs/functions/vec2.zero.html b/docs/functions/vec2.zero.html index f859fce..7584f3c 100644 --- a/docs/functions/vec2.zero.html +++ b/docs/functions/vec2.zero.html @@ -1,4 +1,4 @@ -zero | wgpu-matrix

Function zero

  • Zero's a vector

    -

    Parameters

    • Optional dst: Vec2

      vector to hold result. If not passed in a new one is created.

      -

    Returns Vec2

    The zeroed vector.

    -
\ No newline at end of file +zero | wgpu-matrix

Function zero

  • Zero's a vector

    +

    Type Parameters

    Parameters

    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The zeroed vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec2d.add.html b/docs/functions/vec2d.add.html new file mode 100644 index 0000000..9a100db --- /dev/null +++ b/docs/functions/vec2d.add.html @@ -0,0 +1,6 @@ +add | wgpu-matrix
  • Adds two vectors; assumes a and b have the same dimension.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that is the sum of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/vec2d.addScaled.html b/docs/functions/vec2d.addScaled.html new file mode 100644 index 0000000..aef50dc --- /dev/null +++ b/docs/functions/vec2d.addScaled.html @@ -0,0 +1,7 @@ +addScaled | wgpu-matrix

Function addScaled

  • Adds two vectors, scaling the 2nd; assumes a and b have the same dimension.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • scale: number

      Amount to scale b

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that is the sum of a + b * scale.

    +
\ No newline at end of file diff --git a/docs/functions/vec2d.angle.html b/docs/functions/vec2d.angle.html new file mode 100644 index 0000000..925f670 --- /dev/null +++ b/docs/functions/vec2d.angle.html @@ -0,0 +1,5 @@ +angle | wgpu-matrix

Function angle

  • Returns the angle in radians between two vectors.

    +

    Parameters

    Returns number

    The angle in radians between the 2 vectors.

    +
\ No newline at end of file diff --git a/docs/functions/vec2d.ceil.html b/docs/functions/vec2d.ceil.html new file mode 100644 index 0000000..bedb88a --- /dev/null +++ b/docs/functions/vec2d.ceil.html @@ -0,0 +1,5 @@ +ceil | wgpu-matrix
  • Applies Math.ceil to each element of vector

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that is the ceil of each element of v.

    +
\ No newline at end of file diff --git a/docs/functions/vec2d.clamp.html b/docs/functions/vec2d.clamp.html new file mode 100644 index 0000000..9b9f7f4 --- /dev/null +++ b/docs/functions/vec2d.clamp.html @@ -0,0 +1,7 @@ +clamp | wgpu-matrix

Function clamp

  • Clamp each element of vector between min and max

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      Operand vector.

      +
    • min: number = 0

      Max value, default 1

      +
    • max: number = 1

      Min value, default 0

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that the clamped value of each element of v.

    +
\ No newline at end of file diff --git a/docs/functions/vec2d.clone.html b/docs/functions/vec2d.clone.html new file mode 100644 index 0000000..b8a6ed8 --- /dev/null +++ b/docs/functions/vec2d.clone.html @@ -0,0 +1,6 @@ +clone | wgpu-matrix

Function clone

  • Copies a vector. (same as vec2.clone) +Also see vec2.create and vec2.set

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A copy of v.

    +
\ No newline at end of file diff --git a/docs/functions/vec2d.copy.html b/docs/functions/vec2d.copy.html new file mode 100644 index 0000000..4b58d09 --- /dev/null +++ b/docs/functions/vec2d.copy.html @@ -0,0 +1,6 @@ +copy | wgpu-matrix
  • Copies a vector. (same as vec2.clone) +Also see vec2.create and vec2.set

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A copy of v.

    +
\ No newline at end of file diff --git a/docs/functions/vec2d.create.html b/docs/functions/vec2d.create.html new file mode 100644 index 0000000..6c16dc2 --- /dev/null +++ b/docs/functions/vec2d.create.html @@ -0,0 +1,12 @@ +create | wgpu-matrix

Function create

  • Creates a Vec2; may be called with x, y, z to set initial values.

    +

    Note: Since passing in a raw JavaScript array +is valid in all circumstances, if you want to +force a JavaScript array into a Vec2's specified type +it would be faster to use

    +
    const v = vec2.clone(someJSArray);
    +
    + +

    Parameters

    • x: number = 0

      Initial x value.

      +
    • y: number = 0

      Initial y value.

      +

    Returns Float64Array

    the created vector

    +
\ No newline at end of file diff --git a/docs/functions/vec2d.cross.html b/docs/functions/vec2d.cross.html new file mode 100644 index 0000000..fe24436 --- /dev/null +++ b/docs/functions/vec2d.cross.html @@ -0,0 +1,7 @@ +cross | wgpu-matrix

Function cross

  • Computes the cross product of two vectors; assumes both vectors have +three entries.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The vector of a cross b.

    +
\ No newline at end of file diff --git a/docs/functions/vec2d.dist.html b/docs/functions/vec2d.dist.html new file mode 100644 index 0000000..c430179 --- /dev/null +++ b/docs/functions/vec2d.dist.html @@ -0,0 +1,5 @@ +dist | wgpu-matrix
  • Computes the distance between 2 points

    +

    Parameters

    Returns number

    distance between a and b

    +
\ No newline at end of file diff --git a/docs/functions/vec2d.distSq.html b/docs/functions/vec2d.distSq.html new file mode 100644 index 0000000..a112114 --- /dev/null +++ b/docs/functions/vec2d.distSq.html @@ -0,0 +1,5 @@ +distSq | wgpu-matrix

Function distSq

  • Computes the square of the distance between 2 points

    +

    Parameters

    Returns number

    square of the distance between a and b

    +
\ No newline at end of file diff --git a/docs/functions/vec2d.distance.html b/docs/functions/vec2d.distance.html new file mode 100644 index 0000000..7dd7adb --- /dev/null +++ b/docs/functions/vec2d.distance.html @@ -0,0 +1,5 @@ +distance | wgpu-matrix

Function distance

  • Computes the distance between 2 points

    +

    Parameters

    Returns number

    distance between a and b

    +
\ No newline at end of file diff --git a/docs/functions/vec2d.distanceSq.html b/docs/functions/vec2d.distanceSq.html new file mode 100644 index 0000000..6df81c5 --- /dev/null +++ b/docs/functions/vec2d.distanceSq.html @@ -0,0 +1,5 @@ +distanceSq | wgpu-matrix

Function distanceSq

  • Computes the square of the distance between 2 points

    +

    Parameters

    Returns number

    square of the distance between a and b

    +
\ No newline at end of file diff --git a/docs/functions/vec2d.div.html b/docs/functions/vec2d.div.html new file mode 100644 index 0000000..b816aa2 --- /dev/null +++ b/docs/functions/vec2d.div.html @@ -0,0 +1,7 @@ +div | wgpu-matrix
  • Divides a vector by another vector (component-wise); assumes a and +b have the same length.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The vector of quotients of entries of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/vec2d.divScalar.html b/docs/functions/vec2d.divScalar.html new file mode 100644 index 0000000..912688e --- /dev/null +++ b/docs/functions/vec2d.divScalar.html @@ -0,0 +1,6 @@ +divScalar | wgpu-matrix

Function divScalar

  • Divides a vector by a scalar.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • k: number

      The scalar.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The scaled vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec2d.divide.html b/docs/functions/vec2d.divide.html new file mode 100644 index 0000000..650e992 --- /dev/null +++ b/docs/functions/vec2d.divide.html @@ -0,0 +1,7 @@ +divide | wgpu-matrix

Function divide

  • Divides a vector by another vector (component-wise); assumes a and +b have the same length.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The vector of quotients of entries of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/vec2d.dot.html b/docs/functions/vec2d.dot.html new file mode 100644 index 0000000..b145956 --- /dev/null +++ b/docs/functions/vec2d.dot.html @@ -0,0 +1,6 @@ +dot | wgpu-matrix
  • Computes the dot product of two vectors; assumes both vectors have +three entries.

    +

    Parameters

    Returns number

    dot product

    +
\ No newline at end of file diff --git a/docs/functions/vec2d.equals.html b/docs/functions/vec2d.equals.html new file mode 100644 index 0000000..a48065e --- /dev/null +++ b/docs/functions/vec2d.equals.html @@ -0,0 +1,5 @@ +equals | wgpu-matrix

Function equals

  • Check if 2 vectors are exactly equal

    +

    Parameters

    Returns boolean

    true if vectors are exactly equal

    +
\ No newline at end of file diff --git a/docs/functions/vec2d.equalsApproximately.html b/docs/functions/vec2d.equalsApproximately.html new file mode 100644 index 0000000..3e8170a --- /dev/null +++ b/docs/functions/vec2d.equalsApproximately.html @@ -0,0 +1,5 @@ +equalsApproximately | wgpu-matrix

Function equalsApproximately

  • Check if 2 vectors are approximately equal

    +

    Parameters

    Returns boolean

    true if vectors are approximately equal

    +
\ No newline at end of file diff --git a/docs/functions/vec2d.floor.html b/docs/functions/vec2d.floor.html new file mode 100644 index 0000000..5255c52 --- /dev/null +++ b/docs/functions/vec2d.floor.html @@ -0,0 +1,5 @@ +floor | wgpu-matrix

Function floor

  • Applies Math.floor to each element of vector

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that is the floor of each element of v.

    +
\ No newline at end of file diff --git a/docs/functions/vec2d.fromValues.html b/docs/functions/vec2d.fromValues.html new file mode 100644 index 0000000..6c09879 --- /dev/null +++ b/docs/functions/vec2d.fromValues.html @@ -0,0 +1,12 @@ +fromValues | wgpu-matrix

Function fromValues

  • Creates a Vec2; may be called with x, y, z to set initial values.

    +

    Note: Since passing in a raw JavaScript array +is valid in all circumstances, if you want to +force a JavaScript array into a Vec2's specified type +it would be faster to use

    +
    const v = vec2.clone(someJSArray);
    +
    + +

    Parameters

    • x: number = 0

      Initial x value.

      +
    • y: number = 0

      Initial y value.

      +

    Returns Float64Array

    the created vector

    +
\ No newline at end of file diff --git a/docs/functions/vec2d.inverse.html b/docs/functions/vec2d.inverse.html new file mode 100644 index 0000000..2a0aa79 --- /dev/null +++ b/docs/functions/vec2d.inverse.html @@ -0,0 +1,5 @@ +inverse | wgpu-matrix

Function inverse

  • Inverse a vector.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The inverted vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec2d.invert.html b/docs/functions/vec2d.invert.html new file mode 100644 index 0000000..bd7a511 --- /dev/null +++ b/docs/functions/vec2d.invert.html @@ -0,0 +1,5 @@ +invert | wgpu-matrix

Function invert

  • Inverse a vector.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The inverted vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec2d.len.html b/docs/functions/vec2d.len.html new file mode 100644 index 0000000..42f11e0 --- /dev/null +++ b/docs/functions/vec2d.len.html @@ -0,0 +1,4 @@ +len | wgpu-matrix
  • Computes the length of vector

    +

    Parameters

    Returns number

    length of vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec2d.lenSq.html b/docs/functions/vec2d.lenSq.html new file mode 100644 index 0000000..87afa9a --- /dev/null +++ b/docs/functions/vec2d.lenSq.html @@ -0,0 +1,4 @@ +lenSq | wgpu-matrix

Function lenSq

  • Computes the square of the length of vector

    +

    Parameters

    Returns number

    square of the length of vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec2d.length.html b/docs/functions/vec2d.length.html new file mode 100644 index 0000000..1bf0026 --- /dev/null +++ b/docs/functions/vec2d.length.html @@ -0,0 +1,4 @@ +length | wgpu-matrix

Function length

  • Computes the length of vector

    +

    Parameters

    Returns number

    length of vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec2d.lengthSq.html b/docs/functions/vec2d.lengthSq.html new file mode 100644 index 0000000..f04a9ed --- /dev/null +++ b/docs/functions/vec2d.lengthSq.html @@ -0,0 +1,4 @@ +lengthSq | wgpu-matrix

Function lengthSq

  • Computes the square of the length of vector

    +

    Parameters

    Returns number

    square of the length of vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec2d.lerp.html b/docs/functions/vec2d.lerp.html new file mode 100644 index 0000000..4886bd4 --- /dev/null +++ b/docs/functions/vec2d.lerp.html @@ -0,0 +1,9 @@ +lerp | wgpu-matrix
  • Performs linear interpolation on two vectors. +Given vectors a and b and interpolation coefficient t, returns +a + t * (b - a).

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • t: number

      Interpolation coefficient.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The linear interpolated result.

    +
\ No newline at end of file diff --git a/docs/functions/vec2d.lerpV.html b/docs/functions/vec2d.lerpV.html new file mode 100644 index 0000000..0abe84e --- /dev/null +++ b/docs/functions/vec2d.lerpV.html @@ -0,0 +1,9 @@ +lerpV | wgpu-matrix

Function lerpV

  • Performs linear interpolation on two vectors. +Given vectors a and b and interpolation coefficient vector t, returns +a + t * (b - a).

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • t: BaseArgType

      Interpolation coefficients vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    the linear interpolated result.

    +
\ No newline at end of file diff --git a/docs/functions/vec2d.max.html b/docs/functions/vec2d.max.html new file mode 100644 index 0000000..e4ee31a --- /dev/null +++ b/docs/functions/vec2d.max.html @@ -0,0 +1,8 @@ +max | wgpu-matrix
  • Return max values of two vectors. +Given vectors a and b returns +[max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])].

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The max components vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec2d.midpoint.html b/docs/functions/vec2d.midpoint.html new file mode 100644 index 0000000..8e2c3e2 --- /dev/null +++ b/docs/functions/vec2d.midpoint.html @@ -0,0 +1,5 @@ +midpoint | wgpu-matrix

Function midpoint

  • Return the vector exactly between 2 endpoint vectors

    +

    Type Parameters

    Parameters

    Returns T

    The vector exactly residing between endpoints 1 and 2

    +
\ No newline at end of file diff --git a/docs/functions/vec2d.min.html b/docs/functions/vec2d.min.html new file mode 100644 index 0000000..ecdc871 --- /dev/null +++ b/docs/functions/vec2d.min.html @@ -0,0 +1,8 @@ +min | wgpu-matrix
  • Return min values of two vectors. +Given vectors a and b returns +[min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])].

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The min components vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec2d.mul.html b/docs/functions/vec2d.mul.html new file mode 100644 index 0000000..49e0913 --- /dev/null +++ b/docs/functions/vec2d.mul.html @@ -0,0 +1,7 @@ +mul | wgpu-matrix
  • Multiplies a vector by another vector (component-wise); assumes a and +b have the same length.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The vector of products of entries of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/vec2d.mulScalar.html b/docs/functions/vec2d.mulScalar.html new file mode 100644 index 0000000..2446077 --- /dev/null +++ b/docs/functions/vec2d.mulScalar.html @@ -0,0 +1,6 @@ +mulScalar | wgpu-matrix

Function mulScalar

  • Multiplies a vector by a scalar.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • k: number

      The scalar.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The scaled vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec2d.multiply.html b/docs/functions/vec2d.multiply.html new file mode 100644 index 0000000..120989d --- /dev/null +++ b/docs/functions/vec2d.multiply.html @@ -0,0 +1,7 @@ +multiply | wgpu-matrix

Function multiply

  • Multiplies a vector by another vector (component-wise); assumes a and +b have the same length.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The vector of products of entries of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/vec2d.negate.html b/docs/functions/vec2d.negate.html new file mode 100644 index 0000000..31704a6 --- /dev/null +++ b/docs/functions/vec2d.negate.html @@ -0,0 +1,5 @@ +negate | wgpu-matrix

Function negate

  • Negates a vector.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    -v.

    +
\ No newline at end of file diff --git a/docs/functions/vec2d.normalize.html b/docs/functions/vec2d.normalize.html new file mode 100644 index 0000000..7cd4c04 --- /dev/null +++ b/docs/functions/vec2d.normalize.html @@ -0,0 +1,5 @@ +normalize | wgpu-matrix

Function normalize

  • Divides a vector by its Euclidean length and returns the quotient.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The normalized vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec2d.random.html b/docs/functions/vec2d.random.html new file mode 100644 index 0000000..ff8590f --- /dev/null +++ b/docs/functions/vec2d.random.html @@ -0,0 +1,5 @@ +random | wgpu-matrix

Function random

  • Creates a random unit vector * scale

    +

    Type Parameters

    Parameters

    • scale: number = 1

      Default 1

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The random vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec2d.rotate.html b/docs/functions/vec2d.rotate.html new file mode 100644 index 0000000..7534ae5 --- /dev/null +++ b/docs/functions/vec2d.rotate.html @@ -0,0 +1,6 @@ +rotate | wgpu-matrix

Function rotate

  • Rotate a 2D vector

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      The vec2 point to rotate

      +
    • b: BaseArgType

      The origin of the rotation

      +
    • rad: number

      The angle of rotation in radians

      +
    • Optional dst: T

    Returns T

    the rotated vector

    +
\ No newline at end of file diff --git a/docs/functions/vec2d.round.html b/docs/functions/vec2d.round.html new file mode 100644 index 0000000..a20a773 --- /dev/null +++ b/docs/functions/vec2d.round.html @@ -0,0 +1,5 @@ +round | wgpu-matrix

Function round

  • Applies Math.round to each element of vector

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that is the round of each element of v.

    +
\ No newline at end of file diff --git a/docs/functions/vec2d.scale.html b/docs/functions/vec2d.scale.html new file mode 100644 index 0000000..c2ed9af --- /dev/null +++ b/docs/functions/vec2d.scale.html @@ -0,0 +1,6 @@ +scale | wgpu-matrix

Function scale

  • Multiplies a vector by a scalar.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • k: number

      The scalar.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The scaled vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec2d.set.html b/docs/functions/vec2d.set.html new file mode 100644 index 0000000..7365284 --- /dev/null +++ b/docs/functions/vec2d.set.html @@ -0,0 +1,7 @@ +set | wgpu-matrix
  • Sets the values of a Vec2 +Also see vec2.create and vec2.copy

    +

    Type Parameters

    Parameters

    • x: number

      first value

      +
    • y: number

      second value

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector with its elements set.

    +
\ No newline at end of file diff --git a/docs/functions/vec2d.setLength.html b/docs/functions/vec2d.setLength.html new file mode 100644 index 0000000..0d4940f --- /dev/null +++ b/docs/functions/vec2d.setLength.html @@ -0,0 +1,5 @@ +setLength | wgpu-matrix

Function setLength

  • Treat a 2D vector as a direction and set it's length

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      The vec2 to lengthen

      +
    • len: number

      The length of the resulting vector

      +
    • Optional dst: T

    Returns T

    The lengthened vector

    +
\ No newline at end of file diff --git a/docs/functions/vec2d.sub.html b/docs/functions/vec2d.sub.html new file mode 100644 index 0000000..9f04221 --- /dev/null +++ b/docs/functions/vec2d.sub.html @@ -0,0 +1,6 @@ +sub | wgpu-matrix
  • Subtracts two vectors.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that is the difference of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/vec2d.subtract.html b/docs/functions/vec2d.subtract.html new file mode 100644 index 0000000..6b02e1e --- /dev/null +++ b/docs/functions/vec2d.subtract.html @@ -0,0 +1,6 @@ +subtract | wgpu-matrix

Function subtract

  • Subtracts two vectors.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that is the difference of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/vec2d.transformMat3.html b/docs/functions/vec2d.transformMat3.html new file mode 100644 index 0000000..091b980 --- /dev/null +++ b/docs/functions/vec2d.transformMat3.html @@ -0,0 +1,6 @@ +transformMat3 | wgpu-matrix

Function transformMat3

  • Transforms vec4 by 3x3 matrix

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      the vector

      +
    • m: BaseArgType

      The matrix.

      +
    • Optional dst: T

      optional Vec2 to store result. If not passed a new one is created.

      +

    Returns T

    the transformed vector

    +
\ No newline at end of file diff --git a/docs/functions/vec2d.transformMat4.html b/docs/functions/vec2d.transformMat4.html new file mode 100644 index 0000000..56621ea --- /dev/null +++ b/docs/functions/vec2d.transformMat4.html @@ -0,0 +1,6 @@ +transformMat4 | wgpu-matrix

Function transformMat4

  • transform Vec2 by 4x4 matrix

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      the vector

      +
    • m: BaseArgType

      The matrix.

      +
    • Optional dst: T

      optional Vec2 to store result. If not passed a new one is created.

      +

    Returns T

    the transformed vector

    +
\ No newline at end of file diff --git a/docs/functions/vec2d.truncate.html b/docs/functions/vec2d.truncate.html new file mode 100644 index 0000000..9ebf478 --- /dev/null +++ b/docs/functions/vec2d.truncate.html @@ -0,0 +1,5 @@ +truncate | wgpu-matrix

Function truncate

  • Ensure a vector is not longer than a max length

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      The vec2 to limit

      +
    • maxLen: number

      The longest length of the resulting vector

      +
    • Optional dst: T

    Returns T

    The vector, shortened to maxLen if it's too long

    +
\ No newline at end of file diff --git a/docs/functions/vec2d.zero.html b/docs/functions/vec2d.zero.html new file mode 100644 index 0000000..ebc8e86 --- /dev/null +++ b/docs/functions/vec2d.zero.html @@ -0,0 +1,4 @@ +zero | wgpu-matrix
  • Zero's a vector

    +

    Type Parameters

    Parameters

    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The zeroed vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec2n.add.html b/docs/functions/vec2n.add.html new file mode 100644 index 0000000..25425e7 --- /dev/null +++ b/docs/functions/vec2n.add.html @@ -0,0 +1,6 @@ +add | wgpu-matrix
  • Adds two vectors; assumes a and b have the same dimension.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that is the sum of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/vec2n.addScaled.html b/docs/functions/vec2n.addScaled.html new file mode 100644 index 0000000..e5e0d1c --- /dev/null +++ b/docs/functions/vec2n.addScaled.html @@ -0,0 +1,7 @@ +addScaled | wgpu-matrix

Function addScaled

  • Adds two vectors, scaling the 2nd; assumes a and b have the same dimension.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • scale: number

      Amount to scale b

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that is the sum of a + b * scale.

    +
\ No newline at end of file diff --git a/docs/functions/vec2n.angle.html b/docs/functions/vec2n.angle.html new file mode 100644 index 0000000..c2e902e --- /dev/null +++ b/docs/functions/vec2n.angle.html @@ -0,0 +1,5 @@ +angle | wgpu-matrix

Function angle

  • Returns the angle in radians between two vectors.

    +

    Parameters

    Returns number

    The angle in radians between the 2 vectors.

    +
\ No newline at end of file diff --git a/docs/functions/vec2n.ceil.html b/docs/functions/vec2n.ceil.html new file mode 100644 index 0000000..e2bf6e3 --- /dev/null +++ b/docs/functions/vec2n.ceil.html @@ -0,0 +1,5 @@ +ceil | wgpu-matrix
  • Applies Math.ceil to each element of vector

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that is the ceil of each element of v.

    +
\ No newline at end of file diff --git a/docs/functions/vec2n.clamp.html b/docs/functions/vec2n.clamp.html new file mode 100644 index 0000000..f17e49d --- /dev/null +++ b/docs/functions/vec2n.clamp.html @@ -0,0 +1,7 @@ +clamp | wgpu-matrix

Function clamp

  • Clamp each element of vector between min and max

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      Operand vector.

      +
    • min: number = 0

      Max value, default 1

      +
    • max: number = 1

      Min value, default 0

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that the clamped value of each element of v.

    +
\ No newline at end of file diff --git a/docs/functions/vec2n.clone.html b/docs/functions/vec2n.clone.html new file mode 100644 index 0000000..30feabb --- /dev/null +++ b/docs/functions/vec2n.clone.html @@ -0,0 +1,6 @@ +clone | wgpu-matrix

Function clone

  • Copies a vector. (same as vec2.clone) +Also see vec2.create and vec2.set

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A copy of v.

    +
\ No newline at end of file diff --git a/docs/functions/vec2n.copy.html b/docs/functions/vec2n.copy.html new file mode 100644 index 0000000..eee7daa --- /dev/null +++ b/docs/functions/vec2n.copy.html @@ -0,0 +1,6 @@ +copy | wgpu-matrix
  • Copies a vector. (same as vec2.clone) +Also see vec2.create and vec2.set

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A copy of v.

    +
\ No newline at end of file diff --git a/docs/functions/vec2n.create.html b/docs/functions/vec2n.create.html new file mode 100644 index 0000000..04507fb --- /dev/null +++ b/docs/functions/vec2n.create.html @@ -0,0 +1,12 @@ +create | wgpu-matrix

Function create

  • Creates a Vec2; may be called with x, y, z to set initial values.

    +

    Note: Since passing in a raw JavaScript array +is valid in all circumstances, if you want to +force a JavaScript array into a Vec2's specified type +it would be faster to use

    +
    const v = vec2.clone(someJSArray);
    +
    + +

    Parameters

    • x: number = 0

      Initial x value.

      +
    • y: number = 0

      Initial y value.

      +

    Returns number[]

    the created vector

    +
\ No newline at end of file diff --git a/docs/functions/vec2n.cross.html b/docs/functions/vec2n.cross.html new file mode 100644 index 0000000..a63bc96 --- /dev/null +++ b/docs/functions/vec2n.cross.html @@ -0,0 +1,7 @@ +cross | wgpu-matrix

Function cross

  • Computes the cross product of two vectors; assumes both vectors have +three entries.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The vector of a cross b.

    +
\ No newline at end of file diff --git a/docs/functions/vec2n.dist.html b/docs/functions/vec2n.dist.html new file mode 100644 index 0000000..4788c2d --- /dev/null +++ b/docs/functions/vec2n.dist.html @@ -0,0 +1,5 @@ +dist | wgpu-matrix
  • Computes the distance between 2 points

    +

    Parameters

    Returns number

    distance between a and b

    +
\ No newline at end of file diff --git a/docs/functions/vec2n.distSq.html b/docs/functions/vec2n.distSq.html new file mode 100644 index 0000000..f3156d1 --- /dev/null +++ b/docs/functions/vec2n.distSq.html @@ -0,0 +1,5 @@ +distSq | wgpu-matrix

Function distSq

  • Computes the square of the distance between 2 points

    +

    Parameters

    Returns number

    square of the distance between a and b

    +
\ No newline at end of file diff --git a/docs/functions/vec2n.distance.html b/docs/functions/vec2n.distance.html new file mode 100644 index 0000000..756336d --- /dev/null +++ b/docs/functions/vec2n.distance.html @@ -0,0 +1,5 @@ +distance | wgpu-matrix

Function distance

  • Computes the distance between 2 points

    +

    Parameters

    Returns number

    distance between a and b

    +
\ No newline at end of file diff --git a/docs/functions/vec2n.distanceSq.html b/docs/functions/vec2n.distanceSq.html new file mode 100644 index 0000000..e4e79d3 --- /dev/null +++ b/docs/functions/vec2n.distanceSq.html @@ -0,0 +1,5 @@ +distanceSq | wgpu-matrix

Function distanceSq

  • Computes the square of the distance between 2 points

    +

    Parameters

    Returns number

    square of the distance between a and b

    +
\ No newline at end of file diff --git a/docs/functions/vec2n.div.html b/docs/functions/vec2n.div.html new file mode 100644 index 0000000..5d8d09d --- /dev/null +++ b/docs/functions/vec2n.div.html @@ -0,0 +1,7 @@ +div | wgpu-matrix
  • Divides a vector by another vector (component-wise); assumes a and +b have the same length.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The vector of quotients of entries of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/vec2n.divScalar.html b/docs/functions/vec2n.divScalar.html new file mode 100644 index 0000000..a72d36a --- /dev/null +++ b/docs/functions/vec2n.divScalar.html @@ -0,0 +1,6 @@ +divScalar | wgpu-matrix

Function divScalar

  • Divides a vector by a scalar.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • k: number

      The scalar.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The scaled vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec2n.divide.html b/docs/functions/vec2n.divide.html new file mode 100644 index 0000000..4b0b14e --- /dev/null +++ b/docs/functions/vec2n.divide.html @@ -0,0 +1,7 @@ +divide | wgpu-matrix

Function divide

  • Divides a vector by another vector (component-wise); assumes a and +b have the same length.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The vector of quotients of entries of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/vec2n.dot.html b/docs/functions/vec2n.dot.html new file mode 100644 index 0000000..1374cc5 --- /dev/null +++ b/docs/functions/vec2n.dot.html @@ -0,0 +1,6 @@ +dot | wgpu-matrix
  • Computes the dot product of two vectors; assumes both vectors have +three entries.

    +

    Parameters

    Returns number

    dot product

    +
\ No newline at end of file diff --git a/docs/functions/vec2n.equals.html b/docs/functions/vec2n.equals.html new file mode 100644 index 0000000..945003d --- /dev/null +++ b/docs/functions/vec2n.equals.html @@ -0,0 +1,5 @@ +equals | wgpu-matrix

Function equals

  • Check if 2 vectors are exactly equal

    +

    Parameters

    Returns boolean

    true if vectors are exactly equal

    +
\ No newline at end of file diff --git a/docs/functions/vec2n.equalsApproximately.html b/docs/functions/vec2n.equalsApproximately.html new file mode 100644 index 0000000..17218f6 --- /dev/null +++ b/docs/functions/vec2n.equalsApproximately.html @@ -0,0 +1,5 @@ +equalsApproximately | wgpu-matrix

Function equalsApproximately

  • Check if 2 vectors are approximately equal

    +

    Parameters

    Returns boolean

    true if vectors are approximately equal

    +
\ No newline at end of file diff --git a/docs/functions/vec2n.floor.html b/docs/functions/vec2n.floor.html new file mode 100644 index 0000000..eebeac5 --- /dev/null +++ b/docs/functions/vec2n.floor.html @@ -0,0 +1,5 @@ +floor | wgpu-matrix

Function floor

  • Applies Math.floor to each element of vector

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that is the floor of each element of v.

    +
\ No newline at end of file diff --git a/docs/functions/vec2n.fromValues.html b/docs/functions/vec2n.fromValues.html new file mode 100644 index 0000000..4284d11 --- /dev/null +++ b/docs/functions/vec2n.fromValues.html @@ -0,0 +1,12 @@ +fromValues | wgpu-matrix

Function fromValues

  • Creates a Vec2; may be called with x, y, z to set initial values.

    +

    Note: Since passing in a raw JavaScript array +is valid in all circumstances, if you want to +force a JavaScript array into a Vec2's specified type +it would be faster to use

    +
    const v = vec2.clone(someJSArray);
    +
    + +

    Parameters

    • x: number = 0

      Initial x value.

      +
    • y: number = 0

      Initial y value.

      +

    Returns number[]

    the created vector

    +
\ No newline at end of file diff --git a/docs/functions/vec2n.inverse.html b/docs/functions/vec2n.inverse.html new file mode 100644 index 0000000..8c294ba --- /dev/null +++ b/docs/functions/vec2n.inverse.html @@ -0,0 +1,5 @@ +inverse | wgpu-matrix

Function inverse

  • Inverse a vector.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The inverted vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec2n.invert.html b/docs/functions/vec2n.invert.html new file mode 100644 index 0000000..8c13edb --- /dev/null +++ b/docs/functions/vec2n.invert.html @@ -0,0 +1,5 @@ +invert | wgpu-matrix

Function invert

  • Inverse a vector.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The inverted vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec2n.len.html b/docs/functions/vec2n.len.html new file mode 100644 index 0000000..16a4fe7 --- /dev/null +++ b/docs/functions/vec2n.len.html @@ -0,0 +1,4 @@ +len | wgpu-matrix
  • Computes the length of vector

    +

    Parameters

    Returns number

    length of vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec2n.lenSq.html b/docs/functions/vec2n.lenSq.html new file mode 100644 index 0000000..c751bb7 --- /dev/null +++ b/docs/functions/vec2n.lenSq.html @@ -0,0 +1,4 @@ +lenSq | wgpu-matrix

Function lenSq

  • Computes the square of the length of vector

    +

    Parameters

    Returns number

    square of the length of vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec2n.length.html b/docs/functions/vec2n.length.html new file mode 100644 index 0000000..e009786 --- /dev/null +++ b/docs/functions/vec2n.length.html @@ -0,0 +1,4 @@ +length | wgpu-matrix

Function length

  • Computes the length of vector

    +

    Parameters

    Returns number

    length of vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec2n.lengthSq.html b/docs/functions/vec2n.lengthSq.html new file mode 100644 index 0000000..6bcb091 --- /dev/null +++ b/docs/functions/vec2n.lengthSq.html @@ -0,0 +1,4 @@ +lengthSq | wgpu-matrix

Function lengthSq

  • Computes the square of the length of vector

    +

    Parameters

    Returns number

    square of the length of vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec2n.lerp.html b/docs/functions/vec2n.lerp.html new file mode 100644 index 0000000..37d0136 --- /dev/null +++ b/docs/functions/vec2n.lerp.html @@ -0,0 +1,9 @@ +lerp | wgpu-matrix
  • Performs linear interpolation on two vectors. +Given vectors a and b and interpolation coefficient t, returns +a + t * (b - a).

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • t: number

      Interpolation coefficient.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The linear interpolated result.

    +
\ No newline at end of file diff --git a/docs/functions/vec2n.lerpV.html b/docs/functions/vec2n.lerpV.html new file mode 100644 index 0000000..f513ff3 --- /dev/null +++ b/docs/functions/vec2n.lerpV.html @@ -0,0 +1,9 @@ +lerpV | wgpu-matrix

Function lerpV

  • Performs linear interpolation on two vectors. +Given vectors a and b and interpolation coefficient vector t, returns +a + t * (b - a).

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • t: BaseArgType

      Interpolation coefficients vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    the linear interpolated result.

    +
\ No newline at end of file diff --git a/docs/functions/vec2n.max.html b/docs/functions/vec2n.max.html new file mode 100644 index 0000000..9c6c3a0 --- /dev/null +++ b/docs/functions/vec2n.max.html @@ -0,0 +1,8 @@ +max | wgpu-matrix
  • Return max values of two vectors. +Given vectors a and b returns +[max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])].

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The max components vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec2n.midpoint.html b/docs/functions/vec2n.midpoint.html new file mode 100644 index 0000000..c961504 --- /dev/null +++ b/docs/functions/vec2n.midpoint.html @@ -0,0 +1,5 @@ +midpoint | wgpu-matrix

Function midpoint

  • Return the vector exactly between 2 endpoint vectors

    +

    Type Parameters

    Parameters

    Returns T

    The vector exactly residing between endpoints 1 and 2

    +
\ No newline at end of file diff --git a/docs/functions/vec2n.min.html b/docs/functions/vec2n.min.html new file mode 100644 index 0000000..4bcf9ca --- /dev/null +++ b/docs/functions/vec2n.min.html @@ -0,0 +1,8 @@ +min | wgpu-matrix
  • Return min values of two vectors. +Given vectors a and b returns +[min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])].

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The min components vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec2n.mul.html b/docs/functions/vec2n.mul.html new file mode 100644 index 0000000..2f521a0 --- /dev/null +++ b/docs/functions/vec2n.mul.html @@ -0,0 +1,7 @@ +mul | wgpu-matrix
  • Multiplies a vector by another vector (component-wise); assumes a and +b have the same length.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The vector of products of entries of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/vec2n.mulScalar.html b/docs/functions/vec2n.mulScalar.html new file mode 100644 index 0000000..c1d4ae0 --- /dev/null +++ b/docs/functions/vec2n.mulScalar.html @@ -0,0 +1,6 @@ +mulScalar | wgpu-matrix

Function mulScalar

  • Multiplies a vector by a scalar.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • k: number

      The scalar.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The scaled vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec2n.multiply.html b/docs/functions/vec2n.multiply.html new file mode 100644 index 0000000..8ba1b6c --- /dev/null +++ b/docs/functions/vec2n.multiply.html @@ -0,0 +1,7 @@ +multiply | wgpu-matrix

Function multiply

  • Multiplies a vector by another vector (component-wise); assumes a and +b have the same length.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The vector of products of entries of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/vec2n.negate.html b/docs/functions/vec2n.negate.html new file mode 100644 index 0000000..58a1f3d --- /dev/null +++ b/docs/functions/vec2n.negate.html @@ -0,0 +1,5 @@ +negate | wgpu-matrix

Function negate

  • Negates a vector.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    -v.

    +
\ No newline at end of file diff --git a/docs/functions/vec2n.normalize.html b/docs/functions/vec2n.normalize.html new file mode 100644 index 0000000..73b6c1b --- /dev/null +++ b/docs/functions/vec2n.normalize.html @@ -0,0 +1,5 @@ +normalize | wgpu-matrix

Function normalize

  • Divides a vector by its Euclidean length and returns the quotient.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The normalized vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec2n.random.html b/docs/functions/vec2n.random.html new file mode 100644 index 0000000..4227e28 --- /dev/null +++ b/docs/functions/vec2n.random.html @@ -0,0 +1,5 @@ +random | wgpu-matrix

Function random

  • Creates a random unit vector * scale

    +

    Type Parameters

    Parameters

    • scale: number = 1

      Default 1

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The random vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec2n.rotate.html b/docs/functions/vec2n.rotate.html new file mode 100644 index 0000000..32a8ec0 --- /dev/null +++ b/docs/functions/vec2n.rotate.html @@ -0,0 +1,6 @@ +rotate | wgpu-matrix

Function rotate

  • Rotate a 2D vector

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      The vec2 point to rotate

      +
    • b: BaseArgType

      The origin of the rotation

      +
    • rad: number

      The angle of rotation in radians

      +
    • Optional dst: T

    Returns T

    the rotated vector

    +
\ No newline at end of file diff --git a/docs/functions/vec2n.round.html b/docs/functions/vec2n.round.html new file mode 100644 index 0000000..36a27c3 --- /dev/null +++ b/docs/functions/vec2n.round.html @@ -0,0 +1,5 @@ +round | wgpu-matrix

Function round

  • Applies Math.round to each element of vector

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that is the round of each element of v.

    +
\ No newline at end of file diff --git a/docs/functions/vec2n.scale.html b/docs/functions/vec2n.scale.html new file mode 100644 index 0000000..1e72552 --- /dev/null +++ b/docs/functions/vec2n.scale.html @@ -0,0 +1,6 @@ +scale | wgpu-matrix

Function scale

  • Multiplies a vector by a scalar.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • k: number

      The scalar.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The scaled vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec2n.set.html b/docs/functions/vec2n.set.html new file mode 100644 index 0000000..cef2f53 --- /dev/null +++ b/docs/functions/vec2n.set.html @@ -0,0 +1,7 @@ +set | wgpu-matrix
  • Sets the values of a Vec2 +Also see vec2.create and vec2.copy

    +

    Type Parameters

    Parameters

    • x: number

      first value

      +
    • y: number

      second value

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector with its elements set.

    +
\ No newline at end of file diff --git a/docs/functions/vec2n.setLength.html b/docs/functions/vec2n.setLength.html new file mode 100644 index 0000000..946629a --- /dev/null +++ b/docs/functions/vec2n.setLength.html @@ -0,0 +1,5 @@ +setLength | wgpu-matrix

Function setLength

  • Treat a 2D vector as a direction and set it's length

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      The vec2 to lengthen

      +
    • len: number

      The length of the resulting vector

      +
    • Optional dst: T

    Returns T

    The lengthened vector

    +
\ No newline at end of file diff --git a/docs/functions/vec2n.sub.html b/docs/functions/vec2n.sub.html new file mode 100644 index 0000000..446cab3 --- /dev/null +++ b/docs/functions/vec2n.sub.html @@ -0,0 +1,6 @@ +sub | wgpu-matrix
  • Subtracts two vectors.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that is the difference of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/vec2n.subtract.html b/docs/functions/vec2n.subtract.html new file mode 100644 index 0000000..21069ec --- /dev/null +++ b/docs/functions/vec2n.subtract.html @@ -0,0 +1,6 @@ +subtract | wgpu-matrix

Function subtract

  • Subtracts two vectors.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that is the difference of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/vec2n.transformMat3.html b/docs/functions/vec2n.transformMat3.html new file mode 100644 index 0000000..219e819 --- /dev/null +++ b/docs/functions/vec2n.transformMat3.html @@ -0,0 +1,6 @@ +transformMat3 | wgpu-matrix

Function transformMat3

  • Transforms vec4 by 3x3 matrix

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      the vector

      +
    • m: BaseArgType

      The matrix.

      +
    • Optional dst: T

      optional Vec2 to store result. If not passed a new one is created.

      +

    Returns T

    the transformed vector

    +
\ No newline at end of file diff --git a/docs/functions/vec2n.transformMat4.html b/docs/functions/vec2n.transformMat4.html new file mode 100644 index 0000000..46746b0 --- /dev/null +++ b/docs/functions/vec2n.transformMat4.html @@ -0,0 +1,6 @@ +transformMat4 | wgpu-matrix

Function transformMat4

  • transform Vec2 by 4x4 matrix

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      the vector

      +
    • m: BaseArgType

      The matrix.

      +
    • Optional dst: T

      optional Vec2 to store result. If not passed a new one is created.

      +

    Returns T

    the transformed vector

    +
\ No newline at end of file diff --git a/docs/functions/vec2n.truncate.html b/docs/functions/vec2n.truncate.html new file mode 100644 index 0000000..ae3f4a4 --- /dev/null +++ b/docs/functions/vec2n.truncate.html @@ -0,0 +1,5 @@ +truncate | wgpu-matrix

Function truncate

  • Ensure a vector is not longer than a max length

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      The vec2 to limit

      +
    • maxLen: number

      The longest length of the resulting vector

      +
    • Optional dst: T

    Returns T

    The vector, shortened to maxLen if it's too long

    +
\ No newline at end of file diff --git a/docs/functions/vec2n.zero.html b/docs/functions/vec2n.zero.html new file mode 100644 index 0000000..cbea1a2 --- /dev/null +++ b/docs/functions/vec2n.zero.html @@ -0,0 +1,4 @@ +zero | wgpu-matrix
  • Zero's a vector

    +

    Type Parameters

    Parameters

    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The zeroed vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec3.add.html b/docs/functions/vec3.add.html index 75aa74e..df759a2 100644 --- a/docs/functions/vec3.add.html +++ b/docs/functions/vec3.add.html @@ -1,6 +1,6 @@ -add | wgpu-matrix

Function add

  • Adds two vectors; assumes a and b have the same dimension.

    -

    Parameters

    • a: Vec3

      Operand vector.

      -
    • b: Vec3

      Operand vector.

      -
    • Optional dst: Vec3

      vector to hold result. If not passed in a new one is created.

      -

    Returns Vec3

    A vector that is the sum of a and b.

    -
\ No newline at end of file +add | wgpu-matrix

Function add

  • Adds two vectors; assumes a and b have the same dimension.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that is the sum of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/vec3.addScaled.html b/docs/functions/vec3.addScaled.html index e894e58..8ca8ff4 100644 --- a/docs/functions/vec3.addScaled.html +++ b/docs/functions/vec3.addScaled.html @@ -1,7 +1,7 @@ -addScaled | wgpu-matrix

Function addScaled

  • Adds two vectors, scaling the 2nd; assumes a and b have the same dimension.

    -

    Parameters

    • a: Vec3

      Operand vector.

      -
    • b: Vec3

      Operand vector.

      +addScaled | wgpu-matrix

      Function addScaled

      • Adds two vectors, scaling the 2nd; assumes a and b have the same dimension.

        +

        Type Parameters

        Parameters

        • a: BaseArgType

          Operand vector.

          +
        • b: BaseArgType

          Operand vector.

        • scale: number

          Amount to scale b

          -
        • Optional dst: Vec3

          vector to hold result. If not passed in a new one is created.

          -

        Returns Vec3

        A vector that is the sum of a + b * scale.

        -
      \ No newline at end of file +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that is the sum of a + b * scale.

    +
\ No newline at end of file diff --git a/docs/functions/vec3.angle.html b/docs/functions/vec3.angle.html index 9d5bac4..5cfc3ce 100644 --- a/docs/functions/vec3.angle.html +++ b/docs/functions/vec3.angle.html @@ -1,5 +1,5 @@ -angle | wgpu-matrix

Function angle

  • Returns the angle in radians between two vectors.

    -

    Parameters

    • a: Vec3

      Operand vector.

      -
    • b: Vec3

      Operand vector.

      +angle | wgpu-matrix

      Function angle

      • Returns the angle in radians between two vectors.

        +

        Parameters

        Returns number

        The angle in radians between the 2 vectors.

        -
      \ No newline at end of file +
\ No newline at end of file diff --git a/docs/functions/vec3.ceil.html b/docs/functions/vec3.ceil.html index 486b133..eb32690 100644 --- a/docs/functions/vec3.ceil.html +++ b/docs/functions/vec3.ceil.html @@ -1,5 +1,5 @@ -ceil | wgpu-matrix

Function ceil

  • Applies Math.ceil to each element of vector

    -

    Parameters

    • v: Vec3

      Operand vector.

      -
    • Optional dst: Vec3

      vector to hold result. If not passed in a new one is created.

      -

    Returns Vec3

    A vector that is the ceil of each element of v.

    -
\ No newline at end of file +ceil | wgpu-matrix

Function ceil

  • Applies Math.ceil to each element of vector

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that is the ceil of each element of v.

    +
\ No newline at end of file diff --git a/docs/functions/vec3.clamp.html b/docs/functions/vec3.clamp.html index b483915..0439f5a 100644 --- a/docs/functions/vec3.clamp.html +++ b/docs/functions/vec3.clamp.html @@ -1,7 +1,7 @@ -clamp | wgpu-matrix

Function clamp

  • Clamp each element of vector between min and max

    -

    Parameters

    • v: Vec3

      Operand vector.

      +clamp | wgpu-matrix

      Function clamp

      • Clamp each element of vector between min and max

        +

        Type Parameters

        Parameters

        • v: BaseArgType

          Operand vector.

        • min: number = 0

          Max value, default 1

        • max: number = 1

          Min value, default 0

          -
        • Optional dst: Vec3

          vector to hold result. If not passed in a new one is created.

          -

        Returns Vec3

        A vector that the clamped value of each element of v.

        -
      \ No newline at end of file +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that the clamped value of each element of v.

    +
\ No newline at end of file diff --git a/docs/functions/vec3.clone.html b/docs/functions/vec3.clone.html index b9049ac..2b8c94e 100644 --- a/docs/functions/vec3.clone.html +++ b/docs/functions/vec3.clone.html @@ -1,6 +1,6 @@ -clone | wgpu-matrix

Function clone

  • Clones a vector. (same as vec3.copy) -Also see vec3.create and vec3.set

    -

    Parameters

    • v: Vec3

      The vector.

      -
    • Optional dst: Vec3

      vector to hold result. If not passed in a new one is created.

      -

    Returns Vec3

    A copy of v.

    -
\ No newline at end of file +clone | wgpu-matrix

Function clone

  • Copies a vector. (same as vec3.clone) +Also see vec3.create and vec3.set

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A copy of v.

    +
\ No newline at end of file diff --git a/docs/functions/vec3.copy.html b/docs/functions/vec3.copy.html index f2b4ba3..4e00d26 100644 --- a/docs/functions/vec3.copy.html +++ b/docs/functions/vec3.copy.html @@ -1,6 +1,6 @@ -copy | wgpu-matrix

Function copy

  • Copies a vector. (same as vec3.clone) -Also see vec3.create and vec3.set

    -

    Parameters

    • v: Vec3

      The vector.

      -
    • Optional dst: Vec3

      vector to hold result. If not passed in a new one is created.

      -

    Returns Vec3

    A copy of v.

    -
\ No newline at end of file +copy | wgpu-matrix

Function copy

  • Copies a vector. (same as vec3.clone) +Also see vec3.create and vec3.set

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A copy of v.

    +
\ No newline at end of file diff --git a/docs/functions/vec3.create.html b/docs/functions/vec3.create.html index dfa1ad6..7b363e8 100644 --- a/docs/functions/vec3.create.html +++ b/docs/functions/vec3.create.html @@ -1,6 +1,6 @@ -create | wgpu-matrix

Function create

  • Creates a vec3; may be called with x, y, z to set initial values.

    +create | wgpu-matrix

    Function create

    • Creates a vec3; may be called with x, y, z to set initial values.

      Parameters

      • Optional x: number

        Initial x value.

      • Optional y: number

        Initial y value.

      • Optional z: number

        Initial z value.

        -

      Returns Vec3

      the created vector

      -
    \ No newline at end of file +

Returns Float32Array

the created vector

+
\ No newline at end of file diff --git a/docs/functions/vec3.cross.html b/docs/functions/vec3.cross.html index 8723f2a..8f80052 100644 --- a/docs/functions/vec3.cross.html +++ b/docs/functions/vec3.cross.html @@ -1,7 +1,7 @@ -cross | wgpu-matrix

Function cross

  • Computes the cross product of two vectors; assumes both vectors have +cross | wgpu-matrix

    Function cross

    • Computes the cross product of two vectors; assumes both vectors have three entries.

      -

      Parameters

      • a: Vec3

        Operand vector.

        -
      • b: Vec3

        Operand vector.

        -
      • Optional dst: Vec3

        vector to hold result. If not passed in a new one is created.

        -

      Returns Vec3

      The vector of a cross b.

      -
    \ No newline at end of file +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The vector of a cross b.

    +
\ No newline at end of file diff --git a/docs/functions/vec3.dist.html b/docs/functions/vec3.dist.html index 373c861..ae6dbc9 100644 --- a/docs/functions/vec3.dist.html +++ b/docs/functions/vec3.dist.html @@ -1,5 +1,5 @@ -dist | wgpu-matrix

Function dist

  • Computes the distance between 2 points (same as distance)

    -

    Parameters

    • a: Vec3

      vector.

      -
    • b: Vec3

      vector.

      +dist | wgpu-matrix

      Function dist

      • Computes the distance between 2 points

        +

        Parameters

        Returns number

        distance between a and b

        -
      \ No newline at end of file +
\ No newline at end of file diff --git a/docs/functions/vec3.distSq.html b/docs/functions/vec3.distSq.html index ce49eaf..53269d1 100644 --- a/docs/functions/vec3.distSq.html +++ b/docs/functions/vec3.distSq.html @@ -1,5 +1,5 @@ -distSq | wgpu-matrix

Function distSq

  • Computes the square of the distance between 2 points (same as distanceSq)

    -

    Parameters

    • a: Vec3

      vector.

      -
    • b: Vec3

      vector.

      +distSq | wgpu-matrix

      Function distSq

      • Computes the square of the distance between 2 points

        +

        Parameters

        Returns number

        square of the distance between a and b

        -
      \ No newline at end of file +
\ No newline at end of file diff --git a/docs/functions/vec3.distance.html b/docs/functions/vec3.distance.html index 9a46942..f4b379e 100644 --- a/docs/functions/vec3.distance.html +++ b/docs/functions/vec3.distance.html @@ -1,5 +1,5 @@ -distance | wgpu-matrix

Function distance

  • Computes the distance between 2 points

    -

    Parameters

    • a: Vec3

      vector.

      -
    • b: Vec3

      vector.

      +distance | wgpu-matrix

      Function distance

      • Computes the distance between 2 points

        +

        Parameters

        Returns number

        distance between a and b

        -
      \ No newline at end of file +
\ No newline at end of file diff --git a/docs/functions/vec3.distanceSq.html b/docs/functions/vec3.distanceSq.html index 10170cc..2827320 100644 --- a/docs/functions/vec3.distanceSq.html +++ b/docs/functions/vec3.distanceSq.html @@ -1,5 +1,5 @@ -distanceSq | wgpu-matrix

Function distanceSq

  • Computes the square of the distance between 2 points

    -

    Parameters

    • a: Vec3

      vector.

      -
    • b: Vec3

      vector.

      +distanceSq | wgpu-matrix

      Function distanceSq

      • Computes the square of the distance between 2 points

        +

        Parameters

        Returns number

        square of the distance between a and b

        -
      \ No newline at end of file +
\ No newline at end of file diff --git a/docs/functions/vec3.div.html b/docs/functions/vec3.div.html index 497cab5..4ea0930 100644 --- a/docs/functions/vec3.div.html +++ b/docs/functions/vec3.div.html @@ -1,7 +1,7 @@ -div | wgpu-matrix

Function div

  • Divides a vector by another vector (component-wise); assumes a and -b have the same length. (same as divide)

    -

    Parameters

    • a: Vec3

      Operand vector.

      -
    • b: Vec3

      Operand vector.

      -
    • Optional dst: Vec3

      vector to hold result. If not passed in a new one is created.

      -

    Returns Vec3

    The vector of quotients of entries of a and b.

    -
\ No newline at end of file +div | wgpu-matrix

Function div

  • Divides a vector by another vector (component-wise); assumes a and +b have the same length.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The vector of quotients of entries of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/vec3.divScalar.html b/docs/functions/vec3.divScalar.html index 756a231..6670191 100644 --- a/docs/functions/vec3.divScalar.html +++ b/docs/functions/vec3.divScalar.html @@ -1,6 +1,6 @@ -divScalar | wgpu-matrix

Function divScalar

  • Divides a vector by a scalar.

    -

    Parameters

    • v: Vec3

      The vector.

      +divScalar | wgpu-matrix

      Function divScalar

      • Divides a vector by a scalar.

        +

        Type Parameters

        Parameters

        • v: BaseArgType

          The vector.

        • k: number

          The scalar.

          -
        • Optional dst: Vec3

          vector to hold result. If not passed in a new one is created.

          -

        Returns Vec3

        The scaled vector.

        -
      \ No newline at end of file +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The scaled vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec3.divide.html b/docs/functions/vec3.divide.html index 7ac8ebb..e49e19a 100644 --- a/docs/functions/vec3.divide.html +++ b/docs/functions/vec3.divide.html @@ -1,7 +1,7 @@ -divide | wgpu-matrix

Function divide

  • Divides a vector by another vector (component-wise); assumes a and +divide | wgpu-matrix

    Function divide

    • Divides a vector by another vector (component-wise); assumes a and b have the same length.

      -

      Parameters

      • a: Vec3

        Operand vector.

        -
      • b: Vec3

        Operand vector.

        -
      • Optional dst: Vec3

        vector to hold result. If not passed in a new one is created.

        -

      Returns Vec3

      The vector of quotients of entries of a and b.

      -
    \ No newline at end of file +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The vector of quotients of entries of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/vec3.dot.html b/docs/functions/vec3.dot.html index 01cf2b7..3a660f2 100644 --- a/docs/functions/vec3.dot.html +++ b/docs/functions/vec3.dot.html @@ -1,6 +1,6 @@ -dot | wgpu-matrix

Function dot

  • Computes the dot product of two vectors; assumes both vectors have +dot | wgpu-matrix

    Function dot

    • Computes the dot product of two vectors; assumes both vectors have three entries.

      -

      Parameters

    \ No newline at end of file +
\ No newline at end of file diff --git a/docs/functions/vec3.equals.html b/docs/functions/vec3.equals.html index 1706805..9c50488 100644 --- a/docs/functions/vec3.equals.html +++ b/docs/functions/vec3.equals.html @@ -1,5 +1,5 @@ -equals | wgpu-matrix

Function equals

  • Check if 2 vectors are exactly equal

    -

    Parameters

    • a: Vec3

      Operand vector.

      -
    • b: Vec3

      Operand vector.

      +equals | wgpu-matrix

      Function equals

      • Check if 2 vectors are exactly equal

        +

        Parameters

        Returns boolean

        true if vectors are exactly equal

        -
      \ No newline at end of file +
\ No newline at end of file diff --git a/docs/functions/vec3.equalsApproximately.html b/docs/functions/vec3.equalsApproximately.html index 5da71f9..67cd9c3 100644 --- a/docs/functions/vec3.equalsApproximately.html +++ b/docs/functions/vec3.equalsApproximately.html @@ -1,5 +1,5 @@ -equalsApproximately | wgpu-matrix

Function equalsApproximately

  • Check if 2 vectors are approximately equal

    -

    Parameters

    • a: Vec3

      Operand vector.

      -
    • b: Vec3

      Operand vector.

      +equalsApproximately | wgpu-matrix

      Function equalsApproximately

      • Check if 2 vectors are approximately equal

        +

        Parameters

        Returns boolean

        true if vectors are approximately equal

        -
      \ No newline at end of file +
\ No newline at end of file diff --git a/docs/functions/vec3.floor.html b/docs/functions/vec3.floor.html index d05e9eb..900b130 100644 --- a/docs/functions/vec3.floor.html +++ b/docs/functions/vec3.floor.html @@ -1,5 +1,5 @@ -floor | wgpu-matrix

Function floor

  • Applies Math.floor to each element of vector

    -

    Parameters

    • v: Vec3

      Operand vector.

      -
    • Optional dst: Vec3

      vector to hold result. If not passed in a new one is created.

      -

    Returns Vec3

    A vector that is the floor of each element of v.

    -
\ No newline at end of file +floor | wgpu-matrix

Function floor

  • Applies Math.floor to each element of vector

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that is the floor of each element of v.

    +
\ No newline at end of file diff --git a/docs/functions/vec3.fromValues.html b/docs/functions/vec3.fromValues.html index d120c04..82906ee 100644 --- a/docs/functions/vec3.fromValues.html +++ b/docs/functions/vec3.fromValues.html @@ -1,6 +1,6 @@ -fromValues | wgpu-matrix

Function fromValues

  • Creates a vec3; may be called with x, y, z to set initial values. (same as create)

    +fromValues | wgpu-matrix

    Function fromValues

    • Creates a vec3; may be called with x, y, z to set initial values.

      Parameters

      • Optional x: number

        Initial x value.

      • Optional y: number

        Initial y value.

      • Optional z: number

        Initial z value.

        -

      Returns Vec3

      the created vector

      -
    \ No newline at end of file +

Returns Float32Array

the created vector

+
\ No newline at end of file diff --git a/docs/functions/vec3.getAxis.html b/docs/functions/vec3.getAxis.html index e3ce66c..4728a20 100644 --- a/docs/functions/vec3.getAxis.html +++ b/docs/functions/vec3.getAxis.html @@ -1,5 +1,5 @@ -getAxis | wgpu-matrix

Function getAxis

  • Returns an axis of a 4x4 matrix as a vector with 3 entries

    -

    Parameters

    • m: Mat4

      The matrix.

      +getAxis | wgpu-matrix

      Function getAxis

      • Returns an axis of a 4x4 matrix as a vector with 3 entries

        +

        Type Parameters

        Parameters

        • m: BaseArgType

          The matrix.

        • axis: number

          The axis 0 = x, 1 = y, 2 = z;

          -
        • Optional dst: Vec3

        Returns Vec3

        The axis component of m.

        -
      \ No newline at end of file +
    • Optional dst: T

    Returns T

    The axis component of m.

    +
\ No newline at end of file diff --git a/docs/functions/vec3.getScaling.html b/docs/functions/vec3.getScaling.html index 05acc25..a5ba164 100644 --- a/docs/functions/vec3.getScaling.html +++ b/docs/functions/vec3.getScaling.html @@ -1,4 +1,4 @@ -getScaling | wgpu-matrix

Function getScaling

  • Returns the scaling component of the matrix

    -

    Parameters

    • m: Mat4

      The Matrix

      -
    • dst: Vec3

      The vector to set. If not passed a new one is created.

      -

    Returns Vec3

\ No newline at end of file +getScaling | wgpu-matrix

Function getScaling

  • Returns the scaling component of the matrix

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The Matrix

      +
    • Optional dst: T

      The vector to set. If not passed a new one is created.

      +

    Returns T

\ No newline at end of file diff --git a/docs/functions/vec3.getTranslation.html b/docs/functions/vec3.getTranslation.html index 6c23784..f408004 100644 --- a/docs/functions/vec3.getTranslation.html +++ b/docs/functions/vec3.getTranslation.html @@ -1,6 +1,6 @@ -getTranslation | wgpu-matrix

Function getTranslation

  • Returns the translation component of a 4-by-4 matrix as a vector with 3 +getTranslation | wgpu-matrix

    Function getTranslation

    • Returns the translation component of a 4-by-4 matrix as a vector with 3 entries.

      -

      Parameters

      • m: Mat3

        The matrix.

        -
      • Optional dst: Vec3

        vector to hold result. If not passed a new one is created.

        -

      Returns Vec3

      The translation component of m.

      -
    \ No newline at end of file +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix.

      +
    • Optional dst: T

      vector to hold result. If not passed a new one is created.

      +

    Returns T

    The translation component of m.

    +
\ No newline at end of file diff --git a/docs/functions/vec3.inverse.html b/docs/functions/vec3.inverse.html index b3ceabc..8a6f78d 100644 --- a/docs/functions/vec3.inverse.html +++ b/docs/functions/vec3.inverse.html @@ -1,5 +1,5 @@ -inverse | wgpu-matrix

Function inverse

  • Inverse a vector.

    -

    Parameters

    • v: Vec3

      The vector.

      -
    • Optional dst: Vec3

      vector to hold result. If not passed in a new one is created.

      -

    Returns Vec3

    The inverted vector.

    -
\ No newline at end of file +inverse | wgpu-matrix

Function inverse

  • Inverse a vector.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The inverted vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec3.invert.html b/docs/functions/vec3.invert.html index f19712c..0f180dc 100644 --- a/docs/functions/vec3.invert.html +++ b/docs/functions/vec3.invert.html @@ -1,5 +1,5 @@ -invert | wgpu-matrix

Function invert

  • Invert a vector. (same as inverse)

    -

    Parameters

    • v: Vec3

      The vector.

      -
    • Optional dst: Vec3

      vector to hold result. If not passed in a new one is created.

      -

    Returns Vec3

    The inverted vector.

    -
\ No newline at end of file +invert | wgpu-matrix

Function invert

  • Inverse a vector.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The inverted vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec3.len.html b/docs/functions/vec3.len.html index cd8b953..99ee883 100644 --- a/docs/functions/vec3.len.html +++ b/docs/functions/vec3.len.html @@ -1,4 +1,4 @@ -len | wgpu-matrix

Function len

  • Computes the length of vector (same as length)

    -

    Parameters

    • v: Vec3

      vector.

      +len | wgpu-matrix

      Function len

      • Computes the length of vector

        +

        Parameters

        Returns number

        length of vector.

        -
      \ No newline at end of file +
\ No newline at end of file diff --git a/docs/functions/vec3.lenSq.html b/docs/functions/vec3.lenSq.html index b88e4cb..0f9ca01 100644 --- a/docs/functions/vec3.lenSq.html +++ b/docs/functions/vec3.lenSq.html @@ -1,4 +1,4 @@ -lenSq | wgpu-matrix

Function lenSq

  • Computes the square of the length of vector (same as lengthSq)

    -

    Parameters

    • v: Vec3

      vector.

      +lenSq | wgpu-matrix

      Function lenSq

      • Computes the square of the length of vector

        +

        Parameters

        Returns number

        square of the length of vector.

        -
      \ No newline at end of file +
\ No newline at end of file diff --git a/docs/functions/vec3.length.html b/docs/functions/vec3.length.html index 7ed18e9..61fcac0 100644 --- a/docs/functions/vec3.length.html +++ b/docs/functions/vec3.length.html @@ -1,4 +1,4 @@ -length | wgpu-matrix

Function length

  • Computes the length of vector

    -

    Parameters

    • v: Vec3

      vector.

      +length | wgpu-matrix

      Function length

      • Computes the length of vector

        +

        Parameters

        Returns number

        length of vector.

        -
      \ No newline at end of file +
\ No newline at end of file diff --git a/docs/functions/vec3.lengthSq.html b/docs/functions/vec3.lengthSq.html index 4df7ae3..b61c0ca 100644 --- a/docs/functions/vec3.lengthSq.html +++ b/docs/functions/vec3.lengthSq.html @@ -1,4 +1,4 @@ -lengthSq | wgpu-matrix

Function lengthSq

  • Computes the square of the length of vector

    -

    Parameters

    • v: Vec3

      vector.

      +lengthSq | wgpu-matrix

      Function lengthSq

      • Computes the square of the length of vector

        +

        Parameters

        Returns number

        square of the length of vector.

        -
      \ No newline at end of file +
\ No newline at end of file diff --git a/docs/functions/vec3.lerp.html b/docs/functions/vec3.lerp.html index 99d3da3..b94730b 100644 --- a/docs/functions/vec3.lerp.html +++ b/docs/functions/vec3.lerp.html @@ -1,9 +1,9 @@ -lerp | wgpu-matrix

Function lerp

  • Performs linear interpolation on two vectors. +lerp | wgpu-matrix

    Function lerp

    • Performs linear interpolation on two vectors. Given vectors a and b and interpolation coefficient t, returns a + t * (b - a).

      -

      Parameters

      • a: Vec3

        Operand vector.

        -
      • b: Vec3

        Operand vector.

        +

        Type Parameters

        Parameters

        • a: BaseArgType

          Operand vector.

          +
        • b: BaseArgType

          Operand vector.

        • t: number

          Interpolation coefficient.

          -
        • Optional dst: Vec3

          vector to hold result. If not passed in a new one is created.

          -

        Returns Vec3

        The linear interpolated result.

        -
    \ No newline at end of file +
  • Optional dst: T

    vector to hold result. If not passed in a new one is created.

    +

Returns T

The linear interpolated result.

+
\ No newline at end of file diff --git a/docs/functions/vec3.lerpV.html b/docs/functions/vec3.lerpV.html index f2dd7f8..d583d77 100644 --- a/docs/functions/vec3.lerpV.html +++ b/docs/functions/vec3.lerpV.html @@ -1,9 +1,9 @@ -lerpV | wgpu-matrix

Function lerpV

  • Performs linear interpolation on two vectors. +lerpV | wgpu-matrix

    Function lerpV

    • Performs linear interpolation on two vectors. Given vectors a and b and interpolation coefficient vector t, returns a + t * (b - a).

      -

      Parameters

      • a: Vec3

        Operand vector.

        -
      • b: Vec3

        Operand vector.

        -
      • t: Vec3

        Interpolation coefficients vector.

        -
      • Optional dst: Vec3

        vector to hold result. If not passed in a new one is created.

        -

      Returns Vec3

      the linear interpolated result.

      -
    \ No newline at end of file +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • t: BaseArgType

      Interpolation coefficients vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    the linear interpolated result.

    +
\ No newline at end of file diff --git a/docs/functions/vec3.max.html b/docs/functions/vec3.max.html index f00b0de..75f0832 100644 --- a/docs/functions/vec3.max.html +++ b/docs/functions/vec3.max.html @@ -1,8 +1,8 @@ -max | wgpu-matrix

Function max

  • Return max values of two vectors. +max | wgpu-matrix

    Function max

    • Return max values of two vectors. Given vectors a and b returns [max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])].

      -

      Parameters

      • a: Vec3

        Operand vector.

        -
      • b: Vec3

        Operand vector.

        -
      • Optional dst: Vec3

        vector to hold result. If not passed in a new one is created.

        -

      Returns Vec3

      The max components vector.

      -
    \ No newline at end of file +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The max components vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec3.midpoint.html b/docs/functions/vec3.midpoint.html index 8362e57..4a2128d 100644 --- a/docs/functions/vec3.midpoint.html +++ b/docs/functions/vec3.midpoint.html @@ -1,5 +1,5 @@ -midpoint | wgpu-matrix

Function midpoint

  • Return the vector exactly between 2 endpoint vectors

    -

    Parameters

    Returns Vec3

    The vector exactly residing between endpoints 1 and 2

    -
\ No newline at end of file +midpoint | wgpu-matrix

Function midpoint

  • Return the vector exactly between 2 endpoint vectors

    +

    Type Parameters

    Parameters

    Returns T

    The vector exactly residing between endpoints 1 and 2

    +
\ No newline at end of file diff --git a/docs/functions/vec3.min.html b/docs/functions/vec3.min.html index da4add7..fe4a5f6 100644 --- a/docs/functions/vec3.min.html +++ b/docs/functions/vec3.min.html @@ -1,8 +1,8 @@ -min | wgpu-matrix

Function min

  • Return min values of two vectors. +min | wgpu-matrix

    Function min

    • Return min values of two vectors. Given vectors a and b returns [min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])].

      -

      Parameters

      • a: Vec3

        Operand vector.

        -
      • b: Vec3

        Operand vector.

        -
      • Optional dst: Vec3

        vector to hold result. If not passed in a new one is created.

        -

      Returns Vec3

      The min components vector.

      -
    \ No newline at end of file +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The min components vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec3.mul.html b/docs/functions/vec3.mul.html index 40288bb..edd2226 100644 --- a/docs/functions/vec3.mul.html +++ b/docs/functions/vec3.mul.html @@ -1,7 +1,7 @@ -mul | wgpu-matrix

Function mul

  • Multiplies a vector by another vector (component-wise); assumes a and -b have the same length. (same as mul)

    -

    Parameters

    • a: Vec3

      Operand vector.

      -
    • b: Vec3

      Operand vector.

      -
    • Optional dst: Vec3

      vector to hold result. If not passed in a new one is created.

      -

    Returns Vec3

    The vector of products of entries of a and b.

    -
\ No newline at end of file +mul | wgpu-matrix

Function mul

  • Multiplies a vector by another vector (component-wise); assumes a and +b have the same length.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The vector of products of entries of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/vec3.mulScalar.html b/docs/functions/vec3.mulScalar.html index a2e3c5f..74e8013 100644 --- a/docs/functions/vec3.mulScalar.html +++ b/docs/functions/vec3.mulScalar.html @@ -1,6 +1,6 @@ -mulScalar | wgpu-matrix

Function mulScalar

  • Multiplies a vector by a scalar.

    -

    Parameters

    • v: Vec3

      The vector.

      +mulScalar | wgpu-matrix

      Function mulScalar

      • Multiplies a vector by a scalar.

        +

        Type Parameters

        Parameters

        • v: BaseArgType

          The vector.

        • k: number

          The scalar.

          -
        • Optional dst: Vec3

          vector to hold result. If not passed in a new one is created.

          -

        Returns Vec3

        The scaled vector.

        -
      \ No newline at end of file +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The scaled vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec3.multiply.html b/docs/functions/vec3.multiply.html index dc84aab..ec47aa7 100644 --- a/docs/functions/vec3.multiply.html +++ b/docs/functions/vec3.multiply.html @@ -1,7 +1,7 @@ -multiply | wgpu-matrix

Function multiply

  • Multiplies a vector by another vector (component-wise); assumes a and +multiply | wgpu-matrix

    Function multiply

    • Multiplies a vector by another vector (component-wise); assumes a and b have the same length.

      -

      Parameters

      • a: Vec3

        Operand vector.

        -
      • b: Vec3

        Operand vector.

        -
      • Optional dst: Vec3

        vector to hold result. If not passed in a new one is created.

        -

      Returns Vec3

      The vector of products of entries of a and b.

      -
    \ No newline at end of file +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The vector of products of entries of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/vec3.negate.html b/docs/functions/vec3.negate.html index 2f5517c..a39cadf 100644 --- a/docs/functions/vec3.negate.html +++ b/docs/functions/vec3.negate.html @@ -1,5 +1,5 @@ -negate | wgpu-matrix

Function negate

  • Negates a vector.

    -

    Parameters

    • v: Vec3

      The vector.

      -
    • Optional dst: Vec3

      vector to hold result. If not passed in a new one is created.

      -

    Returns Vec3

    -v.

    -
\ No newline at end of file +negate | wgpu-matrix

Function negate

  • Negates a vector.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    -v.

    +
\ No newline at end of file diff --git a/docs/functions/vec3.normalize.html b/docs/functions/vec3.normalize.html index adcad83..7b2daa0 100644 --- a/docs/functions/vec3.normalize.html +++ b/docs/functions/vec3.normalize.html @@ -1,5 +1,5 @@ -normalize | wgpu-matrix

Function normalize

  • Divides a vector by its Euclidean length and returns the quotient.

    -

    Parameters

    • v: Vec3

      The vector.

      -
    • Optional dst: Vec3

      vector to hold result. If not passed in a new one is created.

      -

    Returns Vec3

    The normalized vector.

    -
\ No newline at end of file +normalize | wgpu-matrix

Function normalize

  • Divides a vector by its Euclidean length and returns the quotient.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The normalized vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec3.random.html b/docs/functions/vec3.random.html index f132049..8d2ac78 100644 --- a/docs/functions/vec3.random.html +++ b/docs/functions/vec3.random.html @@ -1,5 +1,5 @@ -random | wgpu-matrix

Function random

  • Creates a random vector

    -

    Parameters

    • scale: number = 1

      Default 1

      -
    • Optional dst: Vec3

      vector to hold result. If not passed in a new one is created.

      -

    Returns Vec3

    The random vector.

    -
\ No newline at end of file +random | wgpu-matrix

Function random

  • Creates a random vector

    +

    Type Parameters

    Parameters

    • scale: number = 1

      Default 1

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The random vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec3.rotateX.html b/docs/functions/vec3.rotateX.html index 0d9a01f..75ee0d6 100644 --- a/docs/functions/vec3.rotateX.html +++ b/docs/functions/vec3.rotateX.html @@ -1,7 +1,7 @@ -rotateX | wgpu-matrix

Function rotateX

  • Rotate a 3D vector around the x-axis

    -

    Parameters

    • a: Vec3

      The vec3 point to rotate

      -
    • b: Vec3

      The origin of the rotation

      +rotateX | wgpu-matrix

      Function rotateX

      • Rotate a 3D vector around the x-axis

        +

        Type Parameters

        Parameters

        • a: BaseArgType

          The vec3 point to rotate

          +
        • b: BaseArgType

          The origin of the rotation

        • rad: number

          The angle of rotation in radians

          -
        • Optional dst: Vec3

          The vector to set. If not passed a new one is created.

          -

        Returns Vec3

        the rotated vector

        -
      \ No newline at end of file +
    • Optional dst: T

      The vector to set. If not passed a new one is created.

      +

    Returns T

    the rotated vector

    +
\ No newline at end of file diff --git a/docs/functions/vec3.rotateY.html b/docs/functions/vec3.rotateY.html index a2ac4f2..4288c17 100644 --- a/docs/functions/vec3.rotateY.html +++ b/docs/functions/vec3.rotateY.html @@ -1,7 +1,7 @@ -rotateY | wgpu-matrix

Function rotateY

  • Rotate a 3D vector around the y-axis

    -

    Parameters

    • a: Vec3

      The vec3 point to rotate

      -
    • b: Vec3

      The origin of the rotation

      +rotateY | wgpu-matrix

      Function rotateY

      • Rotate a 3D vector around the y-axis

        +

        Type Parameters

        Parameters

        • a: BaseArgType

          The vec3 point to rotate

          +
        • b: BaseArgType

          The origin of the rotation

        • rad: number

          The angle of rotation in radians

          -
        • Optional dst: Vec3

          The vector to set. If not passed a new one is created.

          -

        Returns Vec3

        the rotated vector

        -
      \ No newline at end of file +
    • Optional dst: T

      The vector to set. If not passed a new one is created.

      +

    Returns T

    the rotated vector

    +
\ No newline at end of file diff --git a/docs/functions/vec3.rotateZ.html b/docs/functions/vec3.rotateZ.html index e1abee9..844ffcd 100644 --- a/docs/functions/vec3.rotateZ.html +++ b/docs/functions/vec3.rotateZ.html @@ -1,7 +1,7 @@ -rotateZ | wgpu-matrix

Function rotateZ

  • Rotate a 3D vector around the z-axis

    -

    Parameters

    • a: Vec3

      The vec3 point to rotate

      -
    • b: Vec3

      The origin of the rotation

      +rotateZ | wgpu-matrix

      Function rotateZ

      • Rotate a 3D vector around the z-axis

        +

        Type Parameters

        Parameters

        • a: BaseArgType

          The vec3 point to rotate

          +
        • b: BaseArgType

          The origin of the rotation

        • rad: number

          The angle of rotation in radians

          -
        • Optional dst: Vec3

          The vector to set. If not passed a new one is created.

          -

        Returns Vec3

        out

        -
      \ No newline at end of file +
    • Optional dst: T

      The vector to set. If not passed a new one is created.

      +

    Returns T

    out

    +
\ No newline at end of file diff --git a/docs/functions/vec3.round.html b/docs/functions/vec3.round.html index 1296bf8..7c73b58 100644 --- a/docs/functions/vec3.round.html +++ b/docs/functions/vec3.round.html @@ -1,5 +1,5 @@ -round | wgpu-matrix

Function round

  • Applies Math.round to each element of vector

    -

    Parameters

    • v: Vec3

      Operand vector.

      -
    • Optional dst: Vec3

      vector to hold result. If not passed in a new one is created.

      -

    Returns Vec3

    A vector that is the round of each element of v.

    -
\ No newline at end of file +round | wgpu-matrix

Function round

  • Applies Math.round to each element of vector

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that is the round of each element of v.

    +
\ No newline at end of file diff --git a/docs/functions/vec3.scale.html b/docs/functions/vec3.scale.html index 10f5fdb..99ead78 100644 --- a/docs/functions/vec3.scale.html +++ b/docs/functions/vec3.scale.html @@ -1,6 +1,6 @@ -scale | wgpu-matrix

Function scale

  • Multiplies a vector by a scalar. (same as mulScalar)

    -

    Parameters

    • v: Vec3

      The vector.

      +scale | wgpu-matrix

      Function scale

      • Multiplies a vector by a scalar.

        +

        Type Parameters

        Parameters

        • v: BaseArgType

          The vector.

        • k: number

          The scalar.

          -
        • Optional dst: Vec3

          vector to hold result. If not passed in a new one is created.

          -

        Returns Vec3

        The scaled vector.

        -
      \ No newline at end of file +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The scaled vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec3.set.html b/docs/functions/vec3.set.html index 7eb8e36..a94d64a 100644 --- a/docs/functions/vec3.set.html +++ b/docs/functions/vec3.set.html @@ -1,8 +1,8 @@ -set | wgpu-matrix

Function set

  • Sets the values of a Vec3 -Also see vec3.create and vec3.copy

    -

    Parameters

    • x: number

      first value

      +set | wgpu-matrix

      Function set

      • Sets the values of a Vec3 +Also see vec3.create and vec3.copy

        +

        Type Parameters

        Parameters

        • x: number

          first value

        • y: number

          second value

        • z: number

          third value

          -
        • Optional dst: Vec3

          vector to hold result. If not passed in a new one is created.

          -

        Returns Vec3

        A vector with its elements set.

        -
      \ No newline at end of file +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector with its elements set.

    +
\ No newline at end of file diff --git a/docs/functions/vec3.setDefaultType.html b/docs/functions/vec3.setDefaultType.html deleted file mode 100644 index d35eab0..0000000 --- a/docs/functions/vec3.setDefaultType.html +++ /dev/null @@ -1,17 +0,0 @@ -setDefaultType | wgpu-matrix

Function setDefaultType

  • Sets the type this library creates for a Vec3

    -

    Parameters

    • ctor: (new (n) => Vec3)

      the constructor for the type. Either Float32Array, Float64Array, or Array

      -
        • new (n): Vec3
        • Parameters

          • n: number

          Returns Vec3

    Returns (new (n) => Vec3)

    previous constructor for Vec3

    -
      • new (n): Vec3
      • Vec3 math functions.

        -

        Almost all functions take an optional dst argument. If it is not passed in the -functions will create a new Vec3. In other words you can do this

        -
        const v = vec3.cross(v1, v2);  // Creates a new Vec3 with the cross product of v1 x v2.
        -
        -

        or

        -
        const v = vec3.create();
        vec3.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v -
        -

        The first style is often easier but depending on where it's used it generates garbage where -as there is almost never allocation with the second style.

        -

        It is always safe to pass any vector as the destination. So for example

        -
        vec3.cross(v1, v2, v1);  // Puts the cross product of v1 x v2 in v1
        -
        -

        Parameters

        • n: number

        Returns Vec3

\ No newline at end of file diff --git a/docs/functions/vec3.setLength.html b/docs/functions/vec3.setLength.html index 1418048..8a1c4cd 100644 --- a/docs/functions/vec3.setLength.html +++ b/docs/functions/vec3.setLength.html @@ -1,5 +1,5 @@ -setLength | wgpu-matrix

Function setLength

  • Treat a 3D vector as a direction and set it's length

    -

    Parameters

    • a: Vec3

      The vec3 to lengthen

      +setLength | wgpu-matrix

      Function setLength

      • Treat a 3D vector as a direction and set it's length

        +

        Type Parameters

        Parameters

        • a: BaseArgType

          The vec3 to lengthen

        • len: number

          The length of the resulting vector

          -
        • Optional dst: Vec3

        Returns Vec3

        The lengthened vector

        -
      \ No newline at end of file +
    • Optional dst: T

    Returns T

    The lengthened vector

    +
\ No newline at end of file diff --git a/docs/functions/vec3.sub.html b/docs/functions/vec3.sub.html index a11d20f..06df1cb 100644 --- a/docs/functions/vec3.sub.html +++ b/docs/functions/vec3.sub.html @@ -1,6 +1,6 @@ -sub | wgpu-matrix

Function sub

  • Subtracts two vectors.

    -

    Parameters

    • a: Vec3

      Operand vector.

      -
    • b: Vec3

      Operand vector.

      -
    • Optional dst: Vec3

      vector to hold result. If not passed in a new one is created.

      -

    Returns Vec3

    A vector that is the difference of a and b.

    -
\ No newline at end of file +sub | wgpu-matrix

Function sub

  • Subtracts two vectors.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that is the difference of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/vec3.subtract.html b/docs/functions/vec3.subtract.html index 649fc29..274ea5b 100644 --- a/docs/functions/vec3.subtract.html +++ b/docs/functions/vec3.subtract.html @@ -1,6 +1,6 @@ -subtract | wgpu-matrix

Function subtract

  • Subtracts two vectors.

    -

    Parameters

    • a: Vec3

      Operand vector.

      -
    • b: Vec3

      Operand vector.

      -
    • Optional dst: Vec3

      vector to hold result. If not passed in a new one is created.

      -

    Returns Vec3

    A vector that is the difference of a and b.

    -
\ No newline at end of file +subtract | wgpu-matrix

Function subtract

  • Subtracts two vectors.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that is the difference of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/vec3.transformMat3.html b/docs/functions/vec3.transformMat3.html index 9e18b36..08eeccb 100644 --- a/docs/functions/vec3.transformMat3.html +++ b/docs/functions/vec3.transformMat3.html @@ -1,6 +1,6 @@ -transformMat3 | wgpu-matrix

Function transformMat3

  • Transforms vec3 by 3x3 matrix

    -

    Parameters

    • v: Vec3

      the vector

      -
    • m: Mat3

      The matrix.

      -
    • Optional dst: Vec3

      optional vec3 to store result. If not passed a new one is created.

      -

    Returns Vec3

    the transformed vector

    -
\ No newline at end of file +transformMat3 | wgpu-matrix

Function transformMat3

  • Transforms vec3 by 3x3 matrix

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      the vector

      +
    • m: BaseArgType

      The matrix.

      +
    • Optional dst: T

      optional vec3 to store result. If not passed a new one is created.

      +

    Returns T

    the transformed vector

    +
\ No newline at end of file diff --git a/docs/functions/vec3.transformMat4.html b/docs/functions/vec3.transformMat4.html index cf71b6f..f25ac35 100644 --- a/docs/functions/vec3.transformMat4.html +++ b/docs/functions/vec3.transformMat4.html @@ -1,6 +1,6 @@ -transformMat4 | wgpu-matrix

Function transformMat4

  • transform vec3 by 4x4 matrix

    -

    Parameters

    • v: Vec3

      the vector

      -
    • m: Mat4

      The matrix.

      -
    • Optional dst: Vec3

      optional vec3 to store result. If not passed a new one is created.

      -

    Returns Vec3

    the transformed vector

    -
\ No newline at end of file +transformMat4 | wgpu-matrix

Function transformMat4

  • transform vec3 by 4x4 matrix

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      the vector

      +
    • m: BaseArgType

      The matrix.

      +
    • Optional dst: T

      optional vec3 to store result. If not passed a new one is created.

      +

    Returns T

    the transformed vector

    +
\ No newline at end of file diff --git a/docs/functions/vec3.transformMat4Upper3x3.html b/docs/functions/vec3.transformMat4Upper3x3.html index 440d220..720dc9d 100644 --- a/docs/functions/vec3.transformMat4Upper3x3.html +++ b/docs/functions/vec3.transformMat4Upper3x3.html @@ -1,6 +1,6 @@ -transformMat4Upper3x3 | wgpu-matrix

Function transformMat4Upper3x3

  • Transform vec4 by upper 3x3 matrix inside 4x4 matrix.

    -

    Parameters

    • v: Vec3

      The direction.

      -
    • m: Mat4

      The matrix.

      -
    • Optional dst: Vec3

      optional Vec3 to store result. If not passed a new one is created.

      -

    Returns Vec3

    The transformed vector.

    -
\ No newline at end of file +transformMat4Upper3x3 | wgpu-matrix

Function transformMat4Upper3x3

  • Transform vec3 by upper 3x3 matrix inside 4x4 matrix.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The direction.

      +
    • m: BaseArgType

      The matrix.

      +
    • Optional dst: T

      optional vec3 to store result. If not passed a new one is created.

      +

    Returns T

    The transformed vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec3.transformQuat.html b/docs/functions/vec3.transformQuat.html index 6312421..8144342 100644 --- a/docs/functions/vec3.transformQuat.html +++ b/docs/functions/vec3.transformQuat.html @@ -1,6 +1,6 @@ -transformQuat | wgpu-matrix

Function transformQuat

  • Transforms vec3 by Quaternion

    -

    Parameters

    • v: Vec3

      the vector to transform

      -
    • q: Quat

      the quaternion to transform by

      -
    • Optional dst: Vec3

      optional vec3 to store result. If not passed a new one is created.

      -

    Returns Vec3

    the transformed

    -
\ No newline at end of file +transformQuat | wgpu-matrix

Function transformQuat

  • Transforms vec3 by Quaternion

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      the vector to transform

      +
    • q: BaseArgType

      the quaternion to transform by

      +
    • Optional dst: T

      optional vec3 to store result. If not passed a new one is created.

      +

    Returns T

    the transformed

    +
\ No newline at end of file diff --git a/docs/functions/vec3.truncate.html b/docs/functions/vec3.truncate.html index 6a743d0..7873339 100644 --- a/docs/functions/vec3.truncate.html +++ b/docs/functions/vec3.truncate.html @@ -1,5 +1,5 @@ -truncate | wgpu-matrix

Function truncate

  • Ensure a vector is not longer than a max length

    -

    Parameters

    • a: Vec3

      The vec3 to limit

      +truncate | wgpu-matrix

      Function truncate

      • Ensure a vector is not longer than a max length

        +

        Type Parameters

        Parameters

        • a: BaseArgType

          The vec3 to limit

        • maxLen: number

          The longest length of the resulting vector

          -
        • Optional dst: Vec3

        Returns Vec3

        The vector, shortened to maxLen if it's too long

        -
      \ No newline at end of file +
    • Optional dst: T

    Returns T

    The vector, shortened to maxLen if it's too long

    +
\ No newline at end of file diff --git a/docs/functions/vec3.zero.html b/docs/functions/vec3.zero.html index ed5f42b..050efa9 100644 --- a/docs/functions/vec3.zero.html +++ b/docs/functions/vec3.zero.html @@ -1,4 +1,4 @@ -zero | wgpu-matrix

Function zero

  • Zero's a vector

    -

    Parameters

    • Optional dst: Vec3

      vector to hold result. If not passed in a new one is created.

      -

    Returns Vec3

    The zeroed vector.

    -
\ No newline at end of file +zero | wgpu-matrix

Function zero

  • Zero's a vector

    +

    Type Parameters

    Parameters

    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The zeroed vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec3d.add.html b/docs/functions/vec3d.add.html new file mode 100644 index 0000000..df69577 --- /dev/null +++ b/docs/functions/vec3d.add.html @@ -0,0 +1,6 @@ +add | wgpu-matrix
  • Adds two vectors; assumes a and b have the same dimension.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that is the sum of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/vec3d.addScaled.html b/docs/functions/vec3d.addScaled.html new file mode 100644 index 0000000..56d1a8d --- /dev/null +++ b/docs/functions/vec3d.addScaled.html @@ -0,0 +1,7 @@ +addScaled | wgpu-matrix

Function addScaled

  • Adds two vectors, scaling the 2nd; assumes a and b have the same dimension.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • scale: number

      Amount to scale b

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that is the sum of a + b * scale.

    +
\ No newline at end of file diff --git a/docs/functions/vec3d.angle.html b/docs/functions/vec3d.angle.html new file mode 100644 index 0000000..7378376 --- /dev/null +++ b/docs/functions/vec3d.angle.html @@ -0,0 +1,5 @@ +angle | wgpu-matrix

Function angle

  • Returns the angle in radians between two vectors.

    +

    Parameters

    Returns number

    The angle in radians between the 2 vectors.

    +
\ No newline at end of file diff --git a/docs/functions/vec3d.ceil.html b/docs/functions/vec3d.ceil.html new file mode 100644 index 0000000..8003044 --- /dev/null +++ b/docs/functions/vec3d.ceil.html @@ -0,0 +1,5 @@ +ceil | wgpu-matrix
  • Applies Math.ceil to each element of vector

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that is the ceil of each element of v.

    +
\ No newline at end of file diff --git a/docs/functions/vec3d.clamp.html b/docs/functions/vec3d.clamp.html new file mode 100644 index 0000000..a754c05 --- /dev/null +++ b/docs/functions/vec3d.clamp.html @@ -0,0 +1,7 @@ +clamp | wgpu-matrix

Function clamp

  • Clamp each element of vector between min and max

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      Operand vector.

      +
    • min: number = 0

      Max value, default 1

      +
    • max: number = 1

      Min value, default 0

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that the clamped value of each element of v.

    +
\ No newline at end of file diff --git a/docs/functions/vec3d.clone.html b/docs/functions/vec3d.clone.html new file mode 100644 index 0000000..12bae79 --- /dev/null +++ b/docs/functions/vec3d.clone.html @@ -0,0 +1,6 @@ +clone | wgpu-matrix

Function clone

  • Copies a vector. (same as vec3.clone) +Also see vec3.create and vec3.set

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A copy of v.

    +
\ No newline at end of file diff --git a/docs/functions/vec3d.copy.html b/docs/functions/vec3d.copy.html new file mode 100644 index 0000000..ca01ab3 --- /dev/null +++ b/docs/functions/vec3d.copy.html @@ -0,0 +1,6 @@ +copy | wgpu-matrix
  • Copies a vector. (same as vec3.clone) +Also see vec3.create and vec3.set

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A copy of v.

    +
\ No newline at end of file diff --git a/docs/functions/vec3d.create.html b/docs/functions/vec3d.create.html new file mode 100644 index 0000000..ebaa3d0 --- /dev/null +++ b/docs/functions/vec3d.create.html @@ -0,0 +1,6 @@ +create | wgpu-matrix

Function create

  • Creates a vec3; may be called with x, y, z to set initial values.

    +

    Parameters

    • Optional x: number

      Initial x value.

      +
    • Optional y: number

      Initial y value.

      +
    • Optional z: number

      Initial z value.

      +

    Returns Float64Array

    the created vector

    +
\ No newline at end of file diff --git a/docs/functions/vec3d.cross.html b/docs/functions/vec3d.cross.html new file mode 100644 index 0000000..59298be --- /dev/null +++ b/docs/functions/vec3d.cross.html @@ -0,0 +1,7 @@ +cross | wgpu-matrix

Function cross

  • Computes the cross product of two vectors; assumes both vectors have +three entries.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The vector of a cross b.

    +
\ No newline at end of file diff --git a/docs/functions/vec3d.dist.html b/docs/functions/vec3d.dist.html new file mode 100644 index 0000000..f0ae6c7 --- /dev/null +++ b/docs/functions/vec3d.dist.html @@ -0,0 +1,5 @@ +dist | wgpu-matrix
  • Computes the distance between 2 points

    +

    Parameters

    Returns number

    distance between a and b

    +
\ No newline at end of file diff --git a/docs/functions/vec3d.distSq.html b/docs/functions/vec3d.distSq.html new file mode 100644 index 0000000..56bcaf3 --- /dev/null +++ b/docs/functions/vec3d.distSq.html @@ -0,0 +1,5 @@ +distSq | wgpu-matrix

Function distSq

  • Computes the square of the distance between 2 points

    +

    Parameters

    Returns number

    square of the distance between a and b

    +
\ No newline at end of file diff --git a/docs/functions/vec3d.distance.html b/docs/functions/vec3d.distance.html new file mode 100644 index 0000000..f812166 --- /dev/null +++ b/docs/functions/vec3d.distance.html @@ -0,0 +1,5 @@ +distance | wgpu-matrix

Function distance

  • Computes the distance between 2 points

    +

    Parameters

    Returns number

    distance between a and b

    +
\ No newline at end of file diff --git a/docs/functions/vec3d.distanceSq.html b/docs/functions/vec3d.distanceSq.html new file mode 100644 index 0000000..ce77091 --- /dev/null +++ b/docs/functions/vec3d.distanceSq.html @@ -0,0 +1,5 @@ +distanceSq | wgpu-matrix

Function distanceSq

  • Computes the square of the distance between 2 points

    +

    Parameters

    Returns number

    square of the distance between a and b

    +
\ No newline at end of file diff --git a/docs/functions/vec3d.div.html b/docs/functions/vec3d.div.html new file mode 100644 index 0000000..e6edc40 --- /dev/null +++ b/docs/functions/vec3d.div.html @@ -0,0 +1,7 @@ +div | wgpu-matrix
  • Divides a vector by another vector (component-wise); assumes a and +b have the same length.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The vector of quotients of entries of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/vec3d.divScalar.html b/docs/functions/vec3d.divScalar.html new file mode 100644 index 0000000..b2f37fc --- /dev/null +++ b/docs/functions/vec3d.divScalar.html @@ -0,0 +1,6 @@ +divScalar | wgpu-matrix

Function divScalar

  • Divides a vector by a scalar.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • k: number

      The scalar.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The scaled vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec3d.divide.html b/docs/functions/vec3d.divide.html new file mode 100644 index 0000000..44ef6eb --- /dev/null +++ b/docs/functions/vec3d.divide.html @@ -0,0 +1,7 @@ +divide | wgpu-matrix

Function divide

  • Divides a vector by another vector (component-wise); assumes a and +b have the same length.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The vector of quotients of entries of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/vec3d.dot.html b/docs/functions/vec3d.dot.html new file mode 100644 index 0000000..bf02807 --- /dev/null +++ b/docs/functions/vec3d.dot.html @@ -0,0 +1,6 @@ +dot | wgpu-matrix
  • Computes the dot product of two vectors; assumes both vectors have +three entries.

    +

    Parameters

    Returns number

    dot product

    +
\ No newline at end of file diff --git a/docs/functions/vec3d.equals.html b/docs/functions/vec3d.equals.html new file mode 100644 index 0000000..51899f2 --- /dev/null +++ b/docs/functions/vec3d.equals.html @@ -0,0 +1,5 @@ +equals | wgpu-matrix

Function equals

  • Check if 2 vectors are exactly equal

    +

    Parameters

    Returns boolean

    true if vectors are exactly equal

    +
\ No newline at end of file diff --git a/docs/functions/vec3d.equalsApproximately.html b/docs/functions/vec3d.equalsApproximately.html new file mode 100644 index 0000000..0719b19 --- /dev/null +++ b/docs/functions/vec3d.equalsApproximately.html @@ -0,0 +1,5 @@ +equalsApproximately | wgpu-matrix

Function equalsApproximately

  • Check if 2 vectors are approximately equal

    +

    Parameters

    Returns boolean

    true if vectors are approximately equal

    +
\ No newline at end of file diff --git a/docs/functions/vec3d.floor.html b/docs/functions/vec3d.floor.html new file mode 100644 index 0000000..8aedb52 --- /dev/null +++ b/docs/functions/vec3d.floor.html @@ -0,0 +1,5 @@ +floor | wgpu-matrix

Function floor

  • Applies Math.floor to each element of vector

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that is the floor of each element of v.

    +
\ No newline at end of file diff --git a/docs/functions/vec3d.fromValues.html b/docs/functions/vec3d.fromValues.html new file mode 100644 index 0000000..dfec5e8 --- /dev/null +++ b/docs/functions/vec3d.fromValues.html @@ -0,0 +1,6 @@ +fromValues | wgpu-matrix

Function fromValues

  • Creates a vec3; may be called with x, y, z to set initial values.

    +

    Parameters

    • Optional x: number

      Initial x value.

      +
    • Optional y: number

      Initial y value.

      +
    • Optional z: number

      Initial z value.

      +

    Returns Float64Array

    the created vector

    +
\ No newline at end of file diff --git a/docs/functions/vec3d.getAxis.html b/docs/functions/vec3d.getAxis.html new file mode 100644 index 0000000..edbe3c3 --- /dev/null +++ b/docs/functions/vec3d.getAxis.html @@ -0,0 +1,5 @@ +getAxis | wgpu-matrix

Function getAxis

  • Returns an axis of a 4x4 matrix as a vector with 3 entries

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix.

      +
    • axis: number

      The axis 0 = x, 1 = y, 2 = z;

      +
    • Optional dst: T

    Returns T

    The axis component of m.

    +
\ No newline at end of file diff --git a/docs/functions/vec3d.getScaling.html b/docs/functions/vec3d.getScaling.html new file mode 100644 index 0000000..3aad562 --- /dev/null +++ b/docs/functions/vec3d.getScaling.html @@ -0,0 +1,4 @@ +getScaling | wgpu-matrix

Function getScaling

  • Returns the scaling component of the matrix

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The Matrix

      +
    • Optional dst: T

      The vector to set. If not passed a new one is created.

      +

    Returns T

\ No newline at end of file diff --git a/docs/functions/vec3d.getTranslation.html b/docs/functions/vec3d.getTranslation.html new file mode 100644 index 0000000..f4b63b1 --- /dev/null +++ b/docs/functions/vec3d.getTranslation.html @@ -0,0 +1,6 @@ +getTranslation | wgpu-matrix

Function getTranslation

  • Returns the translation component of a 4-by-4 matrix as a vector with 3 +entries.

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix.

      +
    • Optional dst: T

      vector to hold result. If not passed a new one is created.

      +

    Returns T

    The translation component of m.

    +
\ No newline at end of file diff --git a/docs/functions/vec3d.inverse.html b/docs/functions/vec3d.inverse.html new file mode 100644 index 0000000..947597c --- /dev/null +++ b/docs/functions/vec3d.inverse.html @@ -0,0 +1,5 @@ +inverse | wgpu-matrix

Function inverse

  • Inverse a vector.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The inverted vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec3d.invert.html b/docs/functions/vec3d.invert.html new file mode 100644 index 0000000..cc3d023 --- /dev/null +++ b/docs/functions/vec3d.invert.html @@ -0,0 +1,5 @@ +invert | wgpu-matrix

Function invert

  • Inverse a vector.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The inverted vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec3d.len.html b/docs/functions/vec3d.len.html new file mode 100644 index 0000000..6ef3233 --- /dev/null +++ b/docs/functions/vec3d.len.html @@ -0,0 +1,4 @@ +len | wgpu-matrix
  • Computes the length of vector

    +

    Parameters

    Returns number

    length of vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec3d.lenSq.html b/docs/functions/vec3d.lenSq.html new file mode 100644 index 0000000..ae48f75 --- /dev/null +++ b/docs/functions/vec3d.lenSq.html @@ -0,0 +1,4 @@ +lenSq | wgpu-matrix

Function lenSq

  • Computes the square of the length of vector

    +

    Parameters

    Returns number

    square of the length of vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec3d.length.html b/docs/functions/vec3d.length.html new file mode 100644 index 0000000..1a075cb --- /dev/null +++ b/docs/functions/vec3d.length.html @@ -0,0 +1,4 @@ +length | wgpu-matrix

Function length

  • Computes the length of vector

    +

    Parameters

    Returns number

    length of vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec3d.lengthSq.html b/docs/functions/vec3d.lengthSq.html new file mode 100644 index 0000000..e3d5790 --- /dev/null +++ b/docs/functions/vec3d.lengthSq.html @@ -0,0 +1,4 @@ +lengthSq | wgpu-matrix

Function lengthSq

  • Computes the square of the length of vector

    +

    Parameters

    Returns number

    square of the length of vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec3d.lerp.html b/docs/functions/vec3d.lerp.html new file mode 100644 index 0000000..7aa08ea --- /dev/null +++ b/docs/functions/vec3d.lerp.html @@ -0,0 +1,9 @@ +lerp | wgpu-matrix
  • Performs linear interpolation on two vectors. +Given vectors a and b and interpolation coefficient t, returns +a + t * (b - a).

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • t: number

      Interpolation coefficient.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The linear interpolated result.

    +
\ No newline at end of file diff --git a/docs/functions/vec3d.lerpV.html b/docs/functions/vec3d.lerpV.html new file mode 100644 index 0000000..ae525e8 --- /dev/null +++ b/docs/functions/vec3d.lerpV.html @@ -0,0 +1,9 @@ +lerpV | wgpu-matrix

Function lerpV

  • Performs linear interpolation on two vectors. +Given vectors a and b and interpolation coefficient vector t, returns +a + t * (b - a).

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • t: BaseArgType

      Interpolation coefficients vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    the linear interpolated result.

    +
\ No newline at end of file diff --git a/docs/functions/vec3d.max.html b/docs/functions/vec3d.max.html new file mode 100644 index 0000000..72f0d5e --- /dev/null +++ b/docs/functions/vec3d.max.html @@ -0,0 +1,8 @@ +max | wgpu-matrix
  • Return max values of two vectors. +Given vectors a and b returns +[max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])].

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The max components vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec3d.midpoint.html b/docs/functions/vec3d.midpoint.html new file mode 100644 index 0000000..12bec93 --- /dev/null +++ b/docs/functions/vec3d.midpoint.html @@ -0,0 +1,5 @@ +midpoint | wgpu-matrix

Function midpoint

  • Return the vector exactly between 2 endpoint vectors

    +

    Type Parameters

    Parameters

    Returns T

    The vector exactly residing between endpoints 1 and 2

    +
\ No newline at end of file diff --git a/docs/functions/vec3d.min.html b/docs/functions/vec3d.min.html new file mode 100644 index 0000000..52c5bd0 --- /dev/null +++ b/docs/functions/vec3d.min.html @@ -0,0 +1,8 @@ +min | wgpu-matrix
  • Return min values of two vectors. +Given vectors a and b returns +[min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])].

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The min components vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec3d.mul.html b/docs/functions/vec3d.mul.html new file mode 100644 index 0000000..c665be8 --- /dev/null +++ b/docs/functions/vec3d.mul.html @@ -0,0 +1,7 @@ +mul | wgpu-matrix
  • Multiplies a vector by another vector (component-wise); assumes a and +b have the same length.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The vector of products of entries of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/vec3d.mulScalar.html b/docs/functions/vec3d.mulScalar.html new file mode 100644 index 0000000..166adda --- /dev/null +++ b/docs/functions/vec3d.mulScalar.html @@ -0,0 +1,6 @@ +mulScalar | wgpu-matrix

Function mulScalar

  • Multiplies a vector by a scalar.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • k: number

      The scalar.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The scaled vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec3d.multiply.html b/docs/functions/vec3d.multiply.html new file mode 100644 index 0000000..082c11d --- /dev/null +++ b/docs/functions/vec3d.multiply.html @@ -0,0 +1,7 @@ +multiply | wgpu-matrix

Function multiply

  • Multiplies a vector by another vector (component-wise); assumes a and +b have the same length.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The vector of products of entries of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/vec3d.negate.html b/docs/functions/vec3d.negate.html new file mode 100644 index 0000000..7fa154e --- /dev/null +++ b/docs/functions/vec3d.negate.html @@ -0,0 +1,5 @@ +negate | wgpu-matrix

Function negate

  • Negates a vector.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    -v.

    +
\ No newline at end of file diff --git a/docs/functions/vec3d.normalize.html b/docs/functions/vec3d.normalize.html new file mode 100644 index 0000000..b4acfc0 --- /dev/null +++ b/docs/functions/vec3d.normalize.html @@ -0,0 +1,5 @@ +normalize | wgpu-matrix

Function normalize

  • Divides a vector by its Euclidean length and returns the quotient.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The normalized vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec3d.random.html b/docs/functions/vec3d.random.html new file mode 100644 index 0000000..146e4f8 --- /dev/null +++ b/docs/functions/vec3d.random.html @@ -0,0 +1,5 @@ +random | wgpu-matrix

Function random

  • Creates a random vector

    +

    Type Parameters

    Parameters

    • scale: number = 1

      Default 1

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The random vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec3d.rotateX.html b/docs/functions/vec3d.rotateX.html new file mode 100644 index 0000000..3773434 --- /dev/null +++ b/docs/functions/vec3d.rotateX.html @@ -0,0 +1,7 @@ +rotateX | wgpu-matrix

Function rotateX

  • Rotate a 3D vector around the x-axis

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      The vec3 point to rotate

      +
    • b: BaseArgType

      The origin of the rotation

      +
    • rad: number

      The angle of rotation in radians

      +
    • Optional dst: T

      The vector to set. If not passed a new one is created.

      +

    Returns T

    the rotated vector

    +
\ No newline at end of file diff --git a/docs/functions/vec3d.rotateY.html b/docs/functions/vec3d.rotateY.html new file mode 100644 index 0000000..dd0258b --- /dev/null +++ b/docs/functions/vec3d.rotateY.html @@ -0,0 +1,7 @@ +rotateY | wgpu-matrix

Function rotateY

  • Rotate a 3D vector around the y-axis

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      The vec3 point to rotate

      +
    • b: BaseArgType

      The origin of the rotation

      +
    • rad: number

      The angle of rotation in radians

      +
    • Optional dst: T

      The vector to set. If not passed a new one is created.

      +

    Returns T

    the rotated vector

    +
\ No newline at end of file diff --git a/docs/functions/vec3d.rotateZ.html b/docs/functions/vec3d.rotateZ.html new file mode 100644 index 0000000..3a35def --- /dev/null +++ b/docs/functions/vec3d.rotateZ.html @@ -0,0 +1,7 @@ +rotateZ | wgpu-matrix

Function rotateZ

  • Rotate a 3D vector around the z-axis

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      The vec3 point to rotate

      +
    • b: BaseArgType

      The origin of the rotation

      +
    • rad: number

      The angle of rotation in radians

      +
    • Optional dst: T

      The vector to set. If not passed a new one is created.

      +

    Returns T

    out

    +
\ No newline at end of file diff --git a/docs/functions/vec3d.round.html b/docs/functions/vec3d.round.html new file mode 100644 index 0000000..1735da2 --- /dev/null +++ b/docs/functions/vec3d.round.html @@ -0,0 +1,5 @@ +round | wgpu-matrix

Function round

  • Applies Math.round to each element of vector

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that is the round of each element of v.

    +
\ No newline at end of file diff --git a/docs/functions/vec3d.scale.html b/docs/functions/vec3d.scale.html new file mode 100644 index 0000000..f93e931 --- /dev/null +++ b/docs/functions/vec3d.scale.html @@ -0,0 +1,6 @@ +scale | wgpu-matrix

Function scale

  • Multiplies a vector by a scalar.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • k: number

      The scalar.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The scaled vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec3d.set.html b/docs/functions/vec3d.set.html new file mode 100644 index 0000000..633b7bd --- /dev/null +++ b/docs/functions/vec3d.set.html @@ -0,0 +1,8 @@ +set | wgpu-matrix
  • Sets the values of a Vec3 +Also see vec3.create and vec3.copy

    +

    Type Parameters

    Parameters

    • x: number

      first value

      +
    • y: number

      second value

      +
    • z: number

      third value

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector with its elements set.

    +
\ No newline at end of file diff --git a/docs/functions/vec3d.setLength.html b/docs/functions/vec3d.setLength.html new file mode 100644 index 0000000..6cdc143 --- /dev/null +++ b/docs/functions/vec3d.setLength.html @@ -0,0 +1,5 @@ +setLength | wgpu-matrix

Function setLength

  • Treat a 3D vector as a direction and set it's length

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      The vec3 to lengthen

      +
    • len: number

      The length of the resulting vector

      +
    • Optional dst: T

    Returns T

    The lengthened vector

    +
\ No newline at end of file diff --git a/docs/functions/vec3d.sub.html b/docs/functions/vec3d.sub.html new file mode 100644 index 0000000..632e8e9 --- /dev/null +++ b/docs/functions/vec3d.sub.html @@ -0,0 +1,6 @@ +sub | wgpu-matrix
  • Subtracts two vectors.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that is the difference of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/vec3d.subtract.html b/docs/functions/vec3d.subtract.html new file mode 100644 index 0000000..d1a7d46 --- /dev/null +++ b/docs/functions/vec3d.subtract.html @@ -0,0 +1,6 @@ +subtract | wgpu-matrix

Function subtract

  • Subtracts two vectors.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that is the difference of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/vec3d.transformMat3.html b/docs/functions/vec3d.transformMat3.html new file mode 100644 index 0000000..1204571 --- /dev/null +++ b/docs/functions/vec3d.transformMat3.html @@ -0,0 +1,6 @@ +transformMat3 | wgpu-matrix

Function transformMat3

  • Transforms vec3 by 3x3 matrix

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      the vector

      +
    • m: BaseArgType

      The matrix.

      +
    • Optional dst: T

      optional vec3 to store result. If not passed a new one is created.

      +

    Returns T

    the transformed vector

    +
\ No newline at end of file diff --git a/docs/functions/vec3d.transformMat4.html b/docs/functions/vec3d.transformMat4.html new file mode 100644 index 0000000..c92b131 --- /dev/null +++ b/docs/functions/vec3d.transformMat4.html @@ -0,0 +1,6 @@ +transformMat4 | wgpu-matrix

Function transformMat4

  • transform vec3 by 4x4 matrix

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      the vector

      +
    • m: BaseArgType

      The matrix.

      +
    • Optional dst: T

      optional vec3 to store result. If not passed a new one is created.

      +

    Returns T

    the transformed vector

    +
\ No newline at end of file diff --git a/docs/functions/vec3d.transformMat4Upper3x3.html b/docs/functions/vec3d.transformMat4Upper3x3.html new file mode 100644 index 0000000..af02f44 --- /dev/null +++ b/docs/functions/vec3d.transformMat4Upper3x3.html @@ -0,0 +1,6 @@ +transformMat4Upper3x3 | wgpu-matrix

Function transformMat4Upper3x3

  • Transform vec3 by upper 3x3 matrix inside 4x4 matrix.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The direction.

      +
    • m: BaseArgType

      The matrix.

      +
    • Optional dst: T

      optional vec3 to store result. If not passed a new one is created.

      +

    Returns T

    The transformed vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec3d.transformQuat.html b/docs/functions/vec3d.transformQuat.html new file mode 100644 index 0000000..0b97341 --- /dev/null +++ b/docs/functions/vec3d.transformQuat.html @@ -0,0 +1,6 @@ +transformQuat | wgpu-matrix

Function transformQuat

  • Transforms vec3 by Quaternion

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      the vector to transform

      +
    • q: BaseArgType

      the quaternion to transform by

      +
    • Optional dst: T

      optional vec3 to store result. If not passed a new one is created.

      +

    Returns T

    the transformed

    +
\ No newline at end of file diff --git a/docs/functions/vec3d.truncate.html b/docs/functions/vec3d.truncate.html new file mode 100644 index 0000000..f7b9667 --- /dev/null +++ b/docs/functions/vec3d.truncate.html @@ -0,0 +1,5 @@ +truncate | wgpu-matrix

Function truncate

  • Ensure a vector is not longer than a max length

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      The vec3 to limit

      +
    • maxLen: number

      The longest length of the resulting vector

      +
    • Optional dst: T

    Returns T

    The vector, shortened to maxLen if it's too long

    +
\ No newline at end of file diff --git a/docs/functions/vec3d.zero.html b/docs/functions/vec3d.zero.html new file mode 100644 index 0000000..eeb9614 --- /dev/null +++ b/docs/functions/vec3d.zero.html @@ -0,0 +1,4 @@ +zero | wgpu-matrix
  • Zero's a vector

    +

    Type Parameters

    Parameters

    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The zeroed vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec3n.add.html b/docs/functions/vec3n.add.html new file mode 100644 index 0000000..abbabe8 --- /dev/null +++ b/docs/functions/vec3n.add.html @@ -0,0 +1,6 @@ +add | wgpu-matrix
  • Adds two vectors; assumes a and b have the same dimension.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that is the sum of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/vec3n.addScaled.html b/docs/functions/vec3n.addScaled.html new file mode 100644 index 0000000..e991fbb --- /dev/null +++ b/docs/functions/vec3n.addScaled.html @@ -0,0 +1,7 @@ +addScaled | wgpu-matrix

Function addScaled

  • Adds two vectors, scaling the 2nd; assumes a and b have the same dimension.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • scale: number

      Amount to scale b

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that is the sum of a + b * scale.

    +
\ No newline at end of file diff --git a/docs/functions/vec3n.angle.html b/docs/functions/vec3n.angle.html new file mode 100644 index 0000000..4f0558a --- /dev/null +++ b/docs/functions/vec3n.angle.html @@ -0,0 +1,5 @@ +angle | wgpu-matrix

Function angle

  • Returns the angle in radians between two vectors.

    +

    Parameters

    Returns number

    The angle in radians between the 2 vectors.

    +
\ No newline at end of file diff --git a/docs/functions/vec3n.ceil.html b/docs/functions/vec3n.ceil.html new file mode 100644 index 0000000..409115e --- /dev/null +++ b/docs/functions/vec3n.ceil.html @@ -0,0 +1,5 @@ +ceil | wgpu-matrix
  • Applies Math.ceil to each element of vector

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that is the ceil of each element of v.

    +
\ No newline at end of file diff --git a/docs/functions/vec3n.clamp.html b/docs/functions/vec3n.clamp.html new file mode 100644 index 0000000..8278e98 --- /dev/null +++ b/docs/functions/vec3n.clamp.html @@ -0,0 +1,7 @@ +clamp | wgpu-matrix

Function clamp

  • Clamp each element of vector between min and max

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      Operand vector.

      +
    • min: number = 0

      Max value, default 1

      +
    • max: number = 1

      Min value, default 0

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that the clamped value of each element of v.

    +
\ No newline at end of file diff --git a/docs/functions/vec3n.clone.html b/docs/functions/vec3n.clone.html new file mode 100644 index 0000000..cc9a60b --- /dev/null +++ b/docs/functions/vec3n.clone.html @@ -0,0 +1,6 @@ +clone | wgpu-matrix

Function clone

  • Copies a vector. (same as vec3.clone) +Also see vec3.create and vec3.set

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A copy of v.

    +
\ No newline at end of file diff --git a/docs/functions/vec3n.copy.html b/docs/functions/vec3n.copy.html new file mode 100644 index 0000000..09b121d --- /dev/null +++ b/docs/functions/vec3n.copy.html @@ -0,0 +1,6 @@ +copy | wgpu-matrix
  • Copies a vector. (same as vec3.clone) +Also see vec3.create and vec3.set

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A copy of v.

    +
\ No newline at end of file diff --git a/docs/functions/vec3n.create.html b/docs/functions/vec3n.create.html new file mode 100644 index 0000000..0362375 --- /dev/null +++ b/docs/functions/vec3n.create.html @@ -0,0 +1,6 @@ +create | wgpu-matrix

Function create

  • Creates a vec3; may be called with x, y, z to set initial values.

    +

    Parameters

    • Optional x: number

      Initial x value.

      +
    • Optional y: number

      Initial y value.

      +
    • Optional z: number

      Initial z value.

      +

    Returns number[]

    the created vector

    +
\ No newline at end of file diff --git a/docs/functions/vec3n.cross.html b/docs/functions/vec3n.cross.html new file mode 100644 index 0000000..2a297de --- /dev/null +++ b/docs/functions/vec3n.cross.html @@ -0,0 +1,7 @@ +cross | wgpu-matrix

Function cross

  • Computes the cross product of two vectors; assumes both vectors have +three entries.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The vector of a cross b.

    +
\ No newline at end of file diff --git a/docs/functions/vec3n.dist.html b/docs/functions/vec3n.dist.html new file mode 100644 index 0000000..cbe1a42 --- /dev/null +++ b/docs/functions/vec3n.dist.html @@ -0,0 +1,5 @@ +dist | wgpu-matrix
  • Computes the distance between 2 points

    +

    Parameters

    Returns number

    distance between a and b

    +
\ No newline at end of file diff --git a/docs/functions/vec3n.distSq.html b/docs/functions/vec3n.distSq.html new file mode 100644 index 0000000..c5900df --- /dev/null +++ b/docs/functions/vec3n.distSq.html @@ -0,0 +1,5 @@ +distSq | wgpu-matrix

Function distSq

  • Computes the square of the distance between 2 points

    +

    Parameters

    Returns number

    square of the distance between a and b

    +
\ No newline at end of file diff --git a/docs/functions/vec3n.distance.html b/docs/functions/vec3n.distance.html new file mode 100644 index 0000000..4504854 --- /dev/null +++ b/docs/functions/vec3n.distance.html @@ -0,0 +1,5 @@ +distance | wgpu-matrix

Function distance

  • Computes the distance between 2 points

    +

    Parameters

    Returns number

    distance between a and b

    +
\ No newline at end of file diff --git a/docs/functions/vec3n.distanceSq.html b/docs/functions/vec3n.distanceSq.html new file mode 100644 index 0000000..a79447a --- /dev/null +++ b/docs/functions/vec3n.distanceSq.html @@ -0,0 +1,5 @@ +distanceSq | wgpu-matrix

Function distanceSq

  • Computes the square of the distance between 2 points

    +

    Parameters

    Returns number

    square of the distance between a and b

    +
\ No newline at end of file diff --git a/docs/functions/vec3n.div.html b/docs/functions/vec3n.div.html new file mode 100644 index 0000000..1047b14 --- /dev/null +++ b/docs/functions/vec3n.div.html @@ -0,0 +1,7 @@ +div | wgpu-matrix
  • Divides a vector by another vector (component-wise); assumes a and +b have the same length.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The vector of quotients of entries of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/vec3n.divScalar.html b/docs/functions/vec3n.divScalar.html new file mode 100644 index 0000000..1e7e349 --- /dev/null +++ b/docs/functions/vec3n.divScalar.html @@ -0,0 +1,6 @@ +divScalar | wgpu-matrix

Function divScalar

  • Divides a vector by a scalar.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • k: number

      The scalar.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The scaled vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec3n.divide.html b/docs/functions/vec3n.divide.html new file mode 100644 index 0000000..a569258 --- /dev/null +++ b/docs/functions/vec3n.divide.html @@ -0,0 +1,7 @@ +divide | wgpu-matrix

Function divide

  • Divides a vector by another vector (component-wise); assumes a and +b have the same length.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The vector of quotients of entries of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/vec3n.dot.html b/docs/functions/vec3n.dot.html new file mode 100644 index 0000000..6a57ef0 --- /dev/null +++ b/docs/functions/vec3n.dot.html @@ -0,0 +1,6 @@ +dot | wgpu-matrix
  • Computes the dot product of two vectors; assumes both vectors have +three entries.

    +

    Parameters

    Returns number

    dot product

    +
\ No newline at end of file diff --git a/docs/functions/vec3n.equals.html b/docs/functions/vec3n.equals.html new file mode 100644 index 0000000..c9d9096 --- /dev/null +++ b/docs/functions/vec3n.equals.html @@ -0,0 +1,5 @@ +equals | wgpu-matrix

Function equals

  • Check if 2 vectors are exactly equal

    +

    Parameters

    Returns boolean

    true if vectors are exactly equal

    +
\ No newline at end of file diff --git a/docs/functions/vec3n.equalsApproximately.html b/docs/functions/vec3n.equalsApproximately.html new file mode 100644 index 0000000..61c0881 --- /dev/null +++ b/docs/functions/vec3n.equalsApproximately.html @@ -0,0 +1,5 @@ +equalsApproximately | wgpu-matrix

Function equalsApproximately

  • Check if 2 vectors are approximately equal

    +

    Parameters

    Returns boolean

    true if vectors are approximately equal

    +
\ No newline at end of file diff --git a/docs/functions/vec3n.floor.html b/docs/functions/vec3n.floor.html new file mode 100644 index 0000000..cbca0fe --- /dev/null +++ b/docs/functions/vec3n.floor.html @@ -0,0 +1,5 @@ +floor | wgpu-matrix

Function floor

  • Applies Math.floor to each element of vector

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that is the floor of each element of v.

    +
\ No newline at end of file diff --git a/docs/functions/vec3n.fromValues.html b/docs/functions/vec3n.fromValues.html new file mode 100644 index 0000000..34444e8 --- /dev/null +++ b/docs/functions/vec3n.fromValues.html @@ -0,0 +1,6 @@ +fromValues | wgpu-matrix

Function fromValues

  • Creates a vec3; may be called with x, y, z to set initial values.

    +

    Parameters

    • Optional x: number

      Initial x value.

      +
    • Optional y: number

      Initial y value.

      +
    • Optional z: number

      Initial z value.

      +

    Returns number[]

    the created vector

    +
\ No newline at end of file diff --git a/docs/functions/vec3n.getAxis.html b/docs/functions/vec3n.getAxis.html new file mode 100644 index 0000000..2c3328e --- /dev/null +++ b/docs/functions/vec3n.getAxis.html @@ -0,0 +1,5 @@ +getAxis | wgpu-matrix

Function getAxis

  • Returns an axis of a 4x4 matrix as a vector with 3 entries

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix.

      +
    • axis: number

      The axis 0 = x, 1 = y, 2 = z;

      +
    • Optional dst: T

    Returns T

    The axis component of m.

    +
\ No newline at end of file diff --git a/docs/functions/vec3n.getScaling.html b/docs/functions/vec3n.getScaling.html new file mode 100644 index 0000000..a8eac52 --- /dev/null +++ b/docs/functions/vec3n.getScaling.html @@ -0,0 +1,4 @@ +getScaling | wgpu-matrix

Function getScaling

  • Returns the scaling component of the matrix

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The Matrix

      +
    • Optional dst: T

      The vector to set. If not passed a new one is created.

      +

    Returns T

\ No newline at end of file diff --git a/docs/functions/vec3n.getTranslation.html b/docs/functions/vec3n.getTranslation.html new file mode 100644 index 0000000..8208dee --- /dev/null +++ b/docs/functions/vec3n.getTranslation.html @@ -0,0 +1,6 @@ +getTranslation | wgpu-matrix

Function getTranslation

  • Returns the translation component of a 4-by-4 matrix as a vector with 3 +entries.

    +

    Type Parameters

    Parameters

    • m: BaseArgType

      The matrix.

      +
    • Optional dst: T

      vector to hold result. If not passed a new one is created.

      +

    Returns T

    The translation component of m.

    +
\ No newline at end of file diff --git a/docs/functions/vec3n.inverse.html b/docs/functions/vec3n.inverse.html new file mode 100644 index 0000000..7b9b65d --- /dev/null +++ b/docs/functions/vec3n.inverse.html @@ -0,0 +1,5 @@ +inverse | wgpu-matrix

Function inverse

  • Inverse a vector.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The inverted vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec3n.invert.html b/docs/functions/vec3n.invert.html new file mode 100644 index 0000000..37d15a6 --- /dev/null +++ b/docs/functions/vec3n.invert.html @@ -0,0 +1,5 @@ +invert | wgpu-matrix

Function invert

  • Inverse a vector.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The inverted vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec3n.len.html b/docs/functions/vec3n.len.html new file mode 100644 index 0000000..741bb0a --- /dev/null +++ b/docs/functions/vec3n.len.html @@ -0,0 +1,4 @@ +len | wgpu-matrix
  • Computes the length of vector

    +

    Parameters

    Returns number

    length of vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec3n.lenSq.html b/docs/functions/vec3n.lenSq.html new file mode 100644 index 0000000..a39faa8 --- /dev/null +++ b/docs/functions/vec3n.lenSq.html @@ -0,0 +1,4 @@ +lenSq | wgpu-matrix

Function lenSq

  • Computes the square of the length of vector

    +

    Parameters

    Returns number

    square of the length of vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec3n.length.html b/docs/functions/vec3n.length.html new file mode 100644 index 0000000..5ee195c --- /dev/null +++ b/docs/functions/vec3n.length.html @@ -0,0 +1,4 @@ +length | wgpu-matrix

Function length

  • Computes the length of vector

    +

    Parameters

    Returns number

    length of vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec3n.lengthSq.html b/docs/functions/vec3n.lengthSq.html new file mode 100644 index 0000000..1cae8b9 --- /dev/null +++ b/docs/functions/vec3n.lengthSq.html @@ -0,0 +1,4 @@ +lengthSq | wgpu-matrix

Function lengthSq

  • Computes the square of the length of vector

    +

    Parameters

    Returns number

    square of the length of vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec3n.lerp.html b/docs/functions/vec3n.lerp.html new file mode 100644 index 0000000..f16d54d --- /dev/null +++ b/docs/functions/vec3n.lerp.html @@ -0,0 +1,9 @@ +lerp | wgpu-matrix
  • Performs linear interpolation on two vectors. +Given vectors a and b and interpolation coefficient t, returns +a + t * (b - a).

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • t: number

      Interpolation coefficient.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The linear interpolated result.

    +
\ No newline at end of file diff --git a/docs/functions/vec3n.lerpV.html b/docs/functions/vec3n.lerpV.html new file mode 100644 index 0000000..a0966bf --- /dev/null +++ b/docs/functions/vec3n.lerpV.html @@ -0,0 +1,9 @@ +lerpV | wgpu-matrix

Function lerpV

  • Performs linear interpolation on two vectors. +Given vectors a and b and interpolation coefficient vector t, returns +a + t * (b - a).

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • t: BaseArgType

      Interpolation coefficients vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    the linear interpolated result.

    +
\ No newline at end of file diff --git a/docs/functions/vec3n.max.html b/docs/functions/vec3n.max.html new file mode 100644 index 0000000..abe8aec --- /dev/null +++ b/docs/functions/vec3n.max.html @@ -0,0 +1,8 @@ +max | wgpu-matrix
  • Return max values of two vectors. +Given vectors a and b returns +[max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])].

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The max components vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec3n.midpoint.html b/docs/functions/vec3n.midpoint.html new file mode 100644 index 0000000..cc4b95e --- /dev/null +++ b/docs/functions/vec3n.midpoint.html @@ -0,0 +1,5 @@ +midpoint | wgpu-matrix

Function midpoint

  • Return the vector exactly between 2 endpoint vectors

    +

    Type Parameters

    Parameters

    Returns T

    The vector exactly residing between endpoints 1 and 2

    +
\ No newline at end of file diff --git a/docs/functions/vec3n.min.html b/docs/functions/vec3n.min.html new file mode 100644 index 0000000..a5c9b67 --- /dev/null +++ b/docs/functions/vec3n.min.html @@ -0,0 +1,8 @@ +min | wgpu-matrix
  • Return min values of two vectors. +Given vectors a and b returns +[min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])].

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The min components vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec3n.mul.html b/docs/functions/vec3n.mul.html new file mode 100644 index 0000000..15ebf50 --- /dev/null +++ b/docs/functions/vec3n.mul.html @@ -0,0 +1,7 @@ +mul | wgpu-matrix
  • Multiplies a vector by another vector (component-wise); assumes a and +b have the same length.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The vector of products of entries of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/vec3n.mulScalar.html b/docs/functions/vec3n.mulScalar.html new file mode 100644 index 0000000..95e5501 --- /dev/null +++ b/docs/functions/vec3n.mulScalar.html @@ -0,0 +1,6 @@ +mulScalar | wgpu-matrix

Function mulScalar

  • Multiplies a vector by a scalar.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • k: number

      The scalar.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The scaled vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec3n.multiply.html b/docs/functions/vec3n.multiply.html new file mode 100644 index 0000000..7d96953 --- /dev/null +++ b/docs/functions/vec3n.multiply.html @@ -0,0 +1,7 @@ +multiply | wgpu-matrix

Function multiply

  • Multiplies a vector by another vector (component-wise); assumes a and +b have the same length.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The vector of products of entries of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/vec3n.negate.html b/docs/functions/vec3n.negate.html new file mode 100644 index 0000000..24e05ec --- /dev/null +++ b/docs/functions/vec3n.negate.html @@ -0,0 +1,5 @@ +negate | wgpu-matrix

Function negate

  • Negates a vector.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    -v.

    +
\ No newline at end of file diff --git a/docs/functions/vec3n.normalize.html b/docs/functions/vec3n.normalize.html new file mode 100644 index 0000000..5cdad39 --- /dev/null +++ b/docs/functions/vec3n.normalize.html @@ -0,0 +1,5 @@ +normalize | wgpu-matrix

Function normalize

  • Divides a vector by its Euclidean length and returns the quotient.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The normalized vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec3n.random.html b/docs/functions/vec3n.random.html new file mode 100644 index 0000000..e54dbd1 --- /dev/null +++ b/docs/functions/vec3n.random.html @@ -0,0 +1,5 @@ +random | wgpu-matrix

Function random

  • Creates a random vector

    +

    Type Parameters

    Parameters

    • scale: number = 1

      Default 1

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The random vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec3n.rotateX.html b/docs/functions/vec3n.rotateX.html new file mode 100644 index 0000000..b99e203 --- /dev/null +++ b/docs/functions/vec3n.rotateX.html @@ -0,0 +1,7 @@ +rotateX | wgpu-matrix

Function rotateX

  • Rotate a 3D vector around the x-axis

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      The vec3 point to rotate

      +
    • b: BaseArgType

      The origin of the rotation

      +
    • rad: number

      The angle of rotation in radians

      +
    • Optional dst: T

      The vector to set. If not passed a new one is created.

      +

    Returns T

    the rotated vector

    +
\ No newline at end of file diff --git a/docs/functions/vec3n.rotateY.html b/docs/functions/vec3n.rotateY.html new file mode 100644 index 0000000..d33cdf8 --- /dev/null +++ b/docs/functions/vec3n.rotateY.html @@ -0,0 +1,7 @@ +rotateY | wgpu-matrix

Function rotateY

  • Rotate a 3D vector around the y-axis

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      The vec3 point to rotate

      +
    • b: BaseArgType

      The origin of the rotation

      +
    • rad: number

      The angle of rotation in radians

      +
    • Optional dst: T

      The vector to set. If not passed a new one is created.

      +

    Returns T

    the rotated vector

    +
\ No newline at end of file diff --git a/docs/functions/vec3n.rotateZ.html b/docs/functions/vec3n.rotateZ.html new file mode 100644 index 0000000..a36a337 --- /dev/null +++ b/docs/functions/vec3n.rotateZ.html @@ -0,0 +1,7 @@ +rotateZ | wgpu-matrix

Function rotateZ

  • Rotate a 3D vector around the z-axis

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      The vec3 point to rotate

      +
    • b: BaseArgType

      The origin of the rotation

      +
    • rad: number

      The angle of rotation in radians

      +
    • Optional dst: T

      The vector to set. If not passed a new one is created.

      +

    Returns T

    out

    +
\ No newline at end of file diff --git a/docs/functions/vec3n.round.html b/docs/functions/vec3n.round.html new file mode 100644 index 0000000..f8f5494 --- /dev/null +++ b/docs/functions/vec3n.round.html @@ -0,0 +1,5 @@ +round | wgpu-matrix

Function round

  • Applies Math.round to each element of vector

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that is the round of each element of v.

    +
\ No newline at end of file diff --git a/docs/functions/vec3n.scale.html b/docs/functions/vec3n.scale.html new file mode 100644 index 0000000..ebf38db --- /dev/null +++ b/docs/functions/vec3n.scale.html @@ -0,0 +1,6 @@ +scale | wgpu-matrix

Function scale

  • Multiplies a vector by a scalar.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • k: number

      The scalar.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The scaled vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec3n.set.html b/docs/functions/vec3n.set.html new file mode 100644 index 0000000..f5dc313 --- /dev/null +++ b/docs/functions/vec3n.set.html @@ -0,0 +1,8 @@ +set | wgpu-matrix
  • Sets the values of a Vec3 +Also see vec3.create and vec3.copy

    +

    Type Parameters

    Parameters

    • x: number

      first value

      +
    • y: number

      second value

      +
    • z: number

      third value

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector with its elements set.

    +
\ No newline at end of file diff --git a/docs/functions/vec3n.setLength.html b/docs/functions/vec3n.setLength.html new file mode 100644 index 0000000..fe4ad39 --- /dev/null +++ b/docs/functions/vec3n.setLength.html @@ -0,0 +1,5 @@ +setLength | wgpu-matrix

Function setLength

  • Treat a 3D vector as a direction and set it's length

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      The vec3 to lengthen

      +
    • len: number

      The length of the resulting vector

      +
    • Optional dst: T

    Returns T

    The lengthened vector

    +
\ No newline at end of file diff --git a/docs/functions/vec3n.sub.html b/docs/functions/vec3n.sub.html new file mode 100644 index 0000000..c63e830 --- /dev/null +++ b/docs/functions/vec3n.sub.html @@ -0,0 +1,6 @@ +sub | wgpu-matrix
  • Subtracts two vectors.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that is the difference of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/vec3n.subtract.html b/docs/functions/vec3n.subtract.html new file mode 100644 index 0000000..21e4b6f --- /dev/null +++ b/docs/functions/vec3n.subtract.html @@ -0,0 +1,6 @@ +subtract | wgpu-matrix

Function subtract

  • Subtracts two vectors.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that is the difference of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/vec3n.transformMat3.html b/docs/functions/vec3n.transformMat3.html new file mode 100644 index 0000000..4606978 --- /dev/null +++ b/docs/functions/vec3n.transformMat3.html @@ -0,0 +1,6 @@ +transformMat3 | wgpu-matrix

Function transformMat3

  • Transforms vec3 by 3x3 matrix

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      the vector

      +
    • m: BaseArgType

      The matrix.

      +
    • Optional dst: T

      optional vec3 to store result. If not passed a new one is created.

      +

    Returns T

    the transformed vector

    +
\ No newline at end of file diff --git a/docs/functions/vec3n.transformMat4.html b/docs/functions/vec3n.transformMat4.html new file mode 100644 index 0000000..4d7b794 --- /dev/null +++ b/docs/functions/vec3n.transformMat4.html @@ -0,0 +1,6 @@ +transformMat4 | wgpu-matrix

Function transformMat4

  • transform vec3 by 4x4 matrix

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      the vector

      +
    • m: BaseArgType

      The matrix.

      +
    • Optional dst: T

      optional vec3 to store result. If not passed a new one is created.

      +

    Returns T

    the transformed vector

    +
\ No newline at end of file diff --git a/docs/functions/vec3n.transformMat4Upper3x3.html b/docs/functions/vec3n.transformMat4Upper3x3.html new file mode 100644 index 0000000..3005312 --- /dev/null +++ b/docs/functions/vec3n.transformMat4Upper3x3.html @@ -0,0 +1,6 @@ +transformMat4Upper3x3 | wgpu-matrix

Function transformMat4Upper3x3

  • Transform vec3 by upper 3x3 matrix inside 4x4 matrix.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The direction.

      +
    • m: BaseArgType

      The matrix.

      +
    • Optional dst: T

      optional vec3 to store result. If not passed a new one is created.

      +

    Returns T

    The transformed vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec3n.transformQuat.html b/docs/functions/vec3n.transformQuat.html new file mode 100644 index 0000000..1acc4a3 --- /dev/null +++ b/docs/functions/vec3n.transformQuat.html @@ -0,0 +1,6 @@ +transformQuat | wgpu-matrix

Function transformQuat

  • Transforms vec3 by Quaternion

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      the vector to transform

      +
    • q: BaseArgType

      the quaternion to transform by

      +
    • Optional dst: T

      optional vec3 to store result. If not passed a new one is created.

      +

    Returns T

    the transformed

    +
\ No newline at end of file diff --git a/docs/functions/vec3n.truncate.html b/docs/functions/vec3n.truncate.html new file mode 100644 index 0000000..ff3e01b --- /dev/null +++ b/docs/functions/vec3n.truncate.html @@ -0,0 +1,5 @@ +truncate | wgpu-matrix

Function truncate

  • Ensure a vector is not longer than a max length

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      The vec3 to limit

      +
    • maxLen: number

      The longest length of the resulting vector

      +
    • Optional dst: T

    Returns T

    The vector, shortened to maxLen if it's too long

    +
\ No newline at end of file diff --git a/docs/functions/vec3n.zero.html b/docs/functions/vec3n.zero.html new file mode 100644 index 0000000..a84d996 --- /dev/null +++ b/docs/functions/vec3n.zero.html @@ -0,0 +1,4 @@ +zero | wgpu-matrix
  • Zero's a vector

    +

    Type Parameters

    Parameters

    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The zeroed vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec4.add.html b/docs/functions/vec4.add.html index 8ce5009..2effa4c 100644 --- a/docs/functions/vec4.add.html +++ b/docs/functions/vec4.add.html @@ -1,6 +1,6 @@ -add | wgpu-matrix

Function add

  • Adds two vectors; assumes a and b have the same dimension.

    -

    Parameters

    • a: Vec4

      Operand vector.

      -
    • b: Vec4

      Operand vector.

      -
    • Optional dst: Vec4

      vector to hold result. If not passed in a new one is created.

      -

    Returns Vec4

    A vector that is the sum of a and b.

    -
\ No newline at end of file +add | wgpu-matrix

Function add

  • Adds two vectors; assumes a and b have the same dimension.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that is the sum of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/vec4.addScaled.html b/docs/functions/vec4.addScaled.html index 4df534d..d871fb5 100644 --- a/docs/functions/vec4.addScaled.html +++ b/docs/functions/vec4.addScaled.html @@ -1,7 +1,7 @@ -addScaled | wgpu-matrix

Function addScaled

  • Adds two vectors, scaling the 2nd; assumes a and b have the same dimension.

    -

    Parameters

    • a: Vec4

      Operand vector.

      -
    • b: Vec4

      Operand vector.

      +addScaled | wgpu-matrix

      Function addScaled

      • Adds two vectors, scaling the 2nd; assumes a and b have the same dimension.

        +

        Type Parameters

        Parameters

        • a: BaseArgType

          Operand vector.

          +
        • b: BaseArgType

          Operand vector.

        • scale: number

          Amount to scale b

          -
        • Optional dst: Vec4

          vector to hold result. If not passed in a new one is created.

          -

        Returns Vec4

        A vector that is the sum of a + b * scale.

        -
      \ No newline at end of file +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that is the sum of a + b * scale.

    +
\ No newline at end of file diff --git a/docs/functions/vec4.ceil.html b/docs/functions/vec4.ceil.html index 27781db..76b927c 100644 --- a/docs/functions/vec4.ceil.html +++ b/docs/functions/vec4.ceil.html @@ -1,5 +1,5 @@ -ceil | wgpu-matrix

Function ceil

  • Applies Math.ceil to each element of vector

    -

    Parameters

    • v: Vec4

      Operand vector.

      -
    • Optional dst: Vec4

      vector to hold result. If not passed in a new one is created.

      -

    Returns Vec4

    A vector that is the ceil of each element of v.

    -
\ No newline at end of file +ceil | wgpu-matrix

Function ceil

  • Applies Math.ceil to each element of vector

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that is the ceil of each element of v.

    +
\ No newline at end of file diff --git a/docs/functions/vec4.clamp.html b/docs/functions/vec4.clamp.html index 766bd60..97b0a50 100644 --- a/docs/functions/vec4.clamp.html +++ b/docs/functions/vec4.clamp.html @@ -1,7 +1,7 @@ -clamp | wgpu-matrix

Function clamp

  • Clamp each element of vector between min and max

    -

    Parameters

    • v: Vec4

      Operand vector.

      +clamp | wgpu-matrix

      Function clamp

      • Clamp each element of vector between min and max

        +

        Type Parameters

        Parameters

        • v: BaseArgType

          Operand vector.

        • min: number = 0

          Max value, default 1

        • max: number = 1

          Min value, default 0

          -
        • Optional dst: Vec4

          vector to hold result. If not passed in a new one is created.

          -

        Returns Vec4

        A vector that the clamped value of each element of v.

        -
      \ No newline at end of file +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that the clamped value of each element of v.

    +
\ No newline at end of file diff --git a/docs/functions/vec4.clone.html b/docs/functions/vec4.clone.html index ee1fd76..1c39fcd 100644 --- a/docs/functions/vec4.clone.html +++ b/docs/functions/vec4.clone.html @@ -1,6 +1,6 @@ -clone | wgpu-matrix

Function clone

  • Clones a vector. (same as vec4.copy) -Also see vec4.create and vec4.set

    -

    Parameters

    • v: Vec4

      The vector.

      -
    • Optional dst: Vec4

      vector to hold result. If not passed in a new one is created.

      -

    Returns Vec4

    A copy of v.

    -
\ No newline at end of file +clone | wgpu-matrix

Function clone

  • Copies a vector. (same as vec4.clone) +Also see vec4.create and vec4.set

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A copy of v.

    +
\ No newline at end of file diff --git a/docs/functions/vec4.copy.html b/docs/functions/vec4.copy.html index fdaaf08..8139bae 100644 --- a/docs/functions/vec4.copy.html +++ b/docs/functions/vec4.copy.html @@ -1,6 +1,6 @@ -copy | wgpu-matrix

Function copy

  • Copies a vector. (same as vec4.clone) -Also see vec4.create and vec4.set

    -

    Parameters

    • v: Vec4

      The vector.

      -
    • Optional dst: Vec4

      vector to hold result. If not passed in a new one is created.

      -

    Returns Vec4

    A copy of v.

    -
\ No newline at end of file +copy | wgpu-matrix

Function copy

  • Copies a vector. (same as vec4.clone) +Also see vec4.create and vec4.set

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A copy of v.

    +
\ No newline at end of file diff --git a/docs/functions/vec4.create.html b/docs/functions/vec4.create.html index a4698b8..a234441 100644 --- a/docs/functions/vec4.create.html +++ b/docs/functions/vec4.create.html @@ -1,7 +1,7 @@ -create | wgpu-matrix

Function create

  • Creates a vec4; may be called with x, y, z to set initial values.

    +create | wgpu-matrix

    Function create

    • Creates a vec4; may be called with x, y, z to set initial values.

      Parameters

      • Optional x: number

        Initial x value.

      • Optional y: number

        Initial y value.

      • Optional z: number

        Initial z value.

      • Optional w: number

        Initial w value.

        -

      Returns Vec4

      the created vector

      -
    \ No newline at end of file +

Returns Float32Array

the created vector

+
\ No newline at end of file diff --git a/docs/functions/vec4.dist.html b/docs/functions/vec4.dist.html index 0fdbaaa..b84c472 100644 --- a/docs/functions/vec4.dist.html +++ b/docs/functions/vec4.dist.html @@ -1,5 +1,5 @@ -dist | wgpu-matrix

Function dist

  • Computes the distance between 2 points (same as distance)

    -

    Parameters

    • a: Vec4

      vector.

      -
    • b: Vec4

      vector.

      +dist | wgpu-matrix

      Function dist

      • Computes the distance between 2 points

        +

        Parameters

        Returns number

        distance between a and b

        -
      \ No newline at end of file +
\ No newline at end of file diff --git a/docs/functions/vec4.distSq.html b/docs/functions/vec4.distSq.html index 91c687e..bbb4fd6 100644 --- a/docs/functions/vec4.distSq.html +++ b/docs/functions/vec4.distSq.html @@ -1,5 +1,5 @@ -distSq | wgpu-matrix

Function distSq

  • Computes the square of the distance between 2 points (same as distanceSq)

    -

    Parameters

    • a: Vec4

      vector.

      -
    • b: Vec4

      vector.

      +distSq | wgpu-matrix

      Function distSq

      • Computes the square of the distance between 2 points

        +

        Parameters

        Returns number

        square of the distance between a and b

        -
      \ No newline at end of file +
\ No newline at end of file diff --git a/docs/functions/vec4.distance.html b/docs/functions/vec4.distance.html index 152f9d5..8919a53 100644 --- a/docs/functions/vec4.distance.html +++ b/docs/functions/vec4.distance.html @@ -1,5 +1,5 @@ -distance | wgpu-matrix

Function distance

  • Computes the distance between 2 points

    -

    Parameters

    • a: Vec4

      vector.

      -
    • b: Vec4

      vector.

      +distance | wgpu-matrix

      Function distance

      • Computes the distance between 2 points

        +

        Parameters

        Returns number

        distance between a and b

        -
      \ No newline at end of file +
\ No newline at end of file diff --git a/docs/functions/vec4.distanceSq.html b/docs/functions/vec4.distanceSq.html index d974d33..5d0304c 100644 --- a/docs/functions/vec4.distanceSq.html +++ b/docs/functions/vec4.distanceSq.html @@ -1,5 +1,5 @@ -distanceSq | wgpu-matrix

Function distanceSq

  • Computes the square of the distance between 2 points

    -

    Parameters

    • a: Vec4

      vector.

      -
    • b: Vec4

      vector.

      +distanceSq | wgpu-matrix

      Function distanceSq

      • Computes the square of the distance between 2 points

        +

        Parameters

        Returns number

        square of the distance between a and b

        -
      \ No newline at end of file +
\ No newline at end of file diff --git a/docs/functions/vec4.div.html b/docs/functions/vec4.div.html index 5d2a025..10af6fe 100644 --- a/docs/functions/vec4.div.html +++ b/docs/functions/vec4.div.html @@ -1,7 +1,7 @@ -div | wgpu-matrix

Function div

  • Divides a vector by another vector (component-wise); assumes a and -b have the same length. (same as divide)

    -

    Parameters

    • a: Vec4

      Operand vector.

      -
    • b: Vec4

      Operand vector.

      -
    • Optional dst: Vec4

      vector to hold result. If not passed in a new one is created.

      -

    Returns Vec4

    The vector of quotients of entries of a and b.

    -
\ No newline at end of file +div | wgpu-matrix

Function div

  • Divides a vector by another vector (component-wise); assumes a and +b have the same length.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The vector of quotients of entries of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/vec4.divScalar.html b/docs/functions/vec4.divScalar.html index 3bb4e0f..71f36c4 100644 --- a/docs/functions/vec4.divScalar.html +++ b/docs/functions/vec4.divScalar.html @@ -1,6 +1,6 @@ -divScalar | wgpu-matrix

Function divScalar

  • Divides a vector by a scalar.

    -

    Parameters

    • v: Vec4

      The vector.

      +divScalar | wgpu-matrix

      Function divScalar

      • Divides a vector by a scalar.

        +

        Type Parameters

        Parameters

        • v: BaseArgType

          The vector.

        • k: number

          The scalar.

          -
        • Optional dst: Vec4

          vector to hold result. If not passed in a new one is created.

          -

        Returns Vec4

        The scaled vector.

        -
      \ No newline at end of file +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The scaled vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec4.divide.html b/docs/functions/vec4.divide.html index e4c2c3b..3ab298e 100644 --- a/docs/functions/vec4.divide.html +++ b/docs/functions/vec4.divide.html @@ -1,7 +1,7 @@ -divide | wgpu-matrix

Function divide

  • Divides a vector by another vector (component-wise); assumes a and +divide | wgpu-matrix

    Function divide

    • Divides a vector by another vector (component-wise); assumes a and b have the same length.

      -

      Parameters

      • a: Vec4

        Operand vector.

        -
      • b: Vec4

        Operand vector.

        -
      • Optional dst: Vec4

        vector to hold result. If not passed in a new one is created.

        -

      Returns Vec4

      The vector of quotients of entries of a and b.

      -
    \ No newline at end of file +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The vector of quotients of entries of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/vec4.dot.html b/docs/functions/vec4.dot.html index ff1f82e..b572f7c 100644 --- a/docs/functions/vec4.dot.html +++ b/docs/functions/vec4.dot.html @@ -1,5 +1,5 @@ -dot | wgpu-matrix

Function dot

  • Computes the dot product of two vectors

    -

    Parameters

    • a: Vec4

      Operand vector.

      -
    • b: Vec4

      Operand vector.

      +dot | wgpu-matrix

      Function dot

      • Computes the dot product of two vectors

        +

        Parameters

        Returns number

        dot product

        -
      \ No newline at end of file +
\ No newline at end of file diff --git a/docs/functions/vec4.equals.html b/docs/functions/vec4.equals.html index 25e4031..74c58f7 100644 --- a/docs/functions/vec4.equals.html +++ b/docs/functions/vec4.equals.html @@ -1,5 +1,5 @@ -equals | wgpu-matrix

Function equals

  • Check if 2 vectors are exactly equal

    -

    Parameters

    • a: Vec4

      Operand vector.

      -
    • b: Vec4

      Operand vector.

      +equals | wgpu-matrix

      Function equals

      • Check if 2 vectors are exactly equal

        +

        Parameters

        Returns boolean

        true if vectors are exactly equal

        -
      \ No newline at end of file +
\ No newline at end of file diff --git a/docs/functions/vec4.equalsApproximately.html b/docs/functions/vec4.equalsApproximately.html index c62ea1a..2ac5e5b 100644 --- a/docs/functions/vec4.equalsApproximately.html +++ b/docs/functions/vec4.equalsApproximately.html @@ -1,5 +1,5 @@ -equalsApproximately | wgpu-matrix

Function equalsApproximately

  • Check if 2 vectors are approximately equal

    -

    Parameters

    • a: Vec4

      Operand vector.

      -
    • b: Vec4

      Operand vector.

      +equalsApproximately | wgpu-matrix

      Function equalsApproximately

      • Check if 2 vectors are approximately equal

        +

        Parameters

        Returns boolean

        true if vectors are approximately equal

        -
      \ No newline at end of file +
\ No newline at end of file diff --git a/docs/functions/vec4.floor.html b/docs/functions/vec4.floor.html index f2045a3..ea9a89e 100644 --- a/docs/functions/vec4.floor.html +++ b/docs/functions/vec4.floor.html @@ -1,5 +1,5 @@ -floor | wgpu-matrix

Function floor

  • Applies Math.floor to each element of vector

    -

    Parameters

    • v: Vec4

      Operand vector.

      -
    • Optional dst: Vec4

      vector to hold result. If not passed in a new one is created.

      -

    Returns Vec4

    A vector that is the floor of each element of v.

    -
\ No newline at end of file +floor | wgpu-matrix

Function floor

  • Applies Math.floor to each element of vector

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that is the floor of each element of v.

    +
\ No newline at end of file diff --git a/docs/functions/vec4.fromValues.html b/docs/functions/vec4.fromValues.html index f4baee8..590c86d 100644 --- a/docs/functions/vec4.fromValues.html +++ b/docs/functions/vec4.fromValues.html @@ -1,6 +1,7 @@ -fromValues | wgpu-matrix

Function fromValues

  • Creates a vec4; may be called with x, y, z to set initial values. (same as create)

    +fromValues | wgpu-matrix

    Function fromValues

    • Creates a vec4; may be called with x, y, z to set initial values.

      Parameters

      • Optional x: number

        Initial x value.

      • Optional y: number

        Initial y value.

      • Optional z: number

        Initial z value.

        -
      • Optional w: number

      Returns Vec4

      the created vector

      -
    \ No newline at end of file +
  • Optional w: number

    Initial w value.

    +

Returns Float32Array

the created vector

+
\ No newline at end of file diff --git a/docs/functions/vec4.inverse.html b/docs/functions/vec4.inverse.html index da61f08..28c4cb1 100644 --- a/docs/functions/vec4.inverse.html +++ b/docs/functions/vec4.inverse.html @@ -1,5 +1,5 @@ -inverse | wgpu-matrix

Function inverse

  • Inverse a vector.

    -

    Parameters

    • v: Vec4

      The vector.

      -
    • Optional dst: Vec4

      vector to hold result. If not passed in a new one is created.

      -

    Returns Vec4

    The inverted vector.

    -
\ No newline at end of file +inverse | wgpu-matrix

Function inverse

  • Inverse a vector.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The inverted vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec4.invert.html b/docs/functions/vec4.invert.html index d306a2d..933fa12 100644 --- a/docs/functions/vec4.invert.html +++ b/docs/functions/vec4.invert.html @@ -1,5 +1,5 @@ -invert | wgpu-matrix

Function invert

  • Invert a vector. (same as inverse)

    -

    Parameters

    • v: Vec4

      The vector.

      -
    • Optional dst: Vec4

      vector to hold result. If not passed in a new one is created.

      -

    Returns Vec4

    The inverted vector.

    -
\ No newline at end of file +invert | wgpu-matrix

Function invert

  • Inverse a vector.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The inverted vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec4.len.html b/docs/functions/vec4.len.html index 321350f..6745f87 100644 --- a/docs/functions/vec4.len.html +++ b/docs/functions/vec4.len.html @@ -1,4 +1,4 @@ -len | wgpu-matrix

Function len

  • Computes the length of vector (same as length)

    -

    Parameters

    • v: Vec4

      vector.

      +len | wgpu-matrix

      Function len

      • Computes the length of vector

        +

        Parameters

        Returns number

        length of vector.

        -
      \ No newline at end of file +
\ No newline at end of file diff --git a/docs/functions/vec4.lenSq.html b/docs/functions/vec4.lenSq.html index ed4b4c2..96d986b 100644 --- a/docs/functions/vec4.lenSq.html +++ b/docs/functions/vec4.lenSq.html @@ -1,4 +1,4 @@ -lenSq | wgpu-matrix

Function lenSq

  • Computes the square of the length of vector (same as lengthSq)

    -

    Parameters

    • v: Vec4

      vector.

      +lenSq | wgpu-matrix

      Function lenSq

      • Computes the square of the length of vector

        +

        Parameters

        Returns number

        square of the length of vector.

        -
      \ No newline at end of file +
\ No newline at end of file diff --git a/docs/functions/vec4.length.html b/docs/functions/vec4.length.html index 0e682d4..c42b969 100644 --- a/docs/functions/vec4.length.html +++ b/docs/functions/vec4.length.html @@ -1,4 +1,4 @@ -length | wgpu-matrix

Function length

  • Computes the length of vector

    -

    Parameters

    • v: Vec4

      vector.

      +length | wgpu-matrix

      Function length

      • Computes the length of vector

        +

        Parameters

        Returns number

        length of vector.

        -
      \ No newline at end of file +
\ No newline at end of file diff --git a/docs/functions/vec4.lengthSq.html b/docs/functions/vec4.lengthSq.html index 33830a3..3553075 100644 --- a/docs/functions/vec4.lengthSq.html +++ b/docs/functions/vec4.lengthSq.html @@ -1,4 +1,4 @@ -lengthSq | wgpu-matrix

Function lengthSq

  • Computes the square of the length of vector

    -

    Parameters

    • v: Vec4

      vector.

      +lengthSq | wgpu-matrix

      Function lengthSq

      • Computes the square of the length of vector

        +

        Parameters

        Returns number

        square of the length of vector.

        -
      \ No newline at end of file +
\ No newline at end of file diff --git a/docs/functions/vec4.lerp.html b/docs/functions/vec4.lerp.html index d4a4599..ff2663d 100644 --- a/docs/functions/vec4.lerp.html +++ b/docs/functions/vec4.lerp.html @@ -1,9 +1,9 @@ -lerp | wgpu-matrix

Function lerp

  • Performs linear interpolation on two vectors. +lerp | wgpu-matrix

    Function lerp

    • Performs linear interpolation on two vectors. Given vectors a and b and interpolation coefficient t, returns a + t * (b - a).

      -

      Parameters

      • a: Vec4

        Operand vector.

        -
      • b: Vec4

        Operand vector.

        +

        Type Parameters

        Parameters

        • a: BaseArgType

          Operand vector.

          +
        • b: BaseArgType

          Operand vector.

        • t: number

          Interpolation coefficient.

          -
        • Optional dst: Vec4

          vector to hold result. If not passed in a new one is created.

          -

        Returns Vec4

        The linear interpolated result.

        -
    \ No newline at end of file +
  • Optional dst: T

    vector to hold result. If not passed in a new one is created.

    +

Returns T

The linear interpolated result.

+
\ No newline at end of file diff --git a/docs/functions/vec4.lerpV.html b/docs/functions/vec4.lerpV.html index 1ac96a4..cf98067 100644 --- a/docs/functions/vec4.lerpV.html +++ b/docs/functions/vec4.lerpV.html @@ -1,9 +1,9 @@ -lerpV | wgpu-matrix

Function lerpV

  • Performs linear interpolation on two vectors. +lerpV | wgpu-matrix

    Function lerpV

    • Performs linear interpolation on two vectors. Given vectors a and b and interpolation coefficient vector t, returns a + t * (b - a).

      -

      Parameters

      • a: Vec4

        Operand vector.

        -
      • b: Vec4

        Operand vector.

        -
      • t: Vec4

        Interpolation coefficients vector.

        -
      • Optional dst: Vec4

        vector to hold result. If not passed in a new one is created.

        -

      Returns Vec4

      the linear interpolated result.

      -
    \ No newline at end of file +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • t: BaseArgType

      Interpolation coefficients vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    the linear interpolated result.

    +
\ No newline at end of file diff --git a/docs/functions/vec4.max.html b/docs/functions/vec4.max.html index 8014cb8..538640f 100644 --- a/docs/functions/vec4.max.html +++ b/docs/functions/vec4.max.html @@ -1,8 +1,8 @@ -max | wgpu-matrix

Function max

  • Return max values of two vectors. +max | wgpu-matrix

    Function max

    • Return max values of two vectors. Given vectors a and b returns [max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])].

      -

      Parameters

      • a: Vec4

        Operand vector.

        -
      • b: Vec4

        Operand vector.

        -
      • Optional dst: Vec4

        vector to hold result. If not passed in a new one is created.

        -

      Returns Vec4

      The max components vector.

      -
    \ No newline at end of file +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The max components vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec4.midpoint.html b/docs/functions/vec4.midpoint.html index 8753344..ed8c914 100644 --- a/docs/functions/vec4.midpoint.html +++ b/docs/functions/vec4.midpoint.html @@ -1,5 +1,5 @@ -midpoint | wgpu-matrix

Function midpoint

  • Return the vector exactly between 2 endpoint vectors

    -

    Parameters

    Returns Vec4

    The vector exactly residing between endpoints 1 and 2

    -
\ No newline at end of file +midpoint | wgpu-matrix

Function midpoint

  • Return the vector exactly between 2 endpoint vectors

    +

    Type Parameters

    Parameters

    Returns T

    The vector exactly residing between endpoints 1 and 2

    +
\ No newline at end of file diff --git a/docs/functions/vec4.min.html b/docs/functions/vec4.min.html index 42e22d1..2f0dc3d 100644 --- a/docs/functions/vec4.min.html +++ b/docs/functions/vec4.min.html @@ -1,8 +1,8 @@ -min | wgpu-matrix

Function min

  • Return min values of two vectors. +min | wgpu-matrix

    Function min

    • Return min values of two vectors. Given vectors a and b returns [min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])].

      -

      Parameters

      • a: Vec4

        Operand vector.

        -
      • b: Vec4

        Operand vector.

        -
      • Optional dst: Vec4

        vector to hold result. If not passed in a new one is created.

        -

      Returns Vec4

      The min components vector.

      -
    \ No newline at end of file +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The min components vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec4.mul.html b/docs/functions/vec4.mul.html index 6d8b62d..999d10b 100644 --- a/docs/functions/vec4.mul.html +++ b/docs/functions/vec4.mul.html @@ -1,7 +1,7 @@ -mul | wgpu-matrix

Function mul

  • Multiplies a vector by another vector (component-wise); assumes a and -b have the same length. (same as mul)

    -

    Parameters

    • a: Vec4

      Operand vector.

      -
    • b: Vec4

      Operand vector.

      -
    • Optional dst: Vec4

      vector to hold result. If not passed in a new one is created.

      -

    Returns Vec4

    The vector of products of entries of a and b.

    -
\ No newline at end of file +mul | wgpu-matrix

Function mul

  • Multiplies a vector by another vector (component-wise); assumes a and +b have the same length.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The vector of products of entries of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/vec4.mulScalar.html b/docs/functions/vec4.mulScalar.html index c75c994..a8ffa77 100644 --- a/docs/functions/vec4.mulScalar.html +++ b/docs/functions/vec4.mulScalar.html @@ -1,6 +1,6 @@ -mulScalar | wgpu-matrix

Function mulScalar

  • Multiplies a vector by a scalar.

    -

    Parameters

    • v: Vec4

      The vector.

      +mulScalar | wgpu-matrix

      Function mulScalar

      • Multiplies a vector by a scalar.

        +

        Type Parameters

        Parameters

        • v: BaseArgType

          The vector.

        • k: number

          The scalar.

          -
        • Optional dst: Vec4

          vector to hold result. If not passed in a new one is created.

          -

        Returns Vec4

        The scaled vector.

        -
      \ No newline at end of file +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The scaled vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec4.multiply.html b/docs/functions/vec4.multiply.html index dd48e86..d866e52 100644 --- a/docs/functions/vec4.multiply.html +++ b/docs/functions/vec4.multiply.html @@ -1,7 +1,7 @@ -multiply | wgpu-matrix

Function multiply

  • Multiplies a vector by another vector (component-wise); assumes a and +multiply | wgpu-matrix

    Function multiply

    • Multiplies a vector by another vector (component-wise); assumes a and b have the same length.

      -

      Parameters

      • a: Vec4

        Operand vector.

        -
      • b: Vec4

        Operand vector.

        -
      • Optional dst: Vec4

        vector to hold result. If not passed in a new one is created.

        -

      Returns Vec4

      The vector of products of entries of a and b.

      -
    \ No newline at end of file +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The vector of products of entries of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/vec4.negate.html b/docs/functions/vec4.negate.html index 3b7c1ed..193b2e4 100644 --- a/docs/functions/vec4.negate.html +++ b/docs/functions/vec4.negate.html @@ -1,5 +1,5 @@ -negate | wgpu-matrix

Function negate

  • Negates a vector.

    -

    Parameters

    • v: Vec4

      The vector.

      -
    • Optional dst: Vec4

      vector to hold result. If not passed in a new one is created.

      -

    Returns Vec4

    -v.

    -
\ No newline at end of file +negate | wgpu-matrix

Function negate

  • Negates a vector.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    -v.

    +
\ No newline at end of file diff --git a/docs/functions/vec4.normalize.html b/docs/functions/vec4.normalize.html index 00fa5bb..a8964c8 100644 --- a/docs/functions/vec4.normalize.html +++ b/docs/functions/vec4.normalize.html @@ -1,5 +1,5 @@ -normalize | wgpu-matrix

Function normalize

  • Divides a vector by its Euclidean length and returns the quotient.

    -

    Parameters

    • v: Vec4

      The vector.

      -
    • Optional dst: Vec4

      vector to hold result. If not passed in a new one is created.

      -

    Returns Vec4

    The normalized vector.

    -
\ No newline at end of file +normalize | wgpu-matrix

Function normalize

  • Divides a vector by its Euclidean length and returns the quotient.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The normalized vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec4.round.html b/docs/functions/vec4.round.html index 12d936e..59f0f7b 100644 --- a/docs/functions/vec4.round.html +++ b/docs/functions/vec4.round.html @@ -1,5 +1,5 @@ -round | wgpu-matrix

Function round

  • Applies Math.round to each element of vector

    -

    Parameters

    • v: Vec4

      Operand vector.

      -
    • Optional dst: Vec4

      vector to hold result. If not passed in a new one is created.

      -

    Returns Vec4

    A vector that is the round of each element of v.

    -
\ No newline at end of file +round | wgpu-matrix

Function round

  • Applies Math.round to each element of vector

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that is the round of each element of v.

    +
\ No newline at end of file diff --git a/docs/functions/vec4.scale.html b/docs/functions/vec4.scale.html index 8b135e1..812fc67 100644 --- a/docs/functions/vec4.scale.html +++ b/docs/functions/vec4.scale.html @@ -1,6 +1,6 @@ -scale | wgpu-matrix

Function scale

  • Multiplies a vector by a scalar. (same as mulScalar)

    -

    Parameters

    • v: Vec4

      The vector.

      +scale | wgpu-matrix

      Function scale

      • Multiplies a vector by a scalar.

        +

        Type Parameters

        Parameters

        • v: BaseArgType

          The vector.

        • k: number

          The scalar.

          -
        • Optional dst: Vec4

          vector to hold result. If not passed in a new one is created.

          -

        Returns Vec4

        The scaled vector.

        -
      \ No newline at end of file +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The scaled vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec4.set.html b/docs/functions/vec4.set.html index 483df4a..9df7c90 100644 --- a/docs/functions/vec4.set.html +++ b/docs/functions/vec4.set.html @@ -1,9 +1,9 @@ -set | wgpu-matrix

Function set

  • Sets the values of a Vec4 -Also see vec4.create and vec4.copy

    -

    Parameters

    • x: number

      first value

      +set | wgpu-matrix

      Function set

      • Sets the values of a Vec4 +Also see vec4.create and vec4.copy

        +

        Type Parameters

        Parameters

        • x: number

          first value

        • y: number

          second value

        • z: number

          third value

        • w: number

          fourth value

          -
        • Optional dst: Vec4

          vector to hold result. If not passed in a new one is created.

          -

        Returns Vec4

        A vector with its elements set.

        -
      \ No newline at end of file +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector with its elements set.

    +
\ No newline at end of file diff --git a/docs/functions/vec4.setDefaultType.html b/docs/functions/vec4.setDefaultType.html deleted file mode 100644 index a575e7a..0000000 --- a/docs/functions/vec4.setDefaultType.html +++ /dev/null @@ -1,17 +0,0 @@ -setDefaultType | wgpu-matrix

Function setDefaultType

  • Sets the type this library creates for a Vec4

    -

    Parameters

    • ctor: (new (n) => Vec4)

      the constructor for the type. Either Float32Array, Float64Array, or Array

      -
        • new (n): Vec4
        • Parameters

          • n: number

          Returns Vec4

    Returns (new (n) => Vec4)

    previous constructor for Vec4

    -
      • new (n): Vec4
      • Vec4 math functions.

        -

        Almost all functions take an optional dst argument. If it is not passed in the -functions will create a new Vec4. In other words you can do this

        -
        const v = vec4.cross(v1, v2);  // Creates a new Vec4 with the cross product of v1 x v2.
        -
        -

        or

        -
        const v = vec4.create();
        vec4.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v -
        -

        The first style is often easier but depending on where it's used it generates garbage where -as there is almost never allocation with the second style.

        -

        It is always safe to pass any vector as the destination. So for example

        -
        vec4.cross(v1, v2, v1);  // Puts the cross product of v1 x v2 in v1
        -
        -

        Parameters

        • n: number

        Returns Vec4

\ No newline at end of file diff --git a/docs/functions/vec4.setLength.html b/docs/functions/vec4.setLength.html index 8de0c0f..1028d89 100644 --- a/docs/functions/vec4.setLength.html +++ b/docs/functions/vec4.setLength.html @@ -1,5 +1,5 @@ -setLength | wgpu-matrix

Function setLength

  • Treat a 4D vector as a direction and set it's length

    -

    Parameters

    • a: Vec4

      The vec4 to lengthen

      +setLength | wgpu-matrix

      Function setLength

      • Treat a 4D vector as a direction and set it's length

        +

        Type Parameters

        Parameters

        • a: BaseArgType

          The vec4 to lengthen

        • len: number

          The length of the resulting vector

          -
        • Optional dst: Vec4

        Returns Vec4

        The lengthened vector

        -
      \ No newline at end of file +
    • Optional dst: T

    Returns T

    The lengthened vector

    +
\ No newline at end of file diff --git a/docs/functions/vec4.sub.html b/docs/functions/vec4.sub.html index 4a6e763..39cc566 100644 --- a/docs/functions/vec4.sub.html +++ b/docs/functions/vec4.sub.html @@ -1,6 +1,6 @@ -sub | wgpu-matrix

Function sub

  • Subtracts two vectors.

    -

    Parameters

    • a: Vec4

      Operand vector.

      -
    • b: Vec4

      Operand vector.

      -
    • Optional dst: Vec4

      vector to hold result. If not passed in a new one is created.

      -

    Returns Vec4

    A vector that is the difference of a and b.

    -
\ No newline at end of file +sub | wgpu-matrix

Function sub

  • Subtracts two vectors.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that is the difference of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/vec4.subtract.html b/docs/functions/vec4.subtract.html index ac4b5bf..6cc5d1a 100644 --- a/docs/functions/vec4.subtract.html +++ b/docs/functions/vec4.subtract.html @@ -1,6 +1,6 @@ -subtract | wgpu-matrix

Function subtract

  • Subtracts two vectors.

    -

    Parameters

    • a: Vec4

      Operand vector.

      -
    • b: Vec4

      Operand vector.

      -
    • Optional dst: Vec4

      vector to hold result. If not passed in a new one is created.

      -

    Returns Vec4

    A vector that is the difference of a and b.

    -
\ No newline at end of file +subtract | wgpu-matrix

Function subtract

  • Subtracts two vectors.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that is the difference of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/vec4.transformMat4.html b/docs/functions/vec4.transformMat4.html index 036fbb2..6635d3a 100644 --- a/docs/functions/vec4.transformMat4.html +++ b/docs/functions/vec4.transformMat4.html @@ -1,6 +1,6 @@ -transformMat4 | wgpu-matrix

Function transformMat4

  • transform vec4 by 4x4 matrix

    -

    Parameters

    • v: Vec4

      the vector

      -
    • m: Mat4

      The matrix.

      -
    • Optional dst: Vec4

      optional vec4 to store result. If not passed a new one is created.

      -

    Returns Vec4

    the transformed vector

    -
\ No newline at end of file +transformMat4 | wgpu-matrix

Function transformMat4

  • transform vec4 by 4x4 matrix

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      the vector

      +
    • m: BaseArgType

      The matrix.

      +
    • Optional dst: T

      optional vec4 to store result. If not passed a new one is created.

      +

    Returns T

    the transformed vector

    +
\ No newline at end of file diff --git a/docs/functions/vec4.truncate.html b/docs/functions/vec4.truncate.html index fc80b8a..d932bdf 100644 --- a/docs/functions/vec4.truncate.html +++ b/docs/functions/vec4.truncate.html @@ -1,5 +1,5 @@ -truncate | wgpu-matrix

Function truncate

  • Ensure a vector is not longer than a max length

    -

    Parameters

    • a: Vec4

      The vec4 to limit

      +truncate | wgpu-matrix

      Function truncate

      • Ensure a vector is not longer than a max length

        +

        Type Parameters

        Parameters

        • a: BaseArgType

          The vec4 to limit

        • maxLen: number

          The longest length of the resulting vector

          -
        • Optional dst: Vec4

        Returns Vec4

        The vector, shortened to maxLen if it's too long

        -
      \ No newline at end of file +
    • Optional dst: T

    Returns T

    The vector, shortened to maxLen if it's too long

    +
\ No newline at end of file diff --git a/docs/functions/vec4.zero.html b/docs/functions/vec4.zero.html index e896511..7e90e3c 100644 --- a/docs/functions/vec4.zero.html +++ b/docs/functions/vec4.zero.html @@ -1,4 +1,4 @@ -zero | wgpu-matrix

Function zero

  • Zero's a vector

    -

    Parameters

    • Optional dst: Vec4

      vector to hold result. If not passed in a new one is created.

      -

    Returns Vec4

    The zeroed vector.

    -
\ No newline at end of file +zero | wgpu-matrix

Function zero

  • Zero's a vector

    +

    Type Parameters

    Parameters

    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The zeroed vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec4d.add.html b/docs/functions/vec4d.add.html new file mode 100644 index 0000000..decd951 --- /dev/null +++ b/docs/functions/vec4d.add.html @@ -0,0 +1,6 @@ +add | wgpu-matrix
  • Adds two vectors; assumes a and b have the same dimension.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that is the sum of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/vec4d.addScaled.html b/docs/functions/vec4d.addScaled.html new file mode 100644 index 0000000..00e38a0 --- /dev/null +++ b/docs/functions/vec4d.addScaled.html @@ -0,0 +1,7 @@ +addScaled | wgpu-matrix

Function addScaled

  • Adds two vectors, scaling the 2nd; assumes a and b have the same dimension.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • scale: number

      Amount to scale b

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that is the sum of a + b * scale.

    +
\ No newline at end of file diff --git a/docs/functions/vec4d.ceil.html b/docs/functions/vec4d.ceil.html new file mode 100644 index 0000000..2b40fa0 --- /dev/null +++ b/docs/functions/vec4d.ceil.html @@ -0,0 +1,5 @@ +ceil | wgpu-matrix
  • Applies Math.ceil to each element of vector

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that is the ceil of each element of v.

    +
\ No newline at end of file diff --git a/docs/functions/vec4d.clamp.html b/docs/functions/vec4d.clamp.html new file mode 100644 index 0000000..d2d5038 --- /dev/null +++ b/docs/functions/vec4d.clamp.html @@ -0,0 +1,7 @@ +clamp | wgpu-matrix

Function clamp

  • Clamp each element of vector between min and max

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      Operand vector.

      +
    • min: number = 0

      Max value, default 1

      +
    • max: number = 1

      Min value, default 0

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that the clamped value of each element of v.

    +
\ No newline at end of file diff --git a/docs/functions/vec4d.clone.html b/docs/functions/vec4d.clone.html new file mode 100644 index 0000000..36b78cf --- /dev/null +++ b/docs/functions/vec4d.clone.html @@ -0,0 +1,6 @@ +clone | wgpu-matrix

Function clone

  • Copies a vector. (same as vec4.clone) +Also see vec4.create and vec4.set

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A copy of v.

    +
\ No newline at end of file diff --git a/docs/functions/vec4d.copy.html b/docs/functions/vec4d.copy.html new file mode 100644 index 0000000..404b2f1 --- /dev/null +++ b/docs/functions/vec4d.copy.html @@ -0,0 +1,6 @@ +copy | wgpu-matrix
  • Copies a vector. (same as vec4.clone) +Also see vec4.create and vec4.set

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A copy of v.

    +
\ No newline at end of file diff --git a/docs/functions/vec4d.create.html b/docs/functions/vec4d.create.html new file mode 100644 index 0000000..ee31bce --- /dev/null +++ b/docs/functions/vec4d.create.html @@ -0,0 +1,7 @@ +create | wgpu-matrix

Function create

  • Creates a vec4; may be called with x, y, z to set initial values.

    +

    Parameters

    • Optional x: number

      Initial x value.

      +
    • Optional y: number

      Initial y value.

      +
    • Optional z: number

      Initial z value.

      +
    • Optional w: number

      Initial w value.

      +

    Returns Float64Array

    the created vector

    +
\ No newline at end of file diff --git a/docs/functions/vec4d.dist.html b/docs/functions/vec4d.dist.html new file mode 100644 index 0000000..e4fa55d --- /dev/null +++ b/docs/functions/vec4d.dist.html @@ -0,0 +1,5 @@ +dist | wgpu-matrix
  • Computes the distance between 2 points

    +

    Parameters

    Returns number

    distance between a and b

    +
\ No newline at end of file diff --git a/docs/functions/vec4d.distSq.html b/docs/functions/vec4d.distSq.html new file mode 100644 index 0000000..7d489bb --- /dev/null +++ b/docs/functions/vec4d.distSq.html @@ -0,0 +1,5 @@ +distSq | wgpu-matrix

Function distSq

  • Computes the square of the distance between 2 points

    +

    Parameters

    Returns number

    square of the distance between a and b

    +
\ No newline at end of file diff --git a/docs/functions/vec4d.distance.html b/docs/functions/vec4d.distance.html new file mode 100644 index 0000000..65c8da1 --- /dev/null +++ b/docs/functions/vec4d.distance.html @@ -0,0 +1,5 @@ +distance | wgpu-matrix

Function distance

  • Computes the distance between 2 points

    +

    Parameters

    Returns number

    distance between a and b

    +
\ No newline at end of file diff --git a/docs/functions/vec4d.distanceSq.html b/docs/functions/vec4d.distanceSq.html new file mode 100644 index 0000000..6771008 --- /dev/null +++ b/docs/functions/vec4d.distanceSq.html @@ -0,0 +1,5 @@ +distanceSq | wgpu-matrix

Function distanceSq

  • Computes the square of the distance between 2 points

    +

    Parameters

    Returns number

    square of the distance between a and b

    +
\ No newline at end of file diff --git a/docs/functions/vec4d.div.html b/docs/functions/vec4d.div.html new file mode 100644 index 0000000..8707f28 --- /dev/null +++ b/docs/functions/vec4d.div.html @@ -0,0 +1,7 @@ +div | wgpu-matrix
  • Divides a vector by another vector (component-wise); assumes a and +b have the same length.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The vector of quotients of entries of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/vec4d.divScalar.html b/docs/functions/vec4d.divScalar.html new file mode 100644 index 0000000..560fda6 --- /dev/null +++ b/docs/functions/vec4d.divScalar.html @@ -0,0 +1,6 @@ +divScalar | wgpu-matrix

Function divScalar

  • Divides a vector by a scalar.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • k: number

      The scalar.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The scaled vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec4d.divide.html b/docs/functions/vec4d.divide.html new file mode 100644 index 0000000..a3f540f --- /dev/null +++ b/docs/functions/vec4d.divide.html @@ -0,0 +1,7 @@ +divide | wgpu-matrix

Function divide

  • Divides a vector by another vector (component-wise); assumes a and +b have the same length.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The vector of quotients of entries of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/vec4d.dot.html b/docs/functions/vec4d.dot.html new file mode 100644 index 0000000..8feac0e --- /dev/null +++ b/docs/functions/vec4d.dot.html @@ -0,0 +1,5 @@ +dot | wgpu-matrix
  • Computes the dot product of two vectors

    +

    Parameters

    Returns number

    dot product

    +
\ No newline at end of file diff --git a/docs/functions/vec4d.equals.html b/docs/functions/vec4d.equals.html new file mode 100644 index 0000000..c29d52a --- /dev/null +++ b/docs/functions/vec4d.equals.html @@ -0,0 +1,5 @@ +equals | wgpu-matrix

Function equals

  • Check if 2 vectors are exactly equal

    +

    Parameters

    Returns boolean

    true if vectors are exactly equal

    +
\ No newline at end of file diff --git a/docs/functions/vec4d.equalsApproximately.html b/docs/functions/vec4d.equalsApproximately.html new file mode 100644 index 0000000..316e2f3 --- /dev/null +++ b/docs/functions/vec4d.equalsApproximately.html @@ -0,0 +1,5 @@ +equalsApproximately | wgpu-matrix

Function equalsApproximately

  • Check if 2 vectors are approximately equal

    +

    Parameters

    Returns boolean

    true if vectors are approximately equal

    +
\ No newline at end of file diff --git a/docs/functions/vec4d.floor.html b/docs/functions/vec4d.floor.html new file mode 100644 index 0000000..5c06234 --- /dev/null +++ b/docs/functions/vec4d.floor.html @@ -0,0 +1,5 @@ +floor | wgpu-matrix

Function floor

  • Applies Math.floor to each element of vector

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that is the floor of each element of v.

    +
\ No newline at end of file diff --git a/docs/functions/vec4d.fromValues.html b/docs/functions/vec4d.fromValues.html new file mode 100644 index 0000000..e2c44f9 --- /dev/null +++ b/docs/functions/vec4d.fromValues.html @@ -0,0 +1,7 @@ +fromValues | wgpu-matrix

Function fromValues

  • Creates a vec4; may be called with x, y, z to set initial values.

    +

    Parameters

    • Optional x: number

      Initial x value.

      +
    • Optional y: number

      Initial y value.

      +
    • Optional z: number

      Initial z value.

      +
    • Optional w: number

      Initial w value.

      +

    Returns Float64Array

    the created vector

    +
\ No newline at end of file diff --git a/docs/functions/vec4d.inverse.html b/docs/functions/vec4d.inverse.html new file mode 100644 index 0000000..046f671 --- /dev/null +++ b/docs/functions/vec4d.inverse.html @@ -0,0 +1,5 @@ +inverse | wgpu-matrix

Function inverse

  • Inverse a vector.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The inverted vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec4d.invert.html b/docs/functions/vec4d.invert.html new file mode 100644 index 0000000..cc3e5fe --- /dev/null +++ b/docs/functions/vec4d.invert.html @@ -0,0 +1,5 @@ +invert | wgpu-matrix

Function invert

  • Inverse a vector.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The inverted vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec4d.len.html b/docs/functions/vec4d.len.html new file mode 100644 index 0000000..e9eb4e5 --- /dev/null +++ b/docs/functions/vec4d.len.html @@ -0,0 +1,4 @@ +len | wgpu-matrix
  • Computes the length of vector

    +

    Parameters

    Returns number

    length of vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec4d.lenSq.html b/docs/functions/vec4d.lenSq.html new file mode 100644 index 0000000..e0a322e --- /dev/null +++ b/docs/functions/vec4d.lenSq.html @@ -0,0 +1,4 @@ +lenSq | wgpu-matrix

Function lenSq

  • Computes the square of the length of vector

    +

    Parameters

    Returns number

    square of the length of vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec4d.length.html b/docs/functions/vec4d.length.html new file mode 100644 index 0000000..798de70 --- /dev/null +++ b/docs/functions/vec4d.length.html @@ -0,0 +1,4 @@ +length | wgpu-matrix

Function length

  • Computes the length of vector

    +

    Parameters

    Returns number

    length of vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec4d.lengthSq.html b/docs/functions/vec4d.lengthSq.html new file mode 100644 index 0000000..45ba83e --- /dev/null +++ b/docs/functions/vec4d.lengthSq.html @@ -0,0 +1,4 @@ +lengthSq | wgpu-matrix

Function lengthSq

  • Computes the square of the length of vector

    +

    Parameters

    Returns number

    square of the length of vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec4d.lerp.html b/docs/functions/vec4d.lerp.html new file mode 100644 index 0000000..434e756 --- /dev/null +++ b/docs/functions/vec4d.lerp.html @@ -0,0 +1,9 @@ +lerp | wgpu-matrix
  • Performs linear interpolation on two vectors. +Given vectors a and b and interpolation coefficient t, returns +a + t * (b - a).

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • t: number

      Interpolation coefficient.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The linear interpolated result.

    +
\ No newline at end of file diff --git a/docs/functions/vec4d.lerpV.html b/docs/functions/vec4d.lerpV.html new file mode 100644 index 0000000..67860e1 --- /dev/null +++ b/docs/functions/vec4d.lerpV.html @@ -0,0 +1,9 @@ +lerpV | wgpu-matrix

Function lerpV

  • Performs linear interpolation on two vectors. +Given vectors a and b and interpolation coefficient vector t, returns +a + t * (b - a).

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • t: BaseArgType

      Interpolation coefficients vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    the linear interpolated result.

    +
\ No newline at end of file diff --git a/docs/functions/vec4d.max.html b/docs/functions/vec4d.max.html new file mode 100644 index 0000000..221af18 --- /dev/null +++ b/docs/functions/vec4d.max.html @@ -0,0 +1,8 @@ +max | wgpu-matrix
  • Return max values of two vectors. +Given vectors a and b returns +[max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])].

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The max components vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec4d.midpoint.html b/docs/functions/vec4d.midpoint.html new file mode 100644 index 0000000..e375392 --- /dev/null +++ b/docs/functions/vec4d.midpoint.html @@ -0,0 +1,5 @@ +midpoint | wgpu-matrix

Function midpoint

  • Return the vector exactly between 2 endpoint vectors

    +

    Type Parameters

    Parameters

    Returns T

    The vector exactly residing between endpoints 1 and 2

    +
\ No newline at end of file diff --git a/docs/functions/vec4d.min.html b/docs/functions/vec4d.min.html new file mode 100644 index 0000000..e14393a --- /dev/null +++ b/docs/functions/vec4d.min.html @@ -0,0 +1,8 @@ +min | wgpu-matrix
  • Return min values of two vectors. +Given vectors a and b returns +[min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])].

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The min components vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec4d.mul.html b/docs/functions/vec4d.mul.html new file mode 100644 index 0000000..4a05626 --- /dev/null +++ b/docs/functions/vec4d.mul.html @@ -0,0 +1,7 @@ +mul | wgpu-matrix
  • Multiplies a vector by another vector (component-wise); assumes a and +b have the same length.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The vector of products of entries of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/vec4d.mulScalar.html b/docs/functions/vec4d.mulScalar.html new file mode 100644 index 0000000..d0f3e0b --- /dev/null +++ b/docs/functions/vec4d.mulScalar.html @@ -0,0 +1,6 @@ +mulScalar | wgpu-matrix

Function mulScalar

  • Multiplies a vector by a scalar.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • k: number

      The scalar.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The scaled vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec4d.multiply.html b/docs/functions/vec4d.multiply.html new file mode 100644 index 0000000..a621a7b --- /dev/null +++ b/docs/functions/vec4d.multiply.html @@ -0,0 +1,7 @@ +multiply | wgpu-matrix

Function multiply

  • Multiplies a vector by another vector (component-wise); assumes a and +b have the same length.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The vector of products of entries of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/vec4d.negate.html b/docs/functions/vec4d.negate.html new file mode 100644 index 0000000..cda619f --- /dev/null +++ b/docs/functions/vec4d.negate.html @@ -0,0 +1,5 @@ +negate | wgpu-matrix

Function negate

  • Negates a vector.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    -v.

    +
\ No newline at end of file diff --git a/docs/functions/vec4d.normalize.html b/docs/functions/vec4d.normalize.html new file mode 100644 index 0000000..9029817 --- /dev/null +++ b/docs/functions/vec4d.normalize.html @@ -0,0 +1,5 @@ +normalize | wgpu-matrix

Function normalize

  • Divides a vector by its Euclidean length and returns the quotient.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The normalized vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec4d.round.html b/docs/functions/vec4d.round.html new file mode 100644 index 0000000..96c45f0 --- /dev/null +++ b/docs/functions/vec4d.round.html @@ -0,0 +1,5 @@ +round | wgpu-matrix

Function round

  • Applies Math.round to each element of vector

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that is the round of each element of v.

    +
\ No newline at end of file diff --git a/docs/functions/vec4d.scale.html b/docs/functions/vec4d.scale.html new file mode 100644 index 0000000..8af542b --- /dev/null +++ b/docs/functions/vec4d.scale.html @@ -0,0 +1,6 @@ +scale | wgpu-matrix

Function scale

  • Multiplies a vector by a scalar.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • k: number

      The scalar.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The scaled vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec4d.set.html b/docs/functions/vec4d.set.html new file mode 100644 index 0000000..55b2808 --- /dev/null +++ b/docs/functions/vec4d.set.html @@ -0,0 +1,9 @@ +set | wgpu-matrix
  • Sets the values of a Vec4 +Also see vec4.create and vec4.copy

    +

    Type Parameters

    Parameters

    • x: number

      first value

      +
    • y: number

      second value

      +
    • z: number

      third value

      +
    • w: number

      fourth value

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector with its elements set.

    +
\ No newline at end of file diff --git a/docs/functions/vec4d.setLength.html b/docs/functions/vec4d.setLength.html new file mode 100644 index 0000000..3749c43 --- /dev/null +++ b/docs/functions/vec4d.setLength.html @@ -0,0 +1,5 @@ +setLength | wgpu-matrix

Function setLength

  • Treat a 4D vector as a direction and set it's length

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      The vec4 to lengthen

      +
    • len: number

      The length of the resulting vector

      +
    • Optional dst: T

    Returns T

    The lengthened vector

    +
\ No newline at end of file diff --git a/docs/functions/vec4d.sub.html b/docs/functions/vec4d.sub.html new file mode 100644 index 0000000..3b74db7 --- /dev/null +++ b/docs/functions/vec4d.sub.html @@ -0,0 +1,6 @@ +sub | wgpu-matrix
  • Subtracts two vectors.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that is the difference of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/vec4d.subtract.html b/docs/functions/vec4d.subtract.html new file mode 100644 index 0000000..ba26d6f --- /dev/null +++ b/docs/functions/vec4d.subtract.html @@ -0,0 +1,6 @@ +subtract | wgpu-matrix

Function subtract

  • Subtracts two vectors.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that is the difference of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/vec4d.transformMat4.html b/docs/functions/vec4d.transformMat4.html new file mode 100644 index 0000000..55fd4be --- /dev/null +++ b/docs/functions/vec4d.transformMat4.html @@ -0,0 +1,6 @@ +transformMat4 | wgpu-matrix

Function transformMat4

  • transform vec4 by 4x4 matrix

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      the vector

      +
    • m: BaseArgType

      The matrix.

      +
    • Optional dst: T

      optional vec4 to store result. If not passed a new one is created.

      +

    Returns T

    the transformed vector

    +
\ No newline at end of file diff --git a/docs/functions/vec4d.truncate.html b/docs/functions/vec4d.truncate.html new file mode 100644 index 0000000..629f31c --- /dev/null +++ b/docs/functions/vec4d.truncate.html @@ -0,0 +1,5 @@ +truncate | wgpu-matrix

Function truncate

  • Ensure a vector is not longer than a max length

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      The vec4 to limit

      +
    • maxLen: number

      The longest length of the resulting vector

      +
    • Optional dst: T

    Returns T

    The vector, shortened to maxLen if it's too long

    +
\ No newline at end of file diff --git a/docs/functions/vec4d.zero.html b/docs/functions/vec4d.zero.html new file mode 100644 index 0000000..fbb0d92 --- /dev/null +++ b/docs/functions/vec4d.zero.html @@ -0,0 +1,4 @@ +zero | wgpu-matrix
  • Zero's a vector

    +

    Type Parameters

    Parameters

    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The zeroed vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec4n.add.html b/docs/functions/vec4n.add.html new file mode 100644 index 0000000..bb56df1 --- /dev/null +++ b/docs/functions/vec4n.add.html @@ -0,0 +1,6 @@ +add | wgpu-matrix
  • Adds two vectors; assumes a and b have the same dimension.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that is the sum of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/vec4n.addScaled.html b/docs/functions/vec4n.addScaled.html new file mode 100644 index 0000000..59eea03 --- /dev/null +++ b/docs/functions/vec4n.addScaled.html @@ -0,0 +1,7 @@ +addScaled | wgpu-matrix

Function addScaled

  • Adds two vectors, scaling the 2nd; assumes a and b have the same dimension.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • scale: number

      Amount to scale b

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that is the sum of a + b * scale.

    +
\ No newline at end of file diff --git a/docs/functions/vec4n.ceil.html b/docs/functions/vec4n.ceil.html new file mode 100644 index 0000000..b8801e4 --- /dev/null +++ b/docs/functions/vec4n.ceil.html @@ -0,0 +1,5 @@ +ceil | wgpu-matrix
  • Applies Math.ceil to each element of vector

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that is the ceil of each element of v.

    +
\ No newline at end of file diff --git a/docs/functions/vec4n.clamp.html b/docs/functions/vec4n.clamp.html new file mode 100644 index 0000000..de961f2 --- /dev/null +++ b/docs/functions/vec4n.clamp.html @@ -0,0 +1,7 @@ +clamp | wgpu-matrix

Function clamp

  • Clamp each element of vector between min and max

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      Operand vector.

      +
    • min: number = 0

      Max value, default 1

      +
    • max: number = 1

      Min value, default 0

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that the clamped value of each element of v.

    +
\ No newline at end of file diff --git a/docs/functions/vec4n.clone.html b/docs/functions/vec4n.clone.html new file mode 100644 index 0000000..b5e3ddf --- /dev/null +++ b/docs/functions/vec4n.clone.html @@ -0,0 +1,6 @@ +clone | wgpu-matrix

Function clone

  • Copies a vector. (same as vec4.clone) +Also see vec4.create and vec4.set

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A copy of v.

    +
\ No newline at end of file diff --git a/docs/functions/vec4n.copy.html b/docs/functions/vec4n.copy.html new file mode 100644 index 0000000..b35d2da --- /dev/null +++ b/docs/functions/vec4n.copy.html @@ -0,0 +1,6 @@ +copy | wgpu-matrix
  • Copies a vector. (same as vec4.clone) +Also see vec4.create and vec4.set

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A copy of v.

    +
\ No newline at end of file diff --git a/docs/functions/vec4n.create.html b/docs/functions/vec4n.create.html new file mode 100644 index 0000000..9d55d88 --- /dev/null +++ b/docs/functions/vec4n.create.html @@ -0,0 +1,7 @@ +create | wgpu-matrix

Function create

  • Creates a vec4; may be called with x, y, z to set initial values.

    +

    Parameters

    • Optional x: number

      Initial x value.

      +
    • Optional y: number

      Initial y value.

      +
    • Optional z: number

      Initial z value.

      +
    • Optional w: number

      Initial w value.

      +

    Returns number[]

    the created vector

    +
\ No newline at end of file diff --git a/docs/functions/vec4n.dist.html b/docs/functions/vec4n.dist.html new file mode 100644 index 0000000..fed1802 --- /dev/null +++ b/docs/functions/vec4n.dist.html @@ -0,0 +1,5 @@ +dist | wgpu-matrix
  • Computes the distance between 2 points

    +

    Parameters

    Returns number

    distance between a and b

    +
\ No newline at end of file diff --git a/docs/functions/vec4n.distSq.html b/docs/functions/vec4n.distSq.html new file mode 100644 index 0000000..b4086a3 --- /dev/null +++ b/docs/functions/vec4n.distSq.html @@ -0,0 +1,5 @@ +distSq | wgpu-matrix

Function distSq

  • Computes the square of the distance between 2 points

    +

    Parameters

    Returns number

    square of the distance between a and b

    +
\ No newline at end of file diff --git a/docs/functions/vec4n.distance.html b/docs/functions/vec4n.distance.html new file mode 100644 index 0000000..498e916 --- /dev/null +++ b/docs/functions/vec4n.distance.html @@ -0,0 +1,5 @@ +distance | wgpu-matrix

Function distance

  • Computes the distance between 2 points

    +

    Parameters

    Returns number

    distance between a and b

    +
\ No newline at end of file diff --git a/docs/functions/vec4n.distanceSq.html b/docs/functions/vec4n.distanceSq.html new file mode 100644 index 0000000..16eb28f --- /dev/null +++ b/docs/functions/vec4n.distanceSq.html @@ -0,0 +1,5 @@ +distanceSq | wgpu-matrix

Function distanceSq

  • Computes the square of the distance between 2 points

    +

    Parameters

    Returns number

    square of the distance between a and b

    +
\ No newline at end of file diff --git a/docs/functions/vec4n.div.html b/docs/functions/vec4n.div.html new file mode 100644 index 0000000..daac98a --- /dev/null +++ b/docs/functions/vec4n.div.html @@ -0,0 +1,7 @@ +div | wgpu-matrix
  • Divides a vector by another vector (component-wise); assumes a and +b have the same length.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The vector of quotients of entries of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/vec4n.divScalar.html b/docs/functions/vec4n.divScalar.html new file mode 100644 index 0000000..073a896 --- /dev/null +++ b/docs/functions/vec4n.divScalar.html @@ -0,0 +1,6 @@ +divScalar | wgpu-matrix

Function divScalar

  • Divides a vector by a scalar.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • k: number

      The scalar.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The scaled vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec4n.divide.html b/docs/functions/vec4n.divide.html new file mode 100644 index 0000000..23d2096 --- /dev/null +++ b/docs/functions/vec4n.divide.html @@ -0,0 +1,7 @@ +divide | wgpu-matrix

Function divide

  • Divides a vector by another vector (component-wise); assumes a and +b have the same length.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The vector of quotients of entries of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/vec4n.dot.html b/docs/functions/vec4n.dot.html new file mode 100644 index 0000000..c54eef7 --- /dev/null +++ b/docs/functions/vec4n.dot.html @@ -0,0 +1,5 @@ +dot | wgpu-matrix
  • Computes the dot product of two vectors

    +

    Parameters

    Returns number

    dot product

    +
\ No newline at end of file diff --git a/docs/functions/vec4n.equals.html b/docs/functions/vec4n.equals.html new file mode 100644 index 0000000..0ca4fe2 --- /dev/null +++ b/docs/functions/vec4n.equals.html @@ -0,0 +1,5 @@ +equals | wgpu-matrix

Function equals

  • Check if 2 vectors are exactly equal

    +

    Parameters

    Returns boolean

    true if vectors are exactly equal

    +
\ No newline at end of file diff --git a/docs/functions/vec4n.equalsApproximately.html b/docs/functions/vec4n.equalsApproximately.html new file mode 100644 index 0000000..2bd8038 --- /dev/null +++ b/docs/functions/vec4n.equalsApproximately.html @@ -0,0 +1,5 @@ +equalsApproximately | wgpu-matrix

Function equalsApproximately

  • Check if 2 vectors are approximately equal

    +

    Parameters

    Returns boolean

    true if vectors are approximately equal

    +
\ No newline at end of file diff --git a/docs/functions/vec4n.floor.html b/docs/functions/vec4n.floor.html new file mode 100644 index 0000000..d949a56 --- /dev/null +++ b/docs/functions/vec4n.floor.html @@ -0,0 +1,5 @@ +floor | wgpu-matrix

Function floor

  • Applies Math.floor to each element of vector

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that is the floor of each element of v.

    +
\ No newline at end of file diff --git a/docs/functions/vec4n.fromValues.html b/docs/functions/vec4n.fromValues.html new file mode 100644 index 0000000..0267021 --- /dev/null +++ b/docs/functions/vec4n.fromValues.html @@ -0,0 +1,7 @@ +fromValues | wgpu-matrix

Function fromValues

  • Creates a vec4; may be called with x, y, z to set initial values.

    +

    Parameters

    • Optional x: number

      Initial x value.

      +
    • Optional y: number

      Initial y value.

      +
    • Optional z: number

      Initial z value.

      +
    • Optional w: number

      Initial w value.

      +

    Returns number[]

    the created vector

    +
\ No newline at end of file diff --git a/docs/functions/vec4n.inverse.html b/docs/functions/vec4n.inverse.html new file mode 100644 index 0000000..9bbfb7b --- /dev/null +++ b/docs/functions/vec4n.inverse.html @@ -0,0 +1,5 @@ +inverse | wgpu-matrix

Function inverse

  • Inverse a vector.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The inverted vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec4n.invert.html b/docs/functions/vec4n.invert.html new file mode 100644 index 0000000..b6c8807 --- /dev/null +++ b/docs/functions/vec4n.invert.html @@ -0,0 +1,5 @@ +invert | wgpu-matrix

Function invert

  • Inverse a vector.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The inverted vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec4n.len.html b/docs/functions/vec4n.len.html new file mode 100644 index 0000000..a42073c --- /dev/null +++ b/docs/functions/vec4n.len.html @@ -0,0 +1,4 @@ +len | wgpu-matrix
  • Computes the length of vector

    +

    Parameters

    Returns number

    length of vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec4n.lenSq.html b/docs/functions/vec4n.lenSq.html new file mode 100644 index 0000000..1a44b93 --- /dev/null +++ b/docs/functions/vec4n.lenSq.html @@ -0,0 +1,4 @@ +lenSq | wgpu-matrix

Function lenSq

  • Computes the square of the length of vector

    +

    Parameters

    Returns number

    square of the length of vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec4n.length.html b/docs/functions/vec4n.length.html new file mode 100644 index 0000000..62f9453 --- /dev/null +++ b/docs/functions/vec4n.length.html @@ -0,0 +1,4 @@ +length | wgpu-matrix

Function length

  • Computes the length of vector

    +

    Parameters

    Returns number

    length of vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec4n.lengthSq.html b/docs/functions/vec4n.lengthSq.html new file mode 100644 index 0000000..299b49e --- /dev/null +++ b/docs/functions/vec4n.lengthSq.html @@ -0,0 +1,4 @@ +lengthSq | wgpu-matrix

Function lengthSq

  • Computes the square of the length of vector

    +

    Parameters

    Returns number

    square of the length of vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec4n.lerp.html b/docs/functions/vec4n.lerp.html new file mode 100644 index 0000000..ebe7d82 --- /dev/null +++ b/docs/functions/vec4n.lerp.html @@ -0,0 +1,9 @@ +lerp | wgpu-matrix
  • Performs linear interpolation on two vectors. +Given vectors a and b and interpolation coefficient t, returns +a + t * (b - a).

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • t: number

      Interpolation coefficient.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The linear interpolated result.

    +
\ No newline at end of file diff --git a/docs/functions/vec4n.lerpV.html b/docs/functions/vec4n.lerpV.html new file mode 100644 index 0000000..b3fade4 --- /dev/null +++ b/docs/functions/vec4n.lerpV.html @@ -0,0 +1,9 @@ +lerpV | wgpu-matrix

Function lerpV

  • Performs linear interpolation on two vectors. +Given vectors a and b and interpolation coefficient vector t, returns +a + t * (b - a).

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • t: BaseArgType

      Interpolation coefficients vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    the linear interpolated result.

    +
\ No newline at end of file diff --git a/docs/functions/vec4n.max.html b/docs/functions/vec4n.max.html new file mode 100644 index 0000000..4471eac --- /dev/null +++ b/docs/functions/vec4n.max.html @@ -0,0 +1,8 @@ +max | wgpu-matrix
  • Return max values of two vectors. +Given vectors a and b returns +[max(a[0], b[0]), max(a[1], b[1]), max(a[2], b[2])].

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The max components vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec4n.midpoint.html b/docs/functions/vec4n.midpoint.html new file mode 100644 index 0000000..3cbde1d --- /dev/null +++ b/docs/functions/vec4n.midpoint.html @@ -0,0 +1,5 @@ +midpoint | wgpu-matrix

Function midpoint

  • Return the vector exactly between 2 endpoint vectors

    +

    Type Parameters

    Parameters

    Returns T

    The vector exactly residing between endpoints 1 and 2

    +
\ No newline at end of file diff --git a/docs/functions/vec4n.min.html b/docs/functions/vec4n.min.html new file mode 100644 index 0000000..e09d8c5 --- /dev/null +++ b/docs/functions/vec4n.min.html @@ -0,0 +1,8 @@ +min | wgpu-matrix
  • Return min values of two vectors. +Given vectors a and b returns +[min(a[0], b[0]), min(a[1], b[1]), min(a[2], b[2])].

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The min components vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec4n.mul.html b/docs/functions/vec4n.mul.html new file mode 100644 index 0000000..600e597 --- /dev/null +++ b/docs/functions/vec4n.mul.html @@ -0,0 +1,7 @@ +mul | wgpu-matrix
  • Multiplies a vector by another vector (component-wise); assumes a and +b have the same length.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The vector of products of entries of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/vec4n.mulScalar.html b/docs/functions/vec4n.mulScalar.html new file mode 100644 index 0000000..4653e05 --- /dev/null +++ b/docs/functions/vec4n.mulScalar.html @@ -0,0 +1,6 @@ +mulScalar | wgpu-matrix

Function mulScalar

  • Multiplies a vector by a scalar.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • k: number

      The scalar.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The scaled vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec4n.multiply.html b/docs/functions/vec4n.multiply.html new file mode 100644 index 0000000..30bf190 --- /dev/null +++ b/docs/functions/vec4n.multiply.html @@ -0,0 +1,7 @@ +multiply | wgpu-matrix

Function multiply

  • Multiplies a vector by another vector (component-wise); assumes a and +b have the same length.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The vector of products of entries of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/vec4n.negate.html b/docs/functions/vec4n.negate.html new file mode 100644 index 0000000..14db8ed --- /dev/null +++ b/docs/functions/vec4n.negate.html @@ -0,0 +1,5 @@ +negate | wgpu-matrix

Function negate

  • Negates a vector.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    -v.

    +
\ No newline at end of file diff --git a/docs/functions/vec4n.normalize.html b/docs/functions/vec4n.normalize.html new file mode 100644 index 0000000..1d4da05 --- /dev/null +++ b/docs/functions/vec4n.normalize.html @@ -0,0 +1,5 @@ +normalize | wgpu-matrix

Function normalize

  • Divides a vector by its Euclidean length and returns the quotient.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The normalized vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec4n.round.html b/docs/functions/vec4n.round.html new file mode 100644 index 0000000..fb70920 --- /dev/null +++ b/docs/functions/vec4n.round.html @@ -0,0 +1,5 @@ +round | wgpu-matrix

Function round

  • Applies Math.round to each element of vector

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that is the round of each element of v.

    +
\ No newline at end of file diff --git a/docs/functions/vec4n.scale.html b/docs/functions/vec4n.scale.html new file mode 100644 index 0000000..c9c22bd --- /dev/null +++ b/docs/functions/vec4n.scale.html @@ -0,0 +1,6 @@ +scale | wgpu-matrix

Function scale

  • Multiplies a vector by a scalar.

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      The vector.

      +
    • k: number

      The scalar.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The scaled vector.

    +
\ No newline at end of file diff --git a/docs/functions/vec4n.set.html b/docs/functions/vec4n.set.html new file mode 100644 index 0000000..be6ca55 --- /dev/null +++ b/docs/functions/vec4n.set.html @@ -0,0 +1,9 @@ +set | wgpu-matrix
  • Sets the values of a Vec4 +Also see vec4.create and vec4.copy

    +

    Type Parameters

    Parameters

    • x: number

      first value

      +
    • y: number

      second value

      +
    • z: number

      third value

      +
    • w: number

      fourth value

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector with its elements set.

    +
\ No newline at end of file diff --git a/docs/functions/vec4n.setLength.html b/docs/functions/vec4n.setLength.html new file mode 100644 index 0000000..7d509e8 --- /dev/null +++ b/docs/functions/vec4n.setLength.html @@ -0,0 +1,5 @@ +setLength | wgpu-matrix

Function setLength

  • Treat a 4D vector as a direction and set it's length

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      The vec4 to lengthen

      +
    • len: number

      The length of the resulting vector

      +
    • Optional dst: T

    Returns T

    The lengthened vector

    +
\ No newline at end of file diff --git a/docs/functions/vec4n.sub.html b/docs/functions/vec4n.sub.html new file mode 100644 index 0000000..3ef6e0d --- /dev/null +++ b/docs/functions/vec4n.sub.html @@ -0,0 +1,6 @@ +sub | wgpu-matrix
  • Subtracts two vectors.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that is the difference of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/vec4n.subtract.html b/docs/functions/vec4n.subtract.html new file mode 100644 index 0000000..e46e157 --- /dev/null +++ b/docs/functions/vec4n.subtract.html @@ -0,0 +1,6 @@ +subtract | wgpu-matrix

Function subtract

  • Subtracts two vectors.

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      Operand vector.

      +
    • b: BaseArgType

      Operand vector.

      +
    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    A vector that is the difference of a and b.

    +
\ No newline at end of file diff --git a/docs/functions/vec4n.transformMat4.html b/docs/functions/vec4n.transformMat4.html new file mode 100644 index 0000000..b432690 --- /dev/null +++ b/docs/functions/vec4n.transformMat4.html @@ -0,0 +1,6 @@ +transformMat4 | wgpu-matrix

Function transformMat4

  • transform vec4 by 4x4 matrix

    +

    Type Parameters

    Parameters

    • v: BaseArgType

      the vector

      +
    • m: BaseArgType

      The matrix.

      +
    • Optional dst: T

      optional vec4 to store result. If not passed a new one is created.

      +

    Returns T

    the transformed vector

    +
\ No newline at end of file diff --git a/docs/functions/vec4n.truncate.html b/docs/functions/vec4n.truncate.html new file mode 100644 index 0000000..3eaf8f2 --- /dev/null +++ b/docs/functions/vec4n.truncate.html @@ -0,0 +1,5 @@ +truncate | wgpu-matrix

Function truncate

  • Ensure a vector is not longer than a max length

    +

    Type Parameters

    Parameters

    • a: BaseArgType

      The vec4 to limit

      +
    • maxLen: number

      The longest length of the resulting vector

      +
    • Optional dst: T

    Returns T

    The vector, shortened to maxLen if it's too long

    +
\ No newline at end of file diff --git a/docs/functions/vec4n.zero.html b/docs/functions/vec4n.zero.html new file mode 100644 index 0000000..2c0c86f --- /dev/null +++ b/docs/functions/vec4n.zero.html @@ -0,0 +1,4 @@ +zero | wgpu-matrix
  • Zero's a vector

    +

    Type Parameters

    Parameters

    • Optional dst: T

      vector to hold result. If not passed in a new one is created.

      +

    Returns T

    The zeroed vector.

    +
\ No newline at end of file diff --git a/docs/index.html b/docs/index.html index 073f887..86e3933 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1,71 +1,87 @@ -wgpu-matrix

wgpu-matrix

wgpu-matrix

NPM Package

+wgpu-matrix

wgpu-matrix

wgpu-matrix

NPM Package

Fast 3d math library for webgpu

-

Why another 3d math library?

    -
  • Most other 3D math libraries are designed for WebGL, not WebGPU
      +
        +
      • Most other 3D math libraries are designed for WebGL, not WebGPU +
        • WebGPU uses clip space Z 0 to 1, vs WebGL -1 to 1. So ortho, perspective, frustum are different
        • -
        • WebGPU mat3s are 12 floats (padded), WebGL they're 9.
        • +
        • WebGPU mat3s are 12 floats (padded), WebGL they're 9.
      • -
      • Many other 3D math libraries are overly verbose
          -
        • compare

          -
          // wgpu-matrix
          const t = mat4.translation([x, y, z]);
          const p = mat4.perspective(fov, aspect, near, far);
          const r = mat4.rotationX(rad); -
          -
          // gl-matrix
          const t = mat4.create();
          mat4.fromTranslation(t, [x, y, z]);

          const p = mat4.create();
          mat4.perspective(p, fov, aspect, near, far);

          const r = mat4.create();
          mat4.fromXRotation(r, rad); -
          +
        • Many other 3D math libraries are overly verbose +
            +
          • +

            compare

            +
            // wgpu-matrix
            const t = mat4.translation([x, y, z]);
            const p = mat4.perspective(fov, aspect, near, far);
            const r = mat4.rotationX(rad); +
            + +
            // gl-matrix
            const t = mat4.create();
            mat4.fromTranslation(t, [x, y, z]);

            const p = mat4.create();
            mat4.perspective(p, fov, aspect, near, far);

            const r = mat4.create();
            mat4.fromXRotation(r, rad); +
            +

            note that if you want to pre-create matrices you can still do this in wgpu-matrix

            -
            const t = mat4.create();
            mat4.translation([x, y, z], t);

            const p = mat4.create();
            mat4.perspective(fov, aspect, near, far, p);

            const r = mat4.create();
            mat4.rotationX(rad, r); -
            +
            const t = mat4.create();
            mat4.translation([x, y, z], t);

            const p = mat4.create();
            mat4.perspective(fov, aspect, near, far, p);

            const r = mat4.create();
            mat4.rotationX(rad, r); +
            +
        -

        Usage

        import {
        vec3,
        mat4,
        } from 'https://wgpu-matrix.org/dist/2.x/wgpu-matrix.module.js';

        const fov = 60 * Math.PI / 180
        const aspect = width / height;
        const near = 0.1;
        const far = 1000;
        const perspective = mat4.perspective(fov, aspect, near, far);

        const eye = [3, 5, 10];
        const target = [0, 4, 0];
        const up = [0, 1, 0];
        const view = mat4.lookAt(eye, target, up); -
        +
        import {
        vec3,
        mat4,
        } from 'https://wgpu-matrix.org/dist/3.x/wgpu-matrix.module.js';

        const fov = 60 * Math.PI / 180
        const aspect = width / height;
        const near = 0.1;
        const far = 1000;
        const perspective = mat4.perspective(fov, aspect, near, far);

        const eye = [3, 5, 10];
        const target = [0, 4, 0];
        const up = [0, 1, 0];
        const view = mat4.lookAt(eye, target, up); +
        +

        Note: for translation, rotation, and scaling there are 2 versions of each function. One generates a translation, rotation, or scaling matrix. The other translates, rotates, or scales a matrix.

        -
        const t = mat4.translation([1, 2, 3]);    // a translation matrix
        const r = mat4.rotationX(Math.PI * 0.5); // a rotation matrix
        const s = mat4.scaling([1, 2, 3]); // a scaling matrix -
        -
        const m = mat4.identity();
        const t = mat4.translate(m, [1, 2, 3]); // m * translation([1, 2, 3])
        const r = mat4.rotateX(m, Math.PI * 0.5); // m * rotationX(Math.PI * 0.5)
        const s = mat4.scale(m, [1, 2, 3]); // m * scaling([1, 2, 3]) -
        +
        const t = mat4.translation([1, 2, 3]);    // a translation matrix
        const r = mat4.rotationX(Math.PI * 0.5); // a rotation matrix
        const s = mat4.scaling([1, 2, 3]); // a scaling matrix +
        + +
        const m = mat4.identity();
        const t = mat4.translate(m, [1, 2, 3]); // m * translation([1, 2, 3])
        const r = mat4.rotateX(m, Math.PI * 0.5); // m * rotationX(Math.PI * 0.5)
        const s = mat4.scale(m, [1, 2, 3]); // m * scaling([1, 2, 3]) +
        +

        Functions take an optional destination to hold the result.

        -
        const m = mat4.create();            // m = new mat4
        mat4.identity(m); // m = identity
        mat4.translate(m, [1, 2, 3], m); // m *= translation([1, 2, 3])
        mat4.rotateX(m, Math.PI * 0.5, m); // m *= rotationX(Math.PI * 0.5)
        mat4.scale(m, [1, 2, 3], m); // m *= scaling([1, 2, 3]) -
        +
        const m = mat4.create();            // m = new mat4
        mat4.identity(m); // m = identity
        mat4.translate(m, [1, 2, 3], m); // m *= translation([1, 2, 3])
        mat4.rotateX(m, Math.PI * 0.5, m); // m *= rotationX(Math.PI * 0.5)
        mat4.scale(m, [1, 2, 3], m); // m *= scaling([1, 2, 3]) +
        +

        There is also the minified version

        -
        import {
        vec3,
        mat4,
        } from 'https://wgpu-matrix.org/dist/2.x/wgpu-matrix.module.min.js';

        // ... etc ... -
        +
        import {
        vec3,
        mat4,
        } from 'https://wgpu-matrix.org/dist/3.x/wgpu-matrix.module.min.js';

        // ... etc ... +
        +

        and a UMD version

        -
        <script src="https://wgpu-matrix.org/dist/2.x/wgpu-matrix.js"></script>
        <script>
        const { mat4, vec3 } = wgpuMatrix;
        const m = mat4.identity();
        ...
        </script> -
        +
        <script src="https://wgpu-matrix.org/dist/3.x/wgpu-matrix.js"></script>
        <script>
        const { mat4, vec3 } = wgpuMatrix;
        const m = mat4.identity();
        ...
        </script> +
        +

        or UDM min version

        -
        <script src="https://wgpu-matrix.org/dist/2.x/wgpu-matrix.min.js"></script>
        ... -
        +
        <script src="https://wgpu-matrix.org/dist/3.x/wgpu-matrix.min.js"></script>
        ... +
        +

        or via npm

        -
        npm install --save wgpu-matrix
        -
        +
        npm install --save wgpu-matrix
        +
        +

        then using a build process

        -
        import {vec3, mat3} from 'wgpu-matrix';

        // ... etc ... -
        +
        import {vec3, mat3} from 'wgpu-matrix';

        // ... etc ... +
        +

        Example

        -

        Download

          + -

          Notes

          mat4.perspective, +

          mat4.perspective, mat4.ortho, and mat4.frustum all return matrices with Z clip space from 0 to 1 (unlike most WebGL matrix libraries which return -1 to 1)

          mat4.create makes an all zero matrix if passed no parameters. If you want an identity matrix call mat4.identity

          -

          Important!

          mat3 uses the space of 12 elements

          -
          // a mat3
          [
          xx, xy, xz, ?
          yx, yy, yz, ?
          zx, zy, zz, ?
          ] -
          +

          mat3 uses the space of 12 elements

          +
          // a mat3
          [
          xx, xy, xz, ?
          yx, yy, yz, ?
          zx, zy, zz, ?
          ] +
          +

          This is because WebGPU requires mat3s to be in this format and since this library is for WebGPU it makes sense to match so you can manipulate mat3s in TypeArrays directly.

          @@ -74,48 +90,92 @@ padded to 4 floats! In other words, if you declare

          struct Foo {
          bar: vec3<f32>[3];
          };
          +

          then bar[0] is at byte offset 0, bar[1] at byte offset 16, bar[2] at byte offset 32.

          See the WGSL spec on alignment and size.

          -

          Columns vs Rows

          WebGPU follows the same conventions as OpenGL, Vulkan, Metal for matrices. Some people call this "column major". The issue is the columns of +

          WebGPU follows the same conventions as OpenGL, Vulkan, Metal for matrices. Some people call this "column major". The issue is the columns of a traditional "math" matrix are stored as rows when declaring a matrix in code.

          -
          [
          x1, x2, x3, x4, // <- column 0
          y1, y2, y3, y4, // <- column 1
          z1, z2, z3, z4, // <- column 2
          w1, w2, w3, w4, // <- column 3
          ] -
          +
          [
          x1, x2, x3, x4, // <- column 0
          y1, y2, y3, y4, // <- column 1
          z1, z2, z3, z4, // <- column 2
          w1, w2, w3, w4, // <- column 3
          ] +
          +

          To put it another way, the translation vector is in elements 12, 13, 14

          -
          [
          xx, xy, xz, 0, // <- x-axis
          yx, yy, yz, 0, // <- y-axis
          zx, zy, zz, 0, // <- z-axis
          tx, ty, tz, 1, // <- translation
          ] -
          +
          [
          xx, xy, xz, 0, // <- x-axis
          yx, yy, yz, 0, // <- y-axis
          zx, zy, zz, 0, // <- z-axis
          tx, ty, tz, 1, // <- translation
          ] +
          +

          This issue has confused programmers since at least the early 90s 😌

          -

          Performance vs Convenience

          Most functions take an optional destination as the last argument. -If you don't supply it, a new one (vector, matrix) will be created +

          Most functions take an optional destination as the last argument. +If you don't supply it, a new one (vector, matrix) will be created for you.

          -
          // convenient usage

          const persp = mat4.perspective(fov, aspect, near, far);
          const camera = mat4.lookAt(eye, target, up);
          const view = mat4.inverse(camera); -
          -
          // performant usage

          // at init time
          const persp = mat4.create();
          const camera = mat4.create();
          const view = mat4.create();

          // at usage time
          mat4.perspective(fov, aspect, near, far, persp);
          mat4.lookAt(eye, target, up, camera);
          mat4.inverse(camera, view); -
          +
          // convenient usage

          const persp = mat4.perspective(fov, aspect, near, far);
          const camera = mat4.lookAt(eye, target, up);
          const view = mat4.inverse(camera); +
          + +
          // performant usage

          // at init time
          const persp = mat4.create();
          const camera = mat4.create();
          const view = mat4.create();

          // at usage time
          mat4.perspective(fov, aspect, near, far, persp);
          mat4.lookAt(eye, target, up, camera);
          mat4.inverse(camera, view); +
          +

          For me, most of the stuff I do in WebGPU, the supposed performance I might lose -from using the convenient style is so small as to be unmeasurable. I'd prefer to +from using the convenient style is so small as to be unmeasurable. I'd prefer to stay convenient and then, if and only if I find a performance issue, then I might bother to switch to the performant style.

          As the saying goes premature optimization is the root of all evil. 😉

          -

          Migration

          1.x -> 2.x

            -
          • mat4.lookAt -changed from a "camera matrix" to a "view matrix" (same as gluLookAt). +

            In JavaScript there should be no difference in the API except for the removable of setDefaultType.

            +

            In TypeScript, 3.x should mostly be type compatible with 2.x. +3.x is an attempt to fix the casting that was necessary in 2.x.

            +
            // 2.x
            device.queue.writeData(buffer, 0, mat4.identity() as Float32Array); // sadness! 😭

            // 3.x
            device.queue.writeData(buffer, 0, mat4.identity()); // Yay! 🎉 +
            + +

            In TypeScript the differences are as follows

            +

            In 3.x each function has a default type but if you pass it +a destination it returns the type of the destination

            +
            mat4.identity()                       // returns Float32Array
            mat4.identity(new Float32Array(16)); // returns Float32Array
            mat4.identity(new Float64Array(16)); // returns Float32Array
            mat4.identity(new Array(16)); // returns number[] +
            + +
            const a: Mat4 = ...;    // a = Float32Array
            const b: Mat4d = ...; // b = Float64Array
            const c: Mat4n = ...; // c = number[] +
            + +

            This is means code like this

            +
            const position: Mat4 = [10, 20, 30];
            +
            + +

            No longer works because Mat4 is a Float32Array.

            +

            BUT, functions take any of the normal types as an argument just like they used to

            +
            const position = [10, 20, 30];          // number[]
            const target = vec3.create(1, 2, 3); // Float32Array
            const up = new Float64Array([0, 1, 0]); // Float64Array

            // Works fine, even those types are different, just like 2.x did
            const view = mat4.lookAt(position, target, up); // Float32Array +
            + +

            If you really want types for each concrete type there's

            +
              +
            • Float32Array types: Mat3, Mat4, Quat, Vec2, Vec3, Vec4
            • +
            • Float64Array types: Mat3d, Mat4d, Quatd, Vec2d, Vec3d, Vec4d,
            • +
            • number[] types: Mat3n, Mat4n, Quatn, Vec2n, Vec3n, Vec4n
            • +
            +
            mat4.identity()   // returns Float32Array
            mat4d.identity() // returns Float64Array
            mat4n.identity() // returns number[] +
            + +

            Similarly there's mat3d, mat3n, quatd, quatn, +vec2d, vec2n, vec3d, vec3n, vec4d, vec4n.

            +

            Note: that in general you're unlikely to need any of these. Just use the +same ones you were using in 2.x

            +
              +
            • mat4.lookAt +changed from a "camera matrix" to a "view matrix" (same as gluLookAt). If you want a matrix that orients an something in world space see mat4.aim. Sorry about this change but people are used to lookAt making a a view matrix and it seemed prudent to make this change now and save more people from frustration going forward.
            -

            Development

            git clone https://github.com/greggman/wgpu-matrix.git
            cd wgpu-matrix
            npm i
            npm run build
            npm test -
            +
            git clone https://github.com/greggman/wgpu-matrix.git
            cd wgpu-matrix
            npm i
            npm run build
            npm test +
            +

            You can run tests in the browser by starting a local server

            -
            npx servez
            -
            -

            Now go to wherever your server serves pages. In the case of servez that's +

            npx servez
            +
            + +

            Now go to wherever your server serves pages. In the case of servez that's probably http://localhost:8080/test/.

            By default the tests test the minified version. To test the source use src=true as in http://localhost:8080/test/?src=true.

            To limit which tests are run use grep=<regex>. For example -http://localhost:8080/test/?src=true&grep=mat3.*?translate +http://localhost:8080/test/?src=true&grep=mat3.*?translate runs only tests with mat3 followed by translate in the name of test.

            -

            License

            MIT

            -
\ No newline at end of file +

MIT

+
\ No newline at end of file diff --git a/docs/media/LICENSE.md b/docs/media/LICENSE.md new file mode 100644 index 0000000..d3ce3f2 --- /dev/null +++ b/docs/media/LICENSE.md @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 Gregg Tavares + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/docs/modules.html b/docs/modules.html index 03f7154..89fc64e 100644 --- a/docs/modules.html +++ b/docs/modules.html @@ -1,15 +1,53 @@ -wgpu-matrix

wgpu-matrix

Index

Namespaces

mat3 +wgpu-matrix
\ No newline at end of file +Vec4Arg +Vec4Type +Vec4d +Vec4n +
\ No newline at end of file diff --git a/docs/modules/mat3.html b/docs/modules/mat3.html index 06be7a2..3f120b7 100644 --- a/docs/modules/mat3.html +++ b/docs/modules/mat3.html @@ -1,6 +1,4 @@ -mat3 | wgpu-matrix

Namespace mat3

References

Type Aliases

Functions

clone +mat3 | wgpu-matrix

References

Renames and re-exports Mat3
\ No newline at end of file +
\ No newline at end of file diff --git a/docs/modules/mat3d.html b/docs/modules/mat3d.html new file mode 100644 index 0000000..483cfbb --- /dev/null +++ b/docs/modules/mat3d.html @@ -0,0 +1,30 @@ +mat3d | wgpu-matrix
\ No newline at end of file diff --git a/docs/modules/mat3n.html b/docs/modules/mat3n.html new file mode 100644 index 0000000..6515b59 --- /dev/null +++ b/docs/modules/mat3n.html @@ -0,0 +1,30 @@ +mat3n | wgpu-matrix
\ No newline at end of file diff --git a/docs/modules/mat4.html b/docs/modules/mat4.html index f6a0c6f..1669023 100644 --- a/docs/modules/mat4.html +++ b/docs/modules/mat4.html @@ -1,6 +1,4 @@ -mat4 | wgpu-matrix

Namespace mat4

References

Type Aliases

Functions

aim +mat4 | wgpu-matrix

References

Renames and re-exports Mat4
\ No newline at end of file +
\ No newline at end of file diff --git a/docs/modules/mat4d.html b/docs/modules/mat4d.html new file mode 100644 index 0000000..8f57d79 --- /dev/null +++ b/docs/modules/mat4d.html @@ -0,0 +1,46 @@ +mat4d | wgpu-matrix
\ No newline at end of file diff --git a/docs/modules/mat4n.html b/docs/modules/mat4n.html new file mode 100644 index 0000000..5c6c1b7 --- /dev/null +++ b/docs/modules/mat4n.html @@ -0,0 +1,46 @@ +mat4n | wgpu-matrix
\ No newline at end of file diff --git a/docs/modules/quat.html b/docs/modules/quat.html index 5e9aa83..fa1ec5b 100644 --- a/docs/modules/quat.html +++ b/docs/modules/quat.html @@ -1,6 +1,4 @@ -quat | wgpu-matrix

Namespace quat

References

Type Aliases

Functions

add +quat | wgpu-matrix

References

Renames and re-exports Quat
\ No newline at end of file +
\ No newline at end of file diff --git a/docs/modules/quatd.html b/docs/modules/quatd.html new file mode 100644 index 0000000..cd6579f --- /dev/null +++ b/docs/modules/quatd.html @@ -0,0 +1,37 @@ +quatd | wgpu-matrix
\ No newline at end of file diff --git a/docs/modules/quatn.html b/docs/modules/quatn.html new file mode 100644 index 0000000..a702d86 --- /dev/null +++ b/docs/modules/quatn.html @@ -0,0 +1,37 @@ +quatn | wgpu-matrix
\ No newline at end of file diff --git a/docs/modules/utils.html b/docs/modules/utils.html index 682cf4a..625bbbd 100644 --- a/docs/modules/utils.html +++ b/docs/modules/utils.html @@ -1,8 +1,8 @@ -utils | wgpu-matrix

Namespace utils

Index

Variables

EPSILON +utils | wgpu-matrix
\ No newline at end of file +
\ No newline at end of file diff --git a/docs/modules/vec2.html b/docs/modules/vec2.html index 84199c3..b04e76f 100644 --- a/docs/modules/vec2.html +++ b/docs/modules/vec2.html @@ -1,5 +1,4 @@ -vec2 | wgpu-matrix

Namespace vec2

References

Functions

add +vec2 | wgpu-matrix

Namespace vec2

Index

Functions

References

Renames and re-exports Vec2
\ No newline at end of file +
\ No newline at end of file diff --git a/docs/modules/vec2d.html b/docs/modules/vec2d.html new file mode 100644 index 0000000..a772434 --- /dev/null +++ b/docs/modules/vec2d.html @@ -0,0 +1,50 @@ +vec2d | wgpu-matrix
\ No newline at end of file diff --git a/docs/modules/vec2n.html b/docs/modules/vec2n.html new file mode 100644 index 0000000..d62af0b --- /dev/null +++ b/docs/modules/vec2n.html @@ -0,0 +1,50 @@ +vec2n | wgpu-matrix
\ No newline at end of file diff --git a/docs/modules/vec3.html b/docs/modules/vec3.html index 6137304..c905272 100644 --- a/docs/modules/vec3.html +++ b/docs/modules/vec3.html @@ -1,5 +1,4 @@ -vec3 | wgpu-matrix

Namespace vec3

References

Functions

add +vec3 | wgpu-matrix

Namespace vec3

Index

Functions

References

Renames and re-exports Vec3
\ No newline at end of file +
\ No newline at end of file diff --git a/docs/modules/vec3d.html b/docs/modules/vec3d.html new file mode 100644 index 0000000..f67fb67 --- /dev/null +++ b/docs/modules/vec3d.html @@ -0,0 +1,57 @@ +vec3d | wgpu-matrix
\ No newline at end of file diff --git a/docs/modules/vec3n.html b/docs/modules/vec3n.html new file mode 100644 index 0000000..3df38eb --- /dev/null +++ b/docs/modules/vec3n.html @@ -0,0 +1,57 @@ +vec3n | wgpu-matrix
\ No newline at end of file diff --git a/docs/modules/vec4.html b/docs/modules/vec4.html index e906032..4ef5144 100644 --- a/docs/modules/vec4.html +++ b/docs/modules/vec4.html @@ -1,5 +1,4 @@ -vec4 | wgpu-matrix

Namespace vec4

References

Functions

add +vec4 | wgpu-matrix

References

Renames and re-exports Vec4
\ No newline at end of file +
\ No newline at end of file diff --git a/docs/modules/vec4d.html b/docs/modules/vec4d.html new file mode 100644 index 0000000..f8686b6 --- /dev/null +++ b/docs/modules/vec4d.html @@ -0,0 +1,45 @@ +vec4d | wgpu-matrix
\ No newline at end of file diff --git a/docs/modules/vec4n.html b/docs/modules/vec4n.html new file mode 100644 index 0000000..c5c136c --- /dev/null +++ b/docs/modules/vec4n.html @@ -0,0 +1,45 @@ +vec4n | wgpu-matrix
\ No newline at end of file diff --git a/docs/types/BaseArgType.html b/docs/types/BaseArgType.html new file mode 100644 index 0000000..ffe425e --- /dev/null +++ b/docs/types/BaseArgType.html @@ -0,0 +1,3 @@ +BaseArgType | wgpu-matrix

Type Alias BaseArgType

BaseArgType: Float32Array | Float64Array | number[]

The types you can pass to most functions that take an +array of numbers.

+
\ No newline at end of file diff --git a/docs/types/BaseCtor.html b/docs/types/BaseCtor.html new file mode 100644 index 0000000..f14387c --- /dev/null +++ b/docs/types/BaseCtor.html @@ -0,0 +1 @@ +BaseCtor | wgpu-matrix

Type Alias BaseCtor<T>

BaseCtor<T>: (new (n) => T)

Type Parameters

Type declaration

    • new (n): T
    • Parameters

      • n: number

      Returns T

\ No newline at end of file diff --git a/docs/types/Mat3-1.html b/docs/types/Mat3-1.html index 11c4c2d..eb8ac94 100644 --- a/docs/types/Mat3-1.html +++ b/docs/types/Mat3-1.html @@ -1,4 +1 @@ -Mat3 | wgpu-matrix

Type alias Mat3

Mat3: number[] | Float32Array | Float64Array

A JavaScript array with 12 values, a Float32Array with 12 values, or a Float64Array with 12 values. -When created by the library will create the default type which is Float32Array -but can be set by calling mat3.setDefaultType.

-
\ No newline at end of file +Mat3 | wgpu-matrix

Type Alias Mat3

Mat3: Mat3Type<Float32Array>
\ No newline at end of file diff --git a/docs/types/Mat3Arg.html b/docs/types/Mat3Arg.html new file mode 100644 index 0000000..7663174 --- /dev/null +++ b/docs/types/Mat3Arg.html @@ -0,0 +1,2 @@ +Mat3Arg | wgpu-matrix

Type Alias Mat3Arg

Mat3Arg: BaseArgType

A JavaScript array with 12 values, a Float32Array with 12 values, or a Float64Array with 12 values.

+
\ No newline at end of file diff --git a/docs/types/Mat3Type.html b/docs/types/Mat3Type.html new file mode 100644 index 0000000..1f34acd --- /dev/null +++ b/docs/types/Mat3Type.html @@ -0,0 +1,2 @@ +Mat3Type | wgpu-matrix

Type Alias Mat3Type<T>

Mat3Type<T>: T

A specific concrete 3x3 element vector.

+

Type Parameters

\ No newline at end of file diff --git a/docs/types/Mat3d-1.html b/docs/types/Mat3d-1.html new file mode 100644 index 0000000..58463e4 --- /dev/null +++ b/docs/types/Mat3d-1.html @@ -0,0 +1 @@ +Mat3d | wgpu-matrix

Type Alias Mat3d

Mat3d: Mat3Type<Float64Array>
\ No newline at end of file diff --git a/docs/types/Mat3n-1.html b/docs/types/Mat3n-1.html new file mode 100644 index 0000000..d941865 --- /dev/null +++ b/docs/types/Mat3n-1.html @@ -0,0 +1 @@ +Mat3n | wgpu-matrix

Type Alias Mat3n

Mat3n: Mat3Type<number[]>
\ No newline at end of file diff --git a/docs/types/Mat4-1.html b/docs/types/Mat4-1.html index 1da7ffe..75392fc 100644 --- a/docs/types/Mat4-1.html +++ b/docs/types/Mat4-1.html @@ -1,4 +1 @@ -Mat4 | wgpu-matrix

Type alias Mat4

Mat4: number[] | Float32Array | Float64Array

A JavaScript array with 16 values, a Float32Array with 16 values, or a Float64Array with 16 values. -When created by the library will create the default type which is Float32Array -but can be set by calling mat4.setDefaultType.

-
\ No newline at end of file +Mat4 | wgpu-matrix

Type Alias Mat4

Mat4: Mat4Type<Float32Array>
\ No newline at end of file diff --git a/docs/types/Mat4Arg.html b/docs/types/Mat4Arg.html new file mode 100644 index 0000000..eec7f98 --- /dev/null +++ b/docs/types/Mat4Arg.html @@ -0,0 +1,2 @@ +Mat4Arg | wgpu-matrix

Type Alias Mat4Arg

Mat4Arg: BaseArgType

A JavaScript array with 16 values, a Float32Array with 16 values, or a Float64Array with 16 values.

+
\ No newline at end of file diff --git a/docs/types/Mat4Type.html b/docs/types/Mat4Type.html new file mode 100644 index 0000000..445d4ac --- /dev/null +++ b/docs/types/Mat4Type.html @@ -0,0 +1,2 @@ +Mat4Type | wgpu-matrix

Type Alias Mat4Type<T>

Mat4Type<T>: T

A specific concrete 4x4 Matrix Type

+

Type Parameters

\ No newline at end of file diff --git a/docs/types/Mat4d-1.html b/docs/types/Mat4d-1.html new file mode 100644 index 0000000..f9b2fbc --- /dev/null +++ b/docs/types/Mat4d-1.html @@ -0,0 +1 @@ +Mat4d | wgpu-matrix

Type Alias Mat4d

Mat4d: Mat4Type<Float64Array>
\ No newline at end of file diff --git a/docs/types/Mat4n-1.html b/docs/types/Mat4n-1.html new file mode 100644 index 0000000..bbe62f3 --- /dev/null +++ b/docs/types/Mat4n-1.html @@ -0,0 +1 @@ +Mat4n | wgpu-matrix

Type Alias Mat4n

Mat4n: Mat4Type<number[]>
\ No newline at end of file diff --git a/docs/types/Quat-1.html b/docs/types/Quat-1.html index 301577c..851b26a 100644 --- a/docs/types/Quat-1.html +++ b/docs/types/Quat-1.html @@ -1,4 +1 @@ -Quat | wgpu-matrix

Type alias Quat

Quat: number[] | Float32Array | Float64Array

A JavaScript array with 4 values, Float32Array with 4 values, or a Float64Array with 4 values. -When created by the library will create the default type which is Float32Array -but can be set by calling quat.setDefaultType.

-
\ No newline at end of file +Quat | wgpu-matrix

Type Alias Quat

Quat: QuatType<Float32Array>
\ No newline at end of file diff --git a/docs/types/QuatArg.html b/docs/types/QuatArg.html new file mode 100644 index 0000000..cebbd5c --- /dev/null +++ b/docs/types/QuatArg.html @@ -0,0 +1,2 @@ +QuatArg | wgpu-matrix

Type Alias QuatArg

QuatArg: BaseArgType

A JavaScript array with 4 values, a Float32Array with 4 values, or a Float64Array with 4 values.

+
\ No newline at end of file diff --git a/docs/types/QuatType.html b/docs/types/QuatType.html new file mode 100644 index 0000000..ab6f590 --- /dev/null +++ b/docs/types/QuatType.html @@ -0,0 +1,2 @@ +QuatType | wgpu-matrix

Type Alias QuatType<T>

QuatType<T>: T

A specific concrete 4x4 Matrix Type

+

Type Parameters

\ No newline at end of file diff --git a/docs/types/Quatd-1.html b/docs/types/Quatd-1.html new file mode 100644 index 0000000..81509b7 --- /dev/null +++ b/docs/types/Quatd-1.html @@ -0,0 +1 @@ +Quatd | wgpu-matrix

Type Alias Quatd

Quatd: QuatType<Float64Array>
\ No newline at end of file diff --git a/docs/types/Quatn-1.html b/docs/types/Quatn-1.html new file mode 100644 index 0000000..1106805 --- /dev/null +++ b/docs/types/Quatn-1.html @@ -0,0 +1 @@ +Quatn | wgpu-matrix

Type Alias Quatn

Quatn: QuatType<number[]>
\ No newline at end of file diff --git a/docs/types/RotationOrder.html b/docs/types/RotationOrder.html new file mode 100644 index 0000000..c32a761 --- /dev/null +++ b/docs/types/RotationOrder.html @@ -0,0 +1 @@ +RotationOrder | wgpu-matrix

Type Alias RotationOrder

RotationOrder: "xyz" | "xzy" | "yxz" | "yzx" | "zxy" | "zyx"
\ No newline at end of file diff --git a/docs/types/Vec2-1.html b/docs/types/Vec2-1.html index d2bc660..dcc2b54 100644 --- a/docs/types/Vec2-1.html +++ b/docs/types/Vec2-1.html @@ -1,4 +1 @@ -Vec2 | wgpu-matrix

Type alias Vec2

Vec2: number[] | Float32Array | Float64Array

A JavaScript array with 2 values, Float32Array with 2 values, or a Float64Array with 2 values. -When created by the library will create the default type which is Float32Array -but can be set by calling vec2.setDefaultType.

-
\ No newline at end of file +Vec2 | wgpu-matrix

Type Alias Vec2

Vec2: Vec2Type<Float32Array>
\ No newline at end of file diff --git a/docs/types/Vec2Arg.html b/docs/types/Vec2Arg.html new file mode 100644 index 0000000..a1f1757 --- /dev/null +++ b/docs/types/Vec2Arg.html @@ -0,0 +1,2 @@ +Vec2Arg | wgpu-matrix

Type Alias Vec2Arg

Vec2Arg: BaseArgType

A JavaScript array with 2 values, a Float32Array with 2 values, or a Float64Array with 2 values.

+
\ No newline at end of file diff --git a/docs/types/Vec2Type.html b/docs/types/Vec2Type.html new file mode 100644 index 0000000..519e878 --- /dev/null +++ b/docs/types/Vec2Type.html @@ -0,0 +1,2 @@ +Vec2Type | wgpu-matrix

Type Alias Vec2Type<T>

Vec2Type<T>: T

A specific concrete 2 element vector.

+

Type Parameters

\ No newline at end of file diff --git a/docs/types/Vec2d-1.html b/docs/types/Vec2d-1.html new file mode 100644 index 0000000..41ab409 --- /dev/null +++ b/docs/types/Vec2d-1.html @@ -0,0 +1 @@ +Vec2d | wgpu-matrix

Type Alias Vec2d

Vec2d: Vec2Type<Float64Array>
\ No newline at end of file diff --git a/docs/types/Vec2n-1.html b/docs/types/Vec2n-1.html new file mode 100644 index 0000000..6844c14 --- /dev/null +++ b/docs/types/Vec2n-1.html @@ -0,0 +1 @@ +Vec2n | wgpu-matrix

Type Alias Vec2n

Vec2n: Vec2Type<number[]>
\ No newline at end of file diff --git a/docs/types/Vec3-1.html b/docs/types/Vec3-1.html index 1d74b5d..40e09a8 100644 --- a/docs/types/Vec3-1.html +++ b/docs/types/Vec3-1.html @@ -1,4 +1 @@ -Vec3 | wgpu-matrix

Type alias Vec3

Vec3: number[] | Float32Array | Float64Array

A JavaScript array with 3 values, Float32Array with 3 values, or a Float64Array with 3 values. -When created by the library will create the default type which is Float32Array -but can be set by calling vec3.setDefaultType.

-
\ No newline at end of file +Vec3 | wgpu-matrix

Type Alias Vec3

Vec3: Vec3Type<Float32Array>
\ No newline at end of file diff --git a/docs/types/Vec3Arg.html b/docs/types/Vec3Arg.html new file mode 100644 index 0000000..1f7d888 --- /dev/null +++ b/docs/types/Vec3Arg.html @@ -0,0 +1,2 @@ +Vec3Arg | wgpu-matrix

Type Alias Vec3Arg

Vec3Arg: BaseArgType

A JavaScript array with 3 values, a Float32Array with 3 values, or a Float64Array with 3 values.

+
\ No newline at end of file diff --git a/docs/types/Vec3Type.html b/docs/types/Vec3Type.html new file mode 100644 index 0000000..41be0d3 --- /dev/null +++ b/docs/types/Vec3Type.html @@ -0,0 +1,2 @@ +Vec3Type | wgpu-matrix

Type Alias Vec3Type<T>

Vec3Type<T>: T

A specific concrete 3 element vector.

+

Type Parameters

\ No newline at end of file diff --git a/docs/types/Vec3d-1.html b/docs/types/Vec3d-1.html new file mode 100644 index 0000000..7ad66c1 --- /dev/null +++ b/docs/types/Vec3d-1.html @@ -0,0 +1 @@ +Vec3d | wgpu-matrix

Type Alias Vec3d

Vec3d: Vec3Type<Float64Array>
\ No newline at end of file diff --git a/docs/types/Vec3n-1.html b/docs/types/Vec3n-1.html new file mode 100644 index 0000000..4b658db --- /dev/null +++ b/docs/types/Vec3n-1.html @@ -0,0 +1 @@ +Vec3n | wgpu-matrix

Type Alias Vec3n

Vec3n: Vec3Type<number[]>
\ No newline at end of file diff --git a/docs/types/Vec4-1.html b/docs/types/Vec4-1.html index 4b9908d..20b8e59 100644 --- a/docs/types/Vec4-1.html +++ b/docs/types/Vec4-1.html @@ -1,4 +1 @@ -Vec4 | wgpu-matrix

Type alias Vec4

Vec4: number[] | Float32Array | Float64Array

A JavaScript array with 4 values, Float32Array with 4 values, or a Float64Array with 4 values. -When created by the library will create the default type which is Float32Array -but can be set by calling vec4.setDefaultType.

-
\ No newline at end of file +Vec4 | wgpu-matrix

Type Alias Vec4

Vec4: Vec4Type<Float32Array>
\ No newline at end of file diff --git a/docs/types/Vec4Arg.html b/docs/types/Vec4Arg.html new file mode 100644 index 0000000..de8e138 --- /dev/null +++ b/docs/types/Vec4Arg.html @@ -0,0 +1,2 @@ +Vec4Arg | wgpu-matrix

Type Alias Vec4Arg

Vec4Arg: BaseArgType

A JavaScript array with 4 values, a Float32Array with 4 values, or a Float64Array with 4 values.

+
\ No newline at end of file diff --git a/docs/types/Vec4Type.html b/docs/types/Vec4Type.html new file mode 100644 index 0000000..2ed6f72 --- /dev/null +++ b/docs/types/Vec4Type.html @@ -0,0 +1,2 @@ +Vec4Type | wgpu-matrix

Type Alias Vec4Type<T>

Vec4Type<T>: T

A specific concrete 4 element vector.

+

Type Parameters

\ No newline at end of file diff --git a/docs/types/Vec4d-1.html b/docs/types/Vec4d-1.html new file mode 100644 index 0000000..62678b4 --- /dev/null +++ b/docs/types/Vec4d-1.html @@ -0,0 +1 @@ +Vec4d | wgpu-matrix

Type Alias Vec4d

Vec4d: Vec4Type<Float64Array>
\ No newline at end of file diff --git a/docs/types/Vec4n-1.html b/docs/types/Vec4n-1.html new file mode 100644 index 0000000..2576530 --- /dev/null +++ b/docs/types/Vec4n-1.html @@ -0,0 +1 @@ +Vec4n | wgpu-matrix

Type Alias Vec4n

Vec4n: Vec4Type<number[]>
\ No newline at end of file diff --git a/docs/types/mat3.Mat3LikeCtor.html b/docs/types/mat3.Mat3LikeCtor.html deleted file mode 100644 index a68643f..0000000 --- a/docs/types/mat3.Mat3LikeCtor.html +++ /dev/null @@ -1 +0,0 @@ -Mat3LikeCtor | wgpu-matrix

Type alias Mat3LikeCtor

Mat3LikeCtor: (new (n) => Mat3)

Type declaration

    • new (n): Mat3
    • Parameters

      • n: number

      Returns Mat3

\ No newline at end of file diff --git a/docs/types/mat4.Mat4LikeCtor.html b/docs/types/mat4.Mat4LikeCtor.html deleted file mode 100644 index 9c356b9..0000000 --- a/docs/types/mat4.Mat4LikeCtor.html +++ /dev/null @@ -1 +0,0 @@ -Mat4LikeCtor | wgpu-matrix

Type alias Mat4LikeCtor

Mat4LikeCtor: (new (n) => Mat4)

Type declaration

    • new (n): Mat4
    • Parameters

      • n: number

      Returns Mat4

\ No newline at end of file diff --git a/docs/types/quat.RotationOrder.html b/docs/types/quat.RotationOrder.html deleted file mode 100644 index 78b6711..0000000 --- a/docs/types/quat.RotationOrder.html +++ /dev/null @@ -1 +0,0 @@ -RotationOrder | wgpu-matrix

Type alias RotationOrder

RotationOrder: "xyz" | "xzy" | "yxz" | "yzx" | "zxy" | "zyx"
\ No newline at end of file diff --git a/docs/variables/utils.EPSILON.html b/docs/variables/utils.EPSILON.html index 6a18101..98ac872 100644 --- a/docs/variables/utils.EPSILON.html +++ b/docs/variables/utils.EPSILON.html @@ -1 +1 @@ -EPSILON | wgpu-matrix

Variable EPSILON

EPSILON: number = 0.000001
\ No newline at end of file +EPSILON | wgpu-matrix

Variable EPSILON

EPSILON: number = 0.000001
\ No newline at end of file diff --git a/package-lock.json b/package-lock.json index d7ba985..1e97202 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "wgpu-matrix", - "version": "2.9.1", + "version": "3.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "wgpu-matrix", - "version": "2.9.1", + "version": "3.0.0", "license": "MIT", "devDependencies": { "@rollup/plugin-terser": "^0.4.4", @@ -20,12 +20,11 @@ "eslint-plugin-optional-comma-spacing": "^0.0.4", "eslint-plugin-require-trailing-comma": "^0.0.1", "express": "^4.19.2", - "google-closure-compiler": "^20230228.0.0", "mocha": "^10.4.0", "rollup": "^4.17.2", "showdown": "^2.1.0", "tslib": "^2.6.2", - "typedoc": "^0.25.13", + "typedoc": "^0.26.0-beta.2", "typescript": "^5.4.5" } }, @@ -233,15 +232,6 @@ } } }, - "node_modules/@rollup/plugin-terser/node_modules/serialize-javascript": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz", - "integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==", - "dev": true, - "dependencies": { - "randombytes": "^2.1.0" - } - }, "node_modules/@rollup/plugin-typescript": { "version": "11.1.6", "resolved": "https://registry.npmjs.org/@rollup/plugin-typescript/-/plugin-typescript-11.1.6.tgz", @@ -291,9 +281,9 @@ } }, "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.17.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.17.2.tgz", - "integrity": "sha512-NM0jFxY8bB8QLkoKxIQeObCaDlJKewVlIEkuyYKm5An1tdVZ966w2+MPQ2l8LBZLjR+SgyV+nRkTIunzOYBMLQ==", + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.18.0.tgz", + "integrity": "sha512-Tya6xypR10giZV1XzxmH5wr25VcZSncG0pZIjfePT0OVBvqNEurzValetGNarVrGiq66EBVAFn15iYX4w6FKgQ==", "cpu": [ "arm" ], @@ -304,9 +294,9 @@ ] }, "node_modules/@rollup/rollup-android-arm64": { - "version": "4.17.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.17.2.tgz", - "integrity": "sha512-yeX/Usk7daNIVwkq2uGoq2BYJKZY1JfyLTaHO/jaiSwi/lsf8fTFoQW/n6IdAsx5tx+iotu2zCJwz8MxI6D/Bw==", + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.18.0.tgz", + "integrity": "sha512-avCea0RAP03lTsDhEyfy+hpfr85KfyTctMADqHVhLAF3MlIkq83CP8UfAHUssgXTYd+6er6PaAhx/QGv4L1EiA==", "cpu": [ "arm64" ], @@ -317,9 +307,9 @@ ] }, "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.17.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.17.2.tgz", - "integrity": "sha512-kcMLpE6uCwls023+kknm71ug7MZOrtXo+y5p/tsg6jltpDtgQY1Eq5sGfHcQfb+lfuKwhBmEURDga9N0ol4YPw==", + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.18.0.tgz", + "integrity": "sha512-IWfdwU7KDSm07Ty0PuA/W2JYoZ4iTj3TUQjkVsO/6U+4I1jN5lcR71ZEvRh52sDOERdnNhhHU57UITXz5jC1/w==", "cpu": [ "arm64" ], @@ -330,9 +320,9 @@ ] }, "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.17.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.17.2.tgz", - "integrity": "sha512-AtKwD0VEx0zWkL0ZjixEkp5tbNLzX+FCqGG1SvOu993HnSz4qDI6S4kGzubrEJAljpVkhRSlg5bzpV//E6ysTQ==", + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.18.0.tgz", + "integrity": "sha512-n2LMsUz7Ynu7DoQrSQkBf8iNrjOGyPLrdSg802vk6XT3FtsgX6JbE8IHRvposskFm9SNxzkLYGSq9QdpLYpRNA==", "cpu": [ "x64" ], @@ -343,9 +333,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.17.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.17.2.tgz", - "integrity": "sha512-3reX2fUHqN7sffBNqmEyMQVj/CKhIHZd4y631duy0hZqI8Qoqf6lTtmAKvJFYa6bhU95B1D0WgzHkmTg33In0A==", + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.18.0.tgz", + "integrity": "sha512-C/zbRYRXFjWvz9Z4haRxcTdnkPt1BtCkz+7RtBSuNmKzMzp3ZxdM28Mpccn6pt28/UWUCTXa+b0Mx1k3g6NOMA==", "cpu": [ "arm" ], @@ -356,9 +346,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.17.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.17.2.tgz", - "integrity": "sha512-uSqpsp91mheRgw96xtyAGP9FW5ChctTFEoXP0r5FAzj/3ZRv3Uxjtc7taRQSaQM/q85KEKjKsZuiZM3GyUivRg==", + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.18.0.tgz", + "integrity": "sha512-l3m9ewPgjQSXrUMHg93vt0hYCGnrMOcUpTz6FLtbwljo2HluS4zTXFy2571YQbisTnfTKPZ01u/ukJdQTLGh9A==", "cpu": [ "arm" ], @@ -369,9 +359,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.17.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.17.2.tgz", - "integrity": "sha512-EMMPHkiCRtE8Wdk3Qhtciq6BndLtstqZIroHiiGzB3C5LDJmIZcSzVtLRbwuXuUft1Cnv+9fxuDtDxz3k3EW2A==", + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.18.0.tgz", + "integrity": "sha512-rJ5D47d8WD7J+7STKdCUAgmQk49xuFrRi9pZkWoRD1UeSMakbcepWXPF8ycChBoAqs1pb2wzvbY6Q33WmN2ftw==", "cpu": [ "arm64" ], @@ -382,9 +372,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.17.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.17.2.tgz", - "integrity": "sha512-NMPylUUZ1i0z/xJUIx6VUhISZDRT+uTWpBcjdv0/zkp7b/bQDF+NfnfdzuTiB1G6HTodgoFa93hp0O1xl+/UbA==", + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.18.0.tgz", + "integrity": "sha512-be6Yx37b24ZwxQ+wOQXXLZqpq4jTckJhtGlWGZs68TgdKXJgw54lUUoFYrg6Zs/kjzAQwEwYbp8JxZVzZLRepQ==", "cpu": [ "arm64" ], @@ -395,9 +385,9 @@ ] }, "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { - "version": "4.17.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.17.2.tgz", - "integrity": "sha512-T19My13y8uYXPw/L/k0JYaX1fJKFT/PWdXiHr8mTbXWxjVF1t+8Xl31DgBBvEKclw+1b00Chg0hxE2O7bTG7GQ==", + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.18.0.tgz", + "integrity": "sha512-hNVMQK+qrA9Todu9+wqrXOHxFiD5YmdEi3paj6vP02Kx1hjd2LLYR2eaN7DsEshg09+9uzWi2W18MJDlG0cxJA==", "cpu": [ "ppc64" ], @@ -408,9 +398,9 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.17.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.17.2.tgz", - "integrity": "sha512-BOaNfthf3X3fOWAB+IJ9kxTgPmMqPPH5f5k2DcCsRrBIbWnaJCgX2ll77dV1TdSy9SaXTR5iDXRL8n7AnoP5cg==", + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.18.0.tgz", + "integrity": "sha512-ROCM7i+m1NfdrsmvwSzoxp9HFtmKGHEqu5NNDiZWQtXLA8S5HBCkVvKAxJ8U+CVctHwV2Gb5VUaK7UAkzhDjlg==", "cpu": [ "riscv64" ], @@ -421,9 +411,9 @@ ] }, "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.17.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.17.2.tgz", - "integrity": "sha512-W0UP/x7bnn3xN2eYMql2T/+wpASLE5SjObXILTMPUBDB/Fg/FxC+gX4nvCfPBCbNhz51C+HcqQp2qQ4u25ok6g==", + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.18.0.tgz", + "integrity": "sha512-0UyyRHyDN42QL+NbqevXIIUnKA47A+45WyasO+y2bGJ1mhQrfrtXUpTxCOrfxCR4esV3/RLYyucGVPiUsO8xjg==", "cpu": [ "s390x" ], @@ -434,9 +424,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.17.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.17.2.tgz", - "integrity": "sha512-Hy7pLwByUOuyaFC6mAr7m+oMC+V7qyifzs/nW2OJfC8H4hbCzOX07Ov0VFk/zP3kBsELWNFi7rJtgbKYsav9QQ==", + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.18.0.tgz", + "integrity": "sha512-xuglR2rBVHA5UsI8h8UbX4VJ470PtGCf5Vpswh7p2ukaqBGFTnsfzxUBetoWBWymHMxbIG0Cmx7Y9qDZzr648w==", "cpu": [ "x64" ], @@ -447,9 +437,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.17.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.17.2.tgz", - "integrity": "sha512-h1+yTWeYbRdAyJ/jMiVw0l6fOOm/0D1vNLui9iPuqgRGnXA0u21gAqOyB5iHjlM9MMfNOm9RHCQ7zLIzT0x11Q==", + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.18.0.tgz", + "integrity": "sha512-LKaqQL9osY/ir2geuLVvRRs+utWUNilzdE90TpyoX0eNqPzWjRm14oMEE+YLve4k/NAqCdPkGYDaDF5Sw+xBfg==", "cpu": [ "x64" ], @@ -460,9 +450,9 @@ ] }, "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.17.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.17.2.tgz", - "integrity": "sha512-tmdtXMfKAjy5+IQsVtDiCfqbynAQE/TQRpWdVataHmhMb9DCoJxp9vLcCBjEQWMiUYxO1QprH/HbY9ragCEFLA==", + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.18.0.tgz", + "integrity": "sha512-7J6TkZQFGo9qBKH0pk2cEVSRhJbL6MtfWxth7Y5YmZs57Pi+4x6c2dStAUvaQkHQLnEQv1jzBUW43GvZW8OFqA==", "cpu": [ "arm64" ], @@ -473,9 +463,9 @@ ] }, "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.17.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.17.2.tgz", - "integrity": "sha512-7II/QCSTAHuE5vdZaQEwJq2ZACkBpQDOmQsE6D6XUbnBHW8IAhm4eTufL6msLJorzrHDFv3CF8oCA/hSIRuZeQ==", + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.18.0.tgz", + "integrity": "sha512-Txjh+IxBPbkUB9+SXZMpv+b/vnTEtFyfWZgJ6iyCmt2tdx0OF5WhFowLmnh8ENGNpfUlUZkdI//4IEmhwPieNg==", "cpu": [ "ia32" ], @@ -486,9 +476,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.17.2", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.17.2.tgz", - "integrity": "sha512-TGGO7v7qOq4CYmSBVEYpI1Y5xDuCEnbVC5Vth8mOsW0gDSzxNrVERPc790IGHsrT2dQSimgMr9Ub3Y1Jci5/8w==", + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.18.0.tgz", + "integrity": "sha512-UOo5FdvOL0+eIVTgS4tIdbW+TtnBLWg1YBCcU2KWM7nuNwRz9bksDX1bekJJCpu25N1DVWaCwnT39dVQxzqS8g==", "cpu": [ "x64" ], @@ -498,6 +488,12 @@ "win32" ] }, + "node_modules/@shikijs/core": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@shikijs/core/-/core-1.6.1.tgz", + "integrity": "sha512-CqYyepN4SnBopaoXYwng4NO8riB5ask/LTCkhOFq+GNGtr2X+aKeD767eYdqYukeixEUvv4bXdyTYVaogj7KBw==", + "dev": true + }, "node_modules/@tsconfig/recommended": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/@tsconfig/recommended/-/recommended-1.0.6.tgz", @@ -784,12 +780,6 @@ "node": ">=8" } }, - "node_modules/ansi-sequence-parser": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ansi-sequence-parser/-/ansi-sequence-parser-1.1.1.tgz", - "integrity": "sha512-vJXt3yiaUL4UU546s3rPXlsry/RnM730G1+HkpKE012AN0sx1eOrxSu95oKDIonskeLTijMgqWZ3uDEe3NFvyg==", - "dev": true - }, "node_modules/ansi-styles": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", @@ -907,12 +897,12 @@ } }, "node_modules/braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", "dev": true, "dependencies": { - "fill-range": "^7.0.1" + "fill-range": "^7.1.1" }, "engines": { "node": ">=8" @@ -1045,41 +1035,6 @@ "wrap-ansi": "^7.0.0" } }, - "node_modules/clone": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", - "integrity": "sha512-3Pe/CF1Nn94hyhIYpjtiLhdCoEoz0DqQ+988E9gmeEdQZlojxnOb74wctFyuwWQHzqyf9X7C7MG8juUpqBJT8w==", - "dev": true, - "engines": { - "node": ">=0.8" - } - }, - "node_modules/clone-buffer": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/clone-buffer/-/clone-buffer-1.0.0.tgz", - "integrity": "sha512-KLLTJWrvwIP+OPfMn0x2PheDEP20RPUcGXj/ERegTgdmPEZylALQldygiqrPPu8P45uNuPs7ckmReLY6v/iA5g==", - "dev": true, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/clone-stats": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/clone-stats/-/clone-stats-1.0.0.tgz", - "integrity": "sha512-au6ydSpg6nsrigcZ4m8Bc9hxjeW+GJ8xh5G3BJCMt4WXe1H10UNaVOamqQTmrx1kjVuxAHIQSNU6hY4Nsn9/ag==", - "dev": true - }, - "node_modules/cloneable-readable": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/cloneable-readable/-/cloneable-readable-1.1.3.tgz", - "integrity": "sha512-2EF8zTQOxYq70Y4XKtorQupqF0m49MBz2/yf5Bj+MHjvpG3Hy7sImifnqD6UA+TKYxeSV+u6qqQPawN5UvnpKQ==", - "dev": true, - "dependencies": { - "inherits": "^2.0.1", - "process-nextick-args": "^2.0.0", - "readable-stream": "^2.3.5" - } - }, "node_modules/color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", @@ -1149,12 +1104,6 @@ "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==", "dev": true }, - "node_modules/core-util-is": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", - "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", - "dev": true - }, "node_modules/cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -1170,9 +1119,9 @@ } }, "node_modules/debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.5.tgz", + "integrity": "sha512-pt0bNEmneDIvdL1Xsd9oDQ/wrQRkXDT4AUWlNZNPKvW5x/jyO9VFXkJUP07vQ2upmw5PlaITaPKc31jK13V+jg==", "dev": true, "dependencies": { "ms": "2.1.2" @@ -1767,9 +1716,9 @@ } }, "node_modules/fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", "dev": true, "dependencies": { "to-regex-range": "^5.0.1" @@ -1935,6 +1884,7 @@ "version": "8.1.0", "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", + "deprecated": "Glob versions prior to v9 are no longer supported", "dev": true, "dependencies": { "fs.realpath": "^1.0.0", @@ -2018,79 +1968,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/google-closure-compiler": { - "version": "20230228.0.0", - "resolved": "https://registry.npmjs.org/google-closure-compiler/-/google-closure-compiler-20230228.0.0.tgz", - "integrity": "sha512-jFI4QNZgM4WhNIoaRNwA5kHq6n6NKSWZj3N9HgRsJE9bN4LUrkIURI+svChbEp/WmGh3Bt3o3/5kUlOOWyCo3Q==", - "dev": true, - "dependencies": { - "chalk": "4.x", - "google-closure-compiler-java": "^20230228.0.0", - "minimist": "1.x", - "vinyl": "2.x", - "vinyl-sourcemaps-apply": "^0.2.0" - }, - "bin": { - "google-closure-compiler": "cli.js" - }, - "engines": { - "node": ">=10" - }, - "optionalDependencies": { - "google-closure-compiler-linux": "^20230228.0.0", - "google-closure-compiler-osx": "^20230228.0.0", - "google-closure-compiler-windows": "^20230228.0.0" - } - }, - "node_modules/google-closure-compiler-java": { - "version": "20230228.0.0", - "resolved": "https://registry.npmjs.org/google-closure-compiler-java/-/google-closure-compiler-java-20230228.0.0.tgz", - "integrity": "sha512-t0sXYJbhfkuNTF6zniwrTv4gLap620D32v6GwBJQzlYUg0lb7yQHN9KswwqBsuuO917cPNwW4okI0O40G7GrMQ==", - "dev": true - }, - "node_modules/google-closure-compiler-linux": { - "version": "20230228.0.0", - "resolved": "https://registry.npmjs.org/google-closure-compiler-linux/-/google-closure-compiler-linux-20230228.0.0.tgz", - "integrity": "sha512-5YLxfWS8lvHkD/a0+pitTuDV1X9QPBToGQ5mnLFg7HcbBR1w6I5ZKHjl7FAsAOHEXYwIrStwwaLzrNzbolrZLg==", - "cpu": [ - "x32", - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/google-closure-compiler-osx": { - "version": "20230228.0.0", - "resolved": "https://registry.npmjs.org/google-closure-compiler-osx/-/google-closure-compiler-osx-20230228.0.0.tgz", - "integrity": "sha512-ORveHpHuNhJEJIGir35+xP4UuBOldSO8XeOwJV5yunUhZAPzR4aixdTdtm6i0GsqW4/Eu2cjcHrkIR3eFCcwSg==", - "cpu": [ - "x32", - "x64", - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/google-closure-compiler-windows": { - "version": "20230228.0.0", - "resolved": "https://registry.npmjs.org/google-closure-compiler-windows/-/google-closure-compiler-windows-20230228.0.0.tgz", - "integrity": "sha512-xKMjUq6JwEOFqS97S86TWkn+BMiDHjP85mMgAmR8vRmKxgfHIyxMcr+RlMz0msgY9jedgj119KXyOe32lIQTjA==", - "cpu": [ - "x32", - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ] - }, "node_modules/gopd": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", @@ -2260,6 +2137,7 @@ "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", "dev": true, "dependencies": { "once": "^1.3.0", @@ -2374,12 +2252,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", - "dev": true - }, "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", @@ -2416,12 +2288,6 @@ "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", "dev": true }, - "node_modules/jsonc-parser": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.1.tgz", - "integrity": "sha512-AilxAyFOAcK5wA1+LeaySVBrHsGQvUFCDWXKpZjzaL0PqW+xfBOttn8GNtWKFWqneyMZj41MWF9Kl6iPWLwgOA==", - "dev": true - }, "node_modules/keyv": { "version": "4.5.4", "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", @@ -2444,6 +2310,15 @@ "node": ">= 0.8.0" } }, + "node_modules/linkify-it": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-5.0.0.tgz", + "integrity": "sha512-5aHCbzQRADcdP+ATqnDuhhJ/MRIqDkZX5pyjFHRRysS8vZ5AbqGEoFIb6pYHPZ+L/OC2Lc+xT8uHVVR5CAK/wQ==", + "dev": true, + "dependencies": { + "uc.micro": "^2.0.0" + } + }, "node_modules/locate-path": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", @@ -2487,18 +2362,29 @@ "integrity": "sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow==", "dev": true }, - "node_modules/marked": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/marked/-/marked-4.3.0.tgz", - "integrity": "sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A==", + "node_modules/markdown-it": { + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-14.1.0.tgz", + "integrity": "sha512-a54IwgWPaeBCAAsv13YgmALOF1elABB08FxO9i+r4VFk5Vl4pKokRPeX8u5TCgSsPi6ec1otfLjdOpVcgbpshg==", "dev": true, - "bin": { - "marked": "bin/marked.js" + "dependencies": { + "argparse": "^2.0.1", + "entities": "^4.4.0", + "linkify-it": "^5.0.0", + "mdurl": "^2.0.0", + "punycode.js": "^2.3.1", + "uc.micro": "^2.1.0" }, - "engines": { - "node": ">= 12" + "bin": { + "markdown-it": "bin/markdown-it.mjs" } }, + "node_modules/mdurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-2.0.0.tgz", + "integrity": "sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w==", + "dev": true + }, "node_modules/media-typer": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", @@ -2533,12 +2419,12 @@ } }, "node_modules/micromatch": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", - "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.7.tgz", + "integrity": "sha512-LPP/3KorzCwBxfeUuZmaR6bG2kdeHSbe0P2tY3FLRU4vYrjYz5hI4QZwV0njUx3jeuKe67YukQ1LSPZBKDqO/Q==", "dev": true, "dependencies": { - "braces": "^3.0.2", + "braces": "^3.0.3", "picomatch": "^2.3.1" }, "engines": { @@ -2590,15 +2476,6 @@ "node": "*" } }, - "node_modules/minimist": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", - "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", - "dev": true, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/mocha": { "version": "10.4.0", "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.4.0.tgz", @@ -2643,6 +2520,29 @@ "balanced-match": "^1.0.0" } }, + "node_modules/mocha/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/mocha/node_modules/debug/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, "node_modules/mocha/node_modules/minimatch": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz", @@ -2661,6 +2561,15 @@ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", "dev": true }, + "node_modules/mocha/node_modules/serialize-javascript": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", + "integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==", + "dev": true, + "dependencies": { + "randombytes": "^2.1.0" + } + }, "node_modules/mocha/node_modules/supports-color": { "version": "8.1.1", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", @@ -2879,12 +2788,6 @@ "node": ">= 0.8.0" } }, - "node_modules/process-nextick-args": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", - "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", - "dev": true - }, "node_modules/proxy-addr": { "version": "2.0.7", "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", @@ -2907,6 +2810,15 @@ "node": ">=6" } }, + "node_modules/punycode.js": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode.js/-/punycode.js-2.3.1.tgz", + "integrity": "sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA==", + "dev": true, + "engines": { + "node": ">=6" + } + }, "node_modules/qs": { "version": "6.11.0", "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", @@ -2975,27 +2887,6 @@ "node": ">= 0.8" } }, - "node_modules/readable-stream": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", - "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", - "dev": true, - "dependencies": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "node_modules/readable-stream/node_modules/safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true - }, "node_modules/readdirp": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", @@ -3008,21 +2899,6 @@ "node": ">=8.10.0" } }, - "node_modules/remove-trailing-separator": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", - "integrity": "sha512-/hS+Y0u3aOfIETiaiirUFwDBDzmXPvO+jAfKTitUngIPzdKc6Z0LoFjM/CK5PL4C+eKwHohlHAb6H0VFfmmUsw==", - "dev": true - }, - "node_modules/replace-ext": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-1.0.1.tgz", - "integrity": "sha512-yD5BHCe7quCgBph4rMQ+0KkIRKwWCrHDOX1p1Gp6HwjPM5kVoCdKGNhN7ydqqsX6lJEnQDKZ/tFMiEdQ1dvPEw==", - "dev": true, - "engines": { - "node": ">= 0.10" - } - }, "node_modules/require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -3072,6 +2948,7 @@ "version": "3.0.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "deprecated": "Rimraf versions prior to v4 are no longer supported", "dev": true, "dependencies": { "glob": "^7.1.3" @@ -3087,6 +2964,7 @@ "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Glob versions prior to v9 are no longer supported", "dev": true, "dependencies": { "fs.realpath": "^1.0.0", @@ -3104,9 +2982,9 @@ } }, "node_modules/rollup": { - "version": "4.17.2", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.17.2.tgz", - "integrity": "sha512-/9ClTJPByC0U4zNLowV1tMBe8yMEAxewtR3cUNX5BoEpGH3dQEWpJLr6CLp0fPdYRF/fzVOgvDb1zXuakwF5kQ==", + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.18.0.tgz", + "integrity": "sha512-QmJz14PX3rzbJCN1SG4Xe/bAAX2a6NpCP8ab2vfu2GiUr8AQcr2nCV/oEO3yneFarB67zk8ShlIyWb2LGTb3Sg==", "dev": true, "dependencies": { "@types/estree": "1.0.5" @@ -3119,22 +2997,22 @@ "npm": ">=8.0.0" }, "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.17.2", - "@rollup/rollup-android-arm64": "4.17.2", - "@rollup/rollup-darwin-arm64": "4.17.2", - "@rollup/rollup-darwin-x64": "4.17.2", - "@rollup/rollup-linux-arm-gnueabihf": "4.17.2", - "@rollup/rollup-linux-arm-musleabihf": "4.17.2", - "@rollup/rollup-linux-arm64-gnu": "4.17.2", - "@rollup/rollup-linux-arm64-musl": "4.17.2", - "@rollup/rollup-linux-powerpc64le-gnu": "4.17.2", - "@rollup/rollup-linux-riscv64-gnu": "4.17.2", - "@rollup/rollup-linux-s390x-gnu": "4.17.2", - "@rollup/rollup-linux-x64-gnu": "4.17.2", - "@rollup/rollup-linux-x64-musl": "4.17.2", - "@rollup/rollup-win32-arm64-msvc": "4.17.2", - "@rollup/rollup-win32-ia32-msvc": "4.17.2", - "@rollup/rollup-win32-x64-msvc": "4.17.2", + "@rollup/rollup-android-arm-eabi": "4.18.0", + "@rollup/rollup-android-arm64": "4.18.0", + "@rollup/rollup-darwin-arm64": "4.18.0", + "@rollup/rollup-darwin-x64": "4.18.0", + "@rollup/rollup-linux-arm-gnueabihf": "4.18.0", + "@rollup/rollup-linux-arm-musleabihf": "4.18.0", + "@rollup/rollup-linux-arm64-gnu": "4.18.0", + "@rollup/rollup-linux-arm64-musl": "4.18.0", + "@rollup/rollup-linux-powerpc64le-gnu": "4.18.0", + "@rollup/rollup-linux-riscv64-gnu": "4.18.0", + "@rollup/rollup-linux-s390x-gnu": "4.18.0", + "@rollup/rollup-linux-x64-gnu": "4.18.0", + "@rollup/rollup-linux-x64-musl": "4.18.0", + "@rollup/rollup-win32-arm64-msvc": "4.18.0", + "@rollup/rollup-win32-ia32-msvc": "4.18.0", + "@rollup/rollup-win32-x64-msvc": "4.18.0", "fsevents": "~2.3.2" } }, @@ -3245,9 +3123,9 @@ "dev": true }, "node_modules/serialize-javascript": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", - "integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz", + "integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==", "dev": true, "dependencies": { "randombytes": "^2.1.0" @@ -3313,15 +3191,12 @@ } }, "node_modules/shiki": { - "version": "0.14.7", - "resolved": "https://registry.npmjs.org/shiki/-/shiki-0.14.7.tgz", - "integrity": "sha512-dNPAPrxSc87ua2sKJ3H5dQ/6ZaY8RNnaAqK+t0eG7p0Soi2ydiqbGOTaZCqaYvA/uZYfS1LJnemt3Q+mSfcPCg==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/shiki/-/shiki-1.6.1.tgz", + "integrity": "sha512-1Pu/A1rtsG6HZvQm4W0NExQ45e02og+rPog7PDaFDiMumZgOYnZIu4JtGQeAIfMwdbKSjJQoCUr79vDLKUUxWA==", "dev": true, "dependencies": { - "ansi-sequence-parser": "^1.1.0", - "jsonc-parser": "^3.2.0", - "vscode-oniguruma": "^1.7.0", - "vscode-textmate": "^8.0.0" + "@shikijs/core": "1.6.1" } }, "node_modules/showdown": { @@ -3374,9 +3249,9 @@ "dev": true }, "node_modules/source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ==", + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", "dev": true, "engines": { "node": ">=0.10.0" @@ -3392,15 +3267,6 @@ "source-map": "^0.6.0" } }, - "node_modules/source-map-support/node_modules/source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/statuses": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", @@ -3410,21 +3276,6 @@ "node": ">= 0.8" } }, - "node_modules/string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "dependencies": { - "safe-buffer": "~5.1.0" - } - }, - "node_modules/string_decoder/node_modules/safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true - }, "node_modules/string-width": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", @@ -3603,24 +3454,25 @@ } }, "node_modules/typedoc": { - "version": "0.25.13", - "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.25.13.tgz", - "integrity": "sha512-pQqiwiJ+Z4pigfOnnysObszLiU3mVLWAExSPf+Mu06G/qsc3wzbuM56SZQvONhHLncLUhYzOVkjFFpFfL5AzhQ==", + "version": "0.26.0-beta.2", + "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.26.0-beta.2.tgz", + "integrity": "sha512-sFVUArw13cF8K7jeayUXyVCby9pRsEdjkQSvgnRxL8Wzuow9G7xlrXBhWU1BFBoGK8RC25hXD/4oJmMQhnnEnQ==", "dev": true, "dependencies": { "lunr": "^2.3.9", - "marked": "^4.3.0", - "minimatch": "^9.0.3", - "shiki": "^0.14.7" + "markdown-it": "^14.1.0", + "minimatch": "^9.0.4", + "shiki": "^1.6.0", + "yaml": "^2.4.2" }, "bin": { "typedoc": "bin/typedoc" }, "engines": { - "node": ">= 16" + "node": ">= 18" }, "peerDependencies": { - "typescript": "4.6.x || 4.7.x || 4.8.x || 4.9.x || 5.0.x || 5.1.x || 5.2.x || 5.3.x || 5.4.x" + "typescript": "4.6.x || 4.7.x || 4.8.x || 4.9.x || 5.0.x || 5.1.x || 5.2.x || 5.3.x || 5.4.x || 5.5.x" } }, "node_modules/typedoc/node_modules/brace-expansion": { @@ -3660,6 +3512,12 @@ "node": ">=14.17" } }, + "node_modules/uc.micro": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-2.1.0.tgz", + "integrity": "sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==", + "dev": true + }, "node_modules/unpipe": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", @@ -3678,12 +3536,6 @@ "punycode": "^2.1.0" } }, - "node_modules/util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", - "dev": true - }, "node_modules/utils-merge": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", @@ -3702,44 +3554,6 @@ "node": ">= 0.8" } }, - "node_modules/vinyl": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-2.2.1.tgz", - "integrity": "sha512-LII3bXRFBZLlezoG5FfZVcXflZgWP/4dCwKtxd5ky9+LOtM4CS3bIRQsmR1KMnMW07jpE8fqR2lcxPZ+8sJIcw==", - "dev": true, - "dependencies": { - "clone": "^2.1.1", - "clone-buffer": "^1.0.0", - "clone-stats": "^1.0.0", - "cloneable-readable": "^1.0.0", - "remove-trailing-separator": "^1.0.1", - "replace-ext": "^1.0.0" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/vinyl-sourcemaps-apply": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/vinyl-sourcemaps-apply/-/vinyl-sourcemaps-apply-0.2.1.tgz", - "integrity": "sha512-+oDh3KYZBoZC8hfocrbrxbLUeaYtQK7J5WU5Br9VqWqmCll3tFJqKp97GC9GmMsVIL0qnx2DgEDVxdo5EZ5sSw==", - "dev": true, - "dependencies": { - "source-map": "^0.5.1" - } - }, - "node_modules/vscode-oniguruma": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/vscode-oniguruma/-/vscode-oniguruma-1.7.0.tgz", - "integrity": "sha512-L9WMGRfrjOhgHSdOYgCt/yRMsXzLDJSL7BPrOZt73gU0iWO4mpqzqQzOz5srxqTvMBaR0XZTSrVWo4j55Rc6cA==", - "dev": true - }, - "node_modules/vscode-textmate": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/vscode-textmate/-/vscode-textmate-8.0.0.tgz", - "integrity": "sha512-AFbieoL7a5LMqcnOF04ji+rpXadgOXnZsxQr//r83kLPr7biP7am3g9zbaZIaBGwBRWeSvoMD4mgPdX3e4NWBg==", - "dev": true - }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -3802,6 +3616,18 @@ "node": ">=10" } }, + "node_modules/yaml": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.4.2.tgz", + "integrity": "sha512-B3VqDZ+JAg1nZpaEmWtTXUlBneoGx6CPM9b0TENK6aoSu5t73dItudwdgmi6tHlIZZId4dZ9skcAQ2UbcyAeVA==", + "dev": true, + "bin": { + "yaml": "bin.mjs" + }, + "engines": { + "node": ">= 14" + } + }, "node_modules/yargs": { "version": "16.2.0", "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", diff --git a/package.json b/package.json index 3d10215..403f54e 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,10 @@ { "name": "wgpu-matrix", - "version": "2.9.1", + "version": "3.0.0", "description": "fast matrix math library for WebGPU", - "main": "dist/2.x/wgpu-matrix.module.js", - "module": "dist/2.x/wgpu-matrix.module.js", - "types": "dist/2.x/wgpu-matrix.d.ts", + "main": "dist/3.x/wgpu-matrix.module.js", + "module": "dist/3.x/wgpu-matrix.module.js", + "types": "dist/3.x/wgpu-matrix.d.ts", "type": "module", "sideEffects": false, "directories": { @@ -28,7 +28,7 @@ "url": "git+https://github.com/greggman/wgpu-matrix.git" }, "files": [ - "dist/2.x/**" + "dist/3.x/**" ], "keywords": [ "webgpu", @@ -57,12 +57,11 @@ "eslint-plugin-optional-comma-spacing": "^0.0.4", "eslint-plugin-require-trailing-comma": "^0.0.1", "express": "^4.19.2", - "google-closure-compiler": "^20230228.0.0", "mocha": "^10.4.0", "rollup": "^4.17.2", "showdown": "^2.1.0", "tslib": "^2.6.2", - "typedoc": "^0.25.13", + "typedoc": "^0.26.0-beta.2", "typescript": "^5.4.5" } } diff --git a/src/mat3-impl.ts b/src/mat3-impl.ts index 74c97f9..4b1db03 100644 --- a/src/mat3-impl.ts +++ b/src/mat3-impl.ts @@ -21,61 +21,22 @@ */ import * as utils from './utils.js'; -import { Quat } from './quat'; -import { Mat3 } from './mat3'; -import { Mat4 } from './mat4'; -import Vec2, * as vec2 from './vec2-impl'; +import { QuatArg } from './quat'; +import { Mat3Arg, Mat3Type } from './mat3'; +import { Mat4Arg } from './mat4'; +import { Vec2Arg } from './vec2'; +import { getAPI as getVec2API } from './vec2-impl'; +import { BaseArgType } from './types'; -export default Mat3; +export { Mat3Arg, Mat3Type }; -export type Mat3LikeCtor = new (n: number) => Mat3; +type Mat3Ctor = new (n: number) => T; /** - * 3x3 Matrix math math functions. - * - * Almost all functions take an optional `dst` argument. If it is not passed in the - * functions will create a new matrix. In other words you can do this - * - * const mat = mat3.translation([1, 2, 3]); // Creates a new translation matrix - * - * or - * - * const mat = mat3.create(); - * mat3.translation([1, 2, 3], mat); // Puts translation matrix in mat. - * - * The first style is often easier but depending on where it's used it generates garbage where - * as there is almost never allocation with the second style. - * - * It is always save to pass any matrix as the destination. So for example - * - * const mat = mat3.identity(); - * const trans = mat3.translation([1, 2, 3]); - * mat3.multiply(mat, trans, mat); // Multiplies mat * trans and puts result in mat. - * - */ -let MatType: Mat3LikeCtor = Float32Array; - -// This mess is because with Mat3 we have 3 unused elements. -// For Float32Array and Float64Array that's not an issue -// but for Array it's troublesome -const ctorMap = new Map Mat3>([ - [Float32Array, () => new Float32Array(12)], - [Float64Array, () => new Float64Array(12)], - [Array, () => new Array(12).fill(0)], -]); -let newMat3: () => Mat3 = ctorMap.get(Float32Array)!; - -/** - * Sets the type this library creates for a Mat3 - * @param ctor - the constructor for the type. Either `Float32Array`, `Float64Array`, or `Array` - * @returns previous constructor for Mat3 - */ -export function setDefaultType(ctor: new (n: number) => Mat3) { - const oldType = MatType; - MatType = ctor; - newMat3 = ctorMap.get(ctor)!; - return oldType; -} + * Generates a typed API for Mat3 + * */ +function getAPIImpl(Ctor: Mat3Ctor) { + const vec2 = getVec2API(Ctor); /** * Create a Mat3 from values @@ -89,17 +50,6 @@ export function setDefaultType(ctor: new (n: number) => Mat3) { * const m = mat3.clone(someJSArray); * ``` * - * Note: a consequence of the implementation is if your Mat3Type = `Array` - * instead of `Float32Array` or `Float64Array` then any values you - * don't pass in will be undefined. Usually this is not an issue since - * (a) using `Array` is rare and (b) using `mat3.create` is usually used - * to create a Mat3 to be filled out as in - * - * ``` - * const m = mat3.create(); - * mat3.perspective(fov, aspect, near, far, m); - * ``` - * * @param v0 - value for element 0 * @param v1 - value for element 1 * @param v2 - value for element 2 @@ -111,34 +61,34 @@ export function setDefaultType(ctor: new (n: number) => Mat3) { * @param v8 - value for element 8 * @returns matrix created from values. */ -export function create( +function create( v0?: number, v1?: number, v2?: number, v3?: number, v4?: number, v5?: number, - v6?: number, v7?: number, v8?: number): Mat3 { - const dst = newMat3(); + v6?: number, v7?: number, v8?: number) { + const newDst = new Ctor(12); // to make the array homogenous - dst[3] = 0; - dst[7] = 0; - dst[11] = 0; + newDst[3] = 0; + newDst[7] = 0; + newDst[11] = 0; if (v0 !== undefined) { - dst[0] = v0; + newDst[0] = v0; if (v1 !== undefined) { - dst[1] = v1; + newDst[1] = v1; if (v2 !== undefined) { - dst[2] = v2; + newDst[2] = v2; if (v3 !== undefined) { - dst[4] = v3; + newDst[4] = v3; if (v4 !== undefined) { - dst[5] = v4; + newDst[5] = v4; if (v5 !== undefined) { - dst[6] = v5; + newDst[6] = v5; if (v6 !== undefined) { - dst[8] = v6; + newDst[8] = v6; if (v7 !== undefined) { - dst[9] = v7; + newDst[9] = v7; if (v8 !== undefined) { - dst[10] = v8; + newDst[10] = v8; } } } @@ -149,7 +99,7 @@ export function create( } } - return dst; + return newDst; } /** @@ -168,17 +118,17 @@ export function create( * @param dst - matrix to hold result. If not passed a new one is created. * @returns Mat3 set from values. */ -export function set( +function set( v0: number, v1: number, v2: number, v3: number, v4: number, v5: number, - v6: number, v7: number, v8: number, dst?: Mat3) { - dst = dst || newMat3(); + v6: number, v7: number, v8: number, dst?: T) { + const newDst = (dst ?? new Ctor(12)) as T; - dst[0] = v0; dst[1] = v1; dst[ 2] = v2; dst[ 3] = 0; - dst[4] = v3; dst[5] = v4; dst[ 6] = v5; dst[ 7] = 0; - dst[8] = v6; dst[9] = v7; dst[10] = v8; dst[11] = 0; + newDst[0] = v0; newDst[1] = v1; newDst[ 2] = v2; newDst[ 3] = 0; + newDst[4] = v3; newDst[5] = v4; newDst[ 6] = v5; newDst[ 7] = 0; + newDst[8] = v6; newDst[9] = v7; newDst[10] = v8; newDst[11] = 0; - return dst; + return newDst; } /** @@ -187,12 +137,12 @@ export function set( * @param dst - matrix to hold result. If not passed a new one is created. * @returns Mat3 made from m4 */ -export function fromMat4(m4: Mat4, dst?: Mat3): Mat3 { - dst = dst || newMat3(); - dst[0] = m4[0]; dst[1] = m4[1]; dst[ 2] = m4[ 2]; dst[ 3] = 0; - dst[4] = m4[4]; dst[5] = m4[5]; dst[ 6] = m4[ 6]; dst[ 7] = 0; - dst[8] = m4[8]; dst[9] = m4[9]; dst[10] = m4[10]; dst[11] = 0; - return dst; +function fromMat4(m4: Mat4Arg, dst?: T) { + const newDst = (dst ?? new Ctor(12)) as T; + newDst[0] = m4[0]; newDst[1] = m4[1]; newDst[ 2] = m4[ 2]; newDst[ 3] = 0; + newDst[4] = m4[4]; newDst[5] = m4[5]; newDst[ 6] = m4[ 6]; newDst[ 7] = 0; + newDst[8] = m4[8]; newDst[9] = m4[9]; newDst[10] = m4[10]; newDst[11] = 0; + return newDst; } /** @@ -201,8 +151,8 @@ export function fromMat4(m4: Mat4, dst?: Mat3): Mat3 { * @param dst - matrix to hold result. If not passed a new one is created. * @returns Mat3 made from q */ -export function fromQuat(q: Quat, dst?: Mat3): Mat3 { - dst = dst || newMat3(); +function fromQuat(q: QuatArg, dst?: T) { + const newDst = (dst ?? new Ctor(12)) as T; const x = q[0]; const y = q[1]; const z = q[2]; const w = q[3]; const x2 = x + x; const y2 = y + y; const z2 = z + z; @@ -217,11 +167,11 @@ export function fromQuat(q: Quat, dst?: Mat3): Mat3 { const wy = w * y2; const wz = w * z2; - dst[ 0] = 1 - yy - zz; dst[ 1] = yx + wz; dst[ 2] = zx - wy; dst[ 3] = 0; - dst[ 4] = yx - wz; dst[ 5] = 1 - xx - zz; dst[ 6] = zy + wx; dst[ 7] = 0; - dst[ 8] = zx + wy; dst[ 9] = zy - wx; dst[10] = 1 - xx - yy; dst[11] = 0; + newDst[ 0] = 1 - yy - zz; newDst[ 1] = yx + wz; newDst[ 2] = zx - wy; newDst[ 3] = 0; + newDst[ 4] = yx - wz; newDst[ 5] = 1 - xx - zz; newDst[ 6] = zy + wx; newDst[ 7] = 0; + newDst[ 8] = zx + wy; newDst[ 9] = zy - wx; newDst[10] = 1 - xx - yy; newDst[11] = 0; - return dst; + return newDst; } /** @@ -230,14 +180,14 @@ export function fromQuat(q: Quat, dst?: Mat3): Mat3 { * @param dst - matrix to hold result. If not passed a new one is created. * @returns -m. */ -export function negate(m: Mat3, dst?: Mat3): Mat3 { - dst = dst || newMat3(); +function negate(m: Mat3Arg, dst?: T) { + const newDst = (dst ?? new Ctor(12)) as T; - dst[ 0] = -m[ 0]; dst[ 1] = -m[ 1]; dst[ 2] = -m[ 2]; - dst[ 4] = -m[ 4]; dst[ 5] = -m[ 5]; dst[ 6] = -m[ 6]; - dst[ 8] = -m[ 8]; dst[ 9] = -m[ 9]; dst[10] = -m[10]; + newDst[ 0] = -m[ 0]; newDst[ 1] = -m[ 1]; newDst[ 2] = -m[ 2]; + newDst[ 4] = -m[ 4]; newDst[ 5] = -m[ 5]; newDst[ 6] = -m[ 6]; + newDst[ 8] = -m[ 8]; newDst[ 9] = -m[ 9]; newDst[10] = -m[10]; - return dst; + return newDst; } /** @@ -247,14 +197,14 @@ export function negate(m: Mat3, dst?: Mat3): Mat3 { * @param dst - The matrix. If not passed a new one is created. * @returns A copy of m. */ -export function copy(m: Mat3, dst?: Mat3): Mat3 { - dst = dst || newMat3(); +function copy(m: Mat3Arg, dst?: T) { + const newDst = (dst ?? new Ctor(12)) as T; - dst[ 0] = m[ 0]; dst[ 1] = m[ 1]; dst[ 2] = m[ 2]; - dst[ 4] = m[ 4]; dst[ 5] = m[ 5]; dst[ 6] = m[ 6]; - dst[ 8] = m[ 8]; dst[ 9] = m[ 9]; dst[10] = m[10]; + newDst[ 0] = m[ 0]; newDst[ 1] = m[ 1]; newDst[ 2] = m[ 2]; + newDst[ 4] = m[ 4]; newDst[ 5] = m[ 5]; newDst[ 6] = m[ 6]; + newDst[ 8] = m[ 8]; newDst[ 9] = m[ 9]; newDst[10] = m[10]; - return dst; + return newDst; } /** @@ -264,7 +214,7 @@ export function copy(m: Mat3, dst?: Mat3): Mat3 { * @param dst - The matrix. If not passed a new one is created. * @returns A copy of m. */ -export const clone = copy; +const clone = copy; /** * Check if 2 matrices are approximately equal @@ -272,7 +222,7 @@ export const clone = copy; * @param b Operand matrix. * @returns true if matrices are approximately equal */ -export function equalsApproximately(a: Mat3, b: Mat3): boolean { +function equalsApproximately(a: Mat3Arg, b: Mat3Arg): boolean { return Math.abs(a[ 0] - b[ 0]) < utils.EPSILON && Math.abs(a[ 1] - b[ 1]) < utils.EPSILON && Math.abs(a[ 2] - b[ 2]) < utils.EPSILON && @@ -290,7 +240,7 @@ export function equalsApproximately(a: Mat3, b: Mat3): boolean { * @param b Operand matrix. * @returns true if matrices are exactly equal */ -export function equals(a: Mat3, b: Mat3): boolean { +function equals(a: Mat3Arg, b: Mat3Arg): boolean { return a[ 0] === b[ 0] && a[ 1] === b[ 1] && a[ 2] === b[ 2] && @@ -308,14 +258,14 @@ export function equals(a: Mat3, b: Mat3): boolean { * @param dst - matrix to hold result. If not passed a new one is created. * @returns A 3-by-3 identity matrix. */ -export function identity(dst?: Mat3): Mat3 { - dst = dst || newMat3(); +function identity(dst?: T) { + const newDst = (dst ?? new Ctor(12)) as T; - dst[ 0] = 1; dst[ 1] = 0; dst[ 2] = 0; - dst[ 4] = 0; dst[ 5] = 1; dst[ 6] = 0; - dst[ 8] = 0; dst[ 9] = 0; dst[10] = 1; + newDst[ 0] = 1; newDst[ 1] = 0; newDst[ 2] = 0; + newDst[ 4] = 0; newDst[ 5] = 1; newDst[ 6] = 0; + newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1; - return dst; + return newDst; } /** @@ -324,9 +274,9 @@ export function identity(dst?: Mat3): Mat3 { * @param dst - matrix to hold result. If not passed a new one is created. * @returns The transpose of m. */ -export function transpose(m: Mat3, dst?: Mat3): Mat3 { - dst = dst || newMat3(); - if (dst === m) { +function transpose(m: Mat3Arg, dst?: T) { + const newDst = (dst ?? new Ctor(12)) as T; + if (newDst === m) { let t: number; // 0 1 2 @@ -345,7 +295,7 @@ export function transpose(m: Mat3, dst?: Mat3): Mat3 { m[6] = m[9]; m[9] = t; - return dst; + return newDst; } const m00 = m[0 * 4 + 0]; @@ -358,11 +308,11 @@ export function transpose(m: Mat3, dst?: Mat3): Mat3 { const m21 = m[2 * 4 + 1]; const m22 = m[2 * 4 + 2]; - dst[ 0] = m00; dst[ 1] = m10; dst[ 2] = m20; - dst[ 4] = m01; dst[ 5] = m11; dst[ 6] = m21; - dst[ 8] = m02; dst[ 9] = m12; dst[10] = m22; + newDst[ 0] = m00; newDst[ 1] = m10; newDst[ 2] = m20; + newDst[ 4] = m01; newDst[ 5] = m11; newDst[ 6] = m21; + newDst[ 8] = m02; newDst[ 9] = m12; newDst[10] = m22; - return dst; + return newDst; } /** @@ -371,8 +321,8 @@ export function transpose(m: Mat3, dst?: Mat3): Mat3 { * @param dst - matrix to hold result. If not passed a new one is created. * @returns The inverse of m. */ -export function inverse(m: Mat3, dst?: Mat3): Mat3 { - dst = dst || newMat3(); +function inverse(m: Mat3Arg, dst?: T) { + const newDst = (dst ?? new Ctor(12)) as T; const m00 = m[0 * 4 + 0]; const m01 = m[0 * 4 + 1]; @@ -390,17 +340,17 @@ export function inverse(m: Mat3, dst?: Mat3): Mat3 { const invDet = 1 / (m00 * b01 + m01 * b11 + m02 * b21); - dst[ 0] = b01 * invDet; - dst[ 1] = (-m22 * m01 + m02 * m21) * invDet; - dst[ 2] = ( m12 * m01 - m02 * m11) * invDet; - dst[ 4] = b11 * invDet; - dst[ 5] = ( m22 * m00 - m02 * m20) * invDet; - dst[ 6] = (-m12 * m00 + m02 * m10) * invDet; - dst[ 8] = b21 * invDet; - dst[ 9] = (-m21 * m00 + m01 * m20) * invDet; - dst[10] = ( m11 * m00 - m01 * m10) * invDet; - - return dst; + newDst[ 0] = b01 * invDet; + newDst[ 1] = (-m22 * m01 + m02 * m21) * invDet; + newDst[ 2] = ( m12 * m01 - m02 * m11) * invDet; + newDst[ 4] = b11 * invDet; + newDst[ 5] = ( m22 * m00 - m02 * m20) * invDet; + newDst[ 6] = (-m12 * m00 + m02 * m10) * invDet; + newDst[ 8] = b21 * invDet; + newDst[ 9] = (-m21 * m00 + m01 * m20) * invDet; + newDst[10] = ( m11 * m00 - m01 * m10) * invDet; + + return newDst; } /** @@ -408,7 +358,7 @@ export function inverse(m: Mat3, dst?: Mat3): Mat3 { * @param m - the matrix * @returns the determinant */ -export function determinant(m: Mat3): number { +function determinant(m: Mat3Arg): number { const m00 = m[0 * 4 + 0]; const m01 = m[0 * 4 + 1]; const m02 = m[0 * 4 + 2]; @@ -430,7 +380,7 @@ export function determinant(m: Mat3): number { * @param dst - matrix to hold result. If not passed a new one is created. * @returns The inverse of m. */ -export const invert = inverse; +const invert = inverse; /** * Multiplies two 3-by-3 matrices with a on the left and b on the right @@ -439,8 +389,8 @@ export const invert = inverse; * @param dst - matrix to hold result. If not passed a new one is created. * @returns The matrix product of a and b. */ -export function multiply(a: Mat3, b: Mat3, dst?: Mat3): Mat3 { - dst = dst || newMat3(); +function multiply(a: Mat3Arg, b: Mat3Arg, dst?: T) { + const newDst = (dst ?? new Ctor(12)) as T; const a00 = a[0]; const a01 = a[1]; @@ -461,17 +411,17 @@ export function multiply(a: Mat3, b: Mat3, dst?: Mat3): Mat3 { const b21 = b[ 8 + 1]; const b22 = b[ 8 + 2]; - dst[ 0] = a00 * b00 + a10 * b01 + a20 * b02; - dst[ 1] = a01 * b00 + a11 * b01 + a21 * b02; - dst[ 2] = a02 * b00 + a12 * b01 + a22 * b02; - dst[ 4] = a00 * b10 + a10 * b11 + a20 * b12; - dst[ 5] = a01 * b10 + a11 * b11 + a21 * b12; - dst[ 6] = a02 * b10 + a12 * b11 + a22 * b12; - dst[ 8] = a00 * b20 + a10 * b21 + a20 * b22; - dst[ 9] = a01 * b20 + a11 * b21 + a21 * b22; - dst[10] = a02 * b20 + a12 * b21 + a22 * b22; - - return dst; + newDst[ 0] = a00 * b00 + a10 * b01 + a20 * b02; + newDst[ 1] = a01 * b00 + a11 * b01 + a21 * b02; + newDst[ 2] = a02 * b00 + a12 * b01 + a22 * b02; + newDst[ 4] = a00 * b10 + a10 * b11 + a20 * b12; + newDst[ 5] = a01 * b10 + a11 * b11 + a21 * b12; + newDst[ 6] = a02 * b10 + a12 * b11 + a22 * b12; + newDst[ 8] = a00 * b20 + a10 * b21 + a20 * b22; + newDst[ 9] = a01 * b20 + a11 * b21 + a21 * b22; + newDst[10] = a02 * b20 + a12 * b21 + a22 * b22; + + return newDst; } /** @@ -481,7 +431,7 @@ export function multiply(a: Mat3, b: Mat3, dst?: Mat3): Mat3 { * @param dst - matrix to hold result. If not passed a new one is created. * @returns The matrix product of a and b. */ -export const mul = multiply; +const mul = multiply; /** * Sets the translation component of a 3-by-3 matrix to the given @@ -491,20 +441,20 @@ export const mul = multiply; * @param dst - matrix to hold result. If not passed a new one is created. * @returns The matrix with translation set. */ -export function setTranslation(a: Mat3, v: Vec2, dst?: Mat3): Mat3 { - dst = dst || identity(); - if (a !== dst) { - dst[ 0] = a[ 0]; - dst[ 1] = a[ 1]; - dst[ 2] = a[ 2]; - dst[ 4] = a[ 4]; - dst[ 5] = a[ 5]; - dst[ 6] = a[ 6]; +function setTranslation(a: Mat3Arg, v: Vec2Arg, dst?: T) { + const newDst = (dst ?? identity()) as T; + if (a !== newDst) { + newDst[ 0] = a[ 0]; + newDst[ 1] = a[ 1]; + newDst[ 2] = a[ 2]; + newDst[ 4] = a[ 4]; + newDst[ 5] = a[ 5]; + newDst[ 6] = a[ 6]; } - dst[ 8] = v[0]; - dst[ 9] = v[1]; - dst[10] = 1; - return dst; + newDst[ 8] = v[0]; + newDst[ 9] = v[1]; + newDst[10] = 1; + return newDst; } /** @@ -514,11 +464,11 @@ export function setTranslation(a: Mat3, v: Vec2, dst?: Mat3): Mat3 { * @param dst - vector to hold result. If not passed a new one is created. * @returns The translation component of m. */ -export function getTranslation(m: Mat3, dst?: Vec2): Vec2 { - dst = dst || vec2.create(); - dst[0] = m[8]; - dst[1] = m[9]; - return dst; +function getTranslation(m: Mat3Arg, dst?: T) { + const newDst = (dst ?? vec2.create()) as T; + newDst[0] = m[8]; + newDst[1] = m[9]; + return newDst; } /** @@ -527,12 +477,12 @@ export function getTranslation(m: Mat3, dst?: Vec2): Vec2 { * @param axis - The axis 0 = x, 1 = y, * @returns The axis component of m. */ -export function getAxis(m: Mat3, axis: number, dst?: Vec2): Vec2 { - dst = dst || vec2.create(); +function getAxis(m: Mat3Arg, axis: number, dst?: T) { + const newDst = (dst ?? vec2.create()) as T; const off = axis * 4; - dst[0] = m[off + 0]; - dst[1] = m[off + 1]; - return dst; + newDst[0] = m[off + 0]; + newDst[1] = m[off + 1]; + return newDst; } /** @@ -543,33 +493,32 @@ export function getAxis(m: Mat3, axis: number, dst?: Vec2): Vec2 { * @param dst - The matrix to set. If not passed a new one is created. * @returns The matrix with axis set. */ -export function setAxis(m: Mat3, v: Vec2, axis: number, dst?: Mat3): Mat3 { - if (dst !== m) { - dst = copy(m, dst); - } +function setAxis(m: Mat3Arg, v: Vec2Arg, axis: number, dst?: T) { + const newDst = (dst === m ? m : copy(m, dst)) as T; + const off = axis * 4; - dst[off + 0] = v[0]; - dst[off + 1] = v[1]; - return dst; + newDst[off + 0] = v[0]; + newDst[off + 1] = v[1]; + return newDst; } -/** - * Returns the scaling component of the matrix - * @param m - The Matrix - * @param dst - The vector to set. If not passed a new one is created. - */ -export function getScaling(m: Mat3, dst?: Vec2): Vec2 { - dst = dst || vec2.create(); +///** +// * Returns the scaling component of the matrix +// * @param m - The Matrix +// * @param dst - The vector to set. If not passed a new one is created. +// */ +function getScaling(m: Mat3Arg, dst?: T) { + const newDst = (dst ?? vec2.create()); const xx = m[0]; const xy = m[1]; const yx = m[4]; const yy = m[5]; - dst[0] = Math.sqrt(xx * xx + xy * xy); - dst[1] = Math.sqrt(yx * yx + yy * yy); + newDst[0] = Math.sqrt(xx * xx + xy * xy); + newDst[1] = Math.sqrt(yx * yx + yy * yy); - return dst; + return newDst; } /** @@ -578,14 +527,14 @@ export function getScaling(m: Mat3, dst?: Vec2): Vec2 { * @param dst - matrix to hold result. If not passed a new one is created. * @returns The translation matrix. */ -export function translation(v: Vec2, dst?: Mat3): Mat3 { - dst = dst || newMat3(); +function translation(v: Vec2Arg, dst?: T) { + const newDst = (dst ?? new Ctor(12)) as T; - dst[ 0] = 1; dst[ 1] = 0; dst[ 2] = 0; - dst[ 4] = 0; dst[ 5] = 1; dst[ 6] = 0; - dst[ 8] = v[0]; dst[ 9] = v[1]; dst[10] = 1; + newDst[ 0] = 1; newDst[ 1] = 0; newDst[ 2] = 0; + newDst[ 4] = 0; newDst[ 5] = 1; newDst[ 6] = 0; + newDst[ 8] = v[0]; newDst[ 9] = v[1]; newDst[10] = 1; - return dst; + return newDst; } /** @@ -595,8 +544,8 @@ export function translation(v: Vec2, dst?: Mat3): Mat3 { * @param dst - matrix to hold result. If not passed a new one is created. * @returns The translated matrix. */ -export function translate(m: Mat3, v: Vec2, dst?: Mat3): Mat3 { - dst = dst || newMat3(); +function translate(m: Mat3Arg, v: Vec2Arg, dst?: T) { + const newDst = (dst ?? new Ctor(12)) as T; const v0 = v[0]; const v1 = v[1]; @@ -611,20 +560,20 @@ export function translate(m: Mat3, v: Vec2, dst?: Mat3): Mat3 { const m21 = m[2 * 4 + 1]; const m22 = m[2 * 4 + 2]; - if (m !== dst) { - dst[ 0] = m00; - dst[ 1] = m01; - dst[ 2] = m02; - dst[ 4] = m10; - dst[ 5] = m11; - dst[ 6] = m12; + if (m !== newDst) { + newDst[ 0] = m00; + newDst[ 1] = m01; + newDst[ 2] = m02; + newDst[ 4] = m10; + newDst[ 5] = m11; + newDst[ 6] = m12; } - dst[ 8] = m00 * v0 + m10 * v1 + m20; - dst[ 9] = m01 * v0 + m11 * v1 + m21; - dst[10] = m02 * v0 + m12 * v1 + m22; + newDst[ 8] = m00 * v0 + m10 * v1 + m20; + newDst[ 9] = m01 * v0 + m11 * v1 + m21; + newDst[10] = m02 * v0 + m12 * v1 + m22; - return dst; + return newDst; } /** @@ -633,17 +582,17 @@ export function translate(m: Mat3, v: Vec2, dst?: Mat3): Mat3 { * @param dst - matrix to hold result. If not passed a new one is created. * @returns The rotation matrix. */ -export function rotation(angleInRadians: number, dst?: Mat3): Mat3 { - dst = dst || newMat3(); +function rotation(angleInRadians: number, dst?: T) { + const newDst = (dst ?? new Ctor(12)) as T; const c = Math.cos(angleInRadians); const s = Math.sin(angleInRadians); - dst[ 0] = c; dst[ 1] = s; dst[ 2] = 0; - dst[ 4] = -s; dst[ 5] = c; dst[ 6] = 0; - dst[ 8] = 0; dst[ 9] = 0; dst[10] = 1; + newDst[ 0] = c; newDst[ 1] = s; newDst[ 2] = 0; + newDst[ 4] = -s; newDst[ 5] = c; newDst[ 6] = 0; + newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1; - return dst; + return newDst; } /** @@ -653,8 +602,8 @@ export function rotation(angleInRadians: number, dst?: Mat3): Mat3 { * @param dst - matrix to hold result. If not passed a new one is created. * @returns The rotated matrix. */ -export function rotate(m: Mat3, angleInRadians: number, dst?: Mat3): Mat3 { - dst = dst || newMat3(); +function rotate(m: Mat3Arg, angleInRadians: number, dst?: T) { + const newDst = (dst ?? new Ctor(12)) as T; const m00 = m[0 * 4 + 0]; const m01 = m[0 * 4 + 1]; @@ -665,22 +614,22 @@ export function rotate(m: Mat3, angleInRadians: number, dst?: Mat3): Mat3 { const c = Math.cos(angleInRadians); const s = Math.sin(angleInRadians); - dst[ 0] = c * m00 + s * m10; - dst[ 1] = c * m01 + s * m11; - dst[ 2] = c * m02 + s * m12; + newDst[ 0] = c * m00 + s * m10; + newDst[ 1] = c * m01 + s * m11; + newDst[ 2] = c * m02 + s * m12; - dst[ 4] = c * m10 - s * m00; - dst[ 5] = c * m11 - s * m01; - dst[ 6] = c * m12 - s * m02; + newDst[ 4] = c * m10 - s * m00; + newDst[ 5] = c * m11 - s * m01; + newDst[ 6] = c * m12 - s * m02; - if (m !== dst) { - dst[ 8] = m[ 8]; - dst[ 9] = m[ 9]; - dst[10] = m[10]; + if (m !== newDst) { + newDst[ 8] = m[ 8]; + newDst[ 9] = m[ 9]; + newDst[10] = m[10]; } - return dst; + return newDst; } /** @@ -692,14 +641,14 @@ export function rotate(m: Mat3, angleInRadians: number, dst?: Mat3): Mat3 { * @param dst - matrix to hold result. If not passed a new one is created. * @returns The scaling matrix. */ -export function scaling(v: Vec2, dst?: Mat3): Mat3 { - dst = dst || newMat3(); +function scaling(v: Vec2Arg, dst?: T) { + const newDst = (dst ?? new Ctor(12)) as T; - dst[ 0] = v[0]; dst[ 1] = 0; dst[ 2] = 0; - dst[ 4] = 0; dst[ 5] = v[1]; dst[ 6] = 0; - dst[ 8] = 0; dst[ 9] = 0; dst[10] = 1; + newDst[ 0] = v[0]; newDst[ 1] = 0; newDst[ 2] = 0; + newDst[ 4] = 0; newDst[ 5] = v[1]; newDst[ 6] = 0; + newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1; - return dst; + return newDst; } /** @@ -712,27 +661,27 @@ export function scaling(v: Vec2, dst?: Mat3): Mat3 { * @param dst - matrix to hold result. If not passed a new one is created. * @returns The scaled matrix. */ -export function scale(m: Mat3, v: Vec2, dst?: Mat3): Mat3 { - dst = dst || newMat3(); +function scale(m: Mat3Arg, v: Vec2Arg, dst?: T) { + const newDst = (dst ?? new Ctor(12)) as T; const v0 = v[0]; const v1 = v[1]; - dst[ 0] = v0 * m[0 * 4 + 0]; - dst[ 1] = v0 * m[0 * 4 + 1]; - dst[ 2] = v0 * m[0 * 4 + 2]; + newDst[ 0] = v0 * m[0 * 4 + 0]; + newDst[ 1] = v0 * m[0 * 4 + 1]; + newDst[ 2] = v0 * m[0 * 4 + 2]; - dst[ 4] = v1 * m[1 * 4 + 0]; - dst[ 5] = v1 * m[1 * 4 + 1]; - dst[ 6] = v1 * m[1 * 4 + 2]; + newDst[ 4] = v1 * m[1 * 4 + 0]; + newDst[ 5] = v1 * m[1 * 4 + 1]; + newDst[ 6] = v1 * m[1 * 4 + 2]; - if (m !== dst) { - dst[ 8] = m[ 8]; - dst[ 9] = m[ 9]; - dst[10] = m[10]; + if (m !== newDst) { + newDst[ 8] = m[ 8]; + newDst[ 9] = m[ 9]; + newDst[10] = m[10]; } - return dst; + return newDst; } /** @@ -741,14 +690,14 @@ export function scale(m: Mat3, v: Vec2, dst?: Mat3): Mat3 { * @param dst - matrix to hold result. If not passed a new one is created. * @returns The scaling matrix. */ -export function uniformScaling(s: number, dst?: Mat3): Mat3 { - dst = dst || newMat3(); +function uniformScaling(s: number, dst?: T) { + const newDst = (dst ?? new Ctor(12)) as T; - dst[ 0] = s; dst[ 1] = 0; dst[ 2] = 0; - dst[ 4] = 0; dst[ 5] = s; dst[ 6] = 0; - dst[ 8] = 0; dst[ 9] = 0; dst[10] = 1; + newDst[ 0] = s; newDst[ 1] = 0; newDst[ 2] = 0; + newDst[ 4] = 0; newDst[ 5] = s; newDst[ 6] = 0; + newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1; - return dst; + return newDst; } /** @@ -759,22 +708,69 @@ export function uniformScaling(s: number, dst?: Mat3): Mat3 { * @param dst - matrix to hold result. If not passed a new one is created. * @returns The scaled matrix. */ -export function uniformScale(m: Mat3, s: number, dst?: Mat3): Mat3 { - dst = dst || newMat3(); +function uniformScale(m: Mat3Arg, s: number, dst?: T) { + const newDst = (dst ?? new Ctor(12)) as T; - dst[ 0] = s * m[0 * 4 + 0]; - dst[ 1] = s * m[0 * 4 + 1]; - dst[ 2] = s * m[0 * 4 + 2]; + newDst[ 0] = s * m[0 * 4 + 0]; + newDst[ 1] = s * m[0 * 4 + 1]; + newDst[ 2] = s * m[0 * 4 + 2]; - dst[ 4] = s * m[1 * 4 + 0]; - dst[ 5] = s * m[1 * 4 + 1]; - dst[ 6] = s * m[1 * 4 + 2]; + newDst[ 4] = s * m[1 * 4 + 0]; + newDst[ 5] = s * m[1 * 4 + 1]; + newDst[ 6] = s * m[1 * 4 + 2]; - if (m !== dst) { - dst[ 8] = m[ 8]; - dst[ 9] = m[ 9]; - dst[10] = m[10]; + if (m !== newDst) { + newDst[ 8] = m[ 8]; + newDst[ 9] = m[ 9]; + newDst[10] = m[10]; } - return dst; + return newDst; +} + +return { + clone, + create, + set, + fromMat4, + fromQuat, + negate, + copy, + equalsApproximately, + equals, + identity, + transpose, + inverse, + invert, + determinant, + mul, + multiply, + setTranslation, + getTranslation, + getAxis, + setAxis, + getScaling, + translation, + translate, + rotation, + rotate, + scaling, + scale, + uniformScaling, + uniformScale, +}; + +} + +type API = ReturnType>; + +const cache = new Map(); + +export function getAPI(Ctor: Mat3Ctor) { + let api = cache.get(Ctor); + if (!api) { + api = getAPIImpl(Ctor); + cache.set(Ctor, api); + } + return api as API; } diff --git a/src/mat3.ts b/src/mat3.ts index d9a68fd..86b7b49 100644 --- a/src/mat3.ts +++ b/src/mat3.ts @@ -20,9 +20,15 @@ * DEALINGS IN THE SOFTWARE. */ +import { BaseArgType } from "./types"; + /** * A JavaScript array with 12 values, a Float32Array with 12 values, or a Float64Array with 12 values. - * When created by the library will create the default type which is `Float32Array` - * but can be set by calling {@link mat3.setDefaultType}. */ -export type Mat3 = number[] | Float32Array | Float64Array; +export type Mat3Arg = BaseArgType; + +/** + * A specific concrete 3x3 element vector. + */ +export type Mat3Type = T; + diff --git a/src/mat4-impl.ts b/src/mat4-impl.ts index a5c4a2e..6822b02 100644 --- a/src/mat4-impl.ts +++ b/src/mat4-impl.ts @@ -1,18 +1,25 @@ - -import { Mat3 } from './mat3'; -import { Mat4 } from './mat4'; -import { Quat } from './quat'; -import Vec3, * as vec3 from './vec3-impl'; +import { Mat4Arg, Mat4Type } from './mat4'; +import { Mat3Arg } from './mat3'; +import { QuatArg } from './quat'; +import { Vec3Arg } from './vec3'; +import { getAPI as getVec3API } from './vec3-impl'; +import { BaseArgType } from './types'; import * as utils from './utils'; -export default Mat4; +export { Mat4Arg, Mat4Type }; + +type Mat4Ctor = new (n: number) => T; -export type Mat4LikeCtor = new (n: number) => Mat4; +/** + * Generates a typed API for Mat4 + * */ +function getAPIImpl(Ctor: Mat4Ctor) { + const vec3 = getVec3API(Ctor); /** * 4x4 Matrix math math functions. * - * Almost all functions take an optional `dst` argument. If it is not passed in the + * Almost all functions take an optional `newDst` argument. If it is not passed in the * functions will create a new matrix. In other words you can do this * * const mat = mat4.translation([1, 2, 3]); // Creates a new translation matrix @@ -32,18 +39,7 @@ export type Mat4LikeCtor = new (n: number) => Mat4; * mat4.multiply(mat, trans, mat); // Multiplies mat * trans and puts result in mat. * */ -let MatType: Mat4LikeCtor = Float32Array; -/** - * Sets the type this library creates for a Mat4 - * @param ctor - the constructor for the type. Either `Float32Array`, `Float64Array`, or `Array` - * @returns previous constructor for Mat4 - */ -export function setDefaultType(ctor: new (n: number) => Mat4) { - const oldType = MatType; - MatType = ctor; - return oldType; -} /** * Create a Mat4 from values @@ -57,17 +53,6 @@ export function setDefaultType(ctor: new (n: number) => Mat4) { * const m = mat4.clone(someJSArray); * ``` * - * Note: a consequence of the implementation is if your Mat4Type = `Array` - * instead of `Float32Array` or `Float64Array` then any values you - * don't pass in will be undefined. Usually this is not an issue since - * (a) using `Array` is rare and (b) using `mat4.create` is usually used - * to create a Mat4 to be filled out as in - * - * ``` - * const m = mat4.create(); - * mat4.perspective(fov, aspect, near, far, m); - * ``` - * * @param v0 - value for element 0 * @param v1 - value for element 1 * @param v2 - value for element 2 @@ -86,44 +71,44 @@ export function setDefaultType(ctor: new (n: number) => Mat4) { * @param v15 - value for element 15 * @returns created from values. */ -export function create( +function create( v0?: number, v1?: number, v2?: number, v3?: number, v4?: number, v5?: number, v6?: number, v7?: number, v8?: number, v9?: number, v10?: number, v11?: number, - v12?: number, v13?: number, v14?: number, v15?: number): Mat4 { - const dst = new MatType(16); + v12?: number, v13?: number, v14?: number, v15?: number) { + const newDst = new Ctor(16); if (v0 !== undefined) { - dst[0] = v0; + newDst[0] = v0; if (v1 !== undefined) { - dst[1] = v1; + newDst[1] = v1; if (v2 !== undefined) { - dst[2] = v2; + newDst[2] = v2; if (v3 !== undefined) { - dst[3] = v3; + newDst[3] = v3; if (v4 !== undefined) { - dst[4] = v4; + newDst[4] = v4; if (v5 !== undefined) { - dst[5] = v5; + newDst[5] = v5; if (v6 !== undefined) { - dst[6] = v6; + newDst[6] = v6; if (v7 !== undefined) { - dst[7] = v7; + newDst[7] = v7; if (v8 !== undefined) { - dst[8] = v8; + newDst[8] = v8; if (v9 !== undefined) { - dst[9] = v9; + newDst[9] = v9; if (v10 !== undefined) { - dst[10] = v10; + newDst[10] = v10; if (v11 !== undefined) { - dst[11] = v11; + newDst[11] = v11; if (v12 !== undefined) { - dst[12] = v12; + newDst[12] = v12; if (v13 !== undefined) { - dst[13] = v13; + newDst[13] = v13; if (v14 !== undefined) { - dst[14] = v14; + newDst[14] = v14; if (v15 !== undefined) { - dst[15] = v15; + newDst[15] = v15; } } } @@ -140,7 +125,7 @@ export function create( } } } - return dst; + return newDst; } /** @@ -166,20 +151,20 @@ export function create( * @param dst - matrix to hold result. If not passed a new one is created. * @returns Mat4 created from values. */ -export function set( +function set( v0: number, v1: number, v2: number, v3: number, v4: number, v5: number, v6: number, v7: number, v8: number, v9: number, v10: number, v11: number, v12: number, v13: number, v14: number, v15: number, - dst?: Mat4): Mat4 { - dst = dst || new MatType(16); + dst?: T) { + const newDst = (dst ?? new Ctor(16)) as T; - dst[ 0] = v0; dst[ 1] = v1; dst[ 2] = v2; dst[ 3] = v3; - dst[ 4] = v4; dst[ 5] = v5; dst[ 6] = v6; dst[ 7] = v7; - dst[ 8] = v8; dst[ 9] = v9; dst[10] = v10; dst[11] = v11; - dst[12] = v12; dst[13] = v13; dst[14] = v14; dst[15] = v15; + newDst[ 0] = v0; newDst[ 1] = v1; newDst[ 2] = v2; newDst[ 3] = v3; + newDst[ 4] = v4; newDst[ 5] = v5; newDst[ 6] = v6; newDst[ 7] = v7; + newDst[ 8] = v8; newDst[ 9] = v9; newDst[10] = v10; newDst[11] = v11; + newDst[12] = v12; newDst[13] = v13; newDst[14] = v14; newDst[15] = v15; - return dst; + return newDst; } /** @@ -188,15 +173,15 @@ export function set( * @param dst - matrix to hold result. If not passed a new one is created. * @returns Mat4 made from m3 */ -export function fromMat3(m3: Mat3, dst?: Mat4): Mat4 { - dst = dst || new MatType(16); +function fromMat3(m3: Mat3Arg, dst?: T) { + const newDst = (dst ?? new Ctor(16)) as T; - dst[ 0] = m3[0]; dst[ 1] = m3[1]; dst[ 2] = m3[ 2]; dst[ 3] = 0; - dst[ 4] = m3[4]; dst[ 5] = m3[5]; dst[ 6] = m3[ 6]; dst[ 7] = 0; - dst[ 8] = m3[8]; dst[ 9] = m3[9]; dst[10] = m3[10]; dst[11] = 0; - dst[12] = 0; dst[13] = 0; dst[14] = 0; dst[15] = 1; + newDst[ 0] = m3[0]; newDst[ 1] = m3[1]; newDst[ 2] = m3[ 2]; newDst[ 3] = 0; + newDst[ 4] = m3[4]; newDst[ 5] = m3[5]; newDst[ 6] = m3[ 6]; newDst[ 7] = 0; + newDst[ 8] = m3[8]; newDst[ 9] = m3[9]; newDst[10] = m3[10]; newDst[11] = 0; + newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1; - return dst; + return newDst; } /** @@ -205,8 +190,8 @@ export function fromMat3(m3: Mat3, dst?: Mat4): Mat4 { * @param dst - matrix to hold result. If not passed a new one is created. * @returns Mat4 made from q */ -export function fromQuat(q: Quat, dst?: Mat4): Mat4 { - dst = dst || new MatType(16); +function fromQuat(q: QuatArg, dst?: T) { + const newDst = (dst ?? new Ctor(16)) as T; const x = q[0]; const y = q[1]; const z = q[2]; const w = q[3]; const x2 = x + x; const y2 = y + y; const z2 = z + z; @@ -221,12 +206,12 @@ export function fromQuat(q: Quat, dst?: Mat4): Mat4 { const wy = w * y2; const wz = w * z2; - dst[ 0] = 1 - yy - zz; dst[ 1] = yx + wz; dst[ 2] = zx - wy; dst[ 3] = 0; - dst[ 4] = yx - wz; dst[ 5] = 1 - xx - zz; dst[ 6] = zy + wx; dst[ 7] = 0; - dst[ 8] = zx + wy; dst[ 9] = zy - wx; dst[10] = 1 - xx - yy; dst[11] = 0; - dst[12] = 0; dst[13] = 0; dst[14] = 0; dst[15] = 1; + newDst[ 0] = 1 - yy - zz; newDst[ 1] = yx + wz; newDst[ 2] = zx - wy; newDst[ 3] = 0; + newDst[ 4] = yx - wz; newDst[ 5] = 1 - xx - zz; newDst[ 6] = zy + wx; newDst[ 7] = 0; + newDst[ 8] = zx + wy; newDst[ 9] = zy - wx; newDst[10] = 1 - xx - yy; newDst[11] = 0; + newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1; - return dst; + return newDst; } /** @@ -235,15 +220,15 @@ export function fromQuat(q: Quat, dst?: Mat4): Mat4 { * @param dst - matrix to hold result. If not passed a new one is created. * @returns -m. */ -export function negate(m: Mat4, dst?: Mat4): Mat4 { - dst = dst || new MatType(16); +function negate(m: Mat4Arg, dst?: T) { + const newDst = (dst ?? new Ctor(16)) as T; - dst[ 0] = -m[ 0]; dst[ 1] = -m[ 1]; dst[ 2] = -m[ 2]; dst[ 3] = -m[ 3]; - dst[ 4] = -m[ 4]; dst[ 5] = -m[ 5]; dst[ 6] = -m[ 6]; dst[ 7] = -m[ 7]; - dst[ 8] = -m[ 8]; dst[ 9] = -m[ 9]; dst[10] = -m[10]; dst[11] = -m[11]; - dst[12] = -m[12]; dst[13] = -m[13]; dst[14] = -m[14]; dst[15] = -m[15]; + newDst[ 0] = -m[ 0]; newDst[ 1] = -m[ 1]; newDst[ 2] = -m[ 2]; newDst[ 3] = -m[ 3]; + newDst[ 4] = -m[ 4]; newDst[ 5] = -m[ 5]; newDst[ 6] = -m[ 6]; newDst[ 7] = -m[ 7]; + newDst[ 8] = -m[ 8]; newDst[ 9] = -m[ 9]; newDst[10] = -m[10]; newDst[11] = -m[11]; + newDst[12] = -m[12]; newDst[13] = -m[13]; newDst[14] = -m[14]; newDst[15] = -m[15]; - return dst; + return newDst; } /** @@ -253,15 +238,15 @@ export function negate(m: Mat4, dst?: Mat4): Mat4 { * @param dst - The matrix. If not passed a new one is created. * @returns A copy of m. */ -export function copy(m: Mat4, dst?: Mat4): Mat4 { - dst = dst || new MatType(16); +function copy(m: Mat4Arg, dst?: T) { + const newDst = (dst ?? new Ctor(16)) as T; - dst[ 0] = m[ 0]; dst[ 1] = m[ 1]; dst[ 2] = m[ 2]; dst[ 3] = m[ 3]; - dst[ 4] = m[ 4]; dst[ 5] = m[ 5]; dst[ 6] = m[ 6]; dst[ 7] = m[ 7]; - dst[ 8] = m[ 8]; dst[ 9] = m[ 9]; dst[10] = m[10]; dst[11] = m[11]; - dst[12] = m[12]; dst[13] = m[13]; dst[14] = m[14]; dst[15] = m[15]; + newDst[ 0] = m[ 0]; newDst[ 1] = m[ 1]; newDst[ 2] = m[ 2]; newDst[ 3] = m[ 3]; + newDst[ 4] = m[ 4]; newDst[ 5] = m[ 5]; newDst[ 6] = m[ 6]; newDst[ 7] = m[ 7]; + newDst[ 8] = m[ 8]; newDst[ 9] = m[ 9]; newDst[10] = m[10]; newDst[11] = m[11]; + newDst[12] = m[12]; newDst[13] = m[13]; newDst[14] = m[14]; newDst[15] = m[15]; - return dst; + return newDst; } /** @@ -271,7 +256,7 @@ export function copy(m: Mat4, dst?: Mat4): Mat4 { * @param dst - The matrix. If not passed a new one is created. * @returns A copy of m. */ -export const clone = copy; +const clone = copy; /** * Check if 2 matrices are approximately equal @@ -279,7 +264,7 @@ export const clone = copy; * @param b - Operand matrix. * @returns true if matrices are approximately equal */ -export function equalsApproximately(a: Mat4, b: Mat4): boolean { +function equalsApproximately(a: Mat4Arg, b: Mat4Arg): boolean { return Math.abs(a[ 0] - b[ 0]) < utils.EPSILON && Math.abs(a[ 1] - b[ 1]) < utils.EPSILON && Math.abs(a[ 2] - b[ 2]) < utils.EPSILON && @@ -304,7 +289,7 @@ export function equalsApproximately(a: Mat4, b: Mat4): boolean { * @param b - Operand matrix. * @returns true if matrices are exactly equal */ -export function equals(a: Mat4, b: Mat4): boolean { +function equals(a: Mat4Arg, b: Mat4Arg): boolean { return a[ 0] === b[ 0] && a[ 1] === b[ 1] && a[ 2] === b[ 2] && @@ -329,15 +314,15 @@ export function equals(a: Mat4, b: Mat4): boolean { * @param dst - matrix to hold result. If not passed a new one is created. * @returns A 4-by-4 identity matrix. */ -export function identity(dst?: Mat4): Mat4 { - dst = dst || new MatType(16); +function identity(dst?: T) { + const newDst = (dst ?? new Ctor(16)) as T; - dst[ 0] = 1; dst[ 1] = 0; dst[ 2] = 0; dst[ 3] = 0; - dst[ 4] = 0; dst[ 5] = 1; dst[ 6] = 0; dst[ 7] = 0; - dst[ 8] = 0; dst[ 9] = 0; dst[10] = 1; dst[11] = 0; - dst[12] = 0; dst[13] = 0; dst[14] = 0; dst[15] = 1; + newDst[ 0] = 1; newDst[ 1] = 0; newDst[ 2] = 0; newDst[ 3] = 0; + newDst[ 4] = 0; newDst[ 5] = 1; newDst[ 6] = 0; newDst[ 7] = 0; + newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1; newDst[11] = 0; + newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1; - return dst; + return newDst; } /** @@ -346,9 +331,9 @@ export function identity(dst?: Mat4): Mat4 { * @param dst - matrix to hold result. If not passed a new one is created. * @returns The transpose of m. */ -export function transpose(m: Mat4, dst?: Mat4): Mat4 { - dst = dst || new MatType(16); - if (dst === m) { +function transpose(m: Mat4Arg, dst?: T) { + const newDst = (dst ?? new Ctor(16)) as T; + if (newDst === m) { let t; t = m[1]; @@ -374,7 +359,7 @@ export function transpose(m: Mat4, dst?: Mat4): Mat4 { t = m[11]; m[11] = m[14]; m[14] = t; - return dst; + return newDst; } const m00 = m[0 * 4 + 0]; @@ -394,12 +379,12 @@ export function transpose(m: Mat4, dst?: Mat4): Mat4 { const m32 = m[3 * 4 + 2]; const m33 = m[3 * 4 + 3]; - dst[ 0] = m00; dst[ 1] = m10; dst[ 2] = m20; dst[ 3] = m30; - dst[ 4] = m01; dst[ 5] = m11; dst[ 6] = m21; dst[ 7] = m31; - dst[ 8] = m02; dst[ 9] = m12; dst[10] = m22; dst[11] = m32; - dst[12] = m03; dst[13] = m13; dst[14] = m23; dst[15] = m33; + newDst[ 0] = m00; newDst[ 1] = m10; newDst[ 2] = m20; newDst[ 3] = m30; + newDst[ 4] = m01; newDst[ 5] = m11; newDst[ 6] = m21; newDst[ 7] = m31; + newDst[ 8] = m02; newDst[ 9] = m12; newDst[10] = m22; newDst[11] = m32; + newDst[12] = m03; newDst[13] = m13; newDst[14] = m23; newDst[15] = m33; - return dst; + return newDst; } /** @@ -408,8 +393,8 @@ export function transpose(m: Mat4, dst?: Mat4): Mat4 { * @param dst - matrix to hold result. If not passed a new one is created. * @returns The inverse of m. */ -export function inverse(m: Mat4, dst?: Mat4): Mat4 { - dst = dst || new MatType(16); +function inverse(m: Mat4Arg, dst?: T) { + const newDst = (dst ?? new Ctor(16)) as T; const m00 = m[0 * 4 + 0]; const m01 = m[0 * 4 + 1]; @@ -463,36 +448,36 @@ export function inverse(m: Mat4, dst?: Mat4): Mat4 { const d = 1 / (m00 * t0 + m10 * t1 + m20 * t2 + m30 * t3); - dst[ 0] = d * t0; - dst[ 1] = d * t1; - dst[ 2] = d * t2; - dst[ 3] = d * t3; - dst[ 4] = d * ((tmp1 * m10 + tmp2 * m20 + tmp5 * m30) - + newDst[ 0] = d * t0; + newDst[ 1] = d * t1; + newDst[ 2] = d * t2; + newDst[ 3] = d * t3; + newDst[ 4] = d * ((tmp1 * m10 + tmp2 * m20 + tmp5 * m30) - (tmp0 * m10 + tmp3 * m20 + tmp4 * m30)); - dst[ 5] = d * ((tmp0 * m00 + tmp7 * m20 + tmp8 * m30) - + newDst[ 5] = d * ((tmp0 * m00 + tmp7 * m20 + tmp8 * m30) - (tmp1 * m00 + tmp6 * m20 + tmp9 * m30)); - dst[ 6] = d * ((tmp3 * m00 + tmp6 * m10 + tmp11 * m30) - + newDst[ 6] = d * ((tmp3 * m00 + tmp6 * m10 + tmp11 * m30) - (tmp2 * m00 + tmp7 * m10 + tmp10 * m30)); - dst[ 7] = d * ((tmp4 * m00 + tmp9 * m10 + tmp10 * m20) - + newDst[ 7] = d * ((tmp4 * m00 + tmp9 * m10 + tmp10 * m20) - (tmp5 * m00 + tmp8 * m10 + tmp11 * m20)); - dst[ 8] = d * ((tmp12 * m13 + tmp15 * m23 + tmp16 * m33) - + newDst[ 8] = d * ((tmp12 * m13 + tmp15 * m23 + tmp16 * m33) - (tmp13 * m13 + tmp14 * m23 + tmp17 * m33)); - dst[ 9] = d * ((tmp13 * m03 + tmp18 * m23 + tmp21 * m33) - + newDst[ 9] = d * ((tmp13 * m03 + tmp18 * m23 + tmp21 * m33) - (tmp12 * m03 + tmp19 * m23 + tmp20 * m33)); - dst[10] = d * ((tmp14 * m03 + tmp19 * m13 + tmp22 * m33) - + newDst[10] = d * ((tmp14 * m03 + tmp19 * m13 + tmp22 * m33) - (tmp15 * m03 + tmp18 * m13 + tmp23 * m33)); - dst[11] = d * ((tmp17 * m03 + tmp20 * m13 + tmp23 * m23) - + newDst[11] = d * ((tmp17 * m03 + tmp20 * m13 + tmp23 * m23) - (tmp16 * m03 + tmp21 * m13 + tmp22 * m23)); - dst[12] = d * ((tmp14 * m22 + tmp17 * m32 + tmp13 * m12) - + newDst[12] = d * ((tmp14 * m22 + tmp17 * m32 + tmp13 * m12) - (tmp16 * m32 + tmp12 * m12 + tmp15 * m22)); - dst[13] = d * ((tmp20 * m32 + tmp12 * m02 + tmp19 * m22) - + newDst[13] = d * ((tmp20 * m32 + tmp12 * m02 + tmp19 * m22) - (tmp18 * m22 + tmp21 * m32 + tmp13 * m02)); - dst[14] = d * ((tmp18 * m12 + tmp23 * m32 + tmp15 * m02) - + newDst[14] = d * ((tmp18 * m12 + tmp23 * m32 + tmp15 * m02) - (tmp22 * m32 + tmp14 * m02 + tmp19 * m12)); - dst[15] = d * ((tmp22 * m22 + tmp16 * m02 + tmp21 * m12) - + newDst[15] = d * ((tmp22 * m22 + tmp16 * m02 + tmp21 * m12) - (tmp20 * m12 + tmp23 * m22 + tmp17 * m02)); - return dst; + return newDst; } /** @@ -500,7 +485,7 @@ export function inverse(m: Mat4, dst?: Mat4): Mat4 { * @param m - the matrix * @returns the determinant */ -export function determinant(m: Mat4): number { +function determinant(m: Mat4Arg): number { const m00 = m[0 * 4 + 0]; const m01 = m[0 * 4 + 1]; const m02 = m[0 * 4 + 2]; @@ -549,7 +534,7 @@ export function determinant(m: Mat4): number { * @param dst - matrix to hold result. If not passed a new one is created. * @returns The inverse of m. */ -export const invert = inverse; +const invert = inverse; /** * Multiplies two 4-by-4 matrices with a on the left and b on the right @@ -558,8 +543,8 @@ export const invert = inverse; * @param dst - matrix to hold result. If not passed a new one is created. * @returns The matrix product of a and b. */ -export function multiply(a: Mat4, b: Mat4, dst?: Mat4): Mat4 { - dst = dst || new MatType(16); +function multiply(a: Mat4Arg, b: Mat4Arg, dst?: T) { + const newDst = (dst ?? new Ctor(16)) as T; const a00 = a[0]; const a01 = a[1]; @@ -594,24 +579,24 @@ export function multiply(a: Mat4, b: Mat4, dst?: Mat4): Mat4 { const b32 = b[12 + 2]; const b33 = b[12 + 3]; - dst[ 0] = a00 * b00 + a10 * b01 + a20 * b02 + a30 * b03; - dst[ 1] = a01 * b00 + a11 * b01 + a21 * b02 + a31 * b03; - dst[ 2] = a02 * b00 + a12 * b01 + a22 * b02 + a32 * b03; - dst[ 3] = a03 * b00 + a13 * b01 + a23 * b02 + a33 * b03; - dst[ 4] = a00 * b10 + a10 * b11 + a20 * b12 + a30 * b13; - dst[ 5] = a01 * b10 + a11 * b11 + a21 * b12 + a31 * b13; - dst[ 6] = a02 * b10 + a12 * b11 + a22 * b12 + a32 * b13; - dst[ 7] = a03 * b10 + a13 * b11 + a23 * b12 + a33 * b13; - dst[ 8] = a00 * b20 + a10 * b21 + a20 * b22 + a30 * b23; - dst[ 9] = a01 * b20 + a11 * b21 + a21 * b22 + a31 * b23; - dst[10] = a02 * b20 + a12 * b21 + a22 * b22 + a32 * b23; - dst[11] = a03 * b20 + a13 * b21 + a23 * b22 + a33 * b23; - dst[12] = a00 * b30 + a10 * b31 + a20 * b32 + a30 * b33; - dst[13] = a01 * b30 + a11 * b31 + a21 * b32 + a31 * b33; - dst[14] = a02 * b30 + a12 * b31 + a22 * b32 + a32 * b33; - dst[15] = a03 * b30 + a13 * b31 + a23 * b32 + a33 * b33; - - return dst; + newDst[ 0] = a00 * b00 + a10 * b01 + a20 * b02 + a30 * b03; + newDst[ 1] = a01 * b00 + a11 * b01 + a21 * b02 + a31 * b03; + newDst[ 2] = a02 * b00 + a12 * b01 + a22 * b02 + a32 * b03; + newDst[ 3] = a03 * b00 + a13 * b01 + a23 * b02 + a33 * b03; + newDst[ 4] = a00 * b10 + a10 * b11 + a20 * b12 + a30 * b13; + newDst[ 5] = a01 * b10 + a11 * b11 + a21 * b12 + a31 * b13; + newDst[ 6] = a02 * b10 + a12 * b11 + a22 * b12 + a32 * b13; + newDst[ 7] = a03 * b10 + a13 * b11 + a23 * b12 + a33 * b13; + newDst[ 8] = a00 * b20 + a10 * b21 + a20 * b22 + a30 * b23; + newDst[ 9] = a01 * b20 + a11 * b21 + a21 * b22 + a31 * b23; + newDst[10] = a02 * b20 + a12 * b21 + a22 * b22 + a32 * b23; + newDst[11] = a03 * b20 + a13 * b21 + a23 * b22 + a33 * b23; + newDst[12] = a00 * b30 + a10 * b31 + a20 * b32 + a30 * b33; + newDst[13] = a01 * b30 + a11 * b31 + a21 * b32 + a31 * b33; + newDst[14] = a02 * b30 + a12 * b31 + a22 * b32 + a32 * b33; + newDst[15] = a03 * b30 + a13 * b31 + a23 * b32 + a33 * b33; + + return newDst; } /** @@ -621,7 +606,7 @@ export function multiply(a: Mat4, b: Mat4, dst?: Mat4): Mat4 { * @param dst - matrix to hold result. If not passed a new one is created. * @returns The matrix product of a and b. */ -export const mul = multiply; +const mul = multiply; /** * Sets the translation component of a 4-by-4 matrix to the given @@ -631,42 +616,42 @@ export const mul = multiply; * @param dst - matrix to hold result. If not passed a new one is created. * @returns The matrix with translation set. */ -export function setTranslation(a: Mat4, v: Vec3, dst?: Mat4): Mat4 { - dst = dst || identity(); - if (a !== dst) { - dst[ 0] = a[ 0]; - dst[ 1] = a[ 1]; - dst[ 2] = a[ 2]; - dst[ 3] = a[ 3]; - dst[ 4] = a[ 4]; - dst[ 5] = a[ 5]; - dst[ 6] = a[ 6]; - dst[ 7] = a[ 7]; - dst[ 8] = a[ 8]; - dst[ 9] = a[ 9]; - dst[10] = a[10]; - dst[11] = a[11]; +function setTranslation(a: Mat4Arg, v: Vec3Arg, dst?: T) { + const newDst = (dst ?? identity()) as T; + if (a !== newDst) { + newDst[ 0] = a[ 0]; + newDst[ 1] = a[ 1]; + newDst[ 2] = a[ 2]; + newDst[ 3] = a[ 3]; + newDst[ 4] = a[ 4]; + newDst[ 5] = a[ 5]; + newDst[ 6] = a[ 6]; + newDst[ 7] = a[ 7]; + newDst[ 8] = a[ 8]; + newDst[ 9] = a[ 9]; + newDst[10] = a[10]; + newDst[11] = a[11]; } - dst[12] = v[0]; - dst[13] = v[1]; - dst[14] = v[2]; - dst[15] = 1; - return dst; + newDst[12] = v[0]; + newDst[13] = v[1]; + newDst[14] = v[2]; + newDst[15] = 1; + return newDst; } -/** - * Returns the translation component of a 4-by-4 matrix as a vector with 3 - * entries. - * @param m - The matrix. - * @param dst - vector to hold result. If not passed a new one is created. - * @returns The translation component of m. - */ -export function getTranslation(m: Mat4, dst?: Vec3): Vec3 { - dst = dst || vec3.create(); - dst[0] = m[12]; - dst[1] = m[13]; - dst[2] = m[14]; - return dst; +///** +// * Returns the translation component of a 4-by-4 matrix as a vector with 3 +// * entries. +// * @param m - The matrix. +// * @param dst - vector to hold result. If not passed a new one is created. +// * @returns The translation component of m. +// */ +function getTranslation(m: Mat4Arg, dst?: T) { + const newDst = (dst ?? vec3.create()) as T; + newDst[0] = m[12]; + newDst[1] = m[13]; + newDst[2] = m[14]; + return newDst; } /** @@ -675,13 +660,13 @@ export function getTranslation(m: Mat4, dst?: Vec3): Vec3 { * @param axis - The axis 0 = x, 1 = y, 2 = z; * @returns The axis component of m. */ -export function getAxis(m: Mat4, axis: number, dst?: Vec3): Vec3 { - dst = dst || vec3.create(); +function getAxis(m: Mat4Arg, axis: number, dst?: T) { + const newDst = (dst ?? vec3.create()); const off = axis * 4; - dst[0] = m[off + 0]; - dst[1] = m[off + 1]; - dst[2] = m[off + 2]; - return dst; + newDst[0] = m[off + 0]; + newDst[1] = m[off + 1]; + newDst[2] = m[off + 2]; + return newDst; } /** @@ -692,24 +677,23 @@ export function getAxis(m: Mat4, axis: number, dst?: Vec3): Vec3 { * @param dst - The matrix to set. If not passed a new one is created. * @returns The matrix with axis set. */ -export function setAxis(m: Mat4, v: Vec3, axis: number, dst: Mat4): Mat4 { - if (dst !== m) { - dst = copy(m, dst); - } +function setAxis(m: Mat4Arg, v: Vec3Arg, axis: number, dst: T) { + const newDst = (dst === m) ? dst : copy(m, dst); + const off = axis * 4; - dst[off + 0] = v[0]; - dst[off + 1] = v[1]; - dst[off + 2] = v[2]; - return dst; + newDst[off + 0] = v[0]; + newDst[off + 1] = v[1]; + newDst[off + 2] = v[2]; + return newDst; } -/** - * Returns the scaling component of the matrix - * @param m - The Matrix - * @param dst - The vector to set. If not passed a new one is created. - */ -export function getScaling(m: Mat4, dst?: Vec3): Vec3 { - dst = dst || vec3.create(); +///** +// * Returns the scaling component of the matrix +// * @param m - The Matrix +// * @param dst - The vector to set. If not passed a new one is created. +// */ +function getScaling(m: Mat4Arg, dst?: T) { + const newDst = (dst ?? vec3.create()) as T; const xx = m[0]; const xy = m[1]; @@ -721,11 +705,11 @@ export function getScaling(m: Mat4, dst?: Vec3): Vec3 { const zy = m[9]; const zz = m[10]; - dst[0] = Math.sqrt(xx * xx + xy * xy + xz * xz); - dst[1] = Math.sqrt(yx * yx + yy * yy + yz * yz); - dst[2] = Math.sqrt(zx * zx + zy * zy + zz * zz); + newDst[0] = Math.sqrt(xx * xx + xy * xy + xz * xz); + newDst[1] = Math.sqrt(yx * yx + yy * yy + yz * yz); + newDst[2] = Math.sqrt(zx * zx + zy * zy + zz * zz); - return dst; + return newDst; } /** @@ -753,39 +737,39 @@ export function getScaling(m: Mat4, dst?: Vec3): Vec3 { * @param dst - matrix to hold result. If not passed a new one is created. * @returns The perspective matrix. */ -export function perspective(fieldOfViewYInRadians: number, aspect: number, zNear: number, zFar: number, dst?: Mat4): Mat4 { - dst = dst || new MatType(16); +function perspective(fieldOfViewYInRadians: number, aspect: number, zNear: number, zFar: number, dst?: T) { + const newDst = (dst ?? new Ctor(16)) as T; const f = Math.tan(Math.PI * 0.5 - 0.5 * fieldOfViewYInRadians); - dst[0] = f / aspect; - dst[1] = 0; - dst[2] = 0; - dst[3] = 0; + newDst[0] = f / aspect; + newDst[1] = 0; + newDst[2] = 0; + newDst[3] = 0; - dst[4] = 0; - dst[5] = f; - dst[6] = 0; - dst[7] = 0; + newDst[4] = 0; + newDst[5] = f; + newDst[6] = 0; + newDst[7] = 0; - dst[8] = 0; - dst[9] = 0; - dst[11] = -1; + newDst[8] = 0; + newDst[9] = 0; + newDst[11] = -1; - dst[12] = 0; - dst[13] = 0; - dst[15] = 0; + newDst[12] = 0; + newDst[13] = 0; + newDst[15] = 0; if (Number.isFinite(zFar)) { const rangeInv = 1 / (zNear - zFar); - dst[10] = zFar * rangeInv; - dst[14] = zFar * zNear * rangeInv; + newDst[10] = zFar * rangeInv; + newDst[14] = zFar * zNear * rangeInv; } else { - dst[10] = -1; - dst[14] = -zNear; + newDst[10] = -1; + newDst[14] = -zNear; } - return dst; + return newDst; } /** @@ -808,39 +792,39 @@ export function perspective(fieldOfViewYInRadians: number, aspect: number, zNear * of the far clipping plane. (default = Infinity) * @param dst - matrix to hold result. If not passed a new one is created. * @returns The perspective matrix. - */export function perspectiveReverseZ(fieldOfViewYInRadians: number, aspect: number, zNear: number, zFar = Infinity, dst?: Mat4) { - dst = dst || new MatType(16); + */function perspectiveReverseZ(fieldOfViewYInRadians: number, aspect: number, zNear: number, zFar = Infinity, dst?: T) { + const newDst = (dst ?? new Ctor(16)) as T; const f = 1 / Math.tan(fieldOfViewYInRadians * 0.5); - dst[ 0] = f / aspect; - dst[ 1] = 0; - dst[ 2] = 0; - dst[ 3] = 0; + newDst[ 0] = f / aspect; + newDst[ 1] = 0; + newDst[ 2] = 0; + newDst[ 3] = 0; - dst[ 4] = 0; - dst[ 5] = f; - dst[ 6] = 0; - dst[ 7] = 0; + newDst[ 4] = 0; + newDst[ 5] = f; + newDst[ 6] = 0; + newDst[ 7] = 0; - dst[ 8] = 0; - dst[ 9] = 0; - dst[11] = -1; + newDst[ 8] = 0; + newDst[ 9] = 0; + newDst[11] = -1; - dst[12] = 0; - dst[13] = 0; - dst[15] = 0; + newDst[12] = 0; + newDst[13] = 0; + newDst[15] = 0; if (zFar === Infinity) { - dst[10] = 0; - dst[14] = zNear; + newDst[10] = 0; + newDst[14] = zNear; } else { const rangeInv = 1 / (zFar - zNear); - dst[10] = zNear * rangeInv; - dst[14] = zFar * zNear * rangeInv; + newDst[10] = zNear * rangeInv; + newDst[14] = zFar * zNear * rangeInv; } - return dst; + return newDst; } /** @@ -858,30 +842,30 @@ export function perspective(fieldOfViewYInRadians: number, aspect: number, zNear * @param dst - Output matrix. If not passed a new one is created. * @returns The orthographic projection matrix. */ -export function ortho(left: number, right: number, bottom: number, top: number, near: number, far: number, dst?: Mat4): Mat4 { - dst = dst || new MatType(16); - - dst[0] = 2 / (right - left); - dst[1] = 0; - dst[2] = 0; - dst[3] = 0; - - dst[4] = 0; - dst[5] = 2 / (top - bottom); - dst[6] = 0; - dst[7] = 0; - - dst[8] = 0; - dst[9] = 0; - dst[10] = 1 / (near - far); - dst[11] = 0; - - dst[12] = (right + left) / (left - right); - dst[13] = (top + bottom) / (bottom - top); - dst[14] = near / (near - far); - dst[15] = 1; - - return dst; +function ortho(left: number, right: number, bottom: number, top: number, near: number, far: number, dst?: T) { + const newDst = (dst ?? new Ctor(16)) as T; + + newDst[0] = 2 / (right - left); + newDst[1] = 0; + newDst[2] = 0; + newDst[3] = 0; + + newDst[4] = 0; + newDst[5] = 2 / (top - bottom); + newDst[6] = 0; + newDst[7] = 0; + + newDst[8] = 0; + newDst[9] = 0; + newDst[10] = 1 / (near - far); + newDst[11] = 0; + + newDst[12] = (right + left) / (left - right); + newDst[13] = (top + bottom) / (bottom - top); + newDst[14] = near / (near - far); + newDst[15] = 1; + + return newDst; } /** @@ -902,31 +886,31 @@ export function ortho(left: number, right: number, bottom: number, top: number, * @param dst - Output matrix. If not passed a new one is created. * @returns The perspective projection matrix. */ -export function frustum(left: number, right: number, bottom: number, top: number, near: number, far: number, dst?: Mat4): Mat4 { - dst = dst || new MatType(16); +function frustum(left: number, right: number, bottom: number, top: number, near: number, far: number, dst?: T) { + const newDst = (dst ?? new Ctor(16)) as T; const dx = (right - left); const dy = (top - bottom); const dz = (near - far); - dst[ 0] = 2 * near / dx; - dst[ 1] = 0; - dst[ 2] = 0; - dst[ 3] = 0; - dst[ 4] = 0; - dst[ 5] = 2 * near / dy; - dst[ 6] = 0; - dst[ 7] = 0; - dst[ 8] = (left + right) / dx; - dst[ 9] = (top + bottom) / dy; - dst[10] = far / dz; - dst[11] = -1; - dst[12] = 0; - dst[13] = 0; - dst[14] = near * far / dz; - dst[15] = 0; - - return dst; + newDst[ 0] = 2 * near / dx; + newDst[ 1] = 0; + newDst[ 2] = 0; + newDst[ 3] = 0; + newDst[ 4] = 0; + newDst[ 5] = 2 * near / dy; + newDst[ 6] = 0; + newDst[ 7] = 0; + newDst[ 8] = (left + right) / dx; + newDst[ 9] = (top + bottom) / dy; + newDst[10] = far / dz; + newDst[11] = -1; + newDst[12] = 0; + newDst[13] = 0; + newDst[14] = near * far / dz; + newDst[15] = 0; + + return newDst; } /** @@ -947,42 +931,42 @@ export function frustum(left: number, right: number, bottom: number, top: number * @param dst - Output matrix. If not passed a new one is created. * @returns The perspective projection matrix. */ -export function frustumReverseZ(left: number, right: number, bottom: number, top: number, near: number, far = Infinity, dst?: Mat4): Mat4 { - dst = dst || new MatType(16); +function frustumReverseZ(left: number, right: number, bottom: number, top: number, near: number, far = Infinity, dst?: T) { + const newDst = (dst ?? new Ctor(16)) as T; const dx = (right - left); const dy = (top - bottom); - dst[ 0] = 2 * near / dx; - dst[ 1] = 0; - dst[ 2] = 0; - dst[ 3] = 0; - dst[ 4] = 0; - dst[ 5] = 2 * near / dy; - dst[ 6] = 0; - dst[ 7] = 0; - dst[ 8] = (left + right) / dx; - dst[ 9] = (top + bottom) / dy; - dst[11] = -1; - dst[12] = 0; - dst[13] = 0; - dst[15] = 0; + newDst[ 0] = 2 * near / dx; + newDst[ 1] = 0; + newDst[ 2] = 0; + newDst[ 3] = 0; + newDst[ 4] = 0; + newDst[ 5] = 2 * near / dy; + newDst[ 6] = 0; + newDst[ 7] = 0; + newDst[ 8] = (left + right) / dx; + newDst[ 9] = (top + bottom) / dy; + newDst[11] = -1; + newDst[12] = 0; + newDst[13] = 0; + newDst[15] = 0; if (far === Infinity) { - dst[10] = 0; - dst[14] = near; + newDst[10] = 0; + newDst[14] = near; } else { const rangeInv = 1 / (far - near); - dst[10] = near * rangeInv; - dst[14] = far * near * rangeInv; + newDst[10] = near * rangeInv; + newDst[14] = far * near * rangeInv; } - return dst; + return newDst; } -let xAxis: Vec3; -let yAxis: Vec3; -let zAxis: Vec3; +const xAxis = vec3.create(); +const yAxis = vec3.create(); +const zAxis = vec3.create(); /** * Computes a 4-by-4 aim transformation. @@ -998,23 +982,19 @@ let zAxis: Vec3; * @param dst - matrix to hold result. If not passed a new one is created. * @returns The aim matrix. */ -export function aim(position: Vec3, target: Vec3, up: Vec3, dst?: Mat4): Mat4 { - dst = dst || new MatType(16); - - xAxis = xAxis || vec3.create(); - yAxis = yAxis || vec3.create(); - zAxis = zAxis || vec3.create(); +function aim(position: Vec3Arg, target: Vec3Arg, up: Vec3Arg, dst?: T) { + const newDst = (dst ?? new Ctor(16)) as T; vec3.normalize(vec3.subtract(target, position, zAxis), zAxis); vec3.normalize(vec3.cross(up, zAxis, xAxis), xAxis); vec3.normalize(vec3.cross(zAxis, xAxis, yAxis), yAxis); - dst[ 0] = xAxis[0]; dst[ 1] = xAxis[1]; dst[ 2] = xAxis[2]; dst[ 3] = 0; - dst[ 4] = yAxis[0]; dst[ 5] = yAxis[1]; dst[ 6] = yAxis[2]; dst[ 7] = 0; - dst[ 8] = zAxis[0]; dst[ 9] = zAxis[1]; dst[10] = zAxis[2]; dst[11] = 0; - dst[12] = position[0]; dst[13] = position[1]; dst[14] = position[2]; dst[15] = 1; + newDst[ 0] = xAxis[0]; newDst[ 1] = xAxis[1]; newDst[ 2] = xAxis[2]; newDst[ 3] = 0; + newDst[ 4] = yAxis[0]; newDst[ 5] = yAxis[1]; newDst[ 6] = yAxis[2]; newDst[ 7] = 0; + newDst[ 8] = zAxis[0]; newDst[ 9] = zAxis[1]; newDst[10] = zAxis[2]; newDst[11] = 0; + newDst[12] = position[0]; newDst[13] = position[1]; newDst[14] = position[2]; newDst[15] = 1; - return dst; + return newDst; } /** @@ -1031,23 +1011,19 @@ export function aim(position: Vec3, target: Vec3, up: Vec3, dst?: Mat4): Mat4 { * @param dst - matrix to hold result. If not passed a new one is created. * @returns The aim matrix. */ -export function cameraAim(eye: Vec3, target: Vec3, up: Vec3, dst?: Mat4): Mat4 { - dst = dst || new MatType(16); - - xAxis = xAxis || vec3.create(); - yAxis = yAxis || vec3.create(); - zAxis = zAxis || vec3.create(); +function cameraAim(eye: Vec3Arg, target: Vec3Arg, up: Vec3Arg, dst?: T) { + const newDst = (dst ?? new Ctor(16)) as T; vec3.normalize(vec3.subtract(eye, target, zAxis), zAxis); vec3.normalize(vec3.cross(up, zAxis, xAxis), xAxis); vec3.normalize(vec3.cross(zAxis, xAxis, yAxis), yAxis); - dst[ 0] = xAxis[0]; dst[ 1] = xAxis[1]; dst[ 2] = xAxis[2]; dst[ 3] = 0; - dst[ 4] = yAxis[0]; dst[ 5] = yAxis[1]; dst[ 6] = yAxis[2]; dst[ 7] = 0; - dst[ 8] = zAxis[0]; dst[ 9] = zAxis[1]; dst[10] = zAxis[2]; dst[11] = 0; - dst[12] = eye[0]; dst[13] = eye[1]; dst[14] = eye[2]; dst[15] = 1; + newDst[ 0] = xAxis[0]; newDst[ 1] = xAxis[1]; newDst[ 2] = xAxis[2]; newDst[ 3] = 0; + newDst[ 4] = yAxis[0]; newDst[ 5] = yAxis[1]; newDst[ 6] = yAxis[2]; newDst[ 7] = 0; + newDst[ 8] = zAxis[0]; newDst[ 9] = zAxis[1]; newDst[10] = zAxis[2]; newDst[11] = 0; + newDst[12] = eye[0]; newDst[13] = eye[1]; newDst[14] = eye[2]; newDst[15] = 1; - return dst; + return newDst; } /** @@ -1062,27 +1038,23 @@ export function cameraAim(eye: Vec3, target: Vec3, up: Vec3, dst?: Mat4): Mat4 { * @param dst - matrix to hold result. If not passed a new one is created. * @returns The look-at matrix. */ -export function lookAt(eye: Vec3, target: Vec3, up: Vec3, dst?: Mat4): Mat4 { - dst = dst || new MatType(16); - - xAxis = xAxis || vec3.create(); - yAxis = yAxis || vec3.create(); - zAxis = zAxis || vec3.create(); +function lookAt(eye: Vec3Arg, target: Vec3Arg, up: Vec3Arg, dst?: T) { + const newDst = (dst ?? new Ctor(16)) as T; vec3.normalize(vec3.subtract(eye, target, zAxis), zAxis); vec3.normalize(vec3.cross(up, zAxis, xAxis), xAxis); vec3.normalize(vec3.cross(zAxis, xAxis, yAxis), yAxis); - dst[ 0] = xAxis[0]; dst[ 1] = yAxis[0]; dst[ 2] = zAxis[0]; dst[ 3] = 0; - dst[ 4] = xAxis[1]; dst[ 5] = yAxis[1]; dst[ 6] = zAxis[1]; dst[ 7] = 0; - dst[ 8] = xAxis[2]; dst[ 9] = yAxis[2]; dst[10] = zAxis[2]; dst[11] = 0; + newDst[ 0] = xAxis[0]; newDst[ 1] = yAxis[0]; newDst[ 2] = zAxis[0]; newDst[ 3] = 0; + newDst[ 4] = xAxis[1]; newDst[ 5] = yAxis[1]; newDst[ 6] = zAxis[1]; newDst[ 7] = 0; + newDst[ 8] = xAxis[2]; newDst[ 9] = yAxis[2]; newDst[10] = zAxis[2]; newDst[11] = 0; - dst[12] = -(xAxis[0] * eye[0] + xAxis[1] * eye[1] + xAxis[2] * eye[2]); - dst[13] = -(yAxis[0] * eye[0] + yAxis[1] * eye[1] + yAxis[2] * eye[2]); - dst[14] = -(zAxis[0] * eye[0] + zAxis[1] * eye[1] + zAxis[2] * eye[2]); - dst[15] = 1; + newDst[12] = -(xAxis[0] * eye[0] + xAxis[1] * eye[1] + xAxis[2] * eye[2]); + newDst[13] = -(yAxis[0] * eye[0] + yAxis[1] * eye[1] + yAxis[2] * eye[2]); + newDst[14] = -(zAxis[0] * eye[0] + zAxis[1] * eye[1] + zAxis[2] * eye[2]); + newDst[15] = 1; - return dst; + return newDst; } /** @@ -1092,15 +1064,15 @@ export function lookAt(eye: Vec3, target: Vec3, up: Vec3, dst?: Mat4): Mat4 { * @param dst - matrix to hold result. If not passed a new one is created. * @returns The translation matrix. */ -export function translation(v: Vec3, dst?: Mat4): Mat4 { - dst = dst || new MatType(16); +function translation(v: Vec3Arg, dst?: T) { + const newDst = (dst ?? new Ctor(16)) as T; - dst[ 0] = 1; dst[ 1] = 0; dst[ 2] = 0; dst[ 3] = 0; - dst[ 4] = 0; dst[ 5] = 1; dst[ 6] = 0; dst[ 7] = 0; - dst[ 8] = 0; dst[ 9] = 0; dst[10] = 1; dst[11] = 0; - dst[12] = v[0]; dst[13] = v[1]; dst[14] = v[2]; dst[15] = 1; + newDst[ 0] = 1; newDst[ 1] = 0; newDst[ 2] = 0; newDst[ 3] = 0; + newDst[ 4] = 0; newDst[ 5] = 1; newDst[ 6] = 0; newDst[ 7] = 0; + newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1; newDst[11] = 0; + newDst[12] = v[0]; newDst[13] = v[1]; newDst[14] = v[2]; newDst[15] = 1; - return dst; + return newDst; } /** @@ -1111,8 +1083,8 @@ export function translation(v: Vec3, dst?: Mat4): Mat4 { * @param dst - matrix to hold result. If not passed a new one is created. * @returns The translated matrix. */ -export function translate(m: Mat4, v: Vec3, dst?: Mat4): Mat4 { - dst = dst || new MatType(16); +function translate(m: Mat4Arg, v: Vec3Arg, dst?: T) { + const newDst = (dst ?? new Ctor(16)) as T; const v0 = v[0]; const v1 = v[1]; @@ -1134,27 +1106,27 @@ export function translate(m: Mat4, v: Vec3, dst?: Mat4): Mat4 { const m32 = m[3 * 4 + 2]; const m33 = m[3 * 4 + 3]; - if (m !== dst) { - dst[ 0] = m00; - dst[ 1] = m01; - dst[ 2] = m02; - dst[ 3] = m03; - dst[ 4] = m10; - dst[ 5] = m11; - dst[ 6] = m12; - dst[ 7] = m13; - dst[ 8] = m20; - dst[ 9] = m21; - dst[10] = m22; - dst[11] = m23; + if (m !== newDst) { + newDst[ 0] = m00; + newDst[ 1] = m01; + newDst[ 2] = m02; + newDst[ 3] = m03; + newDst[ 4] = m10; + newDst[ 5] = m11; + newDst[ 6] = m12; + newDst[ 7] = m13; + newDst[ 8] = m20; + newDst[ 9] = m21; + newDst[10] = m22; + newDst[11] = m23; } - dst[12] = m00 * v0 + m10 * v1 + m20 * v2 + m30; - dst[13] = m01 * v0 + m11 * v1 + m21 * v2 + m31; - dst[14] = m02 * v0 + m12 * v1 + m22 * v2 + m32; - dst[15] = m03 * v0 + m13 * v1 + m23 * v2 + m33; + newDst[12] = m00 * v0 + m10 * v1 + m20 * v2 + m30; + newDst[13] = m01 * v0 + m11 * v1 + m21 * v2 + m31; + newDst[14] = m02 * v0 + m12 * v1 + m22 * v2 + m32; + newDst[15] = m03 * v0 + m13 * v1 + m23 * v2 + m33; - return dst; + return newDst; } /** @@ -1163,18 +1135,18 @@ export function translate(m: Mat4, v: Vec3, dst?: Mat4): Mat4 { * @param dst - matrix to hold result. If not passed a new one is created. * @returns The rotation matrix. */ -export function rotationX(angleInRadians: number, dst?: Mat4): Mat4 { - dst = dst || new MatType(16); +function rotationX(angleInRadians: number, dst?: T) { + const newDst = (dst ?? new Ctor(16)) as T; const c = Math.cos(angleInRadians); const s = Math.sin(angleInRadians); - dst[ 0] = 1; dst[ 1] = 0; dst[ 2] = 0; dst[ 3] = 0; - dst[ 4] = 0; dst[ 5] = c; dst[ 6] = s; dst[ 7] = 0; - dst[ 8] = 0; dst[ 9] = -s; dst[10] = c; dst[11] = 0; - dst[12] = 0; dst[13] = 0; dst[14] = 0; dst[15] = 1; + newDst[ 0] = 1; newDst[ 1] = 0; newDst[ 2] = 0; newDst[ 3] = 0; + newDst[ 4] = 0; newDst[ 5] = c; newDst[ 6] = s; newDst[ 7] = 0; + newDst[ 8] = 0; newDst[ 9] = -s; newDst[10] = c; newDst[11] = 0; + newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1; - return dst; + return newDst; } /** @@ -1185,8 +1157,8 @@ export function rotationX(angleInRadians: number, dst?: Mat4): Mat4 { * @param dst - matrix to hold result. If not passed a new one is created. * @returns The rotated matrix. */ -export function rotateX(m: Mat4, angleInRadians: number, dst?: Mat4): Mat4 { - dst = dst || new MatType(16); +function rotateX(m: Mat4Arg, angleInRadians: number, dst?: T) { + const newDst = (dst ?? new Ctor(16)) as T; const m10 = m[4]; const m11 = m[5]; @@ -1199,27 +1171,27 @@ export function rotateX(m: Mat4, angleInRadians: number, dst?: Mat4): Mat4 { const c = Math.cos(angleInRadians); const s = Math.sin(angleInRadians); - dst[4] = c * m10 + s * m20; - dst[5] = c * m11 + s * m21; - dst[6] = c * m12 + s * m22; - dst[7] = c * m13 + s * m23; - dst[8] = c * m20 - s * m10; - dst[9] = c * m21 - s * m11; - dst[10] = c * m22 - s * m12; - dst[11] = c * m23 - s * m13; - - if (m !== dst) { - dst[ 0] = m[ 0]; - dst[ 1] = m[ 1]; - dst[ 2] = m[ 2]; - dst[ 3] = m[ 3]; - dst[12] = m[12]; - dst[13] = m[13]; - dst[14] = m[14]; - dst[15] = m[15]; + newDst[4] = c * m10 + s * m20; + newDst[5] = c * m11 + s * m21; + newDst[6] = c * m12 + s * m22; + newDst[7] = c * m13 + s * m23; + newDst[8] = c * m20 - s * m10; + newDst[9] = c * m21 - s * m11; + newDst[10] = c * m22 - s * m12; + newDst[11] = c * m23 - s * m13; + + if (m !== newDst) { + newDst[ 0] = m[ 0]; + newDst[ 1] = m[ 1]; + newDst[ 2] = m[ 2]; + newDst[ 3] = m[ 3]; + newDst[12] = m[12]; + newDst[13] = m[13]; + newDst[14] = m[14]; + newDst[15] = m[15]; } - return dst; + return newDst; } /** @@ -1228,18 +1200,18 @@ export function rotateX(m: Mat4, angleInRadians: number, dst?: Mat4): Mat4 { * @param dst - matrix to hold result. If not passed a new one is created. * @returns The rotation matrix. */ -export function rotationY(angleInRadians: number, dst?: Mat4): Mat4 { - dst = dst || new MatType(16); +function rotationY(angleInRadians: number, dst?: T) { + const newDst = (dst ?? new Ctor(16)) as T; const c = Math.cos(angleInRadians); const s = Math.sin(angleInRadians); - dst[ 0] = c; dst[ 1] = 0; dst[ 2] = -s; dst[ 3] = 0; - dst[ 4] = 0; dst[ 5] = 1; dst[ 6] = 0; dst[ 7] = 0; - dst[ 8] = s; dst[ 9] = 0; dst[10] = c; dst[11] = 0; - dst[12] = 0; dst[13] = 0; dst[14] = 0; dst[15] = 1; + newDst[ 0] = c; newDst[ 1] = 0; newDst[ 2] = -s; newDst[ 3] = 0; + newDst[ 4] = 0; newDst[ 5] = 1; newDst[ 6] = 0; newDst[ 7] = 0; + newDst[ 8] = s; newDst[ 9] = 0; newDst[10] = c; newDst[11] = 0; + newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1; - return dst; + return newDst; } /** @@ -1250,8 +1222,8 @@ export function rotationY(angleInRadians: number, dst?: Mat4): Mat4 { * @param dst - matrix to hold result. If not passed a new one is created. * @returns The rotated matrix. */ -export function rotateY(m: Mat4, angleInRadians: number, dst?: Mat4): Mat4 { - dst = dst || new MatType(16); +function rotateY(m: Mat4Arg, angleInRadians: number, dst?: T) { + const newDst = (dst ?? new Ctor(16)) as T; const m00 = m[0 * 4 + 0]; const m01 = m[0 * 4 + 1]; @@ -1264,27 +1236,27 @@ export function rotateY(m: Mat4, angleInRadians: number, dst?: Mat4): Mat4 { const c = Math.cos(angleInRadians); const s = Math.sin(angleInRadians); - dst[ 0] = c * m00 - s * m20; - dst[ 1] = c * m01 - s * m21; - dst[ 2] = c * m02 - s * m22; - dst[ 3] = c * m03 - s * m23; - dst[ 8] = c * m20 + s * m00; - dst[ 9] = c * m21 + s * m01; - dst[10] = c * m22 + s * m02; - dst[11] = c * m23 + s * m03; - - if (m !== dst) { - dst[ 4] = m[ 4]; - dst[ 5] = m[ 5]; - dst[ 6] = m[ 6]; - dst[ 7] = m[ 7]; - dst[12] = m[12]; - dst[13] = m[13]; - dst[14] = m[14]; - dst[15] = m[15]; + newDst[ 0] = c * m00 - s * m20; + newDst[ 1] = c * m01 - s * m21; + newDst[ 2] = c * m02 - s * m22; + newDst[ 3] = c * m03 - s * m23; + newDst[ 8] = c * m20 + s * m00; + newDst[ 9] = c * m21 + s * m01; + newDst[10] = c * m22 + s * m02; + newDst[11] = c * m23 + s * m03; + + if (m !== newDst) { + newDst[ 4] = m[ 4]; + newDst[ 5] = m[ 5]; + newDst[ 6] = m[ 6]; + newDst[ 7] = m[ 7]; + newDst[12] = m[12]; + newDst[13] = m[13]; + newDst[14] = m[14]; + newDst[15] = m[15]; } - return dst; + return newDst; } /** @@ -1293,18 +1265,18 @@ export function rotateY(m: Mat4, angleInRadians: number, dst?: Mat4): Mat4 { * @param dst - matrix to hold result. If not passed a new one is created. * @returns The rotation matrix. */ -export function rotationZ(angleInRadians: number, dst?: Mat4): Mat4 { - dst = dst || new MatType(16); +function rotationZ(angleInRadians: number, dst?: T) { + const newDst = (dst ?? new Ctor(16)) as T; const c = Math.cos(angleInRadians); const s = Math.sin(angleInRadians); - dst[ 0] = c; dst[ 1] = s; dst[ 2] = 0; dst[ 3] = 0; - dst[ 4] = -s; dst[ 5] = c; dst[ 6] = 0; dst[ 7] = 0; - dst[ 8] = 0; dst[ 9] = 0; dst[10] = 1; dst[11] = 0; - dst[12] = 0; dst[13] = 0; dst[14] = 0; dst[15] = 1; + newDst[ 0] = c; newDst[ 1] = s; newDst[ 2] = 0; newDst[ 3] = 0; + newDst[ 4] = -s; newDst[ 5] = c; newDst[ 6] = 0; newDst[ 7] = 0; + newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = 1; newDst[11] = 0; + newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1; - return dst; + return newDst; } /** @@ -1315,8 +1287,8 @@ export function rotationZ(angleInRadians: number, dst?: Mat4): Mat4 { * @param dst - matrix to hold result. If not passed a new one is created. * @returns The rotated matrix. */ -export function rotateZ(m: Mat4, angleInRadians: number, dst?: Mat4): Mat4 { - dst = dst || new MatType(16); +function rotateZ(m: Mat4Arg, angleInRadians: number, dst?: T) { + const newDst = (dst ?? new Ctor(16)) as T; const m00 = m[0 * 4 + 0]; const m01 = m[0 * 4 + 1]; @@ -1329,27 +1301,27 @@ export function rotateZ(m: Mat4, angleInRadians: number, dst?: Mat4): Mat4 { const c = Math.cos(angleInRadians); const s = Math.sin(angleInRadians); - dst[ 0] = c * m00 + s * m10; - dst[ 1] = c * m01 + s * m11; - dst[ 2] = c * m02 + s * m12; - dst[ 3] = c * m03 + s * m13; - dst[ 4] = c * m10 - s * m00; - dst[ 5] = c * m11 - s * m01; - dst[ 6] = c * m12 - s * m02; - dst[ 7] = c * m13 - s * m03; - - if (m !== dst) { - dst[ 8] = m[ 8]; - dst[ 9] = m[ 9]; - dst[10] = m[10]; - dst[11] = m[11]; - dst[12] = m[12]; - dst[13] = m[13]; - dst[14] = m[14]; - dst[15] = m[15]; + newDst[ 0] = c * m00 + s * m10; + newDst[ 1] = c * m01 + s * m11; + newDst[ 2] = c * m02 + s * m12; + newDst[ 3] = c * m03 + s * m13; + newDst[ 4] = c * m10 - s * m00; + newDst[ 5] = c * m11 - s * m01; + newDst[ 6] = c * m12 - s * m02; + newDst[ 7] = c * m13 - s * m03; + + if (m !== newDst) { + newDst[ 8] = m[ 8]; + newDst[ 9] = m[ 9]; + newDst[10] = m[10]; + newDst[11] = m[11]; + newDst[12] = m[12]; + newDst[13] = m[13]; + newDst[14] = m[14]; + newDst[15] = m[15]; } - return dst; + return newDst; } /** @@ -1362,8 +1334,8 @@ export function rotateZ(m: Mat4, angleInRadians: number, dst?: Mat4): Mat4 { * @returns A matrix which rotates angle radians * around the axis. */ -export function axisRotation(axis: Vec3, angleInRadians: number, dst?: Mat4): Mat4 { - dst = dst || new MatType(16); +function axisRotation(axis: Vec3Arg, angleInRadians: number, dst?: T) { + const newDst = (dst ?? new Ctor(16)) as T; let x = axis[0]; let y = axis[1]; @@ -1379,24 +1351,24 @@ export function axisRotation(axis: Vec3, angleInRadians: number, dst?: Mat4): Ma const s = Math.sin(angleInRadians); const oneMinusCosine = 1 - c; - dst[ 0] = xx + (1 - xx) * c; - dst[ 1] = x * y * oneMinusCosine + z * s; - dst[ 2] = x * z * oneMinusCosine - y * s; - dst[ 3] = 0; - dst[ 4] = x * y * oneMinusCosine - z * s; - dst[ 5] = yy + (1 - yy) * c; - dst[ 6] = y * z * oneMinusCosine + x * s; - dst[ 7] = 0; - dst[ 8] = x * z * oneMinusCosine + y * s; - dst[ 9] = y * z * oneMinusCosine - x * s; - dst[10] = zz + (1 - zz) * c; - dst[11] = 0; - dst[12] = 0; - dst[13] = 0; - dst[14] = 0; - dst[15] = 1; - - return dst; + newDst[ 0] = xx + (1 - xx) * c; + newDst[ 1] = x * y * oneMinusCosine + z * s; + newDst[ 2] = x * z * oneMinusCosine - y * s; + newDst[ 3] = 0; + newDst[ 4] = x * y * oneMinusCosine - z * s; + newDst[ 5] = yy + (1 - yy) * c; + newDst[ 6] = y * z * oneMinusCosine + x * s; + newDst[ 7] = 0; + newDst[ 8] = x * z * oneMinusCosine + y * s; + newDst[ 9] = y * z * oneMinusCosine - x * s; + newDst[10] = zz + (1 - zz) * c; + newDst[11] = 0; + newDst[12] = 0; + newDst[13] = 0; + newDst[14] = 0; + newDst[15] = 1; + + return newDst; } /** @@ -1409,7 +1381,7 @@ export function axisRotation(axis: Vec3, angleInRadians: number, dst?: Mat4): Ma * @returns A matrix which rotates angle radians * around the axis. */ -export const rotation = axisRotation; +const rotation = axisRotation; /** * Rotates the given 4-by-4 matrix around the given axis by the @@ -1421,8 +1393,8 @@ export const rotation = axisRotation; * @param dst - matrix to hold result. If not passed a new one is created. * @returns The rotated matrix. */ -export function axisRotate(m: Mat4, axis: Vec3, angleInRadians: number, dst?: Mat4): Mat4 { - dst = dst || new MatType(16); +function axisRotate(m: Mat4Arg, axis: Vec3Arg, angleInRadians: number, dst?: T) { + const newDst = (dst ?? new Ctor(16)) as T; let x = axis[0]; let y = axis[1]; @@ -1461,27 +1433,27 @@ export function axisRotate(m: Mat4, axis: Vec3, angleInRadians: number, dst?: Ma const m22 = m[10]; const m23 = m[11]; - dst[ 0] = r00 * m00 + r01 * m10 + r02 * m20; - dst[ 1] = r00 * m01 + r01 * m11 + r02 * m21; - dst[ 2] = r00 * m02 + r01 * m12 + r02 * m22; - dst[ 3] = r00 * m03 + r01 * m13 + r02 * m23; - dst[ 4] = r10 * m00 + r11 * m10 + r12 * m20; - dst[ 5] = r10 * m01 + r11 * m11 + r12 * m21; - dst[ 6] = r10 * m02 + r11 * m12 + r12 * m22; - dst[ 7] = r10 * m03 + r11 * m13 + r12 * m23; - dst[ 8] = r20 * m00 + r21 * m10 + r22 * m20; - dst[ 9] = r20 * m01 + r21 * m11 + r22 * m21; - dst[10] = r20 * m02 + r21 * m12 + r22 * m22; - dst[11] = r20 * m03 + r21 * m13 + r22 * m23; - - if (m !== dst) { - dst[12] = m[12]; - dst[13] = m[13]; - dst[14] = m[14]; - dst[15] = m[15]; + newDst[ 0] = r00 * m00 + r01 * m10 + r02 * m20; + newDst[ 1] = r00 * m01 + r01 * m11 + r02 * m21; + newDst[ 2] = r00 * m02 + r01 * m12 + r02 * m22; + newDst[ 3] = r00 * m03 + r01 * m13 + r02 * m23; + newDst[ 4] = r10 * m00 + r11 * m10 + r12 * m20; + newDst[ 5] = r10 * m01 + r11 * m11 + r12 * m21; + newDst[ 6] = r10 * m02 + r11 * m12 + r12 * m22; + newDst[ 7] = r10 * m03 + r11 * m13 + r12 * m23; + newDst[ 8] = r20 * m00 + r21 * m10 + r22 * m20; + newDst[ 9] = r20 * m01 + r21 * m11 + r22 * m21; + newDst[10] = r20 * m02 + r21 * m12 + r22 * m22; + newDst[11] = r20 * m03 + r21 * m13 + r22 * m23; + + if (m !== newDst) { + newDst[12] = m[12]; + newDst[13] = m[13]; + newDst[14] = m[14]; + newDst[15] = m[15]; } - return dst; + return newDst; } /** @@ -1494,7 +1466,7 @@ export function axisRotate(m: Mat4, axis: Vec3, angleInRadians: number, dst?: Ma * @param dst - matrix to hold result. If not passed a new one is created. * @returns The rotated matrix. */ -export const rotate = axisRotate; +const rotate = axisRotate; /** * Creates a 4-by-4 matrix which scales in each dimension by an amount given by @@ -1505,15 +1477,15 @@ export const rotate = axisRotate; * @param dst - matrix to hold result. If not passed a new one is created. * @returns The scaling matrix. */ -export function scaling(v: Vec3, dst?: Mat4): Mat4 { - dst = dst || new MatType(16); +function scaling(v: Vec3Arg, dst?: T) { + const newDst = (dst ?? new Ctor(16)) as T; - dst[ 0] = v[0]; dst[ 1] = 0; dst[ 2] = 0; dst[ 3] = 0; - dst[ 4] = 0; dst[ 5] = v[1]; dst[ 6] = 0; dst[ 7] = 0; - dst[ 8] = 0; dst[ 9] = 0; dst[10] = v[2]; dst[11] = 0; - dst[12] = 0; dst[13] = 0; dst[14] = 0; dst[15] = 1; + newDst[ 0] = v[0]; newDst[ 1] = 0; newDst[ 2] = 0; newDst[ 3] = 0; + newDst[ 4] = 0; newDst[ 5] = v[1]; newDst[ 6] = 0; newDst[ 7] = 0; + newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = v[2]; newDst[11] = 0; + newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1; - return dst; + return newDst; } /** @@ -1526,34 +1498,34 @@ export function scaling(v: Vec3, dst?: Mat4): Mat4 { * @param dst - matrix to hold result. If not passed a new one is created. * @returns The scaled matrix. */ -export function scale(m: Mat4, v: Vec3, dst?: Mat4): Mat4 { - dst = dst || new MatType(16); +function scale(m: Mat4Arg, v: Vec3Arg, dst?: T) { + const newDst = (dst ?? new Ctor(16)) as T; const v0 = v[0]; const v1 = v[1]; const v2 = v[2]; - dst[ 0] = v0 * m[0 * 4 + 0]; - dst[ 1] = v0 * m[0 * 4 + 1]; - dst[ 2] = v0 * m[0 * 4 + 2]; - dst[ 3] = v0 * m[0 * 4 + 3]; - dst[ 4] = v1 * m[1 * 4 + 0]; - dst[ 5] = v1 * m[1 * 4 + 1]; - dst[ 6] = v1 * m[1 * 4 + 2]; - dst[ 7] = v1 * m[1 * 4 + 3]; - dst[ 8] = v2 * m[2 * 4 + 0]; - dst[ 9] = v2 * m[2 * 4 + 1]; - dst[10] = v2 * m[2 * 4 + 2]; - dst[11] = v2 * m[2 * 4 + 3]; - - if (m !== dst) { - dst[12] = m[12]; - dst[13] = m[13]; - dst[14] = m[14]; - dst[15] = m[15]; + newDst[ 0] = v0 * m[0 * 4 + 0]; + newDst[ 1] = v0 * m[0 * 4 + 1]; + newDst[ 2] = v0 * m[0 * 4 + 2]; + newDst[ 3] = v0 * m[0 * 4 + 3]; + newDst[ 4] = v1 * m[1 * 4 + 0]; + newDst[ 5] = v1 * m[1 * 4 + 1]; + newDst[ 6] = v1 * m[1 * 4 + 2]; + newDst[ 7] = v1 * m[1 * 4 + 3]; + newDst[ 8] = v2 * m[2 * 4 + 0]; + newDst[ 9] = v2 * m[2 * 4 + 1]; + newDst[10] = v2 * m[2 * 4 + 2]; + newDst[11] = v2 * m[2 * 4 + 3]; + + if (m !== newDst) { + newDst[12] = m[12]; + newDst[13] = m[13]; + newDst[14] = m[14]; + newDst[15] = m[15]; } - return dst; + return newDst; } /** @@ -1562,15 +1534,15 @@ export function scale(m: Mat4, v: Vec3, dst?: Mat4): Mat4 { * @param dst - matrix to hold result. If not passed a new one is created. * @returns The scaling matrix. */ -export function uniformScaling(s: number, dst?: Mat4): Mat4 { - dst = dst || new MatType(16); +function uniformScaling(s: number, dst?: T) { + const newDst = (dst ?? new Ctor(16)) as T; - dst[ 0] = s; dst[ 1] = 0; dst[ 2] = 0; dst[ 3] = 0; - dst[ 4] = 0; dst[ 5] = s; dst[ 6] = 0; dst[ 7] = 0; - dst[ 8] = 0; dst[ 9] = 0; dst[10] = s; dst[11] = 0; - dst[12] = 0; dst[13] = 0; dst[14] = 0; dst[15] = 1; + newDst[ 0] = s; newDst[ 1] = 0; newDst[ 2] = 0; newDst[ 3] = 0; + newDst[ 4] = 0; newDst[ 5] = s; newDst[ 6] = 0; newDst[ 7] = 0; + newDst[ 8] = 0; newDst[ 9] = 0; newDst[10] = s; newDst[11] = 0; + newDst[12] = 0; newDst[13] = 0; newDst[14] = 0; newDst[15] = 1; - return dst; + return newDst; } /** @@ -1580,28 +1552,92 @@ export function uniformScaling(s: number, dst?: Mat4): Mat4 { * @param dst - matrix to hold result. If not passed a new one is created. * @returns The scaled matrix. */ -export function uniformScale(m: Mat4, s: number, dst?: Mat4): Mat4 { - dst = dst || new MatType(16); - - dst[ 0] = s * m[0 * 4 + 0]; - dst[ 1] = s * m[0 * 4 + 1]; - dst[ 2] = s * m[0 * 4 + 2]; - dst[ 3] = s * m[0 * 4 + 3]; - dst[ 4] = s * m[1 * 4 + 0]; - dst[ 5] = s * m[1 * 4 + 1]; - dst[ 6] = s * m[1 * 4 + 2]; - dst[ 7] = s * m[1 * 4 + 3]; - dst[ 8] = s * m[2 * 4 + 0]; - dst[ 9] = s * m[2 * 4 + 1]; - dst[10] = s * m[2 * 4 + 2]; - dst[11] = s * m[2 * 4 + 3]; - - if (m !== dst) { - dst[12] = m[12]; - dst[13] = m[13]; - dst[14] = m[14]; - dst[15] = m[15]; +function uniformScale(m: Mat4Arg, s: number, dst?: T) { + const newDst = (dst ?? new Ctor(16)) as T; + + newDst[ 0] = s * m[0 * 4 + 0]; + newDst[ 1] = s * m[0 * 4 + 1]; + newDst[ 2] = s * m[0 * 4 + 2]; + newDst[ 3] = s * m[0 * 4 + 3]; + newDst[ 4] = s * m[1 * 4 + 0]; + newDst[ 5] = s * m[1 * 4 + 1]; + newDst[ 6] = s * m[1 * 4 + 2]; + newDst[ 7] = s * m[1 * 4 + 3]; + newDst[ 8] = s * m[2 * 4 + 0]; + newDst[ 9] = s * m[2 * 4 + 1]; + newDst[10] = s * m[2 * 4 + 2]; + newDst[11] = s * m[2 * 4 + 3]; + + if (m !== newDst) { + newDst[12] = m[12]; + newDst[13] = m[13]; + newDst[14] = m[14]; + newDst[15] = m[15]; } - return dst; -} \ No newline at end of file + return newDst; +} + +return { + create, + set, + fromMat3, + fromQuat, + negate, + copy, + clone, + equalsApproximately, + equals, + identity, + transpose, + inverse, + determinant, + invert, + multiply, + mul, + setTranslation, + getTranslation, + getAxis, + setAxis, + getScaling, + perspective, + perspectiveReverseZ, + ortho, + frustum, + frustumReverseZ, + aim, + cameraAim, + lookAt, + translation, + translate, + rotationX, + rotateX, + rotationY, + rotateY, + rotationZ, + rotateZ, + axisRotation, + rotation, + axisRotate, + rotate, + scaling, + scale, + uniformScaling, + uniformScale, +}; + +} + + +type API = ReturnType>; + +const cache = new Map(); + +export function getAPI(Ctor: Mat4Ctor) { + let api = cache.get(Ctor); + if (!api) { + api = getAPIImpl(Ctor); + cache.set(Ctor, api); + } + return api as API; +} diff --git a/src/mat4.ts b/src/mat4.ts index 2711397..6dcc899 100644 --- a/src/mat4.ts +++ b/src/mat4.ts @@ -19,10 +19,15 @@ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ +import { BaseArgType } from "./types"; /** * A JavaScript array with 16 values, a Float32Array with 16 values, or a Float64Array with 16 values. - * When created by the library will create the default type which is `Float32Array` - * but can be set by calling {@link mat4.setDefaultType}. */ -export type Mat4 = number[] | Float32Array | Float64Array; +export type Mat4Arg = BaseArgType; + +/** + * A specific concrete 4x4 Matrix Type + */ +export type Mat4Type = T; + diff --git a/src/quat-impl.ts b/src/quat-impl.ts index bd55da9..09144ce 100644 --- a/src/quat-impl.ts +++ b/src/quat-impl.ts @@ -20,16 +20,49 @@ * DEALINGS IN THE SOFTWARE. */ import * as utils from './utils.js'; -import { Quat, create, setDefaultType, QuatType } from './quat'; -import { Mat3 } from './mat3.js'; -import { Mat4 } from './mat4.js'; -import { Vec3 } from './vec3.js'; -import * as vec3 from './vec3-impl.js'; +import { QuatArg, QuatType } from './quat'; +import { Mat3Arg } from './mat3.js'; +import { Mat4Arg } from './mat4.js'; +import { Vec3Arg } from './vec3.js'; +import { getAPI as getVec3API } from './vec3-impl'; +import { BaseArgType } from './types'; + +export { QuatArg, QuatType }; + +type QuatCtor = new (n: number) => T; export type RotationOrder = 'xyz' | 'xzy' | 'yxz' | 'yzx' | 'zxy' | 'zyx'; -export default Quat; -export { create, setDefaultType }; +/** + * Generates am typed API for Qud + * */ +function getAPIImpl(Ctor: QuatCtor) { + const vec3 = getVec3API(Ctor); + +/** + * Creates a quat4; may be called with x, y, z to set initial values. + * @param x - Initial x value. + * @param y - Initial y value. + * @param z - Initial z value. + * @param w - Initial w value. + * @returns the created vector + */ +function create(x?: number, y?: number, z?: number, w?: number) { + const newDst = new Ctor(4); + if (x !== undefined) { + newDst[0] = x; + if (y !== undefined) { + newDst[1] = y; + if (z !== undefined) { + newDst[2] = z; + if (w !== undefined) { + newDst[3] = w; + } + } + } + } + return newDst; +} /** * Creates a Quat; may be called with x, y, z to set initial values. (same as create) @@ -39,7 +72,7 @@ export { create, setDefaultType }; * @param z - Initial w value. * @returns the created vector */ -export const fromValues = create; +const fromValues = create; /** * Sets the values of a Quat @@ -52,15 +85,15 @@ export const fromValues = create; * @param dst - vector to hold result. If not passed in a new one is created. * @returns A vector with its elements set. */ -export function set(x: number, y: number, z: number, w: number, dst?: Quat) { - dst = dst || new QuatType(4); +function set(x: number, y: number, z: number, w: number, dst?: T) { + const newDst = (dst ?? new Ctor(4)) as T; - dst[0] = x; - dst[1] = y; - dst[2] = z; - dst[3] = w; + newDst[0] = x; + newDst[1] = y; + newDst[2] = z; + newDst[3] = w; - return dst; + return newDst; } /** @@ -72,18 +105,18 @@ export function set(x: number, y: number, z: number, w: number, dst?: Quat) { * @param dst - quaternion to hold result. If not passed in a new one is created. * @returns The quaternion that represents the given axis and angle **/ -export function fromAxisAngle(axis: Vec3, angleInRadians: number, dst?: Quat): Quat { - dst = dst || new QuatType(4); +function fromAxisAngle(axis: Vec3Arg, angleInRadians: number, dst?: T) { + const newDst = (dst ?? new Ctor(4)) as T; const halfAngle = angleInRadians * 0.5; const s = Math.sin(halfAngle); - dst[0] = s * axis[0]; - dst[1] = s * axis[1]; - dst[2] = s * axis[2]; - dst[3] = Math.cos(halfAngle); + newDst[0] = s * axis[0]; + newDst[1] = s * axis[1]; + newDst[2] = s * axis[2]; + newDst[3] = Math.cos(halfAngle); - return dst; + return newDst; } /** @@ -92,22 +125,22 @@ export function fromAxisAngle(axis: Vec3, angleInRadians: number, dst?: Quat): Q * @param dst - Vec3 to hold result. If not passed in a new one is created. * @return angle and axis */ -export function toAxisAngle(q: Quat, dst?: Vec3): { angle: number, axis: Vec3 } { - dst = dst || vec3.create(4); +function toAxisAngle(q: QuatArg, dst?: T): { angle: number, axis: T } { + const newDst = (dst ?? vec3.create(3)) as T; const angle = Math.acos(q[3]) * 2; const s = Math.sin(angle * 0.5); if (s > utils.EPSILON) { - dst[0] = q[0] / s; - dst[1] = q[1] / s; - dst[2] = q[2] / s; + newDst[0] = q[0] / s; + newDst[1] = q[1] / s; + newDst[2] = q[2] / s; } else { - dst[0] = 1; - dst[1] = 0; - dst[2] = 0; + newDst[0] = 1; + newDst[1] = 0; + newDst[2] = 0; } - return { angle, axis: dst }; + return { angle, axis: newDst }; } /** @@ -116,7 +149,7 @@ export function toAxisAngle(q: Quat, dst?: Vec3): { angle: number, axis: Vec3 } * @param b - quaternion b * @return angle in radians between the two quaternions */ -export function angle(a: Quat, b: Quat) { +function angle(a: QuatArg, b: QuatArg) { const d = dot(a, b); return Math.acos(2 * d * d - 1); } @@ -129,8 +162,8 @@ export function angle(a: Quat, b: Quat) { * @param dst - quaternion to hold result. If not passed in a new one is created. * @returns A quaternion that is the result of a * b */ -export function multiply(a: Quat, b: Quat, dst?: Quat): Quat { - dst = dst || new QuatType(4); +function multiply(a: QuatArg, b: QuatArg, dst?: T) { + const newDst = (dst ?? new Ctor(4)) as T; const ax = a[0]; const ay = a[1]; @@ -142,12 +175,12 @@ export function multiply(a: Quat, b: Quat, dst?: Quat): Quat { const bz = b[2]; const bw = b[3]; - dst[0] = ax * bw + aw * bx + ay * bz - az * by; - dst[1] = ay * bw + aw * by + az * bx - ax * bz; - dst[2] = az * bw + aw * bz + ax * by - ay * bx; - dst[3] = aw * bw - ax * bx - ay * by - az * bz; + newDst[0] = ax * bw + aw * bx + ay * bz - az * by; + newDst[1] = ay * bw + aw * by + az * bx - ax * bz; + newDst[2] = az * bw + aw * bz + ax * by - ay * bx; + newDst[3] = aw * bw - ax * bx - ay * by - az * bz; - return dst; + return newDst; } /** @@ -158,7 +191,7 @@ export function multiply(a: Quat, b: Quat, dst?: Quat): Quat { * @param dst - quaternion to hold result. If not passed in a new one is created. * @returns A quaternion that is the result of a * b */ -export const mul = multiply; +const mul = multiply; /** * Rotates the given quaternion around the X axis by the given angle. @@ -167,8 +200,8 @@ export const mul = multiply; * @param dst - quaternion to hold result. If not passed in a new one is created. * @returns A quaternion that is the result of a * b */ -export function rotateX(q: Quat, angleInRadians: number, dst?: Quat): Quat { - dst = dst || new QuatType(4); +function rotateX(q: QuatArg, angleInRadians: number, dst?: T) { + const newDst = (dst ?? new Ctor(4)) as T; const halfAngle = angleInRadians * 0.5; @@ -180,12 +213,12 @@ export function rotateX(q: Quat, angleInRadians: number, dst?: Quat): Quat { const bx = Math.sin(halfAngle); const bw = Math.cos(halfAngle); - dst[0] = qx * bw + qw * bx; - dst[1] = qy * bw + qz * bx; - dst[2] = qz * bw - qy * bx; - dst[3] = qw * bw - qx * bx; + newDst[0] = qx * bw + qw * bx; + newDst[1] = qy * bw + qz * bx; + newDst[2] = qz * bw - qy * bx; + newDst[3] = qw * bw - qx * bx; - return dst; + return newDst; } /** @@ -195,8 +228,8 @@ export function rotateX(q: Quat, angleInRadians: number, dst?: Quat): Quat { * @param dst - quaternion to hold result. If not passed in a new one is created. * @returns A quaternion that is the result of a * b */ -export function rotateY(q: Quat, angleInRadians: number, dst?: Quat): Quat { - dst = dst || new QuatType(4); +function rotateY(q: QuatArg, angleInRadians: number, dst?: T) { + const newDst = (dst ?? new Ctor(4)) as T; const halfAngle = angleInRadians * 0.5; @@ -208,12 +241,12 @@ export function rotateY(q: Quat, angleInRadians: number, dst?: Quat): Quat { const by = Math.sin(halfAngle); const bw = Math.cos(halfAngle); - dst[0] = qx * bw - qz * by; - dst[1] = qy * bw + qw * by; - dst[2] = qz * bw + qx * by; - dst[3] = qw * bw - qy * by; + newDst[0] = qx * bw - qz * by; + newDst[1] = qy * bw + qw * by; + newDst[2] = qz * bw + qx * by; + newDst[3] = qw * bw - qy * by; - return dst; + return newDst; } /** @@ -223,8 +256,8 @@ export function rotateY(q: Quat, angleInRadians: number, dst?: Quat): Quat { * @param dst - quaternion to hold result. If not passed in a new one is created. * @returns A quaternion that is the result of a * b */ -export function rotateZ(q: Quat, angleInRadians: number, dst?: Quat): Quat { - dst = dst || new QuatType(4); +function rotateZ(q: QuatArg, angleInRadians: number, dst?: T) { + const newDst = (dst ?? new Ctor(4)) as T; const halfAngle = angleInRadians * 0.5; @@ -236,12 +269,12 @@ export function rotateZ(q: Quat, angleInRadians: number, dst?: Quat): Quat { const bz = Math.sin(halfAngle); const bw = Math.cos(halfAngle); - dst[0] = qx * bw + qy * bz; - dst[1] = qy * bw - qx * bz; - dst[2] = qz * bw + qw * bz; - dst[3] = qw * bw - qz * bz; + newDst[0] = qx * bw + qy * bz; + newDst[1] = qy * bw - qx * bz; + newDst[2] = qz * bw + qw * bz; + newDst[3] = qw * bw - qz * bz; - return dst; + return newDst; } /** @@ -253,8 +286,8 @@ export function rotateZ(q: Quat, angleInRadians: number, dst?: Quat): Quat { * @param dst - quaternion to hold result. If not passed in a new one is created. * @returns A quaternion that is the result of a * b */ -export function slerp(a: Quat, b: Quat, t: number, dst?: Quat): Quat { - dst = dst || new QuatType(4); +function slerp(a: QuatArg, b: QuatArg, t: number, dst?: T) { + const newDst = (dst ?? new Ctor(4)) as T; const ax = a[0]; const ay = a[1]; @@ -289,12 +322,12 @@ export function slerp(a: Quat, b: Quat, t: number, dst?: Quat): Quat { scale1 = t; } - dst[0] = scale0 * ax + scale1 * bx; - dst[1] = scale0 * ay + scale1 * by; - dst[2] = scale0 * az + scale1 * bz; - dst[3] = scale0 * aw + scale1 * bw; + newDst[0] = scale0 * ax + scale1 * bx; + newDst[1] = scale0 * ay + scale1 * by; + newDst[2] = scale0 * az + scale1 * bz; + newDst[3] = scale0 * aw + scale1 * bw; - return dst; + return newDst; } /** @@ -303,8 +336,8 @@ export function slerp(a: Quat, b: Quat, t: number, dst?: Quat): Quat { * @param q - quaternion to compute the inverse of * @returns A quaternion that is the result of a * b */ -export function inverse(q: Quat, dst?: Quat): Quat { - dst = dst || new QuatType(4); +function inverse(q: QuatArg, dst?: T) { + const newDst = (dst ?? new Ctor(4)) as T; const a0 = q[0]; const a1 = q[1]; @@ -314,12 +347,12 @@ export function inverse(q: Quat, dst?: Quat): Quat { const dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3; const invDot = dot ? 1 / dot : 0; - dst[0] = -a0 * invDot; - dst[1] = -a1 * invDot; - dst[2] = -a2 * invDot; - dst[3] = a3 * invDot; + newDst[0] = -a0 * invDot; + newDst[1] = -a1 * invDot; + newDst[2] = -a2 * invDot; + newDst[3] = a3 * invDot; - return dst; + return newDst; } /** @@ -331,15 +364,15 @@ export function inverse(q: Quat, dst?: Quat): Quat { * @param dst - quaternion to hold result. If not passed in a new one is created. * @returns The conjugate of q */ -export function conjugate(q: Quat, dst?: Quat): Quat { - dst = dst || new QuatType(4); +function conjugate(q: QuatArg, dst?: T) { + const newDst = (dst ?? new Ctor(4)) as T; - dst[0] = -q[0]; - dst[1] = -q[1]; - dst[2] = -q[2]; - dst[3] = q[3]; + newDst[0] = -q[0]; + newDst[1] = -q[1]; + newDst[2] = -q[2]; + newDst[3] = q[3]; - return dst; + return newDst; } /** @@ -351,8 +384,8 @@ export function conjugate(q: Quat, dst?: Quat): Quat { * @param dst - quaternion to hold result. If not passed in a new one is created. * @returns the result */ -export function fromMat(m: Mat3 | Mat4, dst?: Quat): Quat { - dst = dst || new QuatType(4); +function fromMat(m: Mat3Arg | Mat4Arg, dst?: T) { + const newDst = (dst ?? new Ctor(4)) as T; /* 0 1 2 @@ -371,12 +404,12 @@ export function fromMat(m: Mat3 | Mat4, dst?: Quat): Quat { if (trace > 0.0) { // |w| > 1/2, may as well choose w > 1/2 const root = Math.sqrt(trace + 1); // 2w - dst[3] = 0.5 * root; + newDst[3] = 0.5 * root; const invRoot = 0.5 / root; // 1/(4w) - dst[0] = (m[6] - m[9]) * invRoot; - dst[1] = (m[8] - m[2]) * invRoot; - dst[2] = (m[1] - m[4]) * invRoot; + newDst[0] = (m[6] - m[9]) * invRoot; + newDst[1] = (m[8] - m[2]) * invRoot; + newDst[2] = (m[1] - m[4]) * invRoot; } else { // |w| <= 1/2 let i = 0; @@ -392,16 +425,16 @@ export function fromMat(m: Mat3 | Mat4, dst?: Quat): Quat { const k = (i + 2) % 3; const root = Math.sqrt(m[i * 4 + i] - m[j * 4 + j] - m[k * 4 + k] + 1.0); - dst[i] = 0.5 * root; + newDst[i] = 0.5 * root; const invRoot = 0.5 / root; - dst[3] = (m[j * 4 + k] - m[k * 4 + j]) * invRoot; - dst[j] = (m[j * 4 + i] + m[i * 4 + j]) * invRoot; - dst[k] = (m[k * 4 + i] + m[i * 4 + k]) * invRoot; + newDst[3] = (m[j * 4 + k] - m[k * 4 + j]) * invRoot; + newDst[j] = (m[j * 4 + i] + m[i * 4 + j]) * invRoot; + newDst[k] = (m[k * 4 + i] + m[i * 4 + k]) * invRoot; } - return dst; + return newDst; } /** @@ -414,13 +447,13 @@ export function fromMat(m: Mat3 | Mat4, dst?: Quat): Quat { * @param dst - quaternion to hold result. If not passed in a new one is created. * @returns A quaternion representing the same rotation as the euler angles applied in the given order */ -export function fromEuler( +function fromEuler( xAngleInRadians: number, yAngleInRadians: number, zAngleInRadians: number, order: RotationOrder, - dst?: Quat) { - dst = dst || new QuatType(4); + dst?: T) { + const newDst = (dst ?? new Ctor(4)) as T; const xHalfAngle = xAngleInRadians * 0.5; const yHalfAngle = yAngleInRadians * 0.5; @@ -435,52 +468,52 @@ export function fromEuler( switch (order) { case 'xyz': - dst[0] = sx * cy * cz + cx * sy * sz; - dst[1] = cx * sy * cz - sx * cy * sz; - dst[2] = cx * cy * sz + sx * sy * cz; - dst[3] = cx * cy * cz - sx * sy * sz; + newDst[0] = sx * cy * cz + cx * sy * sz; + newDst[1] = cx * sy * cz - sx * cy * sz; + newDst[2] = cx * cy * sz + sx * sy * cz; + newDst[3] = cx * cy * cz - sx * sy * sz; break; case 'xzy': - dst[0] = sx * cy * cz - cx * sy * sz; - dst[1] = cx * sy * cz - sx * cy * sz; - dst[2] = cx * cy * sz + sx * sy * cz; - dst[3] = cx * cy * cz + sx * sy * sz; + newDst[0] = sx * cy * cz - cx * sy * sz; + newDst[1] = cx * sy * cz - sx * cy * sz; + newDst[2] = cx * cy * sz + sx * sy * cz; + newDst[3] = cx * cy * cz + sx * sy * sz; break; case 'yxz': - dst[0] = sx * cy * cz + cx * sy * sz; - dst[1] = cx * sy * cz - sx * cy * sz; - dst[2] = cx * cy * sz - sx * sy * cz; - dst[3] = cx * cy * cz + sx * sy * sz; + newDst[0] = sx * cy * cz + cx * sy * sz; + newDst[1] = cx * sy * cz - sx * cy * sz; + newDst[2] = cx * cy * sz - sx * sy * cz; + newDst[3] = cx * cy * cz + sx * sy * sz; break; case 'yzx': - dst[0] = sx * cy * cz + cx * sy * sz; - dst[1] = cx * sy * cz + sx * cy * sz; - dst[2] = cx * cy * sz - sx * sy * cz; - dst[3] = cx * cy * cz - sx * sy * sz; + newDst[0] = sx * cy * cz + cx * sy * sz; + newDst[1] = cx * sy * cz + sx * cy * sz; + newDst[2] = cx * cy * sz - sx * sy * cz; + newDst[3] = cx * cy * cz - sx * sy * sz; break; case 'zxy': - dst[0] = sx * cy * cz - cx * sy * sz; - dst[1] = cx * sy * cz + sx * cy * sz; - dst[2] = cx * cy * sz + sx * sy * cz; - dst[3] = cx * cy * cz - sx * sy * sz; + newDst[0] = sx * cy * cz - cx * sy * sz; + newDst[1] = cx * sy * cz + sx * cy * sz; + newDst[2] = cx * cy * sz + sx * sy * cz; + newDst[3] = cx * cy * cz - sx * sy * sz; break; case 'zyx': - dst[0] = sx * cy * cz - cx * sy * sz; - dst[1] = cx * sy * cz + sx * cy * sz; - dst[2] = cx * cy * sz - sx * sy * cz; - dst[3] = cx * cy * cz + sx * sy * sz; + newDst[0] = sx * cy * cz - cx * sy * sz; + newDst[1] = cx * sy * cz + sx * cy * sz; + newDst[2] = cx * cy * sz - sx * sy * cz; + newDst[3] = cx * cy * cz + sx * sy * sz; break; default: throw new Error(`Unknown rotation order: ${order}`); } - return dst; + return newDst; } /** @@ -490,15 +523,15 @@ export function fromEuler( * @param dst - quaternion to hold result. If not passed in a new one is created. * @returns A quaternion that is a copy of q */ -export function copy(q: Quat, dst?: Quat): Quat { - dst = dst || new QuatType(4); +function copy(q: QuatArg, dst?: T) { + const newDst = (dst ?? new Ctor(4)) as T; - dst[0] = q[0]; - dst[1] = q[1]; - dst[2] = q[2]; - dst[3] = q[3]; + newDst[0] = q[0]; + newDst[1] = q[1]; + newDst[2] = q[2]; + newDst[3] = q[3]; - return dst; + return newDst; } /** @@ -508,7 +541,7 @@ export function copy(q: Quat, dst?: Quat): Quat { * @param dst - quaternion to hold result. If not passed in a new one is created. * @returns A copy of q. */ -export const clone = copy; +const clone = copy; /** * Adds two quaternions; assumes a and b have the same dimension. @@ -517,15 +550,15 @@ export const clone = copy; * @param dst - quaternion to hold result. If not passed in a new one is created. * @returns A quaternion that is the sum of a and b. */ -export function add(a: Quat, b: Quat, dst?: Quat): Quat { - dst = dst || new QuatType(4); +function add(a: QuatArg, b: QuatArg, dst?: T) { + const newDst = (dst ?? new Ctor(4)) as T; - dst[0] = a[0] + b[0]; - dst[1] = a[1] + b[1]; - dst[2] = a[2] + b[2]; - dst[3] = a[3] + b[3]; + newDst[0] = a[0] + b[0]; + newDst[1] = a[1] + b[1]; + newDst[2] = a[2] + b[2]; + newDst[3] = a[3] + b[3]; - return dst; + return newDst; } /** @@ -535,15 +568,15 @@ export function add(a: Quat, b: Quat, dst?: Quat): Quat { * @param dst - quaternion to hold result. If not passed in a new one is created. * @returns A quaternion that is the difference of a and b. */ -export function subtract(a: Quat, b: Quat, dst?: Quat): Quat { - dst = dst || new QuatType(4); +function subtract(a: QuatArg, b: QuatArg, dst?: T) { + const newDst = (dst ?? new Ctor(4)) as T; - dst[0] = a[0] - b[0]; - dst[1] = a[1] - b[1]; - dst[2] = a[2] - b[2]; - dst[3] = a[3] - b[3]; + newDst[0] = a[0] - b[0]; + newDst[1] = a[1] - b[1]; + newDst[2] = a[2] - b[2]; + newDst[3] = a[3] - b[3]; - return dst; + return newDst; } /** @@ -553,7 +586,7 @@ export function subtract(a: Quat, b: Quat, dst?: Quat): Quat { * @param dst - quaternion to hold result. If not passed in a new one is created. * @returns A quaternion that is the difference of a and b. */ -export const sub = subtract; +const sub = subtract; /** * Multiplies a quaternion by a scalar. @@ -562,15 +595,15 @@ export const sub = subtract; * @param dst - quaternion to hold result. If not passed in a new one is created. * @returns The scaled quaternion. */ -export function mulScalar(v: Quat, k: number, dst?: Quat): Quat { - dst = dst || new QuatType(4); +function mulScalar(v: QuatArg, k: number, dst?: T) { + const newDst = (dst ?? new Ctor(4)) as T; - dst[0] = v[0] * k; - dst[1] = v[1] * k; - dst[2] = v[2] * k; - dst[3] = v[3] * k; + newDst[0] = v[0] * k; + newDst[1] = v[1] * k; + newDst[2] = v[2] * k; + newDst[3] = v[3] * k; - return dst; + return newDst; } /** @@ -580,7 +613,7 @@ export function mulScalar(v: Quat, k: number, dst?: Quat): Quat { * @param dst - quaternion to hold result. If not passed in a new one is created. * @returns The scaled quaternion. */ -export const scale = mulScalar; +const scale = mulScalar; /** * Divides a vector by a scalar. @@ -589,15 +622,15 @@ export const scale = mulScalar; * @param dst - quaternion to hold result. If not passed in a new one is created. * @returns The scaled quaternion. */ -export function divScalar(v: Quat, k: number, dst?: Quat): Quat { - dst = dst || new QuatType(4); +function divScalar(v: QuatArg, k: number, dst?: T) { + const newDst = (dst ?? new Ctor(4)) as T; - dst[0] = v[0] / k; - dst[1] = v[1] / k; - dst[2] = v[2] / k; - dst[3] = v[3] / k; + newDst[0] = v[0] / k; + newDst[1] = v[1] / k; + newDst[2] = v[2] / k; + newDst[3] = v[3] / k; - return dst; + return newDst; } /** @@ -606,7 +639,7 @@ export function divScalar(v: Quat, k: number, dst?: Quat): Quat { * @param b - Operand quaternion. * @returns dot product */ -export function dot(a: Quat, b: Quat): number { +function dot(a: QuatArg, b: QuatArg): number { return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]) + (a[3] * b[3]); } @@ -620,15 +653,15 @@ export function dot(a: Quat, b: Quat): number { * @param dst - quaternion to hold result. If not passed in a new one is created. * @returns The linear interpolated result. */ -export function lerp(a: Quat, b: Quat, t: number, dst?: Quat): Quat { - dst = dst || new QuatType(4); +function lerp(a: QuatArg, b: QuatArg, t: number, dst?: T) { + const newDst = (dst ?? new Ctor(4)) as T; - dst[0] = a[0] + t * (b[0] - a[0]); - dst[1] = a[1] + t * (b[1] - a[1]); - dst[2] = a[2] + t * (b[2] - a[2]); - dst[3] = a[3] + t * (b[3] - a[3]); + newDst[0] = a[0] + t * (b[0] - a[0]); + newDst[1] = a[1] + t * (b[1] - a[1]); + newDst[2] = a[2] + t * (b[2] - a[2]); + newDst[3] = a[3] + t * (b[3] - a[3]); - return dst; + return newDst; } /** @@ -636,7 +669,7 @@ export function lerp(a: Quat, b: Quat, t: number, dst?: Quat): Quat { * @param v - quaternion. * @returns length of quaternion. */ -export function length(v: Quat): number { +function length(v: QuatArg): number { const v0 = v[0]; const v1 = v[1]; const v2 = v[2]; @@ -649,14 +682,14 @@ export function length(v: Quat): number { * @param v - quaternion. * @returns length of quaternion. */ -export const len = length; +const len = length; /** * Computes the square of the length of quaternion * @param v - quaternion. * @returns square of the length of quaternion. */ -export function lengthSq(v: Quat): number { +function lengthSq(v: QuatArg): number { const v0 = v[0]; const v1 = v[1]; const v2 = v[2]; @@ -669,7 +702,7 @@ export function lengthSq(v: Quat): number { * @param v - quaternion. * @returns square of the length of quaternion. */ -export const lenSq = lengthSq; +const lenSq = lengthSq; /** * Divides a quaternion by its Euclidean length and returns the quotient. @@ -677,8 +710,8 @@ export const lenSq = lengthSq; * @param dst - quaternion to hold result. If not passed in a new one is created. * @returns The normalized quaternion. */ -export function normalize(v: Quat, dst?: Quat): Quat { - dst = dst || new QuatType(4); +function normalize(v: QuatArg, dst?: T) { + const newDst = (dst ?? new Ctor(4)) as T; const v0 = v[0]; const v1 = v[1]; @@ -687,18 +720,18 @@ export function normalize(v: Quat, dst?: Quat): Quat { const len = Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3); if (len > 0.00001) { - dst[0] = v0 / len; - dst[1] = v1 / len; - dst[2] = v2 / len; - dst[3] = v3 / len; + newDst[0] = v0 / len; + newDst[1] = v1 / len; + newDst[2] = v2 / len; + newDst[3] = v3 / len; } else { - dst[0] = 0; - dst[1] = 0; - dst[2] = 0; - dst[3] = 0; + newDst[0] = 0; + newDst[1] = 0; + newDst[2] = 0; + newDst[3] = 0; } - return dst; + return newDst; } /** @@ -707,7 +740,7 @@ export function normalize(v: Quat, dst?: Quat): Quat { * @param b - Operand quaternion. * @returns true if quaternions are approximately equal */ -export function equalsApproximately(a: Quat, b: Quat): boolean { +function equalsApproximately(a: QuatArg, b: QuatArg): boolean { return Math.abs(a[0] - b[0]) < utils.EPSILON && Math.abs(a[1] - b[1]) < utils.EPSILON && Math.abs(a[2] - b[2]) < utils.EPSILON && @@ -720,7 +753,7 @@ export function equalsApproximately(a: Quat, b: Quat): boolean { * @param b - Operand quaternion. * @returns true if quaternions are exactly equal */ -export function equals(a: Quat, b: Quat): boolean { +function equals(a: QuatArg, b: QuatArg): boolean { return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3]; } @@ -729,20 +762,20 @@ export function equals(a: Quat, b: Quat): boolean { * @param dst - quaternion to hold result. If not passed in a new one is created. * @returns an identity quaternion */ -export function identity(dst?: Quat): Quat { - dst = dst || new QuatType(4); +function identity(dst?: T) { + const newDst = (dst ?? new Ctor(4)) as T; - dst[0] = 0; - dst[1] = 0; - dst[2] = 0; - dst[3] = 1; + newDst[0] = 0; + newDst[1] = 0; + newDst[2] = 0; + newDst[3] = 1; - return dst; + return newDst; } -let tempVec3: Vec3; -let xUnitVec3: Vec3; -let yUnitVec3: Vec3; +const tempVec3 = vec3.create(); +const xUnitVec3 = vec3.create(); +const yUnitVec3 = vec3.create(); /** * Computes a quaternion to represent the shortest rotation from one vector to another. @@ -752,12 +785,8 @@ let yUnitVec3: Vec3; * @param dst - quaternion to hold result. If not passed in a new one is created. * @returns the result */ -export function rotationTo(aUnit: Vec3, bUnit: Vec3, dst?: Quat): Quat { - dst = dst || new QuatType(4); - - tempVec3 = tempVec3 || vec3.create(); - xUnitVec3 = xUnitVec3 || vec3.create(1, 0, 0); - yUnitVec3 = yUnitVec3 || vec3.create(0, 1, 0); +function rotationTo(aUnit: Vec3Arg, bUnit: Vec3Arg, dst?: T) { + const newDst = (dst ?? new Ctor(4)) as T; const dot = vec3.dot(aUnit, bUnit); if (dot < -0.999999) { @@ -767,30 +796,30 @@ export function rotationTo(aUnit: Vec3, bUnit: Vec3, dst?: Quat): Quat { } vec3.normalize(tempVec3, tempVec3); - fromAxisAngle(tempVec3, Math.PI, dst); + fromAxisAngle(tempVec3, Math.PI, newDst); - return dst; + return newDst; } else if (dot > 0.999999) { - dst[0] = 0; - dst[1] = 0; - dst[2] = 0; - dst[3] = 1; + newDst[0] = 0; + newDst[1] = 0; + newDst[2] = 0; + newDst[3] = 1; - return dst; + return newDst; } else { vec3.cross(aUnit, bUnit, tempVec3); - dst[0] = tempVec3[0]; - dst[1] = tempVec3[1]; - dst[2] = tempVec3[2]; - dst[3] = 1 + dot; + newDst[0] = tempVec3[0]; + newDst[1] = tempVec3[1]; + newDst[2] = tempVec3[2]; + newDst[3] = 1 + dot; - return normalize(dst, dst); + return normalize(newDst, newDst); } } -let tempQuat1: Quat; -let tempQuat2: Quat; +const tempQuat1 = new Ctor(4); +const tempQuat2 = new Ctor(4); /** * Performs a spherical linear interpolation with two control points @@ -802,21 +831,94 @@ let tempQuat2: Quat; * @param t - Interpolation coefficient 0 to 1 * @returns result */ -export function sqlerp( - a: Quat, - b: Quat, - c: Quat, - d: Quat, +function sqlerp( + a: QuatArg, + b: QuatArg, + c: QuatArg, + d: QuatArg, t: number, - dst?: Quat): Quat { - dst = dst || new QuatType(4); - - tempQuat1 = tempQuat1 || new QuatType(4); - tempQuat2 = tempQuat2 || new QuatType(4); + dst?: T) { + const newDst = (dst ?? new Ctor(4)) as T; slerp(a, d, t, tempQuat1); slerp(b, c, t, tempQuat2); - slerp(tempQuat1, tempQuat2, 2 * t * (1 - t), dst); + slerp(tempQuat1, tempQuat2, 2 * t * (1 - t), newDst); + + return newDst; +} - return dst; +return { + create, + fromValues, + set, + fromAxisAngle, + toAxisAngle, + angle, + multiply, + mul, + rotateX, + rotateY, + rotateZ, + slerp, + inverse, + conjugate, + fromMat, + fromEuler, + copy, + clone, + add, + subtract, + sub, + mulScalar, + scale, + divScalar, + dot, + lerp, + length, + len, + lengthSq, + lenSq, + normalize, + equalsApproximately, + equals, + identity, + rotationTo, + sqlerp, +}; + +} + +type API = ReturnType>; + +const cache = new Map(); + +/** + * + * Quat4 math functions. + * + * Almost all functions take an optional `newDst` argument. If it is not passed in the + * functions will create a new `Quat4`. In other words you can do this + * + * const v = quat4.cross(v1, v2); // Creates a new Quat4 with the cross product of v1 x v2. + * + * or + * + * const v = quat4.create(); + * quat4.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v + * + * The first style is often easier but depending on where it's used it generates garbage where + * as there is almost never allocation with the second style. + * + * It is always safe to pass any vector as the destination. So for example + * + * quat4.cross(v1, v2, v1); // Puts the cross product of v1 x v2 in v1 + * + */ +export function getAPI(Ctor: QuatCtor) { + let api = cache.get(Ctor); + if (!api) { + api = getAPIImpl(Ctor); + cache.set(Ctor, api); + } + return api as API; } diff --git a/src/quat.ts b/src/quat.ts index e211dea..f8935f7 100644 --- a/src/quat.ts +++ b/src/quat.ts @@ -20,70 +20,15 @@ * DEALINGS IN THE SOFTWARE. */ -/** - * A JavaScript array with 4 values, Float32Array with 4 values, or a Float64Array with 4 values. - * When created by the library will create the default type which is `Float32Array` - * but can be set by calling {@link quat.setDefaultType}. - */ -export type Quat = number[] | Float32Array | Float64Array; +import { BaseArgType } from "./types"; /** - * - * Quat4 math functions. - * - * Almost all functions take an optional `dst` argument. If it is not passed in the - * functions will create a new `Quat4`. In other words you can do this - * - * const v = quat4.cross(v1, v2); // Creates a new Quat4 with the cross product of v1 x v2. - * - * or - * - * const v = quat4.create(); - * quat4.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v - * - * The first style is often easier but depending on where it's used it generates garbage where - * as there is almost never allocation with the second style. - * - * It is always safe to pass any vector as the destination. So for example - * - * quat4.cross(v1, v2, v1); // Puts the cross product of v1 x v2 in v1 - * + * A JavaScript array with 4 values, a Float32Array with 4 values, or a Float64Array with 4 values. */ - -export let QuatType: new (n: number) => Quat = Float32Array; +export type QuatArg = BaseArgType; /** - * Sets the type this library creates for a Quat4 - * @param ctor - the constructor for the type. Either `Float32Array`, `Float64Array`, or `Array` - * @returns previous constructor for Quat4 + * A specific concrete 4x4 Matrix Type */ -export function setDefaultType(ctor: new (n: number) => Quat) { - const oldType = QuatType; - QuatType = ctor; - return oldType; -} +export type QuatType = T; -/** - * Creates a quat4; may be called with x, y, z to set initial values. - * @param x - Initial x value. - * @param y - Initial y value. - * @param z - Initial z value. - * @param w - Initial w value. - * @returns the created vector - */ -export function create(x?: number, y?: number, z?: number, w?: number): Quat { - const dst = new QuatType(4); - if (x !== undefined) { - dst[0] = x; - if (y !== undefined) { - dst[1] = y; - if (z !== undefined) { - dst[2] = z; - if (w !== undefined) { - dst[3] = w; - } - } - } - } - return dst; -} \ No newline at end of file diff --git a/src/types.ts b/src/types.ts new file mode 100644 index 0000000..87cb587 --- /dev/null +++ b/src/types.ts @@ -0,0 +1,20 @@ +/** + * The types you can pass to most functions that take an + * array of numbers. + */ +export type BaseArgType = Float32Array | Float64Array | number[]; + +function wrapConstructor any>( + OriginalConstructor: T, + modifier: (instance: InstanceType) => void +): T { + return class extends OriginalConstructor { + constructor(...args: any[]) { + super(...args); + modifier(this as InstanceType); + } + } as T; // Type assertion is necessary here +} + +export const ZeroArray = wrapConstructor(Array, a => a.fill(0)); + diff --git a/src/vec2-impl.ts b/src/vec2-impl.ts index d22113e..474b8e9 100644 --- a/src/vec2-impl.ts +++ b/src/vec2-impl.ts @@ -20,13 +20,47 @@ * DEALINGS IN THE SOFTWARE. */ import * as utils from './utils.js'; -import { Mat3 } from './mat3'; -import { Mat4 } from './mat4'; -import { Vec2, create, setDefaultType, VecType } from './vec2'; -import { Vec3, VecType as Vec3Type } from './vec3'; +import { Mat3Arg } from './mat3'; +import { Mat4Arg } from './mat4'; +import { Vec2Arg, Vec2Type } from './vec2'; +import { Vec3Arg } from './vec3'; +import { BaseArgType } from './types'; -export default Vec2; -export { create, setDefaultType }; +export { Vec2Arg, Vec2Type }; + +type Vec2Ctor = new (n: number) => T; + +/** + * Generates am typed API for Vec3 + */ +function getAPIImpl(Ctor: Vec2Ctor) { + +/** + * Creates a Vec2; may be called with x, y, z to set initial values. + * + * Note: Since passing in a raw JavaScript array + * is valid in all circumstances, if you want to + * force a JavaScript array into a Vec2's specified type + * it would be faster to use + * + * ``` + * const v = vec2.clone(someJSArray); + * ``` + * + * @param x - Initial x value. + * @param y - Initial y value. + * @returns the created vector + */ +function create(x = 0, y = 0) { + const newDst = new Ctor(2); + if (x !== undefined) { + newDst[0] = x; + if (y !== undefined) { + newDst[1] = y; + } + } + return newDst; +} /** * Creates a Vec2; may be called with x, y, z to set initial values. (same as create) @@ -34,7 +68,7 @@ export { create, setDefaultType }; * @param y - Initial y value. * @returns the created vector */ -export const fromValues = create; +const fromValues = create; /** * Sets the values of a Vec2 @@ -45,13 +79,13 @@ export const fromValues = create; * @param dst - vector to hold result. If not passed in a new one is created. * @returns A vector with its elements set. */ -export function set(x: number, y: number, dst?: Vec2) { - dst = dst || new VecType(2); +function set(x: number, y: number, dst?: T) { + const newDst = (dst ?? new Ctor(2)) as T; - dst[0] = x; - dst[1] = y; + newDst[0] = x; + newDst[1] = y; - return dst; + return newDst; } /** @@ -60,13 +94,13 @@ export function set(x: number, y: number, dst?: Vec2) { * @param dst - vector to hold result. If not passed in a new one is created. * @returns A vector that is the ceil of each element of v. */ -export function ceil(v: Vec2, dst?: Vec2): Vec2 { - dst = dst || new VecType(2); +function ceil(v: Vec2Arg, dst?: T) { + const newDst = (dst ?? new Ctor(2)) as T; - dst[0] = Math.ceil(v[0]); - dst[1] = Math.ceil(v[1]); + newDst[0] = Math.ceil(v[0]); + newDst[1] = Math.ceil(v[1]); - return dst; + return newDst; } /** @@ -75,13 +109,13 @@ export function ceil(v: Vec2, dst?: Vec2): Vec2 { * @param dst - vector to hold result. If not passed in a new one is created. * @returns A vector that is the floor of each element of v. */ -export function floor(v: Vec2, dst?: Vec2): Vec2 { - dst = dst || new VecType(2); +function floor(v: Vec2Arg, dst?: T) { + const newDst = (dst ?? new Ctor(2)) as T; - dst[0] = Math.floor(v[0]); - dst[1] = Math.floor(v[1]); + newDst[0] = Math.floor(v[0]); + newDst[1] = Math.floor(v[1]); - return dst; + return newDst; } /** @@ -90,13 +124,13 @@ export function floor(v: Vec2, dst?: Vec2): Vec2 { * @param dst - vector to hold result. If not passed in a new one is created. * @returns A vector that is the round of each element of v. */ -export function round(v: Vec2, dst?: Vec2): Vec2 { - dst = dst || new VecType(2); +function round(v: Vec2Arg, dst?: T) { + const newDst = (dst ?? new Ctor(2)) as T; - dst[0] = Math.round(v[0]); - dst[1] = Math.round(v[1]); + newDst[0] = Math.round(v[0]); + newDst[1] = Math.round(v[1]); - return dst; + return newDst; } /** @@ -107,13 +141,13 @@ export function round(v: Vec2, dst?: Vec2): Vec2 { * @param dst - vector to hold result. If not passed in a new one is created. * @returns A vector that the clamped value of each element of v. */ -export function clamp(v: Vec2, min = 0, max = 1, dst?: Vec2): Vec2 { - dst = dst || new VecType(2); +function clamp(v: Vec2Arg, min = 0, max = 1, dst?: T) { + const newDst = (dst ?? new Ctor(2)) as T; - dst[0] = Math.min(max, Math.max(min, v[0])); - dst[1] = Math.min(max, Math.max(min, v[1])); + newDst[0] = Math.min(max, Math.max(min, v[0])); + newDst[1] = Math.min(max, Math.max(min, v[1])); - return dst; + return newDst; } /** @@ -123,13 +157,13 @@ export function clamp(v: Vec2, min = 0, max = 1, dst?: Vec2): Vec2 { * @param dst - vector to hold result. If not passed in a new one is created. * @returns A vector that is the sum of a and b. */ -export function add(a: Vec2, b: Vec2, dst?: Vec2): Vec2 { - dst = dst || new VecType(2); +function add(a: Vec2Arg, b: Vec2Arg, dst?: T) { + const newDst = (dst ?? new Ctor(2)) as T; - dst[0] = a[0] + b[0]; - dst[1] = a[1] + b[1]; + newDst[0] = a[0] + b[0]; + newDst[1] = a[1] + b[1]; - return dst; + return newDst; } /** @@ -140,13 +174,13 @@ export function add(a: Vec2, b: Vec2, dst?: Vec2): Vec2 { * @param dst - vector to hold result. If not passed in a new one is created. * @returns A vector that is the sum of a + b * scale. */ -export function addScaled(a: Vec2, b: Vec2, scale: number, dst?: Vec2) { - dst = dst || new VecType(2); +function addScaled(a: Vec2Arg, b: Vec2Arg, scale: number, dst?: T) { + const newDst = (dst ?? new Ctor(2)) as T; - dst[0] = a[0] + b[0] * scale; - dst[1] = a[1] + b[1] * scale; + newDst[0] = a[0] + b[0] * scale; + newDst[1] = a[1] + b[1] * scale; - return dst; + return newDst; } /** @@ -155,7 +189,7 @@ export function addScaled(a: Vec2, b: Vec2, scale: number, dst?: Vec2) { * @param b - Operand vector. * @returns The angle in radians between the 2 vectors. */ -export function angle(a: Vec2, b: Vec2): number { +function angle(a: Vec2Arg, b: Vec2Arg): number { const ax = a[0]; const ay = a[1]; const bx = b[0]; @@ -174,13 +208,13 @@ export function angle(a: Vec2, b: Vec2): number { * @param dst - vector to hold result. If not passed in a new one is created. * @returns A vector that is the difference of a and b. */ -export function subtract(a: Vec2, b: Vec2, dst?: Vec2): Vec2 { - dst = dst || new VecType(2); +function subtract(a: Vec2Arg, b: Vec2Arg, dst?: T) { + const newDst = (dst ?? new Ctor(2)) as T; - dst[0] = a[0] - b[0]; - dst[1] = a[1] - b[1]; + newDst[0] = a[0] - b[0]; + newDst[1] = a[1] - b[1]; - return dst; + return newDst; } /** @@ -190,7 +224,7 @@ export function subtract(a: Vec2, b: Vec2, dst?: Vec2): Vec2 { * @param dst - vector to hold result. If not passed in a new one is created. * @returns A vector that is the difference of a and b. */ -export const sub = subtract; +const sub = subtract; /** * Check if 2 vectors are approximately equal @@ -198,7 +232,7 @@ export const sub = subtract; * @param b - Operand vector. * @returns true if vectors are approximately equal */ -export function equalsApproximately(a: Vec2, b: Vec2): boolean { +function equalsApproximately(a: Vec2Arg, b: Vec2Arg): boolean { return Math.abs(a[0] - b[0]) < utils.EPSILON && Math.abs(a[1] - b[1]) < utils.EPSILON; } @@ -209,7 +243,7 @@ export function equalsApproximately(a: Vec2, b: Vec2): boolean { * @param b - Operand vector. * @returns true if vectors are exactly equal */ -export function equals(a: Vec2, b: Vec2): boolean { +function equals(a: Vec2Arg, b: Vec2Arg): boolean { return a[0] === b[0] && a[1] === b[1]; } @@ -223,13 +257,13 @@ export function equals(a: Vec2, b: Vec2): boolean { * @param dst - vector to hold result. If not passed in a new one is created. * @returns The linear interpolated result. */ -export function lerp(a: Vec2, b: Vec2, t: number, dst?: Vec2): Vec2 { - dst = dst || new VecType(2); +function lerp(a: Vec2Arg, b: Vec2Arg, t: number, dst?: T) { + const newDst = (dst ?? new Ctor(2)) as T; - dst[0] = a[0] + t * (b[0] - a[0]); - dst[1] = a[1] + t * (b[1] - a[1]); + newDst[0] = a[0] + t * (b[0] - a[0]); + newDst[1] = a[1] + t * (b[1] - a[1]); - return dst; + return newDst; } /** @@ -242,13 +276,13 @@ export function lerp(a: Vec2, b: Vec2, t: number, dst?: Vec2): Vec2 { * @param dst - vector to hold result. If not passed in a new one is created. * @returns the linear interpolated result. */ -export function lerpV(a: Vec2, b: Vec2, t: Vec2, dst?: Vec2): Vec2 { - dst = dst || new VecType(2); +function lerpV(a: Vec2Arg, b: Vec2Arg, t: Vec2Arg, dst?: T) { + const newDst = (dst ?? new Ctor(2)) as T; - dst[0] = a[0] + t[0] * (b[0] - a[0]); - dst[1] = a[1] + t[1] * (b[1] - a[1]); + newDst[0] = a[0] + t[0] * (b[0] - a[0]); + newDst[1] = a[1] + t[1] * (b[1] - a[1]); - return dst; + return newDst; } /** @@ -260,13 +294,13 @@ export function lerpV(a: Vec2, b: Vec2, t: Vec2, dst?: Vec2): Vec2 { * @param dst - vector to hold result. If not passed in a new one is created. * @returns The max components vector. */ -export function max(a: Vec2, b: Vec2, dst?: Vec2): Vec2 { - dst = dst || new VecType(2); +function max(a: Vec2Arg, b: Vec2Arg, dst?: T) { + const newDst = (dst ?? new Ctor(2)) as T; - dst[0] = Math.max(a[0], b[0]); - dst[1] = Math.max(a[1], b[1]); + newDst[0] = Math.max(a[0], b[0]); + newDst[1] = Math.max(a[1], b[1]); - return dst; + return newDst; } /** @@ -278,13 +312,13 @@ export function max(a: Vec2, b: Vec2, dst?: Vec2): Vec2 { * @param dst - vector to hold result. If not passed in a new one is created. * @returns The min components vector. */ -export function min(a: Vec2, b: Vec2, dst?: Vec2): Vec2 { - dst = dst || new VecType(2); +function min(a: Vec2Arg, b: Vec2Arg, dst?: T) { + const newDst = (dst ?? new Ctor(2)) as T; - dst[0] = Math.min(a[0], b[0]); - dst[1] = Math.min(a[1], b[1]); + newDst[0] = Math.min(a[0], b[0]); + newDst[1] = Math.min(a[1], b[1]); - return dst; + return newDst; } /** @@ -294,13 +328,13 @@ export function min(a: Vec2, b: Vec2, dst?: Vec2): Vec2 { * @param dst - vector to hold result. If not passed in a new one is created. * @returns The scaled vector. */ -export function mulScalar(v: Vec2, k: number, dst?: Vec2): Vec2 { - dst = dst || new VecType(2); +function mulScalar(v: Vec2Arg, k: number, dst?: T) { + const newDst = (dst ?? new Ctor(2)) as T; - dst[0] = v[0] * k; - dst[1] = v[1] * k; + newDst[0] = v[0] * k; + newDst[1] = v[1] * k; - return dst; + return newDst; } /** @@ -310,7 +344,7 @@ export function mulScalar(v: Vec2, k: number, dst?: Vec2): Vec2 { * @param dst - vector to hold result. If not passed in a new one is created. * @returns The scaled vector. */ -export const scale = mulScalar; +const scale = mulScalar; /** * Divides a vector by a scalar. @@ -319,13 +353,13 @@ export const scale = mulScalar; * @param dst - vector to hold result. If not passed in a new one is created. * @returns The scaled vector. */ -export function divScalar(v: Vec2, k: number, dst?: Vec2): Vec2 { - dst = dst || new VecType(2); +function divScalar(v: Vec2Arg, k: number, dst?: T) { + const newDst = (dst ?? new Ctor(2)) as T; - dst[0] = v[0] / k; - dst[1] = v[1] / k; + newDst[0] = v[0] / k; + newDst[1] = v[1] / k; - return dst; + return newDst; } /** @@ -334,13 +368,13 @@ export function divScalar(v: Vec2, k: number, dst?: Vec2): Vec2 { * @param dst - vector to hold result. If not passed in a new one is created. * @returns The inverted vector. */ -export function inverse(v: Vec2, dst?: Vec2): Vec2 { - dst = dst || new VecType(2); +function inverse(v: Vec2Arg, dst?: T) { + const newDst = (dst ?? new Ctor(2)) as T; - dst[0] = 1 / v[0]; - dst[1] = 1 / v[1]; + newDst[0] = 1 / v[0]; + newDst[1] = 1 / v[1]; - return dst; + return newDst; } /** @@ -349,7 +383,7 @@ export function inverse(v: Vec2, dst?: Vec2): Vec2 { * @param dst - vector to hold result. If not passed in a new one is created. * @returns The inverted vector. */ -export const invert = inverse; +const invert = inverse; /** * Computes the cross product of two vectors; assumes both vectors have @@ -359,14 +393,14 @@ export const invert = inverse; * @param dst - vector to hold result. If not passed in a new one is created. * @returns The vector of a cross b. */ -export function cross(a: Vec2, b: Vec2, dst?: Vec3): Vec3 { - dst = dst || new Vec3Type(3); +function cross(a: Vec2Arg, b: Vec2Arg, dst?: T) { + const newDst = (dst ?? new Ctor(3)) as T; const z = a[0] * b[1] - a[1] * b[0]; - dst[0] = 0; - dst[1] = 0; - dst[2] = z; + newDst[0] = 0; + newDst[1] = 0; + newDst[2] = z; - return dst; + return newDst; } /** @@ -376,7 +410,7 @@ export function cross(a: Vec2, b: Vec2, dst?: Vec3): Vec3 { * @param b - Operand vector. * @returns dot product */ -export function dot(a: Vec2, b: Vec2): number { +function dot(a: Vec2Arg, b: Vec2Arg): number { return a[0] * b[0] + a[1] * b[1]; } @@ -385,7 +419,7 @@ export function dot(a: Vec2, b: Vec2): number { * @param v - vector. * @returns length of vector. */ -export function length(v: Vec2): number { +function length(v: Vec2Arg): number { const v0 = v[0]; const v1 = v[1]; return Math.sqrt(v0 * v0 + v1 * v1); @@ -396,14 +430,14 @@ export function length(v: Vec2): number { * @param v - vector. * @returns length of vector. */ -export const len = length; +const len = length; /** * Computes the square of the length of vector * @param v - vector. * @returns square of the length of vector. */ -export function lengthSq(v: Vec2): number { +function lengthSq(v: Vec2Arg): number { const v0 = v[0]; const v1 = v[1]; return v0 * v0 + v1 * v1; @@ -414,7 +448,7 @@ export function lengthSq(v: Vec2): number { * @param v - vector. * @returns square of the length of vector. */ -export const lenSq = lengthSq; +const lenSq = lengthSq; /** * Computes the distance between 2 points @@ -422,7 +456,7 @@ export const lenSq = lengthSq; * @param b - vector. * @returns distance between a and b */ -export function distance(a: Vec2, b: Vec2): number { +function distance(a: Vec2Arg, b: Vec2Arg): number { const dx = a[0] - b[0]; const dy = a[1] - b[1]; return Math.sqrt(dx * dx + dy * dy); @@ -434,7 +468,7 @@ export function distance(a: Vec2, b: Vec2): number { * @param b - vector. * @returns distance between a and b */ -export const dist = distance; +const dist = distance; /** * Computes the square of the distance between 2 points @@ -442,7 +476,7 @@ export const dist = distance; * @param b - vector. * @returns square of the distance between a and b */ -export function distanceSq(a: Vec2, b: Vec2): number { +function distanceSq(a: Vec2Arg, b: Vec2Arg): number { const dx = a[0] - b[0]; const dy = a[1] - b[1]; return dx * dx + dy * dy; @@ -454,7 +488,7 @@ export function distanceSq(a: Vec2, b: Vec2): number { * @param b - vector. * @returns square of the distance between a and b */ -export const distSq = distanceSq; +const distSq = distanceSq; /** * Divides a vector by its Euclidean length and returns the quotient. @@ -462,22 +496,22 @@ export const distSq = distanceSq; * @param dst - vector to hold result. If not passed in a new one is created. * @returns The normalized vector. */ -export function normalize(v: Vec2, dst?: Vec2): Vec2 { - dst = dst || new VecType(2); +function normalize(v: Vec2Arg, dst?: T) { + const newDst = (dst ?? new Ctor(2)) as T; const v0 = v[0]; const v1 = v[1]; const len = Math.sqrt(v0 * v0 + v1 * v1); if (len > 0.00001) { - dst[0] = v0 / len; - dst[1] = v1 / len; + newDst[0] = v0 / len; + newDst[1] = v1 / len; } else { - dst[0] = 0; - dst[1] = 0; + newDst[0] = 0; + newDst[1] = 0; } - return dst; + return newDst; } /** @@ -486,13 +520,13 @@ export function normalize(v: Vec2, dst?: Vec2): Vec2 { * @param dst - vector to hold result. If not passed in a new one is created. * @returns -v. */ -export function negate(v: Vec2, dst?: Vec2): Vec2 { - dst = dst || new VecType(2); +function negate(v: Vec2Arg, dst?: T) { + const newDst = (dst ?? new Ctor(2)) as T; - dst[0] = -v[0]; - dst[1] = -v[1]; + newDst[0] = -v[0]; + newDst[1] = -v[1]; - return dst; + return newDst; } /** @@ -502,13 +536,13 @@ export function negate(v: Vec2, dst?: Vec2): Vec2 { * @param dst - vector to hold result. If not passed in a new one is created. * @returns A copy of v. */ -export function copy(v: Vec2, dst?: Vec2): Vec2 { - dst = dst || new VecType(2); +function copy(v: Vec2Arg, dst?: T) { + const newDst = (dst ?? new Ctor(2)) as T; - dst[0] = v[0]; - dst[1] = v[1]; + newDst[0] = v[0]; + newDst[1] = v[1]; - return dst; + return newDst; } /** @@ -518,7 +552,7 @@ export function copy(v: Vec2, dst?: Vec2): Vec2 { * @param dst - vector to hold result. If not passed in a new one is created. * @returns A copy of v. */ -export const clone = copy; +const clone = copy; /** * Multiplies a vector by another vector (component-wise); assumes a and @@ -528,13 +562,13 @@ export const clone = copy; * @param dst - vector to hold result. If not passed in a new one is created. * @returns The vector of products of entries of a and b. */ -export function multiply(a: Vec2, b: Vec2, dst?: Vec2) { - dst = dst || new VecType(2); +function multiply(a: Vec2Arg, b: Vec2Arg, dst?: T) { + const newDst = (dst ?? new Ctor(2)) as T; - dst[0] = a[0] * b[0]; - dst[1] = a[1] * b[1]; + newDst[0] = a[0] * b[0]; + newDst[1] = a[1] * b[1]; - return dst; + return newDst; } /** @@ -545,7 +579,7 @@ export function multiply(a: Vec2, b: Vec2, dst?: Vec2) { * @param dst - vector to hold result. If not passed in a new one is created. * @returns The vector of products of entries of a and b. */ -export const mul = multiply; +const mul = multiply; /** * Divides a vector by another vector (component-wise); assumes a and @@ -555,13 +589,13 @@ export const mul = multiply; * @param dst - vector to hold result. If not passed in a new one is created. * @returns The vector of quotients of entries of a and b. */ -export function divide(a: Vec2, b: Vec2, dst?: Vec2): Vec2 { - dst = dst || new VecType(2); +function divide(a: Vec2Arg, b: Vec2Arg, dst?: T) { + const newDst = (dst ?? new Ctor(2)) as T; - dst[0] = a[0] / b[0]; - dst[1] = a[1] / b[1]; + newDst[0] = a[0] / b[0]; + newDst[1] = a[1] / b[1]; - return dst; + return newDst; } /** @@ -572,7 +606,7 @@ export function divide(a: Vec2, b: Vec2, dst?: Vec2): Vec2 { * @param dst - vector to hold result. If not passed in a new one is created. * @returns The vector of quotients of entries of a and b. */ -export const div = divide; +const div = divide; /** * Creates a random unit vector * scale @@ -580,14 +614,14 @@ export const div = divide; * @param dst - vector to hold result. If not passed in a new one is created. * @returns The random vector. */ -export function random(scale = 1, dst?: Vec2): Vec2 { - dst = dst || new VecType(2); +function random(scale = 1, dst?: T) { + const newDst = (dst ?? new Ctor(2)) as T; const angle = Math.random() * 2 * Math.PI; - dst[0] = Math.cos(angle) * scale; - dst[1] = Math.sin(angle) * scale; + newDst[0] = Math.cos(angle) * scale; + newDst[1] = Math.sin(angle) * scale; - return dst; + return newDst; } /** @@ -595,13 +629,13 @@ export function random(scale = 1, dst?: Vec2): Vec2 { * @param dst - vector to hold result. If not passed in a new one is created. * @returns The zeroed vector. */ -export function zero(dst?: Vec2): Vec2 { - dst = dst || new VecType(2); +function zero(dst?: T) { + const newDst = (dst ?? new Ctor(2)) as T; - dst[0] = 0; - dst[1] = 0; + newDst[0] = 0; + newDst[1] = 0; - return dst; + return newDst; } @@ -612,16 +646,16 @@ export function zero(dst?: Vec2): Vec2 { * @param dst - optional Vec2 to store result. If not passed a new one is created. * @returns the transformed vector */ -export function transformMat4(v: Vec2, m: Mat4, dst?: Vec2): Vec2 { - dst = dst || new VecType(2); +function transformMat4(v: Vec2Arg, m: Mat4Arg, dst?: T) { + const newDst = (dst ?? new Ctor(2)) as T; const x = v[0]; const y = v[1]; - dst[0] = x * m[0] + y * m[4] + m[12]; - dst[1] = x * m[1] + y * m[5] + m[13]; + newDst[0] = x * m[0] + y * m[4] + m[12]; + newDst[1] = x * m[1] + y * m[5] + m[13]; - return dst; + return newDst; } /** @@ -632,16 +666,16 @@ export function transformMat4(v: Vec2, m: Mat4, dst?: Vec2): Vec2 { * @param dst - optional Vec2 to store result. If not passed a new one is created. * @returns the transformed vector */ -export function transformMat3(v: Vec2, m: Mat3, dst?: Vec2): Vec2 { - dst = dst || new VecType(2); +function transformMat3(v: Vec2Arg, m: Mat3Arg, dst?: T) { + const newDst = (dst ?? new Ctor(2)) as T; const x = v[0]; const y = v[1]; - dst[0] = m[0] * x + m[4] * y + m[8]; - dst[1] = m[1] * x + m[5] * y + m[9]; + newDst[0] = m[0] * x + m[4] * y + m[8]; + newDst[1] = m[1] * x + m[5] * y + m[9]; - return dst; + return newDst; } /** @@ -652,8 +686,8 @@ export function transformMat3(v: Vec2, m: Mat3, dst?: Vec2): Vec2 { * @param rad The angle of rotation in radians * @returns the rotated vector */ -export function rotate(a: Vec2, b: Vec2, rad: number, dst?: Vec2) { - dst = dst || new VecType(2); +function rotate(a: Vec2Arg, b: Vec2Arg, rad: number, dst?: T) { + const newDst = (dst ?? new Ctor(2)) as T; // Translate point to the origin const p0 = a[0] - b[0]; @@ -662,10 +696,10 @@ export function rotate(a: Vec2, b: Vec2, rad: number, dst?: Vec2) { const cosC = Math.cos(rad); //perform rotation and translate to correct position - dst[0] = p0 * cosC - p1 * sinC + b[0]; - dst[1] = p0 * sinC + p1 * cosC + b[1]; + newDst[0] = p0 * cosC - p1 * sinC + b[0]; + newDst[1] = p0 * sinC + p1 * cosC + b[1]; - return dst; + return newDst; } /** @@ -675,10 +709,10 @@ export function rotate(a: Vec2, b: Vec2, rad: number, dst?: Vec2) { * @param len The length of the resulting vector * @returns The lengthened vector */ -export function setLength(a: Vec2, len: number, dst?: Vec2) { - dst = dst || new VecType(2); - normalize(a, dst); - return mulScalar(dst, len, dst); +function setLength(a: Vec2Arg, len: number, dst?: T) { + const newDst = (dst ?? new Ctor(2)) as T; + normalize(a, newDst); + return mulScalar(newDst, len, newDst); } /** @@ -688,14 +722,14 @@ export function setLength(a: Vec2, len: number, dst?: Vec2) { * @param maxLen The longest length of the resulting vector * @returns The vector, shortened to maxLen if it's too long */ -export function truncate(a: Vec2, maxLen: number, dst?: Vec2) { - dst = dst || new VecType(2); +function truncate(a: Vec2Arg, maxLen: number, dst?: T) { + const newDst = (dst ?? new Ctor(2)) as T; if (length(a) > maxLen) { - return setLength(a, maxLen, dst); + return setLength(a, maxLen, newDst); } - return copy(a, dst); + return copy(a, newDst); } /** @@ -705,7 +739,73 @@ export function truncate(a: Vec2, maxLen: number, dst?: Vec2) { * @param b Endpoint 2 * @returns The vector exactly residing between endpoints 1 and 2 */ -export function midpoint(a: Vec2, b: Vec2, dst?: Vec2) { - dst = dst || new VecType(2); - return lerp(a, b, 0.5, dst); +function midpoint(a: Vec2Arg, b: Vec2Arg, dst?: T) { + const newDst = (dst ?? new Ctor(2)) as T; + return lerp(a, b, 0.5, newDst); +} + +return { + create, + fromValues, + set, + ceil, + floor, + round, + clamp, + add, + addScaled, + angle, + subtract, + sub, + equalsApproximately, + equals, + lerp, + lerpV, + max, + min, + mulScalar, + scale, + divScalar, + inverse, + invert, + cross, + dot, + length, + len, + lengthSq, + lenSq, + distance, + dist, + distanceSq, + distSq, + normalize, + negate, + copy, + clone, + multiply, + mul, + divide, + div, + random, + zero, + transformMat4, + transformMat3, + rotate, + setLength, + truncate, + midpoint, +}; +} + +type API = ReturnType>; + +const cache = new Map(); + +export function getAPI(Ctor: Vec2Ctor) { + let api = cache.get(Ctor); + if (!api) { + api = getAPIImpl(Ctor); + cache.set(Ctor, api); + } + return api as API; } diff --git a/src/vec2.ts b/src/vec2.ts index 59766bf..f314859 100644 --- a/src/vec2.ts +++ b/src/vec2.ts @@ -20,83 +20,14 @@ * DEALINGS IN THE SOFTWARE. */ -/** - * A JavaScript array with 2 values, Float32Array with 2 values, or a Float64Array with 2 values. - * When created by the library will create the default type which is `Float32Array` - * but can be set by calling {@link vec2.setDefaultType}. - */ -export type Vec2 = number[] | Float32Array | Float64Array; - -/** - * - * Vec2 math functions. - * - * Almost all functions take an optional `dst` argument. If it is not passed in the - * functions will create a new Vec2. In other words you can do this - * - * const v = vec2.cross(v1, v2); // Creates a new Vec2 with the cross product of v1 x v2. - * - * or - * - * const v = vec2.create(); - * vec2.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v - * - * The first style is often easier but depending on where it's used it generates garbage where - * as there is almost never allocation with the second style. - * - * It is always safe to pass any vector as the destination. So for example - * - * vec2.cross(v1, v2, v1); // Puts the cross product of v1 x v2 in v1 - * - */ - -export let VecType: new (n: number) => Vec2 = Float32Array; +import { BaseArgType } from "./types"; /** - * Sets the type this library creates for a Vec2 - * @param ctor - the constructor for the type. Either `Float32Array`, `Float64Array`, or `Array` - * @returns previous constructor for Vec2 + * A JavaScript array with 2 values, a Float32Array with 2 values, or a Float64Array with 2 values. */ -export function setDefaultType(ctor: new (n: number) => Vec2) { - const oldType = VecType; - VecType = ctor; - return oldType; -} +export type Vec2Arg = BaseArgType; /** - * Creates a Vec2; may be called with x, y, z to set initial values. - * - * Note: Since passing in a raw JavaScript array - * is valid in all circumstances, if you want to - * force a JavaScript array into a Vec2's specified type - * it would be faster to use - * - * ``` - * const v = vec2.clone(someJSArray); - * ``` - * - * Note: a consequence of the implementation is if your Vec2Type = `Array` - * instead of `Float32Array` or `Float64Array` then any values you - * don't pass in will be undefined. Usually this is not an issue since - * (a) using `Array` is rare and (b) using `vec2.create` is usually used - * to create a Vec2 to be filled out as in - * - * ``` - * const sum = vec2.create(); - * vec2.add(v1, v2, sum); - * ``` - * - * @param x - Initial x value. - * @param y - Initial y value. - * @returns the created vector + * A specific concrete 2 element vector. */ -export function create(x = 0, y = 0): Vec2 { - const dst = new VecType(2); - if (x !== undefined) { - dst[0] = x; - if (y !== undefined) { - dst[1] = y; - } - } - return dst; -} +export type Vec2Type = T; diff --git a/src/vec3-impl.ts b/src/vec3-impl.ts index 34d43a0..08d2a81 100644 --- a/src/vec3-impl.ts +++ b/src/vec3-impl.ts @@ -20,13 +20,41 @@ * DEALINGS IN THE SOFTWARE. */ import * as utils from './utils.js'; -import { Vec3, create, setDefaultType, VecType } from './vec3'; -import { Mat3 } from './mat3'; -import { Mat4 } from './mat4'; -import { Quat } from './quat'; +import { Vec3Arg, Vec3Type } from './vec3'; +import { Mat3Arg } from './mat3'; +import { Mat4Arg } from './mat4'; +import { QuatArg } from './quat'; +import { BaseArgType } from './types'; -export default Vec3; -export { create, setDefaultType }; +export { Vec3Arg, Vec3Type }; + +type Vec3Ctor = new (n: number) => T; + +/** + * Generates am typed API for Vec3 + * */ +function getAPIImpl(Ctor: Vec3Ctor) { + +/** + * Creates a vec3; may be called with x, y, z to set initial values. + * @param x - Initial x value. + * @param y - Initial y value. + * @param z - Initial z value. + * @returns the created vector + */ +function create(x?: number, y?: number, z?: number) { + const newDst = new Ctor(3); + if (x !== undefined) { + newDst[0] = x; + if (y !== undefined) { + newDst[1] = y; + if (z !== undefined) { + newDst[2] = z; + } + } + } + return newDst; +} /** * Creates a vec3; may be called with x, y, z to set initial values. (same as create) @@ -35,7 +63,7 @@ export { create, setDefaultType }; * @param z - Initial z value. * @returns the created vector */ -export const fromValues = create; +const fromValues = create; /** * Sets the values of a Vec3 @@ -47,14 +75,14 @@ export const fromValues = create; * @param dst - vector to hold result. If not passed in a new one is created. * @returns A vector with its elements set. */ -export function set(x: number, y: number, z: number, dst?: Vec3) { - dst = dst || new VecType(3); +function set(x: number, y: number, z: number, dst?: T) { + const newDst = (dst ?? new Ctor(3)) as T; - dst[0] = x; - dst[1] = y; - dst[2] = z; + newDst[0] = x; + newDst[1] = y; + newDst[2] = z; - return dst; + return newDst; } /** @@ -63,14 +91,14 @@ export function set(x: number, y: number, z: number, dst?: Vec3) { * @param dst - vector to hold result. If not passed in a new one is created. * @returns A vector that is the ceil of each element of v. */ -export function ceil(v: Vec3, dst?: Vec3): Vec3 { - dst = dst || new VecType(3); +function ceil(v: Vec3Arg, dst?: T) { + const newDst = (dst ?? new Ctor(3)) as T; - dst[0] = Math.ceil(v[0]); - dst[1] = Math.ceil(v[1]); - dst[2] = Math.ceil(v[2]); + newDst[0] = Math.ceil(v[0]); + newDst[1] = Math.ceil(v[1]); + newDst[2] = Math.ceil(v[2]); - return dst; + return newDst; } /** @@ -79,14 +107,14 @@ export function ceil(v: Vec3, dst?: Vec3): Vec3 { * @param dst - vector to hold result. If not passed in a new one is created. * @returns A vector that is the floor of each element of v. */ -export function floor(v: Vec3, dst?: Vec3): Vec3 { - dst = dst || new VecType(3); +function floor(v: Vec3Arg, dst?: T) { + const newDst = (dst ?? new Ctor(3)) as T; - dst[0] = Math.floor(v[0]); - dst[1] = Math.floor(v[1]); - dst[2] = Math.floor(v[2]); + newDst[0] = Math.floor(v[0]); + newDst[1] = Math.floor(v[1]); + newDst[2] = Math.floor(v[2]); - return dst; + return newDst; } /** @@ -95,14 +123,14 @@ export function floor(v: Vec3, dst?: Vec3): Vec3 { * @param dst - vector to hold result. If not passed in a new one is created. * @returns A vector that is the round of each element of v. */ -export function round(v: Vec3, dst?: Vec3): Vec3 { - dst = dst || new VecType(3); +function round(v: Vec3Arg, dst?: T) { + const newDst = (dst ?? new Ctor(3)) as T; - dst[0] = Math.round(v[0]); - dst[1] = Math.round(v[1]); - dst[2] = Math.round(v[2]); + newDst[0] = Math.round(v[0]); + newDst[1] = Math.round(v[1]); + newDst[2] = Math.round(v[2]); - return dst; + return newDst; } /** @@ -113,14 +141,14 @@ export function round(v: Vec3, dst?: Vec3): Vec3 { * @param dst - vector to hold result. If not passed in a new one is created. * @returns A vector that the clamped value of each element of v. */ -export function clamp(v: Vec3, min = 0, max = 1, dst?: Vec3): Vec3 { - dst = dst || new VecType(3); +function clamp(v: Vec3Arg, min = 0, max = 1, dst?: T) { + const newDst = (dst ?? new Ctor(3)) as T; - dst[0] = Math.min(max, Math.max(min, v[0])); - dst[1] = Math.min(max, Math.max(min, v[1])); - dst[2] = Math.min(max, Math.max(min, v[2])); + newDst[0] = Math.min(max, Math.max(min, v[0])); + newDst[1] = Math.min(max, Math.max(min, v[1])); + newDst[2] = Math.min(max, Math.max(min, v[2])); - return dst; + return newDst; } /** @@ -130,14 +158,14 @@ export function clamp(v: Vec3, min = 0, max = 1, dst?: Vec3): Vec3 { * @param dst - vector to hold result. If not passed in a new one is created. * @returns A vector that is the sum of a and b. */ -export function add(a: Vec3, b: Vec3, dst?: Vec3) { - dst = dst || new VecType(3); +function add(a: Vec3Arg, b: Vec3Arg, dst?: T) { + const newDst = (dst ?? new Ctor(3)) as T; - dst[0] = a[0] + b[0]; - dst[1] = a[1] + b[1]; - dst[2] = a[2] + b[2]; + newDst[0] = a[0] + b[0]; + newDst[1] = a[1] + b[1]; + newDst[2] = a[2] + b[2]; - return dst; + return newDst; } /** @@ -148,14 +176,14 @@ export function add(a: Vec3, b: Vec3, dst?: Vec3) { * @param dst - vector to hold result. If not passed in a new one is created. * @returns A vector that is the sum of a + b * scale. */ -export function addScaled(a: Vec3, b: Vec3, scale: number, dst?: Vec3): Vec3 { - dst = dst || new VecType(3); +function addScaled(a: Vec3Arg, b: Vec3Arg, scale: number, dst?: T) { + const newDst = (dst ?? new Ctor(3)) as T; - dst[0] = a[0] + b[0] * scale; - dst[1] = a[1] + b[1] * scale; - dst[2] = a[2] + b[2] * scale; + newDst[0] = a[0] + b[0] * scale; + newDst[1] = a[1] + b[1] * scale; + newDst[2] = a[2] + b[2] * scale; - return dst; + return newDst; } /** @@ -164,7 +192,7 @@ export function addScaled(a: Vec3, b: Vec3, scale: number, dst?: Vec3): Vec3 { * @param b - Operand vector. * @returns The angle in radians between the 2 vectors. */ -export function angle(a: Vec3, b: Vec3): number { +function angle(a: Vec3Arg, b: Vec3Arg): number { const ax = a[0]; const ay = a[1]; const az = a[2]; @@ -185,14 +213,14 @@ export function angle(a: Vec3, b: Vec3): number { * @param dst - vector to hold result. If not passed in a new one is created. * @returns A vector that is the difference of a and b. */ -export function subtract(a: Vec3, b: Vec3, dst?: Vec3): Vec3 { - dst = dst || new VecType(3); +function subtract(a: Vec3Arg, b: Vec3Arg, dst?: T) { + const newDst = (dst ?? new Ctor(3)) as T; - dst[0] = a[0] - b[0]; - dst[1] = a[1] - b[1]; - dst[2] = a[2] - b[2]; + newDst[0] = a[0] - b[0]; + newDst[1] = a[1] - b[1]; + newDst[2] = a[2] - b[2]; - return dst; + return newDst; } /** @@ -202,7 +230,7 @@ export function subtract(a: Vec3, b: Vec3, dst?: Vec3): Vec3 { * @param dst - vector to hold result. If not passed in a new one is created. * @returns A vector that is the difference of a and b. */ -export const sub = subtract; +const sub = subtract; /** * Check if 2 vectors are approximately equal @@ -210,7 +238,7 @@ export const sub = subtract; * @param b - Operand vector. * @returns true if vectors are approximately equal */ -export function equalsApproximately(a: Vec3, b: Vec3): boolean { +function equalsApproximately(a: Vec3Arg, b: Vec3Arg): boolean { return Math.abs(a[0] - b[0]) < utils.EPSILON && Math.abs(a[1] - b[1]) < utils.EPSILON && Math.abs(a[2] - b[2]) < utils.EPSILON; @@ -222,7 +250,7 @@ export function equalsApproximately(a: Vec3, b: Vec3): boolean { * @param b - Operand vector. * @returns true if vectors are exactly equal */ -export function equals(a: Vec3, b: Vec3): boolean { +function equals(a: Vec3Arg, b: Vec3Arg): boolean { return a[0] === b[0] && a[1] === b[1] && a[2] === b[2]; } @@ -236,14 +264,14 @@ export function equals(a: Vec3, b: Vec3): boolean { * @param dst - vector to hold result. If not passed in a new one is created. * @returns The linear interpolated result. */ -export function lerp(a: Vec3, b: Vec3, t: number, dst?: Vec3): Vec3 { - dst = dst || new VecType(3); +function lerp(a: Vec3Arg, b: Vec3Arg, t: number, dst?: T) { + const newDst = (dst ?? new Ctor(3)) as T; - dst[0] = a[0] + t * (b[0] - a[0]); - dst[1] = a[1] + t * (b[1] - a[1]); - dst[2] = a[2] + t * (b[2] - a[2]); + newDst[0] = a[0] + t * (b[0] - a[0]); + newDst[1] = a[1] + t * (b[1] - a[1]); + newDst[2] = a[2] + t * (b[2] - a[2]); - return dst; + return newDst; } /** @@ -256,14 +284,14 @@ export function lerp(a: Vec3, b: Vec3, t: number, dst?: Vec3): Vec3 { * @param dst - vector to hold result. If not passed in a new one is created. * @returns the linear interpolated result. */ -export function lerpV(a: Vec3, b: Vec3, t: Vec3, dst?: Vec3): Vec3 { - dst = dst || new VecType(3); +function lerpV(a: Vec3Arg, b: Vec3Arg, t: Vec3Arg, dst?: T) { + const newDst = (dst ?? new Ctor(3)) as T; - dst[0] = a[0] + t[0] * (b[0] - a[0]); - dst[1] = a[1] + t[1] * (b[1] - a[1]); - dst[2] = a[2] + t[2] * (b[2] - a[2]); + newDst[0] = a[0] + t[0] * (b[0] - a[0]); + newDst[1] = a[1] + t[1] * (b[1] - a[1]); + newDst[2] = a[2] + t[2] * (b[2] - a[2]); - return dst; + return newDst; } /** @@ -275,14 +303,14 @@ export function lerpV(a: Vec3, b: Vec3, t: Vec3, dst?: Vec3): Vec3 { * @param dst - vector to hold result. If not passed in a new one is created. * @returns The max components vector. */ -export function max(a: Vec3, b: Vec3, dst?: Vec3): Vec3 { - dst = dst || new VecType(3); +function max(a: Vec3Arg, b: Vec3Arg, dst?: T) { + const newDst = (dst ?? new Ctor(3)) as T; - dst[0] = Math.max(a[0], b[0]); - dst[1] = Math.max(a[1], b[1]); - dst[2] = Math.max(a[2], b[2]); + newDst[0] = Math.max(a[0], b[0]); + newDst[1] = Math.max(a[1], b[1]); + newDst[2] = Math.max(a[2], b[2]); - return dst; + return newDst; } /** @@ -294,14 +322,14 @@ export function max(a: Vec3, b: Vec3, dst?: Vec3): Vec3 { * @param dst - vector to hold result. If not passed in a new one is created. * @returns The min components vector. */ -export function min(a: Vec3, b: Vec3, dst?: Vec3): Vec3 { - dst = dst || new VecType(3); +function min(a: Vec3Arg, b: Vec3Arg, dst?: T) { + const newDst = (dst ?? new Ctor(3)) as T; - dst[0] = Math.min(a[0], b[0]); - dst[1] = Math.min(a[1], b[1]); - dst[2] = Math.min(a[2], b[2]); + newDst[0] = Math.min(a[0], b[0]); + newDst[1] = Math.min(a[1], b[1]); + newDst[2] = Math.min(a[2], b[2]); - return dst; + return newDst; } /** @@ -311,14 +339,14 @@ export function min(a: Vec3, b: Vec3, dst?: Vec3): Vec3 { * @param dst - vector to hold result. If not passed in a new one is created. * @returns The scaled vector. */ -export function mulScalar(v: Vec3, k: number, dst?: Vec3): Vec3 { - dst = dst || new VecType(3); +function mulScalar(v: Vec3Arg, k: number, dst?: T) { + const newDst = (dst ?? new Ctor(3)) as T; - dst[0] = v[0] * k; - dst[1] = v[1] * k; - dst[2] = v[2] * k; + newDst[0] = v[0] * k; + newDst[1] = v[1] * k; + newDst[2] = v[2] * k; - return dst; + return newDst; } /** @@ -328,7 +356,7 @@ export function mulScalar(v: Vec3, k: number, dst?: Vec3): Vec3 { * @param dst - vector to hold result. If not passed in a new one is created. * @returns The scaled vector. */ -export const scale = mulScalar; +const scale = mulScalar; /** * Divides a vector by a scalar. @@ -337,14 +365,14 @@ export const scale = mulScalar; * @param dst - vector to hold result. If not passed in a new one is created. * @returns The scaled vector. */ -export function divScalar(v: Vec3, k: number, dst?: Vec3): Vec3 { - dst = dst || new VecType(3); +function divScalar(v: Vec3Arg, k: number, dst?: T) { + const newDst = (dst ?? new Ctor(3)) as T; - dst[0] = v[0] / k; - dst[1] = v[1] / k; - dst[2] = v[2] / k; + newDst[0] = v[0] / k; + newDst[1] = v[1] / k; + newDst[2] = v[2] / k; - return dst; + return newDst; } /** @@ -353,14 +381,14 @@ export function divScalar(v: Vec3, k: number, dst?: Vec3): Vec3 { * @param dst - vector to hold result. If not passed in a new one is created. * @returns The inverted vector. */ -export function inverse(v: Vec3, dst?: Vec3): Vec3 { - dst = dst || new VecType(3); +function inverse(v: Vec3Arg, dst?: T) { + const newDst = (dst ?? new Ctor(3)) as T; - dst[0] = 1 / v[0]; - dst[1] = 1 / v[1]; - dst[2] = 1 / v[2]; + newDst[0] = 1 / v[0]; + newDst[1] = 1 / v[1]; + newDst[2] = 1 / v[2]; - return dst; + return newDst; } /** @@ -369,7 +397,7 @@ export function inverse(v: Vec3, dst?: Vec3): Vec3 { * @param dst - vector to hold result. If not passed in a new one is created. * @returns The inverted vector. */ -export const invert = inverse; +const invert = inverse; /** * Computes the cross product of two vectors; assumes both vectors have @@ -379,16 +407,16 @@ export const invert = inverse; * @param dst - vector to hold result. If not passed in a new one is created. * @returns The vector of a cross b. */ -export function cross(a: Vec3, b: Vec3, dst?: Vec3): Vec3 { - dst = dst || new VecType(3); +function cross(a: Vec3Arg, b: Vec3Arg, dst?: T) { + const newDst = (dst ?? new Ctor(3)) as T; const t1 = a[2] * b[0] - a[0] * b[2]; const t2 = a[0] * b[1] - a[1] * b[0]; - dst[0] = a[1] * b[2] - a[2] * b[1]; - dst[1] = t1; - dst[2] = t2; + newDst[0] = a[1] * b[2] - a[2] * b[1]; + newDst[1] = t1; + newDst[2] = t2; - return dst; + return newDst; } /** @@ -398,7 +426,7 @@ export function cross(a: Vec3, b: Vec3, dst?: Vec3): Vec3 { * @param b - Operand vector. * @returns dot product */ -export function dot(a: Vec3, b: Vec3): number { +function dot(a: Vec3Arg, b: Vec3Arg): number { return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]); } @@ -407,7 +435,7 @@ export function dot(a: Vec3, b: Vec3): number { * @param v - vector. * @returns length of vector. */ -export function length(v: Vec3): number { +function length(v: Vec3Arg): number { const v0 = v[0]; const v1 = v[1]; const v2 = v[2]; @@ -419,14 +447,14 @@ export function length(v: Vec3): number { * @param v - vector. * @returns length of vector. */ -export const len = length; +const len = length; /** * Computes the square of the length of vector * @param v - vector. * @returns square of the length of vector. */ -export function lengthSq(v: Vec3): number { +function lengthSq(v: Vec3Arg): number { const v0 = v[0]; const v1 = v[1]; const v2 = v[2]; @@ -438,7 +466,7 @@ export function lengthSq(v: Vec3): number { * @param v - vector. * @returns square of the length of vector. */ -export const lenSq = lengthSq; +const lenSq = lengthSq; /** * Computes the distance between 2 points @@ -446,7 +474,7 @@ export const lenSq = lengthSq; * @param b - vector. * @returns distance between a and b */ -export function distance(a: Vec3, b: Vec3): number { +function distance(a: Vec3Arg, b: Vec3Arg): number { const dx = a[0] - b[0]; const dy = a[1] - b[1]; const dz = a[2] - b[2]; @@ -459,7 +487,7 @@ export function distance(a: Vec3, b: Vec3): number { * @param b - vector. * @returns distance between a and b */ -export const dist = distance; +const dist = distance; /** * Computes the square of the distance between 2 points @@ -467,7 +495,7 @@ export const dist = distance; * @param b - vector. * @returns square of the distance between a and b */ -export function distanceSq(a: Vec3, b: Vec3): number { +function distanceSq(a: Vec3Arg, b: Vec3Arg): number { const dx = a[0] - b[0]; const dy = a[1] - b[1]; const dz = a[2] - b[2]; @@ -480,7 +508,7 @@ export function distanceSq(a: Vec3, b: Vec3): number { * @param b - vector. * @returns square of the distance between a and b */ -export const distSq = distanceSq; +const distSq = distanceSq; /** * Divides a vector by its Euclidean length and returns the quotient. @@ -488,8 +516,8 @@ export const distSq = distanceSq; * @param dst - vector to hold result. If not passed in a new one is created. * @returns The normalized vector. */ -export function normalize(v: Vec3, dst?: Vec3): Vec3 { - dst = dst || new VecType(3); +function normalize(v: Vec3Arg, dst?: T) { + const newDst = (dst ?? new Ctor(3)) as T; const v0 = v[0]; const v1 = v[1]; @@ -497,17 +525,17 @@ export function normalize(v: Vec3, dst?: Vec3): Vec3 { const len = Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2); if (len > 0.00001) { - dst[0] = v0 / len; - dst[1] = v1 / len; - dst[2] = v2 / len; + newDst[0] = v0 / len; + newDst[1] = v1 / len; + newDst[2] = v2 / len; } else { - dst[0] = 0; - dst[1] = 0; - dst[2] = 0; + newDst[0] = 0; + newDst[1] = 0; + newDst[2] = 0; } - return dst; + return newDst; } /** @@ -516,14 +544,14 @@ export function normalize(v: Vec3, dst?: Vec3): Vec3 { * @param dst - vector to hold result. If not passed in a new one is created. * @returns -v. */ -export function negate(v: Vec3, dst?: Vec3): Vec3 { - dst = dst || new VecType(3); +function negate(v: Vec3Arg, dst?: T) { + const newDst = (dst ?? new Ctor(3)) as T; - dst[0] = -v[0]; - dst[1] = -v[1]; - dst[2] = -v[2]; + newDst[0] = -v[0]; + newDst[1] = -v[1]; + newDst[2] = -v[2]; - return dst; + return newDst; } /** @@ -533,14 +561,14 @@ export function negate(v: Vec3, dst?: Vec3): Vec3 { * @param dst - vector to hold result. If not passed in a new one is created. * @returns A copy of v. */ -export function copy(v: Vec3, dst?: Vec3): Vec3 { - dst = dst || new VecType(3); +function copy(v: Vec3Arg, dst?: T) { + const newDst = (dst ?? new Ctor(3)) as T; - dst[0] = v[0]; - dst[1] = v[1]; - dst[2] = v[2]; + newDst[0] = v[0]; + newDst[1] = v[1]; + newDst[2] = v[2]; - return dst; + return newDst; } /** @@ -550,7 +578,7 @@ export function copy(v: Vec3, dst?: Vec3): Vec3 { * @param dst - vector to hold result. If not passed in a new one is created. * @returns A copy of v. */ -export const clone = copy; +const clone = copy; /** * Multiplies a vector by another vector (component-wise); assumes a and @@ -560,14 +588,14 @@ export const clone = copy; * @param dst - vector to hold result. If not passed in a new one is created. * @returns The vector of products of entries of a and b. */ -export function multiply(a: Vec3, b: Vec3, dst?: Vec3): Vec3 { - dst = dst || new VecType(3); +function multiply(a: Vec3Arg, b: Vec3Arg, dst?: T) { + const newDst = (dst ?? new Ctor(3)) as T; - dst[0] = a[0] * b[0]; - dst[1] = a[1] * b[1]; - dst[2] = a[2] * b[2]; + newDst[0] = a[0] * b[0]; + newDst[1] = a[1] * b[1]; + newDst[2] = a[2] * b[2]; - return dst; + return newDst; } /** @@ -578,7 +606,7 @@ export function multiply(a: Vec3, b: Vec3, dst?: Vec3): Vec3 { * @param dst - vector to hold result. If not passed in a new one is created. * @returns The vector of products of entries of a and b. */ -export const mul = multiply; +const mul = multiply; /** * Divides a vector by another vector (component-wise); assumes a and @@ -588,14 +616,14 @@ export const mul = multiply; * @param dst - vector to hold result. If not passed in a new one is created. * @returns The vector of quotients of entries of a and b. */ -export function divide(a: Vec3, b: Vec3, dst?: Vec3) { - dst = dst || new VecType(3); +function divide(a: Vec3Arg, b: Vec3Arg, dst?: T) { + const newDst = (dst ?? new Ctor(3)) as T; - dst[0] = a[0] / b[0]; - dst[1] = a[1] / b[1]; - dst[2] = a[2] / b[2]; + newDst[0] = a[0] / b[0]; + newDst[1] = a[1] / b[1]; + newDst[2] = a[2] / b[2]; - return dst; + return newDst; } /** @@ -606,7 +634,7 @@ export function divide(a: Vec3, b: Vec3, dst?: Vec3) { * @param dst - vector to hold result. If not passed in a new one is created. * @returns The vector of quotients of entries of a and b. */ -export const div = divide; +const div = divide; /** * Creates a random vector @@ -614,17 +642,17 @@ export const div = divide; * @param dst - vector to hold result. If not passed in a new one is created. * @returns The random vector. */ -export function random(scale = 1, dst?: Vec3): Vec3 { - dst = dst || new VecType(3); +function random(scale = 1, dst?: T) { + const newDst = (dst ?? new Ctor(3)) as T; const angle = Math.random() * 2 * Math.PI; const z = Math.random() * 2 - 1; const zScale = Math.sqrt(1 - z * z) * scale; - dst[0] = Math.cos(angle) * zScale; - dst[1] = Math.sin(angle) * zScale; - dst[2] = z * scale; + newDst[0] = Math.cos(angle) * zScale; + newDst[1] = Math.sin(angle) * zScale; + newDst[2] = z * scale; - return dst; + return newDst; } /** @@ -632,14 +660,14 @@ export function random(scale = 1, dst?: Vec3): Vec3 { * @param dst - vector to hold result. If not passed in a new one is created. * @returns The zeroed vector. */ -export function zero(dst?: Vec3): Vec3 { - dst = dst || new VecType(3); +function zero(dst?: T) { + const newDst = (dst ?? new Ctor(3)) as T; - dst[0] = 0; - dst[1] = 0; - dst[2] = 0; + newDst[0] = 0; + newDst[1] = 0; + newDst[2] = 0; - return dst; + return newDst; } @@ -650,40 +678,40 @@ export function zero(dst?: Vec3): Vec3 { * @param dst - optional vec3 to store result. If not passed a new one is created. * @returns the transformed vector */ -export function transformMat4(v: Vec3, m: Mat4, dst?: Vec3): Vec3 { - dst = dst || new VecType(3); +function transformMat4(v: Vec3Arg, m: Mat4Arg, dst?: T) { + const newDst = (dst ?? new Ctor(3)) as T; const x = v[0]; const y = v[1]; const z = v[2]; const w = (m[3] * x + m[7] * y + m[11] * z + m[15]) || 1; - dst[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w; - dst[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w; - dst[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w; + newDst[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w; + newDst[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w; + newDst[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w; - return dst; + return newDst; } /** - * Transform vec4 by upper 3x3 matrix inside 4x4 matrix. + * Transform vec3 by upper 3x3 matrix inside 4x4 matrix. * @param v - The direction. * @param m - The matrix. - * @param dst - optional Vec3 to store result. If not passed a new one is created. + * @param dst - optional vec3 to store result. If not passed a new one is created. * @returns The transformed vector. */ -export function transformMat4Upper3x3(v: Vec3, m: Mat4, dst?: Vec3): Vec3 { - dst = dst || new VecType(3); +function transformMat4Upper3x3(v: Vec3Arg, m: Mat4Arg, dst?: T) { + const newDst = (dst ?? new Ctor(3)) as T; const v0 = v[0]; const v1 = v[1]; const v2 = v[2]; - dst[0] = v0 * m[0 * 4 + 0] + v1 * m[1 * 4 + 0] + v2 * m[2 * 4 + 0]; - dst[1] = v0 * m[0 * 4 + 1] + v1 * m[1 * 4 + 1] + v2 * m[2 * 4 + 1]; - dst[2] = v0 * m[0 * 4 + 2] + v1 * m[1 * 4 + 2] + v2 * m[2 * 4 + 2]; + newDst[0] = v0 * m[0 * 4 + 0] + v1 * m[1 * 4 + 0] + v2 * m[2 * 4 + 0]; + newDst[1] = v0 * m[0 * 4 + 1] + v1 * m[1 * 4 + 1] + v2 * m[2 * 4 + 1]; + newDst[2] = v0 * m[0 * 4 + 2] + v1 * m[1 * 4 + 2] + v2 * m[2 * 4 + 2]; - return dst; + return newDst; } /** @@ -694,18 +722,18 @@ export function transformMat4Upper3x3(v: Vec3, m: Mat4, dst?: Vec3): Vec3 { * @param dst - optional vec3 to store result. If not passed a new one is created. * @returns the transformed vector */ -export function transformMat3(v: Vec3, m: Mat3, dst?: Vec3): Vec3 { - dst = dst || new VecType(3); +function transformMat3(v: Vec3Arg, m: Mat3Arg, dst?: T) { + const newDst = (dst ?? new Ctor(3)) as T; const x = v[0]; const y = v[1]; const z = v[2]; - dst[0] = x * m[0] + y * m[4] + z * m[8]; - dst[1] = x * m[1] + y * m[5] + z * m[9]; - dst[2] = x * m[2] + y * m[6] + z * m[10]; + newDst[0] = x * m[0] + y * m[4] + z * m[8]; + newDst[1] = x * m[1] + y * m[5] + z * m[9]; + newDst[2] = x * m[2] + y * m[6] + z * m[10]; - return dst; + return newDst; } /** @@ -715,8 +743,8 @@ export function transformMat3(v: Vec3, m: Mat3, dst?: Vec3): Vec3 { * @param dst - optional vec3 to store result. If not passed a new one is created. * @returns the transformed */ -export function transformQuat(v: Vec3, q: Quat, dst?: Vec3): Vec3 { - dst = dst || new VecType(3); +function transformQuat(v: Vec3Arg, q: QuatArg, dst?: T) { + const newDst = (dst ?? new Ctor(3)) as T; const qx = q[0]; const qy = q[1]; @@ -731,11 +759,11 @@ export function transformQuat(v: Vec3, q: Quat, dst?: Vec3): Vec3 { const uvY = qz * x - qx * z; const uvZ = qx * y - qy * x; - dst[0] = x + uvX * w2 + (qy * uvZ - qz * uvY) * 2; - dst[1] = y + uvY * w2 + (qz * uvX - qx * uvZ) * 2; - dst[2] = z + uvZ * w2 + (qx * uvY - qy * uvX) * 2; + newDst[0] = x + uvX * w2 + (qy * uvZ - qz * uvY) * 2; + newDst[1] = y + uvY * w2 + (qz * uvX - qx * uvZ) * 2; + newDst[2] = z + uvZ * w2 + (qx * uvY - qy * uvX) * 2; - return dst; + return newDst; } /** @@ -745,12 +773,12 @@ export function transformQuat(v: Vec3, q: Quat, dst?: Vec3): Vec3 { * @param dst - vector to hold result. If not passed a new one is created. * @returns The translation component of m. */ -export function getTranslation(m: Mat3, dst?: Vec3) { - dst = dst || new VecType(3); - dst[0] = m[12]; - dst[1] = m[13]; - dst[2] = m[14]; - return dst; +function getTranslation(m: Mat3Arg, dst?: T) { + const newDst = (dst ?? new Ctor(3)) as T; + newDst[0] = m[12]; + newDst[1] = m[13]; + newDst[2] = m[14]; + return newDst; } /** * Returns an axis of a 4x4 matrix as a vector with 3 entries @@ -758,21 +786,21 @@ export function getTranslation(m: Mat3, dst?: Vec3) { * @param axis - The axis 0 = x, 1 = y, 2 = z; * @returns The axis component of m. */ -export function getAxis(m: Mat4, axis: number, dst?: Vec3) { - dst = dst || new VecType(3); +function getAxis(m: Mat4Arg, axis: number, dst?: T) { + const newDst = (dst ?? new Ctor(3)) as T; const off = axis * 4; - dst[0] = m[off + 0]; - dst[1] = m[off + 1]; - dst[2] = m[off + 2]; - return dst; + newDst[0] = m[off + 0]; + newDst[1] = m[off + 1]; + newDst[2] = m[off + 2]; + return newDst; } /** * Returns the scaling component of the matrix * @param m - The Matrix * @param dst - The vector to set. If not passed a new one is created. */ -export function getScaling(m: Mat4, dst: Vec3) { - dst = dst || new VecType(3); +function getScaling(m: Mat4Arg, dst?: T) { + const newDst = (dst ?? new Ctor(3)) as T; const xx = m[0]; const xy = m[1]; const xz = m[2]; @@ -782,10 +810,10 @@ export function getScaling(m: Mat4, dst: Vec3) { const zx = m[8]; const zy = m[9]; const zz = m[10]; - dst[0] = Math.sqrt(xx * xx + xy * xy + xz * xz); - dst[1] = Math.sqrt(yx * yx + yy * yy + yz * yz); - dst[2] = Math.sqrt(zx * zx + zy * zy + zz * zz); - return dst; + newDst[0] = Math.sqrt(xx * xx + xy * xy + xz * xz); + newDst[1] = Math.sqrt(yx * yx + yy * yy + yz * yz); + newDst[2] = Math.sqrt(zx * zx + zy * zy + zz * zz); + return newDst; } /** @@ -797,8 +825,8 @@ export function getScaling(m: Mat4, dst: Vec3) { * @param dst - The vector to set. If not passed a new one is created. * @returns the rotated vector */ -export function rotateX(a: Vec3, b: Vec3, rad: number, dst?: Vec3) { - dst = dst || new VecType(3); +function rotateX(a: Vec3Arg, b: Vec3Arg, rad: number, dst?: T) { + const newDst = (dst ?? new Ctor(3)) as T; const p = []; const r = []; @@ -813,11 +841,11 @@ export function rotateX(a: Vec3, b: Vec3, rad: number, dst?: Vec3) { r[2] = p[1] * Math.sin(rad) + p[2] * Math.cos(rad); //translate to correct position - dst[0] = r[0] + b[0]; - dst[1] = r[1] + b[1]; - dst[2] = r[2] + b[2]; + newDst[0] = r[0] + b[0]; + newDst[1] = r[1] + b[1]; + newDst[2] = r[2] + b[2]; - return dst; + return newDst; } /** @@ -829,8 +857,8 @@ export function rotateX(a: Vec3, b: Vec3, rad: number, dst?: Vec3) { * @param dst - The vector to set. If not passed a new one is created. * @returns the rotated vector */ -export function rotateY(a: Vec3, b: Vec3, rad: number, dst?: Vec3) { - dst = dst || new VecType(3); +function rotateY(a: Vec3Arg, b: Vec3Arg, rad: number, dst?: T) { + const newDst = (dst ?? new Ctor(3)) as T; const p = []; const r = []; @@ -845,11 +873,11 @@ export function rotateY(a: Vec3, b: Vec3, rad: number, dst?: Vec3) { r[2] = p[2] * Math.cos(rad) - p[0] * Math.sin(rad); // translate to correct position - dst[0] = r[0] + b[0]; - dst[1] = r[1] + b[1]; - dst[2] = r[2] + b[2]; + newDst[0] = r[0] + b[0]; + newDst[1] = r[1] + b[1]; + newDst[2] = r[2] + b[2]; - return dst; + return newDst; } /** @@ -861,8 +889,8 @@ export function rotateY(a: Vec3, b: Vec3, rad: number, dst?: Vec3) { * @param dst - The vector to set. If not passed a new one is created. * @returns {vec3} out */ -export function rotateZ(a: Vec3, b: Vec3, rad: number, dst?: Vec3) { - dst = dst || new VecType(3); +function rotateZ(a: Vec3Arg, b: Vec3Arg, rad: number, dst?: T) { + const newDst = (dst ?? new Ctor(3)) as T; const p = []; const r = []; @@ -877,11 +905,11 @@ export function rotateZ(a: Vec3, b: Vec3, rad: number, dst?: Vec3) { r[2] = p[2]; // translate to correct position - dst[0] = r[0] + b[0]; - dst[1] = r[1] + b[1]; - dst[2] = r[2] + b[2]; + newDst[0] = r[0] + b[0]; + newDst[1] = r[1] + b[1]; + newDst[2] = r[2] + b[2]; - return dst; + return newDst; } /** @@ -891,10 +919,10 @@ export function rotateZ(a: Vec3, b: Vec3, rad: number, dst?: Vec3) { * @param len The length of the resulting vector * @returns The lengthened vector */ -export function setLength(a: Vec3, len: number, dst?: Vec3) { - dst = dst || new VecType(3); - normalize(a, dst); - return mulScalar(dst, len, dst); +function setLength(a: Vec3Arg, len: number, dst?: T) { + const newDst = (dst ?? new Ctor(3)) as T; + normalize(a, newDst); + return mulScalar(newDst, len, newDst); } /** @@ -904,14 +932,14 @@ export function setLength(a: Vec3, len: number, dst?: Vec3) { * @param maxLen The longest length of the resulting vector * @returns The vector, shortened to maxLen if it's too long */ -export function truncate(a: Vec3, maxLen: number, dst?: Vec3) { - dst = dst || new VecType(3); +function truncate(a: Vec3Arg, maxLen: number, dst?: T) { + const newDst = (dst ?? new Ctor(3)) as T; if (length(a) > maxLen) { - return setLength(a, maxLen, dst); + return setLength(a, maxLen, newDst); } - return copy(a, dst); + return copy(a, newDst); } /** @@ -921,7 +949,81 @@ export function truncate(a: Vec3, maxLen: number, dst?: Vec3) { * @param b Endpoint 2 * @returns The vector exactly residing between endpoints 1 and 2 */ -export function midpoint(a: Vec3, b: Vec3, dst?: Vec3) { - dst = dst || new VecType(3); - return lerp(a, b, 0.5, dst); +function midpoint(a: Vec3Arg, b: Vec3Arg, dst?: T) { + const newDst = (dst ?? new Ctor(3)) as T; + return lerp(a, b, 0.5, newDst); +} + +return { + create, + fromValues, + set, + ceil, + floor, + round, + clamp, + add, + addScaled, + angle, + subtract, + sub, + equalsApproximately, + equals, + lerp, + lerpV, + max, + min, + mulScalar, + scale, + divScalar, + inverse, + invert, + cross, + dot, + length, + len, + lengthSq, + lenSq, + distance, + dist, + distanceSq, + distSq, + normalize, + negate, + copy, + clone, + multiply, + mul, + divide, + div, + random, + zero, + transformMat4, + transformMat4Upper3x3, + transformMat3, + transformQuat, + getTranslation, + getAxis, + getScaling, + rotateX, + rotateY, + rotateZ, + setLength, + truncate, + midpoint, +}; + +} + +type API = ReturnType>; + +const cache = new Map(); + +export function getAPI(Ctor: Vec3Ctor) { + let api = cache.get(Ctor); + if (!api) { + api = getAPIImpl(Ctor); + cache.set(Ctor, api); + } + return api as API; } diff --git a/src/vec3.ts b/src/vec3.ts index 62fe04d..d5501d3 100644 --- a/src/vec3.ts +++ b/src/vec3.ts @@ -20,66 +20,14 @@ * DEALINGS IN THE SOFTWARE. */ -/** - * A JavaScript array with 3 values, Float32Array with 3 values, or a Float64Array with 3 values. - * When created by the library will create the default type which is `Float32Array` - * but can be set by calling {@link vec3.setDefaultType}. - */ -export type Vec3 = number[] | Float32Array | Float64Array; - -/** - * - * Vec3 math functions. - * - * Almost all functions take an optional `dst` argument. If it is not passed in the - * functions will create a new `Vec3`. In other words you can do this - * - * const v = vec3.cross(v1, v2); // Creates a new Vec3 with the cross product of v1 x v2. - * - * or - * - * const v = vec3.create(); - * vec3.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v - * - * The first style is often easier but depending on where it's used it generates garbage where - * as there is almost never allocation with the second style. - * - * It is always safe to pass any vector as the destination. So for example - * - * vec3.cross(v1, v2, v1); // Puts the cross product of v1 x v2 in v1 - * - */ - -export let VecType: new (n: number) => Vec3 = Float32Array; +import { BaseArgType } from "./types"; /** - * Sets the type this library creates for a Vec3 - * @param ctor - the constructor for the type. Either `Float32Array`, `Float64Array`, or `Array` - * @returns previous constructor for Vec3 + * A JavaScript array with 3 values, a Float32Array with 3 values, or a Float64Array with 3 values. */ -export function setDefaultType(ctor: new (n: number) => Vec3) { - const oldType = VecType; - VecType = ctor; - return oldType; -} +export type Vec3Arg = BaseArgType; /** - * Creates a vec3; may be called with x, y, z to set initial values. - * @param x - Initial x value. - * @param y - Initial y value. - * @param z - Initial z value. - * @returns the created vector + * A specific concrete 3 element vector. */ -export function create(x?: number, y?: number, z?: number): Vec3 { - const dst = new VecType(3); - if (x !== undefined) { - dst[0] = x; - if (y !== undefined) { - dst[1] = y; - if (z !== undefined) { - dst[2] = z; - } - } - } - return dst; -} \ No newline at end of file +export type Vec3Type = T; diff --git a/src/vec4-impl.ts b/src/vec4-impl.ts index c5c52c2..e6f6d48 100644 --- a/src/vec4-impl.ts +++ b/src/vec4-impl.ts @@ -20,11 +20,43 @@ * DEALINGS IN THE SOFTWARE. */ import * as utils from './utils.js'; -import { Vec4, create, setDefaultType, VecType } from './vec4'; -import { Mat4 } from './mat4'; +import { Vec4Arg, Vec4Type } from './vec4'; +import { Mat4Arg } from './mat4'; +import { BaseArgType } from './types'; -export default Vec4; -export { create, setDefaultType }; +export { Vec4Arg, Vec4Type }; + +type Vec4Ctor = new (n: number) => T; + +/** + * Generates am typed API for Vec4 + * */ +function getAPIImpl(Ctor: Vec4Ctor) { + +/** + * Creates a vec4; may be called with x, y, z to set initial values. + * @param x - Initial x value. + * @param y - Initial y value. + * @param z - Initial z value. + * @param w - Initial w value. + * @returns the created vector + */ +function create(x?: number, y?: number, z?: number, w?: number) { + const newDst = new Ctor(4); + if (x !== undefined) { + newDst[0] = x; + if (y !== undefined) { + newDst[1] = y; + if (z !== undefined) { + newDst[2] = z; + if (w !== undefined) { + newDst[3] = w; + } + } + } + } + return newDst; +} /** * Creates a vec4; may be called with x, y, z to set initial values. (same as create) @@ -34,7 +66,7 @@ export { create, setDefaultType }; * @param z - Initial w value. * @returns the created vector */ -export const fromValues = create; +const fromValues = create; /** * Sets the values of a Vec4 @@ -47,15 +79,15 @@ export const fromValues = create; * @param dst - vector to hold result. If not passed in a new one is created. * @returns A vector with its elements set. */ -export function set(x: number, y: number, z: number, w: number, dst?: Vec4) { - dst = dst || new VecType(4); +function set(x: number, y: number, z: number, w: number, dst?: T) { + const newDst = (dst ?? new Ctor(4)) as T; - dst[0] = x; - dst[1] = y; - dst[2] = z; - dst[3] = w; + newDst[0] = x; + newDst[1] = y; + newDst[2] = z; + newDst[3] = w; - return dst; + return newDst; } /** @@ -64,15 +96,15 @@ export function set(x: number, y: number, z: number, w: number, dst?: Vec4) { * @param dst - vector to hold result. If not passed in a new one is created. * @returns A vector that is the ceil of each element of v. */ -export function ceil(v: Vec4, dst?: Vec4): Vec4 { - dst = dst || new VecType(4); +function ceil(v: Vec4Arg, dst?: T) { + const newDst = (dst ?? new Ctor(4)) as T; - dst[0] = Math.ceil(v[0]); - dst[1] = Math.ceil(v[1]); - dst[2] = Math.ceil(v[2]); - dst[3] = Math.ceil(v[3]); + newDst[0] = Math.ceil(v[0]); + newDst[1] = Math.ceil(v[1]); + newDst[2] = Math.ceil(v[2]); + newDst[3] = Math.ceil(v[3]); - return dst; + return newDst; } /** @@ -81,15 +113,15 @@ export function ceil(v: Vec4, dst?: Vec4): Vec4 { * @param dst - vector to hold result. If not passed in a new one is created. * @returns A vector that is the floor of each element of v. */ -export function floor(v: Vec4, dst?: Vec4): Vec4 { - dst = dst || new VecType(4); +function floor(v: Vec4Arg, dst?: T) { + const newDst = (dst ?? new Ctor(4)) as T; - dst[0] = Math.floor(v[0]); - dst[1] = Math.floor(v[1]); - dst[2] = Math.floor(v[2]); - dst[3] = Math.floor(v[3]); + newDst[0] = Math.floor(v[0]); + newDst[1] = Math.floor(v[1]); + newDst[2] = Math.floor(v[2]); + newDst[3] = Math.floor(v[3]); - return dst; + return newDst; } /** @@ -98,15 +130,15 @@ export function floor(v: Vec4, dst?: Vec4): Vec4 { * @param dst - vector to hold result. If not passed in a new one is created. * @returns A vector that is the round of each element of v. */ -export function round(v: Vec4, dst?: Vec4): Vec4 { - dst = dst || new VecType(4); +function round(v: Vec4Arg, dst?: T) { + const newDst = (dst ?? new Ctor(4)) as T; - dst[0] = Math.round(v[0]); - dst[1] = Math.round(v[1]); - dst[2] = Math.round(v[2]); - dst[3] = Math.round(v[3]); + newDst[0] = Math.round(v[0]); + newDst[1] = Math.round(v[1]); + newDst[2] = Math.round(v[2]); + newDst[3] = Math.round(v[3]); - return dst; + return newDst; } /** @@ -117,15 +149,15 @@ export function round(v: Vec4, dst?: Vec4): Vec4 { * @param dst - vector to hold result. If not passed in a new one is created. * @returns A vector that the clamped value of each element of v. */ -export function clamp(v: Vec4, min = 0, max = 1, dst?: Vec4): Vec4 { - dst = dst || new VecType(4); +function clamp(v: Vec4Arg, min = 0, max = 1, dst?: T) { + const newDst = (dst ?? new Ctor(4)) as T; - dst[0] = Math.min(max, Math.max(min, v[0])); - dst[1] = Math.min(max, Math.max(min, v[1])); - dst[2] = Math.min(max, Math.max(min, v[2])); - dst[3] = Math.min(max, Math.max(min, v[3])); + newDst[0] = Math.min(max, Math.max(min, v[0])); + newDst[1] = Math.min(max, Math.max(min, v[1])); + newDst[2] = Math.min(max, Math.max(min, v[2])); + newDst[3] = Math.min(max, Math.max(min, v[3])); - return dst; + return newDst; } /** @@ -135,15 +167,15 @@ export function clamp(v: Vec4, min = 0, max = 1, dst?: Vec4): Vec4 { * @param dst - vector to hold result. If not passed in a new one is created. * @returns A vector that is the sum of a and b. */ -export function add(a: Vec4, b: Vec4, dst?: Vec4): Vec4 { - dst = dst || new VecType(4); +function add(a: Vec4Arg, b: Vec4Arg, dst?: T) { + const newDst = (dst ?? new Ctor(4)) as T; - dst[0] = a[0] + b[0]; - dst[1] = a[1] + b[1]; - dst[2] = a[2] + b[2]; - dst[3] = a[3] + b[3]; + newDst[0] = a[0] + b[0]; + newDst[1] = a[1] + b[1]; + newDst[2] = a[2] + b[2]; + newDst[3] = a[3] + b[3]; - return dst; + return newDst; } /** @@ -154,15 +186,15 @@ export function add(a: Vec4, b: Vec4, dst?: Vec4): Vec4 { * @param dst - vector to hold result. If not passed in a new one is created. * @returns A vector that is the sum of a + b * scale. */ -export function addScaled(a: Vec4, b: Vec4, scale: number, dst?: Vec4): Vec4 { - dst = dst || new VecType(4); +function addScaled(a: Vec4Arg, b: Vec4Arg, scale: number, dst?: T) { + const newDst = (dst ?? new Ctor(4)) as T; - dst[0] = a[0] + b[0] * scale; - dst[1] = a[1] + b[1] * scale; - dst[2] = a[2] + b[2] * scale; - dst[3] = a[3] + b[3] * scale; + newDst[0] = a[0] + b[0] * scale; + newDst[1] = a[1] + b[1] * scale; + newDst[2] = a[2] + b[2] * scale; + newDst[3] = a[3] + b[3] * scale; - return dst; + return newDst; } /** @@ -172,15 +204,15 @@ export function addScaled(a: Vec4, b: Vec4, scale: number, dst?: Vec4): Vec4 { * @param dst - vector to hold result. If not passed in a new one is created. * @returns A vector that is the difference of a and b. */ -export function subtract(a: Vec4, b: Vec4, dst?: Vec4): Vec4 { - dst = dst || new VecType(4); +function subtract(a: Vec4Arg, b: Vec4Arg, dst?: T) { + const newDst = (dst ?? new Ctor(4)) as T; - dst[0] = a[0] - b[0]; - dst[1] = a[1] - b[1]; - dst[2] = a[2] - b[2]; - dst[3] = a[3] - b[3]; + newDst[0] = a[0] - b[0]; + newDst[1] = a[1] - b[1]; + newDst[2] = a[2] - b[2]; + newDst[3] = a[3] - b[3]; - return dst; + return newDst; } /** @@ -190,7 +222,7 @@ export function subtract(a: Vec4, b: Vec4, dst?: Vec4): Vec4 { * @param dst - vector to hold result. If not passed in a new one is created. * @returns A vector that is the difference of a and b. */ -export const sub = subtract; +const sub = subtract; /** * Check if 2 vectors are approximately equal @@ -198,7 +230,7 @@ export const sub = subtract; * @param b - Operand vector. * @returns true if vectors are approximately equal */ -export function equalsApproximately(a: Vec4, b: Vec4): boolean { +function equalsApproximately(a: Vec4Arg, b: Vec4Arg): boolean { return Math.abs(a[0] - b[0]) < utils.EPSILON && Math.abs(a[1] - b[1]) < utils.EPSILON && Math.abs(a[2] - b[2]) < utils.EPSILON && @@ -211,7 +243,7 @@ export function equalsApproximately(a: Vec4, b: Vec4): boolean { * @param b - Operand vector. * @returns true if vectors are exactly equal */ -export function equals(a: Vec4, b: Vec4): boolean { +function equals(a: Vec4Arg, b: Vec4Arg): boolean { return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3]; } @@ -225,15 +257,15 @@ export function equals(a: Vec4, b: Vec4): boolean { * @param dst - vector to hold result. If not passed in a new one is created. * @returns The linear interpolated result. */ -export function lerp(a: Vec4, b: Vec4, t: number, dst?: Vec4): Vec4 { - dst = dst || new VecType(4); +function lerp(a: Vec4Arg, b: Vec4Arg, t: number, dst?: T) { + const newDst = (dst ?? new Ctor(4)) as T; - dst[0] = a[0] + t * (b[0] - a[0]); - dst[1] = a[1] + t * (b[1] - a[1]); - dst[2] = a[2] + t * (b[2] - a[2]); - dst[3] = a[3] + t * (b[3] - a[3]); + newDst[0] = a[0] + t * (b[0] - a[0]); + newDst[1] = a[1] + t * (b[1] - a[1]); + newDst[2] = a[2] + t * (b[2] - a[2]); + newDst[3] = a[3] + t * (b[3] - a[3]); - return dst; + return newDst; } /** @@ -246,15 +278,15 @@ export function lerp(a: Vec4, b: Vec4, t: number, dst?: Vec4): Vec4 { * @param dst - vector to hold result. If not passed in a new one is created. * @returns the linear interpolated result. */ -export function lerpV(a: Vec4, b: Vec4, t: Vec4, dst?: Vec4): Vec4 { - dst = dst || new VecType(4); +function lerpV(a: Vec4Arg, b: Vec4Arg, t: Vec4Arg, dst?: T) { + const newDst = (dst ?? new Ctor(4)) as T; - dst[0] = a[0] + t[0] * (b[0] - a[0]); - dst[1] = a[1] + t[1] * (b[1] - a[1]); - dst[2] = a[2] + t[2] * (b[2] - a[2]); - dst[3] = a[3] + t[3] * (b[3] - a[3]); + newDst[0] = a[0] + t[0] * (b[0] - a[0]); + newDst[1] = a[1] + t[1] * (b[1] - a[1]); + newDst[2] = a[2] + t[2] * (b[2] - a[2]); + newDst[3] = a[3] + t[3] * (b[3] - a[3]); - return dst; + return newDst; } /** @@ -266,15 +298,15 @@ export function lerpV(a: Vec4, b: Vec4, t: Vec4, dst?: Vec4): Vec4 { * @param dst - vector to hold result. If not passed in a new one is created. * @returns The max components vector. */ -export function max(a: Vec4, b: Vec4, dst?: Vec4): Vec4 { - dst = dst || new VecType(4); +function max(a: Vec4Arg, b: Vec4Arg, dst?: T) { + const newDst = (dst ?? new Ctor(4)) as T; - dst[0] = Math.max(a[0], b[0]); - dst[1] = Math.max(a[1], b[1]); - dst[2] = Math.max(a[2], b[2]); - dst[3] = Math.max(a[3], b[3]); + newDst[0] = Math.max(a[0], b[0]); + newDst[1] = Math.max(a[1], b[1]); + newDst[2] = Math.max(a[2], b[2]); + newDst[3] = Math.max(a[3], b[3]); - return dst; + return newDst; } /** @@ -286,15 +318,15 @@ export function max(a: Vec4, b: Vec4, dst?: Vec4): Vec4 { * @param dst - vector to hold result. If not passed in a new one is created. * @returns The min components vector. */ -export function min(a: Vec4, b: Vec4, dst?: Vec4): Vec4 { - dst = dst || new VecType(4); +function min(a: Vec4Arg, b: Vec4Arg, dst?: T) { + const newDst = (dst ?? new Ctor(4)) as T; - dst[0] = Math.min(a[0], b[0]); - dst[1] = Math.min(a[1], b[1]); - dst[2] = Math.min(a[2], b[2]); - dst[3] = Math.min(a[3], b[3]); + newDst[0] = Math.min(a[0], b[0]); + newDst[1] = Math.min(a[1], b[1]); + newDst[2] = Math.min(a[2], b[2]); + newDst[3] = Math.min(a[3], b[3]); - return dst; + return newDst; } /** @@ -304,15 +336,15 @@ export function min(a: Vec4, b: Vec4, dst?: Vec4): Vec4 { * @param dst - vector to hold result. If not passed in a new one is created. * @returns The scaled vector. */ -export function mulScalar(v: Vec4, k: number, dst?: Vec4): Vec4 { - dst = dst || new VecType(4); +function mulScalar(v: Vec4Arg, k: number, dst?: T) { + const newDst = (dst ?? new Ctor(4)) as T; - dst[0] = v[0] * k; - dst[1] = v[1] * k; - dst[2] = v[2] * k; - dst[3] = v[3] * k; + newDst[0] = v[0] * k; + newDst[1] = v[1] * k; + newDst[2] = v[2] * k; + newDst[3] = v[3] * k; - return dst; + return newDst; } /** @@ -322,7 +354,7 @@ export function mulScalar(v: Vec4, k: number, dst?: Vec4): Vec4 { * @param dst - vector to hold result. If not passed in a new one is created. * @returns The scaled vector. */ -export const scale = mulScalar; +const scale = mulScalar; /** * Divides a vector by a scalar. @@ -331,15 +363,15 @@ export const scale = mulScalar; * @param dst - vector to hold result. If not passed in a new one is created. * @returns The scaled vector. */ -export function divScalar(v: Vec4, k: number, dst?: Vec4): Vec4 { - dst = dst || new VecType(4); +function divScalar(v: Vec4Arg, k: number, dst?: T) { + const newDst = (dst ?? new Ctor(4)) as T; - dst[0] = v[0] / k; - dst[1] = v[1] / k; - dst[2] = v[2] / k; - dst[3] = v[3] / k; + newDst[0] = v[0] / k; + newDst[1] = v[1] / k; + newDst[2] = v[2] / k; + newDst[3] = v[3] / k; - return dst; + return newDst; } /** @@ -348,15 +380,15 @@ export function divScalar(v: Vec4, k: number, dst?: Vec4): Vec4 { * @param dst - vector to hold result. If not passed in a new one is created. * @returns The inverted vector. */ -export function inverse(v: Vec4, dst?: Vec4): Vec4 { - dst = dst || new VecType(4); +function inverse(v: Vec4Arg, dst?: T) { + const newDst = (dst ?? new Ctor(4)) as T; - dst[0] = 1 / v[0]; - dst[1] = 1 / v[1]; - dst[2] = 1 / v[2]; - dst[3] = 1 / v[3]; + newDst[0] = 1 / v[0]; + newDst[1] = 1 / v[1]; + newDst[2] = 1 / v[2]; + newDst[3] = 1 / v[3]; - return dst; + return newDst; } /** @@ -365,7 +397,7 @@ export function inverse(v: Vec4, dst?: Vec4): Vec4 { * @param dst - vector to hold result. If not passed in a new one is created. * @returns The inverted vector. */ -export const invert = inverse; +const invert = inverse; /** * Computes the dot product of two vectors @@ -373,7 +405,7 @@ export const invert = inverse; * @param b - Operand vector. * @returns dot product */ -export function dot(a: Vec4, b: Vec4): number { +function dot(a: Vec4Arg, b: Vec4Arg): number { return (a[0] * b[0]) + (a[1] * b[1]) + (a[2] * b[2]) + (a[3] * b[3]); } @@ -382,7 +414,7 @@ export function dot(a: Vec4, b: Vec4): number { * @param v - vector. * @returns length of vector. */ -export function length(v: Vec4): number { +function length(v: Vec4Arg): number { const v0 = v[0]; const v1 = v[1]; const v2 = v[2]; @@ -395,14 +427,14 @@ export function length(v: Vec4): number { * @param v - vector. * @returns length of vector. */ -export const len = length; +const len = length; /** * Computes the square of the length of vector * @param v - vector. * @returns square of the length of vector. */ -export function lengthSq(v: Vec4): number { +function lengthSq(v: Vec4Arg): number { const v0 = v[0]; const v1 = v[1]; const v2 = v[2]; @@ -415,7 +447,7 @@ export function lengthSq(v: Vec4): number { * @param v - vector. * @returns square of the length of vector. */ -export const lenSq = lengthSq; +const lenSq = lengthSq; /** * Computes the distance between 2 points @@ -423,7 +455,7 @@ export const lenSq = lengthSq; * @param b - vector. * @returns distance between a and b */ -export function distance(a: Vec4, b: Vec4): number { +function distance(a: Vec4Arg, b: Vec4Arg): number { const dx = a[0] - b[0]; const dy = a[1] - b[1]; const dz = a[2] - b[2]; @@ -437,7 +469,7 @@ export function distance(a: Vec4, b: Vec4): number { * @param b - vector. * @returns distance between a and b */ -export const dist = distance; +const dist = distance; /** * Computes the square of the distance between 2 points @@ -445,7 +477,7 @@ export const dist = distance; * @param b - vector. * @returns square of the distance between a and b */ -export function distanceSq(a: Vec4, b: Vec4): number { +function distanceSq(a: Vec4Arg, b: Vec4Arg): number { const dx = a[0] - b[0]; const dy = a[1] - b[1]; const dz = a[2] - b[2]; @@ -459,7 +491,7 @@ export function distanceSq(a: Vec4, b: Vec4): number { * @param b - vector. * @returns square of the distance between a and b */ -export const distSq = distanceSq; +const distSq = distanceSq; /** * Divides a vector by its Euclidean length and returns the quotient. @@ -467,8 +499,8 @@ export const distSq = distanceSq; * @param dst - vector to hold result. If not passed in a new one is created. * @returns The normalized vector. */ -export function normalize(v: Vec4, dst?: Vec4): Vec4 { - dst = dst || new VecType(4); +function normalize(v: Vec4Arg, dst?: T) { + const newDst = (dst ?? new Ctor(4)) as T; const v0 = v[0]; const v1 = v[1]; @@ -477,18 +509,18 @@ export function normalize(v: Vec4, dst?: Vec4): Vec4 { const len = Math.sqrt(v0 * v0 + v1 * v1 + v2 * v2 + v3 * v3); if (len > 0.00001) { - dst[0] = v0 / len; - dst[1] = v1 / len; - dst[2] = v2 / len; - dst[3] = v3 / len; + newDst[0] = v0 / len; + newDst[1] = v1 / len; + newDst[2] = v2 / len; + newDst[3] = v3 / len; } else { - dst[0] = 0; - dst[1] = 0; - dst[2] = 0; - dst[3] = 0; + newDst[0] = 0; + newDst[1] = 0; + newDst[2] = 0; + newDst[3] = 0; } - return dst; + return newDst; } /** @@ -497,15 +529,15 @@ export function normalize(v: Vec4, dst?: Vec4): Vec4 { * @param dst - vector to hold result. If not passed in a new one is created. * @returns -v. */ -export function negate(v: Vec4, dst?: Vec4): Vec4 { - dst = dst || new VecType(4); +function negate(v: Vec4Arg, dst?: T) { + const newDst = (dst ?? new Ctor(4)) as T; - dst[0] = -v[0]; - dst[1] = -v[1]; - dst[2] = -v[2]; - dst[3] = -v[3]; + newDst[0] = -v[0]; + newDst[1] = -v[1]; + newDst[2] = -v[2]; + newDst[3] = -v[3]; - return dst; + return newDst; } /** @@ -515,15 +547,15 @@ export function negate(v: Vec4, dst?: Vec4): Vec4 { * @param dst - vector to hold result. If not passed in a new one is created. * @returns A copy of v. */ -export function copy(v: Vec4, dst?: Vec4): Vec4 { - dst = dst || new VecType(4); +function copy(v: Vec4Arg, dst?: T) { + const newDst = (dst ?? new Ctor(4)) as T; - dst[0] = v[0]; - dst[1] = v[1]; - dst[2] = v[2]; - dst[3] = v[3]; + newDst[0] = v[0]; + newDst[1] = v[1]; + newDst[2] = v[2]; + newDst[3] = v[3]; - return dst; + return newDst; } /** @@ -533,7 +565,7 @@ export function copy(v: Vec4, dst?: Vec4): Vec4 { * @param dst - vector to hold result. If not passed in a new one is created. * @returns A copy of v. */ -export const clone = copy; +const clone = copy; /** * Multiplies a vector by another vector (component-wise); assumes a and @@ -543,15 +575,15 @@ export const clone = copy; * @param dst - vector to hold result. If not passed in a new one is created. * @returns The vector of products of entries of a and b. */ -export function multiply(a: Vec4, b: Vec4, dst?: Vec4): Vec4 { - dst = dst || new VecType(4); +function multiply(a: Vec4Arg, b: Vec4Arg, dst?: T) { + const newDst = (dst ?? new Ctor(4)) as T; - dst[0] = a[0] * b[0]; - dst[1] = a[1] * b[1]; - dst[2] = a[2] * b[2]; - dst[3] = a[3] * b[3]; + newDst[0] = a[0] * b[0]; + newDst[1] = a[1] * b[1]; + newDst[2] = a[2] * b[2]; + newDst[3] = a[3] * b[3]; - return dst; + return newDst; } /** @@ -562,7 +594,7 @@ export function multiply(a: Vec4, b: Vec4, dst?: Vec4): Vec4 { * @param dst - vector to hold result. If not passed in a new one is created. * @returns The vector of products of entries of a and b. */ -export const mul = multiply; +const mul = multiply; /** * Divides a vector by another vector (component-wise); assumes a and @@ -572,15 +604,15 @@ export const mul = multiply; * @param dst - vector to hold result. If not passed in a new one is created. * @returns The vector of quotients of entries of a and b. */ -export function divide(a: Vec4, b: Vec4, dst?: Vec4) { - dst = dst || new VecType(4); +function divide(a: Vec4Arg, b: Vec4Arg, dst?: T) { + const newDst = (dst ?? new Ctor(4)) as T; - dst[0] = a[0] / b[0]; - dst[1] = a[1] / b[1]; - dst[2] = a[2] / b[2]; - dst[3] = a[3] / b[3]; + newDst[0] = a[0] / b[0]; + newDst[1] = a[1] / b[1]; + newDst[2] = a[2] / b[2]; + newDst[3] = a[3] / b[3]; - return dst; + return newDst; } /** @@ -591,22 +623,22 @@ export function divide(a: Vec4, b: Vec4, dst?: Vec4) { * @param dst - vector to hold result. If not passed in a new one is created. * @returns The vector of quotients of entries of a and b. */ -export const div = divide; +const div = divide; /** * Zero's a vector * @param dst - vector to hold result. If not passed in a new one is created. * @returns The zeroed vector. */ -export function zero(dst?: Vec4): Vec4 { - dst = dst || new VecType(4); +function zero(dst?: T) { + const newDst = (dst ?? new Ctor(4)) as T; - dst[0] = 0; - dst[1] = 0; - dst[2] = 0; - dst[3] = 0; + newDst[0] = 0; + newDst[1] = 0; + newDst[2] = 0; + newDst[3] = 0; - return dst; + return newDst; } @@ -617,20 +649,20 @@ export function zero(dst?: Vec4): Vec4 { * @param dst - optional vec4 to store result. If not passed a new one is created. * @returns the transformed vector */ -export function transformMat4(v: Vec4, m: Mat4, dst?: Vec4): Vec4 { - dst = dst || new VecType(4); +function transformMat4(v: Vec4Arg, m: Mat4Arg, dst?: T) { + const newDst = (dst ?? new Ctor(4)) as T; const x = v[0]; const y = v[1]; const z = v[2]; const w = v[3]; - dst[0] = m[0] * x + m[4] * y + m[ 8] * z + m[12] * w; - dst[1] = m[1] * x + m[5] * y + m[ 9] * z + m[13] * w; - dst[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w; - dst[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w; + newDst[0] = m[0] * x + m[4] * y + m[ 8] * z + m[12] * w; + newDst[1] = m[1] * x + m[5] * y + m[ 9] * z + m[13] * w; + newDst[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w; + newDst[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w; - return dst; + return newDst; } @@ -641,10 +673,10 @@ export function transformMat4(v: Vec4, m: Mat4, dst?: Vec4): Vec4 { * @param len The length of the resulting vector * @returns The lengthened vector */ -export function setLength(a: Vec4, len: number, dst?: Vec4) { - dst = dst || new VecType(4); - normalize(a, dst); - return mulScalar(dst, len, dst); +function setLength(a: Vec4Arg, len: number, dst?: T) { + const newDst = (dst ?? new Ctor(4)) as T; + normalize(a, newDst); + return mulScalar(newDst, len, newDst); } /** @@ -654,14 +686,14 @@ export function setLength(a: Vec4, len: number, dst?: Vec4) { * @param maxLen The longest length of the resulting vector * @returns The vector, shortened to maxLen if it's too long */ -export function truncate(a: Vec4, maxLen: number, dst?: Vec4) { - dst = dst || new VecType(4); +function truncate(a: Vec4Arg, maxLen: number, dst?: T) { + const newDst = (dst ?? new Ctor(4)) as T; if (length(a) > maxLen) { - return setLength(a, maxLen, dst); + return setLength(a, maxLen, newDst); } - return copy(a, dst); + return copy(a, newDst); } /** @@ -671,7 +703,91 @@ export function truncate(a: Vec4, maxLen: number, dst?: Vec4) { * @param b Endpoint 2 * @returns The vector exactly residing between endpoints 1 and 2 */ -export function midpoint(a: Vec4, b: Vec4, dst?: Vec4) { - dst = dst || new VecType(4); - return lerp(a, b, 0.5, dst); +function midpoint(a: Vec4Arg, b: Vec4Arg, dst?: T) { + const newDst = (dst ?? new Ctor(4)) as T; + return lerp(a, b, 0.5, newDst); +} + +return { + create, + fromValues, + set, + ceil, + floor, + round, + clamp, + add, + addScaled, + subtract, + sub, + equalsApproximately, + equals, + lerp, + lerpV, + max, + min, + mulScalar, + scale, + divScalar, + inverse, + invert, + dot, + length, + len, + lengthSq, + lenSq, + distance, + dist, + distanceSq, + distSq, + normalize, + negate, + copy, + clone, + multiply, + mul, + divide, + div, + zero, + transformMat4, + setLength, + truncate, + midpoint, +}; +} + +type API = ReturnType>; + +const cache = new Map(); + +/** + * + * Vec4 math functions. + * + * Almost all functions take an optional `newDst` argument. If it is not passed in the + * functions will create a new `Vec4`. In other words you can do this + * + * const v = vec4.cross(v1, v2); // Creates a new Vec4 with the cross product of v1 x v2. + * + * or + * + * const v = vec4.create(); + * vec4.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v + * + * The first style is often easier but depending on where it's used it generates garbage where + * as there is almost never allocation with the second style. + * + * It is always safe to pass any vector as the destination. So for example + * + * vec4.cross(v1, v2, v1); // Puts the cross product of v1 x v2 in v1 + * + */ +export function getAPI(Ctor: Vec4Ctor) { + let api = cache.get(Ctor); + if (!api) { + api = getAPIImpl(Ctor); + cache.set(Ctor, api); + } + return api as API; } + diff --git a/src/vec4.ts b/src/vec4.ts index 77c47b0..2fad69a 100644 --- a/src/vec4.ts +++ b/src/vec4.ts @@ -20,70 +20,14 @@ * DEALINGS IN THE SOFTWARE. */ -/** - * A JavaScript array with 4 values, Float32Array with 4 values, or a Float64Array with 4 values. - * When created by the library will create the default type which is `Float32Array` - * but can be set by calling {@link vec4.setDefaultType}. - */ -export type Vec4 = number[] | Float32Array | Float64Array; - -/** - * - * Vec4 math functions. - * - * Almost all functions take an optional `dst` argument. If it is not passed in the - * functions will create a new `Vec4`. In other words you can do this - * - * const v = vec4.cross(v1, v2); // Creates a new Vec4 with the cross product of v1 x v2. - * - * or - * - * const v = vec4.create(); - * vec4.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v - * - * The first style is often easier but depending on where it's used it generates garbage where - * as there is almost never allocation with the second style. - * - * It is always safe to pass any vector as the destination. So for example - * - * vec4.cross(v1, v2, v1); // Puts the cross product of v1 x v2 in v1 - * - */ - -export let VecType: new (n: number) => Vec4 = Float32Array; +import { BaseArgType } from "./types"; /** - * Sets the type this library creates for a Vec4 - * @param ctor - the constructor for the type. Either `Float32Array`, `Float64Array`, or `Array` - * @returns previous constructor for Vec4 + * A JavaScript array with 4 values, a Float32Array with 4 values, or a Float64Array with 4 values. */ -export function setDefaultType(ctor: new (n: number) => Vec4) { - const oldType = VecType; - VecType = ctor; - return oldType; -} +export type Vec4Arg = BaseArgType; /** - * Creates a vec4; may be called with x, y, z to set initial values. - * @param x - Initial x value. - * @param y - Initial y value. - * @param z - Initial z value. - * @param w - Initial w value. - * @returns the created vector + * A specific concrete 4 element vector. */ -export function create(x?: number, y?: number, z?: number, w?: number): Vec4 { - const dst = new VecType(4); - if (x !== undefined) { - dst[0] = x; - if (y !== undefined) { - dst[1] = y; - if (z !== undefined) { - dst[2] = z; - if (w !== undefined) { - dst[3] = w; - } - } - } - } - return dst; -} \ No newline at end of file +export type Vec4Type = T; diff --git a/src/wgpu-matrix.ts b/src/wgpu-matrix.ts index c9687f5..9bc0826 100644 --- a/src/wgpu-matrix.ts +++ b/src/wgpu-matrix.ts @@ -1,43 +1,137 @@ -import Mat3, * as mat3 from './mat3-impl'; -import Mat4, * as mat4 from './mat4-impl'; -import Quat, * as quat from './quat-impl'; -import Vec2, * as vec2 from './vec2-impl'; -import Vec3, * as vec3 from './vec3-impl'; -import Vec4, * as vec4 from './vec4-impl'; +import {BaseArgType, ZeroArray} from './types'; +import {Mat3Arg, Mat3Type, getAPI as getMat3API} from './mat3-impl'; +import {Mat4Arg, Mat4Type, getAPI as getMat4API} from './mat4-impl'; +import {QuatArg, QuatType, getAPI as getQuatAPI, RotationOrder} from './quat-impl'; +import {Vec2Arg, Vec2Type, getAPI as getVec2API} from './vec2-impl'; +import {Vec3Arg, Vec3Type, getAPI as getVec3API} from './vec3-impl'; +import {Vec4Arg, Vec4Type, getAPI as getVec4API} from './vec4-impl'; import * as utils from './utils'; +export { + RotationOrder, + utils, + + BaseArgType, + + Mat3Arg, + Mat4Arg, + QuatArg, + Vec2Arg, + Vec3Arg, + Vec4Arg, + + Mat3Type, + Mat4Type, + QuatType, + Vec2Type, + Vec3Type, + Vec4Type, +}; + +export type BaseCtor = new (n: number) => T; + +export type Mat3 = Mat3Type; +export type Mat4 = Mat4Type; +export type Quat = QuatType; +export type Vec2 = Vec2Type; +export type Vec3 = Vec3Type; +export type Vec4 = Vec4Type; + +export type Mat3d = Mat3Type; +export type Mat4d = Mat4Type; +export type Quatd = QuatType; +export type Vec2d = Vec2Type; +export type Vec3d = Vec3Type; +export type Vec4d = Vec4Type; + +export type Mat3n = Mat3Type; +export type Mat4n = Mat4Type; +export type Quatn = QuatType; +export type Vec2n = Vec2Type; +export type Vec3n = Vec3Type; +export type Vec4n = Vec4Type; + /** - * Sets the type this library creates for all types - * - * example: - * - * ``` - * setDefaultType(Float64Array); - * ``` - * - * @param ctor - the constructor for the type. Either `Float32Array`, `Float64Array`, or `Array` + * Generate wgpu-matrix API for type */ -export function setDefaultType(ctor: new (n: number) => Float32Array | Float64Array | number[]) { - mat3.setDefaultType(ctor); - mat4.setDefaultType(ctor); - quat.setDefaultType(ctor); - vec2.setDefaultType(ctor); - vec3.setDefaultType(ctor); - vec4.setDefaultType(ctor); +function wgpuMatrixAPI< + Mat3 extends BaseArgType, + Mat4 extends BaseArgType, + Quat extends BaseArgType, + Vec2 extends BaseArgType, + Vec3 extends BaseArgType, + Vec4 extends BaseArgType, +>( + Mat3Ctor: BaseCtor, + Mat4Ctor: BaseCtor, + QuatCtor: BaseCtor, + Vec2Ctor: BaseCtor, + Vec3Ctor: BaseCtor, + Vec4Ctor: BaseCtor, +) { + return { + /** @namespace mat4 */ + mat4: getMat4API(Mat3Ctor), + /** @namespace mat3 */ + mat3: getMat3API(Mat4Ctor), + /** @namespace quat */ + quat: getQuatAPI(QuatCtor), + /** @namespace vec2 */ + vec2: getVec2API(Vec2Ctor), + /** @namespace vec3 */ + vec3: getVec3API(Vec3Ctor), + /** @namespace vec4 */ + vec4: getVec4API(Vec4Ctor), + }; } -export { - Mat3, - mat3, - Mat4, +export const { + /** @namespace */ mat4, - Quat, + /** @namespace */ + mat3, + /** @namespace */ quat, - utils, - Vec2, + /** @namespace */ vec2, - Vec3, + /** @namespace */ vec3, - Vec4, + /** @namespace */ vec4, -}; \ No newline at end of file +} = wgpuMatrixAPI< + Mat3, Mat4, Quat, Vec2, Vec3, Vec4>( + Float32Array, Float32Array, Float32Array, Float32Array, Float32Array, Float32Array); + +export const { + /** @namespace */ + mat4: mat4d, + /** @namespace */ + mat3: mat3d, + /** @namespace */ + quat: quatd, + /** @namespace */ + vec2: vec2d, + /** @namespace */ + vec3: vec3d, + /** @namespace */ + vec4: vec4d, +} = wgpuMatrixAPI< + Mat3d, Mat4d, Quatd, Vec2d, Vec3d, Vec4d>( + Float64Array, Float64Array, Float64Array, Float64Array, Float64Array, Float64Array); + +export const { + /** @namespace */ + mat4: mat4n, + /** @namespace */ + mat3: mat3n, + /** @namespace */ + quat: quatn, + /** @namespace */ + vec2: vec2n, + /** @namespace */ + vec3: vec3n, + /** @namespace */ + vec4: vec4n, +} = wgpuMatrixAPI< + Mat3n, Mat4n, Quatn, Vec2n, Vec3n, Vec4n>( + ZeroArray, Array, Array, Array, Array, Array); diff --git a/test/tests/mat3-test.js b/test/tests/mat3-test.js index 49f8ada..0a37afb 100644 --- a/test/tests/mat3-test.js +++ b/test/tests/mat3-test.js @@ -1,15 +1,13 @@ -import {mat3, mat4, quat, utils} from '../../dist/2.x/wgpu-matrix.module.js'; +import {mat3, mat3d, mat3n, mat4, quat, utils} from '../../dist/3.x/wgpu-matrix.module.js'; import { assertEqual, assertFalsy, - assertIsArray, - assertInstanceOf, assertStrictEqual, assertStrictNotEqual, assertTruthy, } from '../assert.js'; -import {describe, it, before} from '../mocha-support.js'; +import {describe, it} from '../mocha-support.js'; function assertMat3Equal(a, b) { if (!mat3.equals(a, b)) { @@ -31,10 +29,6 @@ function check(Type) { 8, 9, 10, 0, ]; - before(function () { - mat3.setDefaultType(Type); - }); - function testM3WithoutDest(func, expected, ...args) { const d = func(...args); assertMat3EqualApproximately(d, expected); @@ -100,15 +94,15 @@ function check(Type) { -4, -5, -6, -7, -8, -9, -10, -11, ]; - testMat3WithAndWithoutDest((dst) => { - return mat3.negate(m, dst); + testMat3WithAndWithoutDest((newDst) => { + return mat3.negate(m, newDst); }, expected); }); it('should copy', () => { const expected = m; - testMat3WithAndWithoutDest((dst) => { - const result = mat3.copy(m, dst); + testMat3WithAndWithoutDest((newDst) => { + const result = mat3.copy(m, newDst); assertStrictNotEqual(result, m); return result; }, expected); @@ -146,8 +140,8 @@ function check(Type) { it('should clone', () => { const expected = m; - testMat3WithAndWithoutDest((dst) => { - const result = mat3.clone(m, dst); + testMat3WithAndWithoutDest((newDst) => { + const result = mat3.clone(m, newDst); assertStrictNotEqual(result, m); return result; }, expected); @@ -155,8 +149,8 @@ function check(Type) { it('should set', () => { const expected = [2, 3, 4, 0, 22, 33, 44, 0, 222, 333, 444, 0]; - testMat3WithAndWithoutDest((v0, v1, v2, v3, v4, v5, v6, v7, v8, dst) => { - return mat3.set(v0, v1, v2, v3, v4, v5, v6, v7, v8, dst); + testMat3WithAndWithoutDest((v0, v1, v2, v3, v4, v5, v6, v7, v8, newDst) => { + return mat3.set(v0, v1, v2, v3, v4, v5, v6, v7, v8, newDst); }, expected, 2, 3, 4, 22, 33, 44, 222, 333, 444); }); @@ -167,8 +161,8 @@ function check(Type) { 0, 0, 1, 0, 0, 0, 0, 1, ]; - testMat3WithAndWithoutDest((dst) => { - return mat3.identity(dst); + testMat3WithAndWithoutDest((newDst) => { + return mat3.identity(newDst); }, expected); }); @@ -179,8 +173,8 @@ function check(Type) { 2, 6, 10, 14, 3, 7, 11, 15, ]; - testMat3WithAndWithoutDest((dst) => { - return mat3.transpose(m, dst); + testMat3WithAndWithoutDest((newDst) => { + return mat3.transpose(m, newDst); }, expected); }); @@ -204,8 +198,8 @@ function check(Type) { m2[2 * 4 + 0] * m[0 * 4 + 2] + m2[2 * 4 + 1] * m[1 * 4 + 2] + m2[2 * 4 + 2] * m[2 * 4 + 2], m2[2 * 4 + 0] * m[0 * 4 + 3] + m2[2 * 4 + 1] * m[1 * 4 + 3] + m2[2 * 4 + 2] * m[2 * 4 + 3], ]; - testMat3WithAndWithoutDest((dst) => { - return fn(m, m2, dst); + testMat3WithAndWithoutDest((newDst) => { + return fn(m, m2, newDst); }, expected); } @@ -258,8 +252,8 @@ function check(Type) { }, ]; for (const {m, expected} of tests) { - testMat3WithAndWithoutDest((dst) => { - return fn(m, dst); + testMat3WithAndWithoutDest((newDst) => { + return fn(m, newDst); }, expected); } } @@ -312,15 +306,15 @@ function check(Type) { 4, 5, 6, 0, 11, 22, 1, 1, ]; - testMat3WithAndWithoutDest((dst) => { - return mat3.setTranslation(m, [11, 22], dst); + testMat3WithAndWithoutDest((newDst) => { + return mat3.setTranslation(m, [11, 22], newDst); }, expected); }); it('should get translation', () => { const expected = [8, 9]; - testV2WithAndWithoutDest((dst) => { - return mat3.getTranslation(m, dst); + testV2WithAndWithoutDest((newDst) => { + return mat3.getTranslation(m, newDst); }, expected); }); @@ -329,8 +323,8 @@ function check(Type) { [0, 1], [4, 5], ].forEach((expected, ndx) => { - testV2WithAndWithoutDest((dst) => { - return mat3.getAxis(m, ndx, dst); + testV2WithAndWithoutDest((newDst) => { + return mat3.getAxis(m, ndx, newDst); }, expected); }); }); @@ -348,8 +342,8 @@ function check(Type) { 8, 9, 10, 0, ], ].forEach((expected, ndx) => { - testMat3WithAndWithoutDest((dst) => { - return mat3.setAxis(m, [11, 22], ndx, dst); + testMat3WithAndWithoutDest((newDst) => { + return mat3.setAxis(m, [11, 22], ndx, newDst); }, expected); }); }); @@ -364,8 +358,8 @@ function check(Type) { Math.sqrt(1 * 1 + 2 * 2), Math.sqrt(5 * 5 + 6 * 6), ]; - testV2WithAndWithoutDest((dst) => { - return mat3.getScaling(m, dst); + testV2WithAndWithoutDest((newDst) => { + return mat3.getScaling(m, newDst); }, expected); }); @@ -375,8 +369,8 @@ function check(Type) { 0, 1, 0, 0, 2, 3, 1, 0, ]; - testMat3WithAndWithoutDest((dst) => { - return mat3.translation([2, 3], dst); + testMat3WithAndWithoutDest((newDst) => { + return mat3.translation([2, 3], newDst); }, expected); }); @@ -388,8 +382,8 @@ function check(Type) { 9 + 1 * 2 + 5 * 3, 10 + 2 * 2 + 6 * 3, 0, ]; - testMat3WithAndWithoutDest((dst) => { - return mat3.translate(m, [2, 3], dst); + testMat3WithAndWithoutDest((newDst) => { + return mat3.translate(m, [2, 3], newDst); }, expected); }); @@ -402,20 +396,18 @@ function check(Type) { -s, c, 0, 0, 0, 0, 1, 0, ]; - testMat3WithAndWithoutDest((dst) => { - return mat3.rotation(angle, dst); + testMat3WithAndWithoutDest((newDst) => { + return mat3.rotation(angle, newDst); }, expected); }); it('should rotate', () => { const angle = 1.23; // switch to Array type to keep precision high for expected - const oldType = mat3.setDefaultType(Array); - const expected = mat3.multiply(m, mat3.rotation(angle)); - mat3.setDefaultType(oldType); + const expected = mat3n.multiply(m, mat3.rotation(angle)); - testMat3WithAndWithoutDest((dst) => { - return mat3.rotate(m, angle, dst); + testMat3WithAndWithoutDest((newDst) => { + return mat3.rotate(m, angle, newDst); }, expected); }); @@ -425,8 +417,8 @@ function check(Type) { 0, 3, 0, 0, 0, 0, 1, 0, ]; - testMat3WithAndWithoutDest((dst) => { - return mat3.scaling([2, 3], dst); + testMat3WithAndWithoutDest((newDst) => { + return mat3.scaling([2, 3], newDst); }, expected); }); @@ -436,8 +428,8 @@ function check(Type) { 12, 15, 18, 0, 8, 9, 10, 0, ]; - testMat3WithAndWithoutDest((dst) => { - return mat3.scale(m, [2, 3], dst); + testMat3WithAndWithoutDest((newDst) => { + return mat3.scale(m, [2, 3], newDst); }, expected); }); @@ -447,8 +439,8 @@ function check(Type) { 0, 2, 0, 0, 0, 0, 1, 0, ]; - testMat3WithAndWithoutDest((dst) => { - return mat3.uniformScaling(2, dst); + testMat3WithAndWithoutDest((newDst) => { + return mat3.uniformScaling(2, newDst); }, expected); }); @@ -458,8 +450,8 @@ function check(Type) { 8, 10, 12, 0, 8, 9, 10, 0, ]; - testMat3WithAndWithoutDest((dst) => { - return mat3.uniformScale(m, 2, dst); + testMat3WithAndWithoutDest((newDst) => { + return mat3.uniformScale(m, 2, newDst); }, expected); }); @@ -469,13 +461,13 @@ function check(Type) { 5, 6, 7, 0, 9, 10, 11, 0, ]; - testMat3WithAndWithoutDest((dst) => { + testMat3WithAndWithoutDest((newDst) => { const m4 = mat4.create( 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); - return mat3.fromMat4(m4, dst); + return mat3.fromMat4(m4, newDst); }, expected); }); @@ -489,8 +481,8 @@ function check(Type) { { q: quat.fromEuler(0, 0, Math.PI / 2, 'xyz'), expected: mat3.fromMat4(mat4.rotationZ(Math.PI / 2)), }, ]; for (const {q, expected} of tests) { - testMat3WithAndWithoutDest((dst) => { - return mat3.fromQuat(q, dst); + testMat3WithAndWithoutDest((newDst) => { + return mat3.fromQuat(q, newDst); }, expected); } }); @@ -499,18 +491,8 @@ function check(Type) { } describe('mat3', () => { - - it('should set default type', () => { - mat3.setDefaultType(Array); - let d = mat3.identity(); - assertIsArray(d); - mat3.setDefaultType(Float32Array); - d = mat3.identity(); - assertInstanceOf(d, Float32Array); - }); - - check(Array); - check(Float32Array); - check(Float64Array); + check(mat3n); + check(mat3); + check(mat3d); }); diff --git a/test/tests/mat4-test.js b/test/tests/mat4-test.js index 58f7050..8707b04 100644 --- a/test/tests/mat4-test.js +++ b/test/tests/mat4-test.js @@ -1,18 +1,18 @@ -import {mat4, mat3, quat, utils, vec3} from '../../dist/2.x/wgpu-matrix.module.js'; +import {mat4, mat4d, mat4n, mat3, quat, utils, vec3} from '../../dist/3.x/wgpu-matrix.module.js'; import { assertEqual, assertEqualApproximately, assertFalsy, - assertIsArray, - assertInstanceOf, assertStrictEqual, assertStrictNotEqual, assertTruthy, } from '../assert.js'; -import {describe, it, before} from '../mocha-support.js'; +import {describe, it} from '../mocha-support.js'; + + +function check(mat4, Type) { -function check(Type) { describe('using ' + Type, () => { const m = [ 0, 1, 2, 3, @@ -21,10 +21,6 @@ function check(Type) { 12, 13, 14, 15, ]; - before(function () { - mat4.setDefaultType(Type); - }); - function testMat4WithoutDest(func, expected, ...args) { const d = func(...args); assertEqualApproximately(d, expected); @@ -39,8 +35,8 @@ function check(Type) { } function testMat4WithAndWithoutDest(func, expected, ...args) { - if (Type === Float32Array) { - expected = new Float32Array(expected); + if (mat4.identity() instanceof Float32Array) { + //expected = new Float32Array(expected); } testMat4WithoutDest(func, expected, ...args); testMat4WithDest(func, expected, ...args); @@ -48,14 +44,14 @@ function check(Type) { function testVec3WithoutDest(func, expected) { const d = func(); - assertEqual(d, expected); + assertEqualApproximately(d, expected, 2e7); } function testVec3WithDest(func, expected) { const d = new Float32Array(3); const c = func(d); assertStrictEqual(c, d); - assertEqual(c, expected); + assertEqualApproximately(c, expected, 2e7); } function testVec3WithAndWithoutDest(func, expected) { @@ -80,7 +76,7 @@ function check(Type) { it('should create', () => { for (let i = 0; i <= 16; ++i) { const expected = mat4.clone(new Array(16).fill(0).map((_, ndx) => ndx < i ? ndx + 1 : 0)); - const args = new Array(Type === Array ? 16 : i).fill(0).map((_, ndx) => ndx < i ? ndx + 1 : 0); + const args = new Array(Array.isArray(mat4.identity()) ? 16 : i).fill(0).map((_, ndx) => ndx < i ? ndx + 1 : 0); const m = mat4.create(...args); assertEqual(m, expected); } @@ -93,15 +89,15 @@ function check(Type) { -8, -9, -10, -11, -12, -13, -14, -15, ]; - testMat4WithAndWithoutDest((dst) => { - return mat4.negate(m, dst); + testMat4WithAndWithoutDest((newDst) => { + return mat4.negate(m, newDst); }, expected); }); it('should copy', () => { const expected = m; - testMat4WithAndWithoutDest((dst) => { - const result = mat4.copy(m, dst); + testMat4WithAndWithoutDest((newDst) => { + const result = mat4.copy(m, newDst); assertStrictNotEqual(result, m); return result; }, expected); @@ -135,8 +131,8 @@ function check(Type) { it('should clone', () => { const expected = m; - testMat4WithAndWithoutDest((dst) => { - const result = mat4.clone(m, dst); + testMat4WithAndWithoutDest((newDst) => { + const result = mat4.clone(m, newDst); assertStrictNotEqual(result, m); return result; }, expected); @@ -144,8 +140,8 @@ function check(Type) { it('should set', () => { const expected = [2, 3, 4, 5, 22, 33, 44, 55, 222, 333, 444, 555, 2222, 3333, 4444, 5555]; - testMat4WithAndWithoutDest((v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, dst) => { - return mat4.set(v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, dst); + testMat4WithAndWithoutDest((v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, newDst) => { + return mat4.set(v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, newDst); }, expected, 2, 3, 4, 5, 22, 33, 44, 55, 222, 333, 444, 555, 2222, 3333, 4444, 5555); }); @@ -156,8 +152,8 @@ function check(Type) { 0, 0, 1, 0, 0, 0, 0, 1, ]; - testMat4WithAndWithoutDest((dst) => { - return mat4.identity(dst); + testMat4WithAndWithoutDest((newDst) => { + return mat4.identity(newDst); }, expected); }); @@ -168,8 +164,8 @@ function check(Type) { 2, 6, 10, 14, 3, 7, 11, 15, ]; - testMat4WithAndWithoutDest((dst) => { - return mat4.transpose(m, dst); + testMat4WithAndWithoutDest((newDst) => { + return mat4.transpose(m, newDst); }, expected); }); @@ -198,8 +194,8 @@ function check(Type) { m2[3 * 4 + 0] * m[0 * 4 + 2] + m2[3 * 4 + 1] * m[1 * 4 + 2] + m2[3 * 4 + 2] * m[2 * 4 + 2] + m2[3 * 4 + 3] * m[3 * 4 + 2], m2[3 * 4 + 0] * m[0 * 4 + 3] + m2[3 * 4 + 1] * m[1 * 4 + 3] + m2[3 * 4 + 2] * m[2 * 4 + 3] + m2[3 * 4 + 3] * m[3 * 4 + 3], ]; - testMat4WithAndWithoutDest((dst) => { - return fn(m, m2, dst); + testMat4WithAndWithoutDest((newDst) => { + return fn(m, m2, newDst); }, expected); } @@ -236,8 +232,8 @@ function check(Type) { 0.375, 1, ]; - testMat4WithAndWithoutDest((dst) => { - return fn(m, dst); + testMat4WithAndWithoutDest((newDst) => { + return fn(m, newDst); }, expected); } @@ -304,15 +300,15 @@ function check(Type) { 8, 9, 10, 11, 11, 22, 33, 1, ]; - testMat4WithAndWithoutDest((dst) => { - return mat4.setTranslation(m, [11, 22, 33], dst); + testMat4WithAndWithoutDest((newDst) => { + return mat4.setTranslation(m, [11, 22, 33], newDst); }, expected); }); it('should get translation', () => { const expected = [12, 13, 14]; - testVec3WithAndWithoutDest((dst) => { - return mat4.getTranslation(m, dst); + testVec3WithAndWithoutDest((newDst) => { + return mat4.getTranslation(m, newDst); }, expected); }); @@ -322,8 +318,8 @@ function check(Type) { [4, 5, 6], [8, 9, 10], ].forEach((expected, ndx) => { - testVec3WithAndWithoutDest((dst) => { - return mat4.getAxis(m, ndx, dst); + testVec3WithAndWithoutDest((newDst) => { + return mat4.getAxis(m, ndx, newDst); }, expected); }); }); @@ -349,8 +345,8 @@ function check(Type) { 12, 13, 14, 15, ], ].forEach((expected, ndx) => { - testMat4WithAndWithoutDest((dst) => { - return mat4.setAxis(m, [11, 22, 33], ndx, dst); + testMat4WithAndWithoutDest((newDst) => { + return mat4.setAxis(m, [11, 22, 33], ndx, newDst); }, expected); }); }); @@ -366,9 +362,9 @@ function check(Type) { Math.sqrt(1 * 1 + 2 * 2 + 3 * 3), Math.sqrt(5 * 5 + 6 * 6 + 7 * 7), Math.sqrt(9 * 9 + 10 * 10 + 11 * 11), - ]; - testVec3WithAndWithoutDest((dst) => { - return mat4.getScaling(m, dst); + ].map(v => new Type([v])[0]); + testVec3WithAndWithoutDest((newDst) => { + return mat4.getScaling(m, newDst); }, expected); }); @@ -400,8 +396,8 @@ function check(Type) { zNear * zFar * rangeInv, 0, ]; - testMat4WithAndWithoutDest((dst) => { - return mat4.perspective(fov, aspect, zNear, zFar, dst); + testMat4WithAndWithoutDest((newDst) => { + return mat4.perspective(fov, aspect, zNear, zFar, newDst); }, expected); }); @@ -432,8 +428,8 @@ function check(Type) { -zNear, 0, ]; - testMat4WithAndWithoutDest((dst) => { - return mat4.perspective(fov, aspect, zNear, zFar, dst); + testMat4WithAndWithoutDest((newDst) => { + return mat4.perspective(fov, aspect, zNear, zFar, newDst); }, expected); }); @@ -502,8 +498,8 @@ function check(Type) { zFar * zNear * rangeInv, 0, ]; - testMat4WithAndWithoutDest((dst) => { - return mat4.perspectiveReverseZ(fov, aspect, zNear, zFar, dst); + testMat4WithAndWithoutDest((newDst) => { + return mat4.perspectiveReverseZ(fov, aspect, zNear, zFar, newDst); }, expected); }); @@ -545,8 +541,8 @@ function check(Type) { zNear, 0, ]; - testMat4WithAndWithoutDest((dst) => { - return mat4.perspectiveReverseZ(fov, aspect, zNear, zFar, dst); + testMat4WithAndWithoutDest((newDst) => { + return mat4.perspectiveReverseZ(fov, aspect, zNear, zFar, newDst); }, expected); }); @@ -591,8 +587,8 @@ function check(Type) { near / (near - far), 1, ]; - testMat4WithAndWithoutDest((dst) => { - return mat4.ortho(left, right, bottom, top, near, far, dst); + testMat4WithAndWithoutDest((newDst) => { + return mat4.ortho(left, right, bottom, top, near, far, newDst); }, expected); }); @@ -638,8 +634,8 @@ function check(Type) { near * far / dz, 0, ]; - testMat4WithAndWithoutDest((dst) => { - return mat4.frustum(left, right, bottom, top, near, far, dst); + testMat4WithAndWithoutDest((newDst) => { + return mat4.frustum(left, right, bottom, top, near, far, newDst); }, expected); }); @@ -689,8 +685,8 @@ function check(Type) { near * far / dz, 0, ]; - testMat4WithAndWithoutDest((dst) => { - return mat4.frustumReverseZ(left, right, bottom, top, near, far, dst); + testMat4WithAndWithoutDest((newDst) => { + return mat4.frustumReverseZ(left, right, bottom, top, near, far, newDst); }, expected); }); @@ -738,13 +734,13 @@ function check(Type) { 0.4364357888698578, -0.8017837405204773, 0, - 1.4901161193847656e-7, + Type === Float32Array ? 1.4901161193847656e-7 : -4.440892098500626e-16, 0, 3.74165740609169, 1, ]; - testMat4WithAndWithoutDest((dst) => { - return mat4.lookAt(eye, target, up, dst); + testMat4WithAndWithoutDest((newDst) => { + return mat4.lookAt(eye, target, up, newDst); }, expected); }); @@ -851,14 +847,14 @@ function check(Type) { camExpected, }, i) => { it(`should make aim matrix ${i}`, () => { - testMat4WithAndWithoutDest((dst) => { - return mat4.aim(position, target, up, dst); + testMat4WithAndWithoutDest((newDst) => { + return mat4.aim(position, target, up, newDst); }, expected); }); it(`should make cameraAim matrix ${i}`, () => { - testMat4WithAndWithoutDest((dst) => { - return mat4.cameraAim(position, target, up, dst); + testMat4WithAndWithoutDest((newDst) => { + return mat4.cameraAim(position, target, up, newDst); }, camExpected); }); }); @@ -871,8 +867,8 @@ function check(Type) { 0, 0, 1, 0, 2, 3, 4, 1, ]; - testMat4WithAndWithoutDest((dst) => { - return mat4.translation([2, 3, 4], dst); + testMat4WithAndWithoutDest((newDst) => { + return mat4.translation([2, 3, 4], newDst); }, expected); }); @@ -886,8 +882,8 @@ function check(Type) { 14 + 2 * 2 + 6 * 3 + 10 * 4, 15 + 3 * 2 + 7 * 3 + 11 * 4, ]; - testMat4WithAndWithoutDest((dst) => { - return mat4.translate(m, [2, 3, 4], dst); + testMat4WithAndWithoutDest((newDst) => { + return mat4.translate(m, [2, 3, 4], newDst); }, expected); }); @@ -901,20 +897,18 @@ function check(Type) { 0, -s, c, 0, 0, 0, 0, 1, ]; - testMat4WithAndWithoutDest((dst) => { - return mat4.rotationX(angle, dst); + testMat4WithAndWithoutDest((newDst) => { + return mat4.rotationX(angle, newDst); }, expected); }); it('should rotate x', () => { const angle = 1.23; // switch to Array type to keep precision high for expected - const oldType = mat4.setDefaultType(Array); - const expected = mat4.multiply(m, mat4.rotationX(angle)); - mat4.setDefaultType(oldType); + const expected = mat4.multiply(m, mat4.rotationX(angle, [])); - testMat4WithAndWithoutDest((dst) => { - return mat4.rotateX(m, angle, dst); + testMat4WithAndWithoutDest((newDst) => { + return mat4.rotateX(m, angle, newDst); }, expected); }); @@ -928,20 +922,18 @@ function check(Type) { s, 0, c, 0, 0, 0, 0, 1, ]; - testMat4WithAndWithoutDest((dst) => { - return mat4.rotationY(angle, dst); + testMat4WithAndWithoutDest((newDst) => { + return mat4.rotationY(angle, newDst); }, expected); }); it('should rotate y', () => { const angle = 1.23; // switch to Array type to keep precision high for expected - const oldType = mat4.setDefaultType(Array); - const expected = mat4.multiply(m, mat4.rotationY(angle)); - mat4.setDefaultType(oldType); + const expected = mat4.multiply(m, mat4.rotationY(angle, new Array(16))); - testMat4WithAndWithoutDest((dst) => { - return mat4.rotateY(m, angle, dst); + testMat4WithAndWithoutDest((newDst) => { + return mat4.rotateY(m, angle, newDst); }, expected); }); @@ -955,20 +947,18 @@ function check(Type) { 0, 0, 1, 0, 0, 0, 0, 1, ]; - testMat4WithAndWithoutDest((dst) => { - return mat4.rotationZ(angle, dst); + testMat4WithAndWithoutDest((newDst) => { + return mat4.rotationZ(angle, newDst); }, expected); }); it('should rotate z', () => { const angle = 1.23; // switch to Array type to keep precision high for expected - const oldType = mat4.setDefaultType(Array); - const expected = mat4.multiply(m, mat4.rotationZ(angle)); - mat4.setDefaultType(oldType); + const expected = mat4.multiply(m, mat4.rotationZ(angle, new Array(16))); - testMat4WithAndWithoutDest((dst) => { - return mat4.rotateZ(m, angle, dst); + testMat4WithAndWithoutDest((newDst) => { + return mat4.rotateZ(m, angle, newDst); }, expected); }); @@ -1006,8 +996,8 @@ function check(Type) { 0, 0, 0, 1, ]; - testMat4WithAndWithoutDest((dst) => { - return mat4.axisRotation(axis, angle, dst); + testMat4WithAndWithoutDest((newDst) => { + return mat4.axisRotation(axis, angle, newDst); }, expected); }); @@ -1015,12 +1005,10 @@ function check(Type) { const axis = [0.5, 0.6, -0.7]; const angle = 1.23; // switch to Array type to keep precision high for expected - const oldType = mat4.setDefaultType(Array); - const expected = mat4.multiply(m, mat4.axisRotation(axis, angle)); - mat4.setDefaultType(oldType); + const expected = mat4.multiply(m, mat4.axisRotation(axis, angle, new Array(16))); - testMat4WithAndWithoutDest((dst) => { - return mat4.axisRotate(m, axis, angle, dst); + testMat4WithAndWithoutDest((newDst) => { + return mat4.axisRotate(m, axis, angle, newDst); }, expected); }); @@ -1031,8 +1019,8 @@ function check(Type) { 0, 0, 4, 0, 0, 0, 0, 1, ]; - testMat4WithAndWithoutDest((dst) => { - return mat4.scaling([2, 3, 4], dst); + testMat4WithAndWithoutDest((newDst) => { + return mat4.scaling([2, 3, 4], newDst); }, expected); }); @@ -1043,8 +1031,8 @@ function check(Type) { 32, 36, 40, 44, 12, 13, 14, 15, ]; - testMat4WithAndWithoutDest((dst) => { - return mat4.scale(m, [2, 3, 4], dst); + testMat4WithAndWithoutDest((newDst) => { + return mat4.scale(m, [2, 3, 4], newDst); }, expected); }); @@ -1055,8 +1043,8 @@ function check(Type) { 0, 0, 2, 0, 0, 0, 0, 1, ]; - testMat4WithAndWithoutDest((dst) => { - return mat4.uniformScaling(2, dst); + testMat4WithAndWithoutDest((newDst) => { + return mat4.uniformScaling(2, newDst); }, expected); }); @@ -1067,8 +1055,8 @@ function check(Type) { 16, 18, 20, 22, 12, 13, 14, 15, ]; - testMat4WithAndWithoutDest((dst) => { - return mat4.uniformScale(m, 2, dst); + testMat4WithAndWithoutDest((newDst) => { + return mat4.uniformScale(m, 2, newDst); }, expected); }); @@ -1079,9 +1067,9 @@ function check(Type) { 7, 8, 9, 0, 0, 0, 0, 1, ]; - testMat4WithAndWithoutDest((dst) => { + testMat4WithAndWithoutDest((newDst) => { const m3 = mat3.create(1, 2, 3, 4, 5, 6, 7, 8, 9); - return mat4.fromMat3(m3, dst); + return mat4.fromMat3(m3, newDst); }, expected); }); @@ -1095,8 +1083,8 @@ function check(Type) { { q: quat.fromEuler(0, 0, Math.PI / 2, 'xyz'), expected: mat4.rotationZ(Math.PI / 2), }, ]; for (const {q, expected} of tests) { - testMat4WithAndWithoutDest((dst) => { - return mat4.fromQuat(q, dst); + testMat4WithAndWithoutDest((newDst) => { + return mat4.fromQuat(q, newDst); }, expected); } }); @@ -1105,18 +1093,8 @@ function check(Type) { } describe('mat4', () => { - - it('should set default type', () => { - mat4.setDefaultType(Array); - let d = mat4.identity(); - assertIsArray(d); - mat4.setDefaultType(Float32Array); - d = mat4.identity(); - assertInstanceOf(d, Float32Array); - }); - - check(Array); - check(Float32Array); - check(Float64Array); + check(mat4n, Array); + check(mat4, Float32Array); + check(mat4d, Float64Array); }); diff --git a/test/tests/quat-test.js b/test/tests/quat-test.js index 0f9343a..38db067 100644 --- a/test/tests/quat-test.js +++ b/test/tests/quat-test.js @@ -1,4 +1,4 @@ -import {mat3, mat4, quat, utils, vec3} from '../../dist/2.x/wgpu-matrix.module.js'; +import {mat3, mat4, quat, quatn, quatd, utils, vec3} from '../../dist/3.x/wgpu-matrix.module.js'; import { assertEqual, @@ -6,12 +6,11 @@ import { assertInstanceOf, assertStrictEqual, assertStrictNotEqual, - assertIsArray, assertTruthy, assertFalsy, assertDeepEqualApproximately, } from '../assert.js'; -import {describe, it, before} from '../mocha-support.js'; +import {describe, it} from '../mocha-support.js'; // Note: quat.create is use extensively in these tests but that is NOT idiomatic! // Idiomatic usage use to use raw JS arrays where convenient. For example @@ -22,12 +21,8 @@ import {describe, it, before} from '../mocha-support.js'; // The reason quat.create is used in the tests is to make sure we are working // with the specified default type when testing. -function check(Type) { - describe('using ' + Type, () => { - - before(() => { - quat.setDefaultType(Type); - }); +function check(quat, Type) { + describe('using ' + quat, () => { function clone(v) { return v.slice ? v.slice() : v; @@ -456,25 +451,9 @@ function check(Type) { describe('quat', () => { - it('should set default type', () => { - quat.setDefaultType(Array); - let d = quat.create(1, 2, 3, 4); - assertIsArray(d); - - d = quat.add([1, 2, 3, 4], [5, 6, 7, 8]); - assertIsArray(d); - - quat.setDefaultType(Float32Array); - d = quat.create(1, 2, 3, 4); - assertInstanceOf(d, Float32Array); - - d = quat.add([1, 2, 3, 4], [5, 6, 7, 8]); - assertInstanceOf(d, Float32Array); - }); - - check(Array); - check(Float32Array); - check(Float64Array); + check(quatn, Array); + check(quat, Float32Array); + check(quatd, Float64Array); }); diff --git a/test/tests/utils-test.js b/test/tests/utils-test.js index f61d87b..885318a 100644 --- a/test/tests/utils-test.js +++ b/test/tests/utils-test.js @@ -1,4 +1,4 @@ -import {utils} from '../../dist/2.x/wgpu-matrix.module.js'; +import {utils} from '../../dist/3.x/wgpu-matrix.module.js'; import { assertEqual, diff --git a/test/tests/vec2-test.js b/test/tests/vec2-test.js index 187cf8a..61789f6 100644 --- a/test/tests/vec2-test.js +++ b/test/tests/vec2-test.js @@ -1,18 +1,16 @@ -import {vec2, utils} from '../../dist/2.x/wgpu-matrix.module.js'; +import {vec2, vec2n, vec2d, utils} from '../../dist/3.x/wgpu-matrix.module.js'; import { assertEqual, assertInstanceOf, - assertLessThan, assertStrictEqual, assertStrictNotEqual, - assertIsArray, assertEqualApproximately, assertTruthy, assertFalsy, assertArrayEqualApproximately, } from '../assert.js'; -import {describe, it, before} from '../mocha-support.js'; +import {describe, it} from '../mocha-support.js'; // Note: vec2.create is use extensively in these tests but that is NOT idiomatic! // Idiomatic usage use to use raw JS arrays where convenient. For example @@ -22,78 +20,82 @@ import {describe, it, before} from '../mocha-support.js'; // The reason vec2.create is used in the tests is to make sure we are working // with the specified default type when testing. -function check(Type) { +function check(vec2, Type) { describe('using ' + Type, () => { - before(() => { - vec2.setDefaultType(Type); - }); - function clone(c) { return c.length ? c.slice() : c; } - function elementsEqual(a, b) { - assertStrictEqual(a.length, b.length); - for (let i = 0; i < a.length; ++i) { - const diff = Math.abs(a[i] - b[i]); - assertLessThan(diff, 0.0000001); - } - } + //function elementsEqual(a, b) { + // assertStrictEqual(a.length, b.length); + // for (let i = 0; i < a.length; ++i) { + // const diff = Math.abs(a[i] - b[i]); + // assertLessThan(diff, 0.0000001); + // } + //} - function testV2WithoutDest(func, expected, ...args) { + function testV2WithoutDest(func, expected, tolerance, ...args) { const v = args.shift(); const d = func(clone(v), ...args); - assertEqual(d, expected); + assertEqualApproximately(d, expected, tolerance); assertInstanceOf(d, Type); } - function testV2WithDest(func, expected, ...args) { + function testV2WithDest(func, expected, tolerance, ...args) { const firstArg = args.shift(); // clone expected so we can check it wasn't modified expected = vec2.clone(expected); - let d = vec2.create(); + const d = vec2.create(); // clone v to make sure it's the correct type - let c = func(clone(firstArg), ...args, d); + const c = func(clone(firstArg), ...args, d); assertStrictEqual(c, d); - assertEqual(c, expected); - - // test if we pass same vector as source and dest we get - // correct result - if (firstArg.length) { - d = clone(firstArg); - // clone args to make sure we don't overwrite first arg - const bOrig = args.map(b => clone(b)); - c = func(d, ...args, d); - assertStrictEqual(c, d); - elementsEqual(c, expected); - args.forEach((b, ndx) => { - assertEqual(b, bOrig[ndx]); - }); - } + assertEqualApproximately(c, expected, tolerance); + + //// test if we pass same vector as source and dest we get + //// correct result + //if (firstArg.length) { + // d = clone(firstArg); + // // clone args to make sure we don't overwrite first arg + // const bOrig = args.map(b => clone(b)); + // c = func(d, ...args, d); + // assertStrictEqual(c, d); + // elementsEqual(c, expected); + // args.forEach((b, ndx) => { + // assertEqual(b, bOrig[ndx]); + // }); + //} + + //// test if we pass operand as dest we get correct result + //if (args.length > 0 && firstArg.length) { + // d = vec2.clone(args[0]); + // // clone v to make sure it is not overwritten + // const vOrig = vec2.clone(firstArg); + // c = func(firstArg, d, d); + // elementsEqual(c, expected); + // assertEqual(firstArg, vOrig); + // assertStrictEqual(c, d); + //} + } - // test if we pass operand as dest we get correct result - if (args.length > 0 && firstArg.length) { - d = vec2.clone(args[0]); - // clone v to make sure it is not overwritten - const vOrig = vec2.clone(firstArg); - c = func(firstArg, d, d); - elementsEqual(c, expected); - assertEqual(firstArg, vOrig); - assertStrictEqual(c, d); - } + function testV2WithAndWithoutDestImpl(func, expected, tolerance, ...args) { + expected = vec2.clone(expected); + testV2WithoutDest(func, expected, tolerance, ...args); + testV2WithDest(func, expected, tolerance, ...args); } function testV2WithAndWithoutDest(func, expected, ...args) { - expected = vec2.clone(expected); - testV2WithoutDest(func, expected, ...args); - testV2WithDest(func, expected, ...args); + testV2WithAndWithoutDestImpl(func, expected, 0, ...args); + } + + function testV2WithAndWithoutDestApprox(func, expected, ...args) { + testV2WithAndWithoutDestImpl(func, expected, 1e7, ...args); } it('should add', () => { const expected = [3, 5]; - testV2WithAndWithoutDest((a, b, dst) => { - return vec2.add(a, b, dst); + testV2WithAndWithoutDest((a, b, newDst) => { + return vec2.add(a, b, newDst); }, expected, [1, 2], [2, 3]); }); @@ -117,36 +119,36 @@ function check(Type) { it('should compute ceil', () => { const expected = [2, -1]; - testV2WithAndWithoutDest((a, dst) => { - return vec2.ceil(a, dst); + testV2WithAndWithoutDest((a, newDst) => { + return vec2.ceil(a, newDst); }, expected, [1.1, -1.1]); }); it('should compute floor', () => { const expected = [1, -2]; - testV2WithAndWithoutDest((a, dst) => { - return vec2.floor(a, dst); + testV2WithAndWithoutDest((a, newDst) => { + return vec2.floor(a, newDst); }, expected, [1.1, -1.1]); }); it('should compute round', () => { const expected = [1, -1]; - testV2WithAndWithoutDest((a, dst) => { - return vec2.round(a, dst); + testV2WithAndWithoutDest((a, newDst) => { + return vec2.round(a, newDst); }, expected, [1.1, -1.1]); }); it('should clamp', () => { { const expected = [1, 0]; - testV2WithAndWithoutDest((a, dst) => { - return vec2.clamp(a, 0, 1, dst); + testV2WithAndWithoutDest((a, newDst) => { + return vec2.clamp(a, 0, 1, newDst); }, expected, [2, -1]); } { const expected = [-10, 5]; - testV2WithAndWithoutDest((a, dst) => { - return vec2.clamp(a, -10, 5, dst); + testV2WithAndWithoutDest((a, newDst) => { + return vec2.clamp(a, -10, 5, newDst); }, expected, [-22, 50]); } }); @@ -164,71 +166,71 @@ function check(Type) { it('should subtract', () => { const expected = [-2, -3]; - testV2WithAndWithoutDest((a, b, dst) => { - return vec2.subtract(a, b, dst); + testV2WithAndWithoutDest((a, b, newDst) => { + return vec2.subtract(a, b, newDst); }, expected, [2, 3], [4, 6]); }); it('should sub', () => { const expected = [-2, -3]; - testV2WithAndWithoutDest((a, b, dst) => { - return vec2.sub(a, b, dst); + testV2WithAndWithoutDest((a, b, newDst) => { + return vec2.sub(a, b, newDst); }, expected, [2, 3], [4, 6]); }); it('should lerp', () => { const expected = [3, 4.5]; - testV2WithAndWithoutDest((a, b, dst) => { - return vec2.lerp(a, b, 0.5, dst); + testV2WithAndWithoutDest((a, b, newDst) => { + return vec2.lerp(a, b, 0.5, newDst); }, expected, [2, 3], [4, 6]); }); it('should lerp under 0', () => { const expected = [0.5, 1.5]; - testV2WithAndWithoutDest((a, b, dst) => { - return vec2.lerp(a, b, -0.5, dst); + testV2WithAndWithoutDest((a, b, newDst) => { + return vec2.lerp(a, b, -0.5, newDst); }, expected, [1, 3], [2, 6]); }); it('should lerp over 0', () => { const expected = [2.5, 7.5]; - testV2WithAndWithoutDest((a, b, dst) => { - return vec2.lerp(a, b, 1.5, dst); + testV2WithAndWithoutDest((a, b, newDst) => { + return vec2.lerp(a, b, 1.5, newDst); }, expected, [1, 3], [2, 6]); }); it('should multiply by scalar', () => { const expected = [4, 6]; - testV2WithAndWithoutDest((a, dst) => { - return vec2.mulScalar(a, 2, dst); + testV2WithAndWithoutDest((a, newDst) => { + return vec2.mulScalar(a, 2, newDst); }, expected, [2, 3]); }); it('should scale', () => { const expected = [4, 6]; - testV2WithAndWithoutDest((a, dst) => { - return vec2.scale(a, 2, dst); + testV2WithAndWithoutDest((a, newDst) => { + return vec2.scale(a, 2, newDst); }, expected, [2, 3]); }); it('should add scaled', () => { const expected = [10, 15]; - testV2WithAndWithoutDest((a, dst) => { - return vec2.addScaled(a, [4, 6], 2, dst); + testV2WithAndWithoutDest((a, newDst) => { + return vec2.addScaled(a, [4, 6], 2, newDst); }, expected, [2, 3]); }); it('should divide by scalar', () => { const expected = [0.5, 1.5]; - testV2WithAndWithoutDest((a, dst) => { - return vec2.divScalar(a, 2, dst); + testV2WithAndWithoutDest((a, newDst) => { + return vec2.divScalar(a, 2, newDst); }, expected, [1, 3]); }); it('should inverse', () => { const expected = [1 / 3, 1 / -4]; - testV2WithAndWithoutDest((a, dst) => { - return vec2.inverse(a, dst); + testV2WithAndWithoutDest((a, newDst) => { + return vec2.inverse(a, newDst); }, expected, [3, -4]); }); @@ -311,23 +313,23 @@ function check(Type) { 2 / length, 3 / length, ]; - testV2WithAndWithoutDest((a, dst) => { - return vec2.normalize(a, dst); + testV2WithAndWithoutDest((a, newDst) => { + return vec2.normalize(a, newDst); }, expected, [2, 3]); }); it('should negate', () => { const expected = [-2, 3]; - testV2WithAndWithoutDest((a, dst) => { - return vec2.negate(a, dst); + testV2WithAndWithoutDest((a, newDst) => { + return vec2.negate(a, newDst); }, expected, [2, -3]); }); it('should copy', () => { const expected = [2, 3]; const v = vec2.create(2, 3); - testV2WithAndWithoutDest((a, dst) => { - const result = vec2.copy(a, dst); + testV2WithAndWithoutDest((a, newDst) => { + const result = vec2.copy(a, newDst); assertStrictNotEqual(result, v); return result; }, expected, [2, 3]); @@ -336,8 +338,8 @@ function check(Type) { it('should clone', () => { const expected = [2, 3]; const v = vec2.create(2, 3); - testV2WithAndWithoutDest((a, dst) => { - const result = vec2.clone(a, dst); + testV2WithAndWithoutDest((a, newDst) => { + const result = vec2.clone(a, newDst); assertStrictNotEqual(result, v); return result; }, expected, [2, 3]); @@ -345,36 +347,36 @@ function check(Type) { it('should set', () => { const expected = [2, 3]; - testV2WithAndWithoutDest((a, b, dst) => { - return vec2.set(a, b, dst); + testV2WithAndWithoutDest((a, b, newDst) => { + return vec2.set(a, b, newDst); }, expected, 2, 3); }); it('should multiply', () => { const expected = [8, 18]; - testV2WithAndWithoutDest((a, b, dst) => { - return vec2.multiply(a, b, dst); + testV2WithAndWithoutDest((a, b, newDst) => { + return vec2.multiply(a, b, newDst); }, expected, [2, 3], [4, 6]); }); it('should mul', () => { const expected = [8, 18]; - testV2WithAndWithoutDest((a, b, dst) => { - return vec2.mul(a, b, dst); + testV2WithAndWithoutDest((a, b, newDst) => { + return vec2.mul(a, b, newDst); }, expected, [2, 3], [4, 6]); }); it('should divide', () => { const expected = [2 / 3, 3 / 4]; - testV2WithAndWithoutDest((a, b, dst) => { - return vec2.divide(a, b, dst); + testV2WithAndWithoutDest((a, b, newDst) => { + return vec2.divide(a, b, newDst); }, expected, [2, 3], [3, 4]); }); it('should div', () => { const expected = [2 / 3, 3 / 4]; - testV2WithAndWithoutDest((a, b, dst) => { - return vec2.div(a, b, dst); + testV2WithAndWithoutDest((a, b, newDst) => { + return vec2.div(a, b, newDst); }, expected, [2, 3], [3, 4]); }); @@ -402,38 +404,38 @@ function check(Type) { /* it('should transform by 2x2', () => { const expected = [14, 21]; - testV2WithAndWithoutDest((a, dst) => { + testV2WithAndWithoutDest((a, newDst) => { const m = [ 4, 3, 2, 5, ]; - return vec2.transformMat2(a, m, dst); + return vec2.transformMat2(a, m, newDst); }, expected, [2, 3]); }); */ it('should transform by 3x3', () => { const expected = [16, 17]; - testV2WithAndWithoutDest((a, dst) => { + testV2WithAndWithoutDest((a, newDst) => { const m = [ 4, 0, 0, 11, 0, 5, 0, 12, 8, 2, 0, 13, ]; - return vec2.transformMat3(a, m, dst); + return vec2.transformMat3(a, m, newDst); }, expected, [2, 3]); }); it('should transform by 4x4', () => { const expected = [6, 11]; - testV2WithAndWithoutDest((a, dst) => { + testV2WithAndWithoutDest((a, newDst) => { const m = [ 1, 0, 0, 0, 0, 2, 0, 0, 0, 0, 3, 0, 4, 5, 6, 1, ]; - return vec2.transformMat4(a, m, dst); + return vec2.transformMat4(a, m, newDst); }, expected, [2, 3]); }); @@ -446,111 +448,92 @@ function check(Type) { assertEqual(v2, [0, 0]); }); - }); -} - -describe('vec2', () => { - - it('should set default type', () => { - vec2.setDefaultType(Array); - let d = vec2.create(1, 2, 3); - assertIsArray(d); - - d = vec2.add([1, 2], [3, 4]); - assertIsArray(d); - - vec2.setDefaultType(Float32Array); - d = vec2.create(1, 2, 3); - assertInstanceOf(d, Float32Array); - - d = vec2.add([1, 2], [3, 4]); - assertInstanceOf(d, Float32Array); - }); - - check(Array); - check(Float32Array); - check(Float64Array); - - describe('rotate', function() { - describe('rotation around world origin [0, 0, 0]', function() { - let vecA, vecB, result; - beforeEach(function () { - vecA = [0, 1]; - vecB = [0, 0]; - result = vec2.rotate(vecA, vecB, Math.PI); + describe('rotate', function () { + describe('rotation around world origin [0, 0]', function () { + it("should return the rotated vector", function () { + const expected = [0, -1]; + testV2WithAndWithoutDestApprox((a, b, angle, newDst) => { + return vec2.rotate(a, b, angle, newDst); + }, expected, [0, 1], [0, 0], Math.PI); + }); }); - it("should return the rotated vector", function () { - assertEqualApproximately(result, [0, -1]); + describe('rotation around an arbitrary origin', function () { + it("should return the rotated vector", function () { + const expected = [-6, -5]; + testV2WithAndWithoutDestApprox((a, b, angle, newDst) => { + return vec2.rotate(a, b, angle, newDst); + }, expected, [6, -5], [0, -5], Math.PI); + }); }); }); - describe('rotation around an arbitrary origin', function () { - let vecA, vecB, result; - beforeEach(function () { - vecA = [6, -5]; - vecB = [0, -5]; - result = vec2.rotate(vecA, vecB, Math.PI); - }); - it("should return the rotated vector", function () { - assertEqualApproximately(result, [-6, -5]); + + describe('setLength', function () { + describe('set the length of a provided direction vector', function () { + it("should return the lengthened vector", function () { + const expected = [10.323759005323593, 10.323759005323593]; + testV2WithAndWithoutDestApprox( + (a, len, newDst) => vec2.setLength(a, len, newDst), + expected, + [1, 1], 14.6); + }); }); }); - }); - describe('setLength', function() { - describe('set the length of a provided direction vector', function() { - let vecA, result; - beforeEach(function () { - vecA = [1, 1]; - result = vec2.setLength(vecA, 14.6); - }); - it("should return the lengthend vector", function () { - assertEqualApproximately(result, [10.323759005323593, 10.323759005323593]); - assertEqualApproximately(vec2.length(result), 14.6); + describe('truncate', function () { + describe('limit a vector to a max length', function () { + + it("should shorten the vector", function () { + const expected = [2.82842712474619, 2.82842712474619]; + testV2WithAndWithoutDestApprox( + (a, len, newDst) => vec2.truncate(a, len, newDst), + expected, + [10.323759005323593, 10.323759005323593], + 4.0); + }); + + it("should preserve the vector when shorter than maxLen", function () { + const expected = [11, 12]; + testV2WithAndWithoutDestApprox( + (a, len, newDst) => vec2.truncate(a, len, newDst), + expected, + [11, 12], + 14.6); + }); }); }); - }); - describe('truncate', function() { - describe('limit a vector to a max length', function() { - let vecA; + describe('midpoint', function () { + describe('return the midpoint between 2 vectors', function () { - beforeEach(function () { - vecA = [10.323759005323593, 10.323759005323593]; - }); + it("should return the midpoint", function () { + const expected = [5, 5]; + testV2WithAndWithoutDest( + (a, b, newDst) => vec2.midpoint(a, b, newDst), + expected, + [0, 0], [10, 10] + ); + }); - it("should shorten the vector", function () { - const result = vec2.truncate(vecA, 4.0); - assertEqualApproximately(result, [2.82842712474619, 2.82842712474619]); - assertEqualApproximately(vec2.length(result), 4.0); - }); + it("should handle negatives", function () { + const expected = [10, 10]; + testV2WithAndWithoutDest( + (a, b, newDst) => vec2.midpoint(a, b, newDst), + expected, + [-10, -20], [30, 40]); + }); - it("should preserve the vector when shorter than maxLen", function () { - const result = vec2.truncate(vecA, 18.0); - assertEqualApproximately(result, [10.323759005323593, 10.323759005323593]); - assertEqualApproximately(vec2.length(result), 14.6); }); }); - }); - describe('midpoint', function() { - describe('return the midpoint between 2 vectors', function() { - it("should return the midpoint", function () { - const vecA = [ 0, 0 ] - const vecB = [ 10, 10 ] - const result = vec2.midpoint(vecA, vecB); - assertEqualApproximately(result, [ 5, 5 ]); - }); + }); +} - it("should handle negatives", function () { - const vecA = [ -10, -10 ] - const vecB = [ 10, 10 ] - const result = vec2.midpoint(vecA, vecB); - assertEqualApproximately(result, [ 0, 0 ]); - }); +describe('vec2', () => { - }); - }); + check(vec2n, Array); + check(vec2, Float32Array); + check(vec2d, Float64Array); }); diff --git a/test/tests/vec3-test.js b/test/tests/vec3-test.js index ce1eadb..450788b 100644 --- a/test/tests/vec3-test.js +++ b/test/tests/vec3-test.js @@ -1,17 +1,15 @@ -import {quat, vec3, utils} from '../../dist/2.x/wgpu-matrix.module.js'; +import {quat, vec3, vec3d, vec3n, utils} from '../../dist/3.x/wgpu-matrix.module.js'; import { assertEqual, assertInstanceOf, - assertLessThan, assertStrictEqual, assertStrictNotEqual, - assertIsArray, assertEqualApproximately, assertTruthy, assertFalsy, } from '../assert.js'; -import {describe, it, before} from '../mocha-support.js'; +import {describe, it} from '../mocha-support.js'; // Note: vec3.create is use extensively in these tests but that is NOT idiomatic! // Idiomatic usage use to use raw JS arrays where convenient. For example @@ -22,21 +20,9 @@ import {describe, it, before} from '../mocha-support.js'; // The reason vec3.create is used in the tests is to make sure we are working // with the specified default type when testing. -function check(Type) { +function check(vec3, Type) { describe('using ' + Type, () => { - before(() => { - vec3.setDefaultType(Type); - }); - - function elementsEqual(a, b) { - assertStrictEqual(a.length, b.length); - for (let i = 0; i < a.length; ++i) { - const diff = Math.abs(a[i] - b[i]); - assertLessThan(diff, 0.0000001); - } - } - function clone(v) { return v.length ? v.slice() : v; } @@ -52,36 +38,36 @@ function check(Type) { const firstArg = args.shift(); // clone expected so we can check it wasn't modified expected = vec3.clone(expected); - let d = vec3.create(); + const d = vec3.create(); // clone v to make sure it's the correct type - let c = func(clone(firstArg), ...args, d); + const c = func(clone(firstArg), ...args, d); assertStrictEqual(c, d); assertEqualApproximately(c, expected); // test if we pass same vector as source and dest we get // correct result - if (firstArg.length) { - d = vec3.clone(firstArg); - // clone args to make sure we don't overwrite first arg - const bOrig = args.map(b => b.slice(b)); - c = func(d, ...args, d); - assertStrictEqual(c, d); - elementsEqual(c, expected); - args.forEach((b, ndx) => { - assertEqual(b, bOrig[ndx]); - }); - } + //if (firstArg.length) { + // d = vec3.clone(firstArg); + // // clone args to make sure we don't overwrite first arg + // const bOrig = args.map(b => clone(b)); + // c = func(d, ...args, d); + // assertStrictEqual(c, d); + // elementsEqual(c, expected); + // args.forEach((b, ndx) => { + // assertEqual(b, bOrig[ndx]); + // }); + //} // test if we pass operand as dest we get correct result - if (args.length > 0 && firstArg.length) { - d = vec3.clone(args[0]); - // clone v to make sure it is not overwritten - const vOrig = vec3.clone(firstArg); - c = func(firstArg, d, d); - elementsEqual(c, expected); - assertEqual(firstArg, vOrig); - assertStrictEqual(c, d); - } + //if (args.length > 0 && firstArg.length) { + // d = vec3.clone(args[0]); + // // clone v to make sure it is not overwritten + // const vOrig = vec3.clone(firstArg); + // c = func(firstArg, d, d); + // elementsEqual(c, expected); + // assertEqual(firstArg, vOrig); + // assertStrictEqual(c, d); + //} } function testV3WithAndWithoutDest(func, expected, ...args) { @@ -92,8 +78,8 @@ function check(Type) { it('should add', () => { const expected = [3, 5, 7]; - testV3WithAndWithoutDest((a, b, dst) => { - return vec3.add(a, b, dst); + testV3WithAndWithoutDest((a, b, newDst) => { + return vec3.add(a, b, newDst); }, expected, [1, 2, 3], [2, 3, 4]); }); @@ -117,36 +103,36 @@ function check(Type) { it('should compute ceil', () => { const expected = [2, -1, 3]; - testV3WithAndWithoutDest((a, dst) => { - return vec3.ceil(a, dst); + testV3WithAndWithoutDest((a, newDst) => { + return vec3.ceil(a, newDst); }, expected, [1.1, -1.1, 2.9]); }); it('should compute floor', () => { const expected = [1, -2, 2]; - testV3WithAndWithoutDest((a, dst) => { - return vec3.floor(a, dst); + testV3WithAndWithoutDest((a, newDst) => { + return vec3.floor(a, newDst); }, expected, [1.1, -1.1, 2.9]); }); it('should compute round', () => { const expected = [1, -1, 3]; - testV3WithAndWithoutDest((a, dst) => { - return vec3.round(a, dst); + testV3WithAndWithoutDest((a, newDst) => { + return vec3.round(a, newDst); }, expected, [1.1, -1.1, 2.9]); }); it('should clamp', () => { { const expected = [1, 0, 0.5]; - testV3WithAndWithoutDest((a, dst) => { - return vec3.clamp(a, 0, 1, dst); + testV3WithAndWithoutDest((a, newDst) => { + return vec3.clamp(a, 0, 1, newDst); }, expected, [2, -1, 0.5]); } { const expected = [-10, 5, 2.9]; - testV3WithAndWithoutDest((a, dst) => { - return vec3.clamp(a, -10, 5, dst); + testV3WithAndWithoutDest((a, newDst) => { + return vec3.clamp(a, -10, 5, newDst); }, expected, [-22, 50, 2.9]); } }); @@ -164,71 +150,71 @@ function check(Type) { it('should subtract', () => { const expected = [-1, -2, -3]; - testV3WithAndWithoutDest((a, b, dst) => { - return vec3.subtract(a, b, dst); + testV3WithAndWithoutDest((a, b, newDst) => { + return vec3.subtract(a, b, newDst); }, expected, [1, 2, 3], [2, 4, 6]); }); it('should sub', () => { const expected = [-1, -2, -3]; - testV3WithAndWithoutDest((a, b, dst) => { - return vec3.sub(a, b, dst); + testV3WithAndWithoutDest((a, b, newDst) => { + return vec3.sub(a, b, newDst); }, expected, [1, 2, 3], [2, 4, 6]); }); it('should lerp', () => { const expected = [1.5, 3, 4.5]; - testV3WithAndWithoutDest((a, b, dst) => { - return vec3.lerp(a, b, 0.5, dst); + testV3WithAndWithoutDest((a, b, newDst) => { + return vec3.lerp(a, b, 0.5, newDst); }, expected, [1, 2, 3], [2, 4, 6]); }); it('should lerp under 0', () => { const expected = [0.5, 1, 1.5]; - testV3WithAndWithoutDest((a, b, dst) => { - return vec3.lerp(a, b, -0.5, dst); + testV3WithAndWithoutDest((a, b, newDst) => { + return vec3.lerp(a, b, -0.5, newDst); }, expected, [1, 2, 3], [2, 4, 6]); }); it('should lerp over 0', () => { const expected = [2.5, 5, 7.5]; - testV3WithAndWithoutDest((a, b, dst) => { - return vec3.lerp(a, b, 1.5, dst); + testV3WithAndWithoutDest((a, b, newDst) => { + return vec3.lerp(a, b, 1.5, newDst); }, expected, [1, 2, 3], [2, 4, 6]); }); it('should multiply by scalar', () => { const expected = [2, 4, 6]; - testV3WithAndWithoutDest((a, dst) => { - return vec3.mulScalar(a, 2, dst); + testV3WithAndWithoutDest((a, newDst) => { + return vec3.mulScalar(a, 2, newDst); }, expected, [1, 2, 3]); }); it('should scale', () => { const expected = [2, 4, 6]; - testV3WithAndWithoutDest((a, dst) => { - return vec3.scale(a, 2, dst); + testV3WithAndWithoutDest((a, newDst) => { + return vec3.scale(a, 2, newDst); }, expected, [1, 2, 3]); }); it('should add scaled', () => { const expected = [5, 10, 15]; - testV3WithAndWithoutDest((a, dst) => { - return vec3.addScaled(a, [2, 4, 6], 2, dst); + testV3WithAndWithoutDest((a, newDst) => { + return vec3.addScaled(a, [2, 4, 6], 2, newDst); }, expected, [1, 2, 3]); }); it('should divide by scalar', () => { const expected = [0.5, 1, 1.5]; - testV3WithAndWithoutDest((a, dst) => { - return vec3.divScalar(a, 2, dst); + testV3WithAndWithoutDest((a, newDst) => { + return vec3.divScalar(a, 2, newDst); }, expected, [1, 2, 3]); }); it('should inverse', () => { const expected = [1 / 2, 1 / 3, 1 / -4]; - testV3WithAndWithoutDest((a, dst) => { - return vec3.inverse(a, dst); + testV3WithAndWithoutDest((a, newDst) => { + return vec3.inverse(a, newDst); }, expected, [2, 3, -4]); }); @@ -238,8 +224,8 @@ function check(Type) { 3 * 2 - 1 * 6, 1 * 4 - 2 * 2, ]; - testV3WithAndWithoutDest((a, b, dst) => { - return vec3.cross(a, b, dst); + testV3WithAndWithoutDest((a, b, newDst) => { + return vec3.cross(a, b, newDst); }, expected, [1, 2, 3], [2, 4, 6]); }); @@ -304,23 +290,23 @@ function check(Type) { 2 / length, 3 / length, ]; - testV3WithAndWithoutDest((a, dst) => { - return vec3.normalize(a, dst); + testV3WithAndWithoutDest((a, newDst) => { + return vec3.normalize(a, newDst); }, expected, [1, 2, 3]); }); it('should negate', () => { const expected = [-1, -2, -3]; - testV3WithAndWithoutDest((a, dst) => { - return vec3.negate(a, dst); + testV3WithAndWithoutDest((a, newDst) => { + return vec3.negate(a, newDst); }, expected, [1, 2, 3]); }); it('should copy', () => { const expected = [1, 2, 3]; const v = vec3.create(1, 2, 3); - testV3WithAndWithoutDest((a, dst) => { - const result = vec3.copy(a, dst); + testV3WithAndWithoutDest((a, newDst) => { + const result = vec3.copy(a, newDst); assertStrictNotEqual(result, v); return result; }, expected, [1, 2, 3]); @@ -329,8 +315,8 @@ function check(Type) { it('should clone', () => { const expected = [1, 2, 3]; const v = vec3.create(1, 2, 3); - testV3WithAndWithoutDest((a, dst) => { - const result = vec3.clone(a, dst); + testV3WithAndWithoutDest((a, newDst) => { + const result = vec3.clone(a, newDst); assertStrictNotEqual(result, v); return result; }, expected, [1, 2, 3]); @@ -338,22 +324,22 @@ function check(Type) { it('should set', () => { const expected = [2, 3, 4]; - testV3WithAndWithoutDest((a, b, c, dst) => { - return vec3.set(a, b, c, dst); + testV3WithAndWithoutDest((a, b, c, newDst) => { + return vec3.set(a, b, c, newDst); }, expected, 2, 3, 4); }); it('should multiply', () => { const expected = [2, 8, 18]; - testV3WithAndWithoutDest((a, b, dst) => { - return vec3.multiply(a, b, dst); + testV3WithAndWithoutDest((a, b, newDst) => { + return vec3.multiply(a, b, newDst); }, expected, [1, 2, 3], [2, 4, 6]); }); it('should mul', () => { const expected = [2, 8, 18]; - testV3WithAndWithoutDest((a, b, dst) => { - return vec3.mul(a, b, dst); + testV3WithAndWithoutDest((a, b, newDst) => { + return vec3.mul(a, b, newDst); }, expected, [1, 2, 3], [2, 4, 6]); }); @@ -361,8 +347,8 @@ function check(Type) { const expected = [ 1 / 2, 2 / 3, 3 / 4, ]; - testV3WithAndWithoutDest((a, b, dst) => { - return vec3.divide(a, b, dst); + testV3WithAndWithoutDest((a, b, newDst) => { + return vec3.divide(a, b, newDst); }, expected, [1, 2, 3], [2, 3, 4]); }); @@ -370,8 +356,8 @@ function check(Type) { const expected = [ 1 / 2, 2 / 3, 3 / 4, ]; - testV3WithAndWithoutDest((a, b, dst) => { - return vec3.div(a, b, dst); + testV3WithAndWithoutDest((a, b, newDst) => { + return vec3.div(a, b, newDst); }, expected, [1, 2, 3], [2, 3, 4]); }); @@ -403,21 +389,21 @@ function check(Type) { 0, 5, 0, 0, 0, 0, 6, 0, ]; - testV3WithAndWithoutDest((v, dst) => { - return vec3.transformMat3(v, m, dst); + testV3WithAndWithoutDest((v, newDst) => { + return vec3.transformMat3(v, m, newDst); }, expected, [1, 2, 3]); }); it('should transform by 4x4', () => { const expected = [5, 9, 15]; - testV3WithAndWithoutDest((v, dst) => { + testV3WithAndWithoutDest((v, newDst) => { const m = [ 1, 0, 0, 0, 0, 2, 0, 0, 0, 0, 3, 0, 4, 5, 6, 1, ]; - return vec3.transformMat4(v, m, dst); + return vec3.transformMat4(v, m, newDst); }, expected, [1, 2, 3]); }); @@ -429,19 +415,29 @@ function check(Type) { 0, 0, 3, 0, 4, 5, 6, 1, ]; - testV3WithAndWithoutDest((v, mat, dst) => { - return vec3.transformMat4Upper3x3(v, mat, dst); + testV3WithAndWithoutDest((v, mat, newDst) => { + return vec3.transformMat4Upper3x3(v, mat, newDst); }, expected, [2, 3, 4], m); }); it('should transform by quat', () => { const tests = [ - { q: quat.fromEuler(0.1, 0.2, 0.3, 'xyz'), expected: [ 10.48346640790187, 20.99753274028838, 33.81124896860183 ], }, - { q: quat.fromEuler(1.1, 2.2, 3.3, 'xyz'), expected: [ 31.030506373087608, 1.340345941350634, -27.005761366554264 ], }, + { + q: quat.fromEuler(0.1, 0.2, 0.3, 'xyz'), + expected: Type === Float32Array + ? [ 10.48346640790187, 20.99753274028838, 33.81124896860183 ] + : [ 10.483466535953458, 20.99753253479091, 33.81124896860183 ], + }, + { + q: quat.fromEuler(1.1, 2.2, 3.3, 'xyz'), + expected: Type === Float32Array + ? [ 31.030506373087608, 1.3403475284576416, -27.00575828552246 ] + : [ 31.03050528998851, 1.340347488701262, -27.005757983559995 ], + }, ]; for (const {q, expected} of tests) { - testV3WithAndWithoutDest((v, q, dst) => { - return vec3.transformQuat(v, q, dst); + testV3WithAndWithoutDest((v, q, newDst) => { + return vec3.transformQuat(v, q, newDst); }, expected, [11, 22, 33], q); } }); @@ -455,158 +451,119 @@ function check(Type) { assertEqual(v2, [0, 0, 0]); }); - }); -} - -describe('vec3', () => { - - it('should set default type', () => { - vec3.setDefaultType(Array); - let d = vec3.create(1, 2, 3); - assertIsArray(d); - - d = vec3.add([1, 2, 3], [4, 5, 6]); - assertIsArray(d); - - vec3.setDefaultType(Float32Array); - d = vec3.create(1, 2, 3); - assertInstanceOf(d, Float32Array); - - d = vec3.add([1, 2, 3], [4, 5, 6]); - assertInstanceOf(d, Float32Array); - }); - - check(Array); - check(Float32Array); - check(Float64Array); - - let vecA, vecB, result; - - describe('rotateX', function () { - describe('rotation around world origin [0, 0, 0]', function () { - beforeEach(function () { - vecA = [0, 1, 0]; - vecB = [0, 0, 0]; - result = vec3.rotateX(vecA, vecB, Math.PI); - }); - it("should return the rotated vector", function () { - assertEqualApproximately(result, [0, -1, 0]); + describe('rotateX', function () { + describe('rotation around world origin [0, 0, 0]', function () { + it("should return the rotated vector", function () { + testV3WithAndWithoutDest((a, b, angle, newDst) => { + return vec3.rotateX(a, b, angle, newDst); + }, [0, -1, 0], [0, 1, 0], [0, 0, 0], Math.PI); + }); }); - }); - describe('rotation around an arbitrary origin', function () { - beforeEach(function () { - vecA = [2, 7, 0]; - vecB = [2, 5, 0]; - result = vec3.rotateX(vecA, vecB, Math.PI); - }); - it("should return the rotated vector", function () { - assertEqualApproximately(result, [2, 3, 0]); + describe('rotation around an arbitrary origin', function () { + const expected = [2, 3, 0]; + testV3WithAndWithoutDest((a, b, angle, newDst) => { + return vec3.rotateX(a, b, angle, newDst); + }, expected, [2, 7, 0], [2, 5, 0], Math.PI); }); }); - }); - describe('rotateY', function () { - describe('rotation around world origin [0, 0, 0]', function () { - beforeEach(function() { - vecA = [1, 0, 0]; - vecB = [0, 0, 0]; - result = vec3.rotateY(vecA, vecB, Math.PI); - }); + describe('rotateY', function () { + describe('rotation around world origin [0, 0, 0]', function () { it("should return the rotated vector", function () { - assertEqualApproximately(result, [-1, 0, 0]); - }); - }); - describe('rotation around an arbitrary origin', function () { - beforeEach(function () { - vecA = [-2, 3, 10]; - vecB = [-4, 3, 10]; - result = vec3.rotateY(vecA, vecB, Math.PI); + const expected = [-1, 0, 0]; + testV3WithAndWithoutDest((a, b, angle, newDst) => { + return vec3.rotateY(a, b, angle, newDst); + }, expected, [1, 0, 0], [0, 0, 0], Math.PI); }); + }); + describe('rotation around an arbitrary origin', function () { it("should return the rotated vector", function () { - assertEqualApproximately(result, [-6, 3, 10]); + const expected = [-6, 3, 10]; + testV3WithAndWithoutDest((a, b, angle, newDst) => { + return vec3.rotateY(a, b, angle, newDst); + }, expected, [-2, 3, 10], [-4, 3, 10], Math.PI); }); + }); }); - }); - describe('rotateZ', function () { - describe('rotation around world origin [0, 0, 0]', function () { - beforeEach(function () { - vecA = [0, 1, 0]; - vecB = [0, 0, 0]; - result = vec3.rotateZ(vecA, vecB, Math.PI); - }); + describe('rotateZ', function () { + describe('rotation around world origin [0, 0, 0]', function () { it("should return the rotated vector", function () { - assertEqualApproximately(result, [0, -1, 0]); - }); - }); - describe('rotation around an arbitrary origin', function () { - beforeEach(function () { - vecA = [0, 6, -5]; - vecB = [0, 0, -5]; - result = vec3.rotateZ(vecA, vecB, Math.PI); + const expected = [0, -1, 0]; + testV3WithAndWithoutDest((a, b, angle, newDst) => { + return vec3.rotateZ(a, b, angle, newDst); + }, expected, [0, 1, 0], [0, 0, 0], Math.PI); }); + }); + describe('rotation around an arbitrary origin', function () { it("should return the rotated vector", function () { - assertEqualApproximately(result, [0, -6, -5]); + const expected = [0, -6, -5]; + testV3WithAndWithoutDest((a, b, angle, newDst) => { + return vec3.rotateZ(a, b, angle, newDst); + }, expected, [0, 6, -5], [0, 0, -5], Math.PI); }); - }); - }); - - describe('setLength', function() { - describe('set the length of a provided direction vector', function() { - let vecA, result; - beforeEach(function () { - vecA = [1, 1, 1]; - result = vec3.setLength(vecA, 14.6); - }); - it("should return the lengthened vector", function () { - assertEqualApproximately(result, [8.429313930168536, 8.429313930168536, 8.429313930168536]); - assertEqualApproximately(vec3.length(result), 14.6); }); }); - }); - - describe('truncate', function() { - describe('limit a vector to a max length', function() { - let vecA; - beforeEach(function () { - vecA = [8.429313930168536, 8.429313930168536, 8.429313930168536]; + describe('setLength', function () { + describe('set the length of a provided direction vector', function () { + it("should return the lengthened vector", function () { + const expected = [8.429313930168536, 8.429313930168536, 8.429313930168536]; + testV3WithAndWithoutDest( + (a, len, newDst) => vec3.setLength(a, len, newDst), + expected, + [1, 1, 1], 14.6); + }); }); + }); - it("should shorten the vector", function () { - const result = vec3.truncate(vecA, 4.0); - assertEqualApproximately(result, [2.309401076758503, 2.309401076758503, 2.309401076758503]); - assertEqualApproximately(vec3.length(result), 4.0); - }); + describe('truncate', function () { + describe('limit a vector to a max length', function () { + it("should shorten the vector", function () { + const expected = [2.309401076758503, 2.309401076758503, 2.309401076758503]; + testV3WithAndWithoutDest( + (a, len, newDst) => vec3.truncate(a, len, newDst), + expected, + [8.429313930168536, 8.429313930168536, 8.429313930168536], 4.0); + }); - it("should preserve the vector when shorter than maxLen", function () { - const result = vec3.truncate(vecA, 18.0); - assertEqualApproximately(result, [8.429313930168536, 8.429313930168536, 8.429313930168536]); - assertEqualApproximately(vec3.length(result), 14.6); + it("should preserve the vector when shorter than maxLen", function () { + const expected = [8.429313930168536, 8.429313930168536, 8.429313930168536]; + testV3WithAndWithoutDest( + (a, len, newDst) => vec3.truncate(a, len, newDst), + expected, [8.429313930168536, 8.429313930168536, 8.429313930168536], 18.0); + }); }); }); - }); - describe('midpoint', function() { - describe('return the midpoint between 2 vectors', function() { + describe('midpoint', function () { + describe('return the midpoint between 2 vectors', function () { - it("should return the midpoint", function () { - const vecA = [ 0, 0, 0 ] - const vecB = [ 10, 10, 10 ] - const result = vec3.midpoint(vecA, vecB); - assertEqualApproximately(result, [ 5, 5, 5 ]); - }); + it("should return the midpoint", function () { + const vecA = [ 0, 0, 0 ]; + const vecB = [ 10, 10, 10 ]; + const result = vec3.midpoint(vecA, vecB); + assertEqualApproximately(result, [ 5, 5, 5 ]); + }); - it("should handle negatives", function () { - const vecA = [ -10, -10, -10 ] - const vecB = [ 10, 10, 10 ] - const result = vec3.midpoint(vecA, vecB); - assertEqualApproximately(result, [ 0, 0, 0 ]); - }); + it("should handle negatives", function () { + const vecA = [ -10, -10, -10 ]; + const vecB = [ 10, 10, 10 ]; + const result = vec3.midpoint(vecA, vecB); + assertEqualApproximately(result, [ 0, 0, 0 ]); + }); + }); }); + }); +} -}); +describe('vec3', () => { + + check(vec3n, Array); + check(vec3, Float32Array); + check(vec3d, Float64Array); +}); diff --git a/test/tests/vec4-test.js b/test/tests/vec4-test.js index 28ff528..ed5d482 100644 --- a/test/tests/vec4-test.js +++ b/test/tests/vec4-test.js @@ -1,17 +1,14 @@ -import {vec4, utils} from '../../dist/2.x/wgpu-matrix.module.js'; +import {vec4, vec4n, vec4d, utils} from '../../dist/3.x/wgpu-matrix.module.js'; import { assertEqual, assertInstanceOf, - assertLessThan, assertStrictEqual, assertStrictNotEqual, - assertIsArray, - assertEqualApproximately, assertTruthy, assertFalsy, } from '../assert.js'; -import {describe, it, before} from '../mocha-support.js'; +import {describe, it} from '../mocha-support.js'; // Note: vec4.create is use extensively in these tests but that is NOT idiomatic! // Idiomatic usage use to use raw JS arrays where convenient. For example @@ -22,25 +19,13 @@ import {describe, it, before} from '../mocha-support.js'; // The reason vec4.create is used in the tests is to make sure we are working // with the specified default type when testing. -function check(Type) { +function check(vec4, Type) { describe('using ' + Type, () => { - before(() => { - vec4.setDefaultType(Type); - }); - function clone(v) { return v.length ? v.slice() : v; } - function elementsEqual(a, b) { - assertStrictEqual(a.length, b.length); - for (let i = 0; i < a.length; ++i) { - const diff = Math.abs(a[i] - b[i]); - assertLessThan(diff, 0.0000001); - } - } - function testV4WithoutDest(func, expected, ...args) { const v = args.shift(); const d = func(clone(v), ...args); @@ -52,36 +37,36 @@ function check(Type) { const firstArg = args.shift(); // clone expected so we can check it wasn't modified expected = vec4.clone(expected); - let d = vec4.create(); + const d = vec4.create(); // clone v to make sure it's the correct type - let c = func(clone(firstArg), ...args, d); + const c = func(clone(firstArg), ...args, d); assertStrictEqual(c, d); assertEqual(c, expected); - // test if we pass same vector as source and dest we get - // correct result - if (firstArg.length) { - d = vec4.clone(firstArg); - // clone args to make sure we don't overwrite first arg - const bOrig = args.map(b => clone(b)); - c = func(d, ...args, d); - assertStrictEqual(c, d); - elementsEqual(c, expected); - args.forEach((b, ndx) => { - assertEqual(b, bOrig[ndx]); - }); - } - - // test if we pass operand as dest we get correct result - if (args.length > 0 && firstArg.length) { - d = vec4.clone(args[0]); - // clone v to make sure it is not overwritten - const vOrig = vec4.clone(firstArg); - c = func(firstArg, d, d); - elementsEqual(c, expected); - assertEqual(firstArg, vOrig); - assertStrictEqual(c, d); - } + //// test if we pass same vector as source and dest we get + //// correct result + //if (firstArg.length) { + // d = vec4.clone(firstArg); + // // clone args to make sure we don't overwrite first arg + // const bOrig = args.map(b => clone(b)); + // c = func(d, ...args, d); + // assertStrictEqual(c, d); + // elementsEqual(c, expected); + // args.forEach((b, ndx) => { + // assertEqual(b, bOrig[ndx]); + // }); + //} + + //// test if we pass operand as dest we get correct result + //if (args.length > 0 && firstArg.length) { + // d = vec4.clone(args[0]); + // // clone v to make sure it is not overwritten + // const vOrig = vec4.clone(firstArg); + // c = func(firstArg, d, d); + // elementsEqual(c, expected); + // assertEqual(firstArg, vOrig); + // assertStrictEqual(c, d); + //} } function testV4WithAndWithoutDest(func, expected, ...args) { @@ -92,43 +77,43 @@ function check(Type) { it('should add', () => { const expected = [3, 5, 7, 9]; - testV4WithAndWithoutDest((a, b, dst) => { - return vec4.add(a, b, dst); + testV4WithAndWithoutDest((a, b, newDst) => { + return vec4.add(a, b, newDst); }, expected, [1, 2, 3, 4], [2, 3, 4, 5]); }); it('should compute ceil', () => { const expected = [2, -1, 3, -4]; - testV4WithAndWithoutDest((a, dst) => { - return vec4.ceil(a, dst); + testV4WithAndWithoutDest((a, newDst) => { + return vec4.ceil(a, newDst); }, expected, [1.1, -1.1, 2.9, -4.2]); }); it('should compute floor', () => { const expected = [1, -2, 2, -4]; - testV4WithAndWithoutDest((a, dst) => { - return vec4.floor(a, dst); + testV4WithAndWithoutDest((a, newDst) => { + return vec4.floor(a, newDst); }, expected, [1.1, -1.1, 2.9, -3.1]); }); it('should compute round', () => { const expected = [1, -1, 3, 0]; - testV4WithAndWithoutDest((a, dst) => { - return vec4.round(a, dst); + testV4WithAndWithoutDest((a, newDst) => { + return vec4.round(a, newDst); }, expected, [1.1, -1.1, 2.9, 0.1]); }); it('should clamp', () => { { const expected = [1, 0, 0.5, 0]; - testV4WithAndWithoutDest((a, dst) => { - return vec4.clamp(a, 0, 1, dst); + testV4WithAndWithoutDest((a, newDst) => { + return vec4.clamp(a, 0, 1, newDst); }, expected, [2, -1, 0.5, -4]); } { const expected = [-10, 5, 2.9, -9]; - testV4WithAndWithoutDest((a, dst) => { - return vec4.clamp(a, -10, 5, dst); + testV4WithAndWithoutDest((a, newDst) => { + return vec4.clamp(a, -10, 5, newDst); }, expected, [-22, 50, 2.9, -9]); } }); @@ -155,71 +140,71 @@ function check(Type) { it('should subtract', () => { const expected = [-1, -2, -3, -4]; - testV4WithAndWithoutDest((a, b, dst) => { - return vec4.subtract(a, b, dst); + testV4WithAndWithoutDest((a, b, newDst) => { + return vec4.subtract(a, b, newDst); }, expected, [1, 2, 3, 4], [2, 4, 6, 8]); }); it('should sub', () => { const expected = [-1, -2, -3, -4]; - testV4WithAndWithoutDest((a, b, dst) => { - return vec4.sub(a, b, dst); + testV4WithAndWithoutDest((a, b, newDst) => { + return vec4.sub(a, b, newDst); }, expected, [1, 2, 3, 4], [2, 4, 6, 8]); }); it('should lerp', () => { const expected = [1.5, 3, 4.5, 6]; - testV4WithAndWithoutDest((a, b, dst) => { - return vec4.lerp(a, b, 0.5, dst); + testV4WithAndWithoutDest((a, b, newDst) => { + return vec4.lerp(a, b, 0.5, newDst); }, expected, [1, 2, 3, 4], [2, 4, 6, 8]); }); it('should lerp under 0', () => { const expected = [0.5, 1, 1.5, 2]; - testV4WithAndWithoutDest((a, b, dst) => { - return vec4.lerp(a, b, -0.5, dst); + testV4WithAndWithoutDest((a, b, newDst) => { + return vec4.lerp(a, b, -0.5, newDst); }, expected, [1, 2, 3, 4], [2, 4, 6, 8]); }); it('should lerp over 0', () => { const expected = [2.5, 5, 7.5, 10]; - testV4WithAndWithoutDest((a, b, dst) => { - return vec4.lerp(a, b, 1.5, dst); + testV4WithAndWithoutDest((a, b, newDst) => { + return vec4.lerp(a, b, 1.5, newDst); }, expected, [1, 2, 3, 4], [2, 4, 6, 8]); }); it('should multiply by scalar', () => { const expected = [2, 4, 6, 8]; - testV4WithAndWithoutDest((a, dst) => { - return vec4.mulScalar(a, 2, dst); + testV4WithAndWithoutDest((a, newDst) => { + return vec4.mulScalar(a, 2, newDst); }, expected, [1, 2, 3, 4]); }); it('should scale', () => { const expected = [2, 4, 6, 8]; - testV4WithAndWithoutDest((a, dst) => { - return vec4.scale(a, 2, dst); + testV4WithAndWithoutDest((a, newDst) => { + return vec4.scale(a, 2, newDst); }, expected, [1, 2, 3, 4]); }); it('should add scaled', () => { const expected = [5, 10, 15, 20]; - testV4WithAndWithoutDest((a, dst) => { - return vec4.addScaled(a, [2, 4, 6, 8], 2, dst); + testV4WithAndWithoutDest((a, newDst) => { + return vec4.addScaled(a, [2, 4, 6, 8], 2, newDst); }, expected, [1, 2, 3, 4]); }); it('should divide by scalar', () => { const expected = [0.5, 1, 1.5, 2]; - testV4WithAndWithoutDest((a, dst) => { - return vec4.divScalar(a, 2, dst); + testV4WithAndWithoutDest((a, newDst) => { + return vec4.divScalar(a, 2, newDst); }, expected, [1, 2, 3, 4]); }); it('should inverse', () => { const expected = [1 / 2, 1 / 3, 1 / -4, 1 / -8]; - testV4WithAndWithoutDest((a, dst) => { - return vec4.inverse(a, dst); + testV4WithAndWithoutDest((a, newDst) => { + return vec4.inverse(a, newDst); }, expected, [2, 3, -4, -8]); }); @@ -285,23 +270,23 @@ function check(Type) { 3 / length, 4 / length, ]; - testV4WithAndWithoutDest((a, dst) => { - return vec4.normalize(a, dst); + testV4WithAndWithoutDest((a, newDst) => { + return vec4.normalize(a, newDst); }, expected, [1, 2, 3, 4]); }); it('should negate', () => { const expected = [-1, -2, -3, 4]; - testV4WithAndWithoutDest((a, dst) => { - return vec4.negate(a, dst); + testV4WithAndWithoutDest((a, newDst) => { + return vec4.negate(a, newDst); }, expected, [1, 2, 3, -4]); }); it('should copy', () => { const expected = [1, 2, 3, 4]; const v = vec4.create(1, 2, 3, 4); - testV4WithAndWithoutDest((a, dst) => { - const result = vec4.copy(a, dst); + testV4WithAndWithoutDest((a, newDst) => { + const result = vec4.copy(a, newDst); assertStrictNotEqual(result, v); return result; }, expected, [1, 2, 3, 4]); @@ -310,8 +295,8 @@ function check(Type) { it('should clone', () => { const expected = [1, 2, 3, 4]; const v = vec4.create(1, 2, 3, 4); - testV4WithAndWithoutDest((a, dst) => { - const result = vec4.clone(a, dst); + testV4WithAndWithoutDest((a, newDst) => { + const result = vec4.clone(a, newDst); assertStrictNotEqual(result, v); return result; }, expected, [1, 2, 3, 4]); @@ -319,36 +304,36 @@ function check(Type) { it('should set', () => { const expected = [2, 3, 4, 5]; - testV4WithAndWithoutDest((a, b, c, d, dst) => { - return vec4.set(a, b, c, d, dst); + testV4WithAndWithoutDest((a, b, c, d, newDst) => { + return vec4.set(a, b, c, d, newDst); }, expected, 2, 3, 4, 5); }); it('should multiply', () => { const expected = [2, 8, 18, 32]; - testV4WithAndWithoutDest((a, b, dst) => { - return vec4.multiply(a, b, dst); + testV4WithAndWithoutDest((a, b, newDst) => { + return vec4.multiply(a, b, newDst); }, expected, [1, 2, 3, 4], [2, 4, 6, 8]); }); it('should mul', () => { const expected = [2, 8, 18, 32]; - testV4WithAndWithoutDest((a, b, dst) => { - return vec4.mul(a, b, dst); + testV4WithAndWithoutDest((a, b, newDst) => { + return vec4.mul(a, b, newDst); }, expected, [1, 2, 3, 4], [2, 4, 6, 8]); }); it('should divide', () => { const expected = [1 / 2, 2 / 3, 3 / 4, 4 / 5]; - testV4WithAndWithoutDest((a, b, dst) => { - return vec4.divide(a, b, dst); + testV4WithAndWithoutDest((a, b, newDst) => { + return vec4.divide(a, b, newDst); }, expected, [1, 2, 3, 4], [2, 3, 4, 5]); }); it('should div', () => { const expected = [1 / 2, 2 / 3, 3 / 4, 4 / 5]; - testV4WithAndWithoutDest((a, b, dst) => { - return vec4.div(a, b, dst); + testV4WithAndWithoutDest((a, b, newDst) => { + return vec4.div(a, b, newDst); }, expected, [1, 2, 3, 4], [2, 3, 4, 5]); }); @@ -366,8 +351,8 @@ function check(Type) { 0, 0, 3, 0, 4, 5, 6, 1, ]; - testV4WithAndWithoutDest((v, mat, dst) => { - return vec4.transformMat4(v, mat, dst); + testV4WithAndWithoutDest((v, mat, newDst) => { + return vec4.transformMat4(v, mat, newDst); }, expected, [1, 2, 3, 4], m); }); @@ -380,86 +365,54 @@ function check(Type) { assertEqual(v2, [0, 0, 0, 0]); }); - }); -} - -describe('vec4', () => { - - it('should set default type', () => { - vec4.setDefaultType(Array); - let d = vec4.create(1, 2, 3, 4); - assertIsArray(d); - - d = vec4.add([1, 2, 3, 4], [5, 6, 7, 8]); - assertIsArray(d); - - vec4.setDefaultType(Float32Array); - d = vec4.create(1, 2, 3, 4); - assertInstanceOf(d, Float32Array); - - d = vec4.add([1, 2, 3, 4], [5, 6, 7, 8]); - assertInstanceOf(d, Float32Array); - }); - - check(Array); - check(Float32Array); - check(Float64Array); - - describe('setLength', function() { - describe('set the length of a provided direction vector', function() { - let vecA, result; - beforeEach(function () { - vecA = [1, 1, 1, 1]; - result = vec4.setLength(vecA, 14.6); - }); - it("should return the lengthened vector", function () { - assertEqualApproximately(result, [7.3, 7.3, 7.3, 7.3]); - assertEqualApproximately(vec4.length(result), 14.6); - }); + it('should setLength', () => { + const expected = [7.3, 7.3, 7.3, 7.3]; + testV4WithAndWithoutDest((v, len, newDst) => { + return vec4.setLength(v, len, newDst); + }, expected, [1, 1, 1, 1], 14.6); }); - }); - describe('truncate', function() { - describe('limit a vector to a max length', function() { - let vecA; - - beforeEach(function () { - vecA = [8.429313930168536, 8.429313930168536, 8.429313930168536, 8.429313930168536]; - }); + it('should truncate - shorten when too long', () => { + const expected = [ + 2.721655269759087, + Type === Float32Array ? 4.082483291625977 : 4.0824829046386295, + 5.443310539518174, + 6.804138174397716, + ]; + testV4WithAndWithoutDest((v, len, newDst) => { + return vec4.truncate(v, len, newDst); + }, expected, [20, 30, 40, 50], 10); + }); - it("should shorten the vector", function () { - const result = vec4.truncate(vecA, 4.0); - assertEqualApproximately(result, [2, 2, 2, 2]); - assertEqualApproximately(vec4.length(result), 4.0); - }); + it("should truncate - preserve the vector when shorter than maxLen", () => { + const expected = [20, 30, 40, 50]; + testV4WithAndWithoutDest((v, len, newDst) => { + return vec4.truncate(v, len, newDst); + }, expected, [20, 30, 40, 50], 100); + }); - it("should preserve the vector when shorter than maxLen", function () { - const result = vec4.truncate(vecA, 18.0); - assertEqualApproximately(result, [8.429313930168536, 8.429313930168536, 8.429313930168536, 8.429313930168536]); - assertEqualApproximately(vec4.length(result), 16.858627860337073); - }); + it('should midpoint', () => { + const expected = [6, 12, 18, 24]; + testV4WithAndWithoutDest((a, b, newDst) => { + return vec4.midpoint(a, b, newDst); + }, expected, [1, 2, 3, 4], [11, 22, 33, 44]); }); - }); - describe('midpoint', function() { - describe('return the midpoint between 2 vectors', function() { + it("should midpoint - handle negatives", function () { + const expected = [-5, -10, -15, -20]; + testV4WithAndWithoutDest((a, b, newDst) => { + return vec4.midpoint(a, b, newDst); + }, expected, [1, 2, 3, 4], [-11, -22, -33, -44]); + }); - it("should return the midpoint", function () { - const vecA = [ 0, 0, 0, 0 ] - const vecB = [ 10, 10, 10, 10 ] - const result = vec4.midpoint(vecA, vecB); - assertEqualApproximately(result, [ 5, 5, 5, 5 ]); - }); + }); +} - it("should handle negatives", function () { - const vecA = [ -10, -10, -10, -10 ] - const vecB = [ 10, 10, 10, 10 ] - const result = vec4.midpoint(vecA, vecB); - assertEqualApproximately(result, [ 0, 0, 0, 0 ]); - }); +describe('vec4', () => { - }); - }); + check(vec4n, Array); + check(vec4, Float32Array); + check(vec4d, Float64Array); }); diff --git a/test/tests/wgpu-matrix-test.js b/test/tests/wgpu-matrix-test.js index 649756f..f0e4bfb 100644 --- a/test/tests/wgpu-matrix-test.js +++ b/test/tests/wgpu-matrix-test.js @@ -1,27 +1,5 @@ -import {setDefaultType, mat3, mat4, vec2, vec3, vec4} from '../../dist/2.x/wgpu-matrix.module.js'; - -import { - assertInstanceOf, -} from '../assert.js'; - -import {describe, it} from '../mocha-support.js'; +import {describe} from '../mocha-support.js'; describe('wgpu-matrix', () => { - function check(Type) { - - it(`setsDefaultType to ${Type}`, () => { - setDefaultType(Type); - assertInstanceOf(mat3.create(), Type); - assertInstanceOf(mat4.create(), Type); - assertInstanceOf(vec2.create(), Type); - assertInstanceOf(vec3.create(), Type); - assertInstanceOf(vec4.create(), Type); - }); - - } - - check(Array); - check(Float64Array); - check(Float32Array); }); diff --git a/test/umd-test.html b/test/umd-test.html index 072d19e..ef2deb7 100644 --- a/test/umd-test.html +++ b/test/umd-test.html @@ -4,7 +4,7 @@ UMD Test - +