UNPKG

1.91 kBTypeScriptView Raw
1import { Box3 } from "./Box3.js";
2import { Matrix4 } from "./Matrix4.js";
3import { Plane } from "./Plane.js";
4import { Sphere } from "./Sphere.js";
5import { Vector3 } from "./Vector3.js";
6
7export class Ray {
8 constructor(origin?: Vector3, direction?: Vector3);
9
10 /**
11 * @default new THREE.Vector3()
12 */
13 origin: Vector3;
14
15 /**
16 * @default new THREE.Vector3( 0, 0, - 1 )
17 */
18 direction: Vector3;
19
20 set(origin: Vector3, direction: Vector3): Ray;
21 clone(): this;
22 copy(ray: Ray): this;
23 at(t: number, target: Vector3): Vector3;
24 lookAt(v: Vector3): Ray;
25 recast(t: number): Ray;
26 closestPointToPoint(point: Vector3, target: Vector3): Vector3;
27 distanceToPoint(point: Vector3): number;
28 distanceSqToPoint(point: Vector3): number;
29 distanceSqToSegment(
30 v0: Vector3,
31 v1: Vector3,
32 optionalPointOnRay?: Vector3,
33 optionalPointOnSegment?: Vector3,
34 ): number;
35 intersectSphere(sphere: Sphere, target: Vector3): Vector3 | null;
36 intersectsSphere(sphere: Sphere): boolean;
37 distanceToPlane(plane: Plane): number;
38 intersectPlane(plane: Plane, target: Vector3): Vector3 | null;
39 intersectsPlane(plane: Plane): boolean;
40 intersectBox(box: Box3, target: Vector3): Vector3 | null;
41 intersectsBox(box: Box3): boolean;
42 intersectTriangle(a: Vector3, b: Vector3, c: Vector3, backfaceCulling: boolean, target: Vector3): Vector3 | null;
43 applyMatrix4(matrix4: Matrix4): Ray;
44 equals(ray: Ray): boolean;
45
46 /**
47 * @deprecated Use {@link Ray#intersectsBox .intersectsBox()} instead.
48 */
49 isIntersectionBox(b: any): any;
50
51 /**
52 * @deprecated Use {@link Ray#intersectsPlane .intersectsPlane()} instead.
53 */
54 isIntersectionPlane(p: any): any;
55
56 /**
57 * @deprecated Use {@link Ray#intersectsSphere .intersectsSphere()} instead.
58 */
59 isIntersectionSphere(s: any): any;
60}