Omnidome
Fulldome Mapping Software Toolkit
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Angle.h
Go to the documentation of this file.
1 /* Copyright (c) 2014-2016 "Omnidome" by cr8tr
2  * Dome Mapping Projection Software (http://omnido.me).
3  * Omnidome was created by Michael Winkelmann aka Wilston Oreo (@WilstonOreo)
4  *
5  * This file is part of Omnidome.
6  *
7  * Omnidome is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU Affero General Public License as
9  * published by the Free Software Foundation, either version 3 of the
10  * License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU Affero General Public License for more details.
16  * You should have received a copy of the GNU Affero General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef OMNI_GEOMETRY_ANGLE_H_
21 #define OMNI_GEOMETRY_ANGLE_H_
22 
23 #include <QtGlobal>
24 
25 namespace omni {
26  namespace geometry {
27  /// Struct for representing an angle (stored in degrees internally)
28  struct Angle
29  {
30  /// Default constructor
31  Angle();
32 
33  /// Constructor from value
34  Angle(qreal _angle);
35 
36  /// Set angle by given degrees
37  void setDegrees(qreal _angle);
38 
39  /// Set angle by radians
40  void setRadians(qreal _angle);
41 
42  /// Return degrees
43  qreal degrees() const;
44 
45  /// Returns radians
46  qreal radians() const;
47 
48  /// Constructs from degrees
49  static Angle fromDeg(qreal _angle);
50 
51  /// Constructs angle from radians
52  static Angle fromRad(qreal _angle);
53 
54  /// Increment angle by another
55  Angle const& operator+=(Angle const&);
56 
57  /// Decrement angle by another
58  Angle const& operator-=(Angle const&);
59 
60  /// Test for equality
61  friend bool operator==(Angle const&,
62  Angle const&);
63 
64  private:
65  qreal angle_;
66  };
67  }
68  using geometry::Angle;
69 }
70 
71 QDataStream& operator<<(QDataStream& _os,
72  const omni::geometry::Angle& _angle);
73 QDataStream& operator>>(QDataStream& _is,
74  omni::geometry::Angle& _angle);
75 
76 #endif /* OMNI_GEOMETRY_ANGLE_H_ */
void setDegrees(qreal _angle)
Set angle by given degrees.
Definition: Angle.cpp:37
Angle const & operator-=(Angle const &)
Decrement angle by another.
Definition: Angle.cpp:81
qreal degrees() const
Return degrees.
Definition: Angle.cpp:49
void setRadians(qreal _angle)
Set angle by radians.
Definition: Angle.cpp:43
Angle const & operator+=(Angle const &)
Increment angle by another.
Definition: Angle.cpp:75
QDataStream & operator<<(QDataStream &_os, const omni::geometry::Angle &_angle)
Definition: Angle.cpp:94
QDataStream & operator>>(QDataStream &_is, omni::geometry::Angle &_angle)
Definition: Angle.cpp:100
static Angle fromRad(qreal _angle)
Constructs angle from radians.
Definition: Angle.cpp:67
friend bool operator==(Angle const &, Angle const &)
Test for equality.
Definition: Angle.cpp:87
static Angle fromDeg(qreal _angle)
Constructs from degrees.
Definition: Angle.cpp:61
qreal angle_
Definition: Angle.h:65
Struct for representing an angle (stored in degrees internally)
Definition: Angle.h:28
qreal radians() const
Returns radians.
Definition: Angle.cpp:55
Angle()
Default constructor.
Definition: Angle.cpp:28