# ImmutableTriangle

Artifact: [androidx.ink:ink-geometry](https://developer.android.com/jetpack/androidx/releases/ink) [View Source](https://cs.android.com/search?q=file:androidx/ink/geometry/ImmutableTriangle.kt+class:androidx.ink.geometry.ImmutableTriangle) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/ink#1.0.0)

*** ** * ** ***

<br />

```
public final class ImmutableTriangle extends Triangle
```

<br />

|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) |||
| ↳ | [androidx.ink.geometry.Triangle](https://developer.android.com/reference/androidx/ink/geometry/Triangle) ||
|   | ↳ | [androidx.ink.geometry.ImmutableTriangle](https://developer.android.com/reference/androidx/ink/geometry/ImmutableTriangle) |

*** ** * ** ***

An immutable triangle, defined by its three corners `https://developer.android.com/reference/androidx/ink/geometry/ImmutableTriangle#(androidx.ink.geometry.Vec,androidx.ink.geometry.Vec,androidx.ink.geometry.Vec)`, `https://developer.android.com/reference/androidx/ink/geometry/ImmutableTriangle#(androidx.ink.geometry.Vec,androidx.ink.geometry.Vec,androidx.ink.geometry.Vec)` and `https://developer.android.com/reference/androidx/ink/geometry/ImmutableTriangle#(androidx.ink.geometry.Vec,androidx.ink.geometry.Vec,androidx.ink.geometry.Vec)` in order. This object is immutable, so it is inherently thread-safe. See `https://developer.android.com/reference/androidx/ink/geometry/MutableTriangle` for the mutable version.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/ink/geometry/ImmutableTriangle#ImmutableTriangle(androidx.ink.geometry.Vec,androidx.ink.geometry.Vec,androidx.ink.geometry.Vec)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/geometry/Vec p0, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/geometry/Vec p1, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/geometry/Vec p2)` |

| ### Public methods |
|---|---|
| `boolean` | `https://developer.android.com/reference/androidx/ink/geometry/ImmutableTriangle#equals(kotlin.Any)(https://developer.android.com/reference/java/lang/Object.html other)` Equality for `https://developer.android.com/reference/androidx/ink/geometry/ImmutableTriangle` is defined using the order in which `https://developer.android.com/reference/androidx/ink/geometry/ImmutableTriangle#p0()`, `https://developer.android.com/reference/androidx/ink/geometry/ImmutableTriangle#p1()` and `https://developer.android.com/reference/androidx/ink/geometry/ImmutableTriangle#p2()` are defined. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/geometry/ImmutableVec` | `https://developer.android.com/reference/androidx/ink/geometry/ImmutableTriangle#getP0()()` One of the three points that define the `https://developer.android.com/reference/androidx/ink/geometry/Triangle`. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/geometry/ImmutableVec` | `https://developer.android.com/reference/androidx/ink/geometry/ImmutableTriangle#getP1()()` One of the three points that define the `https://developer.android.com/reference/androidx/ink/geometry/Triangle`. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/geometry/ImmutableVec` | `https://developer.android.com/reference/androidx/ink/geometry/ImmutableTriangle#getP2()()` One of the three points that define the `https://developer.android.com/reference/androidx/ink/geometry/Triangle`. |
| `int` | `https://developer.android.com/reference/androidx/ink/geometry/ImmutableTriangle#hashCode()()` |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/geometry/ImmutableTriangle` | `https://developer.android.com/reference/androidx/ink/geometry/ImmutableTriangle#toImmutable()()` Returns an immutable copy of this object. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/ink/geometry/ImmutableTriangle#toString()()` |

### Inherited methods

From [androidx.ink.geometry.Triangle](https://developer.android.com/reference/androidx/ink/geometry/Triangle) `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/geometry/ImmutableBox` `https://developer.android.com/reference/androidx/ink/geometry/Triangle#computeBoundingBox()()`

Returns the minimum bounding box containing the `https://developer.android.com/reference/androidx/ink/geometry/Triangle`.
`final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/geometry/MutableBox` `https://developer.android.com/reference/androidx/ink/geometry/Triangle#computeBoundingBox(androidx.ink.geometry.MutableBox)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/geometry/MutableBox outBox)`

Populates `https://developer.android.com/reference/androidx/ink/geometry/Triangle#computeBoundingBox(androidx.ink.geometry.MutableBox)` with the minimum bounding box containing the `https://developer.android.com/reference/androidx/ink/geometry/Triangle` and returns `https://developer.android.com/reference/androidx/ink/geometry/Triangle#computeBoundingBox(androidx.ink.geometry.MutableBox)`.
`final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/geometry/ImmutableSegment` `https://developer.android.com/reference/androidx/ink/geometry/Triangle#computeEdge(kotlin.Int)(@https://developer.android.com/reference/androidx/annotation/IntRange(from = 0, to = 2) int index)`

Returns the segment of the Triangle between the point at `https://developer.android.com/reference/androidx/ink/geometry/Triangle#computeEdge(kotlin.Int)` and the point at `https://developer.android.com/reference/androidx/ink/geometry/Triangle#computeEdge(kotlin.Int)` + 1 modulo 3.
`final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/geometry/MutableSegment` `https://developer.android.com/reference/androidx/ink/geometry/Triangle#computeEdge(kotlin.Int,androidx.ink.geometry.MutableSegment)(

@https://developer.android.com/reference/androidx/annotation/IntRange(from = 0, to = 2) int index,

@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/geometry/MutableSegment outSegment

)`

Fills `https://developer.android.com/reference/androidx/ink/geometry/Triangle#computeEdge(kotlin.Int,androidx.ink.geometry.MutableSegment)` with the segment of the Triangle between the point at `https://developer.android.com/reference/androidx/ink/geometry/Triangle#computeEdge(kotlin.Int,androidx.ink.geometry.MutableSegment)` and the point at `https://developer.android.com/reference/androidx/ink/geometry/Triangle#computeEdge(kotlin.Int,androidx.ink.geometry.MutableSegment)` + 1 modulo 3.
`final float` `https://developer.android.com/reference/androidx/ink/geometry/Triangle#computeSignedArea()()`

Return the signed area of the `https://developer.android.com/reference/androidx/ink/geometry/Triangle`.
`final boolean` `https://developer.android.com/reference/androidx/ink/geometry/Triangle#contains(androidx.ink.geometry.Vec)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/geometry/Vec point)`

Returns true if the given point is contained within the Triangle.
`final boolean` `https://developer.android.com/reference/androidx/ink/geometry/Triangle#isAlmostEqual(androidx.ink.geometry.Triangle,kotlin.Float)(

@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/ink/geometry/Triangle other,

@https://developer.android.com/reference/androidx/annotation/FloatRange(from = 0.0) float tolerance

)`

## Public constructors

### ImmutableTriangle

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/ink#1.0.0)

```
public ImmutableTriangle(@NonNull Vec p0, @NonNull Vec p1, @NonNull Vec p2)
```

## Public methods

### equals

```
public boolean equals(Object other)
```

Equality for `https://developer.android.com/reference/androidx/ink/geometry/ImmutableTriangle` is defined using the order in which `https://developer.android.com/reference/androidx/ink/geometry/ImmutableTriangle#p0()`, `https://developer.android.com/reference/androidx/ink/geometry/ImmutableTriangle#p1()` and `https://developer.android.com/reference/androidx/ink/geometry/ImmutableTriangle#p2()` are defined. Rotated/flipped triangles with out-of-order vertices are not considered equal.

### getP0

```
public @NonNull ImmutableVec getP0()
```

One of the three points that define the `https://developer.android.com/reference/androidx/ink/geometry/Triangle`.

### getP1

```
public @NonNull ImmutableVec getP1()
```

One of the three points that define the `https://developer.android.com/reference/androidx/ink/geometry/Triangle`.

### getP2

```
public @NonNull ImmutableVec getP2()
```

One of the three points that define the `https://developer.android.com/reference/androidx/ink/geometry/Triangle`.

### hashCode

```
public int hashCode()
```

### toImmutable

```
public @NonNull ImmutableTriangle toImmutable()
```

Returns an immutable copy of this object. This will return itself if called on an immutable instance.

### toString

```
public @NonNull String toString()
```