You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's definitely an intended use for coordinates to represent vectors: they're used for normals and tangents already and have things like the dot product defined for them. (It's also definitely possible this lacks some purity, but so far I can't think of any practical problems)
This seems like a good idea to me: I've now added an initial implementation to this repository. I've chosen unit_vector_at_angle() for the name and made it an extension of anything that implements the Coordinate2D trait rather than something specific to Coord2. I've added a unit_vector() construction function as well for any coordinate, which I think complements the origin() function.
The main reason there aren't too many functions like this is that I've been adding functionality as it becomes necessary for FlowBetween, so this is just something that's never been needed there before (this helps with designing a usable API as well as making it less likely that something non-functional gets put in)
I'm surprised there's no function like this:
The text was updated successfully, but these errors were encountered: