MutableVec
public final class MutableVec extends 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 |
|---|
MutableVec(float x, float y) |
Public methods |
|
|---|---|
boolean |
|
float |
getX()The |
float |
getY()The |
int |
hashCode() |
final @NonNull MutableVec |
populateFrom(@NonNull Vec input)Fills this |
final @NonNull MutableVec |
populateFromDirectionInDegreesAndMagnitude(Fills this |
void |
setX(float x)The |
void |
setY(float y)The |
@NonNull String |
toString() |
Extension functions |
|
|---|---|
final @NonNull MutableVec |
AndroidGraphicsConverter.populateFrom(Fills this |
Inherited methods |
||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Public constructors
Public methods
populateFrom
public final @NonNull MutableVec populateFrom(@NonNull Vec input)
Fills this MutableVec with the same values contained in input.
populateFromDirectionInDegreesAndMagnitude
public final @NonNull MutableVec populateFromDirectionInDegreesAndMagnitude(
@AngleDegreesFloat float directionDegrees,
float magnitude
)
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
AndroidGraphicsConverter.populateFrom
public final @NonNull MutableVec AndroidGraphicsConverter.populateFrom(
@NonNull MutableVec receiver,
@NonNull PointF point
)
Fills this MutableVec with the values from point.
Leaves point unchanged. Returns the modified instance to allow chaining calls.
| Returns | |
|---|---|
@NonNull MutableVec |
|