import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.glu.Sphere; public class Segment { Vector3D location; Vector3D color; float d; Segment(Vector3D location_, float d_, Vector3D color_) { location = new Vector3D(); location.setXYZ(location_); color = new Vector3D(); color.setXYZ(color_); d=d_; } //Spatial Functions float x() { return location.x();} float y() { return location.y();} float z() { return location.z();} Vector3D XYZ() { return location.copy();} void setX(float x_) { location.setX(x_);} void setY(float y_) { location.setY(y_);} void setZ(float z_) { location.setZ(z_);} void setXYZ(float x_, float y_, float z_) { location.setXYZ(x_,y_,z_);} void setXYZ(Vector3D pos) { location.setXYZ(pos);} float d() { return d;} void setD(float d_){d=d_;} Vector3D color() { return color.copy();} void setcolor(Vector3D color_) { color.setXYZ(color_);} void render() { Sphere s = new Sphere(); // an LWJGL class for drawing sphere GL11.glPushMatrix(); { GL11.glTranslatef(location.x(), location.y(), location.z()); GL11.glScalef(d,d,d);//NOTE AFTER the Translate!!!!!!!!! GL11.glColor3f(color.x(),color.y(),color.z()); s.draw(1, 8, 8); // run GL commands to draw sphere } GL11.glPopMatrix(); } }//END Segment