QuaternionD class

Quaternion, 4 components

A unit quaternion representing a 3D rotation as xi + yj + zk + w.

Inheritance

Constructors

QuaternionD({StructPointer<QuaternionD>? op, double x = 0, double y = 0, double z = 0, double w = 0})
QuaternionD.fromAxisAngle(Vector3D axis, double angle)
Returns a quaternion representing a rotation of angle radians around axis.
factory
QuaternionD.fromEuler(double pitch, double yaw, double roll)
Returns a quaternion from pitch, yaw, roll Euler angles (in radians).
factory
QuaternionD.fromMatrix(MatrixD mat)
Returns the quaternion equivalent of rotation matrix mat.
factory
QuaternionD.fromVector3ToVector3(Vector3D from, Vector3D to)
Returns the shortest-arc quaternion rotating from to to.
factory
QuaternionD.fromVector4(Vector4D v)
Returns a quaternion from the raw XYZW components of v.
factory
QuaternionD.identity()
Returns the identity quaternion (0, 0, 0, 1).
factory
QuaternionD.quat(num x, num y, num z, num w)
factory
QuaternionD.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 quaternion.
no setter
lengthSqr → double
Squared length of this quaternion.
no setter
op ↔ StructPointer<QuaternionD>?
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
w ↔ double
Real (scalar) component
getter/setter pair
x ↔ double
Imaginary i component
getter/setter pair
y ↔ double
Imaginary j component
getter/setter pair
z ↔ double
Imaginary k component
getter/setter pair

Methods

add(QuaternionD o) → QuaternionD
Returns a new quaternion that is the component-wise sum of this and o.
addValue(num value) → QuaternionD
Returns a new quaternion with value added to each component.
clone() → QuaternionD
Returns a deep copy of this instance, preserving op if present.
override
copy() → QuaternionD
Returns a deep copy of this instance without op.
inherited
cubicHermiteSpline(QuaternionD outTangent1, QuaternionD q2, QuaternionD inTangent2, double t) → QuaternionD
Interpolates along a cubic Hermite spline between this and q2.
distance(QuaternionD o) → double
Euclidean distance between this quaternion and o in 4D space.
distanceSqr(QuaternionD o) → double
Squared Euclidean distance between this quaternion and o.
div(QuaternionD o) → QuaternionD
Returns a new quaternion that is the component-wise quotient of this and o.
divideBy(num o) → QuaternionD
Returns a new quaternion with all components divided by o.
dotProduct(QuaternionD o) → double
Dot product of this quaternion and o.
equals(QuaternionD o) → bool
Returns true if this quaternion is approximately equal to o.
format([int x0 = 0, int? y0, int? z0, int? w0]) → String
Returns a formatted string representation of this quaternion.
getOp() → StructPointer<QuaternionD>
Returns op, throwing a descriptive StateError if unavailable or this instance RaylibTempStructState.isDisposed.
inherited
getOpAndDispose() → StructPointer<QuaternionD>
Returns op and immediately disposes this struct.
inherited
invert() → QuaternionD
Returns the inverse (conjugate divided by squared length) of this quaternion.
lerp(QuaternionD o, double amount) → QuaternionD
Linear interpolation between this and o by amount (component-wise).
max(QuaternionD o) → QuaternionD
Returns a new quaternion with each component being the component-wise maximum of this and o.
min(QuaternionD o) → QuaternionD
Returns a new quaternion with each component being the component-wise minimum of this and o.
mul(QuaternionD o) → QuaternionD
Returns the Hamilton product of this quaternion and o.
negate() → QuaternionD
Returns a new quaternion with all components negated.
nLerp(QuaternionD o, double amount) → QuaternionD
Normalized linear interpolation between this and o by amount.
normalize() → QuaternionD
Returns a normalized (unit-length) copy of this quaternion.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
scale(num o) → QuaternionD
Returns a new quaternion with all components scaled by o.
set(num x, num y, num z, num w) → QuaternionD
Sets all components at once.
setDart(QuaternionD o) → QuaternionD
Copies the fields of o into this instance.
override
signature() → String
Returns a human-readable representation of this struct.
override
sLerp(QuaternionD o, double amount) → QuaternionD
Spherical linear interpolation between this and o by amount.
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<QuaternionD> p)) → void
Calls callback with op if it is set, otherwise no-ops.
inherited
structReadFrom(MemoryPointer<RType> p) → void
override
structSetTag(String newTag) → QuaternionD
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(QuaternionD o) → QuaternionD
Returns a new quaternion that is the component-wise difference of this and o.
subValue(num value) → QuaternionD
Returns a new quaternion with value subtracted from each component.
toArray() → List<double>
Returns the components as a new double list.
toAxisAngle() → (Vector3D, double)
Decomposes this quaternion into an axis–angle representation.
toEuler() → Vector3D
Converts this quaternion to Euler angles (roll, pitch, yaw) in radians.
toMatrix() → MatrixD
Converts this quaternion to an equivalent rotation matrix.
toString() → String
A string representation of this object.
inherited
toVector4() → Vector4D
Converts this quaternion to a V4 with the same (x, y, z, w) components.
transform(MatrixD mat) → QuaternionD
Transforms this quaternion by the given matrix mat.

Operators

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

Static Properties

field_w → StructValueField<double, RFloat>
Field descriptor for w.
final
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<QuaternionD>
Describes the raw memory layout, construction, and pointer representation of this struct type.
final
structLayout → StructLayout<QuaternionField>
Raw memory layout of this object.
final