Shape
public class Cube extends Hexahedron
edges, faces
D, embeddedSpace, hyperPlanes, position, vertices
Constructor | Description |
---|---|
Cube(Space embeddedSpace) |
Constructs a cube of unit size.
|
Cube(Space embeddedSpace,
double size) |
Constructs a cube with edge length having the given value.
|
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 |
getEdgeLength() |
|
double |
getPerimeter() |
Returns 12*edgeLength
|
double |
getSurfaceArea() |
Returns 6*edgeLength^2
|
double |
getVolume() |
Returns edgeLength^3.
|
void |
setEdgeLength(double edgeLength) |
|
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
distanceTo, getEdges, getFaces
applyTranslationRotation, D, getEmbeddedSpace, getPosition, getVertexCount, getVertices, setPosition, toString
public Cube(Space embeddedSpace)
public Cube(Space embeddedSpace, double size)
size
- edge length of the cubepublic double getVolume()
public double getSurfaceArea()
getSurfaceArea
in class Polyhedron
public double getPerimeter()
getPerimeter
in class Polyhedron
public boolean contains(Vector v)
true
if the given vector lies inside (or on the surface of)
this cell, false
otherwise.public double getEdgeLength()
public void setEdgeLength(double edgeLength)
edgeLength
- The size to set.public void updateVertices()
Polytope
updateVertices
in class Polytope