Crate hexga_math

Crate hexga_math 

Source
Expand description

§A Math library that contains

§N Dimension stuff and Array Programming

This crate define N dimensional math stuff (2d, 3d, 4d, … nd) like vector/point of any type (float, int, uint, or even user defined) :

The same common functions such as min, max, mix, abs, and clamp work for

  • primitive values(u32, i32, f32, bool, …)
  • and on composite types (Array, Vector, Color, Rectangle, Matrix, Grid, …) that implement the Map / MapWith / MapIntern / MapInternWith traits.

Any external type implementing these traits automatically gains support for these common functions.

§Useful type like

§Generic Casting trait

The crate also provide generic traits for casting with the same behavior as the as keyword :

§Generic Remapping trait

Similar traits for casting remapping the range of an primitive to another primitive range also exist :

§Quick start with the prelude

There are some quick typedef in the prelude :

§More advanced type

If you need more control about the precision, each type have another more generic base type :

  • Grid type uses a Point for the indexing precision, but that can be changed by using with the [hexga_math::grid::GridBase] type.
  • Angle and Time use a float precision that can be changed using AngleOf and TimeOf

Re-exports§

pub use hexga_typedef as typedef;

Modules§

angle
array
convert
grid
map
map_on
matrix
number
prelude
range
rectangle
Geometry Rectangle Module
time
transform
unit
vector

Macros§

impl_fixed_array
impl_fixed_array_constant
impl_fixed_array_core
impl_fixed_array_display
impl_fixed_array_op
impl_generic_array
impl_generic_array_constant
impl_generic_array_core
impl_generic_array_display
impl_generic_array_op
impl_number_basic_trait