Vector2D class
- Inheritance
-
- Object
- RaylibStructBase<
RaylibTemp, Pointer< Vector2C> , Vector2D> - StructD<
Vector2C, Vector2D> - StructDLiteral<
Vector2C, Vector2D> - Vector2D
- Mixed-in types
Constructors
-
Vector2D({Pointer<
Vector2C> ? originalPointer, double x = 0, double y = 0}) - Vector2D.one()
-
factory
- Vector2D.vec2(num x, num y)
-
factory
- Vector2D.zero()
-
factory
Properties
- $state → RaylibTempStructState
-
Per-instance allocation state tracking slot keys, disposal, and identity.
finalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- length → double
-
Euclidean length (magnitude) of this vector.
no setterinherited
- lengthSqr → double
-
Squared length of this vector.
no setterinherited
-
originalPointer
↔ Pointer<
Vector2C> ? -
The C-owned or RaylibTemp-owned native pointer for this struct, if any.
getter/setter pairinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- structIsDisposed → bool
-
Whether structMarkDisposed has been called on this instance.
no setterinherited
- structName → String
-
The Dart-side type name of this struct
no setterinherited
- structRequiresOriginalPointer → bool
-
Whether this struct requires an originalPointer to function correctly.
no setterinherited
- x ↔ double
-
X component
getter/setter pairoverride
- y ↔ double
-
Y component
getter/setter pairoverride
Methods
-
add(
Vector2D o) → Vector2D -
Returns a new vector that is the component-wise sum of this and
o.inherited -
addValue(
num value) → Vector2D -
Returns a new vector with
valueadded to each component.inherited -
angle(
Vector2D o) → double -
Angle between this vector and
oin radians.inherited -
clamp(
Vector2D min, Vector2D max) → Vector2D -
Clamps each component of this vector between the corresponding components of
minandmax.inherited -
clampValue(
double min, double max) → Vector2D -
Clamps the length of this vector to the range
[min, max].inherited -
clone(
) → Vector2D -
Returns a deep copy of this instance, preserving RaylibStructBase.originalPointer if present.
override
-
copy(
) → Vector2D -
Returns a deep copy of this instance without RaylibStructBase.originalPointer.
inherited
-
distance(
Vector2D o) → double -
Euclidean distance between this vector and
o.inherited -
distanceSqr(
Vector2D o) → double -
Squared Euclidean distance between this vector and
o.inherited -
div(
Vector2D o) → Vector2D -
Returns a new vector that is the component-wise quotient of this and
o.inherited -
divideBy(
num o) → Vector2D -
Returns a new vector with all components divided by
o.inherited -
dotProduct(
Vector2D o) → double -
Dot product of this vector and
o.inherited -
equals(
Vector2D o) → bool -
Returns
trueif this vector is approximately equal too.inherited -
format(
[int x0 = 0, int? y0]) → String -
Returns a formatted string representation of this vector.
inherited
-
getOriginalPointer(
) → Pointer< Vector2C> -
Returns originalPointer, throwing a descriptive StateError if unavailable or this instance RaylibTempStructState.isDisposed.
inherited
-
getOriginalPointerAndDispose(
) → Pointer< Vector2C> -
Returns originalPointer and immediately calls structMarkDisposed.
inherited
-
invert(
) → Vector2D -
Returns a new vector with each component replaced by its reciprocal (
1/x,1/y).inherited -
lerp(
Vector2D o, double amount) → Vector2D -
Linear interpolation between this and
obyamount.inherited -
lineAngle(
Vector2D o) → double -
Angle of the line from this point to
o, relative to the X axis.inherited -
max(
Vector2D o) → Vector2D -
Returns a new vector with each component being the component-wise maximum of this and
o.inherited -
min(
Vector2D o) → Vector2D -
Returns a new vector with each component being the component-wise minimum of this and
o.inherited -
moveTowards(
Vector2D target, double maxDistance) → Vector2D -
Moves this vector towards
targetby at mostmaxDistance.inherited -
mul(
Vector2D o) → Vector2D -
Returns a new vector that is the component-wise product of this and
o.inherited -
nativeGetIndexedArrayReference(
Array< Vector2C> p, int index) → Vector2C -
override
-
nativeGetIndexedReference(
Pointer< Vector2C> p, int index) → Vector2C -
override
-
nativeGetReference(
Pointer< Vector2C> p) → Vector2C -
inherited
-
nativeReadFrom(
Vector2C p) → void -
override
-
nativeWriteInto(
Vector2C p) → void -
Writes all fields directly into the native struct reference
p. For nested structs, usewriteIntoas well.override -
negate(
) → Vector2D -
Returns a new vector with all components negated.
inherited
-
normalize(
) → Vector2D -
Returns a normalized (unit-length) copy of this vector.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
reflect(
Vector2D normal) → Vector2D -
Reflects this vector off a surface with the given
normal.inherited -
refract(
Vector2D n, double r) → Vector2D -
Refracts this vector through a surface with normal
nand ratior.inherited -
rotate(
double angle) → Vector2D -
Rotates this vector by
angleradians around the origin.inherited -
scale(
num o) → Vector2D -
Returns a new vector with all components scaled by
o.inherited -
set(
num x, num y) → Vector2D -
Sets all components at once.
inherited
-
setD(
Vector2D o) → Vector2D -
Copies the fields of
ointo this instance and returnsthis.override -
signature(
) → String -
Returns a human-readable representation of this struct.
inherited
-
structAllocateInto(
RaylibTemp temp, Pointer< Vector2C> p, String key) → void -
Writes all fields into the native struct at
p, allocating nested pointers intotempunderkeyas needed.inherited -
structMarkDisposed(
) → void -
Marks this instance as disposed and clears originalPointer.
inherited
-
structOnOp(
void callback(Pointer< Vector2C> p)) → void -
Calls
callbackwith originalPointer if it is set, otherwise no-ops.inherited -
structReadFrom(
Pointer< Vector2C> p) → void -
Reads all fields from the memory at
p.inherited -
structSetTag(
String newTag) → Vector2D -
Sets RaylibTempStructState.tag to
newTagand returnsthisfor chaining.inherited -
structSyncFromMemory(
) → void -
Syncs all fields from the memory. Requires originalPointer.
inherited
-
structSyncInto(
RaylibTemp temp, Pointer< Vector2C> p, String key) → void -
Syncs Dart-side fields into the already-allocated native pointer
p.inherited -
structSyncToMemory(
) → void -
Syncs all fields to the memory. Requires originalPointer.
inherited
-
structWriteInto(
Pointer< Vector2C> p) → void -
Writes all fields into the memory at
p.inherited -
sub(
Vector2D o) → Vector2D -
Returns a new vector that is the component-wise difference of this and
o.inherited -
subValue(
num value) → Vector2D -
Returns a new vector with
valuesubtracted from each component.inherited -
toArray(
) → List< double> -
Returns the components as a new double list.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
transform(
MatrixD o) → Vector2D -
Transforms this vector by matrix
o.inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited