|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.proteinshader.graphics.Shape org.proteinshader.graphics.ExtrudedShape org.proteinshader.graphics.Tube
public class Tube
Draws a segment of a three-dimensional tube by using a waist polygon
that approximates a circle as the number of vertices in the waist
polygon becomes large.
In the GLU library, spheres and cylinders are described as being
composed of slices and stacks. A sphere could be thought of as being
subdivided around the z-axis into a number of slices (similar to
longitude lines) and subdivided along the z-axis into stacks (similer
to latitude lines). If a cylinder was drawn with its length along the
z-axis, the cylinder could be subdivided around the z-axis into slices
and along the z-axis into stacks.
Tube shaped structures created by sweeping a waist polygon along a
spline can also be described in terms of slices and stacks. The waist
polygon is initially drawn in the xy-plane with its center at the
orgin, so if the polygon was described as having n number of slices,
it would have n + 1 vertices (with the first and last vertex in the
same position in order to form a closed polygon). An individual slice
could be thought of as a triangle composed of two adjacent vertices
and a point at the center of the nearly circular polygon.
If a segment of the tube was described as having n number of stacks
along its length, then it would need n + 1 number of local frames for
positioning the waist polygon (so a stack can be thought of as a
length of the tube inbetween two waist polygon positions).
The constructor for Tube will create a waist polygon with
DEFULT_SLICES number of slices, but this value can be changed with
the setSlices() method. The number of stacks a segment is composed
of will be one less than the number of LocalFrames it is has (a stack
must have a LocalFrame at each end).
Texture coordinates will be added to the surface of a tube segment
such that the s-coordinate wraps around the circumference of the tube
and the t-coordinate runs along the length of the tube. The
t-coordinate will be zero at the beginning of the segment and 1 at
the end of the segment. The s-coordinate will be zero where the
circumference of the polygon crosses the x-axis of the local
coordinate frame and it will increase to 1 as it wraps all the way
around the circumference of the tube and comes back to the x-axis.
Field Summary | |
---|---|
static double |
ALPHA_RADIUS
The default radius for a Helix region waist polygon is 1.5 angstroms. |
static int |
ALPHA_SLICES
The default number of slices for a Helix region waist polygon is 20. |
static int |
ALPHA_STACKS
The default number of stacks for an alpha-helix segment is 10. |
static double |
BETA_RADIUS
The default radius for a BetaStrand region waist polygon is 1.5 angstroms. |
static int |
BETA_SLICES
The default number of slices for a BetaStrand region waist polygon is 20. |
static int |
BETA_STACKS
The default number of stacks for a beta-strand segment is 10. |
static double |
LOOP_RADIUS
The default radius for a Loop region waist polygon is 0.75 angstroms. |
static int |
LOOP_SLICES
The default number of slices for a Loop region waist polygon is 10. |
static int |
LOOP_STACKS
The default number of stacks for a loop segment is 10. |
static float |
S_MAX
The ending s-coordinate for texture mapping is 2.0, which will cause a texture image to wrap around the tube twice. |
static float |
S_MIN
The starting s-coordinate for texture mapping is 0.0. |
Fields inherited from class org.proteinshader.graphics.ExtrudedShape |
---|
END_CAP_COLOR, START_CAP_COLOR |
Fields inherited from class org.proteinshader.graphics.Shape |
---|
HALF_PI, PI, SPECULAR_COLOR, TWO_PI |
Constructor Summary | |
---|---|
Tube()
Constructs a Tube object that can be used for rendering tubes with a circular-shaped waist polygon. |
|
Tube(double radius,
int slices,
float sCoordStart,
float sCoordEnd,
boolean counterclockwise)
Constructs a Tube object that can be used for rendering tubes with a circular-shaped waist polygon. |
|
Tube(RegionEnum regionType)
Constructs a Tube object that can be used for rendering tubes with a circular-shaped waist polygon. |
Method Summary | |
---|---|
void |
draw(GL gl,
LocalFrame[] frames)
Uses an array of LocalFrame objects to draw a segment of a tube. |
void |
drawEndCap(GL gl,
LocalFrame frame)
Creates a cap for the end of a segment by drawing the waist polygon. |
void |
drawStartCap(GL gl,
LocalFrame frame)
Creates a cap for the beginning of a segment by drawing the waist polygon. |
void |
setRadius(double radius)
Sets the radius used for drawing the waist polygon, which approximates a circle as the number of vertices becomes large. |
void |
setSlicesAndSCoordParameters(int slices,
float sCoordStart,
float sCoordEnd,
boolean counterclockwise)
Sets the direction in which the s-texture coordinate increases from sCoordStart to sCoordEnd and then calls on setSlicesAndSCoordRange(). |
void |
setSlicesAndSCoordRange(int slices,
float sCoordStart,
float sCoordEnd)
Sets the number of slices that the nearly circular waist polygon would be divided into if a line was drawn from the center of the polygon to each vertex. |
Methods inherited from class org.proteinshader.graphics.ExtrudedShape |
---|
applyEndCapColor, applyStartCapColor, createDisplayList, createDisplayLists, createEndCapDisplayList, createStartCapDisplayList |
Methods inherited from class org.proteinshader.graphics.Shape |
---|
deleteDisplayList, executeDisplayList, executeDisplayList, setMaterial |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final double LOOP_RADIUS
public static final int LOOP_SLICES
public static final int LOOP_STACKS
public static final double ALPHA_RADIUS
public static final int ALPHA_SLICES
public static final int ALPHA_STACKS
public static final double BETA_RADIUS
public static final int BETA_SLICES
public static final int BETA_STACKS
public static final float S_MIN
public static final float S_MAX
Constructor Detail |
---|
public Tube()
public Tube(RegionEnum regionType)
regionType
- the type can be HELIX, BETA_STRAND, or LOOP.public Tube(double radius, int slices, float sCoordStart, float sCoordEnd, boolean counterclockwise)
radius
- the radius of the circular waist polygon.slices
- determines the number of vertices in the circle.sCoordStart
- lowest s-coordinate for texture mapping.sCoordEnd
- highest s-coordinate for texture mapping.counterclockwise
- determines the direction in which the
s-texture coordinate increases.Method Detail |
---|
public void draw(GL gl, LocalFrame[] frames)
draw
in class ExtrudedShape
gl
- the current GL object.frames
- array of LocalFrames for positioning a waist
polygon.public void drawStartCap(GL gl, LocalFrame frame)
drawStartCap
in class ExtrudedShape
gl
- the current GL object.frame
- the frame for positioning the waist polygon.public void drawEndCap(GL gl, LocalFrame frame)
drawEndCap
in class ExtrudedShape
gl
- the current GL object.frame
- the frame for positioning the waist polygon.public void setRadius(double radius)
radius
- the radius of the circular waist polygon.public void setSlicesAndSCoordParameters(int slices, float sCoordStart, float sCoordEnd, boolean counterclockwise)
slices
- determines the number of vertices in the circle.sCoordStart
- lowest s-coordinate for texture mapping.sCoordEnd
- highest s-coordinate for texture mapping.counterclockwise
- determines the direction in which the
s-texture coordinate increases.public void setSlicesAndSCoordRange(int slices, float sCoordStart, float sCoordEnd)
slices
- the number of slices the circle is divided into.sCoordStart
- lowest s-coordinate for texture mapping.sCoordEnd
- highest s-coordinate for texture mapping.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |