001 package com.croftsoft.core.math.axis;
002
003 import com.croftsoft.core.math.matrix.Matrix3x3;
004
005 /***********************************************************************
006 * AxisAngle test methods.
007 *
008 * @version
009 * $Id: AxisAngleTest.java,v 1.2 2008/09/20 04:12:46 croft Exp $
010 * @since
011 * 2008-05-09
012 * @author
013 * <a href="http://www.CroftSoft.com/">David Wallace Croft</a>
014 ***********************************************************************/
015
016 public final class AxisAngleTest
017 ////////////////////////////////////////////////////////////////////////
018 ////////////////////////////////////////////////////////////////////////
019 {
020
021 public static void main ( final String [ ] args )
022 ////////////////////////////////////////////////////////////////////////
023 {
024 System.out.println ( test ( ) );
025 }
026
027 public static boolean test ( )
028 ////////////////////////////////////////////////////////////////////////
029 {
030 return testToRotationMatrix ( );
031 }
032
033 public static boolean testToRotationMatrix ( )
034 ////////////////////////////////////////////////////////////////////////
035 {
036 return testToRotationMatrix ( new AxisAngleImp ( 0, 1, 0, 0 ) )
037 && testToRotationMatrix ( new AxisAngleImp ( 180, 0, 1, 0 ) )
038 && testToRotationMatrix ( new AxisAngleImp ( 90, 0, 0, 1 ) )
039 && testToRotationMatrix ( new AxisAngleImp ( 37, 1, 0, 0 ) )
040 && testToRotationMatrix ( new AxisAngleImp ( 37, 0, 1, 0 ) )
041 && testToRotationMatrix ( new AxisAngleImp ( 37, 0, 0, 1 ) );
042 }
043
044 public static boolean testToRotationMatrix (
045 final AxisAngle axisAngle )
046 ////////////////////////////////////////////////////////////////////////
047 {
048 final Matrix3x3 rotationMatrix0 = axisAngle.toRotationMatrix ( );
049
050 final Matrix3x3 rotationMatrix1
051 = axisAngle.toQuat ( ).toRotationMatrix ( );
052
053 System.out.println ( rotationMatrix0.toString ( ) );
054
055 System.out.println ( rotationMatrix1.toString ( ) );
056
057 return rotationMatrix0.matches ( rotationMatrix1, 0.001 );
058 }
059
060 ////////////////////////////////////////////////////////////////////////
061 // private methods
062 ////////////////////////////////////////////////////////////////////////
063
064 private AxisAngleTest ( )
065 ////////////////////////////////////////////////////////////////////////
066 {
067 // empty
068 }
069
070 ////////////////////////////////////////////////////////////////////////
071 ////////////////////////////////////////////////////////////////////////
072 }