import { mat4 } from './mat4'; import { quat } from './quat'; /** * Represents 4D vector * @category Types */ export type vec4 = readonly [x: number, y: number, z: number, w: number]; /** * Functions for {@link vec4}, a 4D vector. * @category Modules */ export declare namespace vec4 { /** * Mutable version of {@link vec4} * @category Types */ type Mutable = [x: number, y: number, z: number, w: number]; /** * Creates a new vector from given elements * @category Generators */ function of(x: number, y?: number, z?: number, w?: number): vec4; /** * Creates a mutable clone of given vec4 * @category Generators */ function clone(a: vec4): Mutable; /** * @category Constants */ const zero: vec4; /** * @category Constants */ const one: vec4; /** * An unit vector pointing towards positive X. Same as `[1, 0, 0, 0]` * @category Constants */ const unitX: vec4; /** * An unit vector pointing towards positive Y. Same as `[0, 1, 0, 0]` * @category Constants */ const unitY: vec4; /** * An unit vector pointing towards positive Z. Same as `[0, 0, 1, 0]` * @category Constants */ const unitZ: vec4; /** * An unit vector pointing towards positive W. Same as `[0, 0, 0, 1]` * @category Constants */ const unitW: vec4; /** * Adds given vec4's */ function add(...vs: (vec4 | number)[]): vec4; /** * Subtracts given vec4's. When the argument is a single vector, it negates it. Otherwise, it subtracts from left to right. * * @shorthands * - {@link sub} */ function subtract(...vs: (vec4 | number)[]): vec4; /** * Alias for {@link subtract} */ const sub: typeof subtract; /** * Subtracts a from b */ function delta(a: vec4 | number, b: vec4 | number): vec4; /** * Multiplies given vec4's * @shorthands * - {@link mul} */ function multiply(...vs: (vec4 | number)[]): vec4; /** * Alias for {@link multiply} */ const mul: typeof multiply; /** * Divides given vec4's * * @shorthands * - {@link div} */ function divide(...vs: (vec4 | number)[]): vec4; /** * Alias for {@link divide} */ const div: typeof divide; /** * Returns the absolute value of each component of a vec4 */ function abs(v: vec4): vec4; /** * Symmetric round the components of a vec4 */ function round(a: vec4): vec4; /** * Applies Math.ceil to each component of a vec4 */ function ceil(a: vec4): vec4; /** * Applies Math.floor to each component of a vec4 */ function floor(a: vec4): vec4; /** * Applies Math.sign to each component of a vec4 */ function sign(v: vec4): vec4; /** * Removes the fractional part * @see https://www.sidefx.com/docs/houdini/vex/functions/trunc.html */ function trunc(v: vec4): vec4; /** * Computes the fractional part of the argument * @see https://registry.khronos.org/OpenGL-Refpages/gl4/html/fract.xhtml */ function fract(a: vec4): vec4; /** * 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: vec4, b: vec4 | number): vec4; /** * Quantize a vec4 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: vec4, step: vec4 | number, offset?: vec4 | number): vec4; /** * Returns the minimum of given vec4's */ function min(...vs: (vec4 | number)[]): vec4; /** * Returns the maximum of given vec4's */ function max(...vs: (vec4 | number)[]): vec4; /** * 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(a: vec4, min: vec4 | number, max: vec4 | number): vec4; /** * Clamps each component to [0, 1]. Equivalent to {@link saturate}. */ function clamp01(v: vec4): vec4; /** * Clamps each component to [-1, 1] */ function clamp11(v: vec4): vec4; /** * Scales a vec4 by a scalar number * * @param a the vector to scale * @param s amount to scale the vector by */ function scale(a: vec4, s: number): vec4; /** * 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: vec4[]): vec4; /** * Alias for {@link average} */ const avg: typeof average; /** * Adds given vec4's after scaling the second operand by a scalar value * @param scale the amount to scale b by before adding */ function scaleAndAdd(a: vec4, b: vec4, scale: number): vec4; /** * Calculates the euclidian distance between two vec4's */ function distance(a: vec4, b: vec4): number; /** * Alias for {@link distance} */ const dist: typeof distance; /** * Calculates the squared euclidian distance between two vec4's * * @shorthands * - {@link sqrDist} */ function squaredDistance(a: vec4, b: vec4): number; /** * Alias for {@link squaredDistance} */ const sqrDist: typeof squaredDistance; /** * Returns the absolute difference between corresponding components of two vec4's * * @shorthands * - {@link diff} */ function difference(a: vec4, b: vec4): vec4; /** * Alias for {@link vec4.difference} * @category Shorthands */ const diff: typeof difference; /** * Calculates the length of a vec4 * * @shorthands * - {@link len} */ function length(a: vec4): number; /** * Alias for {@link length} */ const len: typeof length; /** * Calculates the squared length of a vec4 * * @shorthands * - {@link sqrLen} */ function squaredLength(a: vec4): number; /** * Alias for {@link squaredLength} */ const sqrLen: typeof squaredLength; /** * Negates the components of a vec4 * @shorthands * - {@link neg} */ function negate(a: vec4): vec4; /** * Alias for {@link negate} */ const neg: typeof negate; /** * Returns the inverse of the components of a vec4 * * @shorthands * - {@link inv} */ function invert(a: vec4): vec4; /** * Alias for {@link invert} * @category Shorthands */ const inv: typeof invert; /** * Returns the result of `v` subtracted from {@link one}. */ function oneMinus(v: vec4): vec4; /** * 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: vec4, omin: vec4, omax: vec4, nmin: vec4, nmax: vec4): vec4; /** * 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: vec4, omin: vec4, omax: vec4, nmin: vec4, nmax: vec4): vec4; /** * 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: vec4, nmin: vec4, nmax: vec4): vec4; /** * 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: vec4, nmin: vec4, nmax: vec4): vec4; /** * Normalize a vec4 */ function normalize(a: vec4): vec4; /** * Calculates the dot product of two vec4's */ function dot(a: vec4, b: vec4): number; /** * Returns the cross-product of three vectors in a 4-dimensional space */ function cross(u: vec4, v: vec4, w: vec4): vec4; /** * Linearly interpolate between two vec4'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: vec4, b: vec4, t: vec4 | number): vec4; /** * Alias for {@link lerp} * @see https://registry.khronos.org/OpenGL-Refpages/gl4/html/mix.xhtml */ 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: vec4, b: vec4, t: vec4): vec4; /** * Alias for {@link inverseSqrt} * @category Shorthands */ const invsqrt: typeof inverseSqrt; /** * Alias for {@link inverseLerp} */ const invlerp: typeof inverseLerp; /** * Transforms the vec4 with a mat4. */ function transformMat4(a: vec4, m: mat4): vec4; /** * Transforms the vec4 with a quat */ function transformQuat(a: vec4, q: quat): vec4; /** * Transforms a vec4 with a matrix or quaternion, automatically choosing the appropriate transformation function * @param p The vector to transform * @param m The transformation (mat4 or quat) * @returns The transformed vector * * @shorthands * - {@link xform} */ function transform(p: vec4, m: mat4 | quat): vec4; /** * Alias for {@link vec4.transform} * @category Shorthands */ const xform: typeof transform; /** * 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: vec4 | number, v: vec4 | number): vec4; /** * 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: vec4 | number, edge1: vec4 | number, x: vec4): vec4; /** * Converts the components of a vec4 from radians to degrees * @param rad The input vec4 in radians * @returns The degrees equivalent of the input * * @shorthands * - {@link deg} */ function degrees(rad: vec4): vec4; /** * Alias for {@link degrees} * @category Shorthands */ const deg: typeof degrees; /** * Converts the components of a vec4 from degrees to radians * @param deg The input vec4 in degrees * @returns The radians equivalent of the input * * @shorthands * - {@link rad} */ function radians(deg: vec4): vec4; /** * Alias for {@link radians} * @category Shorthands */ const rad: typeof radians; /** * Returns the sine of each component, which are angles in degrees */ function sin(deg: vec4): vec4; /** * Returns the cosine of each component, which are angles in degrees */ function cos(deg: vec4): vec4; /** * Returns the tangent of each component, which are angles in degrees */ function tan(deg: vec4): vec4; /** * Returns the arcsine of each component, in degrees */ function asin(v: vec4): vec4; /** * Returns the arc cosine of each component, in degrees */ function acos(v: vec4): vec4; /** * 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: vec4, x?: vec4): vec4; /** * 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: vec4, x: vec4): vec4; /** * Returns the base to the exponent power, component-wise */ function pow(a: vec4, b: vec4 | number): vec4; /** * Returns e raised to the power of each component */ function exp(v: vec4): vec4; /** * Returns the natural logarithm of each component */ function log(v: vec4): vec4; /** * 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: vec4): vec4; /** * Returns the base-2 logarithm of each component */ function log2(v: vec4): vec4; /** * Returns the square root of each component */ function sqrt(v: vec4): vec4; /** * 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 */ function inverseSqrt(v: vec4): vec4; /** * Returns the hyperbolic sine of each component */ function sinh(v: vec4): vec4; /** * Returns the hyperbolic cosine of each component */ function cosh(v: vec4): vec4; /** * Returns the hyperbolic tangent of each component */ function tanh(v: vec4): vec4; /** * Returns the inverse hyperbolic sine of each component */ function asinh(v: vec4): vec4; /** * Returns the inverse hyperbolic cosine of each component */ function acosh(v: vec4): vec4; /** * Returns the inverse hyperbolic tangent of each component */ function atanh(v: vec4): vec4; /** * Clamps each component to [0, 1]. Equivalent to HLSL's `saturate`. */ function saturate(v: vec4): vec4; /** * Returns the sum of all components of a vector. * Equivalent to GLM's `glm::compAdd`. */ function compAdd(v: vec4): number; /** * Returns the product of all components of a vector. * Equivalent to GLM's `glm::compMul`. */ function compMul(v: vec4): 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: vec4, b: vec4): 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: vec4, b: vec4): 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 vec4 * @param v vector to represent as a string * @param fractionDigits number of digits to appear after the decimal point */ const toString: (v: vec4, fractionDigits?: number) => string; } //# sourceMappingURL=vec4.d.ts.map