java.awt.geom
Class Rectangle2D.Double
java.lang.Object
|
+--java.awt.geom.RectangularShape
|
+--java.awt.geom.Rectangle2D
|
+--java.awt.geom.Rectangle2D.Double
public static class
Rectangle2D.Doubleextends
Rectangle2D This class defines a rectangle in double
precision.
Since:Author:- Eric Blake <ebb9@email.byu.edu>
height
public double height
The height of the rectangle.
width
public double width
The width of the rectangle.
x
public double x
The x coordinate of the lower left corner.
y
public double y
The y coordinate of the lower left corner.
Double
public Double()
Create a rectangle at (0,0) with width 0 and height 0.
Double
public Double(double x, double y, double w, double h)
Create a rectangle with the given values.
Parameters:
createIntersection
public Rectangle2D createIntersection(java.awt.geom.Rectangle2D r)
Return a new rectangle which is the intersection of this and the given
one. The result will be empty if there is no intersection.
Parameters:
Returns:
Throws:
createUnion
public Rectangle2D createUnion(java.awt.geom.Rectangle2D r)
Return a new rectangle which is the union of this and the given one.
Parameters:
Returns:
Throws:
getBounds2D
public Rectangle2D getBounds2D()
Returns the bounds of this rectangle. A pretty useless method, as this
is already a rectangle.
Returns:
getHeight
public double getHeight()
Return the height.
Returns:
getWidth
public double getWidth()
Return the width.
Returns:
getX
public double getX()
Return the X coordinate.
Returns:
getY
public double getY()
Return the Y coordinate.
Returns:
isEmpty
public boolean isEmpty()
Test if the rectangle is empty.
Returns:
- true if width or height is not positive
outcode
public int outcode(double x, double y)
Determine where the point lies with respect to this rectangle. The
result will be the binary OR of the appropriate bit masks.
Since:Parameters:
Returns:
- the binary OR of the result
See Also:
setRect
public void setRect(double x, double y, double w, double h)
Set the contents of this rectangle to those specified.
Parameters:
setRect
public void setRect(java.awt.geom.Rectangle2D r)
Set the contents of this rectangle to those specified.
Parameters:
Throws:
toString
public String toString()
Returns a string representation of this rectangle. This is in the form
getClass().getName() + "[x=" + x + ",y=" + y + ",w=" + width
+ ",h=" + height + ']'
.
Returns:
- a string representation of this rectangle
double
precision.