Skip to content

Commit

Permalink
Merge pull request #23 from NHLStenden-ISAL/small-bug-fix
Browse files Browse the repository at this point in the history
added const to trajectory ctor, it allows const vectors to be given t…
  • Loading branch information
GTMeijer authored Nov 27, 2023
2 parents 5aabb8b + 2c4ac0e commit 8521375
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Trajectory_Hotspots/Trajectory_Hotspots/float.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Float
static inline float fixed_epsilon = 0.0000001f;

float get_value() const { return value; }
float set_value(const float value) { this->value = value; }
void set_value(const float value) { this->value = value; }

Float& operator=(const Float& other);
Float& operator=(float value);
Expand Down Expand Up @@ -84,4 +84,4 @@ class Float
float value = 0.0f;
};

Float operator/(const float& value, const Float& divider);
Float operator/(const float& value, const Float& divider);
4 changes: 2 additions & 2 deletions Trajectory_Hotspots/Trajectory_Hotspots/trajectory.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#include "pch.h"
#include "trajectory.h"

Trajectory::Trajectory(std::vector<Segment>& ordered_segments) : trajectory_segments(ordered_segments)
Trajectory::Trajectory(const std::vector<Segment>& ordered_segments) : trajectory_segments(ordered_segments)
{
trajectory_start = ordered_segments.front().start_t;
trajectory_end = ordered_segments.back().end_t;

for (Segment& i : ordered_segments)
for (const Segment& i : ordered_segments)
{
trajectory_length += i.length();
}
Expand Down
2 changes: 1 addition & 1 deletion Trajectory_Hotspots/Trajectory_Hotspots/trajectory.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class Trajectory
{
public:
Trajectory(){}
Trajectory(std::vector<Segment>& ordered_segments);
Trajectory(const std::vector<Segment>& ordered_segments);
Trajectory(const std::vector<Vec2>& ordered_points);


Expand Down

0 comments on commit 8521375

Please sign in to comment.