Fixed bug in arcToHgt where it wrote to end of file instead of last row of file
[tecorrec.git] / geo / tcObserver.h
blobf694582c0155ec07374b4102416636513a64597b
1 /***************************************************************************
2 * This file is part of Tecorrec. *
3 * Copyright 2008 James Hogan <james@albanarts.com> *
4 * *
5 * Tecorrec is free software: you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation, either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * Tecorrec is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with Tecorrec. If not, write to the Free Software Foundation, *
17 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
18 ***************************************************************************/
20 #ifndef _tcObserver_h_
21 #define _tcObserver_h_
23 /**
24 * @file tcObserver.h
25 * @brief Viewing information for an observer.
28 #include "tcGeo.h"
30 /// Viewing information for an observer.
31 class tcObserver
33 public:
36 * Constructors + destructor
39 /// Primary constructor.
40 tcObserver();
42 /// Destructor.
43 virtual ~tcObserver();
46 * Main interface
49 /// Set up the OpenGL projection matrix for this observer.
50 void setupProjection(double aspect) const;
52 /// Set up the OpenGL modelview matrix for this observer.
53 void setupModelView() const;
56 * Mutators
59 /// Adjust the focus directly.
60 void setFocus(const tcGeo& focus, double altitude);
62 /// Adjust the focus altitude.
63 void setFocusAltitude(double altitude);
65 /// Make a local transformation of the focus.
66 void moveFocusRelative(double dx, double dy);
68 /// Adjust the range exponentially.
69 void adjustRange(double x);
71 /// Adjust the azimuth in radians.
72 void adjustAzimuth(double daz);
74 /// Adjust the elevation in radians.
75 void adjustElevation(double del);
77 /// Change the viewing angle.
78 void setView(const tcGeo& view);
81 * Accessors
84 /// Get the current focus position.
85 tcGeo focus() const;
87 /// Get the current altitude at the focus.
88 double focusAltitude() const;
90 /// Get the current range from the focus.
91 double range() const;
93 /// Get the position of the actual observer.
94 maths::Vector<3,double> position() const;
96 /// Get a ray into the scene from a point on the screen.
97 maths::Vector<3,double> ray(const maths::Vector<2,double>& pos, double aspect);
99 private:
102 * Variables
105 /// Geographical position of focus.
106 tcGeo m_focus;
108 /// Altitude of focus.
109 double m_focusAltitude;
111 /// Observation direction relative to focus.
112 tcGeo m_view;
114 /// Range of camera.
115 double m_range;
118 #endif