UNPKG

1.3 kBTypeScriptView Raw
1import { Box3 } from "./Box3.js";
2import { Matrix4 } from "./Matrix4.js";
3import { Plane } from "./Plane.js";
4import { Vector3 } from "./Vector3.js";
5
6export class Sphere {
7 constructor(center?: Vector3, radius?: number);
8
9 /**
10 * Read-only flag to check if a given object is of type {@link Sphere}.
11 */
12 readonly isSphere: true;
13
14 /**
15 * @default new Vector3()
16 */
17 center: Vector3;
18
19 /**
20 * @default 1
21 */
22 radius: number;
23
24 set(center: Vector3, radius: number): Sphere;
25 setFromPoints(points: Vector3[], optionalCenter?: Vector3): Sphere;
26 clone(): this;
27 copy(sphere: Sphere): this;
28 expandByPoint(point: Vector3): this;
29 isEmpty(): boolean;
30 makeEmpty(): this;
31 containsPoint(point: Vector3): boolean;
32 distanceToPoint(point: Vector3): number;
33 intersectsSphere(sphere: Sphere): boolean;
34 intersectsBox(box: Box3): boolean;
35 intersectsPlane(plane: Plane): boolean;
36 clampPoint(point: Vector3, target: Vector3): Vector3;
37 getBoundingBox(target: Box3): Box3;
38 applyMatrix4(matrix: Matrix4): Sphere;
39 translate(offset: Vector3): Sphere;
40 equals(sphere: Sphere): boolean;
41 union(sphere: Sphere): this;
42
43 /**
44 * @deprecated Use {@link Sphere#isEmpty .isEmpty()} instead.
45 */
46 empty(): any;
47}