ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/branches/new_design/OOPSE-4/src/math/SquareMatrix3.hpp
(Generate patch)

Comparing:
trunk/OOPSE-4/src/math/SquareMatrix3.hpp (file contents), Revision 1616 by tim, Wed Oct 20 18:07:08 2004 UTC vs.
branches/new_design/OOPSE-4/src/math/SquareMatrix3.hpp (file contents), Revision 1804 by tim, Tue Nov 30 19:58:25 2004 UTC

# Line 41 | Line 41 | namespace oopse {
41      template<typename Real>
42      class SquareMatrix3 : public SquareMatrix<Real, 3> {
43          public:
44 +
45 +            typedef Real ElemType;
46 +            typedef Real* ElemPoinerType;
47              
48              /** default constructor */
49              SquareMatrix3() : SquareMatrix<Real, 3>() {
50              }
51 +
52 +            /** Constructs and initializes every element of this matrix to a scalar */
53 +            SquareMatrix3(Real s) : SquareMatrix<Real,3>(s){
54 +            }
55 +
56 +            /** Constructs and initializes from an array */
57 +            SquareMatrix3(Real* array) : SquareMatrix<Real,3>(array){
58 +            }
59 +
60  
61              /** copy  constructor */
62              SquareMatrix3(const SquareMatrix<Real, 3>& m)  : SquareMatrix<Real, 3>(m) {
63              }
64 <
64 >            
65              SquareMatrix3( const Vector3<Real>& eulerAngles) {
66                  setupRotMat(eulerAngles);
67              }
# Line 254 | Line 266 | namespace oopse {
266               * @note since simple algorithm can be applied to inverse the 3 by 3 matrix, we hide the
267               * implementation of inverse in SquareMatrix class
268               */
269 <            SquareMatrix3<Real>  inverse() {
269 >            SquareMatrix3<Real>  inverse() const {
270                  SquareMatrix3<Real> m;
271                  double det = determinant();
272                  if (fabs(det) <= oopse::epsilon) {
# Line 424 | Line 436 | namespace oopse {
436          v = v.transpose();
437          return ;
438      }
439 +
440 +    /**
441 +    * Return the multiplication of two matrixes  (m1 * m2).
442 +    * @return the multiplication of two matrixes
443 +    * @param m1 the first matrix
444 +    * @param m2 the second matrix
445 +    */
446 +    template<typename Real>
447 +    inline SquareMatrix3<Real> operator *(const SquareMatrix3<Real>& m1, const SquareMatrix3<Real>& m2) {
448 +        SquareMatrix3<Real> result;
449 +
450 +            for (unsigned int i = 0; i < 3; i++)
451 +                for (unsigned int j = 0; j < 3; j++)
452 +                    for (unsigned int k = 0; k < 3; k++)
453 +                        result(i, j)  += m1(i, k) * m2(k, j);                
454 +
455 +        return result;
456 +    }
457 +
458 +    template<typename Real>
459 +    inline SquareMatrix3<Real> outProduct(const Vector3<Real>& v1, const Vector3<Real>& v2) {
460 +        SquareMatrix3<Real> result;
461 +
462 +            for (unsigned int i = 0; i < 3; i++) {
463 +                for (unsigned int j = 0; j < 3; j++) {
464 +                        result(i, j)  = v1[i] * v2[j];                
465 +                }
466 +            }
467 +            
468 +        return result;        
469 +    }
470 +
471 +    
472      typedef SquareMatrix3<double> Mat3x3d;
473      typedef SquareMatrix3<double> RotMat3x3d;
474  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines