/[PAMELA software]/yodaUtility/sgp4/cVector.cpp
ViewVC logotype

Contents of /yodaUtility/sgp4/cVector.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (show annotations) (download) (vendor branch)
Sun Apr 30 11:08:15 2006 UTC (18 years, 7 months ago) by kusanagi
Branch: MAIN
CVS Tags: yodaUtility2_0/00, yodaUtility1_0/00, yodaUtility2_2/00, yodaUtility2_1/00, HEAD
Changes since 1.1: +0 -0 lines
Various utilities for the yoda environment and its related softwares.
YFile 	   	- Inheriths from TFile     - Add custom features to a TFile object.
YException 	- Inheriths from exception - YODA specific Exceptions.
YMcmd	   	- Decoder for the Mcmd packets.
YSQLConnection 	- Singletn class for DB connections.
yodaUtility     - Various functions.
sgp4		- C++ NORAD SGP4/SDP4 Implementation - Developed by Michael F. Henry.

1 //
2 // cVector.cpp
3 //
4 // Copyright (c) 2001-2003 Michael F. Henry
5 //
6 #include "stdafx.h"
7
8 #include "math.h"
9 #include "cVector.h"
10
11 //*****************************************************************************
12 // Multiply each component in the vector by 'factor'.
13 //*****************************************************************************
14 void cVector::Mul(double factor)
15 {
16 m_x *= factor;
17 m_y *= factor;
18 m_z *= factor;
19 m_w *= fabs(factor);
20 }
21
22 //*****************************************************************************
23 // Subtract a vector from this one.
24 //*****************************************************************************
25 void cVector::Sub(const cVector& vec)
26 {
27 m_x -= vec.m_x;
28 m_y -= vec.m_y;
29 m_z -= vec.m_z;
30 m_w -= vec.m_w;
31 }
32
33 //*****************************************************************************
34 // Calculate the angle between this vector and another
35 //*****************************************************************************
36 double cVector::Angle(const cVector& vec) const
37 {
38 return acos(Dot(vec) / (Magnitude() * vec.Magnitude()));
39 }
40
41 //*****************************************************************************
42 //
43 //*****************************************************************************
44 double cVector::Magnitude() const
45 {
46 return sqrt((m_x * m_x) +
47 (m_y * m_y) +
48 (m_z * m_z));
49 }
50
51 //*****************************************************************************
52 // Return the dot product
53 //*****************************************************************************
54 double cVector::Dot(const cVector& vec) const
55 {
56 return (m_x * vec.m_x) +
57 (m_y * vec.m_y) +
58 (m_z * vec.m_z);
59 }

  ViewVC Help
Powered by ViewVC 1.1.23