AC_PolyFence_loader.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. #pragma once
  2. #include <AP_Common/AP_Common.h>
  3. #include <AP_Math/AP_Math.h>
  4. class AC_PolyFence_loader
  5. {
  6. public:
  7. // maximum number of fence points we can store in eeprom
  8. uint8_t max_points() const;
  9. // create buffer to hold copy of eeprom points in RAM
  10. // returns nullptr if not enough memory can be allocated
  11. void* create_point_array(uint8_t element_size);
  12. // load boundary point from eeprom, returns true on successful load
  13. bool load_point_from_eeprom(uint16_t i, Vector2l& point);
  14. // save a fence point to eeprom, returns true on successful save
  15. bool save_point_to_eeprom(uint16_t i, const Vector2l& point);
  16. // validate array of boundary points (expressed as either floats or long ints)
  17. // returns true if boundary is valid
  18. template <typename T>
  19. bool boundary_valid(uint16_t num_points, const Vector2<T>* points) const;
  20. // check if a location (expressed as either floats or long ints) is within the boundary
  21. // returns true if location is outside the boundary
  22. template <typename T>
  23. bool boundary_breached(const Vector2<T>& location, uint16_t num_points, const Vector2<T>* points) const;
  24. };