// $Source: /usr/local/SimSoft/SoftShop/XMath/HMatrx2D/HMatrx2D.h,v $
// $Revision: 1.20 $
// $Author: baum $
// $Date: 2001/11/29 15:52:25 $
//
// Login name of the user who locked the revision
// $Locker:  $
// Tag name used to checkout the file
// $Name: Release-20 $
// State assigned to revision
// $State: Exp $
//
//
// $Log: HMatrx2D.h,v $
// Revision 1.20  2001/11/29 15:52:25  baum
// -In Kalender.cpp und Kalender.h Handsteuerung eingebaut
//

#include "Angle.h"
#include "Vec2D.h"

#ifndef _HMATRX2D_H
#define _HMATRX2D_H	1

#ifdef _HMATRX2D_CPP
#  undef _impexp
#  define _impexp __declspec(dllexport)
#elif defined BUILD_XMATH_DLL
#  undef _impexp
#  define _impexp
#else
#  undef _impexp
#  define _impexp __declspec(dllimport)
#endif

#if defined __GNUC__ || defined __hpux
#  undef _impexp
#  define _impexp
#endif

// Please note, that following common mathematical conventions
// the XMath-subsystem defines Vectors to be column vectors.
// All Vector- and Matrix-operations are implemented suitably.

#define HDim2D	3

//==================================================================
//		Class-Header
//		for class HMatrx2D
//==================================================================

class _impexp HMatrx2D {
  public:
    //Konstruktoren
    HMatrx2D ();
    HMatrx2D (const HMatrx2D&);
    HMatrx2D (double, double, double,
              double, double, double,
              double, double, double);

    //Destruktor
    ~HMatrx2D ();

    //Zuweisungsoperator
    HMatrx2D& operator = (const HMatrx2D&);

    //Vergleichsoperatoren
    bool operator == (const HMatrx2D&) const;
    bool operator != (const HMatrx2D&) const;

    //arithmetische Operatoren
    HMatrx2D  operator +  (const HMatrx2D&) const;
    HMatrx2D& operator += (const HMatrx2D&);
    HMatrx2D  operator -  (const HMatrx2D&) const;
    HMatrx2D& operator -= (const HMatrx2D&);
    HMatrx2D  operator *  (const double&)   const;
    HMatrx2D& operator *= (const double&);
    HMatrx2D  operator *  (const HMatrx2D&) const;
    HMatrx2D& operator *= (const HMatrx2D&);
    Vec2D     operator *  (const Vec2D&)    const;

    //Wertrueckgabe
    double operator () (unsigned row, unsigned col) const;

    //Transponierte Matrix
    HMatrx2D trans () const;

    //Inverse Matrix
    HMatrx2D inv () const;

    //Determinante
    double det () const;

    //Print-Funktion
    ostream& print (ostream&) const;

  private:
    //data members
    double ObjVal [HDim2D] [HDim2D];

    //Adjunkte
    double adj (unsigned, unsigned) const;

  //friends
  friend Vec2D  Vec2D::operator *  (const HMatrx2D& m) const;
  friend Vec2D& Vec2D::operator *= (const HMatrx2D& m);
  friend class HMatrx3D;

}; // class HMatrx2D

//==================================================================
//		Funktionsvereinbarungen
//		fuer globale Funktionen aus HMatrx2D.h
//==================================================================

// Einheitsmatrix
extern const HMatrx2D _impexp EM2D;


_impexp HMatrx2D moveHMatrx2D (const Vec2D&);

_impexp HMatrx2D scaleHMatrx2D (const Vec2D&);

_impexp HMatrx2D rotHMatrx2D (const Angle&);


inline ostream& operator << (ostream& o, const HMatrx2D& m) {
  return m.print (o);
}

#endif
