Stellarium  0.90.0
InterpolatedPosition.hpp
1 /*
2  * Stellarium Telescope Control Plug-in
3  *
4  * Copyright (C) 2006 Johannes Gajdosik
5  * Copyright (C) 2009-2010 Bogdan Marinov
6  *
7  * This module was originally written by Johannes Gajdosik in 2006
8  * as a core module of Stellarium. In 2009 it was significantly extended with
9  * GUI features and later split as an external plug-in module by Bogdan Marinov.
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License
13  * as published by the Free Software Foundation; either version 2
14  * of the License, or (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
24  */
25 
26 #ifndef _INTERPOLATED_POSITION_HPP_
27 #define _INTERPOLATED_POSITION_HPP_
28 
29 #include <stdint.h>
30 #ifndef INT64_MAX
31 #define INT64_MAX 0x7FFFFFFFFFFFFFFFLL
32 #endif
33 
34 #include "VecMath.hpp"
35 
38 struct Position
39 {
40  qint64 server_micros;
41  qint64 client_micros;
42  Vec3d pos;
43  int status;
44 };
45 
47 public:
50 
51  void add(Vec3d& position, qint64 clientTime, qint64 serverTime, int status = 0);
53  Vec3d get(qint64 time) const;
55  void reset();
56  bool isKnown() const {return (position_pointer->client_micros != INT64_MAX);}
57 
58 private:
59  Position positions[16];
60  Position *position_pointer;
61  Position *const end_position;
62 };
63 
64  #endif //_INTEPOLATED_POSITION_HPP_
A telescope&#39;s position at a given time.