core
lib
GNSSCore
AngleReduced.cpp
Go to the documentation of this file.
1
//==============================================================================
2
//
3
// This file is part of GNSSTk, the ARL:UT GNSS Toolkit.
4
//
5
// The GNSSTk is free software; you can redistribute it and/or modify
6
// it under the terms of the GNU Lesser General Public License as published
7
// by the Free Software Foundation; either version 3.0 of the License, or
8
// any later version.
9
//
10
// The GNSSTk 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 Lesser General Public License for more details.
14
//
15
// You should have received a copy of the GNU Lesser General Public
16
// License along with GNSSTk; if not, write to the Free Software Foundation,
17
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
18
//
19
// This software was developed by Applied Research Laboratories at the
20
// University of Texas at Austin.
21
// Copyright 2004-2022, The Board of Regents of The University of Texas System
22
//
23
//==============================================================================
24
25
//==============================================================================
26
//
27
// This software was developed by Applied Research Laboratories at the
28
// University of Texas at Austin, under contract to an agency or agencies
29
// within the U.S. Department of Defense. The U.S. Government retains all
30
// rights to use, duplicate, distribute, disclose, or release this software.
31
//
32
// Pursuant to DoD Directive 523024
33
//
34
// DISTRIBUTION STATEMENT A: This software has been approved for public
35
// release, distribution is unlimited.
36
//
37
//==============================================================================
38
39
#include <math.h>
40
#include "
AngleReduced.hpp
"
41
#include "
GNSSconstants.hpp
"
42
43
namespace
gnsstk
44
{
45
AngleReduced ::
46
AngleReduced
()
47
: sine(
std
::numeric_limits<double>::quiet_NaN()),
48
cosine(
std
::numeric_limits<double>::quiet_NaN())
49
{}
50
51
52
void
AngleReduced ::
53
setValue
(
double
v,
AngleType
t)
54
{
55
double
radians;
56
switch
(t)
57
{
58
case
AngleType::Rad
:
59
sine
=
::sin
(v);
60
cosine
=
::cos
(v);
61
break
;
62
case
AngleType::Deg
:
63
radians = v *
DEG2RAD
;
64
sine
=
::sin
(radians);
65
cosine
=
::cos
(radians);
66
break
;
67
case
AngleType::SemiCircle
:
68
radians = v *
PI
;
69
sine
=
::sin
(radians);
70
cosine
=
::cos
(radians);
71
break
;
72
case
AngleType::Sin
:
73
sine
= v;
74
cosine
= ::sqrt(1-
sine
*
sine
);
75
break
;
76
case
AngleType::Cos
:
77
cosine
= v;
78
sine
= ::sqrt(1-
cosine
*
cosine
);
79
break
;
80
default
:
81
GNSSTK_THROW
(
Exception
(
"Invalid type in setValue"
));
82
break
;
83
}
84
}
85
}
gnsstk::AngleType::SemiCircle
@ SemiCircle
Value is in semi-circles (aka half-cycles).
gnsstk::DEG2RAD
const double DEG2RAD
Multiply degrees by DEG2RAD to get radians.
Definition:
GNSSconstants.hpp:64
gnsstk::AngleReduced::sin
double sin() const
Get the sine of this angle.
Definition:
AngleReduced.hpp:94
gnsstk::PI
const double PI
GPS value of PI; also specified by GAL.
Definition:
GNSSconstants.hpp:62
GNSSconstants.hpp
gnsstk
For Sinex::InputHistory.
Definition:
BasicFramework.cpp:50
gnsstk::AngleReduced::setValue
void setValue(double v, AngleType t)
Definition:
AngleReduced.cpp:53
gnsstk::Exception
Definition:
Exception.hpp:151
gnsstk::AngleType::Rad
@ Rad
Value is in radians.
gnsstk::AngleType::Sin
@ Sin
Value is the sine of the angle.
gnsstk::AngleType::Cos
@ Cos
Value is the cosine of the angle.
gnsstk::AngleReduced::cos
double cos() const
Get the cosine of this angle.
Definition:
AngleReduced.hpp:98
gnsstk::AngleReduced::AngleReduced
AngleReduced()
Initialize all data to NaN.
Definition:
AngleReduced.cpp:46
gnsstk::AngleType::Deg
@ Deg
Value is in degrees.
gnsstk::AngleType
AngleType
Definition:
AngleType.hpp:54
gnsstk::AngleReduced::sine
double sine
The sine of the angle.
Definition:
AngleReduced.hpp:105
gnsstk::AngleReduced::cosine
double cosine
The cosine of the angle.
Definition:
AngleReduced.hpp:106
std
Definition:
Angle.hpp:142
GNSSTK_THROW
#define GNSSTK_THROW(exc)
Definition:
Exception.hpp:366
AngleReduced.hpp
gnsstk
Author(s):
autogenerated on Wed Oct 25 2023 02:40:38