Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

[800bc1]: src / boundaries.h Maximize Restore History

Download this file

boundaries.h    174 lines (137 with data), 3.5 kB

  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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
/***************************************************************************
panocanvas.h - description
-------------------
begin : Mon Jun 2 2003
copyright : (C) 2003 by Fabian Wenzel
email : f.wenzel@gmx.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef BOUNDARIES_H
#define BOUNDARIES_H
//invalid degree
#define INVALIDDEG 6000.0
class CAngleRange{
public:
CAngleRange() :
m_min(INVALIDDEG),
m_max(INVALIDDEG)
{
}
CAngleRange(const double &min, const double &max) :
m_min(min),
m_max(max)
{
}
bool inRange(const double &angle) const;
CAngleRange getBorders(const CAngleRange &innerborders) const;
bool validMin() const
{
return m_min != INVALIDDEG;
}
bool validMax() const
{
return m_max != INVALIDDEG;
}
bool validRange() const
{
return validMin() && validMax();
}
const double &getMin() const
{
return m_min;
}
const double &getMax() const
{
return m_max;
}
void setMin(const double &angle)
{
m_min = angle;
}
void setMax(const double &angle)
{
m_max = angle;
}
protected:
double m_min;
double m_max;
};
class CPanRange : public CAngleRange{
public:
CPanRange() : CAngleRange()
{
}
CPanRange(const double &min, const double &max ):
CAngleRange(min,max)
{
}
bool inRange(const double &angle) const;
CAngleRange getBorders(const CPanRange &innerrange) const;
bool isWrapped() const
{
return m_max < m_min;
}
};
class CBoundaries{
public:
CBoundaries(const CPanRange &pan, const CAngleRange &tilt, const CAngleRange &fov);
CBoundaries();
const CPanRange &getPans() const
{
return m_pans;
}
const CAngleRange &getTilts() const
{
return m_tilts;
}
const CAngleRange &getFovs() const
{
return m_fovs;
}
bool inTiltRange(const double &tilt) const
{
return m_tilts.inRange(tilt);
}
bool inPanRange (const double &pan ) const
{
return m_pans.inRange(pan);
}
void setPanmin(const double &panmin)
{
m_pans.setMin(panmin);
}
void setPanmax(const double &panmax)
{
m_pans.setMax(panmax);
}
void setTiltmin(const double &tiltmin)
{
m_tilts.setMin(tiltmin);
}
void setTiltmax(const double &tiltmax)
{
m_tilts.setMax(tiltmax);
}
void setFovmin(const double &fovmin)
{
m_fovs.setMin(fovmin);
}
void setFovmax(const double &fovmax)
{
m_fovs.setMax(fovmax);
}
void getPanBorders (const double &panmin, const double &panmax, double *bordermin, double *bordermax) const;
void getTiltBorders(const double &tiltmin, const double &tiltmax, double *bordermin, double *bordermax) const;
private:
CAngleRange m_tilts;
CPanRange m_pans;
CAngleRange m_fovs;
};
#endif