Valkyrie 2026
Loading...
Searching...
No Matches
ConvexPolygon.h
1#pragma once
2#include <frc/geometry/Translation2d.h>
3
4namespace valor {
5
6class ConvexPolygon {
7 public:
8 ConvexPolygon(std::vector<frc::Translation2d> vert);
9 bool Intersects(const ConvexPolygon& other);
10 bool IsPointInPolygon(frc::Translation2d point) const;
11 void SetVertices(std::vector<frc::Translation2d> new_vert);
12
13 std::vector<frc::Translation2d>& GetVertices() { return vertices; }
14
15 std::vector<frc::Translation2d> GetAxes() const;
16 std::pair<units::square_meter_t, units::square_meter_t> Project(frc::Translation2d axis) const;
17
18 private:
19 bool IsPolygonConvex(std::vector<frc::Translation2d> vert) const;
20
21 std::vector<frc::Translation2d> vertices;
22};
23} // namespace valor