MutableSegment
-
Cmn
class MutableSegment : Segment
Represents a mutable directed line segment between two points. See ImmutableSegment for the immutable alternative.
Summary
Public constructors |
|
|---|---|
|
Constructs a degenerate |
Cmn
|
MutableSegment(start: MutableVec, end: MutableVec)Create the |
Cmn
|
Public functions |
||
|---|---|---|
open operator Boolean |
Cmn
|
|
open Int |
hashCode() |
Cmn
|
MutableSegment |
populateFrom(input: Segment)Fills this |
Cmn
|
open ImmutableSegment |
Returns an immutable copy of this object. |
Cmn
|
open String |
toString() |
Cmn
|
Public properties |
||
|---|---|---|
open MutableVec |
Cmn
|
|
open MutableVec |
Cmn
|
Inherited functions |
|||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
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
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 |
|
toImmutable
open fun toImmutable(): ImmutableSegment
Returns an immutable copy of this object. This will return itself if called on an immutable instance.