makingthematrix / gailibrary

A very cheerful library for Artificial Intelligence in games
MIT License
7 stars 0 forks source link

Direction #9

Open makingthematrix opened 6 years ago

makingthematrix commented 6 years ago

A 3D normalized mathematical vector. It should be possible to create them by operations on other vectors (especially multiplication) and from two Positions. I imagine the basic way to use Directions will be to compute the difference angle (in degrees) between what the agent is turned to and what it should be pointing at. So, simple mathematical operations involving Directions and Positions are necessary. In the same time keep it simple so it might be eventually replaced by something from an external crate.

Also, utility methods for when we don't care about the z component.

makingthematrix commented 6 years ago

So far, I decided to use a thin wrapper over cgmath::Vector3d<f64>. Both the underlying implementation might change (cgmath -> nalgebra?), and the way I use it too (from the so-called Newtype idiom - this wrapper pattern - to traits, for example). Also, the user might have even different ideas, so yeah. Any change has to be carefully planned, but on the other hand I don't wish to get stuck here and never develop anything, because omg what if.