KDIS  2-8-x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
EulerAngles.h
Go to the documentation of this file.
1 /*********************************************************************
2 Copyright 2013 Karl Jones
3 All rights reserved.
4 
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
7 
8 1. Redistributions of source code must retain the above copyright notice, this
9  list of conditions and the following disclaimer.
10 2. Redistributions in binary form must reproduce the above copyright notice,
11  this list of conditions and the following disclaimer in the documentation
12  and/or other materials provided with the distribution.
13 
14 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
15 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
18 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
21 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 
25 For Further Information Please Contact me at
26 Karljj1@yahoo.com
27 http://p.sf.net/kdis/UserGuide
28 *********************************************************************/
29 
30 /********************************************************************
31  class: EulerAngles
32  created: 18/0/2008
33  author: Karl Jones
34 
35  purpose: Stores a vector
36  size: 96 bits / 12 octets
37 *********************************************************************/
38 
39 #pragma once
40 
41 #include "./DataTypeBase.h"
42 
43 namespace KDIS {
44 namespace DATA_TYPE {
45 
47 {
48 protected:
49 
51 
53 
55 
56 public:
57 
58  static const KUINT16 EULER_ANGLES_SIZE = 12;
59 
60  EulerAngles();
61 
62  // In Radians
63  EulerAngles( KFLOAT32 Psi, KFLOAT32 Theta, KFLOAT32 Phi );
64 
65  EulerAngles( KDataStream & stream ) throw( KException );
66 
67  virtual ~EulerAngles();
68 
69  //************************************
70  // FullName: KDIS::DATA_TYPE::EulerAngles::SetPsi
71  // KDIS::DATA_TYPE::EulerAngles::GetPsi
72  //!Description: Radians / Degrees
73  // Parameter: KFLOAT32 Psi
74  //************************************
75  void SetPsiInRadians( KFLOAT32 Psi );
76  KFLOAT32 GetPsiInRadians() const;
77  void SetPsiInDegrees( KFLOAT32 Psi );
78  KFLOAT32 GetPsiInDegrees() const;
79 
80  //************************************
81  // FullName: KDIS::DATA_TYPE::EulerAngles::SetTheta
82  // KDIS::DATA_TYPE::EulerAngles::GetTheta
83  //!Description: Radians / Degrees
84  // Parameter: KFLOAT32 Theta
85  //************************************
86  void SetThetaInRadians( KFLOAT32 Theta );
87  KFLOAT32 GetThetaInRadians() const;
88  void SetThetaInDegrees( KFLOAT32 Theta );
89  KFLOAT32 GetThetaInDegrees() const;
90 
91  //************************************
92  // FullName: KDIS::DATA_TYPE::EulerAngles::SetPhi
93  // KDIS::DATA_TYPE::EulerAngles::GetPhi
94  //!Description: Radians / Degrees
95  // Parameter: KFLOAT32 Phi
96  //************************************
97  void SetPhiInRadians( KFLOAT32 Phi );
98  KFLOAT32 GetPhiInRadians() const;
99  void SetPhiInDegrees( KFLOAT32 Phi );
100  KFLOAT32 GetPhiInDegrees() const;
101 
102  //************************************
103  // FullName: KDIS::DATA_TYPE::EulerAngles::GetAsString
104  //!Description: Returns a string representation
105  //************************************
106  virtual KString GetAsString() const;
107 
108  //************************************
109  // FullName: KDIS::DATA_TYPE::EulerAngles::Decode
110  //!Description: Convert From Network Data.
111  // Parameter: KDataStream & stream
112  //************************************
113  virtual void Decode( KDataStream & stream ) throw( KException );
114 
115  //************************************
116  // FullName: KDIS::DATA_TYPE::EulerAngles::Encode
117  //!Description: Convert To Network Data.
118  // Parameter: KDataStream & stream
119  //************************************
120  virtual KDataStream Encode() const;
121  virtual void Encode( KDataStream & stream ) const;
122 
123  KBOOL operator == ( const EulerAngles & Value ) const;
124  KBOOL operator != ( const EulerAngles & Value ) const;
125  EulerAngles operator * ( const EulerAngles & Value ) const;
126  EulerAngles operator * ( KFLOAT64 Value ) const ;
127  EulerAngles operator + ( const EulerAngles & Value ) const;
128  EulerAngles & operator += ( const EulerAngles & Value );
129  EulerAngles operator - ( const EulerAngles & Value ) const;
130  EulerAngles & operator -= ( const EulerAngles & Value );
131 
132  // Valid values 0 - Psi, 1 - Theta, 2 - Phi. throws OUT_OF_BOUNDS exception for any other value.
133  KFLOAT32 & operator[] ( KUINT16 i ) throw( KException );
134  const KFLOAT32 & operator[] ( KUINT16 i ) const throw( KException );
135 };
136 
137 } // END namespace DATA_TYPES
138 } // END namespace KDIS
139 
unsigned short int KUINT16
Definition: KDefines.h:101
KFLOAT32 m_f32Psi
Definition: EulerAngles.h:50
float KFLOAT32
Definition: KDefines.h:113
Definition: KDefines.h:182
Definition: KDataStream.h:48
Definition: DataTypeBase.h:49
bool KBOOL
Definition: KDefines.h:119
Definition: EulerAngles.h:46
std::string KString
Definition: KDefines.h:116
double KFLOAT64
Definition: KDefines.h:114
KFLOAT32 m_f32Theta
Definition: EulerAngles.h:52
KFLOAT32 m_f32Phi
Definition: EulerAngles.h:54
#define KDIS_EXPORT
Definition: KDefines.h:82