Scalar

Trait Scalar 

Source
pub trait Scalar:
    Sized
    + Num
    + NumAssignOps
    + Neg<Output = Self>
    + PartialOrd
    + Clone
    + Copy {
    // Required methods
    fn two() -> Self;
    fn half() -> Self;
    fn quarter() -> Self;
    fn l8192() -> Self;
    fn epsilon() -> Self;
    fn min(l: Self, r: Self) -> Self;
    fn max(l: Self, r: Self) -> Self;
    fn tabs(self) -> Self;

    // Provided method
    fn squared(self) -> Self { ... }
}
Expand description

Core scalar trait for numeric types used in the library.

This trait extends num-traits types with additional methods commonly needed in 3D mathematics. It is implemented for i32, i64, f32, and f64.

§Required Methods

Types implementing this trait must provide:

  • Basic arithmetic operations (via Num and NumAssignOps)
  • Comparison operations (via PartialOrd)
  • Additional constants and utility methods

Required Methods§

Source

fn two() -> Self

Source

fn half() -> Self

Source

fn quarter() -> Self

Source

fn l8192() -> Self

Source

fn epsilon() -> Self

Source

fn min(l: Self, r: Self) -> Self

Source

fn max(l: Self, r: Self) -> Self

Source

fn tabs(self) -> Self

Provided Methods§

Source

fn squared(self) -> Self

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Scalar for f32

Source§

fn two() -> f32

Source§

fn half() -> f32

Source§

fn quarter() -> f32

Source§

fn l8192() -> f32

Source§

fn epsilon() -> f32

Source§

fn min(l: f32, r: f32) -> f32

Source§

fn max(l: f32, r: f32) -> f32

Source§

fn tabs(self) -> f32

Source§

impl Scalar for f64

Source§

fn two() -> f64

Source§

fn half() -> f64

Source§

fn quarter() -> f64

Source§

fn l8192() -> f64

Source§

fn epsilon() -> f64

Source§

fn min(l: f64, r: f64) -> f64

Source§

fn max(l: f64, r: f64) -> f64

Source§

fn tabs(self) -> f64

Source§

impl Scalar for i32

Source§

fn two() -> i32

Source§

fn half() -> i32

Source§

fn quarter() -> i32

Source§

fn l8192() -> i32

Source§

fn epsilon() -> i32

Source§

fn min(l: i32, r: i32) -> i32

Source§

fn max(l: i32, r: i32) -> i32

Source§

fn tabs(self) -> i32

Source§

impl Scalar for i64

Source§

fn two() -> i64

Source§

fn half() -> i64

Source§

fn quarter() -> i64

Source§

fn l8192() -> i64

Source§

fn epsilon() -> i64

Source§

fn min(l: i64, r: i64) -> i64

Source§

fn max(l: i64, r: i64) -> i64

Source§

fn tabs(self) -> i64

Implementors§