Vector3D class

Vector3, 3 components

Inheritance

Constructors

Vector3D({StructPointer<Vector3D>? op, double x = 0, double y = 0, double z = 0})
Vector3D.barycenter(Vector3D p, Vector3D a, Vector3D b, Vector3D c)
Computes the barycentric coordinates of point p relative to triangle (a, b, c).
factory
Vector3D.normalized(num x, num y, num z)
Creates a vector from x, y, z and immediately normalizes it.
factory
Vector3D.one()
factory
Vector3D.perpendicular(Vector3D o)
Returns a vector perpendicular to o by crossing it with its least-aligned cardinal axis.
factory
Vector3D.vec3(num x, num y, num z)
factory
Vector3D.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 setter
lengthSqr → double
Squared length of this vector.
no setter
op ↔ StructPointer<Vector3D>?
The C-owned or RaylibTemp-owned typed 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
x ↔ double
Vector x component
getter/setter pair
y ↔ double
Vector y component
getter/setter pair
z ↔ double
Vector z component
getter/setter pair

Methods

add(Vector3D o) → Vector3D
Returns a new vector that is the component-wise sum of this and o.
addValue(num value) → Vector3D
Returns a new vector with value added to each component.
angle(Vector3D o) → double
Angle between this vector and o in radians, in the range [0, π].
clamp(Vector3D min, Vector3D max) → Vector3D
Clamps each component of this vector between the corresponding components of min and max.
clampValue(double min, double max) → Vector3D
Clamps the length of this vector to the range [min, max].
clone() → Vector3D
Returns a deep copy of this instance, preserving op if present.
override
copy() → Vector3D
Returns a deep copy of this instance without op.
inherited
crossProduct(Vector3D o) → Vector3D
Cross product of this vector and o.
cubicHermite(Vector3D tangent1, Vector3D v2, Vector3D tangent2, double amount) → Vector3D
Interpolates along a cubic Hermite spline between this and v2.
distance(Vector3D o) → double
Euclidean distance between this vector and o.
distanceSqr(Vector3D o) → double
Squared Euclidean distance between this vector and o.
div(Vector3D o) → Vector3D
Returns a new vector that is the component-wise quotient of this and o.
divideBy(num o) → Vector3D
Returns a new vector with all components divided by o.
dotProduct(Vector3D o) → double
Dot product of this vector and o.
equals(Vector3D o) → bool
Returns true if this vector is approximately equal to o.
format([int x0 = 0, int? y0, int? z0]) → String
Returns a formatted string representation of this vector.
getOp() → StructPointer<Vector3D>
Returns op, throwing a descriptive StateError if unavailable or this instance RaylibTempStructState.isDisposed.
inherited
getOpAndDispose() → StructPointer<Vector3D>
Returns op and immediately disposes this struct.
inherited
invert() → Vector3D
Returns a new vector with each component replaced by its reciprocal (1/x, 1/y, 1/z).
lerp(Vector3D o, double amount) → Vector3D
Linear interpolation between this and o by amount.
max(Vector3D o) → Vector3D
Returns a new vector with each component being the component-wise maximum of this and o.
min(Vector3D o) → Vector3D
Returns a new vector with each component being the component-wise minimum of this and o.
moveTowards(Vector3D target, double maxDistance) → Vector3D
Moves this vector towards target by at most maxDistance.
mul(Vector3D o) → Vector3D
Returns a new vector that is the component-wise product of this and o.
negate() → Vector3D
Returns a new vector with all components negated.
normalize() → Vector3D
Returns a normalized (unit-length) copy of this vector.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
orthoNormalize(Vector3D o) → Vector3D
Orthonormalizes this vector against o using the Gram-Schmidt process.
project(Vector3D o) → Vector3D
Projects this vector onto o.
reflect(Vector3D normal) → Vector3D
Reflects this vector off a surface with the given normal.
refract(Vector3D n, double r) → Vector3D
Refracts this vector through a surface with normal n and ratio r.
reject(Vector3D o) → Vector3D
Rejects o from this vector.
rotateByAxisAngle(Vector3D axis, double angle) → Vector3D
Rotates this vector around axis by angle radians.
rotateByQuaternion(QuaternionD q) → Vector3D
Returns a new vector with this rotated by quaternion q.
scale(num o) → Vector3D
Returns a new vector with all components scaled by o.
set(num x, num y, num z) → Vector3D
Sets all components at once.
setDart(Vector3D o) → Vector3D
Copies the fields of o into this instance.
override
signature() → String
Returns a human-readable representation of this struct.
override
structAllocateInto(RaylibTemp<RaylibBase> temp, MemoryPointer<RType> p, String key) → void
Allocates nested pointers into temp under key as needed.
inherited
structMarkDisposed() → void
Marks this instance as disposed and clears op.
inherited
structOnOp(void callback(StructPointer<Vector3D> p)) → void
Calls callback with op if it is set, otherwise no-ops.
inherited
structReadFrom(MemoryPointer<RType> p) → void
override
structSetTag(String newTag) → Vector3D
Sets RaylibTempStructState.tag to newTag.
inherited
structSyncFromMemory() → void
Syncs all fields from the memory. Requires op.
inherited
structSyncToMemory() → void
Syncs all fields to the memory. Requires op.
inherited
structWriteInto(MemoryPointer<RType> p) → void
override
sub(Vector3D o) → Vector3D
Returns a new vector that is the component-wise difference of this and o.
subValue(num value) → Vector3D
Returns a new vector with value subtracted from each component.
toArray() → List<double>
Returns the components as a new double list.
toFloatV() → float3D
Returns the components as a float3D.
toString() → String
A string representation of this object.
inherited
transform(MatrixD o) → Vector3D
Transforms this vector by matrix o.
unproject(MatrixD projection, MatrixD view) → Vector3D
Unprojects this screen-space vector back into world space.

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Properties

field_x → StructValueField<double, RFloat>
Field descriptor for x.
final
field_y → StructValueField<double, RFloat>
Field descriptor for y.
final
field_z → StructValueField<double, RFloat>
Field descriptor for z.
final
struct → StructType<Vector3D>
Describes the raw memory layout, construction, and pointer representation of this struct type.
final
structLayout → StructLayout<Vector3Field>
Raw memory layout of this object.
final