org.proteinshader.math
Class SlerpDemo

java.lang.Object
  extended by org.proteinshader.math.SlerpDemo

public class SlerpDemo
extends Object

Tests the SLERP algorithm.

The SLERP algorithm is tested using the rotations for three amino acids in the 1JUN.pdb file: CYS 273, GLY 274, and GLY 275, which form Loop 1 of Model 1 (which happens to be on Chain A).

Values calculated by the SegmentFactory for the three vectors [N B T] were printed out by debugging code and are used here testing whether the SLERP interpolation seems reasonable.


Field Summary
static int BANNER_WIDTH
          The banner width is the number of asterisks to print on the line line above or below a banner title.
 
Constructor Summary
SlerpDemo()
          Creates a SlerpDemo object vectors and quaternions that can be used for testing.
 
Method Summary
 String createRepeats(char ch, int n)
          Returns a String with the character given as an argument repeated n number of times.
 void interpolateAndPrint(Quaternion quat1, Quaternion quat2, double t)
          Interpolates between the two quaternions given as arguments and then prints the result quaterion along with the [N B T] equivalent to the quaternion.
 void interpolateQ1AndQ1()
          Interpolates between Q1 (for CYS 273) and itself and prints the results.
 void interpolateQ1AndQ2()
          Interpolates between Q1 (for CYS 273) and Q2 (for GLY 274) and prints the results.
 void interpolateQ2AndQ3()
          Interpolates between Q2 (for GLY 274) and Q3 (for GLY 275) and prints the results.
static void main(String[] args)
          Creates a SlerpDemo object and uses it to the SLERP algorithm.
 void printBanner(String title, String message)
          Prints a banner with a row of asterisks above and below the title, and then a message right below the banner.
 void printColumnVectors(Vec3d N, Vec3d B, Vec3d T)
          Prints the 3 column vectors to standard out.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BANNER_WIDTH

public static final int BANNER_WIDTH
The banner width is the number of asterisks to print on the line line above or below a banner title. The value is set to 72.

See Also:
Constant Field Values
Constructor Detail

SlerpDemo

public SlerpDemo()
Creates a SlerpDemo object vectors and quaternions that can be used for testing.

Method Detail

interpolateQ1AndQ2

public void interpolateQ1AndQ2()
Interpolates between Q1 (for CYS 273) and Q2 (for GLY 274) and prints the results.

In addition to printing the interpolated quaterions for several values of t (where 0 <= t <= 1), each quaternion is converted to the matrix [N B T], and the column vectors are printed out.


interpolateQ2AndQ3

public void interpolateQ2AndQ3()
Interpolates between Q2 (for GLY 274) and Q3 (for GLY 275) and prints the results.

In addition to printing the interpolated quaterions for several values of t (where 0 <= t <= 1), each quaternion is converted to the matrix [N B T], and the column vectors are printed out.


interpolateQ1AndQ1

public void interpolateQ1AndQ1()
Interpolates between Q1 (for CYS 273) and itself and prints the results.

In addition to printing the interpolated quaterions for several values of t (where 0 <= t <= 1), each quaternion is converted to the matrix [N B T], and the column vectors are printed out.


printBanner

public void printBanner(String title,
                        String message)
Prints a banner with a row of asterisks above and below the title, and then a message right below the banner.

Parameters:
title - the title to place in the banner.
message - a message to print right below the banner.

createRepeats

public String createRepeats(char ch,
                            int n)
Returns a String with the character given as an argument repeated n number of times.

Parameters:
ch - the char to repeat.
n - the number of times to repeat ch.
Returns:
A String with n repeats of ch.

printColumnVectors

public void printColumnVectors(Vec3d N,
                               Vec3d B,
                               Vec3d T)
Prints the 3 column vectors to standard out.

Parameters:
N - normal - the 3rd column vector of the rotation matrix.
B - binormal - the 2nd column vector of the rotation matrix.
T - tangent - the 1st column vector of the rotation matrix.

interpolateAndPrint

public void interpolateAndPrint(Quaternion quat1,
                                Quaternion quat2,
                                double t)
Interpolates between the two quaternions given as arguments and then prints the result quaterion along with the [N B T] equivalent to the quaternion.

Parameters:
quat1 - the first quaternion for the interplation.
quat2 - the second quaternion for the interplation.
t - the parameter t should be between 0.0 and 1.0.

main

public static void main(String[] args)
Creates a SlerpDemo object and uses it to the SLERP algorithm.



Copyright © 2007-2008