UNPKG

3.42 kBTypeScriptView Raw
1import { Box3 } from "./Box3.js";
2import { Plane } from "./Plane.js";
3import { Vector2 } from "./Vector2.js";
4import { Vector3 } from "./Vector3.js";
5import { Vector4 } from "./Vector4.js";
6
7import { BufferAttribute } from "../core/BufferAttribute.js";
8import { InterleavedBufferAttribute } from "../core/InterleavedBufferAttribute.js";
9
10export class Triangle {
11 constructor(a?: Vector3, b?: Vector3, c?: Vector3);
12
13 /**
14 * @default new THREE.Vector3()
15 */
16 a: Vector3;
17
18 /**
19 * @default new THREE.Vector3()
20 */
21 b: Vector3;
22
23 /**
24 * @default new THREE.Vector3()
25 */
26 c: Vector3;
27
28 set(a: Vector3, b: Vector3, c: Vector3): Triangle;
29 setFromPointsAndIndices(points: Vector3[], i0: number, i1: number, i2: number): this;
30 setFromAttributeAndIndices(
31 attribute: BufferAttribute | InterleavedBufferAttribute,
32 i0: number,
33 i1: number,
34 i2: number,
35 ): this;
36 clone(): this;
37 copy(triangle: Triangle): this;
38 getArea(): number;
39 getMidpoint(target: Vector3): Vector3;
40 getNormal(target: Vector3): Vector3;
41 getPlane(target: Plane): Plane;
42 getBarycoord(point: Vector3, target: Vector3): Vector3 | null;
43 getInterpolation(point: Vector3, v1: Vector2, v2: Vector2, v3: Vector2, target: Vector2): Vector2 | null;
44 getInterpolation(point: Vector3, v1: Vector3, v2: Vector3, v3: Vector3, target: Vector3): Vector3 | null;
45 getInterpolation(point: Vector3, v1: Vector4, v2: Vector4, v3: Vector4, target: Vector4): Vector4 | null;
46 containsPoint(point: Vector3): boolean;
47 intersectsBox(box: Box3): boolean;
48 isFrontFacing(direction: Vector3): boolean;
49 closestPointToPoint(point: Vector3, target: Vector3): Vector3;
50 equals(triangle: Triangle): boolean;
51
52 static getNormal(a: Vector3, b: Vector3, c: Vector3, target: Vector3): Vector3;
53 static getBarycoord(point: Vector3, a: Vector3, b: Vector3, c: Vector3, target: Vector3): Vector3 | null;
54 static containsPoint(point: Vector3, a: Vector3, b: Vector3, c: Vector3): boolean;
55 static getInterpolation(
56 point: Vector3,
57 p1: Vector3,
58 p2: Vector3,
59 p3: Vector3,
60 v1: Vector2,
61 v2: Vector2,
62 v3: Vector2,
63 target: Vector2,
64 ): Vector2 | null;
65 static getInterpolation(
66 point: Vector3,
67 p1: Vector3,
68 p2: Vector3,
69 p3: Vector3,
70 v1: Vector3,
71 v2: Vector3,
72 v3: Vector3,
73 target: Vector3,
74 ): Vector3 | null;
75 static getInterpolation(
76 point: Vector3,
77 p1: Vector3,
78 p2: Vector3,
79 p3: Vector3,
80 v1: Vector4,
81 v2: Vector4,
82 v3: Vector4,
83 target: Vector4,
84 ): Vector4 | null;
85 static getInterpolatedAttribute(
86 attr: BufferAttribute,
87 i1: number,
88 i2: number,
89 i3: number,
90 barycoord: Vector3,
91 target: Vector2,
92 ): Vector2;
93 static getInterpolatedAttribute(
94 attr: BufferAttribute,
95 i1: number,
96 i2: number,
97 i3: number,
98 barycoord: Vector3,
99 target: Vector3,
100 ): Vector3;
101 static getInterpolatedAttribute(
102 attr: BufferAttribute,
103 i1: number,
104 i2: number,
105 i3: number,
106 barycoord: Vector3,
107 target: Vector4,
108 ): Vector4;
109 static isFrontFacing(a: Vector3, b: Vector3, c: Vector3, direction: Vector3): boolean;
110}