MutableSegment



Represents a mutable directed line segment between two points. See ImmutableSegment for the immutable alternative.

Summary

Public constructors

Constructs a degenerate MutableSegment with both start and end set to (0f, 0f)

Cmn

Create the MutableSegment from two existing MutableVec instances.

Cmn

Public functions

open operator Boolean
equals(other: Any?)
Cmn
open Int
Cmn
MutableSegment

Fills this MutableSegment with the same values contained in input.

Cmn
open String
Cmn

Public properties

open MutableVec
Cmn
open MutableVec
Cmn

Inherited functions

From androidx.ink.geometry.Segment
ImmutableBox

Returns the minimum bounding box containing the Segment.

Cmn
MutableBox

Populates outBox with the minimum bounding box containing the Segment.

Cmn
ImmutableVec

Returns an ImmutableVec with the displacement from start to end.

Cmn
MutableVec

Populates outVec with the displacement from start to end.

Cmn
@FloatRange(from = 0.0) Float

The length of the Segment.

Cmn
ImmutableVec

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

Cmn
MutableVec
computeLerpPoint(ratio: Float, outVec: MutableVec)

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

Cmn
ImmutableVec

Returns an ImmutableVec that lies halfway along the segment.

Cmn
MutableVec

Populates outVec with the point halfway along the segment.

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

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.

Cmn
Float
project(pointToProject: Vec)

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

Cmn

Public constructors

MutableSegment

MutableSegment()

Constructs a degenerate MutableSegment with both start and end set to (0f, 0f)

MutableSegment

MutableSegment(start: MutableVec, end: MutableVec)

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

Public functions

equals

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

hashCode

open fun hashCode(): Int

populateFrom

fun populateFrom(input: Segment): MutableSegment

Fills this MutableSegment with the same values contained in input.

Returns the modified instance to allow chaining calls.

Returns
MutableSegment

this

toString

open fun toString(): String

Public properties

end

open var endMutableVec

start

open var startMutableVec