org.proteinshader.structure.io
Class TubeVertices

java.lang.Object
  extended by org.proteinshader.structure.io.TubeVertices

public class TubeVertices
extends Object

Creates the vertices for 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.

This class is similar to the Tube class in the gui package, but instead of calling on OpenGL to draw a tube, the draw() method returns a 2D array of doubles with the xyz-coordinates for each Vertex. The 2D array is intended to be printed for debugging purposes, or can be used to transfer data from the ProteinShader program over to MatLab, where the tube can be drawn using MatLab patch objects to produce a simple wireframe model (which may be useful for debugging).

FORMAT:

Each row of the matrix represents the vertices [V1, V2, V3,...VN] of a GL_TRIANGLE_STRIP, and is of the form:

row = [x1, y1, z1, x2, y2, z2,...xN, yN, zN]

The first row is the triangle strip at the N-terminus of a Segment, while the last row is the triangle strip at the C-terminus. The order of vertices follows the pattern shown on page 44 of the "OpenGL Programming Guide", 5th Edition, by Shreiner, Woo, Neider, and Davis. Note that the same collection of vertices can be used to draw either a GL_TRIANGLE_STRIP or a GL_QUAD_STRIP. For the first row, the even numbered vertices can be used to create a start cap (to close the end of the tube). For the last row, the odd numbered vertices can be used to create an end cap.

See the comments for the Tube class in the graphics package for additional details of how the vertices are drawn.


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 16.
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 16.
static int BETA_STACKS
          The default number of stacks for a beta-strand segment is 10.
static double HALF_PI
          One-half Pi is defined as 1.57079632679489.
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 8.
static int LOOP_STACKS
          The default number of stacks for a loop segment is 10.
static double PI
          Pi is defined as 3.14159265358979.
static double TWO_PI
          2*Pi is defined as 6.28318530717958.
 
Constructor Summary
TubeVertices()
          Constructs a Tube object that can be used for rendering tubes with a circular-shaped waist polygon.
TubeVertices(double radius, int slices)
          Constructs a TubeVertices object that can be used for rendering tubes with a circular-shaped waist polygon.
TubeVertices(RegionEnum regionType)
          Constructs a TubeVertices object that can be used for rendering tubes with a circular-shaped waist polygon.
 
Method Summary
 double[][] draw(LocalFrame[] frames)
          Uses an array of LocalFrame objects to draw a segment of a tube.
 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 setSlices(int slices)
          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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PI

public static final double PI
Pi is defined as 3.14159265358979.

See Also:
Constant Field Values

TWO_PI

public static final double TWO_PI
2*Pi is defined as 6.28318530717958.

See Also:
Constant Field Values

HALF_PI

public static final double HALF_PI
One-half Pi is defined as 1.57079632679489.

See Also:
Constant Field Values

LOOP_RADIUS

public static final double LOOP_RADIUS
The default radius for a Loop region waist polygon is 0.75 angstroms.

See Also:
Constant Field Values

LOOP_SLICES

public static final int LOOP_SLICES
The default number of slices for a Loop region waist polygon is 8.

See Also:
Constant Field Values

LOOP_STACKS

public static final int LOOP_STACKS
The default number of stacks for a loop segment is 10.

See Also:
Constant Field Values

ALPHA_RADIUS

public static final double ALPHA_RADIUS
The default radius for a Helix region waist polygon is 1.5 angstroms.

See Also:
Constant Field Values

ALPHA_SLICES

public static final int ALPHA_SLICES
The default number of slices for a Helix region waist polygon is 16.

See Also:
Constant Field Values

ALPHA_STACKS

public static final int ALPHA_STACKS
The default number of stacks for an alpha-helix segment is 10.

See Also:
Constant Field Values

BETA_RADIUS

public static final double BETA_RADIUS
The default radius for a BetaStrand region waist polygon is 1.5 angstroms.

See Also:
Constant Field Values

BETA_SLICES

public static final int BETA_SLICES
The default number of slices for a BetaStrand region waist polygon is 16.

See Also:
Constant Field Values

BETA_STACKS

public static final int BETA_STACKS
The default number of stacks for a beta-strand segment is 10.

See Also:
Constant Field Values
Constructor Detail

TubeVertices

public TubeVertices()
Constructs a Tube object that can be used for rendering tubes with a circular-shaped waist polygon.

The default Region type is RegionEnum.LOOP.


TubeVertices

public TubeVertices(RegionEnum regionType)
Constructs a TubeVertices object that can be used for rendering tubes with a circular-shaped waist polygon.

The values for the radius and number of slices will be based on the Region type given as an argument.

Parameters:
regionType - the type can be HELIX, BETA_STRAND, or LOOP.

TubeVertices

public TubeVertices(double radius,
                    int slices)
Constructs a TubeVertices object that can be used for rendering tubes with a circular-shaped waist polygon.

The waist polygon will have the requested radius and the number of vertices will be slices + 1 (the first and last vertex are at the same postion).

Parameters:
radius - the radius of the circular waist polygon.
slices - determines the number of vertices in the circle.
Method Detail

draw

public double[][] draw(LocalFrame[] frames)
Uses an array of LocalFrame objects to draw a segment of a tube.

Parameters:
frames - array of LocalFrames for positioning a waist polygon.

setRadius

public void setRadius(double radius)
Sets the radius used for drawing the waist polygon, which approximates a circle as the number of vertices becomes large.

Parameters:
radius - the radius of the circular waist polygon.

setSlices

public void setSlices(int slices)
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.

The number of vertices in the waist polygon is (slices + 1). If the number of slices is n, then the first vertex would have index 0 and the last vertex would have index n. The first and last vertex are in the same postion so that a closed polygon is formed.

The waist polygon is drawn in the xy-plane using the equation

point(i) = (x, y, z) = ( cosTheta, sinTheta, 0 )

where theta = i * (2*PI / slices), 0 <= i <= slices

The waist polygon is initially drawn using a unit circle (radius = 1) so that the xyz-coordinates could be used to define a surface normal of length 1. The xyz-position will later be scaled by the radius to give a polygon of a desired size.

Parameters:
slices - the number of slices the circle is divided into.


Copyright © 2007-2008