< prev index next >
src/java.desktop/share/classes/java/awt/geom/AffineTransform.java
Print this page
*** 27,37 ****
import java.awt.Shape;
import java.beans.ConstructorProperties;
/**
! * The <code>AffineTransform</code> class represents a 2D affine transform
* that performs a linear mapping from 2D coordinates to other 2D
* coordinates that preserves the "straightness" and
* "parallelness" of lines. Affine transformations can be constructed
* using sequences of translations, scales, flips, rotations, and shears.
* <p>
--- 27,37 ----
import java.awt.Shape;
import java.beans.ConstructorProperties;
/**
! * The {@code AffineTransform} class represents a 2D affine transform
* that performs a linear mapping from 2D coordinates to other 2D
* coordinates that preserves the "straightness" and
* "parallelness" of lines. Affine transformations can be constructed
* using sequences of translations, scales, flips, rotations, and shears.
* <p>
*** 46,57 ****
* [ y'] = [ m10 m11 m12 ] [ y ] = [ m10x + m11y + m12 ]
* [ 1 ] [ 0 0 1 ] [ 1 ] [ 1 ]
* </pre>
* <h3><a name="quadrantapproximation">Handling 90-Degree Rotations</a></h3>
* <p>
! * In some variations of the <code>rotate</code> methods in the
! * <code>AffineTransform</code> class, a double-precision argument
* specifies the angle of rotation in radians.
* These methods have special handling for rotations of approximately
* 90 degrees (including multiples such as 180, 270, and 360 degrees),
* so that the common case of quadrant rotation is handled more
* efficiently.
--- 46,57 ----
* [ y'] = [ m10 m11 m12 ] [ y ] = [ m10x + m11y + m12 ]
* [ 1 ] [ 0 0 1 ] [ 1 ] [ 1 ]
* </pre>
* <h3><a name="quadrantapproximation">Handling 90-Degree Rotations</a></h3>
* <p>
! * In some variations of the {@code rotate} methods in the
! * {@code AffineTransform} class, a double-precision argument
* specifies the angle of rotation in radians.
* These methods have special handling for rotations of approximately
* 90 degrees (including multiples such as 180, 270, and 360 degrees),
* so that the common case of quadrant rotation is handled more
* efficiently.
*** 61,94 ****
* For small multiples of 90 degrees the range of angles treated
* as a quadrant rotation is approximately 0.00000121 degrees wide.
* This section explains why such special care is needed and how
* it is implemented.
* <p>
! * Since 90 degrees is represented as <code>PI/2</code> in radians,
* and since PI is a transcendental (and therefore irrational) number,
* it is not possible to exactly represent a multiple of 90 degrees as
* an exact double precision value measured in radians.
* As a result it is theoretically impossible to describe quadrant
* rotations (90, 180, 270 or 360 degrees) using these values.
* Double precision floating point values can get very close to
! * non-zero multiples of <code>PI/2</code> but never close enough
* for the sine or cosine to be exactly 0.0, 1.0 or -1.0.
! * The implementations of <code>Math.sin()</code> and
! * <code>Math.cos()</code> correspondingly never return 0.0
! * for any case other than <code>Math.sin(0.0)</code>.
* These same implementations do, however, return exactly 1.0 and
* -1.0 for some range of numbers around each multiple of 90
* degrees since the correct answer is so close to 1.0 or -1.0 that
* the double precision significand cannot represent the difference
* as accurately as it can for numbers that are near 0.0.
* <p>
* The net result of these issues is that if the
! * <code>Math.sin()</code> and <code>Math.cos()</code> methods
* are used to directly generate the values for the matrix modifications
* during these radian-based rotation operations then the resulting
* transform is never strictly classifiable as a quadrant rotation
! * even for a simple case like <code>rotate(Math.PI/2.0)</code>,
* due to minor variations in the matrix caused by the non-0.0 values
* obtained for the sine and cosine.
* If these transforms are not classified as quadrant rotations then
* subsequent code which attempts to optimize further operations based
* upon the type of the transform will be relegated to its most general
--- 61,94 ----
* For small multiples of 90 degrees the range of angles treated
* as a quadrant rotation is approximately 0.00000121 degrees wide.
* This section explains why such special care is needed and how
* it is implemented.
* <p>
! * Since 90 degrees is represented as {@code PI/2} in radians,
* and since PI is a transcendental (and therefore irrational) number,
* it is not possible to exactly represent a multiple of 90 degrees as
* an exact double precision value measured in radians.
* As a result it is theoretically impossible to describe quadrant
* rotations (90, 180, 270 or 360 degrees) using these values.
* Double precision floating point values can get very close to
! * non-zero multiples of {@code PI/2} but never close enough
* for the sine or cosine to be exactly 0.0, 1.0 or -1.0.
! * The implementations of {@code Math.sin()} and
! * {@code Math.cos()} correspondingly never return 0.0
! * for any case other than {@code Math.sin(0.0)}.
* These same implementations do, however, return exactly 1.0 and
* -1.0 for some range of numbers around each multiple of 90
* degrees since the correct answer is so close to 1.0 or -1.0 that
* the double precision significand cannot represent the difference
* as accurately as it can for numbers that are near 0.0.
* <p>
* The net result of these issues is that if the
! * {@code Math.sin()} and {@code Math.cos()} methods
* are used to directly generate the values for the matrix modifications
* during these radian-based rotation operations then the resulting
* transform is never strictly classifiable as a quadrant rotation
! * even for a simple case like {@code rotate(Math.PI/2.0)},
* due to minor variations in the matrix caused by the non-0.0 values
* obtained for the sine and cosine.
* If these transforms are not classified as quadrant rotations then
* subsequent code which attempts to optimize further operations based
* upon the type of the transform will be relegated to its most general
*** 104,114 ****
* These methods therefore treat an angle <em>theta</em> as a quadrant
* rotation if either <code>Math.sin(<em>theta</em>)</code> or
* <code>Math.cos(<em>theta</em>)</code> returns exactly 1.0 or -1.0.
* As a rule of thumb, this property holds true for a range of
* approximately 0.0000000211 radians (or 0.00000121 degrees) around
! * small multiples of <code>Math.PI/2.0</code>.
*
* @author Jim Graham
* @since 1.2
*/
public class AffineTransform implements Cloneable, java.io.Serializable {
--- 104,114 ----
* These methods therefore treat an angle <em>theta</em> as a quadrant
* rotation if either <code>Math.sin(<em>theta</em>)</code> or
* <code>Math.cos(<em>theta</em>)</code> returns exactly 1.0 or -1.0.
* As a rule of thumb, this property holds true for a range of
* approximately 0.0000000211 radians (or 0.00000121 degrees) around
! * small multiples of {@code Math.PI/2.0}.
*
* @author Jim Graham
* @since 1.2
*/
public class AffineTransform implements Cloneable, java.io.Serializable {
*** 465,475 ****
this.state = state;
this.type = TYPE_UNKNOWN;
}
/**
! * Constructs a new <code>AffineTransform</code> representing the
* Identity transformation.
* @since 1.2
*/
public AffineTransform() {
m00 = m11 = 1.0;
--- 465,475 ----
this.state = state;
this.type = TYPE_UNKNOWN;
}
/**
! * Constructs a new {@code AffineTransform} representing the
* Identity transformation.
* @since 1.2
*/
public AffineTransform() {
m00 = m11 = 1.0;
*** 477,489 ****
// state = APPLY_IDENTITY; /* Not needed. */
// type = TYPE_IDENTITY; /* Not needed. */
}
/**
! * Constructs a new <code>AffineTransform</code> that is a copy of
! * the specified <code>AffineTransform</code> object.
! * @param Tx the <code>AffineTransform</code> object to copy
* @since 1.2
*/
public AffineTransform(AffineTransform Tx) {
this.m00 = Tx.m00;
this.m10 = Tx.m10;
--- 477,489 ----
// state = APPLY_IDENTITY; /* Not needed. */
// type = TYPE_IDENTITY; /* Not needed. */
}
/**
! * Constructs a new {@code AffineTransform} that is a copy of
! * the specified {@code AffineTransform} object.
! * @param Tx the {@code AffineTransform} object to copy
* @since 1.2
*/
public AffineTransform(AffineTransform Tx) {
this.m00 = Tx.m00;
this.m10 = Tx.m10;
*** 494,504 ****
this.state = Tx.state;
this.type = Tx.type;
}
/**
! * Constructs a new <code>AffineTransform</code> from 6 floating point
* values representing the 6 specifiable entries of the 3x3
* transformation matrix.
*
* @param m00 the X coordinate scaling element of the 3x3 matrix
* @param m10 the Y coordinate shearing element of the 3x3 matrix
--- 494,504 ----
this.state = Tx.state;
this.type = Tx.type;
}
/**
! * Constructs a new {@code AffineTransform} from 6 floating point
* values representing the 6 specifiable entries of the 3x3
* transformation matrix.
*
* @param m00 the X coordinate scaling element of the 3x3 matrix
* @param m10 the Y coordinate shearing element of the 3x3 matrix
*** 520,536 ****
this.m12 = m12;
updateState();
}
/**
! * Constructs a new <code>AffineTransform</code> from an array of
* floating point values representing either the 4 non-translation
* entries or the 6 specifiable entries of the 3x3 transformation
* matrix. The values are retrieved from the array as
* { m00 m10 m01 m11 [m02 m12]}.
* @param flatmatrix the float array containing the values to be set
! * in the new <code>AffineTransform</code> object. The length of the
* array is assumed to be at least 4. If the length of the array is
* less than 6, only the first 4 values are taken. If the length of
* the array is greater than 6, the first 6 values are taken.
* @since 1.2
*/
--- 520,536 ----
this.m12 = m12;
updateState();
}
/**
! * Constructs a new {@code AffineTransform} from an array of
* floating point values representing either the 4 non-translation
* entries or the 6 specifiable entries of the 3x3 transformation
* matrix. The values are retrieved from the array as
* { m00 m10 m01 m11 [m02 m12]}.
* @param flatmatrix the float array containing the values to be set
! * in the new {@code AffineTransform} object. The length of the
* array is assumed to be at least 4. If the length of the array is
* less than 6, only the first 4 values are taken. If the length of
* the array is greater than 6, the first 6 values are taken.
* @since 1.2
*/
*** 545,555 ****
}
updateState();
}
/**
! * Constructs a new <code>AffineTransform</code> from 6 double
* precision values representing the 6 specifiable entries of the 3x3
* transformation matrix.
*
* @param m00 the X coordinate scaling element of the 3x3 matrix
* @param m10 the Y coordinate shearing element of the 3x3 matrix
--- 545,555 ----
}
updateState();
}
/**
! * Constructs a new {@code AffineTransform} from 6 double
* precision values representing the 6 specifiable entries of the 3x3
* transformation matrix.
*
* @param m00 the X coordinate scaling element of the 3x3 matrix
* @param m10 the Y coordinate shearing element of the 3x3 matrix
*** 570,586 ****
this.m12 = m12;
updateState();
}
/**
! * Constructs a new <code>AffineTransform</code> from an array of
* double precision values representing either the 4 non-translation
* entries or the 6 specifiable entries of the 3x3 transformation
* matrix. The values are retrieved from the array as
* { m00 m10 m01 m11 [m02 m12]}.
* @param flatmatrix the double array containing the values to be set
! * in the new <code>AffineTransform</code> object. The length of the
* array is assumed to be at least 4. If the length of the array is
* less than 6, only the first 4 values are taken. If the length of
* the array is greater than 6, the first 6 values are taken.
* @since 1.2
*/
--- 570,586 ----
this.m12 = m12;
updateState();
}
/**
! * Constructs a new {@code AffineTransform} from an array of
* double precision values representing either the 4 non-translation
* entries or the 6 specifiable entries of the 3x3 transformation
* matrix. The values are retrieved from the array as
* { m00 m10 m01 m11 [m02 m12]}.
* @param flatmatrix the double array containing the values to be set
! * in the new {@code AffineTransform} object. The length of the
* array is assumed to be at least 4. If the length of the array is
* less than 6, only the first 4 values are taken. If the length of
* the array is greater than 6, the first 6 values are taken.
* @since 1.2
*/
*** 606,616 ****
* </pre>
* @param tx the distance by which coordinates are translated in the
* X axis direction
* @param ty the distance by which coordinates are translated in the
* Y axis direction
! * @return an <code>AffineTransform</code> object that represents a
* translation transformation, created with the specified vector.
* @since 1.2
*/
public static AffineTransform getTranslateInstance(double tx, double ty) {
AffineTransform Tx = new AffineTransform();
--- 606,616 ----
* </pre>
* @param tx the distance by which coordinates are translated in the
* X axis direction
* @param ty the distance by which coordinates are translated in the
* Y axis direction
! * @return an {@code AffineTransform} object that represents a
* translation transformation, created with the specified vector.
* @since 1.2
*/
public static AffineTransform getTranslateInstance(double tx, double ty) {
AffineTransform Tx = new AffineTransform();
*** 630,640 ****
* X axis toward the positive Y axis.
* Note also the discussion of
* <a href="#quadrantapproximation">Handling 90-Degree Rotations</a>
* above.
* @param theta the angle of rotation measured in radians
! * @return an <code>AffineTransform</code> object that is a rotation
* transformation, created with the specified angle of rotation.
* @since 1.2
*/
public static AffineTransform getRotateInstance(double theta) {
AffineTransform Tx = new AffineTransform();
--- 630,640 ----
* X axis toward the positive Y axis.
* Note also the discussion of
* <a href="#quadrantapproximation">Handling 90-Degree Rotations</a>
* above.
* @param theta the angle of rotation measured in radians
! * @return an {@code AffineTransform} object that is a rotation
* transformation, created with the specified angle of rotation.
* @since 1.2
*/
public static AffineTransform getRotateInstance(double theta) {
AffineTransform Tx = new AffineTransform();
*** 670,680 ****
* above.
*
* @param theta the angle of rotation measured in radians
* @param anchorx the X coordinate of the rotation anchor point
* @param anchory the Y coordinate of the rotation anchor point
! * @return an <code>AffineTransform</code> object that rotates
* coordinates around the specified point by the specified angle of
* rotation.
* @since 1.2
*/
public static AffineTransform getRotateInstance(double theta,
--- 670,680 ----
* above.
*
* @param theta the angle of rotation measured in radians
* @param anchorx the X coordinate of the rotation anchor point
* @param anchory the Y coordinate of the rotation anchor point
! * @return an {@code AffineTransform} object that rotates
* coordinates around the specified point by the specified angle of
* rotation.
* @since 1.2
*/
public static AffineTransform getRotateInstance(double theta,
*** 691,710 ****
* a rotation vector.
* All coordinates rotate about the origin by the same amount.
* The amount of rotation is such that coordinates along the former
* positive X axis will subsequently align with the vector pointing
* from the origin to the specified vector coordinates.
! * If both <code>vecx</code> and <code>vecy</code> are 0.0,
* an identity transform is returned.
* This operation is equivalent to calling:
* <pre>
* AffineTransform.getRotateInstance(Math.atan2(vecy, vecx));
* </pre>
*
* @param vecx the X coordinate of the rotation vector
* @param vecy the Y coordinate of the rotation vector
! * @return an <code>AffineTransform</code> object that rotates
* coordinates according to the specified rotation vector.
* @since 1.6
*/
public static AffineTransform getRotateInstance(double vecx, double vecy) {
AffineTransform Tx = new AffineTransform();
--- 691,710 ----
* a rotation vector.
* All coordinates rotate about the origin by the same amount.
* The amount of rotation is such that coordinates along the former
* positive X axis will subsequently align with the vector pointing
* from the origin to the specified vector coordinates.
! * If both {@code vecx} and {@code vecy} are 0.0,
* an identity transform is returned.
* This operation is equivalent to calling:
* <pre>
* AffineTransform.getRotateInstance(Math.atan2(vecy, vecx));
* </pre>
*
* @param vecx the X coordinate of the rotation vector
* @param vecy the Y coordinate of the rotation vector
! * @return an {@code AffineTransform} object that rotates
* coordinates according to the specified rotation vector.
* @since 1.6
*/
public static AffineTransform getRotateInstance(double vecx, double vecy) {
AffineTransform Tx = new AffineTransform();
*** 718,728 ****
* All coordinates rotate about the specified anchor coordinates
* by the same amount.
* The amount of rotation is such that coordinates along the former
* positive X axis will subsequently align with the vector pointing
* from the origin to the specified vector coordinates.
! * If both <code>vecx</code> and <code>vecy</code> are 0.0,
* an identity transform is returned.
* This operation is equivalent to calling:
* <pre>
* AffineTransform.getRotateInstance(Math.atan2(vecy, vecx),
* anchorx, anchory);
--- 718,728 ----
* All coordinates rotate about the specified anchor coordinates
* by the same amount.
* The amount of rotation is such that coordinates along the former
* positive X axis will subsequently align with the vector pointing
* from the origin to the specified vector coordinates.
! * If both {@code vecx} and {@code vecy} are 0.0,
* an identity transform is returned.
* This operation is equivalent to calling:
* <pre>
* AffineTransform.getRotateInstance(Math.atan2(vecy, vecx),
* anchorx, anchory);
*** 730,740 ****
*
* @param vecx the X coordinate of the rotation vector
* @param vecy the Y coordinate of the rotation vector
* @param anchorx the X coordinate of the rotation anchor point
* @param anchory the Y coordinate of the rotation anchor point
! * @return an <code>AffineTransform</code> object that rotates
* coordinates around the specified point according to the
* specified rotation vector.
* @since 1.6
*/
public static AffineTransform getRotateInstance(double vecx,
--- 730,740 ----
*
* @param vecx the X coordinate of the rotation vector
* @param vecy the Y coordinate of the rotation vector
* @param anchorx the X coordinate of the rotation anchor point
* @param anchory the Y coordinate of the rotation anchor point
! * @return an {@code AffineTransform} object that rotates
* coordinates around the specified point according to the
* specified rotation vector.
* @since 1.6
*/
public static AffineTransform getRotateInstance(double vecx,
*** 755,765 ****
* AffineTransform.getRotateInstance(numquadrants * Math.PI / 2.0);
* </pre>
* Rotating by a positive number of quadrants rotates points on
* the positive X axis toward the positive Y axis.
* @param numquadrants the number of 90 degree arcs to rotate by
! * @return an <code>AffineTransform</code> object that rotates
* coordinates by the specified number of quadrants.
* @since 1.6
*/
public static AffineTransform getQuadrantRotateInstance(int numquadrants) {
AffineTransform Tx = new AffineTransform();
--- 755,765 ----
* AffineTransform.getRotateInstance(numquadrants * Math.PI / 2.0);
* </pre>
* Rotating by a positive number of quadrants rotates points on
* the positive X axis toward the positive Y axis.
* @param numquadrants the number of 90 degree arcs to rotate by
! * @return an {@code AffineTransform} object that rotates
* coordinates by the specified number of quadrants.
* @since 1.6
*/
public static AffineTransform getQuadrantRotateInstance(int numquadrants) {
AffineTransform Tx = new AffineTransform();
*** 779,789 ****
* the positive X axis toward the positive Y axis.
*
* @param numquadrants the number of 90 degree arcs to rotate by
* @param anchorx the X coordinate of the rotation anchor point
* @param anchory the Y coordinate of the rotation anchor point
! * @return an <code>AffineTransform</code> object that rotates
* coordinates by the specified number of quadrants around the
* specified anchor point.
* @since 1.6
*/
public static AffineTransform getQuadrantRotateInstance(int numquadrants,
--- 779,789 ----
* the positive X axis toward the positive Y axis.
*
* @param numquadrants the number of 90 degree arcs to rotate by
* @param anchorx the X coordinate of the rotation anchor point
* @param anchory the Y coordinate of the rotation anchor point
! * @return an {@code AffineTransform} object that rotates
* coordinates by the specified number of quadrants around the
* specified anchor point.
* @since 1.6
*/
public static AffineTransform getQuadrantRotateInstance(int numquadrants,
*** 805,815 ****
* </pre>
* @param sx the factor by which coordinates are scaled along the
* X axis direction
* @param sy the factor by which coordinates are scaled along the
* Y axis direction
! * @return an <code>AffineTransform</code> object that scales
* coordinates by the specified factors.
* @since 1.2
*/
public static AffineTransform getScaleInstance(double sx, double sy) {
AffineTransform Tx = new AffineTransform();
--- 805,815 ----
* </pre>
* @param sx the factor by which coordinates are scaled along the
* X axis direction
* @param sy the factor by which coordinates are scaled along the
* Y axis direction
! * @return an {@code AffineTransform} object that scales
* coordinates by the specified factors.
* @since 1.2
*/
public static AffineTransform getScaleInstance(double sx, double sy) {
AffineTransform Tx = new AffineTransform();
*** 827,837 ****
* </pre>
* @param shx the multiplier by which coordinates are shifted in the
* direction of the positive X axis as a factor of their Y coordinate
* @param shy the multiplier by which coordinates are shifted in the
* direction of the positive Y axis as a factor of their X coordinate
! * @return an <code>AffineTransform</code> object that shears
* coordinates by the specified multipliers.
* @since 1.2
*/
public static AffineTransform getShearInstance(double shx, double shy) {
AffineTransform Tx = new AffineTransform();
--- 827,837 ----
* </pre>
* @param shx the multiplier by which coordinates are shifted in the
* direction of the positive X axis as a factor of their Y coordinate
* @param shy the multiplier by which coordinates are shifted in the
* direction of the positive Y axis as a factor of their X coordinate
! * @return an {@code AffineTransform} object that shears
* coordinates by the specified multipliers.
* @since 1.2
*/
public static AffineTransform getShearInstance(double shx, double shy) {
AffineTransform Tx = new AffineTransform();
*** 1013,1023 ****
* If the determinant is near enough to zero then inverse transform
* operations might not carry enough precision to produce meaningful
* results.
* <p>
* If this transform represents a uniform scale, as indicated by
! * the <code>getType</code> method then the determinant also
* represents the square of the uniform scale factor by which all of
* the points are expanded from or contracted towards the origin.
* If this transform represents a non-uniform scale or more general
* transform then the determinant is not likely to represent a
* value useful for any purpose other than determining if inverse
--- 1013,1023 ----
* If the determinant is near enough to zero then inverse transform
* operations might not carry enough precision to produce meaningful
* results.
* <p>
* If this transform represents a uniform scale, as indicated by
! * the {@code getType} method then the determinant also
* represents the square of the uniform scale factor by which all of
* the points are expanded from or contracted towards the origin.
* If this transform represents a non-uniform scale or more general
* transform then the determinant is not likely to represent a
* value useful for any purpose other than determining if inverse
*** 1232,1242 ****
}
/**
* Concatenates this transform with a translation transformation.
* This is equivalent to calling concatenate(T), where T is an
! * <code>AffineTransform</code> represented by the following matrix:
* <pre>
* [ 1 0 tx ]
* [ 0 1 ty ]
* [ 0 0 1 ]
* </pre>
--- 1232,1242 ----
}
/**
* Concatenates this transform with a translation transformation.
* This is equivalent to calling concatenate(T), where T is an
! * {@code AffineTransform} represented by the following matrix:
* <pre>
* [ 1 0 tx ]
* [ 0 1 ty ]
* [ 0 0 1 ]
* </pre>
*** 1392,1402 ****
}
/**
* Concatenates this transform with a rotation transformation.
* This is equivalent to calling concatenate(R), where R is an
! * <code>AffineTransform</code> represented by the following matrix:
* <pre>
* [ cos(theta) -sin(theta) 0 ]
* [ sin(theta) cos(theta) 0 ]
* [ 0 0 1 ]
* </pre>
--- 1392,1402 ----
}
/**
* Concatenates this transform with a rotation transformation.
* This is equivalent to calling concatenate(R), where R is an
! * {@code AffineTransform} represented by the following matrix:
* <pre>
* [ cos(theta) -sin(theta) 0 ]
* [ sin(theta) cos(theta) 0 ]
* [ 0 0 1 ]
* </pre>
*** 1471,1481 ****
* coordinates according to a rotation vector.
* All coordinates rotate about the origin by the same amount.
* The amount of rotation is such that coordinates along the former
* positive X axis will subsequently align with the vector pointing
* from the origin to the specified vector coordinates.
! * If both <code>vecx</code> and <code>vecy</code> are 0.0,
* no additional rotation is added to this transform.
* This operation is equivalent to calling:
* <pre>
* rotate(Math.atan2(vecy, vecx));
* </pre>
--- 1471,1481 ----
* coordinates according to a rotation vector.
* All coordinates rotate about the origin by the same amount.
* The amount of rotation is such that coordinates along the former
* positive X axis will subsequently align with the vector pointing
* from the origin to the specified vector coordinates.
! * If both {@code vecx} and {@code vecy} are 0.0,
* no additional rotation is added to this transform.
* This operation is equivalent to calling:
* <pre>
* rotate(Math.atan2(vecy, vecx));
* </pre>
*** 1521,1531 ****
* All coordinates rotate about the specified anchor coordinates
* by the same amount.
* The amount of rotation is such that coordinates along the former
* positive X axis will subsequently align with the vector pointing
* from the origin to the specified vector coordinates.
! * If both <code>vecx</code> and <code>vecy</code> are 0.0,
* the transform is not modified in any way.
* This method is equivalent to calling:
* <pre>
* rotate(Math.atan2(vecy, vecx), anchorx, anchory);
* </pre>
--- 1521,1531 ----
* All coordinates rotate about the specified anchor coordinates
* by the same amount.
* The amount of rotation is such that coordinates along the former
* positive X axis will subsequently align with the vector pointing
* from the origin to the specified vector coordinates.
! * If both {@code vecx} and {@code vecy} are 0.0,
* the transform is not modified in any way.
* This method is equivalent to calling:
* <pre>
* rotate(Math.atan2(vecy, vecx), anchorx, anchory);
* </pre>
*** 1619,1629 ****
}
/**
* Concatenates this transform with a scaling transformation.
* This is equivalent to calling concatenate(S), where S is an
! * <code>AffineTransform</code> represented by the following matrix:
* <pre>
* [ sx 0 0 ]
* [ 0 sy 0 ]
* [ 0 0 1 ]
* </pre>
--- 1619,1629 ----
}
/**
* Concatenates this transform with a scaling transformation.
* This is equivalent to calling concatenate(S), where S is an
! * {@code AffineTransform} represented by the following matrix:
* <pre>
* [ sx 0 0 ]
* [ 0 sy 0 ]
* [ 0 0 1 ]
* </pre>
*** 1688,1698 ****
}
/**
* Concatenates this transform with a shearing transformation.
* This is equivalent to calling concatenate(SH), where SH is an
! * <code>AffineTransform</code> represented by the following matrix:
* <pre>
* [ 1 shx 0 ]
* [ shy 1 0 ]
* [ 0 0 1 ]
* </pre>
--- 1688,1698 ----
}
/**
* Concatenates this transform with a shearing transformation.
* This is equivalent to calling concatenate(SH), where SH is an
! * {@code AffineTransform} represented by the following matrix:
* <pre>
* [ 1 shx 0 ]
* [ shy 1 0 ]
* [ 0 0 1 ]
* </pre>
*** 1888,1898 ****
* coordinates according to a rotation vector.
* All coordinates rotate about the origin by the same amount.
* The amount of rotation is such that coordinates along the former
* positive X axis will subsequently align with the vector pointing
* from the origin to the specified vector coordinates.
! * If both <code>vecx</code> and <code>vecy</code> are 0.0,
* the transform is set to an identity transform.
* This operation is equivalent to calling:
* <pre>
* setToRotation(Math.atan2(vecy, vecx));
* </pre>
--- 1888,1898 ----
* coordinates according to a rotation vector.
* All coordinates rotate about the origin by the same amount.
* The amount of rotation is such that coordinates along the former
* positive X axis will subsequently align with the vector pointing
* from the origin to the specified vector coordinates.
! * If both {@code vecx} and {@code vecy} are 0.0,
* the transform is set to an identity transform.
* This operation is equivalent to calling:
* <pre>
* setToRotation(Math.atan2(vecy, vecx));
* </pre>
*** 1941,1951 ****
* All coordinates rotate about the specified anchor coordinates
* by the same amount.
* The amount of rotation is such that coordinates along the former
* positive X axis will subsequently align with the vector pointing
* from the origin to the specified vector coordinates.
! * If both <code>vecx</code> and <code>vecy</code> are 0.0,
* the transform is set to an identity transform.
* This operation is equivalent to calling:
* <pre>
* setToTranslation(Math.atan2(vecy, vecx), anchorx, anchory);
* </pre>
--- 1941,1951 ----
* All coordinates rotate about the specified anchor coordinates
* by the same amount.
* The amount of rotation is such that coordinates along the former
* positive X axis will subsequently align with the vector pointing
* from the origin to the specified vector coordinates.
! * If both {@code vecx} and {@code vecy} are 0.0,
* the transform is set to an identity transform.
* This operation is equivalent to calling:
* <pre>
* setToTranslation(Math.atan2(vecy, vecx), anchorx, anchory);
* </pre>
*** 2165,2176 ****
}
}
/**
* Sets this transform to a copy of the transform in the specified
! * <code>AffineTransform</code> object.
! * @param Tx the <code>AffineTransform</code> object from which to
* copy the transform
* @since 1.2
*/
public void setTransform(AffineTransform Tx) {
this.m00 = Tx.m00;
--- 2165,2176 ----
}
}
/**
* Sets this transform to a copy of the transform in the specified
! * {@code AffineTransform} object.
! * @param Tx the {@code AffineTransform} object from which to
* copy the transform
* @since 1.2
*/
public void setTransform(AffineTransform Tx) {
this.m00 = Tx.m00;
*** 2206,2232 ****
this.m12 = m12;
updateState();
}
/**
! * Concatenates an <code>AffineTransform</code> <code>Tx</code> to
! * this <code>AffineTransform</code> Cx in the most commonly useful
* way to provide a new user space
! * that is mapped to the former user space by <code>Tx</code>.
* Cx is updated to perform the combined transformation.
* Transforming a point p by the updated transform Cx' is
! * equivalent to first transforming p by <code>Tx</code> and then
* transforming the result by the original transform Cx like this:
* Cx'(p) = Cx(Tx(p))
* In matrix notation, if this transform Cx is
! * represented by the matrix [this] and <code>Tx</code> is represented
* by the matrix [Tx] then this method does the following:
* <pre>
* [this] = [this] x [Tx]
* </pre>
! * @param Tx the <code>AffineTransform</code> object to be
! * concatenated with this <code>AffineTransform</code> object.
* @see #preConcatenate
* @since 1.2
*/
@SuppressWarnings("fallthrough")
public void concatenate(AffineTransform Tx) {
--- 2206,2232 ----
this.m12 = m12;
updateState();
}
/**
! * Concatenates an {@code AffineTransform Tx} to
! * this {@code AffineTransform} Cx in the most commonly useful
* way to provide a new user space
! * that is mapped to the former user space by {@code Tx}.
* Cx is updated to perform the combined transformation.
* Transforming a point p by the updated transform Cx' is
! * equivalent to first transforming p by {@code Tx} and then
* transforming the result by the original transform Cx like this:
* Cx'(p) = Cx(Tx(p))
* In matrix notation, if this transform Cx is
! * represented by the matrix [this] and {@code Tx} is represented
* by the matrix [Tx] then this method does the following:
* <pre>
* [this] = [this] x [Tx]
* </pre>
! * @param Tx the {@code AffineTransform} object to be
! * concatenated with this {@code AffineTransform} object.
* @see #preConcatenate
* @since 1.2
*/
@SuppressWarnings("fallthrough")
public void concatenate(AffineTransform Tx) {
*** 2412,2441 ****
}
updateState();
}
/**
! * Concatenates an <code>AffineTransform</code> <code>Tx</code> to
! * this <code>AffineTransform</code> Cx
! * in a less commonly used way such that <code>Tx</code> modifies the
* coordinate transformation relative to the absolute pixel
* space rather than relative to the existing user space.
* Cx is updated to perform the combined transformation.
* Transforming a point p by the updated transform Cx' is
* equivalent to first transforming p by the original transform
* Cx and then transforming the result by
! * <code>Tx</code> like this:
* Cx'(p) = Tx(Cx(p))
* In matrix notation, if this transform Cx
! * is represented by the matrix [this] and <code>Tx</code> is
* represented by the matrix [Tx] then this method does the
* following:
* <pre>
* [this] = [Tx] x [this]
* </pre>
! * @param Tx the <code>AffineTransform</code> object to be
! * concatenated with this <code>AffineTransform</code> object.
* @see #concatenate
* @since 1.2
*/
@SuppressWarnings("fallthrough")
public void preConcatenate(AffineTransform Tx) {
--- 2412,2441 ----
}
updateState();
}
/**
! * Concatenates an {@code AffineTransform Tx} to
! * this {@code AffineTransform} Cx
! * in a less commonly used way such that {@code Tx} modifies the
* coordinate transformation relative to the absolute pixel
* space rather than relative to the existing user space.
* Cx is updated to perform the combined transformation.
* Transforming a point p by the updated transform Cx' is
* equivalent to first transforming p by the original transform
* Cx and then transforming the result by
! * {@code Tx} like this:
* Cx'(p) = Tx(Cx(p))
* In matrix notation, if this transform Cx
! * is represented by the matrix [this] and {@code Tx} is
* represented by the matrix [Tx] then this method does the
* following:
* <pre>
* [this] = [Tx] x [this]
* </pre>
! * @param Tx the {@code AffineTransform} object to be
! * concatenated with this {@code AffineTransform} object.
* @see #concatenate
* @since 1.2
*/
@SuppressWarnings("fallthrough")
public void preConcatenate(AffineTransform Tx) {
*** 2630,2654 ****
}
updateState();
}
/**
! * Returns an <code>AffineTransform</code> object representing the
* inverse transformation.
* The inverse transform Tx' of this transform Tx
* maps coordinates transformed by Tx back
* to their original coordinates.
* In other words, Tx'(Tx(p)) = p = Tx(Tx'(p)).
* <p>
* If this transform maps all coordinates onto a point or a line
* then it will not have an inverse, since coordinates that do
* not lie on the destination point or line will not have an inverse
* mapping.
! * The <code>getDeterminant</code> method can be used to determine if this
* transform has no inverse, in which case an exception will be
! * thrown if the <code>createInverse</code> method is called.
! * @return a new <code>AffineTransform</code> object representing the
* inverse transformation.
* @see #getDeterminant
* @exception NoninvertibleTransformException
* if the matrix cannot be inverted.
* @since 1.2
--- 2630,2654 ----
}
updateState();
}
/**
! * Returns an {@code AffineTransform} object representing the
* inverse transformation.
* The inverse transform Tx' of this transform Tx
* maps coordinates transformed by Tx back
* to their original coordinates.
* In other words, Tx'(Tx(p)) = p = Tx(Tx'(p)).
* <p>
* If this transform maps all coordinates onto a point or a line
* then it will not have an inverse, since coordinates that do
* not lie on the destination point or line will not have an inverse
* mapping.
! * The {@code getDeterminant} method can be used to determine if this
* transform has no inverse, in which case an exception will be
! * thrown if the {@code createInverse} method is called.
! * @return a new {@code AffineTransform} object representing the
* inverse transformation.
* @see #getDeterminant
* @exception NoninvertibleTransformException
* if the matrix cannot be inverted.
* @since 1.2
*** 2738,2750 ****
* <p>
* If this transform maps all coordinates onto a point or a line
* then it will not have an inverse, since coordinates that do
* not lie on the destination point or line will not have an inverse
* mapping.
! * The <code>getDeterminant</code> method can be used to determine if this
* transform has no inverse, in which case an exception will be
! * thrown if the <code>invert</code> method is called.
* @see #getDeterminant
* @exception NoninvertibleTransformException
* if the matrix cannot be inverted.
* @since 1.6
*/
--- 2738,2750 ----
* <p>
* If this transform maps all coordinates onto a point or a line
* then it will not have an inverse, since coordinates that do
* not lie on the destination point or line will not have an inverse
* mapping.
! * The {@code getDeterminant} method can be used to determine if this
* transform has no inverse, in which case an exception will be
! * thrown if the {@code invert} method is called.
* @see #getDeterminant
* @exception NoninvertibleTransformException
* if the matrix cannot be inverted.
* @since 1.6
*/
*** 2859,2883 ****
break;
}
}
/**
! * Transforms the specified <code>ptSrc</code> and stores the result
! * in <code>ptDst</code>.
! * If <code>ptDst</code> is <code>null</code>, a new {@link Point2D}
* object is allocated and then the result of the transformation is
* stored in this object.
! * In either case, <code>ptDst</code>, which contains the
* transformed point, is returned for convenience.
! * If <code>ptSrc</code> and <code>ptDst</code> are the same
* object, the input point is correctly overwritten with
* the transformed point.
! * @param ptSrc the specified <code>Point2D</code> to be transformed
! * @param ptDst the specified <code>Point2D</code> that stores the
! * result of transforming <code>ptSrc</code>
! * @return the <code>ptDst</code> after transforming
! * <code>ptSrc</code> and storing the result in <code>ptDst</code>.
* @since 1.2
*/
public Point2D transform(Point2D ptSrc, Point2D ptDst) {
if (ptDst == null) {
if (ptSrc instanceof Point2D.Double) {
--- 2859,2883 ----
break;
}
}
/**
! * Transforms the specified {@code ptSrc} and stores the result
! * in {@code ptDst}.
! * If {@code ptDst} is {@code null}, a new {@link Point2D}
* object is allocated and then the result of the transformation is
* stored in this object.
! * In either case, {@code ptDst}, which contains the
* transformed point, is returned for convenience.
! * If {@code ptSrc} and {@code ptDst} are the same
* object, the input point is correctly overwritten with
* the transformed point.
! * @param ptSrc the specified {@code Point2D} to be transformed
! * @param ptDst the specified {@code Point2D} that stores the
! * result of transforming {@code ptSrc}
! * @return the {@code ptDst} after transforming
! * {@code ptSrc} and storing the result in {@code ptDst}.
* @since 1.2
*/
public Point2D transform(Point2D ptSrc, Point2D ptDst) {
if (ptDst == null) {
if (ptSrc instanceof Point2D.Double) {
*** 2924,2949 ****
/* NOTREACHED */
}
/**
* Transforms an array of point objects by this transform.
! * If any element of the <code>ptDst</code> array is
! * <code>null</code>, a new <code>Point2D</code> object is allocated
* and stored into that element before storing the results of the
* transformation.
* <p>
* Note that this method does not take any precautions to
! * avoid problems caused by storing results into <code>Point2D</code>
* objects that will be used as the source for calculations
* further down the source array.
! * This method does guarantee that if a specified <code>Point2D</code>
* object is both the source and destination for the same single point
* transform operation then the results will not be stored until
* the calculations are complete to avoid storing the results on
* top of the operands.
! * If, however, the destination <code>Point2D</code> object for one
! * operation is the same object as the source <code>Point2D</code>
* object for another operation further down the source array then
* the original coordinates in that point are overwritten before
* they can be converted.
* @param ptSrc the array containing the source point objects
* @param ptDst the array into which the transform point objects are
--- 2924,2949 ----
/* NOTREACHED */
}
/**
* Transforms an array of point objects by this transform.
! * If any element of the {@code ptDst} array is
! * {@code null}, a new {@code Point2D} object is allocated
* and stored into that element before storing the results of the
* transformation.
* <p>
* Note that this method does not take any precautions to
! * avoid problems caused by storing results into {@code Point2D}
* objects that will be used as the source for calculations
* further down the source array.
! * This method does guarantee that if a specified {@code Point2D}
* object is both the source and destination for the same single point
* transform operation then the results will not be stored until
* the calculations are complete to avoid storing the results on
* top of the operands.
! * If, however, the destination {@code Point2D} object for one
! * operation is the same object as the source {@code Point2D}
* object for another operation further down the source array then
* the original coordinates in that point are overwritten before
* they can be converted.
* @param ptSrc the array containing the source point objects
* @param ptDst the array into which the transform point objects are
*** 3015,3025 ****
* can be overlapping sections of the same array without affecting the
* validity of the results.
* This method ensures that no source coordinates are overwritten by a
* previous operation before they can be transformed.
* The coordinates are stored in the arrays starting at the specified
! * offset in the order <code>[x0, y0, x1, y1, ..., xn, yn]</code>.
* @param srcPts the array containing the source point coordinates.
* Each point is stored as a pair of x, y coordinates.
* @param dstPts the array into which the transformed point coordinates
* are returned. Each point is stored as a pair of x, y
* coordinates.
--- 3015,3025 ----
* can be overlapping sections of the same array without affecting the
* validity of the results.
* This method ensures that no source coordinates are overwritten by a
* previous operation before they can be transformed.
* The coordinates are stored in the arrays starting at the specified
! * offset in the order {@code [x0, y0, x1, y1, ..., xn, yn]}.
* @param srcPts the array containing the source point coordinates.
* Each point is stored as a pair of x, y coordinates.
* @param dstPts the array into which the transformed point coordinates
* are returned. Each point is stored as a pair of x, y
* coordinates.
*** 3130,3140 ****
* can be overlapping sections of the same array without affecting the
* validity of the results.
* This method ensures that no source coordinates are
* overwritten by a previous operation before they can be transformed.
* The coordinates are stored in the arrays starting at the indicated
! * offset in the order <code>[x0, y0, x1, y1, ..., xn, yn]</code>.
* @param srcPts the array containing the source point coordinates.
* Each point is stored as a pair of x, y coordinates.
* @param dstPts the array into which the transformed point
* coordinates are returned. Each point is stored as a pair of
* x, y coordinates.
--- 3130,3140 ----
* can be overlapping sections of the same array without affecting the
* validity of the results.
* This method ensures that no source coordinates are
* overwritten by a previous operation before they can be transformed.
* The coordinates are stored in the arrays starting at the indicated
! * offset in the order {@code [x0, y0, x1, y1, ..., xn, yn]}.
* @param srcPts the array containing the source point coordinates.
* Each point is stored as a pair of x, y coordinates.
* @param dstPts the array into which the transformed point
* coordinates are returned. Each point is stored as a pair of
* x, y coordinates.
*** 3241,3251 ****
/**
* Transforms an array of floating point coordinates by this transform
* and stores the results into an array of doubles.
* The coordinates are stored in the arrays starting at the specified
! * offset in the order <code>[x0, y0, x1, y1, ..., xn, yn]</code>.
* @param srcPts the array containing the source point coordinates.
* Each point is stored as a pair of x, y coordinates.
* @param dstPts the array into which the transformed point coordinates
* are returned. Each point is stored as a pair of x, y
* coordinates.
--- 3241,3251 ----
/**
* Transforms an array of floating point coordinates by this transform
* and stores the results into an array of doubles.
* The coordinates are stored in the arrays starting at the specified
! * offset in the order {@code [x0, y0, x1, y1, ..., xn, yn]}.
* @param srcPts the array containing the source point coordinates.
* Each point is stored as a pair of x, y coordinates.
* @param dstPts the array into which the transformed point coordinates
* are returned. Each point is stored as a pair of x, y
* coordinates.
*** 3337,3347 ****
/**
* Transforms an array of double precision coordinates by this transform
* and stores the results into an array of floats.
* The coordinates are stored in the arrays starting at the specified
! * offset in the order <code>[x0, y0, x1, y1, ..., xn, yn]</code>.
* @param srcPts the array containing the source point coordinates.
* Each point is stored as a pair of x, y coordinates.
* @param dstPts the array into which the transformed point
* coordinates are returned. Each point is stored as a pair of
* x, y coordinates.
--- 3337,3347 ----
/**
* Transforms an array of double precision coordinates by this transform
* and stores the results into an array of floats.
* The coordinates are stored in the arrays starting at the specified
! * offset in the order {@code [x0, y0, x1, y1, ..., xn, yn]}.
* @param srcPts the array containing the source point coordinates.
* Each point is stored as a pair of x, y coordinates.
* @param dstPts the array into which the transformed point
* coordinates are returned. Each point is stored as a pair of
* x, y coordinates.
*** 3430,3452 ****
/* NOTREACHED */
}
/**
! * Inverse transforms the specified <code>ptSrc</code> and stores the
! * result in <code>ptDst</code>.
! * If <code>ptDst</code> is <code>null</code>, a new
! * <code>Point2D</code> object is allocated and then the result of the
* transform is stored in this object.
! * In either case, <code>ptDst</code>, which contains the transformed
* point, is returned for convenience.
! * If <code>ptSrc</code> and <code>ptDst</code> are the same
* object, the input point is correctly overwritten with the
* transformed point.
* @param ptSrc the point to be inverse transformed
* @param ptDst the resulting transformed point
! * @return <code>ptDst</code>, which contains the result of the
* inverse transform.
* @exception NoninvertibleTransformException if the matrix cannot be
* inverted.
* @since 1.2
*/
--- 3430,3452 ----
/* NOTREACHED */
}
/**
! * Inverse transforms the specified {@code ptSrc} and stores the
! * result in {@code ptDst}.
! * If {@code ptDst} is {@code null}, a new
! * {@code Point2D} object is allocated and then the result of the
* transform is stored in this object.
! * In either case, {@code ptDst}, which contains the transformed
* point, is returned for convenience.
! * If {@code ptSrc} and {@code ptDst} are the same
* object, the input point is correctly overwritten with the
* transformed point.
* @param ptSrc the point to be inverse transformed
* @param ptDst the resulting transformed point
! * @return {@code ptDst}, which contains the result of the
* inverse transform.
* @exception NoninvertibleTransformException if the matrix cannot be
* inverted.
* @since 1.2
*/
*** 3519,3529 ****
* can be overlapping sections of the same array without affecting the
* validity of the results.
* This method ensures that no source coordinates are
* overwritten by a previous operation before they can be transformed.
* The coordinates are stored in the arrays starting at the specified
! * offset in the order <code>[x0, y0, x1, y1, ..., xn, yn]</code>.
* @param srcPts the array containing the source point coordinates.
* Each point is stored as a pair of x, y coordinates.
* @param dstPts the array into which the transformed point
* coordinates are returned. Each point is stored as a pair of
* x, y coordinates.
--- 3519,3529 ----
* can be overlapping sections of the same array without affecting the
* validity of the results.
* This method ensures that no source coordinates are
* overwritten by a previous operation before they can be transformed.
* The coordinates are stored in the arrays starting at the specified
! * offset in the order {@code [x0, y0, x1, y1, ..., xn, yn]}.
* @param srcPts the array containing the source point coordinates.
* Each point is stored as a pair of x, y coordinates.
* @param dstPts the array into which the transformed point
* coordinates are returned. Each point is stored as a pair of
* x, y coordinates.
*** 3655,3684 ****
/* NOTREACHED */
}
/**
* Transforms the relative distance vector specified by
! * <code>ptSrc</code> and stores the result in <code>ptDst</code>.
* A relative distance vector is transformed without applying the
* translation components of the affine transformation matrix
* using the following equations:
* <pre>
* [ x' ] [ m00 m01 (m02) ] [ x ] [ m00x + m01y ]
* [ y' ] = [ m10 m11 (m12) ] [ y ] = [ m10x + m11y ]
* [ (1) ] [ (0) (0) ( 1 ) ] [ (1) ] [ (1) ]
* </pre>
! * If <code>ptDst</code> is <code>null</code>, a new
! * <code>Point2D</code> object is allocated and then the result of the
* transform is stored in this object.
! * In either case, <code>ptDst</code>, which contains the
* transformed point, is returned for convenience.
! * If <code>ptSrc</code> and <code>ptDst</code> are the same object,
* the input point is correctly overwritten with the transformed
* point.
* @param ptSrc the distance vector to be delta transformed
* @param ptDst the resulting transformed distance vector
! * @return <code>ptDst</code>, which contains the result of the
* transformation.
* @since 1.2
*/
public Point2D deltaTransform(Point2D ptSrc, Point2D ptDst) {
if (ptDst == null) {
--- 3655,3684 ----
/* NOTREACHED */
}
/**
* Transforms the relative distance vector specified by
! * {@code ptSrc} and stores the result in {@code ptDst}.
* A relative distance vector is transformed without applying the
* translation components of the affine transformation matrix
* using the following equations:
* <pre>
* [ x' ] [ m00 m01 (m02) ] [ x ] [ m00x + m01y ]
* [ y' ] = [ m10 m11 (m12) ] [ y ] = [ m10x + m11y ]
* [ (1) ] [ (0) (0) ( 1 ) ] [ (1) ] [ (1) ]
* </pre>
! * If {@code ptDst} is {@code null}, a new
! * {@code Point2D} object is allocated and then the result of the
* transform is stored in this object.
! * In either case, {@code ptDst}, which contains the
* transformed point, is returned for convenience.
! * If {@code ptSrc} and {@code ptDst} are the same object,
* the input point is correctly overwritten with the transformed
* point.
* @param ptSrc the distance vector to be delta transformed
* @param ptDst the resulting transformed distance vector
! * @return {@code ptDst}, which contains the result of the
* transformation.
* @since 1.2
*/
public Point2D deltaTransform(Point2D ptSrc, Point2D ptDst) {
if (ptDst == null) {
*** 3732,3742 ****
* can be overlapping sections of the same array without affecting the
* validity of the results.
* This method ensures that no source coordinates are
* overwritten by a previous operation before they can be transformed.
* The coordinates are stored in the arrays starting at the indicated
! * offset in the order <code>[x0, y0, x1, y1, ..., xn, yn]</code>.
* @param srcPts the array containing the source distance vectors.
* Each vector is stored as a pair of relative x, y coordinates.
* @param dstPts the array into which the transformed distance vectors
* are returned. Each vector is stored as a pair of relative
* x, y coordinates.
--- 3732,3742 ----
* can be overlapping sections of the same array without affecting the
* validity of the results.
* This method ensures that no source coordinates are
* overwritten by a previous operation before they can be transformed.
* The coordinates are stored in the arrays starting at the indicated
! * offset in the order {@code [x0, y0, x1, y1, ..., xn, yn]}.
* @param srcPts the array containing the source distance vectors.
* Each vector is stored as a pair of relative x, y coordinates.
* @param dstPts the array into which the transformed distance vectors
* are returned. Each vector is stored as a pair of relative
* x, y coordinates.
*** 3812,3827 ****
/* NOTREACHED */
}
/**
* Returns a new {@link Shape} object defined by the geometry of the
! * specified <code>Shape</code> after it has been transformed by
* this transform.
! * @param pSrc the specified <code>Shape</code> object to be
* transformed by this transform.
! * @return a new <code>Shape</code> object that defines the geometry
! * of the transformed <code>Shape</code>, or null if {@code pSrc} is null.
* @since 1.2
*/
public Shape createTransformedShape(Shape pSrc) {
if (pSrc == null) {
return null;
--- 3812,3827 ----
/* NOTREACHED */
}
/**
* Returns a new {@link Shape} object defined by the geometry of the
! * specified {@code Shape} after it has been transformed by
* this transform.
! * @param pSrc the specified {@code Shape} object to be
* transformed by this transform.
! * @return a new {@code Shape} object that defines the geometry
! * of the transformed {@code Shape}, or null if {@code pSrc} is null.
* @since 1.2
*/
public Shape createTransformedShape(Shape pSrc) {
if (pSrc == null) {
return null;
*** 3834,3847 ****
private static double _matround(double matval) {
return Math.rint(matval * 1E15) / 1E15;
}
/**
! * Returns a <code>String</code> that represents the value of this
* {@link Object}.
! * @return a <code>String</code> representing the value of this
! * <code>Object</code>.
* @since 1.2
*/
public String toString() {
return ("AffineTransform[["
+ _matround(m00) + ", "
--- 3834,3847 ----
private static double _matround(double matval) {
return Math.rint(matval * 1E15) / 1E15;
}
/**
! * Returns a {@code String} that represents the value of this
* {@link Object}.
! * @return a {@code String} representing the value of this
! * {@code Object}.
* @since 1.2
*/
public String toString() {
return ("AffineTransform[["
+ _matround(m00) + ", "
*** 3851,3874 ****
+ _matround(m11) + ", "
+ _matround(m12) + "]]");
}
/**
! * Returns <code>true</code> if this <code>AffineTransform</code> is
* an identity transform.
! * @return <code>true</code> if this <code>AffineTransform</code> is
! * an identity transform; <code>false</code> otherwise.
* @since 1.2
*/
public boolean isIdentity() {
return (state == APPLY_IDENTITY || (getType() == TYPE_IDENTITY));
}
/**
! * Returns a copy of this <code>AffineTransform</code> object.
! * @return an <code>Object</code> that is a copy of this
! * <code>AffineTransform</code> object.
* @since 1.2
*/
public Object clone() {
try {
return super.clone();
--- 3851,3874 ----
+ _matround(m11) + ", "
+ _matround(m12) + "]]");
}
/**
! * Returns {@code true} if this {@code AffineTransform} is
* an identity transform.
! * @return {@code true} if this {@code AffineTransform} is
! * an identity transform; {@code false} otherwise.
* @since 1.2
*/
public boolean isIdentity() {
return (state == APPLY_IDENTITY || (getType() == TYPE_IDENTITY));
}
/**
! * Returns a copy of this {@code AffineTransform} object.
! * @return an {@code Object} that is a copy of this
! * {@code AffineTransform} object.
* @since 1.2
*/
public Object clone() {
try {
return super.clone();
*** 3892,3908 ****
bits = bits * 31 + Double.doubleToLongBits(m12);
return (((int) bits) ^ ((int) (bits >> 32)));
}
/**
! * Returns <code>true</code> if this <code>AffineTransform</code>
* represents the same affine coordinate transform as the specified
* argument.
! * @param obj the <code>Object</code> to test for equality with this
! * <code>AffineTransform</code>
! * @return <code>true</code> if <code>obj</code> equals this
! * <code>AffineTransform</code> object; <code>false</code> otherwise.
* @since 1.2
*/
public boolean equals(Object obj) {
if (!(obj instanceof AffineTransform)) {
return false;
--- 3892,3908 ----
bits = bits * 31 + Double.doubleToLongBits(m12);
return (((int) bits) ^ ((int) (bits >> 32)));
}
/**
! * Returns {@code true} if this {@code AffineTransform}
* represents the same affine coordinate transform as the specified
* argument.
! * @param obj the {@code Object} to test for equality with this
! * {@code AffineTransform}
! * @return {@code true} if {@code obj} equals this
! * {@code AffineTransform} object; {@code false} otherwise.
* @since 1.2
*/
public boolean equals(Object obj) {
if (!(obj instanceof AffineTransform)) {
return false;
< prev index next >