org.proteinshader.graphics
Class FrenetFrames

java.lang.Object
  extended by org.proteinshader.graphics.Shape
      extended by org.proteinshader.graphics.ExtrudedShape
          extended by org.proteinshader.graphics.FrenetFrames

public class FrenetFrames
extends ExtrudedShape

Provides a visual representation of the LocalFrame objects of a Segment by drawing an x-axis, a y-axis, and z-axis.


Field Summary
static double AXIS_RADIUS
          The radius for an axis is 0.05 angtroms.
static float[] BASE
          The small sphere at the base of the xyz-axes is gray.
static int FRAMES_PER_SEGMENT
          The default number of frames per segment in a FRENET_FRAME display is 21.
static double MAJOR_AXIS_SCALE
          The scale factor for major axes is 1.5.
static double MAJOR_SPHERE_RADIUS
          The radius for spheres at major points is 0.3.
static int MAJOR_SPHERE_TILING
          The number of slices and stacks for a major sphere is 30.
static double MINOR_AXIS_SCALE
          The scale factor for minor axes is 0.5.
static double MINOR_SPHERE_RADIUS
          The radius for spheres at minor points is 0.0375.
static int MINOR_SPHERE_TILING
          The number of slices and stacks for a minor sphere is 10.
static int SLICES
          The number of slices for a cylinder is 10.
static float SPECULAR_EXP
          The value for the specular exponent is 20.0.
static int STACKS
          The number of stacks for a cylinder is 1.
static double TIP_FRACTION
          The length of an arrow tip as a fraction of the axis length is 0.1.
static double TIP_RADIUS
          The radius of the large end of an arrow tip is 0.08 angstroms.
static float[] X
          The x-axis is green.
static float[] Y
          The y-axis is yellow.
static float[] Z
          The z-axis is red.
 
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
FrenetFrames()
          Constructs a FrenetFrames object.
 
Method Summary
 void draw(GL gl, LocalFrame[] frames)
          Uses an array of LocalFrame objects to draw xyz-axes.
 void draw(GL gl, LocalFrame frame, double scale, double sphereRadius, int sphereTiling, float sphereRed, float sphereGreen, float sphereBlue, float sphereAlpha)
          Draws an xyz-axis based on the rotation and translation in the LocalFrame given as an argument.
 void drawEndCap(GL gl, LocalFrame frame)
          Draws the local frame using red for the sphere at the base.
 void drawStartCap(GL gl, LocalFrame frame)
          Draws the local frame using light blue for the sphere at the base.
 void setShaders(ShaderManager shaders)
          The ShaderManager is only needed because of an apparent bug on some Mac OS X machines where material color can only be set once after a custom shader is set, so to draw Frenet frames with more than one color, the shaders must be reset each time.
 
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

FRAMES_PER_SEGMENT

public static final int FRAMES_PER_SEGMENT
The default number of frames per segment in a FRENET_FRAME display is 21.

See Also:
Constant Field Values

AXIS_RADIUS

public static final double AXIS_RADIUS
The radius for an axis is 0.05 angtroms.

See Also:
Constant Field Values

TIP_RADIUS

public static final double TIP_RADIUS
The radius of the large end of an arrow tip is 0.08 angstroms.

See Also:
Constant Field Values

TIP_FRACTION

public static final double TIP_FRACTION
The length of an arrow tip as a fraction of the axis length is 0.1.

See Also:
Constant Field Values

MINOR_AXIS_SCALE

public static final double MINOR_AXIS_SCALE
The scale factor for minor axes is 0.5.

See Also:
Constant Field Values

MAJOR_AXIS_SCALE

public static final double MAJOR_AXIS_SCALE
The scale factor for major axes is 1.5.

See Also:
Constant Field Values

MAJOR_SPHERE_RADIUS

public static final double MAJOR_SPHERE_RADIUS
The radius for spheres at major points is 0.3.

See Also:
Constant Field Values

