xtorcga
Version:
Xtor Compute Geometry Algorithm Libary 计算几何算法库
45 lines (44 loc) • 1.34 kB
TypeScript
import { EventHandler } from '../render/eventhandler';
import Decimal from 'decimal.js';
export interface IHVec2 {
x: Decimal;
y: Decimal;
}
export interface IHVec3 extends IHVec2 {
z: Decimal;
}
export interface IHVec4 extends IHVec3 {
w: Decimal;
}
export declare class Vec3 extends EventHandler implements IHVec3 {
private _x;
private _y;
private _z;
x: Decimal;
y: Decimal;
z: Decimal;
constructor(_x?: any, _y?: any, _z?: any);
static isVec3(v: any): boolean;
get isVec3(): boolean;
static get Up(): Vec3;
static get Down(): Vec3;
static get UnitX(): Vec3;
static get UnitY(): Vec3;
static get UnitZ(): Vec3;
set(x: Decimal, y: Decimal, z: Decimal): this;
setScalar(scalar: Decimal): this;
setComponent(index: number, value: Decimal): this;
add(v: Vec3, w?: Vec3): this;
addVecs(a: Vec3, b: Vec3): this;
sub(v: Vec3, w?: Vec3): this;
subVecs(a: Vec3, b: Vec3): this;
multiplyScalar(scalar: Decimal | number): this;
cross(v: Vec3, w?: Vec3): this;
crossVecs(a: Vec3, b: Vec3): this;
dot(v: Vec3): Decimal;
lerp(v: Vec3, alpha: number | Decimal): this;
clone(): Vec3;
length(): Decimal;
normalize(): this;
divideScalar(scalar: number | Decimal): this;
}