MutableTriangle


class MutableTriangle : Triangle


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).

Create the MutableTriangle from three existing MutableVec instances.

Public functions

open operator Boolean
equals(other: Any?)

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

open Int
MutableTriangle

Copies the points from input to this MutableTriangle and returns this.

open String

Public properties

open MutableVec

One of the three points that define the Triangle.

open MutableVec

One of the three points that define the Triangle.

open MutableVec

One of the three points that define the Triangle.

Inherited functions

From androidx.ink.geometry.Triangle
ImmutableBox

Returns the minimum bounding box containing the Triangle.

MutableBox

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

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.

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.

Float

Return the signed area of the Triangle.

operator Boolean
contains(point: Vec)

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

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

Public constructors

MutableTriangle

Added in 1.0.0-alpha02
MutableTriangle()

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

MutableTriangle

Added in 1.0.0-alpha02
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

Added in 1.0.0-alpha02
fun populateFrom(input: Triangle): MutableTriangle

Copies the points from input to this MutableTriangle and returns this.

toString

open fun toString(): String

Public properties

p0

Added in 1.0.0-alpha02
open var p0MutableVec

One of the three points that define the Triangle.

p1

Added in 1.0.0-alpha02
open var p1MutableVec

One of the three points that define the Triangle.

p2

Added in 1.0.0-alpha02
open var p2MutableVec

One of the three points that define the Triangle.