Vector3D class
A high-performance 3D vector representing Cartesian coordinates (x, y, z) and providing vector mathematics for spherical projections.
- Annotations
Constructors
- Vector3D(double x, double y, double z)
-
Creates an immutable 3D vector with the given
x,y, andzcomponents.const - Vector3D.fromDegrees(double latDegrees, double lngDegrees, [double radius = 1.0])
-
Converts geographic latitude and longitude (in degrees) into a 3D unit sphere vector.
factory
- Vector3D.fromSpherical(double latRadians, double lngRadians, [double radius = 1.0])
-
Converts geographic latitude and longitude (in radians) into a 3D unit sphere vector.
factory
Properties
- hashCode → int
-
The hash code for this object.
no setteroverride
- length → double
-
Returns the length (magnitude) of this vector.
no setter
- lengthSquared → double
-
Returns the squared length (magnitude) of this vector.
no setter
- normalized → Vector3D
-
Returns a normalized unit vector with the same direction, or zero if length is 0.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- x → double
-
The x-component of the vector.
final
- y → double
-
The y-component of the vector.
final
- z → double
-
The z-component of the vector.
final
Methods
-
angleTo(
Vector3D other) → double -
Computes the angular distance in radians between this unit vector and
other. -
cross(
Vector3D other) → Vector3D -
Computes the cross product of this vector and
other. -
distanceTo(
Vector3D other) → double -
Computes the Euclidean distance between this vector and
other. -
dot(
Vector3D other) → double -
Computes the dot product of this vector and
other. -
lerp(
Vector3D other, double t) → Vector3D -
Linearly interpolates between this vector and
otherby fractiont. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toLatitudeDegrees(
) → double - Converts this 3D point back into latitude (in degrees).
-
toLongitudeDegrees(
) → double - Converts this 3D point back into longitude (in degrees).
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator *(
double scalar) → Vector3D -
Multiplies this vector by scalar
scalar. -
operator +(
Vector3D other) → Vector3D -
Adds
otherto this vector. -
operator -(
Vector3D other) → Vector3D -
Subtracts
otherfrom this vector. -
operator /(
double scalar) → Vector3D -
Divides this vector by scalar
scalar. -
operator ==(
Object other) → bool -
The equality operator.
override