dvm3_matrix.cc

00001 // dvm3_matrix.cc
00002 
00003 // File:    dvm3_matrix.cc
00004 // Author:  Terry Gaetz
00005 
00006 // --8<--8<--8<--8<--
00007 //
00008 // Copyright (C) 2006 Smithsonian Astrophysical Observatory
00009 //
00010 // This file is part of dvm3
00011 //
00012 // dvm3 is free software; you can redistribute it and/or
00013 // modify it under the terms of the GNU General Public License
00014 // as published by the Free Software Foundation; either version 2
00015 // of the License, or (at your option) any later version.
00016 //
00017 // dvm3 is distributed in the hope that it will be useful,
00018 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00019 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020 // GNU General Public License for more details.
00021 //
00022 // You should have received a copy of the GNU General Public License
00023 // along with this program; if not, write to the 
00024 //       Free Software Foundation, Inc. 
00025 //       51 Franklin Street, Fifth Floor
00026 //       Boston, MA  02110-1301, USA
00027 //
00028 // -->8-->8-->8-->8--
00029 
00030 #include <dvm3/dvm3_matrix.h>        // dvm3_Matrix
00031 
00032 //=========================================================================
00033 // orthonormalize a dvm3_DMatrix
00034 
00035 void dvm3_Matrix::
00036 orthonormalize()
00037 {
00038   // assumes we start with almost orthonormal rows.
00039 
00040   vm_V3Math<double>::cross(&data_.m_[ERow1], 
00041                            &data_.m_[ERow2], &data_.m_[ERow0]);
00042     //
00043     // m[ERow1] = m[ERow2] ^ m[ERow0]
00044 
00045   vm_V3Math<double>::cross(&data_.m_[ERow0], 
00046                            &data_.m_[ERow1], &data_.m_[ERow2]);
00047     //
00048     // m[ERow0] = m[ERow1] ^ m[ERow2]
00049 
00050   vm_V3Math<double>::unitize( &data_.m_[ERow0] );
00051     //
00052     // make m[ERow0] a unit vector
00053 
00054   vm_V3Math<double>::unitize( &data_.m_[ERow1] );
00055     //
00056     // make m[ERow1] a unit vector
00057 
00058   vm_V3Math<double>::unitize( &data_.m_[ERow2] );
00059     //
00060     // make m[ERow2] a unit vector
00061 
00062   // we now have an orthonormal triad.
00063 }
00064 
00065 

Generated on Tue Dec 2 15:44:47 2008 for dvm3 by  doxygen 1.5.6