ImmutableTriangle


public final class ImmutableTriangle extends Triangle


An immutable triangle, defined by its three corners p0, p1 and p2 in order. This object is immutable, so it is inherently thread-safe. See MutableTriangle for the mutable version.

Summary

Public constructors

Public methods

boolean
equals(Object other)

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

@NonNull Vec

One of the three points that define the Triangle.

@NonNull Vec

One of the three points that define the Triangle.

@NonNull Vec

One of the three points that define the Triangle.

int
@NonNull String

Inherited methods

From androidx.ink.geometry.Triangle
final @NonNull ImmutableBox

Returns the minimum bounding box containing the Triangle.

final @NonNull MutableBox

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

final @NonNull ImmutableSegment
computeEdge(@IntRange(from = 0, to = 2) int index)

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

final @NonNull MutableSegment
computeEdge(
    @IntRange(from = 0, to = 2) int index,
    @NonNull MutableSegment outSegment
)

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

final float

Return the signed area of the Triangle.

final boolean

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

final boolean
isAlmostEqual(
    @NonNull Triangle other,
    @FloatRange(from = 0.0) float tolerance
)

Public constructors

ImmutableTriangle

Added in 1.0.0-alpha01
public ImmutableTriangle(@NonNull Vec p0, @NonNull Vec p1, @NonNull Vec p2)

Public methods

equals

public boolean equals(Object other)

Equality for ImmutableTriangle 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.

getP0

Added in 1.0.0-alpha01
public @NonNull Vec getP0()

One of the three points that define the Triangle.

getP1

Added in 1.0.0-alpha01
public @NonNull Vec getP1()

One of the three points that define the Triangle.

getP2

Added in 1.0.0-alpha01
public @NonNull Vec getP2()

One of the three points that define the Triangle.

hashCode

public int hashCode()

toString

public @NonNull String toString()