< prev index next >
src/java.desktop/share/classes/java/awt/geom/Line2D.java
Print this page
*** 28,38 ****
import java.awt.Shape;
import java.awt.Rectangle;
import java.io.Serializable;
/**
! * This <code>Line2D</code> represents a line segment in {@code (x,y)}
* coordinate space. This class, like all of the Java 2D API, uses a
* default coordinate system called <i>user space</i> in which the y-axis
* values increase downward and x-axis values increase to the right. For
* more information on the user space coordinate system, see the
* <a href="{@docRoot}/../technotes/guides/2d/spec/j2d-intro.html">
--- 28,38 ----
import java.awt.Shape;
import java.awt.Rectangle;
import java.io.Serializable;
/**
! * This {@code Line2D} represents a line segment in {@code (x,y)}
* coordinate space. This class, like all of the Java 2D API, uses a
* default coordinate system called <i>user space</i> in which the y-axis
* values increase downward and x-axis values increase to the right. For
* more information on the user space coordinate system, see the
* <a href="{@docRoot}/../technotes/guides/2d/spec/j2d-intro.html">
*** 99,112 ****
public Float(float x1, float y1, float x2, float y2) {
setLine(x1, y1, x2, y2);
}
/**
! * Constructs and initializes a <code>Line2D</code> from the
! * specified <code>Point2D</code> objects.
! * @param p1 the start <code>Point2D</code> of this line segment
! * @param p2 the end <code>Point2D</code> of this line segment
* @since 1.2
*/
public Float(Point2D p1, Point2D p2) {
setLine(p1, p2);
}
--- 99,112 ----
public Float(float x1, float y1, float x2, float y2) {
setLine(x1, y1, x2, y2);
}
/**
! * Constructs and initializes a {@code Line2D} from the
! * specified {@code Point2D} objects.
! * @param p1 the start {@code Point2D} of this line segment
! * @param p2 the end {@code Point2D} of this line segment
* @since 1.2
*/
public Float(Point2D p1, Point2D p2) {
setLine(p1, p2);
}
*** 169,179 ****
this.x2 = (float) x2;
this.y2 = (float) y2;
}
/**
! * Sets the location of the end points of this <code>Line2D</code>
* to the specified float coordinates.
* @param x1 the X coordinate of the start point
* @param y1 the Y coordinate of the start point
* @param x2 the X coordinate of the end point
* @param y2 the Y coordinate of the end point
--- 169,179 ----
this.x2 = (float) x2;
this.y2 = (float) y2;
}
/**
! * Sets the location of the end points of this {@code Line2D}
* to the specified float coordinates.
* @param x1 the X coordinate of the start point
* @param y1 the Y coordinate of the start point
* @param x2 the X coordinate of the end point
* @param y2 the Y coordinate of the end point
*** 254,264 ****
*/
public Double() {
}
/**
! * Constructs and initializes a <code>Line2D</code> from the
* specified coordinates.
* @param x1 the X coordinate of the start point
* @param y1 the Y coordinate of the start point
* @param x2 the X coordinate of the end point
* @param y2 the Y coordinate of the end point
--- 254,264 ----
*/
public Double() {
}
/**
! * Constructs and initializes a {@code Line2D} from the
* specified coordinates.
* @param x1 the X coordinate of the start point
* @param y1 the Y coordinate of the start point
* @param x2 the X coordinate of the end point
* @param y2 the Y coordinate of the end point
*** 267,280 ****
public Double(double x1, double y1, double x2, double y2) {
setLine(x1, y1, x2, y2);
}
/**
! * Constructs and initializes a <code>Line2D</code> from the
! * specified <code>Point2D</code> objects.
! * @param p1 the start <code>Point2D</code> of this line segment
! * @param p2 the end <code>Point2D</code> of this line segment
* @since 1.2
*/
public Double(Point2D p1, Point2D p2) {
setLine(p1, p2);
}
--- 267,280 ----
public Double(double x1, double y1, double x2, double y2) {
setLine(x1, y1, x2, y2);
}
/**
! * Constructs and initializes a {@code Line2D} from the
! * specified {@code Point2D} objects.
! * @param p1 the start {@code Point2D} of this line segment
! * @param p2 the end {@code Point2D} of this line segment
* @since 1.2
*/
public Double(Point2D p1, Point2D p2) {
setLine(p1, p2);
}
*** 396,407 ****
* @since 1.2
*/
public abstract double getY1();
/**
! * Returns the start <code>Point2D</code> of this <code>Line2D</code>.
! * @return the start <code>Point2D</code> of this <code>Line2D</code>.
* @since 1.2
*/
public abstract Point2D getP1();
/**
--- 396,407 ----
* @since 1.2
*/
public abstract double getY1();
/**
! * Returns the start {@code Point2D} of this {@code Line2D}.
! * @return the start {@code Point2D} of this {@code Line2D}.
* @since 1.2
*/
public abstract Point2D getP1();
/**
*** 419,460 ****
* @since 1.2
*/
public abstract double getY2();
/**
! * Returns the end <code>Point2D</code> of this <code>Line2D</code>.
! * @return the end <code>Point2D</code> of this <code>Line2D</code>.
* @since 1.2
*/
public abstract Point2D getP2();
/**
! * Sets the location of the end points of this <code>Line2D</code> to
* the specified double coordinates.
* @param x1 the X coordinate of the start point
* @param y1 the Y coordinate of the start point
* @param x2 the X coordinate of the end point
* @param y2 the Y coordinate of the end point
* @since 1.2
*/
public abstract void setLine(double x1, double y1, double x2, double y2);
/**
! * Sets the location of the end points of this <code>Line2D</code> to
! * the specified <code>Point2D</code> coordinates.
! * @param p1 the start <code>Point2D</code> of the line segment
! * @param p2 the end <code>Point2D</code> of the line segment
* @since 1.2
*/
public void setLine(Point2D p1, Point2D p2) {
setLine(p1.getX(), p1.getY(), p2.getX(), p2.getY());
}
/**
! * Sets the location of the end points of this <code>Line2D</code> to
! * the same as those end points of the specified <code>Line2D</code>.
! * @param l the specified <code>Line2D</code>
* @since 1.2
*/
public void setLine(Line2D l) {
setLine(l.getX1(), l.getY1(), l.getX2(), l.getY2());
}
--- 419,460 ----
* @since 1.2
*/
public abstract double getY2();
/**
! * Returns the end {@code Point2D} of this {@code Line2D}.
! * @return the end {@code Point2D} of this {@code Line2D}.
* @since 1.2
*/
public abstract Point2D getP2();
/**
! * Sets the location of the end points of this {@code Line2D} to
* the specified double coordinates.
* @param x1 the X coordinate of the start point
* @param y1 the Y coordinate of the start point
* @param x2 the X coordinate of the end point
* @param y2 the Y coordinate of the end point
* @since 1.2
*/
public abstract void setLine(double x1, double y1, double x2, double y2);
/**
! * Sets the location of the end points of this {@code Line2D} to
! * the specified {@code Point2D} coordinates.
! * @param p1 the start {@code Point2D} of the line segment
! * @param p2 the end {@code Point2D} of the line segment
* @since 1.2
*/
public void setLine(Point2D p1, Point2D p2) {
setLine(p1.getX(), p1.getY(), p2.getX(), p2.getY());
}
/**
! * Sets the location of the end points of this {@code Line2D} to
! * the same as those end points of the specified {@code Line2D}.
! * @param l the specified {@code Line2D}
* @since 1.2
*/
public void setLine(Line2D l) {
setLine(l.getX1(), l.getY1(), l.getX2(), l.getY2());
}
*** 542,573 ****
* {@code (px,py)} lies with respect to this line segment.
* See the method comments of
* {@link #relativeCCW(double, double, double, double, double, double)}
* to interpret the return value.
* @param px the X coordinate of the specified point
! * to be compared with this <code>Line2D</code>
* @param py the Y coordinate of the specified point
! * to be compared with this <code>Line2D</code>
* @return an integer that indicates the position of the specified
! * coordinates with respect to this <code>Line2D</code>
* @see #relativeCCW(double, double, double, double, double, double)
* @since 1.2
*/
public int relativeCCW(double px, double py) {
return relativeCCW(getX1(), getY1(), getX2(), getY2(), px, py);
}
/**
! * Returns an indicator of where the specified <code>Point2D</code>
* lies with respect to this line segment.
* See the method comments of
* {@link #relativeCCW(double, double, double, double, double, double)}
* to interpret the return value.
! * @param p the specified <code>Point2D</code> to be compared
! * with this <code>Line2D</code>
* @return an integer that indicates the position of the specified
! * <code>Point2D</code> with respect to this <code>Line2D</code>
* @see #relativeCCW(double, double, double, double, double, double)
* @since 1.2
*/
public int relativeCCW(Point2D p) {
return relativeCCW(getX1(), getY1(), getX2(), getY2(),
--- 542,573 ----
* {@code (px,py)} lies with respect to this line segment.
* See the method comments of
* {@link #relativeCCW(double, double, double, double, double, double)}
* to interpret the return value.
* @param px the X coordinate of the specified point
! * to be compared with this {@code Line2D}
* @param py the Y coordinate of the specified point
! * to be compared with this {@code Line2D}
* @return an integer that indicates the position of the specified
! * coordinates with respect to this {@code Line2D}
* @see #relativeCCW(double, double, double, double, double, double)
* @since 1.2
*/
public int relativeCCW(double px, double py) {
return relativeCCW(getX1(), getY1(), getX2(), getY2(), px, py);
}
/**
! * Returns an indicator of where the specified {@code Point2D}
* lies with respect to this line segment.
* See the method comments of
* {@link #relativeCCW(double, double, double, double, double, double)}
* to interpret the return value.
! * @param p the specified {@code Point2D} to be compared
! * with this {@code Line2D}
* @return an integer that indicates the position of the specified
! * {@code Point2D} with respect to this {@code Line2D}
* @see #relativeCCW(double, double, double, double, double, double)
* @since 1.2
*/
public int relativeCCW(Point2D p) {
return relativeCCW(getX1(), getY1(), getX2(), getY2(),
*** 593,605 ****
* specified line segment
* @param x4 the X coordinate of the end point of the second
* specified line segment
* @param y4 the Y coordinate of the end point of the second
* specified line segment
! * @return <code>true</code> if the first specified line segment
* and the second specified line segment intersect
! * each other; <code>false</code> otherwise.
* @since 1.2
*/
public static boolean linesIntersect(double x1, double y1,
double x2, double y2,
double x3, double y3,
--- 593,605 ----
* specified line segment
* @param x4 the X coordinate of the end point of the second
* specified line segment
* @param y4 the Y coordinate of the end point of the second
* specified line segment
! * @return {@code true} if the first specified line segment
* and the second specified line segment intersect
! * each other; {@code false} otherwise.
* @since 1.2
*/
public static boolean linesIntersect(double x1, double y1,
double x2, double y2,
double x3, double y3,
*** 622,645 ****
* @param x2 the X coordinate of the end point of the
* specified line segment
* @param y2 the Y coordinate of the end point of the
* specified line segment
* @return {@code <true>} if this line segment and the specified line segment
! * intersect each other; <code>false</code> otherwise.
* @since 1.2
*/
public boolean intersectsLine(double x1, double y1, double x2, double y2) {
return linesIntersect(x1, y1, x2, y2,
getX1(), getY1(), getX2(), getY2());
}
/**
* Tests if the specified line segment intersects this line segment.
! * @param l the specified <code>Line2D</code>
! * @return <code>true</code> if this line segment and the specified line
* segment intersect each other;
! * <code>false</code> otherwise.
* @since 1.2
*/
public boolean intersectsLine(Line2D l) {
return linesIntersect(l.getX1(), l.getY1(), l.getX2(), l.getY2(),
getX1(), getY1(), getX2(), getY2());
--- 622,645 ----
* @param x2 the X coordinate of the end point of the
* specified line segment
* @param y2 the Y coordinate of the end point of the
* specified line segment
* @return {@code <true>} if this line segment and the specified line segment
! * intersect each other; {@code false} otherwise.
* @since 1.2
*/
public boolean intersectsLine(double x1, double y1, double x2, double y2) {
return linesIntersect(x1, y1, x2, y2,
getX1(), getY1(), getX2(), getY2());
}
/**
* Tests if the specified line segment intersects this line segment.
! * @param l the specified {@code Line2D}
! * @return {@code true} if this line segment and the specified line
* segment intersect each other;
! * {@code false} otherwise.
* @since 1.2
*/
public boolean intersectsLine(Line2D l) {
return linesIntersect(l.getX1(), l.getY1(), l.getX2(), l.getY2(),
getX1(), getY1(), getX2(), getY2());
*** 770,789 ****
public double ptSegDistSq(double px, double py) {
return ptSegDistSq(getX1(), getY1(), getX2(), getY2(), px, py);
}
/**
! * Returns the square of the distance from a <code>Point2D</code> to
* this line segment.
* The distance measured is the distance between the specified
* point and the closest point between the current line's end points.
* If the specified point intersects the line segment in between the
* end points, this method returns 0.0.
! * @param pt the specified <code>Point2D</code> being measured against
* this line segment.
* @return a double value that is the square of the distance from the
! * specified <code>Point2D</code> to the current
* line segment.
* @see #ptLineDistSq(Point2D)
* @since 1.2
*/
public double ptSegDistSq(Point2D pt) {
--- 770,789 ----
public double ptSegDistSq(double px, double py) {
return ptSegDistSq(getX1(), getY1(), getX2(), getY2(), px, py);
}
/**
! * Returns the square of the distance from a {@code Point2D} to
* this line segment.
* The distance measured is the distance between the specified
* point and the closest point between the current line's end points.
* If the specified point intersects the line segment in between the
* end points, this method returns 0.0.
! * @param pt the specified {@code Point2D} being measured against
* this line segment.
* @return a double value that is the square of the distance from the
! * specified {@code Point2D} to the current
* line segment.
* @see #ptLineDistSq(Point2D)
* @since 1.2
*/
public double ptSegDistSq(Point2D pt) {
*** 810,829 ****
public double ptSegDist(double px, double py) {
return ptSegDist(getX1(), getY1(), getX2(), getY2(), px, py);
}
/**
! * Returns the distance from a <code>Point2D</code> to this line
* segment.
* The distance measured is the distance between the specified
* point and the closest point between the current line's end points.
* If the specified point intersects the line segment in between the
* end points, this method returns 0.0.
! * @param pt the specified <code>Point2D</code> being measured
* against this line segment
* @return a double value that is the distance from the specified
! * <code>Point2D</code> to the current line
* segment.
* @see #ptLineDist(Point2D)
* @since 1.2
*/
public double ptSegDist(Point2D pt) {
--- 810,829 ----
public double ptSegDist(double px, double py) {
return ptSegDist(getX1(), getY1(), getX2(), getY2(), px, py);
}
/**
! * Returns the distance from a {@code Point2D} to this line
* segment.
* The distance measured is the distance between the specified
* point and the closest point between the current line's end points.
* If the specified point intersects the line segment in between the
* end points, this method returns 0.0.
! * @param pt the specified {@code Point2D} being measured
* against this line segment
* @return a double value that is the distance from the specified
! * {@code Point2D} to the current line
* segment.
* @see #ptLineDist(Point2D)
* @since 1.2
*/
public double ptSegDist(Point2D pt) {
*** 905,915 ****
/**
* Returns the square of the distance from a point to this line.
* The distance measured is the distance between the specified
* point and the closest point on the infinitely-extended line
! * defined by this <code>Line2D</code>. If the specified point
* intersects the line, this method returns 0.0.
*
* @param px the X coordinate of the specified point being
* measured against this line
* @param py the Y coordinate of the specified point being
--- 905,915 ----
/**
* Returns the square of the distance from a point to this line.
* The distance measured is the distance between the specified
* point and the closest point on the infinitely-extended line
! * defined by this {@code Line2D}. If the specified point
* intersects the line, this method returns 0.0.
*
* @param px the X coordinate of the specified point being
* measured against this line
* @param py the Y coordinate of the specified point being
*** 923,941 ****
return ptLineDistSq(getX1(), getY1(), getX2(), getY2(), px, py);
}
/**
* Returns the square of the distance from a specified
! * <code>Point2D</code> to this line.
* The distance measured is the distance between the specified
* point and the closest point on the infinitely-extended line
! * defined by this <code>Line2D</code>. If the specified point
* intersects the line, this method returns 0.0.
! * @param pt the specified <code>Point2D</code> being measured
* against this line
* @return a double value that is the square of the distance from a
! * specified <code>Point2D</code> to the current
* line.
* @see #ptSegDistSq(Point2D)
* @since 1.2
*/
public double ptLineDistSq(Point2D pt) {
--- 923,941 ----
return ptLineDistSq(getX1(), getY1(), getX2(), getY2(), px, py);
}
/**
* Returns the square of the distance from a specified
! * {@code Point2D} to this line.
* The distance measured is the distance between the specified
* point and the closest point on the infinitely-extended line
! * defined by this {@code Line2D}. If the specified point
* intersects the line, this method returns 0.0.
! * @param pt the specified {@code Point2D} being measured
* against this line
* @return a double value that is the square of the distance from a
! * specified {@code Point2D} to the current
* line.
* @see #ptSegDistSq(Point2D)
* @since 1.2
*/
public double ptLineDistSq(Point2D pt) {
*** 945,955 ****
/**
* Returns the distance from a point to this line.
* The distance measured is the distance between the specified
* point and the closest point on the infinitely-extended line
! * defined by this <code>Line2D</code>. If the specified point
* intersects the line, this method returns 0.0.
*
* @param px the X coordinate of the specified point being
* measured against this line
* @param py the Y coordinate of the specified point being
--- 945,955 ----
/**
* Returns the distance from a point to this line.
* The distance measured is the distance between the specified
* point and the closest point on the infinitely-extended line
! * defined by this {@code Line2D}. If the specified point
* intersects the line, this method returns 0.0.
*
* @param px the X coordinate of the specified point being
* measured against this line
* @param py the Y coordinate of the specified point being
*** 962,1011 ****
public double ptLineDist(double px, double py) {
return ptLineDist(getX1(), getY1(), getX2(), getY2(), px, py);
}
/**
! * Returns the distance from a <code>Point2D</code> to this line.
* The distance measured is the distance between the specified
* point and the closest point on the infinitely-extended line
! * defined by this <code>Line2D</code>. If the specified point
* intersects the line, this method returns 0.0.
! * @param pt the specified <code>Point2D</code> being measured
* @return a double value that is the distance from a specified
! * <code>Point2D</code> to the current line.
* @see #ptSegDist(Point2D)
* @since 1.2
*/
public double ptLineDist(Point2D pt) {
return ptLineDist(getX1(), getY1(), getX2(), getY2(),
pt.getX(), pt.getY());
}
/**
* Tests if a specified coordinate is inside the boundary of this
! * <code>Line2D</code>. This method is required to implement the
! * {@link Shape} interface, but in the case of <code>Line2D</code>
! * objects it always returns <code>false</code> since a line contains
* no area.
* @param x the X coordinate of the specified point to be tested
* @param y the Y coordinate of the specified point to be tested
! * @return <code>false</code> because a <code>Line2D</code> contains
* no area.
* @since 1.2
*/
public boolean contains(double x, double y) {
return false;
}
/**
! * Tests if a given <code>Point2D</code> is inside the boundary of
! * this <code>Line2D</code>.
* This method is required to implement the {@link Shape} interface,
! * but in the case of <code>Line2D</code> objects it always returns
! * <code>false</code> since a line contains no area.
! * @param p the specified <code>Point2D</code> to be tested
! * @return <code>false</code> because a <code>Line2D</code> contains
* no area.
* @since 1.2
*/
public boolean contains(Point2D p) {
return false;
--- 962,1011 ----
public double ptLineDist(double px, double py) {
return ptLineDist(getX1(), getY1(), getX2(), getY2(), px, py);
}
/**
! * Returns the distance from a {@code Point2D} to this line.
* The distance measured is the distance between the specified
* point and the closest point on the infinitely-extended line
! * defined by this {@code Line2D}. If the specified point
* intersects the line, this method returns 0.0.
! * @param pt the specified {@code Point2D} being measured
* @return a double value that is the distance from a specified
! * {@code Point2D} to the current line.
* @see #ptSegDist(Point2D)
* @since 1.2
*/
public double ptLineDist(Point2D pt) {
return ptLineDist(getX1(), getY1(), getX2(), getY2(),
pt.getX(), pt.getY());
}
/**
* Tests if a specified coordinate is inside the boundary of this
! * {@code Line2D}. This method is required to implement the
! * {@link Shape} interface, but in the case of {@code Line2D}
! * objects it always returns {@code false} since a line contains
* no area.
* @param x the X coordinate of the specified point to be tested
* @param y the Y coordinate of the specified point to be tested
! * @return {@code false} because a {@code Line2D} contains
* no area.
* @since 1.2
*/
public boolean contains(double x, double y) {
return false;
}
/**
! * Tests if a given {@code Point2D} is inside the boundary of
! * this {@code Line2D}.
* This method is required to implement the {@link Shape} interface,
! * but in the case of {@code Line2D} objects it always returns
! * {@code false} since a line contains no area.
! * @param p the specified {@code Point2D} to be tested
! * @return {@code false} because a {@code Line2D} contains
* no area.
* @since 1.2
*/
public boolean contains(Point2D p) {
return false;
*** 1026,1062 ****
public boolean intersects(Rectangle2D r) {
return r.intersectsLine(getX1(), getY1(), getX2(), getY2());
}
/**
! * Tests if the interior of this <code>Line2D</code> entirely contains
* the specified set of rectangular coordinates.
! * This method is required to implement the <code>Shape</code> interface,
! * but in the case of <code>Line2D</code> objects it always returns
* false since a line contains no area.
* @param x the X coordinate of the upper-left corner of the
* specified rectangular area
* @param y the Y coordinate of the upper-left corner of the
* specified rectangular area
* @param w the width of the specified rectangular area
* @param h the height of the specified rectangular area
! * @return <code>false</code> because a <code>Line2D</code> contains
* no area.
* @since 1.2
*/
public boolean contains(double x, double y, double w, double h) {
return false;
}
/**
! * Tests if the interior of this <code>Line2D</code> entirely contains
! * the specified <code>Rectangle2D</code>.
! * This method is required to implement the <code>Shape</code> interface,
! * but in the case of <code>Line2D</code> objects it always returns
! * <code>false</code> since a line contains no area.
! * @param r the specified <code>Rectangle2D</code> to be tested
! * @return <code>false</code> because a <code>Line2D</code> contains
* no area.
* @since 1.2
*/
public boolean contains(Rectangle2D r) {
return false;
--- 1026,1062 ----
public boolean intersects(Rectangle2D r) {
return r.intersectsLine(getX1(), getY1(), getX2(), getY2());
}
/**
! * Tests if the interior of this {@code Line2D} entirely contains
* the specified set of rectangular coordinates.
! * This method is required to implement the {@code Shape} interface,
! * but in the case of {@code Line2D} objects it always returns
* false since a line contains no area.
* @param x the X coordinate of the upper-left corner of the
* specified rectangular area
* @param y the Y coordinate of the upper-left corner of the
* specified rectangular area
* @param w the width of the specified rectangular area
* @param h the height of the specified rectangular area
! * @return {@code false} because a {@code Line2D} contains
* no area.
* @since 1.2
*/
public boolean contains(double x, double y, double w, double h) {
return false;
}
/**
! * Tests if the interior of this {@code Line2D} entirely contains
! * the specified {@code Rectangle2D}.
! * This method is required to implement the {@code Shape} interface,
! * but in the case of {@code Line2D} objects it always returns
! * {@code false} since a line contains no area.
! * @param r the specified {@code Rectangle2D} to be tested
! * @return {@code false} because a {@code Line2D} contains
* no area.
* @since 1.2
*/
public boolean contains(Rectangle2D r) {
return false;
*** 1070,1110 ****
return getBounds2D().getBounds();
}
/**
* Returns an iteration object that defines the boundary of this
! * <code>Line2D</code>.
* The iterator for this class is not multi-threaded safe,
! * which means that this <code>Line2D</code> class does not
* guarantee that modifications to the geometry of this
! * <code>Line2D</code> object do not affect any iterations of that
* geometry that are already in process.
* @param at the specified {@link AffineTransform}
* @return a {@link PathIterator} that defines the boundary of this
! * <code>Line2D</code>.
* @since 1.2
*/
public PathIterator getPathIterator(AffineTransform at) {
return new LineIterator(this, at);
}
/**
* Returns an iteration object that defines the boundary of this
! * flattened <code>Line2D</code>.
* The iterator for this class is not multi-threaded safe,
! * which means that this <code>Line2D</code> class does not
* guarantee that modifications to the geometry of this
! * <code>Line2D</code> object do not affect any iterations of that
* geometry that are already in process.
! * @param at the specified <code>AffineTransform</code>
* @param flatness the maximum amount that the control points for a
* given curve can vary from colinear before a subdivided
* curve is replaced by a straight line connecting the
! * end points. Since a <code>Line2D</code> object is
* always flat, this parameter is ignored.
! * @return a <code>PathIterator</code> that defines the boundary of the
! * flattened <code>Line2D</code>
* @since 1.2
*/
public PathIterator getPathIterator(AffineTransform at, double flatness) {
return new LineIterator(this, at);
}
--- 1070,1110 ----
return getBounds2D().getBounds();
}
/**
* Returns an iteration object that defines the boundary of this
! * {@code Line2D}.
* The iterator for this class is not multi-threaded safe,
! * which means that this {@code Line2D} class does not
* guarantee that modifications to the geometry of this
! * {@code Line2D} object do not affect any iterations of that
* geometry that are already in process.
* @param at the specified {@link AffineTransform}
* @return a {@link PathIterator} that defines the boundary of this
! * {@code Line2D}.
* @since 1.2
*/
public PathIterator getPathIterator(AffineTransform at) {
return new LineIterator(this, at);
}
/**
* Returns an iteration object that defines the boundary of this
! * flattened {@code Line2D}.
* The iterator for this class is not multi-threaded safe,
! * which means that this {@code Line2D} class does not
* guarantee that modifications to the geometry of this
! * {@code Line2D} object do not affect any iterations of that
* geometry that are already in process.
! * @param at the specified {@code AffineTransform}
* @param flatness the maximum amount that the control points for a
* given curve can vary from colinear before a subdivided
* curve is replaced by a straight line connecting the
! * end points. Since a {@code Line2D} object is
* always flat, this parameter is ignored.
! * @return a {@code PathIterator} that defines the boundary of the
! * flattened {@code Line2D}
* @since 1.2
*/
public PathIterator getPathIterator(AffineTransform at, double flatness) {
return new LineIterator(this, at);
}
< prev index next >