Commit Graph

148 Commits

Author SHA1 Message Date
Michael Bayne b8fea743ee Fix Line.isEmpty().
Closes #27.
2017-11-16 10:57:59 -08:00
Michael Bayne c7ae29ec0c Better toString() for AffineTransform.
If it's just a translation transform, only show the translation, and if it's an
identity transform, just say 'ident'.
2015-11-15 07:27:02 -08:00
Michael Bayne c8dd15647d Accept XY in constructor as well. 2015-09-17 12:24:00 -07:00
Michael Bayne 0447064ea9 Allow a Vector to be set from any XY.
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.
2015-05-30 10:38:28 -07:00
Michael Bayne 70b83fd521 Added IPoint.add(XY,Point).
We already had such a method for subtract(). Not sure how I managed to miss
add.
2015-05-30 10:32:57 -07:00
Michael Bayne b0e7dbbf47 Missed a spot. 2015-02-04 11:37:04 -08:00
Michael Bayne 32516ec816 Fixed indent of double version as well. 2015-02-04 11:30:35 -08:00
Michael Bayne 727861c254 Fixed indentation.
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!
2015-02-04 11:28:15 -08:00
tomfisher 85f702c93f Clean up the serialVersionUID warning 2015-02-04 16:25:33 +08:00
tomfisher bcba265386 Fix the wrong path calculation of Arc with small angle 2015-02-04 16:11:57 +08:00
Michael Bayne 72a35225d2 Take XY wherever we took IPoint.
Be lenient in what you accept, strict in what you produce.
2015-01-15 13:51:49 -08:00
Michael Bayne ce42c01f45 Move GWT source out of src/main/java.
Also updated maven-compiler-plugin to newer less crack-smokey version.
2015-01-15 13:50:37 -08:00
Michael Bayne fe48dd6440 Javadoc fixes. 2015-01-10 15:05:13 -08:00
Michael Bayne 7879c12749 Added set(AffineTransform). More return type refinement. 2014-12-30 15:58:00 -08:00
Michael Bayne 524ce3c82c Specialize return types on copy. 2014-12-30 10:47:16 -08:00
David Hoover 2cbe19a4a2 Spurious semicolons 2014-03-18 10:05:55 -07:00
Michael Bayne a46ea711f0 Handle NaN in toString(). 2013-07-26 11:07:02 -07:00
Michael Bayne 0ff90d641e A bunch of add/substract to syncmake i.Point with f/d.Point.
Closes #24.
2013-05-24 06:10:35 -07:00
Michael Bayne b05258d39e Added test for (now fixed) Area bug. 2013-03-06 11:20:15 -08:00
Michael Bayne 7edef042c0 Added semi-useful toStrings. 2013-03-06 11:20:14 -08:00
Michael Bayne 25b09788e3 Fixed issues with auto-closing paths. 2013-03-06 11:20:12 -08:00
Michael Bayne 73fc54dff0 Switch to _ member names for easer code grokking. 2013-03-06 10:35:56 -08:00
Michael Bayne fc4cf07ca3 Nixed mirrorAngleOrigin because it's not correct.
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.
2013-02-12 17:27:23 -08:00
Michael Bayne 0a388b65aa Catch the double implementations up with the float. 2013-02-12 17:13:47 -08:00
Michael Bayne fef73ea027 Save an extra call to mirrorAngle when d == md. 2013-02-12 14:25:20 -08:00
Michael Bayne f26a72c26f Change new mirrorAngle to mirrorAngleOrigin, improved javadocs.
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).
2013-02-12 14:24:04 -08:00
Christoph Dietze 0ffabf1419 mirrorAngle(HALF_PI) should be -HALFPI rather than HALF_PI 2013-02-12 22:10:04 +01:00
Bruno Garcia b91c17d3b9 Take shortcuts in translate() and scale(). 2012-12-04 18:40:44 -08:00
Michael Bayne 8cece6137b (From aduros) AbstractRectangle.contains should contain bounds.
Points on the top and left edges are considered contained, so should points on
right and bottom. This also makes contains() consistent with outcode().
2012-11-28 16:29:44 -08:00
Michael Bayne 90e0c58c84 Added MathUtil.floorDiv, and tests. 2012-11-28 13:25:44 -08:00
Michael Bayne 0f27f8f0d2 Shearing support from Mike T. 2012-10-24 15:20:54 -07:00
Michael Bayne f1a23112a9 Added Dimensions.ZERO. 2012-10-10 13:29:06 -07:00
Michael Bayne 485abe95e6 Numerous bits:
- 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.
2012-07-12 12:25:06 -07:00
Michael Bayne 5acb7b1551 Use a less cracksmoking name. 2012-06-16 13:23:08 -07:00
Michael Bayne 920b55d1f9 Added a method for extracting the transform matrix. 2012-06-16 13:18:07 -07:00
Michael Bayne 278a947de1 Added a bunch of stuff at Stefan's request.
- Matrix3: add, addLocal, setToZero
- Matrix4: extractRotationScale, setToRotationScale, setToZero
- Vector3: abs, absLocal
- Vector4: negate, negateLocal, abs, absLocal, mult(v), multLocal(v)
2012-05-18 13:42:45 -07:00
Michael Bayne 00df755904 Added methods to get and set elements, rows, columns.
Also clarified the element naming scheme, which is mCOLROW.
2012-05-18 13:10:57 -07:00
Michael Bayne 6a45db8e35 Added Vector4.mult(Matrix4) and Matrix4.transform(Vector4). 2012-05-18 09:06:37 -07:00
Michael Bayne 65c870a0fe Some javadoc fixes. 2012-05-11 11:16:51 -07:00
Michael Bayne 1541c1529f Added method to obtain a vector from two points.
Whatdya know, I already need it.
2012-05-11 11:03:40 -07:00
Michael Bayne f2e7e7da88 Added XY, made IPoint.subtract return Point.
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.
2012-05-11 10:56:39 -07:00
Michael Bayne d132e917ed Some lingering f to d conversions. 2012-05-11 08:41:13 -07:00
Michael Bayne 993b37ed19 Reinstate implementation detail notes plus {@inheritDoc}. 2012-05-11 08:40:30 -07:00
Michael Bayne c99825d35f Logic simplification in iceil/ifloor. 2012-05-11 08:33:53 -07:00
David Hoover e8c11aba87 Nix unused locals in matrix operations.
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.
2012-05-10 22:08:35 -07:00
David Hoover 6d920c1211 Don't describe a particular implementation's details in the interface declaration. 2012-05-10 22:03:05 -07:00
David Hoover be0d761aa2 Mark @Overrides. 2012-05-10 22:03:05 -07:00
David Hoover 0a03eb6849 Whitespace & doc cleanup.
Tabs -> spaces, one space between sentences, capitalization fix, etc.
2012-05-10 22:02:37 -07:00
Michael Bayne 8bcd5c25c8 Be more flexible about the type of our target transform. 2012-05-03 08:56:35 -07:00
Michael Bayne 0daba7bc49 Added Vector.subtractLocal(x, y). 2012-05-01 09:54:31 -07:00