ImmutableSegment


public final class ImmutableSegment extends Segment


Represents a directed line segment between two points. See MutableSegment for mutable alternative.

Summary

Public constructors

Public methods

boolean
equals(Object other)
@NonNull Vec
@NonNull Vec
int
@NonNull String

Inherited methods

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

Returns the minimum bounding box containing the Segment.

final @NonNull MutableBox

Populates outBox with the minimum bounding box containing the Segment.

final @NonNull ImmutableVec

Returns an ImmutableVec with the displacement from start to end.

final @NonNull MutableVec

Populates outVec with the displacement from start to end.

final @FloatRange(from = 0.0) float

The length of the Segment.

final @NonNull ImmutableVec
computeLerpPoint(float ratio)

Returns the point on the segment at the given ratio of the segment's length, measured from the start point.

final @NonNull MutableVec
computeLerpPoint(float ratio, @NonNull MutableVec outVec)

Fills outVec with the point on the segment at the given ratio of the segment's length, measured from the start point.

final @NonNull ImmutableVec

Returns an ImmutableVec that lies halfway along the segment.

final @NonNull MutableVec

Populates outVec with the point halfway along the segment.

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

Compares this Segment with other, and returns true if both start points are considered almost equal with the given tolerance, and likewise for both end points.

final float
project(@NonNull Vec pointToProject)

Returns the multiple of the segment's length at which the infinite extrapolation of this segment is closest to pointToProject.

Public constructors

ImmutableSegment

Added in 1.0.0-alpha01
public ImmutableSegment(@NonNull Vec start, @NonNull Vec end)

Public methods

equals

public boolean equals(Object other)

getEnd

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

getStart

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

hashCode

public int hashCode()

toString

public @NonNull String toString()