@threeify/math
Version:
Computer graphics oriented, High performance, tree-shakeable, TypeScript 3D vector math library.
24 lines (18 loc) • 474 B
text/typescript
import { Vec3 } from './Vec3.js';
export class Ray3 {
constructor(
public readonly origin = new Vec3(),
public readonly direction = new Vec3(0, 0, -1)
) {}
set(origin: Vec3, direction: Vec3): this {
origin.clone(this.origin);
direction.clone(this.direction);
return this;
}
clone(result = new Ray3()): Ray3 {
return result.set(this.origin, this.direction);
}
copy(s: Ray3): this {
return this.set(s.origin, s.direction);
}
}