Rectangular
, Shape
public class Rectangle extends Polygon implements Rectangular
D, embeddedSpace, hyperPlanes, position, vertices
Constructor | Description |
---|---|
Rectangle(Space embeddedSpace) |
Constructs a square rectangle of unit size.
|
Rectangle(Space embeddedSpace,
double xLength,
double yLength) |
Constructs a rectangle with edge lengths having the given values.
|
Modifier and Type | Method | Description |
---|---|---|
boolean |
contains(Vector v) |
Returns
true if the given vector lies inside (or on the surface of)
this cell, false otherwise. |
double |
getArea() |
Returns the area enclosed by the rectangle.
|
Vector |
getEdgeLengths() |
Returns a vector with elements equal to the
edge lengths of the rectangle.
|
double |
getPerimeter() |
Returns the perimeter of the rectangle.
|
protected void |
setEdgeLengths(double edgeLengthX,
double edgeLengthY) |
|
void |
setEdgeLengths(Vector e) |
Sets the two edge lengths of the rectangle, taking
each element of the given vector for the length of
the corresponding rectangle edge.
|
void |
updateVertices() |
This method should be defined by the subclass to calculate the vertices
in accordance with the internal representation of the polytope.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
applyTranslationRotation, D, getEmbeddedSpace, getPosition, getVertexCount, getVertices, setPosition, toString
public Rectangle(Space embeddedSpace)
public Rectangle(Space embeddedSpace, double xLength, double yLength)
public double getArea()
public double getPerimeter()
getPerimeter
in class Polygon
public boolean contains(Vector v)
true
if the given vector lies inside (or on the surface of)
this cell, false
otherwise.public void setEdgeLengths(Vector e)
setEdgeLengths
in interface Rectangular
public Vector getEdgeLengths()
getEdgeLengths
in interface Rectangular
protected void setEdgeLengths(double edgeLengthX, double edgeLengthY)
edgeLengthX
- the new length of the sides of the squareedgeLengthY
- the new length of the sides of the squarepublic void updateVertices()
Polytope
updateVertices
in class Polytope