Sorry, we don't support your browser.  Install a modern browser

More vector functions#33

The Vector and Vector2D types are currently a bit lacking. From what I can tell:

  • They both have operators for ==, +, and -.
  • Vector has SizeSquared.
  • Vector2D has ZeroVector and operators for < and <=.

There’s some improvement to be made here. Aside from both missing some stuff the other has, we could use stuff like:

  • DistanceSquaredTo(other) would be very helpful (I know raw distance is expensive).
  • Rotate(deg) would be nice to avoid raw trigonometry.
  • Dot(other), so we don’t have to remake that logic ourselves. Cross(other) doesn’t seem as useful for a 2D game but hey maybe someone has a wacky idea.
  • Normalised(), or some other way of getting a vector of the same direction but different length.

Also maybe it’s just me but I don’t like how Vector isn’t named Vector3D. It’s slightly confusing as-is in some contexts.

8 months ago
Changed the status to
Planned
4 months ago