Planetary Orbital Evolution due to Tides
Orbital evolution of two objects experiencing tides
ZoneOrientation.cpp
1 #define BUILDING_LIBRARY
2 #include "ZoneOrientation.h"
3 
4 namespace Evolve {
5 
6  Eigen::Vector3d zone_to_zone_transform(const ZoneOrientation &from_zone,
7  const ZoneOrientation &to_zone,
8  const Eigen::Vector3d &vector,
9  Dissipation::QuantityEntry deriv,
10  bool with_respect_to_from)
11  {
12  assert(deriv == Dissipation::NO_DERIV
13  ||
15  ||
16  deriv == Dissipation::PERIAPSIS);
17 
18  double cos_dw=std::cos(to_zone.periapsis()-from_zone.periapsis()),
19  sin_dw=std::sin(to_zone.periapsis()-from_zone.periapsis()),
20  sin_from=std::sin(from_zone.inclination()),
21  cos_from=std::cos(from_zone.inclination()),
22  sin_to=std::sin(to_zone.inclination()),
23  cos_to=std::cos(to_zone.inclination()),
24  sin_sin, cos_cos, sin_cos, cos_sin;
25  if(deriv==Dissipation::PERIAPSIS) {
26  double buffer=cos_dw;
27  if(with_respect_to_from) {cos_dw=sin_dw; sin_dw=-buffer;}
28  else {cos_dw=-sin_dw; sin_dw=buffer;}
29  }
30  if(deriv==Dissipation::INCLINATION) {
31  if(with_respect_to_from) {
32  sin_sin=sin_to*cos_from;
33  cos_cos=-cos_to*sin_from;
34  sin_cos=-sin_to*sin_from;
35  cos_sin=cos_to*cos_from;
36  } else {
37  sin_sin=cos_to*sin_from;
38  cos_cos=-sin_to*cos_from;
39  sin_cos=cos_to*cos_from;
40  cos_sin=-sin_to*sin_from;
41  }
42  } else {
43  sin_sin=sin_to*sin_from;
44  cos_cos=cos_to*cos_from;
45  sin_cos=sin_to*cos_from;
46  cos_sin=cos_to*sin_from;
47  }
48  return Eigen::Vector3d(
49  (sin_sin + cos_cos * cos_dw) * vector[0]
50  -
51  cos_to * sin_dw * vector[1]
52  +
53  (sin_cos - cos_sin * cos_dw) * vector[2],
54 
55 
56  cos_from * sin_dw * vector[0]
57  +
58  cos_dw * vector[1]
59  -
60  sin_from * sin_dw * vector[2],
61 
62  (cos_sin - sin_cos * cos_dw) * vector[0]
63  +
64  sin_to * sin_dw * vector[1]
65  +
66  (cos_cos + sin_sin * cos_dw) * vector[2]
67  );
68  }
69 
70  /*
71  void transform_zone_orientation(const ZoneOrientation &zone,
72  const ZoneOrientation &reference, double &inclination,
73  double &periapsis)
74  {
75  Eigen::Vector3d zone_z_dir=zone_to_zone_transform(zone,
76  reference, Eigen::Vector3d(0, 0, 1));
77  inclination=std::atan2(-zone_z_dir[0], zone_z_dir[2]);
78  if(zone_z_dir[1]==0 && zone_z_dir[0]==0) periapsis=0;
79  else periapsis=M_PI/2+std::atan2(zone_z_dir[1], -zone_z_dir[0]);
80 
81  assert(inclination>=0);
82  assert(inclination<M_PI);
83  }
84  */
85 
86 }//End Evolve namespace.
Declares a class for orientations of zones of DissipatingBody objects.
double periapsis(bool evolution_rate=false) const
The argument of periapsis of this zone minus the reference zone&#39;s.
Eigen::Vector3d zone_to_zone_transform(const ZoneOrientation &from_zone, const ZoneOrientation &to_zone, const Eigen::Vector3d &vector, Dissipation::QuantityEntry deriv, bool with_respect_to_from)
Transforms a vector betwen the coordinates systems of two zones.
Orientations of zones of bodies in a binary system.
double inclination(bool evolution_rate=false) const
The angle between the angular momenta of the zone and the orbit.
NO_DERIV
The quantity itself, undifferentiated.