Closed ManevilleF closed 6 months ago
@ManevilleF Semirelated, why not just use Vec2? You can actually deconstruct them like this:
fn foo(Vec2 { x, y }: Vec2)
...It's weird, no idea why Rust made it this way, but
@ManevilleF Semirelated, why not just use Vec2? You can actually deconstruct them like this:
fn foo(Vec2 { x, y }: Vec2)
...It's weird, no idea why Rust made it this way, but
Where ? The HexLayout
methods do use a Vec2
This
fn matrix_op(matrix: [f32; 4], [x, y]: [f32; 2]) -> [f32; 2] {
(on phone, dunno how to make links to lines on phone, soz)
Yeah that is voluntary, I try to keep internal code as dependency free as possible, in the future I wish to have glam as an optional dependency
Re implementation of #140 by @msparkles
I added CHANGELOG entries and some code clarifications.
Work done
Added the capacity to use fractional axial coordinates as
Vec2
inHexLayout
methods:HexLayout::fract_hex_to_world_pos
methodHexLayout::world_pos_to_fract_hex
methodTo avoid duplication and multi-method chaining I encapsulated the matrix computations in:
HexOrientationData::forward
methodHexOrientationData::inverse
methodI also added these utility methods:
Hex::to_array_f32
utility methodHex::to_cubic_array_f32
utility method