I'm tempted to make add/subtract/scale take XY as well, but I'm not sure I love
that. Part of the point (pardon the pun) of having Point and Vector is to use
the types to prevent one from performing nonsensical operations. For example,
you lerp between two vectors, lerping between a Vector and a Point would be
weird; sloppy at best, most likely wrong. Adding/subtracting a point to/from a
vector feels like it's in the wrong category as well, so perhaps it's best to
continue to prevent that via the type system.
If you really have a Point (or some other XY) that represents a vector, then I
guess I'm fine with forcing you to either put it into a Vector to get the
convenient math, or to pull out its x/y components manually. Then again, that
also feels overly paternal. Blah.
Having these serialVersionUID fields screws up my script which converts the
float code to double code. Meh. I guess I can improve it so that it preserves
the double versions... yaks!
The correct way to mirror an angle in [-PI, PI] around the x-axis is simply to
negate it, which doesn't seem ceremonious enough to require a utility method.
The old mirrorAngle mirrors around the "y-axis" (PI/2 or -PI/2 as appropriate)
which is necessary for other code (particularly angularDifference) to work
correctly. The new mirrorAngleOrigin mirrors around the "x-axis" (zero).
- 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.