|new 0.20.10||Apr 2, 2020|
|0.20.8||Mar 26, 2020|
|0.20.7||Dec 13, 2019|
|0.20.5||Nov 25, 2019|
|0.1.5||Jul 23, 2015|
#3 in Math
33,831 downloads per month
Used in 152 crates (50 directly)
This is a small library for geometric types with a focus on 2d graphics and layout.
A collection of strongly typed math tools for computer graphics with an inclination towards 2d graphics and layout.
All types are generic over the scalar type of their component (
and tagged with a generic Unit parameter which is useful to prevent mixing
values from different spaces. For example it should not be legal to translate
a screen-space position by a world-space vector and this can be expressed using
the generic Unit parameter.
This unit system is not mandatory and all structures have an alias
with the default unit:
default::Point2D<T> is equivalent to
Client code typically creates a set of aliases for each type and doesn't need
to deal with the specifics of typed units further. For example:
use euclid::*; pub struct ScreenSpace; pub type ScreenPoint = Point2D<f32, ScreenSpace>; pub type ScreenSize = Size2D<f32, ScreenSpace>; pub struct WorldSpace; pub type WorldPoint = Point3D<f32, WorldSpace>; pub type ProjectionMatrix = Transform3D<f32, WorldSpace, ScreenSpace>; // etc...
All euclid types are marked
#[repr(C)] in order to facilitate exposing them to
foreign function interfaces (provided the underlying scalar type is also
A set of aliases for all types, tagged with the default unknown unit.