import * as Common from './common'; /** * Functions for working with scalar values. * @category Modules */ export declare namespace scalar { /** * Adds the given values */ function add(...vs: number[]): number; /** * Subtracts the given values. When the argument is a single value, it negates it. Otherwise, it subtracts from left to right. * * @shorthands * - {@link sub} */ function subtract(...vs: number[]): number; /** * Alias for {@link subtract} * @category Shorthands */ const sub: typeof subtract; /** * Subtracts a from b */ function delta(a: number, b: number): number; /** * Multiplies the given values * * @shorthands * - {@link mul} */ function multiply(...vs: number[]): number; /** * Alias for {@link multiply} * @category Shorthands */ const mul: typeof multiply; /** * Divides the given values. When the argument is a single value, it returns its reciprocal. Otherwise, it divides from left to right. * * @shorthands * - {@link div} */ function divide(...vs: number[]): number; /** * Alias for {@link divide} * @category Shorthands */ const div: typeof divide; /** * Symmetric round the given number */ const round: typeof Common.round; /** * Returns the smallest integer greater than or equal to the input */ const ceil: (x: number) => number; /** * Returns the largest integer less than or equal to the input */ const floor: (x: number) => number; /** * Returns the sign of the input (-1, 0, or 1) */ const sign: (x: number) => number; /** * Returns the absolute value of the input */ const abs: (x: number) => number; /** * Removes the fractional part * @see https://www.sidefx.com/docs/houdini/vex/functions/trunc.html */ function trunc(v: number): number; /** * Computes the fractional part of the argument * @see https://registry.khronos.org/OpenGL-Refpages/gl4/html/fract.xhtml */ function fract(v: number): number; /** * Computes the 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: number, b: number): number; /** * Quantize a value 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: number, step: number, offset?: number): number; /** * Returns the minimum of the given values */ const min: (...values: number[]) => number; /** * Returns the maximum of the given values */ const max: (...values: number[]) => number; /** * 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 `s` * @param max the upper end of the range into which to constrain `s` */ function clamp(v: number, min: number, max: number): number; /** * Clamps the value to [0, 1]. Equivalent to {@link saturate}. */ function clamp01(value: number): number; /** * Clamps the value to [-1, 1] */ function clamp11(value: number): number; /** * Multiplies two values */ function scale(a: number, b: number): number; /** * 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: number[]): number; /** * Alias for {@link average} * @category Shorthands */ const avg: typeof average; /** * Adds two values after scaling the second operand by a scalar value */ function scaleAndAdd(a: number, b: number, s: number): number; /** * Calculates the distance between two values * * @shorthands * - {@link dist} */ function distance(a: number, b: number): number; /** * Alias for {@link distance} * @category Shorthands */ const dist: typeof distance; /** * Returns the absolute difference between two numbers * * @shorthands * - {@link diff} */ function difference(a: number, b: number): number; /** * Alias for {@link difference} * @category Shorthands */ const diff: typeof difference; /** * Returns the squared difference between two numbers * * @shorthands * - {@link sqrDist} */ function squaredDistance(a: number, b: number): number; /** * Alias for {@link squaredDistance} * @category Shorthands */ const sqrDist: typeof squaredDistance; /** * Returns the absolute difference between two numbers * * @shorthands * - {@link len} */ const length: (x: number) => number; /** * Alias for {@link length} * @category Shorthands */ const len: (x: number) => number; /** * Returns the squared value of the input * * @shorthands * - {@link sqrLen} */ function squaredLength(a: number): number; /** * Alias for {@link squaredLength} * @category Shorthands */ const sqrLen: typeof squaredLength; /** * Negates a value */ function negate(a: number): number; /** * Returns the reciprocal of a value (1/a) */ function invert(a: number): number; /** * Returns the result of `1 - a`. */ function oneMinus(a: number): number; /** * Normalizes a value to -1, 0, or 1. Equivalent to `Math.sign`. */ const normalize: (x: number) => number; /** * Linearly interpolates between two values. 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: number, b: number, t: number): number; /** * 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: number, b: number, t: number): number; /** * Alias for {@link inverseLerp} * @category Shorthands */ const invlerp: typeof inverseLerp; /** * 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 {@link efit} instead. 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 fit(value: number, omin: number, omax: number, nmin: number, nmax: number): number; /** * 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: number, omin: number, omax: number, nmin: number, nmax: number): number; /** * 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: number, nmin: number, nmax: number): number; /** * 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: number, nmin: number, nmax: number): 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: number, x: number): 0 | 1; /** * 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: number, edge1: number, x: number): number; /** * Converts a number from radians to degrees * @param rad A number in radians * @returns The degrees equivalent of the input * * @shorthands * - {@link deg} */ function degrees(rad: number): number; /** * Alias for {@link degrees} * @category Shorthands */ const deg: typeof degrees; /** * Converts a number from degrees to radians * @param deg A number in degrees * @returns The radians equivalent of the input * * @shorthands * - {@link rad} */ function radians(deg: number): number; /** * Alias for {@link radians} * @category Shorthands */ const rad: typeof radians; /** * Returns the sine of an angle in degrees * @param deg An angle in degrees */ function sin(deg: number): number; /** * Returns the cosine of an angle in degrees * @param deg An angle in degrees */ function cos(deg: number): number; /** * Returns the tangent of an angle in degrees * @param deg An angle in degrees */ function tan(deg: number): number; /** * Returns the arcsine of a value, in degrees * @param x A numeric expression * @returns The angle in degrees */ function asin(x: number): number; /** * Returns the arc cosine of a value, in degrees * @param x A numeric expression * @returns The angle in degrees */ function acos(x: number): number; /** * Returns the arc-tangent of the parameters. If `x` is not provided, `y` is regarded as a value of `y/x`. * @see https://thebookofshaders.com/glossary/?search=atan * @param y the value of the y-coordinate * @param x the value of the x-coordinate * @returns the angle in degrees */ function atan(y: number, x?: number): number; /** * Returns the arc-tangent of the parameters. * @see https://thebookofshaders.com/glossary/?search=atan * @param y the value of the y-coordinate * @param x the value of the x-coordinate * @returns the angle in degrees */ function atan2(y: number, x: number): number; /** * Returns the base to the exponent power */ const pow: (x: number, y: number) => number; /** * Returns e raised to the power of the input */ const exp: (x: number) => number; /** * Returns the natural logarithm of the input */ const log: (x: number) => number; /** * 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: number): number; /** * Returns the base-2 logarithm of the input */ const log2: (x: number) => number; /** * Returns the square root of the input */ const sqrt: (x: number) => number; /** * 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: number): number; /** * Alias for {@link inverseSqrt} * @category Shorthands */ const invsqrt: typeof inverseSqrt; /** * Returns the hyperbolic sine of the input */ const sinh: (x: number) => number; /** * Returns the hyperbolic cosine of the input */ const cosh: (x: number) => number; /** * Returns the hyperbolic tangent of the input */ const tanh: (x: number) => number; /** * Returns the inverse hyperbolic sine of the input */ const asinh: (x: number) => number; /** * Returns the inverse hyperbolic cosine of the input */ const acosh: (x: number) => number; /** * Returns the inverse hyperbolic tangent of the input */ const atanh: (x: number) => number; /** * Clamps the value to [0, 1]. Equivalent to HLSL's `saturate`. */ function saturate(v: number): number; /** * Returns a sawtooth wave with the given period. Basically, the output will be the input value modulo `period`, but returns 1 when the phase is 1. The shape of the wave will be continuous for the negative ranges, so when phase is negative integer, the output will be 0, else if phase is negative float, the output will be 1 - fractional part of phase. * @see https://www.geogebra.org/calculator/d3grfqqe * * @param x the input value * @param period the period of the wave * @category Periodic Functions * * @shorthands * - {@link ramp} * */ function sawtooth(x: number, period?: number): number; /** * Alias for {@link sawtooth} * @category Shorthands */ const ramp: typeof sawtooth; /** * Returns a triangle wave with the given period. The output ranges from 0 to 1. * @see https://www.geogebra.org/calculator/d3grfqqe * * @param x The input value * @param period The period of the wave * @category Periodic Functions */ function triangle(x: number, period?: number): number; /** * Returns a cosine wave with the given period. The output ranges from 0 to 1, and y = 0 when x = 0. * * @see https://www.geogebra.org/calculator/d3grfqqe * @param v the input value * @param period the period of the wave * @category Periodic Functions */ function coswave(v: number, period?: number): number; /** * Returns a sine wave with the given period. The output ranges from 0 to 1, and y = 0 when x = 0. * * @see https://www.geogebra.org/calculator/d3grfqqe * @param v the input value * @param period the period of the wave * @category Periodic Functions */ function sinwave(v: number, period?: number): number; /** * Returns a square wave with the given period. The output is 0 for the first half and 1 for the second half of each period. * @see https://www.geogebra.org/calculator/d3grfqqe * * @param x the input value * @param period the period of the wave * @category Periodic Functions */ function square(x: number, period?: number): number; /** * Returns whether or not two numbers are approximately equal. * * @shorthands * - {@link approx} * - {@link equals} */ function approxEquals(a: number, b: number): 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; } //# sourceMappingURL=scalar.d.ts.map