Michael-F-Bryan / arcs

A Rust CAD System
https://michael-f-bryan.github.io/arcs
Apache License 2.0
249 stars 23 forks source link

Reuse a standard geometry types instead of writing our own Vector #11

Closed Michael-F-Bryan closed 4 years ago

Michael-F-Bryan commented 4 years ago

At the moment we're reimplementing a lot of basic geometry math with Vector and BoundingBox. Is it worth reusing primitive types from an existing geometry library?

Michael-F-Bryan commented 4 years ago

To get the ball rolling, I really like the way euclid attaches a tag to prevent accidentally mixing up coordinate spaces.

At the moment we kinda do this by using kurbo::Point for Canvas Space (things drawn on a canvas) and Drawing Space (the coordinate space for all things in the "drawing").

Some other benefits are:

Michael-F-Bryan commented 4 years ago

Some alternatives I've looked are cgmath and ndarray. I'm leaning away from both because it feels like cgmath is aiming for a different audience, and I've already mentioned some of my gripes around ndarray/nalgebra.

DerLando commented 4 years ago

I mean the description of euclid sounds like a perfect fit:

A collection of strongly typed math tools for computer graphics with an inclination towards 2d graphics and layout.

Out of all the crates named it's the only one I haven't used before, but sure looks really promising!

Michael-F-Bryan commented 4 years ago

I've already started a branch switching over to euclid locally and so far it looks quite promising... I just need to finish resolving the hundreds of compile errors then look over to make sure I haven't subtly broken anything.