@thi.ng/vectors
Version:
Optimized 2d/3d/4d and arbitrary length vector operations, support for memory mapping/layouts
76 lines • 2.3 kB
TypeScript
import type { ReadonlyVec, Vec, VecOpV } from "./api.js";
/**
* Places a re-ordered 2D version of vector `a` into `out`. The given
* coord indices must be valid for `a`. No bounds checking.
*
* @param out -
* @param a -
* @param x - new x coord index
* @param y - new y coord index
*/
export declare const swizzle2: (out: Vec | null, a: ReadonlyVec, x: number, y: number) => Vec<number>;
/**
* Places a re-ordered 3D version of vector `a` into `out`. The given
* coord indices must be valid for `a`. No bounds checking.
*
* @param out -
* @param a -
* @param x - new x coord index
* @param y - new y coord index
* @param z - new z coord index
*/
export declare const swizzle3: (out: Vec | null, a: ReadonlyVec, x: number, y: number, z: number) => Vec<number>;
/**
* Places a re-ordered 4D version of vector `a` into `out`. The given
* coord indices must be valid for `a`. No bounds checking.
*
* @param out -
* @param a -
* @param x - new x coord index
* @param y - new y coord index
* @param z - new z coord index
* @param w - new w coord index
*/
export declare const swizzle4: (out: Vec | null, a: ReadonlyVec, x: number, y: number, z: number, w: number) => Vec<number>;
export declare const swapXY: VecOpV;
export declare const swapXZ: VecOpV;
export declare const swapYZ: VecOpV;
/**
* Sets `out[a] = n`, returns `out`.
*
* @param out -
* @param n -
* @param a -
*/
export declare const setSwizzle1: (out: Vec, n: number, a: number) => Vec<number>;
/**
* Sets `out[a] = v.x, out[b] = v.y`, returns `out`.
*
* @param out -
* @param v -
* @param a -
* @param b -
*/
export declare const setSwizzle2: (out: Vec, v: ReadonlyVec, a: number, b: number) => Vec<number>;
/**
* Sets `out[a] = v.x, out[b] = v.y, out[c] = v.z`, returns `out`.
*
* @param out -
* @param v -
* @param a -
* @param b -
* @param c -
*/
export declare const setSwizzle3: (out: Vec, v: ReadonlyVec, a: number, b: number, c: number) => Vec<number>;
/**
* Sets `out[a] = v.x, out[b] = v.y, out[c] = v.z, out[d]=v.w`, returns `out`.
*
* @param out -
* @param v -
* @param a -
* @param b -
* @param c -
* @param d -
*/
export declare const setSwizzle4: (out: Vec, v: ReadonlyVec, a: number, b: number, c: number, d: number) => Vec<number>;
//# sourceMappingURL=swizzle.d.ts.map