tarcieri / micromath

Embedded Rust arithmetic, 2D/3D vector, and statistics library
Apache License 2.0
402 stars 21 forks source link

2.0 release #68

Closed tarcieri closed 3 years ago

tarcieri commented 3 years ago

Since the vector feature uses generic-array, I thought I'd take a look at porting it over to const generics now that Rust 1.51 stabilized min_const_generics.

It seems given the current way the vector types are structured, that isn't possible as the axes are defined using an associated type and support for generic parameters requires const_generics, not min_const_generics.

However, I'm also noticing the way the vector types are implemented is... not great.

I do still like the use of discrete x, y (and for 3D vectors, z) coordinates which more or less follows existing Rust embedded conventions. However these are defined using macros with separate structs for each type, as opposed to making the coordinates generic.

I think perhaps by refactoring to make the coordinates generic, and reducing the trait portion to just the functionality shared by 2D and 3D vectors, it's possible const generics won't be needed at all.

tarcieri commented 3 years ago

It'd also be good to address #57.

Perhaps it would make sense to implement the functionality in terms of an F32 newtype, keeping the current F32Ext trait, but making the trait a wrapper for the newtype.

tarcieri commented 3 years ago

2.0 was released in #87