import { mat3 } from './mat3'; import { mat4 } from './mat4'; import { quat } from './quat'; /** * Represents 3D vector * @category Types */ export type vec3 = readonly [x: number, y: number, z: number]; /** * Functions for {@link vec3}, a 3D vector. * @category Modules */ export declare namespace vec3 { /** * Mutable version of {@link vec3} * @category Types */ type Mutable = [x: number, y: number, z: number]; /** * Creates a new vector from given elements * @category Generators */ function of(x: number, y?: number, z?: number): vec3; /** * Creates a mutable clone of given vec3 * @category Generators */ function clone(a: vec3): Mutable; /** * @category Constants */ const zero: vec3; /** * @category Constants */ const one: vec3; /** * An unit vector pointing towards positive X. Same as `[1, 0, 0]` * @category Constants */ const unitX: vec3; /** * An unit vector pointing towards positive Y. Same as `[0, 1, 0]` * @category Constants */ const unitY: vec3; /** * An unit vector pointing towards positive Z. Same as `[0, 0, 1]` * @category Constants */ const unitZ: vec3; /** * Adds given vec3's */ function add(...vs: (vec3 | number)[]): vec3; /** * Subtracts given vec3's. When the argument is a single vector, it negates it. Otherwise, it subtracts from left to right. * * @shorthands * - {@link sub} * */ function subtract(...vs: (vec3 | number)[]): vec3; /** * Alias for {@link subtract} * @category Shorthands */ const sub: typeof subtract; /** * Subtracts a from b */ function delta(a: vec3 | number, b: vec3 | number): vec3; /** * Multiplies given vec3's * * @shorthands * - {@link mul} */ function multiply(...vs: (vec3 | number)[]): vec3; /** * Alias for {@link multiply} * @category Shorthands */ const mul: typeof multiply; /** * Divides given vec3's * * @shorthands * - {@link div} */ function divide(...vs: (vec3 | number)[]): vec3; /** * Alias for {@link divide} * @category Shorthands */ const div: typeof divide; /** * Applies Math.ceil to each component of a vec3 */ function ceil(a: vec3): vec3; /** * Applies Math.floor to each component of a vec3 */ function floor(a: vec3): vec3; /** * Applies Math.sign to each component of a vec3 */ function sign(v: vec3): vec3; /** * Removes the fractional part * @see https://www.sidefx.com/docs/houdini/vex/functions/trunc.html */ function trunc(v: vec3): vec3; /** * Computes the fractional part of the argument * @see https://registry.khronos.org/OpenGL-Refpages/gl4/html/fract.xhtml */ function fract(a: vec3): vec3; /** * Compute value of one parameter modulo another. This is computed as x - y * floor(x/y). Unlike JavaScript's `%` operator, the sign of result always matches to `b`. * @see https://thebookofshaders.com/glossary/?search=mod */ function mod(a: vec3, b: vec3 | number): vec3; /** * Quantize a vec3 to a given step and offset. If the step is 0, the value is returned unchanged. * @param v The value to quantize * @param step The step size * @param offset The offset * @returns The quantized value */ function quantize(v: vec3, step: vec3 | number, offset?: vec3 | number): vec3; /** * Returns the minimum of given vec3's */ function min(...vs: (vec3 | number)[]): vec3; /** * Returns the maximum of given vec3's */ function max(...vs: (vec3 | number)[]): vec3; /** * Constrain a value to lie between two further values * @see https://thebookofshaders.com/glossary/?search=clamp * @param v the value to constrain * @param min the lower end of the range into which to constrain `v` * @param max the upper end of the range into which to constrain `v` */ function clamp(v: vec3, min: vec3 | number, max: vec3 | number): vec3; /** * Clamps each component to [0, 1]. Equivalent to {@link saturate}. */ function clamp01(v: vec3): vec3; /** * Clamps each component to [-1, 1] */ function clamp11(v: vec3): vec3; /** * Returns the absolute value of each component of a vec3 */ function abs(v: vec3): vec3; /** * Symmetric round the components of a vec3 */ function round(a: vec3): vec3; /** * Scales a vec3 by a scalar number */ function scale(a: vec3, s: number): vec3; /** * Returns the average value of the input(s) * @see https://www.sidefx.com/docs/houdini/vex/functions/avg.html * * @shorthands * - {@link avg} */ function average(...vs: vec3[]): vec3; /** * Alias for {@link average} * @category Shorthands */ const avg: typeof average; /** * Adds given vec3's after scaling the second operand by a scalar value */ function scaleAndAdd(a: vec3, b: vec3, scale: number): vec3; /** * Calculates the euclidian distance between two vec3's * * @shorthands * - {@link dist} */ function distance(a: vec3, b: vec3): number; /** * Alias for {@link distance} * @category Shorthands */ const dist: typeof distance; /** * Calculates the squared euclidian distance between two vec3's */ function squaredDistance(a: vec3, b: vec3): number; /** * Alias for {@link squaredDistance} * @category Shorthands */ const sqrDist: typeof squaredDistance; /** * Returns the absolute difference between corresponding components of two vec3's * * @shorthands * - {@link diff} */ function difference(a: vec3, b: vec3): vec3; /** * Alias for {@link vec3.difference} * @category Shorthands */ const diff: typeof difference; /** * Calculates the length of a vec3 * * @shorthands * - {@link len} */ function length(a: vec3): number; /** * Alias for {@link length} * @category Shorthands */ const len: typeof length; /** * Calculates the squared length of a vec3 * * @shorthands * - {@link sqrLen} */ function squaredLength(a: vec3): number; /** * Alias for {@link squaredLength} * @category Shorthands */ const sqrLen: typeof squaredLength; /** * Negates the components of a vec3 * * @shorthands * - {@link neg} */ function negate(a: vec3): vec3; /** * Alias for {@link negate} */ const neg: typeof negate; /** * Returns the inverse of the components of a vec3 * * @shorthands * - {@link inv} */ function invert(a: vec3): vec3; /** * Alias for {@link invert} * @category Shorthands */ const inv: typeof invert; /** * Returns the result of `v` subtracted from {@link one}. */ function oneMinus(v: vec3): vec3; /** * Takes the value in the range `(omin, omax)` and shifts it to the corresponding value in the new range `(nmin, nmax)`. The function clamps the given value the range `(omin, omax)` before fitting, so the resulting value will be guaranteed to be in the range `(nmin, nmax)`. To avoid clamping use efit instead. * @see https://www.sidefx.com/docs/houdini/vex/functions/fit.html * @param value * @param omin * @param omax * @param nmin * @param nmax * @returns */ function fit(value: vec3, omin: vec3, omax: vec3, nmin: vec3, nmax: vec3): vec3; /** * Takes the value in the range `(omin, omax)` and shifts it to the corresponding value in the new range `(nmin, nmax)`. Unlike `fit`, this function does not clamp values to the given range. If `omin` and `omax` are the same, the function returns the average of `nmin` and `nmax`. * @see https://www.sidefx.com/docs/houdini/vex/functions/fit.html * @param value * @param omin * @param omax * @param nmin * @param nmax * @returns */ function efit(value: vec3, omin: vec3, omax: vec3, nmin: vec3, nmax: vec3): vec3; /** * Takes the value in the range `(0, 1)` and shifts it to the corresponding value in the new range `(nmin, nmax)`. * @see https://www.sidefx.com/docs/houdini/vex/functions/fit01.html */ function fit01(value: vec3, nmin: vec3, nmax: vec3): vec3; /** * Takes the value in the range `(-1, 1)` and shifts it to the corresponding value in the new range `(nmin, nmax)`. * @see https://www.sidefx.com/docs/houdini/vex/functions/fit11.html */ function fit11(value: vec3, nmin: vec3, nmax: vec3): vec3; /** * Normalize a vec3 */ function normalize(a: vec3): vec3; /** * Calculates the dot product of two vec3's */ function dot(a: vec3, b: vec3): number; /** * Computes the cross product of two vec3's */ function cross(a: vec3, b: vec3): vec3; /** * Reflects incident vector `I` about normal `N`. The normal `N` should be normalized. * @see https://registry.khronos.org/OpenGL-Refpages/gl4/html/reflect.xhtml * @param I Incident vector * @param N Normal vector (should be normalized) */ function reflect(I: vec3, N: vec3): vec3; /** * Computes the refraction vector for incident vector `I`, surface normal `N`, and ratio of indices of refraction `eta`. The normal `N` should be normalized. * @see https://registry.khronos.org/OpenGL-Refpages/gl4/html/refract.xhtml * @param I Incident vector * @param N Normal vector (should be normalized) * @param eta Ratio of indices of refraction * @returns The refraction vector, or zero vector for total internal reflection */ function refract(I: vec3, N: vec3, eta: number): vec3; /** * Orients a normal to point away from a surface as defined by its incident vector. Returns `N` if `dot(Nref, I) < 0`, otherwise returns `-N`. * @see https://registry.khronos.org/OpenGL-Refpages/gl4/html/faceforward.xhtml * @param N Normal vector * @param I Incident vector * @param Nref Reference normal */ function faceforward(N: vec3, I: vec3, Nref: vec3): vec3; /** * Projects vector `a` onto vector `b`. * @param a The vector to project * @param b The vector to project onto */ function project(a: vec3, b: vec3): vec3; /** * Computes the rejection of vector `a` from vector `b` (the component of `a` perpendicular to `b`). * @param a The vector to reject * @param b The vector to reject from */ function reject(a: vec3, b: vec3): vec3; /** * Linearly interpolate between two vec3's. Same as GLSL's built-in `mix` function. * @see https://registry.khronos.org/OpenGL-Refpages/gl4/html/mix.xhtml * * @shorthands * - {@link mix} */ function lerp(a: vec3, b: vec3, t: vec3 | number): vec3; /** * Alias for {@link lerp} * @see https://registry.khronos.org/OpenGL-Refpages/gl4/html/mix.xhtml * @category Shorthands */ const mix: typeof lerp; /** * Returns the amount to mix `min` and `max` to generate the input value `t`. This is the inverse of the `lerp` function. If `min` and `max` are equal, the mixing value is `0.5`. * @see https://docs.unity3d.com/Packages/com.unity.shadergraph@6.9/manual/Inverse-Lerp-Node.html * @see https://www.sidefx.com/docs/houdini/vex/functions/invlerp.html * * @shorthands * - {@link invlerp} */ function inverseLerp(a: vec3, b: vec3, t: vec3): vec3; /** * Alias for {@link inverseLerp} * @category Shorthands */ const invlerp: typeof inverseLerp; /** * Performs a spherical linear interpolation between two vec3's */ function slerp(a: vec3, b: vec3, t: number): vec3; /** * Performs a hermite interpolation with two control points * * @param a the first operand * @param b the second operand * @param c the third operand * @param d the fourth operand * @param t interpolation amount, in the range [0-1], between the two inputs */ function hermite(a: vec3, b: vec3, c: vec3, d: vec3, t: number): vec3; /** * Performs a bezier interpolation with two control points */ function bezier(a: vec3, b: vec3, c: vec3, d: vec3, t: number): vec3; /** * Transforms the vec3 with a mat4. * 4th vector component is implicitly '1' */ function transformMat4(a: vec3, m: mat4): vec3; /** * Transforms the vec3 with a mat3. */ function transformMat3(a: vec3, m: mat3): vec3; /** * Transforms a vec3 with a matrix or quaternion, automatically choosing the appropriate transformation function based on input type * @param p The vector to transform * @param m The transformation matrix (mat3 or mat4) or quaternion * @returns The transformed vector * * @shorthands * - {@link xform} */ function transform(p: vec3, m: mat3 | mat4 | quat): vec3; /** * Alias for {@link vec3.transform} * @category Shorthands */ const xform: typeof transform; /** * Transforms the vec3 with a quat * Can also be used for dual quaternions. (Multiply it with the real part) * * @param a the vector to transform * @param q quaternion to transform with * * @shorthands * - {@link qrotate} */ function transformQuat(a: vec3, q: quat): vec3; /** * Alias for {@link transformQuat} * @see https://www.sidefx.com/docs/houdini/vex/functions/qrotate.html * @category Shorthands */ const qrotate: typeof transformQuat; /** * Rotate a 3D vector around the x-axis * @param v The vec3 point to rotate * @param origin The origin of the rotation * @param deg The angle of rotation in degrees */ function rotateX(v: vec3, origin: vec3, deg: number): vec3; /** * Rotate a 3D vector around the y-axis * @param v The vec3 point to rotate * @param origin The origin of the rotation * @param deg The angle of rotation in degrees */ function rotateY(v: vec3, origin: vec3, deg: number): vec3; /** * Rotate a 3D vector around the z-axis * @param v The vec3 point to rotate * @param origin The origin of the rotation * @param deg The angle of rotation in degrees */ function rotateZ(v: vec3, origin: vec3, deg: number): vec3; /** * Get the angle between two 3D vectors * @param a The first operand * @param b The second operand * @returns The angle in degrees */ function angle(a: vec3, b: vec3): number; /** * Apply a step function by comparing two values * @see https://registry.khronos.org/OpenGL-Refpages/gl4/html/step.xhtml * @param edge The location of the edge of the step function. * @param x The value to be used to generate the step function. * @returns */ function step(edge: vec3 | number, v: vec3 | number): vec3; /** * Perform Hermite interpolation between two values. * @see https://registry.khronos.org/OpenGL-Refpages/gl4/html/smoothstep.xhtml * @param edge0 Lower edge of the Hermite function. * @param edge1 Upper edge of the Hermite function. * @param x Source value for interpolation. * @returns */ function smoothstep(edge0: vec3 | number, edge1: vec3 | number, x: vec3): vec3; /** * Converts the components of a vec3 from radians to degrees * @param rad The input vec3 in radians * @returns The degrees equivalent of the input * * @shorthands * - {@link deg} */ function degrees(rad: vec3): vec3; /** * Alias for {@link degrees} * @category Shorthands */ const deg: typeof degrees; /** * Converts the components of a vec3 from degrees to radians * @param deg The input vec3 in degrees * @returns The radians equivalent of the input * * @shorthands * - {@link rad} */ function radians(deg: vec3): vec3; /** * Alias for {@link radians} * @category Shorthands */ const rad: typeof radians; /** * Returns the sine of each component, which are angles in degrees */ function sin(deg: vec3): vec3; /** * Returns the cosine of each component, which are angles in degrees */ function cos(deg: vec3): vec3; /** * Returns the tangent of each component, which are angles in degrees */ function tan(deg: vec3): vec3; /** * Returns the arcsine of each component, in degrees */ function asin(v: vec3): vec3; /** * Returns the arc cosine of each component, in degrees */ function acos(v: vec3): vec3; /** * Returns the arc-tangent of the parameters. If `x` is not provided, `y` is regarded as a value of `y/x`. * @param y the values of the y-coordinate * @param x the values of the x-coordinate * @returns the angle in degrees * @see https://thebookofshaders.com/glossary/?search=atan * */ function atan(y: vec3, x?: vec3): vec3; /** * Returns the arc-tangent of the parameters. * @param y the values of the y-coordinate * @param x the values of the x-coordinate * @returns the angle in degrees * @see https://thebookofshaders.com/glossary/?search=atan * */ function atan2(y: vec3, x: vec3): vec3; /** * Returns the base to the exponent power, component-wise */ function pow(a: vec3, b: vec3 | number): vec3; /** * Returns e raised to the power of each component */ function exp(v: vec3): vec3; /** * Returns the natural logarithm of each component */ function log(v: vec3): vec3; /** * Returns 2 raised to the power of the parameter * @param v the value of the power to which 2 will be raised */ function exp2(v: vec3): vec3; /** * Returns the base-2 logarithm of each component */ function log2(v: vec3): vec3; /** * Returns the square root of each component */ function sqrt(v: vec3): vec3; /** * Returns the inverse of the square root of the parameter * @param v the value of which to take the inverse of the square root * @see https://thebookofshaders.com/glossary/?search=inversesqrt * * @shorthands * - {@link invsqrt} */ function inverseSqrt(v: vec3): vec3; /** * Alias for {@link inverseSqrt} * @category Shorthands */ const invsqrt: typeof inverseSqrt; /** * Returns the hyperbolic sine of each component */ function sinh(v: vec3): vec3; /** * Returns the hyperbolic cosine of each component */ function cosh(v: vec3): vec3; /** * Returns the hyperbolic tangent of each component */ function tanh(v: vec3): vec3; /** * Returns the inverse hyperbolic sine of each component */ function asinh(v: vec3): vec3; /** * Returns the inverse hyperbolic cosine of each component */ function acosh(v: vec3): vec3; /** * Returns the inverse hyperbolic tangent of each component */ function atanh(v: vec3): vec3; /** * Clamps each component to [0, 1]. Equivalent to HLSL's `saturate`. */ function saturate(v: vec3): vec3; /** * Returns the sum of all components of a vector. * Equivalent to GLM's `glm::compAdd`. */ function compAdd(v: vec3): number; /** * Returns the product of all components of a vector. * Equivalent to GLM's `glm::compMul`. */ function compMul(v: vec3): number; /** * Returns whether or not the vectors have exactly the same elements in the same position (when compared with `===`) * * @shorthands * - {@link eq} */ function exactEquals(a: vec3, b: vec3): boolean; /** * Alias for {@link exactEquals} * @category Shorthands */ const eq: typeof exactEquals; /** * Returns whether or not the vectors have approximately the same elements in the same position. * * @shorthands * - {@link approx} * - {@link equals} */ function approxEquals(a: vec3, b: vec3): boolean; /** * Alias for {@link approxEquals} * @category Shorthands */ const approx: typeof approxEquals; /** * Alias for {@link approxEquals}. This is provided for compatibility with gl-matrix. * @category Shorthands * @deprecated Use {@link approxEquals} instead */ const equals: typeof approxEquals; /** * Returns the string representation of a vec3 * @param v vector to represent as a string * @param fractionDigits number of digits to appear after the decimal point */ const toString: (v: vec3, fractionDigits?: number) => string; } //# sourceMappingURL=vec3.d.ts.map