@threeify/math
Version:
Computer graphics oriented, High performance, tree-shakeable, TypeScript 3D vector math library.
23 lines (17 loc) • 465 B
text/typescript
import { Vec3 } from './Vec3.js';
export class Sphere {
constructor(public readonly center = new Vec3(), public radius = -1) {}
set(center: Vec3, radius: number): this {
center.clone(this.center);
this.radius = radius;
return this;
}
clone(result = new Sphere()): Sphere {
this.center.clone(result.center);
result.radius = this.radius;
return result;
}
copy(s: Sphere): this {
return this.set(s.center, s.radius);
}
}