Vector3D
struct · ferroui-media3d · v0.5.0
struct Vector3D
A displacement in 3D space, with double-precision components (WPF's
System.Windows.Media.Media3D.Vector3D).
This is the vector of the 3D scene model. The base library's ferroui_base::Vector3D is the
vector of the reference's composition API; the two convert into each other with From.
Members
x
x: f64
The X component.
y
y: f64
The Y component.
z
z: f64
The Z component.
new
const fn new(x: f64, y: f64, z: f64) -> Self
A vector with the given components.
length
fn length(self: &Self) -> f64
The length of the vector.
length_squared
fn length_squared(self: &Self) -> f64
The square of the length of the vector.
normalize
fn normalize(self: &mut Self)
Makes the vector a unit vector of the same direction. The components are first divided by
the largest of their magnitudes, so the length does not overflow. The zero vector becomes
NaN components, as in WPF.
negate
fn negate(self: &mut Self)
Reverses the direction of the vector.
dot_product
fn dot_product(vector1: Vector3D, vector2: Vector3D) -> f64
The dot product of two vectors.
cross_product
fn cross_product(vector1: Vector3D, vector2: Vector3D) -> Vector3D
The cross product of two vectors: perpendicular to both, in the right-handed sense.
angle_between
fn angle_between(vector1: Vector3D, vector2: Vector3D) -> f64
The angle between two vectors, in degrees, from 0 to 180. The angle is computed from the length of the difference of the unit vectors, which is precise also near 0 and 180 degrees where the arc cosine of the dot product is not.
parse
fn parse(text: &str) -> Result<Self, FormatError>
Parses the text form "x,y,z" (commas, white space or both between the numbers) in the
invariant culture.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeBorrow<T>BorrowMut<T>CloneToUninitInto<U>From<T>TryInto<U>TryFrom<U>AnyToOwnedToStringPropertyValueAnyValueClassDefaultsErasedDestructorIntoEitherFromIterator<Vector3D>MarkupTypedAdd<Vector3D>Sub<Vector3D>AddAssign<Vector3D>SubAssign<Vector3D>From<Point3D>From<Size3D>CloneCopyDebugStructuralPartialEqPartialEqDefaultAddAdd<Point3D>SubSub<Point3D>NegMul<f64>Mul<Vector3D>Mul<Matrix3D>Div<f64>AddAssignSubAssignMulAssign<f64>DivAssign<f64>From<Vector3D>FromStrDisplay
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.