1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
|
/////////////////////////////////////////////////////////////
// //
// Copyright (c) 2003-2017 by The University of Queensland //
// Centre for Geoscience Computing //
// http://earth.uq.edu.au/centre-geoscience-computing //
// //
// Primary Business: Brisbane, Queensland, Australia //
// Licensed under the Open Software License version 3.0 //
// http://www.apache.org/licenses/LICENSE-2.0 //
// //
/////////////////////////////////////////////////////////////
#ifndef __MATRIX3_H
#define __MATRIX3_H
#define DO_INLINE_MATRIX3 1
#if DO_INLINE_MATRIX3 >= 1
#define MATRIX3_INLINE inline
#else
#define MATRIX3_INLINE
#endif
// --- IO includes ---
#include <iostream>
using std::ostream;
//! exception class for Matrix3
class MatSingularError
{
public:
MATRIX3_INLINE MatSingularError()
{
};
};
class Vec3 ;
/*!
\class Matrix3
\brief 3x3 Matrix
\author Steffen Abe
$Revision$
$Date$
*/
class Matrix3
{
private:
double m[3][3];
public:
MATRIX3_INLINE Matrix3();
MATRIX3_INLINE Matrix3(const Vec3&, const Vec3&,const Vec3&);
MATRIX3_INLINE Matrix3(const double[3][3]);
MATRIX3_INLINE Matrix3(const Matrix3&);
MATRIX3_INLINE virtual ~Matrix3();
MATRIX3_INLINE double det();
Vec3 solve(const Vec3&) const;
Vec3 solve_homogeneous() const;
void invert(); //!< in-situ inversion
MATRIX3_INLINE Matrix3 inv(); //!< return inverse;
MATRIX3_INLINE void transpose(); //!< transpose in situ
MATRIX3_INLINE Matrix3 trans() const; //!< return transposed
MATRIX3_INLINE Vec3 operator *(const Vec3&) const;
MATRIX3_INLINE Matrix3 operator *(double) const;
MATRIX3_INLINE Matrix3 operator /(double) const;
MATRIX3_INLINE Matrix3 operator *(const Matrix3&) const;
MATRIX3_INLINE Matrix3& operator +=(const Matrix3&);
MATRIX3_INLINE Matrix3 operator +(const Matrix3&)const;
MATRIX3_INLINE Matrix3 operator -(const Matrix3&)const;
MATRIX3_INLINE bool operator==(const Matrix3&)const;
MATRIX3_INLINE Matrix3 &operator=(const Matrix3&);
MATRIX3_INLINE double trace() const;
MATRIX3_INLINE double norm() const;
MATRIX3_INLINE double operator()(int i, int j) const {return m[i][j];}
MATRIX3_INLINE double& operator()(int i, int j){return m[i][j];}
MATRIX3_INLINE friend Matrix3 operator*(double,const Matrix3&);
//!< generate matrix from vector
MATRIX3_INLINE friend Matrix3 star(const Vec3&);
//!< generate unit matrix
MATRIX3_INLINE static Matrix3 Unit();
//!< eigenvectors, eigenvalues
void eigen(Vec3&,Vec3&,Vec3&,double&,double&,double&);
// output
MATRIX3_INLINE friend ostream& operator<<(ostream&,const Matrix3&);
};
#if DO_INLINE_MATRIX3 >= 1
#include "Foundation/Matrix3.hpp"
#endif
#endif //__MATRIX3_H
|