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