vec3 library

Constants

dist → const double Function(List<double> a, List<double> b)
Alias for {@link vec3.distance} @function
div → const List<double> Function(List<double> out, List<double> a, List<double> b)
Alias for {@link vec3.divide} @function
len → const double Function(List<double> a)
Alias for {@link vec3.length} @function
mul → const List<double> Function(List<double> out, List<double> a, List<double> b)
Alias for {@link vec3.multiply} @function
sqrDist → const double Function(List<double> a, List<double> b)
Alias for {@link vec3.squaredDistance} @function
sqrLen → const double Function(List<double> a)
Alias for {@link vec3.squaredLength} @function
sub → const List<double> Function(List<double> out, List<double> a, List<double> b)
Alias for {@link vec3.subtract} @function

Properties

forEach List<double> Function(List<double> a, int? stride, int? offset, int? count, dynamic fn, dynamic arg)
Perform some operation over an array of vec3s.
final

Functions

add(List<double> out, List<double> a, List<double> b) List<double>
Adds two vec3's
angle(List<double> a, List<double> b) double
Get the angle between two 3D vectors @param {ReadonlyVec3} a The first operand @param {ReadonlyVec3} b The second operand @returns {Number} The angle in radians
bezier(dynamic out, dynamic a, dynamic b, dynamic c, dynamic d, dynamic t) List<double>
Performs a bezier interpolation with two control points
ceil(List<double> out, List<double> a) List<double>
math.ceil the components of a vec3
clone(dynamic a) List<double>
Creates a new vec3 initialized with values from an existing vector
copy(List<double> out, dynamic a) List<double>
Copy the values from one vec3 to another
create() List<double>
Creates a new, empty vec3
cross(List<double> out, List<double> a, List<double> b) List<double>
Computes the cross product of two vec3's
distance(List<double> a, List<double> b) double
Calculates the euclidian distance between two vec3's
divide(List<double> out, List<double> a, List<double> b) List<double>
Divides two vec3's
dot(List<double> a, List<double> b) double
Calculates the dot product of two vec3's
equals(dynamic a, dynamic b) bool
Returns whether or not the vectors have approximately the same elements in the same position.
exactEquals(dynamic a, dynamic b) bool
Returns whether or not the vectors have exactly the same elements in the same position (when compared with ==)
floor(List<double> out, List<double> a) List<double>
math.floor the components of a vec3
fromValues(double x, double y, double z) List<double>
Creates a new vec3 initialized with the given values
hermite(dynamic out, dynamic a, dynamic b, dynamic c, dynamic d, dynamic t) List<double>
Performs a hermite interpolation with two control points
inverse(List<double> out, List<double> a) List<double>
Returns the inverse of the components of a vec3
length(List<double> a) double
Calculates the length of a vec3
lerp(List<double> out, List<double> a, List<double> b, double t) List<double>
Performs a linear interpolation between two vec3's
max(List<double> out, List<double> a, List<double> b) List<double>
Returns the maximum of two vec3's
min(List<double> out, List<double> a, List<double> b) List<double>
Returns the minimum of two vec3's
multiply(List<double> out, List<double> a, List<double> b) List<double>
Multiplies two vec3's
negate(List<double> out, List<double> a) List<double>
Negates the components of a vec3
normalize(List<double> out, List<double> a) List<double>
Normalize a vec3
random(List<double> out, double? scale) List<double>
Generates a random vector with the given scale
rotateX(List<double> out, List<double> a, List<double> b, double rad) List<double>
Rotate a 3D vector around the x-axis @param {vec3} out The receiving vec3 @param {ReadonlyVec3} a The vec3 point to rotate @param {ReadonlyVec3} b The origin of the rotation @param {Number} rad The angle of rotation in radians @returns {vec3} out
rotateY(List<double> out, List<double> a, List<double> b, double rad) List<double>
Rotate a 3D vector around the y-axis @param {vec3} out The receiving vec3 @param {ReadonlyVec3} a The vec3 point to rotate @param {ReadonlyVec3} b The origin of the rotation @param {Number} rad The angle of rotation in radians @returns {vec3} out
rotateZ(List<double> out, List<double> a, List<double> b, double rad) List<double>
Rotate a 3D vector around the z-axis @param {vec3} out The receiving vec3 @param {ReadonlyVec3} a The vec3 point to rotate @param {ReadonlyVec3} b The origin of the rotation @param {Number} rad The angle of rotation in radians @returns {vec3} out
round(List<double> out, List<double> a) List<double>
math.round the components of a vec3
scale(List<double> out, List<double> a, double b) List<double>
Scales a vec3 by a scalar number
scaleAndAdd(List<double> out, List<double> a, List<double> b, double scale) List<double>
Adds two vec3's after scaling the second operand by a scalar value
set(List<double> out, double x, double y, double z) List<double>
Set the components of a vec3 to the given values
slerp(List<double> out, List<double> a, List<double> b, double t) List<double>
Performs a spherical linear interpolation between two vec3's
squaredDistance(List<double> a, List<double> b) double
Calculates the squared euclidian distance between two vec3's
squaredLength(List<double> a) double
Calculates the squared length of a vec3
str(dynamic a) String
Returns a string representation of a vector
subtract(List<double> out, List<double> a, List<double> b) List<double>
Subtracts vector b from vector a
transformMat3(List<double> out, List<double> a, List<double> m) List<double>
Transforms the vec3 with a mat3.
transformMat4(List<double> out, List<double> a, List<double> m) List<double>
Transforms the vec3 with a mat4. 4th vector component is implicitly '1'
transformQuat(List<double> out, List<double> a, List<double> q) List<double>
Transforms the vec3 with a quat Can also be used for dual quaternions. (Multiply it with the real part)
zero(dynamic out) List<double>
Set the components of a vec3 to zero