From eb56f394ae033a6863444d91475d62a9d6a69c2d Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Fri, 1 Jul 2011 16:59:32 -0700 Subject: [PATCH] Javadoc and clone() improvements. --- src/main/java/pythagoras/d/AffineTransform.java | 14 +++++++++----- src/main/java/pythagoras/f/AffineTransform.java | 14 +++++++++----- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/main/java/pythagoras/d/AffineTransform.java b/src/main/java/pythagoras/d/AffineTransform.java index cadc00a..4b2a25d 100644 --- a/src/main/java/pythagoras/d/AffineTransform.java +++ b/src/main/java/pythagoras/d/AffineTransform.java @@ -311,6 +311,8 @@ public class AffineTransform implements Cloneable, Serializable /** * Sets this transform to a simple rotation using the supplied values. Any existing transform * values are overwritten. + * + * @param angle the angle of rotation (in radians). */ public void setToRotation (double angle) { double sin = Math.sin(angle); @@ -332,6 +334,10 @@ public class AffineTransform implements Cloneable, Serializable /** * Sets this transform to a simple rotation using the supplied values. Any existing transform * values are overwritten. + * + * @param angle the angle of rotation (in radians). + * @param px the x-coordinate of the point around which to rotate. + * @param py the y-coordinate of the point around which to rotate. */ public void setToRotation (double angle, double px, double py) { setToRotation(angle); @@ -590,9 +596,7 @@ public class AffineTransform implements Cloneable, Serializable // @Override // can't declare @Override due to GWT public AffineTransform clone () { - AffineTransform xform = new AffineTransform(m00, m01, m02, m10, m11, m12); - xform.type = this.type; - return xform; + return new AffineTransform(this); } @Override @@ -618,8 +622,8 @@ public class AffineTransform implements Cloneable, Serializable * Multiplies two transforms, storing the result in the target transform. * @return the supplied target transform. */ - protected AffineTransform multiply (AffineTransform t1, AffineTransform t2, - AffineTransform into) { + protected static AffineTransform multiply (AffineTransform t1, AffineTransform t2, + AffineTransform into) { into.setTransform(t1.m00 * t2.m00 + t1.m10 * t2.m01, // m00 t1.m00 * t2.m10 + t1.m10 * t2.m11, // m01 t1.m01 * t2.m00 + t1.m11 * t2.m01, // m10 diff --git a/src/main/java/pythagoras/f/AffineTransform.java b/src/main/java/pythagoras/f/AffineTransform.java index 85effbd..871d592 100644 --- a/src/main/java/pythagoras/f/AffineTransform.java +++ b/src/main/java/pythagoras/f/AffineTransform.java @@ -309,6 +309,8 @@ public class AffineTransform implements Cloneable, Serializable /** * Sets this transform to a simple rotation using the supplied values. Any existing transform * values are overwritten. + * + * @param angle the angle of rotation (in radians). */ public void setToRotation (float angle) { float sin = (float)Math.sin(angle); @@ -330,6 +332,10 @@ public class AffineTransform implements Cloneable, Serializable /** * Sets this transform to a simple rotation using the supplied values. Any existing transform * values are overwritten. + * + * @param angle the angle of rotation (in radians). + * @param px the x-coordinate of the point around which to rotate. + * @param py the y-coordinate of the point around which to rotate. */ public void setToRotation (float angle, float px, float py) { setToRotation(angle); @@ -588,9 +594,7 @@ public class AffineTransform implements Cloneable, Serializable // @Override // can't declare @Override due to GWT public AffineTransform clone () { - AffineTransform xform = new AffineTransform(m00, m01, m02, m10, m11, m12); - xform.type = this.type; - return xform; + return new AffineTransform(this); } @Override @@ -616,8 +620,8 @@ public class AffineTransform implements Cloneable, Serializable * Multiplies two transforms, storing the result in the target transform. * @return the supplied target transform. */ - protected AffineTransform multiply (AffineTransform t1, AffineTransform t2, - AffineTransform into) { + protected static AffineTransform multiply (AffineTransform t1, AffineTransform t2, + AffineTransform into) { into.setTransform(t1.m00 * t2.m00 + t1.m10 * t2.m01, // m00 t1.m00 * t2.m10 + t1.m10 * t2.m11, // m01 t1.m01 * t2.m00 + t1.m11 * t2.m01, // m10