Skip to main content

CoordStorage

Trait CoordStorage 

Source
pub trait CoordStorage: Copy + PartialOrd {
    // Required methods
    fn to_f64(self) -> f64;
    fn to_i64(self) -> i64;
}
Expand description

Coordinate storage for Polygon.

The polygon’s bounding box, acceleration indexes and raycast all operate in “storage space”: the query point is multiplied by the polygon’s scale once per containment check, and segment endpoints are converted with CoordStorage::to_f64 in registers. f64::from(i32) is exact (i32 fits within f64’s 53-bit mantissa), so integer storage loses no precision, and x * 1.0 is an exact identity, so f64 storage behaves bit-identically to a non-generic implementation.

Required Methods§

Source

fn to_f64(self) -> f64

Convert a stored coordinate to f64. Identity for f64; exact f64::from for i32.

Source

fn to_i64(self) -> i64

Convert a stored coordinate to i64 for the opt-in integer raycast. Only meaningful for integer storage.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl CoordStorage for f64

Source§

fn to_f64(self) -> f64

Source§

fn to_i64(self) -> i64

Source§

impl CoordStorage for i32

Source§

fn to_f64(self) -> f64

Source§

fn to_i64(self) -> i64

Implementors§