8
8
9
9
namespace dmsc {
10
10
11
- using EdgeOrientation = std::pair<glm::vec3, glm::vec3>;
12
-
13
11
class InterSatelliteLink {
14
12
public:
15
13
InterSatelliteLink (const uint32_t & v1_idx, const uint32_t & v2_idx, const std::vector<Satellite>& satellites,
@@ -70,22 +68,22 @@ class InterSatelliteLink {
70
68
* @param t [sec] Time when the satellites have to face each other.
71
69
*/
72
70
bool canAlign (const TimelineEvent<glm::vec3>& sat1, const TimelineEvent<glm::vec3>& sat2, const float t) const {
73
- EdgeOrientation target = getOrientation (t);
71
+ glm::vec3 target = getOrientation (t);
74
72
float angle_sat1 = .0f ;
75
73
float angle_sat2 = .0f ;
76
74
float time_sat1 = .0f ;
77
75
float time_sat2 = .0f ;
78
76
79
77
// calc angle between orientations; direction vectors must be length 1
80
78
if (sat1.isValid ()) {
81
- angle_sat1 = std::acos (glm::dot (sat1.data , target. first )); // [rad]
79
+ angle_sat1 = std::acos (glm::dot (sat1.data , target)); // [rad]
82
80
time_sat1 = sat1.t_begin ;
83
81
} else {
84
82
time_sat1 = 0 .f ; // event is invalid, so assume that sat1 was not part of a communication yet
85
83
}
86
84
87
85
if (sat2.isValid ()) {
88
- angle_sat2 = std::acos (glm::dot (sat2.data , target. second )); // [rad]
86
+ angle_sat2 = std::acos (glm::dot (sat2.data , - target)); // [rad]
89
87
time_sat2 = sat2.t_begin ;
90
88
} else {
91
89
time_sat2 = 0 .f ; // event is invalid, so assume that sat1 was not part of a communication yet
@@ -104,15 +102,15 @@ class InterSatelliteLink {
104
102
}
105
103
106
104
/* *
107
- * @brief Calculate the directions for both satellites to face each other.
105
+ * @brief Calculate the directions for both satellites to face each other. Because both satellites have to face each
106
+ * other, the direction of satellite A is the negative direction of satellite B.
108
107
* @param t [sec] time
109
- * @return Two direction vectors at the time when they face each other.
108
+ * @return Direction vector for one of the satellites (origin) at the time when they face each other.
110
109
*/
111
- EdgeOrientation getOrientation (const float time) const {
110
+ glm::vec3 getOrientation (const float time) const {
112
111
glm::vec3 sat1 = v1->cartesian_coordinates (time );
113
112
glm::vec3 sat2 = v2->cartesian_coordinates (time );
114
-
115
- return {glm::normalize (sat2 - sat1), glm::normalize (sat1 - sat2)};
113
+ return glm::normalize (sat2 - sat1);
116
114
}
117
115
118
116
// GETTER
0 commit comments