math 0.0.0 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/API.md +1605 -0
- package/LICENSE +21 -0
- package/README.md +197 -0
- package/dist/color/color.js +136 -0
- package/dist/color/color.js.map +1 -0
- package/dist/color/colorspace.js +43 -0
- package/dist/color/colorspace.js.map +1 -0
- package/dist/color/hsl.js +123 -0
- package/dist/color/hsl.js.map +1 -0
- package/dist/color/index.js +7 -0
- package/dist/color/index.js.map +1 -0
- package/dist/color/parse.js +276 -0
- package/dist/color/parse.js.map +1 -0
- package/dist/core/angle.js +43 -0
- package/dist/core/angle.js.map +1 -0
- package/dist/core/euler.js +212 -0
- package/dist/core/euler.js.map +1 -0
- package/dist/core/mat2.js +385 -0
- package/dist/core/mat2.js.map +1 -0
- package/dist/core/mat2d.js +422 -0
- package/dist/core/mat2d.js.map +1 -0
- package/dist/core/mat3.js +749 -0
- package/dist/core/mat3.js.map +1 -0
- package/dist/core/mat4.js +2197 -0
- package/dist/core/mat4.js.map +1 -0
- package/dist/core/polar.js +200 -0
- package/dist/core/polar.js.map +1 -0
- package/dist/core/quat.js +730 -0
- package/dist/core/quat.js.map +1 -0
- package/dist/core/quat2.js +883 -0
- package/dist/core/quat2.js.map +1 -0
- package/dist/core/scalar.js +112 -0
- package/dist/core/scalar.js.map +1 -0
- package/dist/core/spherical.js +248 -0
- package/dist/core/spherical.js.map +1 -0
- package/dist/core/vec2.js +597 -0
- package/dist/core/vec2.js.map +1 -0
- package/dist/core/vec3.js +916 -0
- package/dist/core/vec3.js.map +1 -0
- package/dist/core/vec4.js +573 -0
- package/dist/core/vec4.js.map +1 -0
- package/dist/geometry/circumcircle.js +39 -0
- package/dist/geometry/circumcircle.js.map +1 -0
- package/dist/geometry/index.js +6 -0
- package/dist/geometry/index.js.map +1 -0
- package/dist/geometry/polygon2-decompose.js +411 -0
- package/dist/geometry/polygon2-decompose.js.map +1 -0
- package/dist/geometry/polygon2-triangulate.js +222 -0
- package/dist/geometry/polygon2-triangulate.js.map +1 -0
- package/dist/geometry/quickhull2.js +123 -0
- package/dist/geometry/quickhull2.js.map +1 -0
- package/dist/geometry/quickhull3.js +605 -0
- package/dist/geometry/quickhull3.js.map +1 -0
- package/dist/ik/fabrik2.js +675 -0
- package/dist/ik/fabrik2.js.map +1 -0
- package/dist/ik/fabrik3.js +912 -0
- package/dist/ik/fabrik3.js.map +1 -0
- package/dist/ik/index.js +5 -0
- package/dist/ik/index.js.map +1 -0
- package/dist/index.js +27 -0
- package/dist/index.js.map +1 -0
- package/dist/noise/fractal.js +185 -0
- package/dist/noise/fractal.js.map +1 -0
- package/dist/noise/index.js +16 -0
- package/dist/noise/index.js.map +1 -0
- package/dist/noise/perlin2d.js +50 -0
- package/dist/noise/perlin2d.js.map +1 -0
- package/dist/noise/perlin3d.js +72 -0
- package/dist/noise/perlin3d.js.map +1 -0
- package/dist/noise/permutation.js +120 -0
- package/dist/noise/permutation.js.map +1 -0
- package/dist/noise/simplex2d.js +84 -0
- package/dist/noise/simplex2d.js.map +1 -0
- package/dist/noise/simplex3d.js +147 -0
- package/dist/noise/simplex3d.js.map +1 -0
- package/dist/noise/simplex4d.js +149 -0
- package/dist/noise/simplex4d.js.map +1 -0
- package/dist/noise/worley2d.js +50 -0
- package/dist/noise/worley2d.js.map +1 -0
- package/dist/noise/worley3d.js +61 -0
- package/dist/noise/worley3d.js.map +1 -0
- package/dist/random/index.js +9 -0
- package/dist/random/index.js.map +1 -0
- package/dist/random/isaac32.js +164 -0
- package/dist/random/isaac32.js.map +1 -0
- package/dist/random/isaac64.js +215 -0
- package/dist/random/isaac64.js.map +1 -0
- package/dist/random/mulberry32.js +48 -0
- package/dist/random/mulberry32.js.map +1 -0
- package/dist/random/random.js +120 -0
- package/dist/random/random.js.map +1 -0
- package/dist/shapes/box2.js +300 -0
- package/dist/shapes/box2.js.map +1 -0
- package/dist/shapes/box3.js +550 -0
- package/dist/shapes/box3.js.map +1 -0
- package/dist/shapes/circle.js +6 -0
- package/dist/shapes/circle.js.map +1 -0
- package/dist/shapes/frustum.js +662 -0
- package/dist/shapes/frustum.js.map +1 -0
- package/dist/shapes/index.js +25 -0
- package/dist/shapes/index.js.map +1 -0
- package/dist/shapes/obb3.js +557 -0
- package/dist/shapes/obb3.js.map +1 -0
- package/dist/shapes/plane3.js +267 -0
- package/dist/shapes/plane3.js.map +1 -0
- package/dist/shapes/polygon2.js +451 -0
- package/dist/shapes/polygon2.js.map +1 -0
- package/dist/shapes/raycast3.js +164 -0
- package/dist/shapes/raycast3.js.map +1 -0
- package/dist/shapes/segment2.js +82 -0
- package/dist/shapes/segment2.js.map +1 -0
- package/dist/shapes/sphere.js +23 -0
- package/dist/shapes/sphere.js.map +1 -0
- package/dist/shapes/triangle2.js +79 -0
- package/dist/shapes/triangle2.js.map +1 -0
- package/dist/shapes/triangle3.js +60 -0
- package/dist/shapes/triangle3.js.map +1 -0
- package/dist/src/color/color.d.ts +50 -0
- package/dist/src/color/colorspace.d.ts +15 -0
- package/dist/src/color/hsl.d.ts +28 -0
- package/dist/src/color/index.d.ts +5 -0
- package/dist/src/color/parse.d.ts +15 -0
- package/dist/src/core/angle.d.ts +29 -0
- package/dist/src/core/arrays.d.ts +4 -0
- package/dist/src/core/euler.d.ts +78 -0
- package/dist/src/core/index.d.ts +27 -0
- package/dist/src/core/mat2.d.ts +217 -0
- package/dist/src/core/mat2d.d.ts +218 -0
- package/dist/src/core/mat3.d.ts +295 -0
- package/dist/src/core/mat4.d.ts +667 -0
- package/dist/src/core/polar.d.ts +151 -0
- package/dist/src/core/quat.d.ts +370 -0
- package/dist/src/core/quat2.d.ts +344 -0
- package/dist/src/core/scalar.d.ts +75 -0
- package/dist/src/core/spherical.d.ts +165 -0
- package/dist/src/core/vec2.d.ts +403 -0
- package/dist/src/core/vec3.d.ts +493 -0
- package/dist/src/core/vec4.d.ts +336 -0
- package/dist/src/geometry/circumcircle.d.ts +9 -0
- package/dist/src/geometry/index.d.ts +5 -0
- package/dist/src/geometry/polygon2-decompose.d.ts +25 -0
- package/dist/src/geometry/polygon2-triangulate.d.ts +15 -0
- package/dist/src/geometry/quickhull2.d.ts +10 -0
- package/dist/src/geometry/quickhull3.d.ts +27 -0
- package/dist/src/ik/fabrik2.d.ts +314 -0
- package/dist/src/ik/fabrik3.d.ts +371 -0
- package/dist/src/ik/index.d.ts +2 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/noise/fractal.d.ts +95 -0
- package/dist/src/noise/index.d.ts +9 -0
- package/dist/src/noise/perlin2d.d.ts +19 -0
- package/dist/src/noise/perlin3d.d.ts +20 -0
- package/dist/src/noise/permutation.d.ts +22 -0
- package/dist/src/noise/simplex2d.d.ts +19 -0
- package/dist/src/noise/simplex3d.d.ts +20 -0
- package/dist/src/noise/simplex4d.d.ts +24 -0
- package/dist/src/noise/worley2d.d.ts +22 -0
- package/dist/src/noise/worley3d.d.ts +23 -0
- package/dist/src/random/index.d.ts +8 -0
- package/dist/src/random/isaac32.d.ts +62 -0
- package/dist/src/random/isaac64.d.ts +75 -0
- package/dist/src/random/mulberry32.d.ts +43 -0
- package/dist/src/random/random.d.ts +67 -0
- package/dist/src/shapes/box2.d.ts +174 -0
- package/dist/src/shapes/box3.d.ts +213 -0
- package/dist/src/shapes/circle.d.ts +7 -0
- package/dist/src/shapes/frustum.d.ts +147 -0
- package/dist/src/shapes/index.d.ts +20 -0
- package/dist/src/shapes/obb3.d.ts +105 -0
- package/dist/src/shapes/plane3.d.ts +130 -0
- package/dist/src/shapes/polygon2.d.ts +155 -0
- package/dist/src/shapes/raycast3.d.ts +42 -0
- package/dist/src/shapes/segment2.d.ts +34 -0
- package/dist/src/shapes/sphere.d.ts +19 -0
- package/dist/src/shapes/triangle2.d.ts +53 -0
- package/dist/src/shapes/triangle3.d.ts +29 -0
- package/dist/src/time/easing.d.ts +21 -0
- package/dist/src/time/index.d.ts +6 -0
- package/dist/src/time/spring-core.d.ts +15 -0
- package/dist/src/time/spring.d.ts +36 -0
- package/dist/src/time/spring2.d.ts +11 -0
- package/dist/src/time/spring3.d.ts +11 -0
- package/dist/src/time/spring4.d.ts +11 -0
- package/dist/time/easing.js +24 -0
- package/dist/time/easing.js.map +1 -0
- package/dist/time/index.js +11 -0
- package/dist/time/index.js.map +1 -0
- package/dist/time/spring-core.js +48 -0
- package/dist/time/spring-core.js.map +1 -0
- package/dist/time/spring.js +62 -0
- package/dist/time/spring.js.map +1 -0
- package/dist/time/spring2.js +31 -0
- package/dist/time/spring2.js.map +1 -0
- package/dist/time/spring3.js +32 -0
- package/dist/time/spring3.js.map +1 -0
- package/dist/time/spring4.js +32 -0
- package/dist/time/spring4.js.map +1 -0
- package/package.json +90 -12
- package/skills/math/SKILL.md +140 -0
- package/math.coffee +0 -36
- package/math.js +0 -67
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vec3.js","sources":["../../src/core/vec3.ts"],"sourcesContent":["import type { MutableArrayLike } from './arrays';\nimport type { Mat3 } from './mat3';\nimport type { Mat4 } from './mat4';\nimport type { Quat } from './quat';\nimport * as scalar from './scalar';\n\n/** A 3D vector */\nexport type Vec3 = [x: number, y: number, z: number];\n\n/**\n * Creates a new, empty vec3\n *\n * @returns a new 3D vector\n */\nexport function create(): Vec3 {\n return [0, 0, 0];\n}\n\n/**\n * Creates a new vec3 initialized with values from an existing vector\n *\n * @param a vector to clone\n * @returns a new 3D vector\n */\nexport function clone(a: Vec3): Vec3 {\n return [a[0], a[1], a[2]];\n}\n\n/**\n * Creates a new vec3 initialized with the given values\n *\n * @param x X component\n * @param y Y component\n * @param z Z component\n * @returns a new 3D vector\n */\nexport function fromValues(x: number, y: number, z: number): Vec3 {\n return [x, y, z];\n}\n\n/**\n * Calculates the length of a vec3\n *\n * @param a vector to calculate length of\n * @returns length of a\n */\nexport function length(a: Vec3): number {\n const x = a[0];\n const y = a[1];\n const z = a[2];\n return Math.sqrt(x * x + y * y + z * z);\n}\n\n/**\n * Copy the values from one vec3 to another\n *\n * @param out the receiving vector\n * @param a the source vector\n * @returns out\n */\nexport function copy(out: Vec3, a: Vec3): Vec3 {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n return out;\n}\n\n/**\n * Set the components of a vec3 to the given values\n *\n * @param out the receiving vector\n * @param x X component\n * @param y Y component\n * @param z Z component\n * @returns out\n */\nexport function set(out: Vec3, x: number, y: number, z: number): Vec3 {\n out[0] = x;\n out[1] = y;\n out[2] = z;\n return out;\n}\n\n/**\n * Sets all components of a vec3 to the given scalar value\n *\n * @param out the receiving vector\n * @param s scalar value to set\n * @returns out\n */\nexport function setScalar(out: Vec3, s: number): Vec3 {\n out[0] = s;\n out[1] = s;\n out[2] = s;\n return out;\n}\n\n/**\n * Sets the components of a vec3 from a buffer\n * @param out the receiving vector\n * @param buffer the source buffer\n * @param startIndex the starting index in the buffer\n * @returns out\n */\nexport function fromBuffer(out: Vec3, buffer: ArrayLike<number>, startIndex: number): Vec3 {\n out[0] = buffer[startIndex];\n out[1] = buffer[startIndex + 1];\n out[2] = buffer[startIndex + 2];\n return out;\n}\n\n/**\n * Writes the components of a vec3 to a buffer\n * @param outBuffer The output buffer\n * @param vec The source vector\n * @param startIndex The starting index in the buffer\n * @returns The output buffer\n */\nexport function toBuffer(outBuffer: MutableArrayLike<number>, vec: Vec3, startIndex: number): MutableArrayLike<number> {\n outBuffer[startIndex] = vec[0];\n outBuffer[startIndex + 1] = vec[1];\n outBuffer[startIndex + 2] = vec[2];\n return outBuffer;\n}\n\n/**\n * Adds two vec3's\n *\n * @param out the receiving vector\n * @param a the first operand\n * @param b the second operand\n * @returns out\n */\nexport function add(out: Vec3, a: Vec3, b: Vec3): Vec3 {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n return out;\n}\n\n/**\n * Adds a scalar value to all components of a vec3\n *\n * @param out the receiving vector\n * @param a the source vector\n * @param b the scalar value to add\n * @returns out\n */\nexport function addScalar(out: Vec3, a: Vec3, b: number): Vec3 {\n out[0] = a[0] + b;\n out[1] = a[1] + b;\n out[2] = a[2] + b;\n return out;\n}\n\n/**\n * Subtracts vector b from vector a\n *\n * @param out the receiving vector\n * @param a the first operand\n * @param b the second operand\n * @returns out\n */\nexport function subtract(out: Vec3, a: Vec3, b: Vec3): Vec3 {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n return out;\n}\n\n/**\n * Subtracts a scalar value from all components of a vec3\n *\n * @param out the receiving vector\n * @param a the source vector\n * @param b the scalar value to subtract\n * @returns out\n */\nexport function subtractScalar(out: Vec3, a: Vec3, b: number): Vec3 {\n out[0] = a[0] - b;\n out[1] = a[1] - b;\n out[2] = a[2] - b;\n return out;\n}\n/**\n * Multiplies two vec3's\n *\n * @param out the receiving vector\n * @param a the first operand\n * @param b the second operand\n * @returns out\n */\nexport function multiply(out: Vec3, a: Vec3, b: Vec3): Vec3 {\n out[0] = a[0] * b[0];\n out[1] = a[1] * b[1];\n out[2] = a[2] * b[2];\n return out;\n}\n\n/**\n * Divides two vec3's\n *\n * @param out the receiving vector\n * @param a the first operand\n * @param b the second operand\n * @returns out\n */\nexport function divide(out: Vec3, a: Vec3, b: Vec3): Vec3 {\n out[0] = a[0] / b[0];\n out[1] = a[1] / b[1];\n out[2] = a[2] / b[2];\n return out;\n}\n\n/**\n * Math.ceil the components of a vec3\n *\n * @param out the receiving vector\n * @param a vector to ceil\n * @returns out\n */\nexport function ceil(out: Vec3, a: Vec3): Vec3 {\n out[0] = Math.ceil(a[0]);\n out[1] = Math.ceil(a[1]);\n out[2] = Math.ceil(a[2]);\n return out;\n}\n\n/**\n * Math.floor the components of a vec3\n *\n * @param out the receiving vector\n * @param a vector to floor\n * @returns out\n */\nexport function floor(out: Vec3, a: Vec3): Vec3 {\n out[0] = Math.floor(a[0]);\n out[1] = Math.floor(a[1]);\n out[2] = Math.floor(a[2]);\n return out;\n}\n\n/**\n * Returns the minimum of two vec3's\n *\n * @param out the receiving vector\n * @param a the first operand\n * @param b the second operand\n * @returns out\n */\nexport function min(out: Vec3, a: Vec3, b: Vec3): Vec3 {\n out[0] = Math.min(a[0], b[0]);\n out[1] = Math.min(a[1], b[1]);\n out[2] = Math.min(a[2], b[2]);\n return out;\n}\n\n/**\n * Returns the maximum of two vec3's\n *\n * @param out the receiving vector\n * @param a the first operand\n * @param b the second operand\n * @returns out\n */\nexport function max(out: Vec3, a: Vec3, b: Vec3): Vec3 {\n out[0] = Math.max(a[0], b[0]);\n out[1] = Math.max(a[1], b[1]);\n out[2] = Math.max(a[2], b[2]);\n return out;\n}\n\n/**\n * symmetric round the components of a vec3\n *\n * @param out the receiving vector\n * @param a vector to round\n * @returns out\n */\nexport function round(out: Vec3, a: Vec3): Vec3 {\n out[0] = scalar.round(a[0]);\n out[1] = scalar.round(a[1]);\n out[2] = scalar.round(a[2]);\n return out;\n}\n\n/**\n * Scales a vec3 by a scalar number\n *\n * @param out the receiving vector\n * @param a the vector to scale\n * @param b amount to scale the vector by\n * @returns out\n */\nexport function scale(out: Vec3, a: Vec3, b: number): Vec3 {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n return out;\n}\n\n/**\n * Adds two vec3's after scaling the second operand by a scalar value\n *\n * @param out the receiving vector\n * @param a the first operand\n * @param b the second operand\n * @param scale the amount to scale b by before adding\n * @returns out\n */\nexport function scaleAndAdd(out: Vec3, a: Vec3, b: Vec3, scale: number): Vec3 {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n out[2] = a[2] + b[2] * scale;\n return out;\n}\n\n/**\n * Calculates the euclidian distance between two vec3's\n *\n * @param a the first operand\n * @param b the second operand\n * @returns distance between a and b\n */\nexport function distance(a: Vec3, b: Vec3): number {\n const x = b[0] - a[0];\n const y = b[1] - a[1];\n const z = b[2] - a[2];\n return Math.sqrt(x * x + y * y + z * z);\n}\n\n/**\n * Calculates the squared euclidian distance between two vec3's\n *\n * @param a the first operand\n * @param b the second operand\n * @returns squared distance between a and b\n */\nexport function squaredDistance(a: Vec3, b: Vec3): number {\n const x = b[0] - a[0];\n const y = b[1] - a[1];\n const z = b[2] - a[2];\n return x * x + y * y + z * z;\n}\n\n/**\n * Calculates the squared length of a vec3\n *\n * @param a vector to calculate squared length of\n * @returns squared length of a\n */\nexport function squaredLength(a: Vec3): number {\n const x = a[0];\n const y = a[1];\n const z = a[2];\n return x * x + y * y + z * z;\n}\n\n/**\n * Negates the components of a vec3\n *\n * @param out the receiving vector\n * @param a vector to negate\n * @returns out\n */\nexport function negate(out: Vec3, a: Vec3): Vec3 {\n out[0] = -a[0];\n out[1] = -a[1];\n out[2] = -a[2];\n return out;\n}\n\n/**\n * Returns the inverse of the components of a vec3\n *\n * @param out the receiving vector\n * @param a vector to invert\n * @returns out\n */\nexport function inverse(out: Vec3, a: Vec3): Vec3 {\n out[0] = 1.0 / a[0];\n out[1] = 1.0 / a[1];\n out[2] = 1.0 / a[2];\n return out;\n}\n\n/**\n * Normalize a vec3\n *\n * @param out the receiving vector\n * @param a vector to normalize\n * @returns out\n */\nexport function normalize(out: Vec3, a: Vec3): Vec3 {\n const x = a[0];\n const y = a[1];\n const z = a[2];\n let len = x * x + y * y + z * z;\n if (len > 0) {\n len = 1 / Math.sqrt(len);\n }\n out[0] = a[0] * len;\n out[1] = a[1] * len;\n out[2] = a[2] * len;\n return out;\n}\n\n/**\n * Calculates the dot product of two vec3's\n *\n * @param a the first operand\n * @param b the second operand\n * @returns dot product of a and b\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 cross product of two vec3's\n *\n * @param out the receiving vector\n * @param a the first operand\n * @param b the second operand\n * @returns out\n */\nexport function cross(out: Vec3, a: Vec3, b: Vec3): Vec3 {\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\n out[0] = ay * bz - az * by;\n out[1] = az * bx - ax * bz;\n out[2] = ax * by - ay * bx;\n return out;\n}\n\n/**\n * Calculates a normalized perpendicular vector to the given vector.\n * Useful for finding an arbitrary orthogonal basis vector.\n *\n * The zero vector has no unique perpendicular - every direction qualifies - so it returns the X\n * axis rather than NaN.\n *\n * @param out the receiving vector\n * @param a the source vector\n * @returns the out vector\n */\nexport function perpendicular(out: Vec3, a: Vec3): Vec3 {\n if (Math.abs(a[0]) > Math.abs(a[1])) {\n const len = Math.sqrt(a[0] * a[0] + a[2] * a[2]);\n const invLen = 1.0 / len;\n out[0] = a[2] * invLen;\n out[1] = 0;\n out[2] = -a[0] * invLen;\n } else {\n const len = Math.sqrt(a[1] * a[1] + a[2] * a[2]);\n\n if (len === 0) {\n // the zero vector, the only input that reaches here with no length. every direction is\n // perpendicular to it, so return one rather than dividing by zero into NaN\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n return out;\n }\n\n const invLen = 1.0 / len;\n out[0] = 0;\n out[1] = a[2] * invLen;\n out[2] = -a[1] * invLen;\n }\n return out;\n}\n\n/**\n * Performs a linear interpolation between two vec3's\n *\n * @param out the receiving vector\n * @param a the first operand\n * @param b the second operand\n * @param t interpolation amount, in the range [0-1], between the two inputs\n * @returns out\n */\nexport function lerp(out: Vec3, a: Vec3, b: Vec3, t: number): Vec3 {\n const ax = a[0];\n const ay = a[1];\n const az = a[2];\n out[0] = ax + t * (b[0] - ax);\n out[1] = ay + t * (b[1] - ay);\n out[2] = az + t * (b[2] - az);\n return out;\n}\n\n/**\n * Quadratic interpolation through three vectors using Lagrange interpolation.\n * Passes through a at t=0, b at t=0.5, and c at t=1.\n *\n * @param out the receiving vector\n * @param a vector at t=0\n * @param b vector at t=0.5\n * @param c vector at t=1\n * @param t interpolation amount\n * @returns out\n */\nexport function lagrange(out: Vec3, a: Vec3, b: Vec3, c: Vec3, t: number): Vec3 {\n const c0 = 2 * (t - 1) * (t - 0.5);\n const c1 = -4 * (t - 1) * t;\n const c2 = 2 * (t - 0.5) * t;\n out[0] = c0 * a[0] + c1 * b[0] + c2 * c[0];\n out[1] = c0 * a[1] + c1 * b[1] + c2 * c[1];\n out[2] = c0 * a[2] + c1 * b[2] + c2 * c[2];\n return out;\n}\n\n/**\n * Performs a spherical linear interpolation between two vec3's\n *\n * @param out the receiving vector\n * @param a the first operand\n * @param b the second operand\n * @param t interpolation amount, in the range [0-1], between the two inputs\n * @returns out\n */\nexport function slerp(out: Vec3, a: Vec3, b: Vec3, t: number): Vec3 {\n const angle = Math.acos(Math.min(Math.max(dot(a, b), -1), 1));\n const sinTotal = Math.sin(angle);\n\n const ratioA = Math.sin((1 - t) * angle) / sinTotal;\n const ratioB = Math.sin(t * angle) / sinTotal;\n out[0] = ratioA * a[0] + ratioB * b[0];\n out[1] = ratioA * a[1] + ratioB * b[1];\n out[2] = ratioA * a[2] + ratioB * b[2];\n\n return out;\n}\n\n/**\n * Performs a hermite interpolation with two control points\n *\n * @param out the receiving vector\n * @param a the first operand\n * @param b the second operand\n * @param c the third operand\n * @param d the fourth operand\n * @param t interpolation amount, in the range [0-1], between the two inputs\n * @returns out\n */\nexport function hermite(out: Vec3, a: Vec3, b: Vec3, c: Vec3, d: Vec3, t: number): Vec3 {\n const factorTimes2 = t * t;\n const factor1 = factorTimes2 * (2 * t - 3) + 1;\n const factor2 = factorTimes2 * (t - 2) + t;\n const factor3 = factorTimes2 * (t - 1);\n const factor4 = factorTimes2 * (3 - 2 * t);\n\n out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;\n out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;\n out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;\n\n return out;\n}\n\n/**\n * Performs a bezier interpolation with two control points\n *\n * @param out the receiving vector\n * @param a the first operand\n * @param b the second operand\n * @param c the third operand\n * @param d the fourth operand\n * @param t interpolation amount, in the range [0-1], between the two inputs\n * @returns out\n */\nexport function bezier(out: Vec3, a: Vec3, b: Vec3, c: Vec3, d: Vec3, t: number): Vec3 {\n const inverseFactor = 1 - t;\n const inverseFactorTimesTwo = inverseFactor * inverseFactor;\n const factorTimes2 = t * t;\n const factor1 = inverseFactorTimesTwo * inverseFactor;\n const factor2 = 3 * t * inverseFactorTimesTwo;\n const factor3 = 3 * factorTimes2 * inverseFactor;\n const factor4 = factorTimes2 * t;\n\n out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;\n out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;\n out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;\n\n return out;\n}\n\n/**\n * Transforms the vec3 with a mat4.\n * 4th vector component is implicitly '1'\n *\n * @param out the receiving vector\n * @param a the vector to transform\n * @param m matrix to transform with\n * @returns out\n */\nexport function transformMat4(out: Vec3, a: Vec3, m: Mat4): Vec3 {\n const x = a[0];\n const y = a[1];\n const z = a[2];\n let w = m[3] * x + m[7] * y + m[11] * z + m[15];\n w = w || 1.0;\n out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;\n out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;\n out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;\n return out;\n}\n\n/**\n * Transforms the vec3 with a mat3.\n *\n * @param out the receiving vector\n * @param a the vector to transform\n * @param m the 3x3 matrix to transform with\n * @returns out\n */\nexport function transformMat3(out: Vec3, a: Vec3, m: Mat3): Vec3 {\n const x = a[0];\n const y = a[1];\n const z = a[2];\n out[0] = x * m[0] + y * m[3] + z * m[6];\n out[1] = x * m[1] + y * m[4] + z * m[7];\n out[2] = x * m[2] + y * m[5] + z * m[8];\n return out;\n}\n\n/**\n * Transforms the vec3 with a quat\n * Can also be used for dual quaternions. (Multiply it with the real part)\n *\n * @param out the receiving vector\n * @param a the vector to transform\n * @param q quaternion to transform with\n * @returns out\n */\nexport function transformQuat(out: Vec3, a: Vec3, q: Quat): Vec3 {\n // benchmarks: https://jsperf.com/quaternion-transform-vec3-implementations-fixed\n const qx = q[0];\n const qy = q[1];\n const qz = q[2];\n const qw = q[3];\n const x = a[0];\n const y = a[1];\n const z = a[2];\n // var qvec = [qx, qy, qz];\n // var uv = vec3.cross([], qvec, a);\n let uvx = qy * z - qz * y;\n let uvy = qz * x - qx * z;\n let uvz = qx * y - qy * x;\n // var uuv = vec3.cross([], qvec, uv);\n let uuvx = qy * uvz - qz * uvy;\n let uuvy = qz * uvx - qx * uvz;\n let uuvz = qx * uvy - qy * uvx;\n // vec3.scale(uv, uv, 2 * w);\n const w2 = qw * 2;\n uvx *= w2;\n uvy *= w2;\n uvz *= w2;\n // vec3.scale(uuv, uuv, 2);\n uuvx *= 2;\n uuvy *= 2;\n uuvz *= 2;\n // return vec3.add(out, a, vec3.add(out, uv, uuv));\n out[0] = x + uvx + uuvx;\n out[1] = y + uvy + uuvy;\n out[2] = z + uvz + uuvz;\n return out;\n}\n\n/**\n * Rotate a 3D vector around the x-axis\n * @param out The receiving vec3\n * @param a The vec3 point to rotate\n * @param b The origin of the rotation\n * @param rad The angle of rotation in radians\n * @returns out\n */\nexport function rotateX(out: Vec3, a: Vec3, b: Vec3, rad: number): Vec3 {\n const p: number[] = [];\n const r: number[] = [];\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 out[0] = r[0] + b[0];\n out[1] = r[1] + b[1];\n out[2] = r[2] + b[2];\n\n return out;\n}\n\n/**\n * Rotate a 3D vector around the y-axis\n * @param out The receiving vec3\n * @param a The vec3 point to rotate\n * @param b The origin of the rotation\n * @param rad The angle of rotation in radians\n * @returns out\n */\nexport function rotateY(out: Vec3, a: Vec3, b: Vec3, rad: number): Vec3 {\n const p: number[] = [];\n const r: number[] = [];\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 out[0] = r[0] + b[0];\n out[1] = r[1] + b[1];\n out[2] = r[2] + b[2];\n\n return out;\n}\n\n/**\n * Rotate a 3D vector around the z-axis\n * @param out The receiving vec3\n * @param a The vec3 point to rotate\n * @param b The origin of the rotation\n * @param rad The angle of rotation in radians\n * @returns out\n */\nexport function rotateZ(out: Vec3, a: Vec3, b: Vec3, rad: number): Vec3 {\n const p: number[] = [];\n const r: number[] = [];\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 out[0] = r[0] + b[0];\n out[1] = r[1] + b[1];\n out[2] = r[2] + b[2];\n\n return out;\n}\n\n/**\n * Get the angle between two 3D vectors\n * @param a The first operand\n * @param b The second operand\n * @returns The angle in radians\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 mag = Math.sqrt((ax * ax + ay * ay + az * az) * (bx * bx + by * by + bz * bz));\n const cosine = mag && dot(a, b) / mag;\n return Math.acos(Math.min(Math.max(cosine, -1), 1));\n}\n\n/**\n * Get the signed angle from `a` to `b` measured about `axis`, in the range (-PI, PI].\n *\n * Positive is counter-clockwise when `axis` points toward the viewer. Only the components of\n * `a` and `b` in the plane perpendicular to `axis` contribute, so they need not be\n * perpendicular to it. Returns 0 if either projects to the zero vector.\n *\n * Unlike {@link angle}, this distinguishes the two directions of rotation, which is what\n * hinge limits and turn directions need.\n *\n * @param a the first operand\n * @param b the second operand\n * @param axis the axis to measure the rotation about, assumed to be unit length\n * @returns the signed angle in radians\n */\nexport function signedAngle(a: Vec3, b: Vec3, axis: Vec3): number {\n const nx = axis[0];\n const ny = axis[1];\n const nz = axis[2];\n\n // drop the components along the axis - they carry no signed angle\n const ad = a[0] * nx + a[1] * ny + a[2] * nz;\n const ax = a[0] - nx * ad;\n const ay = a[1] - ny * ad;\n const az = a[2] - nz * ad;\n\n const bd = b[0] * nx + b[1] * ny + b[2] * nz;\n const bx = b[0] - nx * bd;\n const by = b[1] - ny * bd;\n const bz = b[2] - nz * bd;\n\n // (a x b) . axis is |a||b|sin(theta), a . b is |a||b|cos(theta)\n const cx = ay * bz - az * by;\n const cy = az * bx - ax * bz;\n const cz = ax * by - ay * bx;\n\n return Math.atan2(cx * nx + cy * ny + cz * nz, ax * bx + ay * by + az * bz);\n}\n\nconst _rotateTowards_axis: Vec3 = [0, 0, 0];\n\n/**\n * Rotates the unit vector `from` toward the unit vector `to` by at most `maxAngle` radians.\n *\n * When the two are already within `maxAngle` this copies `to`, so the function doubles as a\n * cone clamp: the result is `to`, limited to lie within `maxAngle` of `from`. That is the form\n * a rotor joint limit and a per-frame turn rate both want.\n *\n * Both inputs are assumed to be unit length, and the result is unit length. `maxAngle` is treated\n * as 0 if negative. When the inputs are exactly antiparallel the rotation plane is undefined\n * and an arbitrary perpendicular is used.\n *\n * @param out the receiving vector\n * @param from the unit vector to rotate away from\n * @param to the unit vector to rotate toward\n * @param maxAngle the maximum rotation, in radians\n * @returns out\n */\nexport function rotateTowards(out: Vec3, from: Vec3, to: Vec3, maxAngle: number): Vec3 {\n const fx = from[0];\n const fy = from[1];\n const fz = from[2];\n const tx = to[0];\n const ty = to[1];\n const tz = to[2];\n\n const cosine = Math.min(Math.max(fx * tx + fy * ty + fz * tz, -1), 1);\n\n const limit = maxAngle > 0 ? maxAngle : 0;\n\n if (Math.acos(cosine) <= limit) {\n out[0] = tx;\n out[1] = ty;\n out[2] = tz;\n return out;\n }\n\n // the rotation plane is spanned by the two vectors, so its normal is their cross product\n let axisX = fy * tz - fz * ty;\n let axisY = fz * tx - fx * tz;\n let axisZ = fx * ty - fy * tx;\n const axisLength = Math.sqrt(axisX * axisX + axisY * axisY + axisZ * axisZ);\n\n if (axisLength < 1e-8) {\n // antiparallel: every plane containing `from` is equally valid, so pick one\n perpendicular(_rotateTowards_axis, from);\n axisX = _rotateTowards_axis[0];\n axisY = _rotateTowards_axis[1];\n axisZ = _rotateTowards_axis[2];\n } else {\n const inverseLength = 1 / axisLength;\n axisX *= inverseLength;\n axisY *= inverseLength;\n axisZ *= inverseLength;\n }\n\n // rodrigues rotation of `from` about `axis`\n const c = Math.cos(limit);\n const s = Math.sin(limit);\n const d = (axisX * fx + axisY * fy + axisZ * fz) * (1 - c);\n\n out[0] = fx * c + (axisY * fz - axisZ * fy) * s + axisX * d;\n out[1] = fy * c + (axisZ * fx - axisX * fz) * s + axisY * d;\n out[2] = fz * c + (axisX * fy - axisY * fx) * s + axisZ * d;\n\n return out;\n}\n\n/**\n * Set the components of a vec3 to zero\n *\n * @param out the receiving vector\n * @returns out\n */\nexport function zero(out: Vec3): Vec3 {\n out[0] = 0.0;\n out[1] = 0.0;\n out[2] = 0.0;\n return out;\n}\n\n/**\n * Returns a string representation of a vector\n *\n * @param a vector to represent as a string\n * @returns string representation of the vector\n */\nexport function str(a: Vec3): string {\n return `vec3(${a[0]}, ${a[1]}, ${a[2]})`;\n}\n\n/**\n * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===)\n *\n * @param a The first vector.\n * @param b The second vector.\n * @returns True if the vectors are equal, false otherwise.\n */\nexport function exactEquals(a: Vec3, b: Vec3): boolean {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2];\n}\n\n/**\n * Returns whether or not the vectors have approximately the same elements in the same position.\n *\n * @param a The first vector.\n * @param b The second vector.\n * @returns True if the vectors are equal, false otherwise.\n */\nexport function equals(a: Vec3, b: Vec3): boolean {\n const a0 = a[0];\n const a1 = a[1];\n const a2 = a[2];\n const b0 = b[0];\n const b1 = b[1];\n const b2 = b[2];\n return (\n Math.abs(a0 - b0) <= scalar.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&\n Math.abs(a1 - b1) <= scalar.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) &&\n Math.abs(a2 - b2) <= scalar.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2))\n );\n}\n\n/**\n * Returns whether or not the vector is finite\n * @param a vector to test\n * @returns whether or not the vector is finite\n */\nexport function finite(a: Vec3): boolean {\n return Number.isFinite(a[0]) && Number.isFinite(a[1]) && Number.isFinite(a[2]);\n}\n\n/**\n * Determines if a scale vector represents an inside-out transformation (reflection)\n * Returns true if an odd number of scale components are negative\n *\n * @param scale The scale vector to test\n * @returns true if the scale represents a reflection (odd number of negative components)\n */\nexport function isScaleInsideOut(scale: Vec3): boolean {\n // create a bitmask of which components are negative\n // each component that is < 0 contributes a bit (1, 2, or 4)\n const mask = (scale[0] < 0 ? 1 : 0) | (scale[1] < 0 ? 2 : 0) | (scale[2] < 0 ? 4 : 0);\n\n // count the number of set bits and return true if odd\n // popcount: count number of 1-bits in the mask\n let count = 0;\n let m = mask;\n while (m) {\n count += m & 1;\n m >>= 1;\n }\n return (count & 1) !== 0;\n}\n\n/**\n * Alias for {@link subtract}\n */\nexport const sub = subtract;\n\n/**\n * Alias for {@link multiply}\n */\nexport const mul = multiply;\n\n/**\n * Alias for {@link divide}\n */\nexport const div = divide;\n\n/**\n * Alias for {@link distance}\n */\nexport const dist = distance;\n\n/**\n * Alias for {@link squaredDistance}\n */\nexport const sqrDist = squaredDistance;\n\n/**\n * Alias for {@link length}\n */\nexport const len = length;\n\n/**\n * Alias for {@link squaredLength}\n */\nexport const sqrLen = squaredLength;\n"],"names":["scalar.round","scalar.EPSILON"],"mappings":";;AASA;;;;AAIG;SACa,MAAM,GAAA;AAClB,IA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AMG;AACG,SAAU,gBAAgB,CAAC,KAAW,EAAA;;;IAGxC,MAAM,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;;;IAIrF,IAAI,KAAK,GAAG,CAAC;IACb,IAAI,CAAC,GAAG,IAAI;IACZ,OAAO,CAAC,EAAE;AACN,QAAA,KAAK,IAAI,CAAC,GAAG,CAAC;QACd,CAAC,KAAK,CAAC;IACX;AACA,IAAA,OAAO,CAAC,KAAK,GAAG,CAAC,MAAM,CAAC;AAC5B;AAEA;;AAEG;AACI,MAAM,GAAG,GAAG;AAEnB;;AAEG;AACI,MAAM,GAAG,GAAG;AAEnB;;AAEG;AACI,MAAM,GAAG,GAAG;AAEnB;;AAEG;AACI,MAAM,IAAI,GAAG;AAEpB;;AAEG;AACI,MAAM,OAAO,GAAG;AAEvB;;AAEG;AACI,MAAM,GAAG,GAAG;AAEnB;;AAEG;AACI,MAAM,MAAM,GAAG;;;;"}
|
|
@@ -0,0 +1,573 @@
|
|
|
1
|
+
import { EPSILON, round as round$1 } from './scalar.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Creates a new, empty vec4
|
|
5
|
+
*
|
|
6
|
+
* @returns a new 4D vector
|
|
7
|
+
*/
|
|
8
|
+
function create() {
|
|
9
|
+
return [0, 0, 0, 0];
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Creates a new vec4 initialized with values from an existing vector
|
|
13
|
+
*
|
|
14
|
+
* @param a vector to clone
|
|
15
|
+
* @returns a new 4D vector
|
|
16
|
+
*/
|
|
17
|
+
function clone(a) {
|
|
18
|
+
return [a[0], a[1], a[2], a[3]];
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Creates a new vec4 initialized with the given values
|
|
22
|
+
*
|
|
23
|
+
* @param x X component
|
|
24
|
+
* @param y Y component
|
|
25
|
+
* @param z Z component
|
|
26
|
+
* @param w W component
|
|
27
|
+
* @returns a new 4D vector
|
|
28
|
+
*/
|
|
29
|
+
function fromValues(x, y, z, w) {
|
|
30
|
+
return [x, y, z, w];
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Copy the values from one vec4 to another
|
|
34
|
+
*
|
|
35
|
+
* @param out the receiving vector
|
|
36
|
+
* @param a the source vector
|
|
37
|
+
* @returns out
|
|
38
|
+
*/
|
|
39
|
+
function copy(out, a) {
|
|
40
|
+
out[0] = a[0];
|
|
41
|
+
out[1] = a[1];
|
|
42
|
+
out[2] = a[2];
|
|
43
|
+
out[3] = a[3];
|
|
44
|
+
return out;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Set the components of a vec4 to the given values
|
|
48
|
+
*
|
|
49
|
+
* @param out the receiving vector
|
|
50
|
+
* @param x X component
|
|
51
|
+
* @param y Y component
|
|
52
|
+
* @param z Z component
|
|
53
|
+
* @param w W component
|
|
54
|
+
* @returns out
|
|
55
|
+
*/
|
|
56
|
+
function set(out, x, y, z, w) {
|
|
57
|
+
out[0] = x;
|
|
58
|
+
out[1] = y;
|
|
59
|
+
out[2] = z;
|
|
60
|
+
out[3] = w;
|
|
61
|
+
return out;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Sets the components of a vec4 from a buffer
|
|
65
|
+
* @param out the receiving vector
|
|
66
|
+
* @param buffer the source buffer
|
|
67
|
+
* @param startIndex the starting index in the buffer
|
|
68
|
+
* @returns out
|
|
69
|
+
*/
|
|
70
|
+
function fromBuffer(out, buffer, startIndex) {
|
|
71
|
+
out[0] = buffer[startIndex];
|
|
72
|
+
out[1] = buffer[startIndex + 1];
|
|
73
|
+
out[2] = buffer[startIndex + 2];
|
|
74
|
+
out[3] = buffer[startIndex + 3];
|
|
75
|
+
return out;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Writes the components of a vec4 to a buffer
|
|
79
|
+
* @param outBuffer The output buffer
|
|
80
|
+
* @param vec The source vector
|
|
81
|
+
* @param startIndex The starting index in the buffer
|
|
82
|
+
* @returns The output buffer
|
|
83
|
+
*/
|
|
84
|
+
function toBuffer(outBuffer, vec, startIndex) {
|
|
85
|
+
outBuffer[startIndex] = vec[0];
|
|
86
|
+
outBuffer[startIndex + 1] = vec[1];
|
|
87
|
+
outBuffer[startIndex + 2] = vec[2];
|
|
88
|
+
outBuffer[startIndex + 3] = vec[3];
|
|
89
|
+
return outBuffer;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Adds two vec4's
|
|
93
|
+
*
|
|
94
|
+
* @param out the receiving vector
|
|
95
|
+
* @param a the first operand
|
|
96
|
+
* @param b the second operand
|
|
97
|
+
* @returns out
|
|
98
|
+
*/
|
|
99
|
+
function add(out, a, b) {
|
|
100
|
+
out[0] = a[0] + b[0];
|
|
101
|
+
out[1] = a[1] + b[1];
|
|
102
|
+
out[2] = a[2] + b[2];
|
|
103
|
+
out[3] = a[3] + b[3];
|
|
104
|
+
return out;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Subtracts vector b from vector a
|
|
108
|
+
*
|
|
109
|
+
* @param out the receiving vector
|
|
110
|
+
* @param a the first operand
|
|
111
|
+
* @param b the second operand
|
|
112
|
+
* @returns out
|
|
113
|
+
*/
|
|
114
|
+
function subtract(out, a, b) {
|
|
115
|
+
out[0] = a[0] - b[0];
|
|
116
|
+
out[1] = a[1] - b[1];
|
|
117
|
+
out[2] = a[2] - b[2];
|
|
118
|
+
out[3] = a[3] - b[3];
|
|
119
|
+
return out;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Multiplies two vec4's
|
|
123
|
+
*
|
|
124
|
+
* @param out the receiving vector
|
|
125
|
+
* @param a the first operand
|
|
126
|
+
* @param b the second operand
|
|
127
|
+
* @returns out
|
|
128
|
+
*/
|
|
129
|
+
function multiply(out, a, b) {
|
|
130
|
+
out[0] = a[0] * b[0];
|
|
131
|
+
out[1] = a[1] * b[1];
|
|
132
|
+
out[2] = a[2] * b[2];
|
|
133
|
+
out[3] = a[3] * b[3];
|
|
134
|
+
return out;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Divides two vec4's
|
|
138
|
+
*
|
|
139
|
+
* @param out the receiving vector
|
|
140
|
+
* @param a the first operand
|
|
141
|
+
* @param b the second operand
|
|
142
|
+
* @returns out
|
|
143
|
+
*/
|
|
144
|
+
function divide(out, a, b) {
|
|
145
|
+
out[0] = a[0] / b[0];
|
|
146
|
+
out[1] = a[1] / b[1];
|
|
147
|
+
out[2] = a[2] / b[2];
|
|
148
|
+
out[3] = a[3] / b[3];
|
|
149
|
+
return out;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Math.ceil the components of a vec4
|
|
153
|
+
*
|
|
154
|
+
* @param out the receiving vector
|
|
155
|
+
* @param a vector to ceil
|
|
156
|
+
* @returns out
|
|
157
|
+
*/
|
|
158
|
+
function ceil(out, a) {
|
|
159
|
+
out[0] = Math.ceil(a[0]);
|
|
160
|
+
out[1] = Math.ceil(a[1]);
|
|
161
|
+
out[2] = Math.ceil(a[2]);
|
|
162
|
+
out[3] = Math.ceil(a[3]);
|
|
163
|
+
return out;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Math.floor the components of a vec4
|
|
167
|
+
*
|
|
168
|
+
* @param out the receiving vector
|
|
169
|
+
* @param a vector to floor
|
|
170
|
+
* @returns out
|
|
171
|
+
*/
|
|
172
|
+
function floor(out, a) {
|
|
173
|
+
out[0] = Math.floor(a[0]);
|
|
174
|
+
out[1] = Math.floor(a[1]);
|
|
175
|
+
out[2] = Math.floor(a[2]);
|
|
176
|
+
out[3] = Math.floor(a[3]);
|
|
177
|
+
return out;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Returns the minimum of two vec4's
|
|
181
|
+
*
|
|
182
|
+
* @param out the receiving vector
|
|
183
|
+
* @param a the first operand
|
|
184
|
+
* @param b the second operand
|
|
185
|
+
* @returns out
|
|
186
|
+
*/
|
|
187
|
+
function min(out, a, b) {
|
|
188
|
+
out[0] = Math.min(a[0], b[0]);
|
|
189
|
+
out[1] = Math.min(a[1], b[1]);
|
|
190
|
+
out[2] = Math.min(a[2], b[2]);
|
|
191
|
+
out[3] = Math.min(a[3], b[3]);
|
|
192
|
+
return out;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Returns the maximum of two vec4's
|
|
196
|
+
*
|
|
197
|
+
* @param out the receiving vector
|
|
198
|
+
* @param a the first operand
|
|
199
|
+
* @param b the second operand
|
|
200
|
+
* @returns out
|
|
201
|
+
*/
|
|
202
|
+
function max(out, a, b) {
|
|
203
|
+
out[0] = Math.max(a[0], b[0]);
|
|
204
|
+
out[1] = Math.max(a[1], b[1]);
|
|
205
|
+
out[2] = Math.max(a[2], b[2]);
|
|
206
|
+
out[3] = Math.max(a[3], b[3]);
|
|
207
|
+
return out;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* symmetric round the components of a vec4
|
|
211
|
+
*
|
|
212
|
+
* @param out the receiving vector
|
|
213
|
+
* @param a vector to round
|
|
214
|
+
* @returns out
|
|
215
|
+
*/
|
|
216
|
+
function round(out, a) {
|
|
217
|
+
out[0] = round$1(a[0]);
|
|
218
|
+
out[1] = round$1(a[1]);
|
|
219
|
+
out[2] = round$1(a[2]);
|
|
220
|
+
out[3] = round$1(a[3]);
|
|
221
|
+
return out;
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Scales a vec4 by a scalar number
|
|
225
|
+
*
|
|
226
|
+
* @param out the receiving vector
|
|
227
|
+
* @param a the vector to scale
|
|
228
|
+
* @param b amount to scale the vector by
|
|
229
|
+
* @returns out
|
|
230
|
+
*/
|
|
231
|
+
function scale(out, a, b) {
|
|
232
|
+
out[0] = a[0] * b;
|
|
233
|
+
out[1] = a[1] * b;
|
|
234
|
+
out[2] = a[2] * b;
|
|
235
|
+
out[3] = a[3] * b;
|
|
236
|
+
return out;
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Adds two vec4's after scaling the second operand by a scalar value
|
|
240
|
+
*
|
|
241
|
+
* @param out the receiving vector
|
|
242
|
+
* @param a the first operand
|
|
243
|
+
* @param b the second operand
|
|
244
|
+
* @param scale the amount to scale b by before adding
|
|
245
|
+
* @returns out
|
|
246
|
+
*/
|
|
247
|
+
function scaleAndAdd(out, a, b, scale) {
|
|
248
|
+
out[0] = a[0] + b[0] * scale;
|
|
249
|
+
out[1] = a[1] + b[1] * scale;
|
|
250
|
+
out[2] = a[2] + b[2] * scale;
|
|
251
|
+
out[3] = a[3] + b[3] * scale;
|
|
252
|
+
return out;
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Calculates the euclidian distance between two vec4's
|
|
256
|
+
*
|
|
257
|
+
* @param a the first operand
|
|
258
|
+
* @param b the second operand
|
|
259
|
+
* @returns distance between a and b
|
|
260
|
+
*/
|
|
261
|
+
function distance(a, b) {
|
|
262
|
+
const x = b[0] - a[0];
|
|
263
|
+
const y = b[1] - a[1];
|
|
264
|
+
const z = b[2] - a[2];
|
|
265
|
+
const w = b[3] - a[3];
|
|
266
|
+
return Math.sqrt(x * x + y * y + z * z + w * w);
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Calculates the squared euclidian distance between two vec4's
|
|
270
|
+
*
|
|
271
|
+
* @param a the first operand
|
|
272
|
+
* @param b the second operand
|
|
273
|
+
* @returns squared distance between a and b
|
|
274
|
+
*/
|
|
275
|
+
function squaredDistance(a, b) {
|
|
276
|
+
const x = b[0] - a[0];
|
|
277
|
+
const y = b[1] - a[1];
|
|
278
|
+
const z = b[2] - a[2];
|
|
279
|
+
const w = b[3] - a[3];
|
|
280
|
+
return x * x + y * y + z * z + w * w;
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Calculates the length of a vec4
|
|
284
|
+
*
|
|
285
|
+
* @param a vector to calculate length of
|
|
286
|
+
* @returns length of a
|
|
287
|
+
*/
|
|
288
|
+
function length(a) {
|
|
289
|
+
const x = a[0];
|
|
290
|
+
const y = a[1];
|
|
291
|
+
const z = a[2];
|
|
292
|
+
const w = a[3];
|
|
293
|
+
return Math.sqrt(x * x + y * y + z * z + w * w);
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Calculates the squared length of a vec4
|
|
297
|
+
*
|
|
298
|
+
* @param a vector to calculate squared length of
|
|
299
|
+
* @returns squared length of a
|
|
300
|
+
*/
|
|
301
|
+
function squaredLength(a) {
|
|
302
|
+
const x = a[0];
|
|
303
|
+
const y = a[1];
|
|
304
|
+
const z = a[2];
|
|
305
|
+
const w = a[3];
|
|
306
|
+
return x * x + y * y + z * z + w * w;
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Negates the components of a vec4
|
|
310
|
+
*
|
|
311
|
+
* @param out the receiving vector
|
|
312
|
+
* @param a vector to negate
|
|
313
|
+
* @returns out
|
|
314
|
+
*/
|
|
315
|
+
function negate(out, a) {
|
|
316
|
+
out[0] = -a[0];
|
|
317
|
+
out[1] = -a[1];
|
|
318
|
+
out[2] = -a[2];
|
|
319
|
+
out[3] = -a[3];
|
|
320
|
+
return out;
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Returns the inverse of the components of a vec4
|
|
324
|
+
*
|
|
325
|
+
* @param out the receiving vector
|
|
326
|
+
* @param a vector to invert
|
|
327
|
+
* @returns out
|
|
328
|
+
*/
|
|
329
|
+
function inverse(out, a) {
|
|
330
|
+
out[0] = 1.0 / a[0];
|
|
331
|
+
out[1] = 1.0 / a[1];
|
|
332
|
+
out[2] = 1.0 / a[2];
|
|
333
|
+
out[3] = 1.0 / a[3];
|
|
334
|
+
return out;
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Normalize a vec4
|
|
338
|
+
*
|
|
339
|
+
* @param out the receiving vector
|
|
340
|
+
* @param a vector to normalize
|
|
341
|
+
* @returns out
|
|
342
|
+
*/
|
|
343
|
+
function normalize(out, a) {
|
|
344
|
+
const x = a[0];
|
|
345
|
+
const y = a[1];
|
|
346
|
+
const z = a[2];
|
|
347
|
+
const w = a[3];
|
|
348
|
+
let len = x * x + y * y + z * z + w * w;
|
|
349
|
+
if (len > 0) {
|
|
350
|
+
len = 1 / Math.sqrt(len);
|
|
351
|
+
}
|
|
352
|
+
out[0] = x * len;
|
|
353
|
+
out[1] = y * len;
|
|
354
|
+
out[2] = z * len;
|
|
355
|
+
out[3] = w * len;
|
|
356
|
+
return out;
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* Calculates the dot product of two vec4's
|
|
360
|
+
*
|
|
361
|
+
* @param a the first operand
|
|
362
|
+
* @param b the second operand
|
|
363
|
+
* @returns dot product of a and b
|
|
364
|
+
*/
|
|
365
|
+
function dot(a, b) {
|
|
366
|
+
return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* Returns the cross-product of three vectors in a 4-dimensional space
|
|
370
|
+
*
|
|
371
|
+
* @param out the receiving vector
|
|
372
|
+
* @param u the first vector
|
|
373
|
+
* @param v the second vector
|
|
374
|
+
* @param w the third vector
|
|
375
|
+
* @returns result
|
|
376
|
+
*/
|
|
377
|
+
function cross(out, u, v, w) {
|
|
378
|
+
const A = v[0] * w[1] - v[1] * w[0];
|
|
379
|
+
const B = v[0] * w[2] - v[2] * w[0];
|
|
380
|
+
const C = v[0] * w[3] - v[3] * w[0];
|
|
381
|
+
const D = v[1] * w[2] - v[2] * w[1];
|
|
382
|
+
const E = v[1] * w[3] - v[3] * w[1];
|
|
383
|
+
const F = v[2] * w[3] - v[3] * w[2];
|
|
384
|
+
const G = u[0];
|
|
385
|
+
const H = u[1];
|
|
386
|
+
const I = u[2];
|
|
387
|
+
const J = u[3];
|
|
388
|
+
out[0] = H * F - I * E + J * D;
|
|
389
|
+
out[1] = -(G * F) + I * C - J * B;
|
|
390
|
+
out[2] = G * E - H * C + J * A;
|
|
391
|
+
out[3] = -(G * D) + H * B - I * A;
|
|
392
|
+
return out;
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
* Performs a linear interpolation between two vec4's
|
|
396
|
+
*
|
|
397
|
+
* @param out the receiving vector
|
|
398
|
+
* @param a the first operand
|
|
399
|
+
* @param b the second operand
|
|
400
|
+
* @param t interpolation amount, in the range [0-1], between the two inputs
|
|
401
|
+
* @returns out
|
|
402
|
+
*/
|
|
403
|
+
function lerp(out, a, b, t) {
|
|
404
|
+
const ax = a[0];
|
|
405
|
+
const ay = a[1];
|
|
406
|
+
const az = a[2];
|
|
407
|
+
const aw = a[3];
|
|
408
|
+
out[0] = ax + t * (b[0] - ax);
|
|
409
|
+
out[1] = ay + t * (b[1] - ay);
|
|
410
|
+
out[2] = az + t * (b[2] - az);
|
|
411
|
+
out[3] = aw + t * (b[3] - aw);
|
|
412
|
+
return out;
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* Quadratic interpolation through three vectors using Lagrange interpolation.
|
|
416
|
+
* Passes through a at t=0, b at t=0.5, and c at t=1.
|
|
417
|
+
*
|
|
418
|
+
* @param out the receiving vector
|
|
419
|
+
* @param a vector at t=0
|
|
420
|
+
* @param b vector at t=0.5
|
|
421
|
+
* @param c vector at t=1
|
|
422
|
+
* @param t interpolation amount
|
|
423
|
+
* @returns out
|
|
424
|
+
*/
|
|
425
|
+
function lagrange(out, a, b, c, t) {
|
|
426
|
+
const c0 = 2 * (t - 1) * (t - 0.5);
|
|
427
|
+
const c1 = -4 * (t - 1) * t;
|
|
428
|
+
const c2 = 2 * (t - 0.5) * t;
|
|
429
|
+
out[0] = c0 * a[0] + c1 * b[0] + c2 * c[0];
|
|
430
|
+
out[1] = c0 * a[1] + c1 * b[1] + c2 * c[1];
|
|
431
|
+
out[2] = c0 * a[2] + c1 * b[2] + c2 * c[2];
|
|
432
|
+
out[3] = c0 * a[3] + c1 * b[3] + c2 * c[3];
|
|
433
|
+
return out;
|
|
434
|
+
}
|
|
435
|
+
/**
|
|
436
|
+
* Transforms the vec4 with a mat4.
|
|
437
|
+
*
|
|
438
|
+
* @param out the receiving vector
|
|
439
|
+
* @param a the vector to transform
|
|
440
|
+
* @param m matrix to transform with
|
|
441
|
+
* @returns out
|
|
442
|
+
*/
|
|
443
|
+
function transformMat4(out, a, m) {
|
|
444
|
+
const x = a[0];
|
|
445
|
+
const y = a[1];
|
|
446
|
+
const z = a[2];
|
|
447
|
+
const w = a[3];
|
|
448
|
+
out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w;
|
|
449
|
+
out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w;
|
|
450
|
+
out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;
|
|
451
|
+
out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;
|
|
452
|
+
return out;
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* Transforms the vec4 with a quat
|
|
456
|
+
*
|
|
457
|
+
* @param out the receiving vector
|
|
458
|
+
* @param a the vector to transform
|
|
459
|
+
* @param q quaternion to transform with
|
|
460
|
+
* @returns out
|
|
461
|
+
*/
|
|
462
|
+
function transformQuat(out, a, q) {
|
|
463
|
+
const x = a[0];
|
|
464
|
+
const y = a[1];
|
|
465
|
+
const z = a[2];
|
|
466
|
+
const qx = q[0];
|
|
467
|
+
const qy = q[1];
|
|
468
|
+
const qz = q[2];
|
|
469
|
+
const qw = q[3];
|
|
470
|
+
// calculate quat * vec
|
|
471
|
+
const ix = qw * x + qy * z - qz * y;
|
|
472
|
+
const iy = qw * y + qz * x - qx * z;
|
|
473
|
+
const iz = qw * z + qx * y - qy * x;
|
|
474
|
+
const iw = -qx * x - qy * y - qz * z;
|
|
475
|
+
// calculate result * inverse quat
|
|
476
|
+
out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy;
|
|
477
|
+
out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz;
|
|
478
|
+
out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx;
|
|
479
|
+
out[3] = a[3];
|
|
480
|
+
return out;
|
|
481
|
+
}
|
|
482
|
+
/**
|
|
483
|
+
* Set the components of a vec4 to zero
|
|
484
|
+
*
|
|
485
|
+
* @param out the receiving vector
|
|
486
|
+
* @returns out
|
|
487
|
+
*/
|
|
488
|
+
function zero(out) {
|
|
489
|
+
out[0] = 0.0;
|
|
490
|
+
out[1] = 0.0;
|
|
491
|
+
out[2] = 0.0;
|
|
492
|
+
out[3] = 0.0;
|
|
493
|
+
return out;
|
|
494
|
+
}
|
|
495
|
+
/**
|
|
496
|
+
* Returns a string representation of a vector
|
|
497
|
+
*
|
|
498
|
+
* @param a vector to represent as a string
|
|
499
|
+
* @returns string representation of the vector
|
|
500
|
+
*/
|
|
501
|
+
function str(a) {
|
|
502
|
+
return `vec4(${a[0]}, ${a[1]}, ${a[2]}, ${a[3]})`;
|
|
503
|
+
}
|
|
504
|
+
/**
|
|
505
|
+
* Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===)
|
|
506
|
+
*
|
|
507
|
+
* @param a The first vector.
|
|
508
|
+
* @param b The second vector.
|
|
509
|
+
* @returns True if the vectors are equal, false otherwise.
|
|
510
|
+
*/
|
|
511
|
+
function exactEquals(a, b) {
|
|
512
|
+
return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3];
|
|
513
|
+
}
|
|
514
|
+
/**
|
|
515
|
+
* Returns whether or not the vectors have approximately the same elements in the same position.
|
|
516
|
+
*
|
|
517
|
+
* @param a The first vector.
|
|
518
|
+
* @param b The second vector.
|
|
519
|
+
* @returns True if the vectors are equal, false otherwise.
|
|
520
|
+
*/
|
|
521
|
+
function equals(a, b) {
|
|
522
|
+
const a0 = a[0];
|
|
523
|
+
const a1 = a[1];
|
|
524
|
+
const a2 = a[2];
|
|
525
|
+
const a3 = a[3];
|
|
526
|
+
const b0 = b[0];
|
|
527
|
+
const b1 = b[1];
|
|
528
|
+
const b2 = b[2];
|
|
529
|
+
const b3 = b[3];
|
|
530
|
+
return (Math.abs(a0 - b0) <= EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) &&
|
|
531
|
+
Math.abs(a1 - b1) <= EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) &&
|
|
532
|
+
Math.abs(a2 - b2) <= EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) &&
|
|
533
|
+
Math.abs(a3 - b3) <= EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)));
|
|
534
|
+
}
|
|
535
|
+
/**
|
|
536
|
+
* Returns whether or not the vector is finite
|
|
537
|
+
* @param a vector to test
|
|
538
|
+
* @returns whether or not the vector is finite
|
|
539
|
+
*/
|
|
540
|
+
function finite(a) {
|
|
541
|
+
return Number.isFinite(a[0]) && Number.isFinite(a[1]) && Number.isFinite(a[2]) && Number.isFinite(a[3]);
|
|
542
|
+
}
|
|
543
|
+
/**
|
|
544
|
+
* Alias for {@link subtract}
|
|
545
|
+
*/
|
|
546
|
+
const sub = subtract;
|
|
547
|
+
/**
|
|
548
|
+
* Alias for {@link multiply}
|
|
549
|
+
*/
|
|
550
|
+
const mul = multiply;
|
|
551
|
+
/**
|
|
552
|
+
* Alias for {@link divide}
|
|
553
|
+
*/
|
|
554
|
+
const div = divide;
|
|
555
|
+
/**
|
|
556
|
+
* Alias for {@link distance}
|
|
557
|
+
*/
|
|
558
|
+
const dist = distance;
|
|
559
|
+
/**
|
|
560
|
+
* Alias for {@link squaredDistance}
|
|
561
|
+
*/
|
|
562
|
+
const sqrDist = squaredDistance;
|
|
563
|
+
/**
|
|
564
|
+
* Alias for {@link length}
|
|
565
|
+
*/
|
|
566
|
+
const len = length;
|
|
567
|
+
/**
|
|
568
|
+
* Alias for {@link squaredLength}
|
|
569
|
+
*/
|
|
570
|
+
const sqrLen = squaredLength;
|
|
571
|
+
|
|
572
|
+
export { add, ceil, clone, copy, create, cross, dist, distance, div, divide, dot, equals, exactEquals, finite, floor, fromBuffer, fromValues, inverse, lagrange, len, length, lerp, max, min, mul, multiply, negate, normalize, round, scale, scaleAndAdd, set, sqrDist, sqrLen, squaredDistance, squaredLength, str, sub, subtract, toBuffer, transformMat4, transformQuat, zero };
|
|
573
|
+
//# sourceMappingURL=vec4.js.map
|