|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.proteinshader.structure.Drawable org.proteinshader.structure.Segment
public class Segment
When a protein is drawn as a tube-like structure, a Segment is a
length of the tube that corresponds to an AminoAcid.
Region objects (Helix, BetaStrand, and Loop) are drawn as tube-like
structures to obtain a schematic or cartoon-like representation of
a protein. The tube is drawn by sweeping a waist polygon along a
spline (a series of control points along a set of cubic equations,
where each cubic equation runs from the center of one alpha-carbon
to the center of the next alpha-carbon). In addition to the
xyz-coordinates for each point along the spline, a rotation
(equivalent to a Frenet frame) needs to be specified so that
the waist polygon can be oriented in the right direction.
The center of a Segment is the alpha-carbon of the AminoAcid the
Segment cooresponds to, and the Segment runs from approximately
the center of the peptide bond before the alpha-carbon to the center
of the peptide bond after the alpha-carbon. The xyz-coordinates of
the alpha-carbon will be the world-space translation of the Segment.
In object-space, the center of the Segment is (0, 0, 0), as objects
are usually drawn about the origin and then afterwards translated to
some position in world-space. The rotation associated with the center
of the Segment should be based on local protein structure, and will
vary depending on whether the Segment is a Helix, BetaStrand, or Loop.
The rotation will be calculated by the SegmentFactory.
A Segment object will hold on to two Hermite objects (hermite1 and
hermite2) and three Quaternion objects (startRotation, middleRotation,
and endRotation). These objects will be created by the SegmentFactory
and then plugged in to the Segment contstructor.
The hermite1 object holds the cubic equation from the center of the
previous Segment object to the center of this Segment object, while
the hermite2 object holds the cubic equation from the center of this
Segment object to the center of the next Segment object. If a
previous or next Segment does not exist, then a cubic equation to
some imaginary next or previous Segment will have to be used (this
issue will be dealt with by the SegmentFactory). The hermite1 object
will be used for finding xyz-points on the spline in the first half
of the Segment object, while the hermite2 object will be used for
finding xyz-points on the spline in the second half of the Segment
object. These xyz-points are the object-space translation component
of a LocalFrame object.
The startRotation and endRotation correspond to the middleRotation for
the previous (i-1) and next (i+1) Segments, respectively. If there is
no previous or next Segment, then some reasonable rotation will need
to be made up by the SegmentFactory. The startRotation and the
middleRotation will be used for finding the rotation for any point
along the spline in the first half of the Segment object, while the
middleRotation and the endRotation will be used for finding the
rotation for any point along the spline in the second half of the
Segment object. Because the rotations are stored as Quaternion
objects, the rotation interpolations can be done with SLERP
(Spherical Linear intERPolation), which should give a nice smooth
transition between rotations.
By combining the Hermite and SLERP interpolations, a Segment will be
able to produce a LocalFrame object for any point along the spline
from the beginning to the end of the Segment. A LocalFrame contains a
rotation (as a Quaternion) and a translation (as a Vec3d) that can be
used to position a waist polygon when rendering the Segment. To
obtain an individual LocalFrame, the getLocalFrame() method takes as
an argument a paramter t, where 0.0 <= t <= 1.0. If t = 0 is plugged
in, a LocalFrame corresponding to a point on the spline at the very
beginning of the Segment is returned. If t = 0.5 is plugged in, the
LocalFrame returned will correspond to the center of the Segment
(where the alpha-carbon is located on the spline). If t = 1.0 is
plugged in, the LocalFrame will correspond to the very end of the
Segment. To obtain an array of LocalFrames, the getLocalFrames()
method takes an argument n, where n is the total number of frames
from the first to the last frame of the Segment.
Field Summary | |
---|---|
static DecorationEnum |
DECORATION
The default decoration is HALFTONING. |
static double |
MAX_BEND
The maximum bend is the cosine of the smallest expected bend angle for a Segment. |
Fields inherited from class org.proteinshader.structure.Drawable |
---|
DEFAULT_ALPHA, DEFAULT_BLUE, DEFAULT_GREEN, DEFAULT_RADIUS, DEFAULT_RED, DEFAULT_SPECULAR_EXP |
Constructor Summary | |
---|---|
Segment(AminoAcid aminoAcid,
Hermite hermite1,
Hermite hermite2,
Quaternion startRotation,
Quaternion middleRotation,
Quaternion endRotation,
boolean alwaysCapStart,
boolean alwaysCapEnd)
Creates a Segment. |
Method Summary | |
---|---|
void |
accept(Visitor visitor)
Accepts a Visitor and does a callback. |
boolean |
displayAlphaCarbon()
Returns true if the alpha-carbon should be displayed. |
AminoAcid |
getAminoAcid()
Returns the a reference to the AminoAcid that this Segment corresponds to. |
AminoAcidEnum |
getAminoAcidType()
Returns the type of AminoAcid that this Sement represents. |
float |
getBendFactor()
Returns the bend factor, which is calculated using the tangent at the very beginning of the segment and the tangent at the very end of the segment. |
int |
getBendTexture()
Returns the name (an integer) of an OpenGL texture object (stored on the graphics card) that can be used as a second texture for adding extra lines in the middle of segments that have a sharp bend to them. |
DecorationEnum |
getDecoration()
Returns the decoration type for this Segment (PLAIN, WIREFRAME, TEXT_LABEL, PATTERNS, or HALFTONING). |
Quaternion |
getEndRotation()
Returns a clone of the Quaternion for the end rotation of this Segment. |
String |
getFullName()
Returns the full name of the Segment, which is a concatenation of the structureID, modelID, regionID, and residueID (with a single blank space between IDs). |
int |
getHalftoningTexture()
Returns the name (an integer) of an OpenGL texure object that can be used for real-time halftoning (or returns zero if no such texture object is associated with this Segment). |
Hermite |
getHermite1()
Creates a clone of the hermite1 object and returns it. |
Hermite |
getHermite2()
Creates a clone of the hermite2 object and returns it. |
LocalFrame |
getLocalFrame(double t)
Creates a LocalFrame along the Segment spline by using Hermite interpolation and SLERP (Spherical Linear intERPolation). |
LocalFrame[] |
getLocalFrames(int n)
Uses SLERP (Spherical Linear intERPolation) and Hermite interpolation to generate the requested number of LocalFrames from the start frame to the end frame, inclusive. |
Vec3d |
getMiddleBinormal()
Converts the middle rotation (a Quaternion) into a 3 x 3 rotation matrix and then returns the third column vector, the Binormal. |
Vec3d |
getMiddleNormal()
Converts the middle rotation (a Quaternion) into a 3 x 3 rotation matrix and then returns the first column vector, the Normal. |
Quaternion |
getMiddleRotation()
Returns a clone of the Quaternion for the middle rotation of this Segment. |
Vec3d |
getMiddleTangent()
Converts the middle rotation (a Quaternion) into a 3 x 3 rotation matrix and then returns the third column vector, the Tangent. |
Vec3d |
getMiddleXYZ()
Copies the xyz-coordinates for the center of this Segment into a new Vec3d and returns it. |
Segment |
getNextSegment()
Returns a reference to the next Segment with the same region so that the visiblity status of the next Segment can be checked before deciding to render a start cap for the current tube or ribbon segment. |
int |
getPatternsTexture()
Returns the name (an integer) of an OpenGL texure object that can be used for applying a pattern onto the surface of this Segment (or returns zero if there is no texture object for applying a pattern). |
Segment |
getPrevSegment()
Returns a reference to the previous Segment with the same region so that the visiblity status of the previous Segment can be checked before deciding to render a start cap for the current tube or ribbon segment. |
RegionEnum |
getRegionType()
Returns the type of Region that this Segment belongs to. |
String |
getSegmentID()
Returns the Segment ID, which is the same as the Residue ID of the AminoAcid this Segment represents. |
SideChainEnum |
getSideChainStyle()
Gets the side chain style (NONE, SPACE_FILLING, STICK_AND_BALLS, or STICKS). |
Quaternion |
getStartRotation()
Returns a clone of the Quaternion for the start rotation of this Segment. |
boolean |
isEndCapped()
Returns a boolean value to indicate if the end of the Segment should be capped when it is drawn. |
boolean |
isStartCapped()
Returns a boolean value to indicate if the start of the Segment should be capped when it is drawn. |
void |
reverseXYAxesOfMiddleRotation()
Modifies the middle rotation quaternion such that if it is converted to the matrix [N B T], the N (x-axis) and B (y-axis) column vectors are inverted. |
void |
setBendTexture(int bendTexture)
Sets the name (an integer) of an OpenGL texture object (stored on the graphics card) that can be used as a second texture for adding extra lines in the middle of segments that have a sharp bend to them. |
void |
setCapEnd(boolean alwaysCapEnd)
Sets a boolean value to remember if the end of the Segment should always be capped when it is drawn. |
void |
setCapStart(boolean alwaysCapStart)
Sets a boolean value to remember if the start of the Segment should be always be capped when it is drawn. |
void |
setDecoration(DecorationEnum decoration)
Sets the decoration type for this Segment (PLAIN, WIREFRAME, TEXT_LABEL, or HALFTONING). |
void |
setHalftoningTexture(int halftoningTexture)
Sets the name (an integer) of an OpenGL texture object (stored on the graphics card) that can be used for real-time halftoning with the Segment. |
void |
setNextSegment(Segment next)
Stores a reference to the next Segment within the same Region. |
void |
setPatternsTexture(int patternsTexture)
Sets the name (an integer) of an OpenGL texture object (stored on the graphics card) that can be used for applying a pattern to the surface of this Segment. |
void |
setPrevSegment(Segment prev)
Stores a reference to the previous Segment within the same Region. |
void |
setSideChainStyle(SideChainEnum style,
boolean alphaCarbon)
Sets the side chain style (NONE, SPACE_FILLING, STICK_AND_BALLS, or STICKS) and determines whether the alpha-carbon should be shown. |
void |
setToAminoAcidColor()
Sets the Segment color to the AAColorEnum for the AminoAcid this Segment corresponds to. |
void |
setToRegionColor()
Sets the Segment color to the RegionColorEnum for the type of Region this Segment belongs to. |
String |
toString()
Returns the ID of this Segment. |
Methods inherited from class org.proteinshader.structure.Drawable |
---|
distance, getAlpha, getAngstromsPerPixel, getBlue, getCameraDepth, getCameraDistance, getColor, getDrawableType, getGreen, getPoint, getRadius, getRed, getSpecularExp, getTranslation, getVisibility, getX, getY, getZ, minus, scaleRadius, setAlpha, setAlphaToDefault, setAngstromsPerPixel, setCameraDepth, setCameraDistance, setColor, setColor, setColor, setRadius, setRadiusToDefault, setRGBAToDefault, setRGBToDefault, setSpecularExp, setSpecularExpToDefault, setVisibility |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final DecorationEnum DECORATION
public static final double MAX_BEND
Constructor Detail |
---|
public Segment(AminoAcid aminoAcid, Hermite hermite1, Hermite hermite2, Quaternion startRotation, Quaternion middleRotation, Quaternion endRotation, boolean alwaysCapStart, boolean alwaysCapEnd)
aminoAcid
- the AminoAcid the Segment corresponds to.hermite1
- cubic equation for first half of the Segment.hermite2
- cubic equation for second half of the Segment.startRotation
- the middleRotation of the previous Segment.middleRotation
- the rotation at the center of this Segment.endRotation
- the middleRotation of the previous Segment.alwaysCapStart
- indicates if the start should always be capped.alwaysCapEnd
- indicates if the end should be always capped.Method Detail |
---|
public void accept(Visitor visitor) throws VisitorException
accept
in interface Visitable
accept
in class Drawable
visitor
- the Visitor to do a callback with.
VisitorException
- if an error occurs while an object is
being visited.public String getSegmentID()
public String getFullName()
public AminoAcid getAminoAcid()
public AminoAcidEnum getAminoAcidType()
public RegionEnum getRegionType()
public DecorationEnum getDecoration()
public void setDecoration(DecorationEnum decoration)
decoration
- the decoration type for this Segment.public int getPatternsTexture()
public void setPatternsTexture(int patternsTexture)
patternsTexture
- the name (an integer) of an OpenGL texture.public int getHalftoningTexture()
public void setHalftoningTexture(int halftoningTexture)
halftoningTexture
- the name (an integer) of an OpenGL
texture.public int getBendTexture()
public void setBendTexture(int bendTexture)
bendTexture
- the name (an integer) of an OpenGL texture.public float getBendFactor()
public LocalFrame[] getLocalFrames(int n)
n
- the total number of LocalFrames requested.
public LocalFrame getLocalFrame(double t)
t
- a parameter from 0.0 to 1.0, inclusive.
public Hermite getHermite1()
public Hermite getHermite2()
public Vec3d getMiddleNormal()
public Vec3d getMiddleBinormal()
public Vec3d getMiddleTangent()
public Vec3d getMiddleXYZ()
public Quaternion getStartRotation()
public Quaternion getMiddleRotation()
public Quaternion getEndRotation()
public boolean isStartCapped()
public boolean isEndCapped()
public void reverseXYAxesOfMiddleRotation()
public void setCapStart(boolean alwaysCapStart)
alwaysCapStart
- a boolean indicating if the start should be
capped.public void setCapEnd(boolean alwaysCapEnd)
alwaysCapEnd
- a boolean indicating if the end should be capped.public void setToAminoAcidColor()
public void setToRegionColor()
public SideChainEnum getSideChainStyle()
public void setSideChainStyle(SideChainEnum style, boolean alphaCarbon)
style
- the desired style for side chains.alphaCarbon
- boolean to determine if alpha-carbon is shown.public boolean displayAlphaCarbon()
public void setPrevSegment(Segment prev)
prev
- the previous Segment in the same Region.public Segment getPrevSegment()
public void setNextSegment(Segment next)
next
- the next Segment in the same Region.public Segment getNextSegment()
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |