Vector3D
struct · ferroui-base · v0.5.0
struct Vector3D
3D vector with double-precision components.
Members
xyznewparsedotaddsubstractmultiplymultiply_scalardividedivide_scalarabsclampmaxminlengthnormalizedistance_squareddistancedeconstruct
x
x: f64
y
y: f64
z
z: f64
new
const fn new(x: f64, y: f64, z: f64) -> Self
parse
fn parse(s: &str) -> Result<Self, FormatError>
Parses a Vector3D string ("x, y, z").
dot
fn dot(vector1: Vector3D, vector2: Vector3D) -> f64
Calculates the dot product of two vectors.
add
fn add(left: Vector3D, right: Vector3D) -> Vector3D
Adds the second to the first vector.
substract
fn substract(left: Vector3D, right: Vector3D) -> Vector3D
Subtracts the second from the first vector.
multiply
fn multiply(left: Vector3D, right: Vector3D) -> Vector3D
Multiplies the first vector by the second, component-wise.
multiply_scalar
fn multiply_scalar(left: Vector3D, right: f64) -> Vector3D
Multiplies the vector by the given scalar.
divide
fn divide(left: Vector3D, right: Vector3D) -> Vector3D
Divides the first vector by the second, component-wise.
divide_scalar
fn divide_scalar(left: Vector3D, right: f64) -> Vector3D
Divides the vector by the given scalar.
abs
fn abs(self: &Self) -> Vector3D
Returns a vector whose elements are the absolute values of each of the specified vector's elements.
clamp
fn clamp(value: Vector3D, min: Vector3D, max: Vector3D) -> Vector3D
Restricts a vector between a minimum and a maximum value.
max
fn max(left: Vector3D, right: Vector3D) -> Vector3D
Returns a vector whose elements are the maximum of each of the pairs of elements in two specified vectors.
min
fn min(left: Vector3D, right: Vector3D) -> Vector3D
Returns a vector whose elements are the minimum of each of the pairs of elements in two specified vectors.
length
fn length(self: &Self) -> f64
Length of the vector.
normalize
fn normalize(value: Vector3D) -> Vector3D
Returns a normalized version of this vector.
distance_squared
fn distance_squared(value1: Vector3D, value2: Vector3D) -> f64
Computes the squared Euclidean distance between the two given points.
distance
fn distance(value1: Vector3D, value2: Vector3D) -> f64
Computes the Euclidean distance between the two given points.
deconstruct
const fn deconstruct(self: &Self) -> (f64, f64, f64)
Deconstructs the vector into its components.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafePropertyValueAnyValueClassDefaultsBorrow<T>BorrowMut<T>CloneToUninitInto<U>From<T>TryInto<U>TryFrom<U>AnyToOwnedToStringErasedDestructorIntoEitherFrom<Vector3D>From<Vector3>IInterpolator<Vector3D>ExpressionVariantValueServerPropertyValueBatchValueMarkupTypedValueTypeRegistrationCloneCopyDebugStructuralPartialEqPartialEqDefaultAddSubNegMul<f64>AddAssignSubAssignMulAssign<f64>FromStrDisplay
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.