- nixed all transforms except identity and affine; the intermediate transforms
were more trouble than they were worth
- fixed bugs in AffineTransform.translate/scaleX/scaleY/rotate; aiya!
- replaced Transform.clone with Transform.copy; deprecated clone
- rewrote transform test in Scala and using Java AffineTransform as a
reference.
XY provides a common super-interface for IPoint and IVector for APIs that don't
care if you have a point or vector, and just want it's x/y coordinates.
Returning a vector when subtracting two points was clever and all, but turns
out to be annoying. More often, you're just adjusting a point and don't want to
switch to vector-baesd math. If we want an easy way to obtain a vector that is
the difference of two points we can add Vectors.subtract() or a new
constructor.
Compilers are presumably smart enough to throw away the bulk of that
automagically, but some were storing the return value of a method call
of some object that implemented an interface whic his a lot harder for
it to realize won't have side effects.
I've tried to make a useful distinction between Point and Vector, but sometimes
you just want to use a Vector as a Point. I'm not going to add Point3 and try
to push this distinction into the third dimension, so I'll accommodate using
Vector as Point in 2D, and we'll just use Vector3 as a 3D point when needed.
- Moved Vector.direction to Point.direction as that makes more sense. If you
want to know the angle of the vector between two points, you should do that
on points, not vectors.
- Added Vector.angle() which returns the angle of the vector (in polar
coordinates), which matches Vector.length() which returns the magnitude of
the vector (in polar coordinates).
- Added Vectors.fromPolar to create a vector from polar coordinates, and added
Vector.setLength and Vector.setAngle to set the one whilst preserving the
other.
As Tim points out, vector multiplication implies dot or cross products. These
methods are scaling, not multiplying. Cross product coming in a future commit.