86 releases

0.22.9 Mar 25, 2023
0.22.7 Apr 4, 2022
0.22.6 May 31, 2021
0.22.2 Feb 24, 2021
0.1.5 Jul 23, 2015

#4 in Math

Download history 24850/week @ 2023-12-23 33499/week @ 2023-12-30 39239/week @ 2024-01-06 45386/week @ 2024-01-13 48725/week @ 2024-01-20 45676/week @ 2024-01-27 46370/week @ 2024-02-03 44030/week @ 2024-02-10 55977/week @ 2024-02-17 50894/week @ 2024-02-24 49558/week @ 2024-03-02 50037/week @ 2024-03-09 46380/week @ 2024-03-16 49481/week @ 2024-03-23 47040/week @ 2024-03-30 35699/week @ 2024-04-06

185,138 downloads per month
Used in 1,009 crates (144 directly)


12K SLoC


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 (f32, i32, etc.), 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: UnknownUnit. for example default::Point2D<T> is equivalent to Point2D<T, UnknownUnit>. 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 repr(C)).

A set of aliases for all types, tagged with the default unknown unit.