Triangle

new Triangle(a?: Vector3, b?: Vector3, c?: Vector3)
THREE: THREE.Triangle

Three-vertex triangle with barycentric coordinate helpers, area computation, and intersection tests.

Properties

NameTypeDescription
a

Vector3

First vertex.

b

Vector3

Second vertex.

c

Vector3

Third vertex.

Methods

MethodDescription
set(a: Vector3, b: Vector3, c: Vector3): this

Sets all three vertices.

getArea(): number

Returns the area of the triangle.

getNormal(target?: Vector3): Vector3

Returns the face normal (unit length).

getBarycoord(point: Vector3, target?: Vector3): Vector3

Returns the barycentric coordinates of a point relative to this triangle.

containsPoint(point: Vector3): boolean

Returns true if the point lies inside the triangle.

isFrontFacing(direction: Vector3): boolean

Returns true if the triangle faces the given direction.

closestPointToPoint(point: Vector3, target?: Vector3): Vector3

Returns the closest point on the triangle to the given point.

clone(): Triangle

Returns a new Triangle with the same vertices.