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