FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    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.

    View source

    Members

    x

    x: f64
    

    The X component.

    Source

    y

    y: f64
    

    The Y component.

    Source

    z

    z: f64
    

    The Z component.

    Source

    new

    const fn new(x: f64, y: f64, z: f64) -> Self
    

    A vector with the given components.

    Source

    length

    fn length(self: &Self) -> f64
    

    The length of the vector.

    Source

    length_squared

    fn length_squared(self: &Self) -> f64
    

    The square of the length of the vector.

    Source

    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.

    Source

    negate

    fn negate(self: &mut Self)
    

    Reverses the direction of the vector.

    Source

    dot_product

    fn dot_product(vector1: Vector3D, vector2: Vector3D) -> f64
    

    The dot product of two vectors.

    Source

    cross_product

    fn cross_product(vector1: Vector3D, vector2: Vector3D) -> Vector3D
    

    The cross product of two vectors: perpendicular to both, in the right-handed sense.

    Source

    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.

    Source

    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.

    Source

    Trait implementations

    • Send
    • Sync
    • Freeze
    • UnsafeUnpin
    • Unpin
    • UnwindSafe
    • RefUnwindSafe
    • Borrow<T>
    • BorrowMut<T>
    • CloneToUninit
    • Into<U>
    • From<T>
    • TryInto<U>
    • TryFrom<U>
    • Any
    • ToOwned
    • ToString
    • PropertyValue
    • AnyValue
    • ClassDefaults
    • ErasedDestructor
    • IntoEither
    • FromIterator<Vector3D>
    • MarkupTyped
    • Add<Vector3D>
    • Sub<Vector3D>
    • AddAssign<Vector3D>
    • SubAssign<Vector3D>
    • From<Point3D>
    • From<Size3D>
    • Clone
    • Copy
    • Debug
    • StructuralPartialEq
    • PartialEq
    • Default
    • Add
    • Add<Point3D>
    • Sub
    • Sub<Point3D>
    • Neg
    • Mul<f64>
    • Mul<Vector3D>
    • Mul<Matrix3D>
    • Div<f64>
    • AddAssign
    • SubAssign
    • MulAssign<f64>
    • DivAssign<f64>
    • From<Vector3D>
    • FromStr
    • Display

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.