MutableTriangle



Represents a mutable triangle, defined by its three corners p0, p1 and p2 in order. See ImmutableTriangle for the immutable version.

Summary

Public constructors

Constructs a degenerate MutableTriangle with p0, p1, and p2 set to (0, 0).

android

Create the MutableTriangle from three existing MutableVec instances.

android

Public functions

open operator Boolean
equals(other: Any?)

Equality for MutableTriangle is defined using the order in which p0, p1 and p2 are defined.

android
open Int
android
MutableTriangle

Fills this MutableTriangle with the values from input.

android
open String
android

Public properties

open MutableVec

One of the three points that define the Triangle.

android
open MutableVec

One of the three points that define the Triangle.

android
open MutableVec

One of the three points that define the Triangle.

android

Inherited functions

From androidx.ink.geometry.Triangle
ImmutableBox

Returns the minimum bounding box containing the Triangle.

android
MutableBox

Populates outBox with the minimum bounding box containing the Triangle and returns outBox.

android
ImmutableSegment
computeEdge(index: @IntRange(from = 0, to = 2) Int)

Returns the segment of the Triangle between the point at index and the point at index + 1 modulo 3.

android
MutableSegment
computeEdge(index: @IntRange(from = 0, to = 2) Int, outSegment: MutableSegment)

Fills outSegment with the segment of the Triangle between the point at index and the point at index + 1 modulo 3.

android
Float

Return the signed area of the Triangle.

android
operator Boolean
contains(point: Vec)

Returns true if the given point is contained within the Triangle.

android
Boolean
isAlmostEqual(other: Triangle, tolerance: @FloatRange(from = 0.0) Float)
android

Public constructors

MutableTriangle

MutableTriangle()

Constructs a degenerate MutableTriangle with p0, p1, and p2 set to (0, 0).

MutableTriangle

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

Create the MutableTriangle from three existing MutableVec instances. Note that these instances will become the internal state of this MutableTriangle, so modifications made to them directly or through setters on this MutableTriangle will modify the input 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 MutableTriangle exclusive ownership of those copies.

Public functions

equals

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

Equality for MutableTriangle is defined using the order in which p0, p1 and p2 are defined. Rotated/flipped triangles with out-of-order vertices are not considered equal.

hashCode

open fun hashCode(): Int

populateFrom

fun populateFrom(input: Triangle): MutableTriangle

Fills this MutableTriangle with the values from input.

Returns the modified instance to allow chaining calls.

Returns
MutableTriangle

this

toString

open fun toString(): String

Public properties

p0

open var p0MutableVec

One of the three points that define the Triangle.

p1

open var p1MutableVec

One of the three points that define the Triangle.

p2

open var p2MutableVec

One of the three points that define the Triangle.