Skip to content

Commit

Permalink
Merge pull request #45 from purduesigbots/AddHelperFunction
Browse files Browse the repository at this point in the history
add getDistance in Point struct
  • Loading branch information
Rocky14683 authored Jan 29, 2024
2 parents e7df2b1 + 451d9ea commit 6104033
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions include/VOSS/utils/Point.hpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
#pragma once
#include <cmath>

namespace voss {

struct Point {
double x;
double y;

static double getDistance(Point a, Point b) {
double dx = a.x - b.x;
double dy = a.y - b.y;
return sqrt(dx * dx + dy * dy);
}
};

} // namespace voss

0 comments on commit 6104033

Please sign in to comment.