Package lejos.robotics.geometry
Class Rectangle2D.Double
- java.lang.Object
-
- lejos.robotics.geometry.RectangularShape
-
- lejos.robotics.geometry.Rectangle2D
-
- lejos.robotics.geometry.Rectangle2D.Double
-
- All Implemented Interfaces:
java.lang.Cloneable,Shape
- Enclosing class:
- Rectangle2D
public static class Rectangle2D.Double extends Rectangle2D
A Rectangle2D with double coordinates
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class lejos.robotics.geometry.Rectangle2D
Rectangle2D.Double, Rectangle2D.Float
-
-
Field Summary
Fields Modifier and Type Field Description doubleheightThe height of the rectangle;doublewidthThe width of the rectangledoublexThe x coordinate of the top left cornerdoubleyThe y coordinate of the top right corner-
Fields inherited from class lejos.robotics.geometry.Rectangle2D
OUT_BOTTOM, OUT_LEFT, OUT_RIGHT, OUT_TOP
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Rectangle2DgetBounds2D()Get the bounding Rectangle2D for the shapedoublegetHeight()Get the height as a doubledoublegetWidth()Get the width as a doubledoublegetX()Get the x coordinate as a doubledoublegetY()Get the y coordinate as a doublebooleanisEmpty()Test if the rectangular shape is emptyintoutcode(double x, double y)Returns a mask value that specifies where a point lies with respect to this rectangle.voidsetFrame(double x, double y, double w, double h)Set the frame for the rectangular shapevoidsetRect(double x, double y, double w, double h)Set this rectangle to a rectangle defined by double coordinatesvoidsetRect(Rectangle2D r)Set this Rectangle2D to be the same as a given Rectangle2D-
Methods inherited from class lejos.robotics.geometry.Rectangle2D
contains, contains, equals, intersects, intersectsLine, outcode
-
Methods inherited from class lejos.robotics.geometry.RectangularShape
clone, contains, contains, getBounds, getCenterX, getCenterY, getFrame, getMaxX, getMaxY, getMinX, getMinY, intersects, setFrame
-
-
-
-
Method Detail
-
getX
public double getX()
Description copied from class:RectangularShapeGet the x coordinate as a double- Specified by:
getXin classRectangularShape- Returns:
- the x coordinate
-
getY
public double getY()
Description copied from class:RectangularShapeGet the y coordinate as a double- Specified by:
getYin classRectangularShape- Returns:
- the y coordinate
-
getWidth
public double getWidth()
Description copied from class:RectangularShapeGet the width as a double- Specified by:
getWidthin classRectangularShape- Returns:
- the width
-
getHeight
public double getHeight()
Description copied from class:RectangularShapeGet the height as a double- Specified by:
getHeightin classRectangularShape- Returns:
- the height
-
isEmpty
public boolean isEmpty()
Description copied from class:RectangularShapeTest if the rectangular shape is empty- Specified by:
isEmptyin classRectangularShape- Returns:
- true iff the shape is empty
-
setFrame
public void setFrame(double x, double y, double w, double h)Description copied from class:RectangularShapeSet the frame for the rectangular shape- Overrides:
setFramein classRectangle2D- Parameters:
x- the x coordinate of the top left cornery- the y coordinate iof the top left cornerw- the widthh- the height
-
getBounds2D
public Rectangle2D getBounds2D()
Description copied from interface:ShapeGet the bounding Rectangle2D for the shape- Returns:
- the bounding Rectangle2D
-
setRect
public void setRect(double x, double y, double w, double h)Description copied from class:Rectangle2DSet this rectangle to a rectangle defined by double coordinates- Specified by:
setRectin classRectangle2D- Parameters:
x- the x coordinate of the top left cornery- the y coordinate of the top right cornerw- the width of the rectangleh- the height of the rectangle
-
setRect
public void setRect(Rectangle2D r)
Description copied from class:Rectangle2DSet this Rectangle2D to be the same as a given Rectangle2D- Overrides:
setRectin classRectangle2D- Parameters:
r- the Rectangle2D
-
outcode
public int outcode(double x, double y)Description copied from class:Rectangle2DReturns a mask value that specifies where a point lies with respect to this rectangle.- Specified by:
outcodein classRectangle2D- Parameters:
x- the x coordinate of the given pointy- the y coordinate of the given point- Returns:
- the mask value
-
-