MutableVec
-
android
class MutableVec : Vec
A mutable two-dimensional vector, i.e. an (x, y) coordinate pair. It can be used to represent either:
-
A two-dimensional offset, i.e. the difference between two points
-
A point in space, i.e. treating the vector as an offset from the origin
This object is mutable and is not inherently thread-safe, so callers should apply their own synchronization logic or use this object from a single thread. See ImmutableVec for an immutable alternative.
Summary
Public constructors |
|
|---|---|
|
android
|
|
MutableVec(x: Float, y: Float) |
android
|
Public functions |
||
|---|---|---|
open operator Boolean |
android
|
|
open Int |
hashCode() |
android
|
MutableVec |
populateFrom(input: Vec)Fills this |
android
|
MutableVec |
populateFromDirectionInDegreesAndMagnitude(Fills this |
android
|
open String |
toString() |
android
|
Public properties |
||
|---|---|---|
open Float |
The |
android
|
open Float |
The |
android
|
Extension functions |
||
|---|---|---|
MutableVec |
MutableVec.populateFrom(point: PointF)Fills this |
android
|
MutableVec |
MutableVec.populateFrom(offset: Offset)Writes the values from |
android
|
Inherited functions |
||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Public functions
populateFrom
fun populateFrom(input: Vec): MutableVec
Fills this MutableVec with the same values contained in input.
populateFromDirectionInDegreesAndMagnitude
fun populateFromDirectionInDegreesAndMagnitude(
directionDegrees: @AngleDegreesFloat Float,
magnitude: Float
): MutableVec
Fills this MutableVec to have the given magnitude and direction in degrees rotated from the positive x-axis in the direction of positive y-axis.
Extension functions
populateFrom
fun MutableVec.populateFrom(point: PointF): MutableVec
Fills this MutableVec with the values from point.
Leaves point unchanged. Returns the modified instance to allow chaining calls.
| Returns | |
|---|---|
MutableVec |
|
populateFrom
fun MutableVec.populateFrom(offset: Offset): MutableVec
Writes the values from offset to this MutableVec.
Returns the modified instance to allow chaining function calls.
| Returns | |
|---|---|
MutableVec |
|