001 package com.croftsoft.core.math.matrix; 002 003 /*********************************************************************** 004 * Implementation of interface Matrix3x3Mut. 005 * 006 * @version 007 * $Id: Matrix3x3Imp.java,v 1.5 2008/05/09 19:48:45 croft Exp $ 008 * @since 009 * 2008-04-25 010 * @author 011 * <a href="https://www.croftsoft.com/">David Wallace Croft</a> 012 ***********************************************************************/ 013 014 public final class Matrix3x3Imp 015 extends MatrixImp 016 implements Matrix3x3Mut 017 //////////////////////////////////////////////////////////////////////// 018 //////////////////////////////////////////////////////////////////////// 019 { 020 021 public Matrix3x3Imp ( ) 022 //////////////////////////////////////////////////////////////////////// 023 { 024 super ( 3, 3 ); 025 } 026 027 public Matrix3x3Imp ( final Matrix matrix ) 028 //////////////////////////////////////////////////////////////////////// 029 { 030 super ( 3, 3 ); 031 032 if ( matrix.getRowCount ( ) != 3 ) 033 { 034 throw new IllegalArgumentException ( "rowCount != 3" ); 035 } 036 037 if ( matrix.getColumnCount ( ) != 3 ) 038 { 039 throw new IllegalArgumentException ( "columnCount != 3" ); 040 } 041 042 for ( int row = 0; row < 3; row++ ) 043 { 044 for ( int column = 0; column < 3; column++ ) 045 { 046 set ( row, column, matrix.get ( row, column ) ); 047 } 048 } 049 } 050 051 public Matrix3x3Imp ( final double [ ] [ ] values ) 052 //////////////////////////////////////////////////////////////////////// 053 { 054 super ( values ); 055 056 if ( rowCount != 3 ) 057 { 058 throw new IllegalArgumentException ( "rowCount != 3" ); 059 } 060 061 if ( columnCount != 3 ) 062 { 063 throw new IllegalArgumentException ( "columnCount != 3" ); 064 } 065 } 066 067 public Matrix3x3Imp ( 068 final double v00, 069 final double v01, 070 final double v02, 071 final double v10, 072 final double v11, 073 final double v12, 074 final double v20, 075 final double v21, 076 final double v22 ) 077 //////////////////////////////////////////////////////////////////////// 078 { 079 super ( 3, 3 ); 080 081 set ( 0, 0, v00 ); 082 083 set ( 0, 1, v01 ); 084 085 set ( 0, 2, v02 ); 086 087 set ( 1, 0, v10 ); 088 089 set ( 1, 1, v11 ); 090 091 set ( 1, 2, v12 ); 092 093 set ( 2, 0, v20 ); 094 095 set ( 2, 1, v21 ); 096 097 set ( 2, 2, v22 ); 098 } 099 100 //////////////////////////////////////////////////////////////////////// 101 //////////////////////////////////////////////////////////////////////// 102 103 public Matrix3x3Mut multiply3x3 ( final Matrix3x3 matrix3x3 ) 104 //////////////////////////////////////////////////////////////////////// 105 { 106 return Matrix3x3Lib.multiply3x3 ( this, matrix3x3 ); 107 } 108 109 public double [ ] toEulerAngles ( ) 110 //////////////////////////////////////////////////////////////////////// 111 { 112 return Matrix3x3Lib.toEulerAngles ( this ); 113 } 114 115 public Matrix3x3Mut transpose3x3 ( ) 116 //////////////////////////////////////////////////////////////////////// 117 { 118 return Matrix3x3Lib.transpose3x3 ( this ); 119 } 120 121 //////////////////////////////////////////////////////////////////////// 122 //////////////////////////////////////////////////////////////////////// 123 }