package elharo.vrml;
public class Cube extends shape {
double width = 1.0;
double height = 1.0;
double depth = 1.0;
public Cube() {
}
public Cube(
double height, double width, double depth) {
this.width = width;
this.height = height;
this.depth = depth;
}
public Cube(
double height, double width, double depth,
double x, double y, double z) {
this.width = width;
this.height = height;
this.depth = depth;
this.x = x;
this.y = y;
this.z = z;
}
public void sizeTo(
double width,
double height,
double depth) {
this.width = width;
this.height = height;
this.depth = depth;
}
public void sizeRelative(
double width,
double height,
double depth) {
this.width += width;
this.height += height;
this.depth += depth;
}
public String draw() {
String node1 = "Translation { \n" +
"translation " + x + " " + y + " " +
"z + \n}\n\n";
String node2 = "Cube {\n" +
" height " + height +
"\n width " + width +
"\n depth " + depth +
"\n}\n\n";
String node3 = "Translation { \n" +
" translation " + -x + " " + -y + " " +
-z + "\n" + "}\n\n";
return node1 + node2 + node3;
}
}