# MutableTriangle

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/MutableTriangle.kt+class:androidx.ink.geometry.MutableTriangle) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/ink#1.0.0)

*** ** * ** ***

Common/AllAndroid/JVMNative/C/iOS
- Cmn

  ```
  class MutableTriangle : Triangle
  ```

|---|---|---|
| [kotlin.Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html) |||
| ↳ | [androidx.ink.geometry.Triangle](https://developer.android.com/reference/kotlin/androidx/ink/geometry/Triangle) ||
|   | ↳ | [androidx.ink.geometry.MutableTriangle](https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableTriangle) |

*** ** * ** ***

Represents a mutable triangle, defined by its three corners `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableTriangle#p0()`, `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableTriangle#p1()` and `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableTriangle#p2()` in order. See `https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableTriangle` for the immutable version.

## Summary

| ### Public constructors |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableTriangle#MutableTriangle()()` Constructs a degenerate `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableTriangle` with `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableTriangle#p0()`, `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableTriangle#p1()`, and `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableTriangle#p2()` set to (0, 0). | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableTriangle#MutableTriangle(androidx.ink.geometry.MutableVec,androidx.ink.geometry.MutableVec,androidx.ink.geometry.MutableVec)(p0: https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableVec, p1: https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableVec, p2: https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableVec)` Create the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableTriangle` from three existing `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableVec` instances. | Cmn |

| ### Public functions |
|---|---|---|
| `open operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableTriangle#equals(kotlin.Any)(other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)` Equality for `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableTriangle` is defined using the order in which `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableTriangle#p0()`, `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableTriangle#p1()` and `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableTriangle#p2()` are defined. | Cmn |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableTriangle#hashCode()()` | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableTriangle` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableTriangle#populateFrom(androidx.ink.geometry.Triangle)(input: https://developer.android.com/reference/kotlin/androidx/ink/geometry/Triangle)` Fills this `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableTriangle` with the values from `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableTriangle#populateFrom(androidx.ink.geometry.Triangle)`. | Cmn |
| `open https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableTriangle` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableTriangle#toImmutable()()` Returns an immutable copy of this object. | Cmn |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableTriangle#toString()()` | Cmn |

| ### Public properties |
|---|---|---|
| `open https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableVec` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableTriangle#p0()` One of the three points that define the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Triangle`. | Cmn |
| `open https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableVec` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableTriangle#p1()` One of the three points that define the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Triangle`. | Cmn |
| `open https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableVec` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableTriangle#p2()` One of the three points that define the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Triangle`. | Cmn |

### Inherited functions

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

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

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

Returns the segment of the Triangle between the point at `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Triangle#computeEdge(kotlin.Int)` and the point at `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Triangle#computeEdge(kotlin.Int)` + 1 modulo 3.
Cmn `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableSegment` `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Triangle#computeEdge(kotlin.Int,androidx.ink.geometry.MutableSegment)(index: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0, to = 2) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, outSegment: https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableSegment)`

Fills `https://developer.android.com/reference/kotlin/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/kotlin/androidx/ink/geometry/Triangle#computeEdge(kotlin.Int,androidx.ink.geometry.MutableSegment)` and the point at `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Triangle#computeEdge(kotlin.Int,androidx.ink.geometry.MutableSegment)` + 1 modulo 3.
Cmn `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Triangle#computeSignedArea()()`

Return the signed area of the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Triangle`.
Cmn `operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Triangle#contains(androidx.ink.geometry.Vec)(point: https://developer.android.com/reference/kotlin/androidx/ink/geometry/Vec)`

Returns true if the given point is contained within the Triangle.
Cmn `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Triangle#isAlmostEqual(androidx.ink.geometry.Triangle,kotlin.Float)(other: https://developer.android.com/reference/kotlin/androidx/ink/geometry/Triangle, tolerance: @https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0.0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` Cmn

## Public constructors

### MutableTriangle

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

```
MutableTriangle()
```

Constructs a degenerate `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableTriangle` with `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableTriangle#p0()`, `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableTriangle#p1()`, and `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableTriangle#p2()` set to (0, 0).

### MutableTriangle

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

```
MutableTriangle(p0: MutableVec, p1: MutableVec, p2: MutableVec)
```

Create the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableTriangle` from three existing `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableVec` instances. Note that these instances will become the internal state of this `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableTriangle`, so modifications made to them directly or through setters on this `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableTriangle` will modify the input `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableVec` instances too. This is to allow performance-critical code to avoid any unnecessary allocations. This can be tricky to manage, especially in multithreaded code, so when calling code is unable to guarantee ownership of the nested mutable data at a particular time, it may be safest to construct this with copies of the data to give this `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableTriangle` exclusive ownership of those copies.

## Public functions

### equals

Cmn

```
open operator fun equals(other: Any?): Boolean
```

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

### hashCode

Cmn

```
open fun hashCode(): Int
```

### populateFrom

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

```
fun populateFrom(input: Triangle): MutableTriangle
```

Fills this `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableTriangle` with the values from `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableTriangle#populateFrom(androidx.ink.geometry.Triangle)`.

Returns the modified instance to allow chaining calls.

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableTriangle` | `this` |

### toImmutable

Cmn

```
open fun toImmutable(): ImmutableTriangle
```

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

### toString

Cmn

```
open fun toString(): String
```

## Public properties

### p0

Cmn

```
open var p0: MutableVec
```

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

### p1

Cmn

```
open var p1: MutableVec
```

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

### p2

Cmn

```
open var p2: MutableVec
```

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