# ExtendedTriangle

class in `three-mesh-bvh`, extends `Triangle`

```js
import { ExtendedTriangle } from 'three-mesh-bvh';
```

An extended version of three.js' Triangle class. A variety of derivative values are cached on
the object to accelerate the intersection functions. `.needsUpdate` must be set to true when
modifying the triangle parameters.

## Properties

### .needsUpdate: boolean

Indicates that the triangle fields have changed so cached variables to accelerate other
function execution can be updated. Must be set to true after modifying the triangle
`a`, `b`, `c` fields.

## Methods

### .intersectsSphere

```js
.intersectsSphere( sphere: Sphere ): boolean
```

Returns whether the triangle intersects the given sphere.

- `sphere`, `Sphere`

### .closestPointToSegment

```js
.closestPointToSegment( segment: Line3, target1?: Vector3, target2?: Vector3 ): number
```

Returns the distance to the provided line segment. `target1` and `target2` are set to the
closest points on the triangle and segment respectively.

- `segment`, `Line3`
- `target1`, `Vector3`, optional
- `target2`, `Vector3`, optional

### .intersectsTriangle

```js
.intersectsTriangle( other: Triangle, target?: Line3, suppressLog?: boolean ): boolean
```

Returns whether the triangles intersect. `target` is set to the line segment representing
the intersection.

- `other`, `Triangle`
- `target`, `Line3`, optional
- `suppressLog`, `boolean`, optional, default `false`

### .distanceToPoint

```js
.distanceToPoint( point: Vector3 ): number
```

Returns the distance to the provided point.

- `point`, `Vector3`

### .distanceToTriangle

```js
.distanceToTriangle( other: Triangle, target1?: Vector3, target2?: Vector3 ): number
```

Returns the distance to the provided triangle.

- `other`, `Triangle`
- `target1`, `Vector3`, optional
- `target2`, `Vector3`, optional
