V

From Robowiki
Revision as of 07:27, 8 August 2018 by Xor (talk | contribs) (Initial commit)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
This article is a stub. You can help RoboWiki by expanding it.

This page is dedicated for describing the aaa.util.math.V




V is a vector 2d library that simplifies/boosts geom in robocoding.

It's common for robocoders to write code like this:

Point2D.Double project(Point2D.Double point, double angle, double distance) {
  return new Point2D.Double(point.getX() + distance * Math.sin(angle), point.getY() + distance * Math.cos(angle));
}

Point2D.Double pos = ...;

for (...) {
  pos = project(pos, heading, velocity);
}

However, this is slow.

With V, you have code like this

V pos = new V(...);

for (...) {
  pos.project_(pos, heading, velocity);
}

which is fast because no objects are allocated in loop at all (and boosted further internaly with FastMath)