Crate emath[−][src]
Opinionated 2D math library for building GUIs.
Includes vectors, positions, rectangles etc.
Conventions (unless otherwise specified):
- All angles are in radians
- X+ is right and Y+ is down.
- (0,0) is left top.
- Dimension order is always
x y
Re-exports
pub use align::Align; | |
pub use align::Align2; |
Modules
align | One- and two-dimensional alignment ( |
smart_aim | Find “simple” numbers is some range. Used by sliders. |
Structs
Pos2 | A position on screen. |
Rect | A rectangular region of space. |
RectTransform | Linearly transforms positions from one |
Rot2 | Represents a rotation in the 2D plane.
A rotation of 𝞃/4 = 90° rotates the X axis to the Y axis.
Normally a |
Vec2 | A vector has a direction and length.
A |
Traits
NumExt | Extends |
Numeric | Implemented for all builtin numeric types |
One | |
Real |
Functions
almost_equal | Return true when arguments are the same within some rounding error. |
clamp | Deprecated Returns |
format_with_decimals_in_range | |
format_with_minimum_decimals | |
lerp | Linear interpolation. |
normalized_angle | Wrap angle to |
pos2 |
|
remap | Linearly remap a value from one range to another,
so that when |
remap_clamp | Like |
round_to_decimals | Round a value to the given number of decimal places. |
vec2 |
|