org.jzy3d.plot3d.primitives
Class Tube

java.lang.Object
  extended by org.jzy3d.plot3d.primitives.AbstractDrawable
      extended by org.jzy3d.plot3d.primitives.AbstractWireframeable
          extended by org.jzy3d.plot3d.primitives.Tube
All Implemented Interfaces:
ISingleColorable, IGLRenderer, ISortableDraw, IWireframeable

public class Tube
extends AbstractWireframeable
implements ISingleColorable

A Tube may be used to render cylinders or pyramids, according to its input parameters.
The position and shape of a Tube is defined through its setData() method. Moreover, a Tube is Wireframeable3d and support only one color that is defined trough its setColor() method.

Author:
Martin Pernollet

Constructor Summary
Tube()
          Initialize a Cylinder at the origin.
Tube(Coord3d position, float radius, float height, int hslicing, int vslicing, Color color)
          Initialize a cylinder with the given parameters.
 
Method Summary
 void draw(javax.media.opengl.GL gl, javax.media.opengl.glu.GLU glu, Camera cam)
          Call OpenGL routines for rendering the object.
 Color getColor()
          Get the color.
 void setColor(Color color)
          Set the color.
 void setData(Coord3d position, float radiusBottom, float radiusTop, float height, int slices, int stacks)
          Set the Tube data.
 void setPosition(Coord3d position)
          Set the position of the Cylinder and the dimensions of its boundingbox.
 void setSlicing(int verticalWires, int horizontalWires)
          Set the cylinder slicing parameters, i.e. the subtlety of the circle estimation.
 void setVolume(float radiusBottom, float radiusTop, float height)
          Set the top and bottom radius of the cylinder, its height, and the dimensions of its boundingbox.
 
Methods inherited from class org.jzy3d.plot3d.primitives.AbstractWireframeable
getFaceDisplayed, getWireframeColor, getWireframeDisplayed, getWireframeWidth, setFaceDisplayed, setWireframeColor, setWireframeDisplayed, setWireframeWidth
 
Methods inherited from class org.jzy3d.plot3d.primitives.AbstractDrawable
addDrawableListener, dispose, getBarycentre, getBounds, getDistance, getFace, getLongestDistance, getShortestDistance, getTransform, hasFace, isDisplayed, isFace2dDisplayed, removeDrawableListener, setDisplayed, setLegend, setLegendDisplayed, setTransform, toString, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Tube

public Tube()
Initialize a Cylinder at the origin.


Tube

public Tube(Coord3d position,
            float radius,
            float height,
            int hslicing,
            int vslicing,
            Color color)
Initialize a cylinder with the given parameters.

Method Detail

draw

public void draw(javax.media.opengl.GL gl,
                 javax.media.opengl.glu.GLU glu,
                 Camera cam)
Description copied from class: AbstractDrawable
Call OpenGL routines for rendering the object.

Specified by:
draw in interface IGLRenderer
Specified by:
draw in class AbstractDrawable
Parameters:
gl - GL context
glu - GLU context
cam - a reference to a shooting Camera.

setData

public void setData(Coord3d position,
                    float radiusBottom,
                    float radiusTop,
                    float height,
                    int slices,
                    int stacks)
Set the Tube data.

Parameters:
position - cylinder position (may be handled diffrently in future version)
radiusBottom - radius of the bottom circle
radiusTop - radius of the top circle
height - height of the cylinder
slices - number of vertical slices (i.e. wireframes)
stacks - number of horizontal stacks (i.e. wireframes)

setPosition

public void setPosition(Coord3d position)
Set the position of the Cylinder and the dimensions of its boundingbox. Note that this position will be use to translate the object before drawing it (meaning a glTranslate(position) is performed right after the Translate.execute).

Parameters:
position -

setVolume

public void setVolume(float radiusBottom,
                      float radiusTop,
                      float height)
Set the top and bottom radius of the cylinder, its height, and the dimensions of its boundingbox.

Parameters:
radiusBottom -
radiusTop -
height -

setSlicing

public void setSlicing(int verticalWires,
                       int horizontalWires)
Set the cylinder slicing parameters, i.e. the subtlety of the circle estimation.

Parameters:
verticalWires - number of vertical slices
horizontalWires - number of horizontal slices

setColor

public void setColor(Color color)
Description copied from interface: ISingleColorable
Set the color.

Specified by:
setColor in interface ISingleColorable
Parameters:
color - the color

getColor

public Color getColor()
Description copied from interface: ISingleColorable
Get the color.

Specified by:
getColor in interface ISingleColorable
Returns:
color the color.