MINOR_SPHERE_RADIUS

public static final double MINOR_SPHERE_RADIUS
The radius for spheres at minor points is 0.0375.

See Also:
Constant Field Values

SLICES

public static final int SLICES
The number of slices for a cylinder is 10.

See Also:
Constant Field Values

STACKS

public static final int STACKS
The number of stacks for a cylinder is 1.

See Also:
Constant Field Values

MAJOR_SPHERE_TILING

public static final int MAJOR_SPHERE_TILING
The number of slices and stacks for a major sphere is 30.

See Also:
Constant Field Values

MINOR_SPHERE_TILING

public static final int MINOR_SPHERE_TILING
The number of slices and stacks for a minor sphere is 10.

See Also:
Constant Field Values

SPECULAR_EXP

public static final float SPECULAR_EXP
The value for the specular exponent is 20.0.

See Also:
Constant Field Values

X

public static final float[] X
The x-axis is green.


Y

public static final float[] Y
The y-axis is yellow.


Z

public static final float[] Z
The z-axis is red.


BASE

public static final float[] BASE
The small sphere at the base of the xyz-axes is gray.

Constructor Detail

FrenetFrames

public FrenetFrames()
Constructs a FrenetFrames object.

Method Detail

setShaders

public void setShaders(ShaderManager shaders)
The ShaderManager is only needed because of an apparent bug on some Mac OS X machines where material color can only be set once after a custom shader is set, so to draw Frenet frames with more than one color, the shaders must be reset each time.

Parameters:
shaders - the shader manager object.

draw

public void draw(GL gl,
                 LocalFrame[] frames)
Uses an array of LocalFrame objects to draw xyz-axes.

If the number of frames is odd, then the frame in the very middle will be drawn at full scale while all other frames will be drawn smaller by using the MINOR_AXES_SCALE, which should be between 0.0 and 1.0. If the number of frames is even, then the frame right after the exact middle will be drawn at full scale with all others reduced. It makes the most sense to always use an odd number of frames because then the largest set of axes will coorespond to the alpha-carbon.

The capStart and capEnd arguments are not currently used, but might be used in the future to draw a special mark or perhaps a waist polygon to indicate that one or the other end of a Segment is capped.

Specified by:
draw in class ExtrudedShape
Parameters:
gl - the current GL object.
frames - array of LocalFrames for positioning a waist polygon.

drawStartCap

public void drawStartCap(GL gl,
                         LocalFrame frame)
Draws the local frame using light blue for the sphere at the base. The sphere will be one-half the size of the alpha-carbon sphere.

Specified by:
drawStartCap in class ExtrudedShape
Parameters:
gl - the current GL object.
frame - the frame for positioning the waist polygon.

drawEndCap

public void drawEndCap(GL gl,
                       LocalFrame frame)
Draws the local frame using red for the sphere at the base. The sphere will be one-half the size of the alpha-carbon sphere.

Specified by:
drawEndCap in class ExtrudedShape
Parameters:
gl - the current GL object.
frame - the frame for positioning the waist polygon.

draw

public void draw(GL gl,
                 LocalFrame frame,
                 double scale,
                 double sphereRadius,
                 int sphereTiling,
                 float sphereRed,
                 float sphereGreen,
                 float sphereBlue,
                 float sphereAlpha)
Draws an xyz-axis based on the rotation and translation in the LocalFrame given as an argument.

Parameters:
gl - the current GL object.
frame - a LocalFrame with a rotation and a translation.
scale - a scale factor for the axes to draw.
sphereRadius - the radius of the sphere at the base of the xyz-axes.
sphereTiling - the number of slices and stacks for the sphere.
sphereRed - the red channel for sphere at base of xyz-axes.
sphereGreen - the green channel for sphere at base of xyz-axes.
sphereBlue - the blue channel for sphere at base of xyz-axes.
sphereAlpha - the alpha channel for sphere at base of xyz-axes.


Copyright © 2007-2008