// $Source: /usr/local/SimSoft/SoftShop/XMath/Angle/Angle.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: Angle.h,v $
// Revision 1.20  2001/11/29 15:52:25  baum
// -In Kalender.cpp und Kalender.h Handsteuerung eingebaut
//

#ifndef _ANGLE_H
#define _ANGLE_H

#include <math.h>
#include <iostream.h>

#ifdef _ANGLE_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

#define ANGLE_DIGITS  4

class _impexp Angle
  {
  public:
    // constructors
    Angle (double val = 0.0, int is_rad = 0);
    Angle (const Angle&);

    // destructor
    ~Angle ();

    // assignment operator
    Angle& operator = (const Angle&);

    // equality operators
    bool operator == (const Angle&) const;
    bool operator != (const Angle&) const;
    bool isMultipleOf (const Angle&) const;

    // NOT und VOID*-Operatoren
    bool operator ! () const;
    operator void* () const;


    // relational operators
    bool operator <  (const Angle&) const;
    bool operator <= (const Angle&) const;
    bool operator >  (const Angle&) const;
    bool operator >= (const Angle&) const;

    // arithmetic operators
    Angle  operator +  (const Angle&) const;
    Angle  operator -  (const Angle&) const;

    Angle& operator += (const Angle&);
    Angle& operator -= (const Angle&);

    // inversion operator (unary -)
    Angle operator - () const;

    // converting an Angle
    double deg () const;	// returns degrees (0 ... 360)
    double rad () const;	// returns radians (0 ... 2*PI)

    //IO-Funktionen
    istream& read (istream&);
    ostream& print (ostream&) const;
    void stream (ostream&, unsigned spaces = 0) const;

    // trigonometric functions
    double sin () const;
    double cos () const;
    double tan () const;
    double cot () const;

  private:
    Angle (int val, char*);
    Angle& clip ();

    // data members
    int ObjVal;

    static const int ClassOff360;
    static const double ClassOffset;
    static const double PIdiv180;
  };	// class Angle

inline istream& operator >> (istream& i, Angle& a) {
  return a.read (i);
}

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

#endif	// !defined _ANGLE_H
