| Modifier and Type | Field and Description |
|---|---|
protected processing.core.PApplet |
parent
The PApplet object for drawing thinks.
|
| Constructor and Description |
|---|
Rect(processing.core.PApplet parent,
float x,
float y,
float width,
float height)
Builds a new rectangle with the given parameters.
|
Rect(processing.core.PApplet parent,
processing.core.PVector p,
processing.core.PVector dimension)
Builds a new rectangle with the given parameters.
|
| Modifier and Type | Method and Description |
|---|---|
void |
computeMinMax()
Forces to calculate the bounds of this shape and store them.
|
Rect |
copy()
Builds and returns a true copy of this shape.
|
Rect |
draw()
Draws the shape-
|
processing.core.PVector |
get(int i)
Returns the coordinate with index i.
|
float |
getArea()
Returns the area (width * height).
|
Rect |
getBoundingBox()
Returns the bounding box of this shape (will mark the bounds of the
shape).
|
processing.core.PVector |
getCenter()
Returns the center coordinate of this shape.
|
processing.core.PVector[] |
getCoordinates()
Returns all coordinates that defines this shape.
|
float |
getHeight()
Returns the height of the rectangle.
|
Line[] |
getLines()
Converts the rectangle to four lines.
|
LineSegments |
getLineSegments()
Converts the rectangle to LineSegments.
|
java.lang.Float |
getRotation()
Returns the angle of shape.
|
processing.core.PVector |
getStart()
Returns the start coordinate for this shape.
|
float |
getWidth()
Returns the width of the rectangle.
|
java.lang.Float |
getX()
Returns the x-position of the start coordinate for this shape.
|
java.lang.Float |
getY()
Returns the y-position of the start coordinate for this shape.
|
Rect |
rotate(float angle)
Turns the shape through the given angle.
|
Rect |
rotate(processing.core.PVector rotationCenter,
float angle)
Turns the shape through the given angle.
|
Rect |
scale(float scale)
Scale the shape by the given scaling factor.
|
Rect |
scale(processing.core.PVector scaleCenter,
float scale)
Scale the shape by the given scaling factor.
|
Rect |
scale(processing.core.PVector scaleCenter,
float scaleX,
float scaleY)
Scales the shape by the given scaling factors.
|
Rect |
setDimension(float width,
float height)
Sets the width and height of the rectangle.
|
Rect |
setDimension(processing.core.PVector center,
float width,
float height)
Sets the width and height of the rectangle.
|
Rect |
setHeight(float height)
Sets the height of the rectangle.
|
Rect |
setHeight(processing.core.PVector center,
float height)
Sets the height of the rectangle.
|
Rect |
setLocation(float x,
float y)
Translates the shape to the given location.
|
Rect |
setRotation(float angle)
Rotates the shape to the given angle (past rotations will be overridden).
|
Rect |
setRotation(processing.core.PVector rotationCenter,
float angle)
Rotates the shape to the given angle (past rotations will be overridden).
|
Rect |
setWidth(float width)
Sets the width of the rectangle.
|
Rect |
setWidth(processing.core.PVector center,
float width)
Sets the width of the rectangle.
|
Rect |
setX(float x)
Translates the shape to the given x-location.
|
Rect |
setY(float y)
Translates the shape to the given y-location.
|
int |
size()
Returns the number of coordinates for this shape.
|
Line[] |
toLines()
Converts the rectangle to four lines.
|
LineSegments |
toLineSegments()
Converts the rectangle to LineSegments.
|
Rect |
translate(float x,
float y)
Translates the coordinates by the given parameters x, y ( "moves
the shape by x, y").
|
public Rect(processing.core.PApplet parent,
float x,
float y,
float width,
float height)
parent - The PApplet object.x - The x-location of the rectangle (top-left corner).y - The y-location of the rectangle (top-left corner).width - The width the rectangle.height - The height the rectangle.public Rect(processing.core.PApplet parent,
processing.core.PVector p,
processing.core.PVector dimension)
parent - The PApplet object.p - The location of the rectangle (top-left corner).dimension - The width and height of the rectangle.public int size()
RShape
for (int i = 0; i < myShape.size(); i++) {
PVector p = myShape.get(i);
}
public processing.core.PVector get(int i)
RShape
for (int i = 0; i < myShape.size(); i++) {
PVector p = myShape.get(i);
}
public processing.core.PVector getStart()
RShapepublic Rect getBoundingBox()
RShapegetBoundingBox in interface RShapepublic processing.core.PVector getCenter()
RShapepublic java.lang.Float getX()
RShapepublic java.lang.Float getY()
RShapepublic float getWidth()
public float getHeight()
public float getArea()
public processing.core.PVector[] getCoordinates()
RShapegetCoordinates in interface RShapepublic java.lang.Float getRotation()
RShapegetRotation in interface RShapepublic Rect copy()
RShapepublic Rect setRotation(float angle)
RShapesetRotation in interface RShapeangle - The target rotation angle.public Rect setRotation(processing.core.PVector rotationCenter, float angle)
RShapesetRotation in interface RShaperotationCenter - The rotation center.angle - The target rotation angle.public Rect setDimension(float width, float height)
width - The new width of the rectangle (> 0).height - The new height of the rectangle (> 0).public Rect setDimension(processing.core.PVector center, float width, float height)
center - The control point for the scaling.width - The new width of the rectangle (> 0).height - The new height of the rectangle (> 0).public Rect setWidth(float width)
width - The new width of the rectangle (> 0).public Rect setWidth(processing.core.PVector center, float width)
center - The control point for the scaling.width - The new width of the rectangle (> 0).public Rect setHeight(float height)
height - The new height of the rectangle (> 0).public Rect setHeight(processing.core.PVector center, float height)
center - The control point for the scaling.height - The new height of the rectangle (> 0).public Rect setX(float x)
RShapepublic Rect setY(float y)
RShapepublic Rect setLocation(float x, float y)
RShapesetLocation in interface RShapex - The new x-position of this shape.y - The new y-position of this shape.public Rect translate(float x, float y)
RShapepublic Rect rotate(float angle)
RShapepublic Rect rotate(processing.core.PVector rotationCenter, float angle)
RShapepublic Rect scale(float scale)
RShapepublic Rect scale(processing.core.PVector scaleCenter, float scale)
RShapepublic Rect scale(processing.core.PVector scaleCenter, float scaleX, float scaleY)
scaleCenter - The scaling center.scaleX - The horizontal scaling.scaleY - The vertical scaling.public void computeMinMax()
public Line[] toLines()
public Line[] getLines()
public LineSegments toLineSegments()
public LineSegments getLineSegments()