1 #ifndef _vec2list_h
2 #define _vec2list_h
3 
4 #ifndef _vec2_h
5 #	include "vec2.h"
6 #endif
7 
8 //
9 // -------------------------------------------------------------------------
10 // class Vec2 : Vektorklasse, die einfach die komplexen Zahlen erweitert
11 // -------------------------------------------------------------------------
12 //
13 
14 class Vec2List {
15 	private:
16 		Vec2	*v;
17 		int	len;
18 		int	alloc_len;
19 
20 	public:
21 		Vec2List( int len=2 );
22 		Vec2List( const Vec2List &vl );
23 		Vec2List( const Vec2List &vl, const class Mat2 &m );
~Vec2List()24 		~Vec2List()											{ if (v)		delete [] v; }
25 
26 		void TurnLeft();
27 		void TurnRight();
28 		void TurnAngleRad( const Real &angle );
TurnAngleDeg(const Real & angle)29 		void TurnAngleDeg( const Real &angle ) { TurnAngleRad(angle/Real(180/M_PI)); }
30 
31 		const Vec2List& operator=(const Vec2List &v);
32 
Len()33 		int Len() const									{ return len; }
34 		const Vec2 &operator[](int i) const			{ return v[i]; }
operator()35 		const Vec2 &operator()(int i) const			{ return v[(i+len)%len]; }
36 
37 		const Vec2List &SetAt( int i, const Vec2 &z );
38 		const Vec2List &AddAt( int i, const Vec2 &z );
39 		const Vec2List &Del( int i );
40 		const Vec2List &DelRange( int i, int j, int *erg );
41 
42 		void GetExtent( Vec2 *tl, Vec2 *br ) const;
43 
44 	// Binary Operator Functions
45 
46 		inline Vec2List operator+(const Vec2&) const;
47 		inline Vec2List operator-(const Vec2&) const;
48 
49 #ifndef __TURBOC__
50 		friend inline Vec2List operator*(const Real&, const Vec2List&);
51 		friend int operator==(const Vec2List&, const Vec2List&);
52 		friend inline int operator!=(const Vec2List&, const Vec2List&);
53 #else
54 		friend Vec2List operator*(const Real&, const Vec2List&);
55 		friend extern int operator==(const Vec2List&, const Vec2List&);
56 		friend int operator!=(const Vec2List&, const Vec2List&);
57 #endif
58 
59 		inline Vec2List operator*(const Real&) const;
60 		inline Vec2List operator/(const Real&) const;
61 
62 		const Vec2List& operator+=(const Vec2&);
63 		const Vec2List& operator-=(const Vec2&);
64 		const Vec2List& operator*=(const Real&);
65 		const Vec2List& operator/=(const Real&);
66 		const Vec2List& operator|=(const Vec2&);
67 
68 		const Vec2List& operator*=(const class Mat2&);
69 
70 		inline Vec2List operator+() const;
71 		inline Vec2List operator-() const;
72 };
73 
74 inline Vec2List Vec2List::operator+() const
75 {
76 	return *this;
77 }
78 
79 inline Vec2List Vec2List::operator-() const
80 {
81 	Vec2List help(*this);
82 	return help*=-1;
83 }
84 
85 
86 // Definitions of compound-assignment operator member functions
87 
88 inline Vec2List Vec2List::operator+(const Vec2 &z) const
89 {
90 		Vec2List help(*this);
91 		return help-=z;
92 }
93 inline Vec2List Vec2List::operator-(const Vec2 &z) const
94 {
95 		Vec2List help(*this);
96 		return help-=z;
97 }
98 inline Vec2List Vec2List::operator*(const Real& val2) const
99 {
100 		Vec2List help(*this);
101 		return help*=val2;
102 }
103 inline Vec2List operator*(const Real& val, const Vec2List& z2)
104 {
105 		Vec2List	help(z2);
106 		return help*=val;
107 }
108 
109 inline Vec2List Vec2List::operator/(const Real& val) const
110 {
111 		Vec2List	help(*this);
112 		return help/=val;
113 }
114 
115 extern int operator==(const Vec2List& z1, const Vec2List& z2);
116 
117 inline int operator!=(const Vec2List& z1, const Vec2List& z2)
118 {
119 		  return !(z1==z2);
120 }
121 
122 #endif
123 
124