|
ESPHome 2026.11.0-dev
|
A polygon in radar coordinates. Trivially copyable so it can be saved to preferences as-is. More...
#include <polygon.h>
Public Member Functions | |
| bool | empty () const |
| True when the polygon has no points, which disables the zone. | |
| bool | is_valid () const |
| True when the polygon is empty, or has a valid number of points that are all inside the radar area. | |
| bool | contains (int16_t x, int16_t y) const |
| Return whether the point is inside the polygon (even-odd rule). Always false for an empty polygon. | |
| bool | parse (const char *str, size_t len) |
| Parse "x,y;x,y;..." (mm) into this polygon. | |
| void | format (char *buf) const |
| Write the polygon as "x,y;x,y;..." into buf, which must hold at least POLYGON_STR_SIZE bytes. | |
Data Fields | |
| std::array< Point, MAX_POLYGON_POINTS > | points {} |
| uint8_t | count {0} |
A polygon in radar coordinates. Trivially copyable so it can be saved to preferences as-is.
| bool esphome::ld2450::Polygon::contains | ( | int16_t | x, |
| int16_t | y ) const |
Return whether the point is inside the polygon (even-odd rule). Always false for an empty polygon.
Definition at line 73 of file polygon.cpp.
|
inline |
| void esphome::ld2450::Polygon::format | ( | char * | buf | ) | const |
Write the polygon as "x,y;x,y;..." into buf, which must hold at least POLYGON_STR_SIZE bytes.
Definition at line 114 of file polygon.cpp.
| bool esphome::ld2450::Polygon::is_valid | ( | ) | const |
True when the polygon is empty, or has a valid number of points that are all inside the radar area.
Definition at line 60 of file polygon.cpp.
| bool esphome::ld2450::Polygon::parse | ( | const char * | str, |
| size_t | len ) |
Parse "x,y;x,y;..." (mm) into this polygon.
Spaces around numbers and a trailing ';' are allowed. An empty or all-space string gives an empty polygon.
Definition at line 91 of file polygon.cpp.
| std::array<Point, MAX_POLYGON_POINTS> esphome::ld2450::Polygon::points {} |