GCC Code Coverage Report


Directory: ./
File: include/trajectory.hpp
Date: 2026-12-03 12:28:13
Exec Total Coverage
Lines: 0 8 0.0%
Functions: 0 0 -%
Branches: 0 6 0.0%
Decisions: 0 0 -%

Line Branch Decision Exec Source
1 #ifndef TRAJECTORY_HPP
2 #define TRAJECTORY_HPP
3
4 #include "DLList.hpp"
5 #include "intersection.hpp"
6 #include "surface.hpp"
7
8 class TrajectoryVector
9 {
10 public:
11
12 double pos;
13 Direction dir, cdir;
14 Trajectory* trajectory;
15
16 ✗ TrajectoryVector(double p, Direction d, Trajectory* t):
17 ✗ pos(p),
18 ✗ dir(d),
19 ✗ trajectory(t)
20 {
21 }
22
23 ✗ TrajectoryVector() {}
24
25 TrajectoryVector flipped()
26 {
27 ✗ return TrajectoryVector(pos, dir == Direction::FORWARD ? Direction::BACKWARD : Direction::FORWARD, trajectory);
28 }
29 };
30
31 class Trajectory: public DLBaseItem<Trajectory>
32 // the trajectory is the basic geometrical object. Tips and segments associate
33 // with a trajectory and move/lie alongside it. Trajectory intersections
34 // determine the collision points
35 {
36 friend class Region;
37
38 public:
39
40 const SurfaceVector base;
41 const double length;
42
43 std::vector<PointAtEdge> end_point;
44 TrajectoryVector this_tr;
45
46 // trajectoryVector of the connecting trajectory at the zero end
47 TrajectoryVector prev_tr;
48
49 // trajectoryVector of the connecting trajectory at the far end
50 TrajectoryVector next_tr;
51
52 // cosine of the 3D angle with the previous trajectory (for edge
53 // catastrophes)
54 double prev_tr_cos_angle;
55
56 // cosine of the 3D angle with the next trajectory (for edge catastrophes)
57 double next_tr_cos_angle;
58
59 // regular catastrophe value at the trajectory zero end
60 double prev_trp_cat;
61
62 // regular catastrophe value at the trajectory far end
63 double next_trp_cat;
64
65 std::multimap<double, Intersection> intersections;
66
67 // sorted list of all intersections
68 IntersectionItr wall_end()
69 {
70 // returns an iterator to the intersection that stands for the far wall
71 ✗ return intersections.end();
72 }
73
74 IntersectionItr wall_begin()
75 {
76 // returns an iterator to the intersection that stands for the zero
77 // wall
78 ✗ return intersections.begin();
79 }
80
81 explicit Trajectory(SurfaceVector, std::vector<PointAtEdge>, double);
82 ~Trajectory();
83
84 bool integrity_check();
85
86 // returns the connected trajectory in a given direction, and creates it if
87 // necessary
88 TrajectoryVector next_trajectory(Direction);
89
90 // checks whether the trajectory can safely be removed - and does it
91 void conditional_remove();
92
93 // list of pointers to associated segments
94 std::list<Segment*> segments;
95
96 // inserts a segment into the list
97 TrjSegmentTag insert_segment(Segment*);
98
99 // removes a segment from the list
100 void remove_segment(TrjSegmentTag);
101
102 // list of pointers to associated tips
103 std::list<MTTip*> notification_list;
104
105 // insert a tip for notifications
106 TrjMTTipTag register_for_notifications(MTTip*);
107
108 // removes a tip from the list
109 void unregister_for_notifications(TrjMTTipTag);
110
111 // is called whenever an intersection is invalidated by trajectory removal
112 void invalidate_intersection(IntersectionItr&);
113
114 // is called when a new intersection is created
115 void new_intersection(IntersectionItr&);
116
117 // returns the difference sign of pos1-pos2, or itr1-itr2 if the first,
118 // cannot be determined accurately
119 int difference_sign(IntersectionItr itr1, double pos1, IntersectionItr itr2, double pos2);
120
121 // total length of trajectory (optical) that is covered by segments
122 double covered_length();
123
124 // total length of segments on the trajectory
125 double segment_length();
126
127 private:
128
129 // avoid accidental (expensive) copying of Trajectory objects, by declaring
130 // private copy constructors without definitions
131 Trajectory(const Trajectory&);
132 Trajectory& operator=(const Trajectory&);
133 };
134
135 #endif // TRAJECTORY_HPP
136