22 #ifndef ALCACHOFA_SHAPE_H 23 #define ALCACHOFA_SHAPE_H 25 #include "common/stream.h" 26 #include "common/array.h" 27 #include "common/stack.h" 28 #include "common/rect.h" 29 #include "common/span.h" 30 #include "common/util.h" 31 #include "math/vector2d.h" 33 #include "alcachofa/common.h" 55 return closestPointTo(query, dummy);
76 template<
class TShape,
typename TPolygon>
78 using difference_type = uint;
79 using value_type = TPolygon;
82 inline value_type operator*()
const {
83 return _shape.at(_index);
87 assert(_index < _shape.polygonCount());
92 inline my_type operator++(
int) {
93 assert(_index < _shape.polygonCount());
99 inline bool operator==(
const my_type &it)
const {
100 return &this->_shape == &it._shape && this->_index == it._index;
103 inline bool operator!=(
const my_type &it)
const {
104 return &this->_shape != &it._shape || this->_index != it._index;
108 friend typename Common::remove_const_t<TShape>;
114 const TShape &_shape;
126 inline uint polygonCount()
const {
return _polygons.size(); }
127 inline bool empty()
const {
return polygonCount() == 0; }
128 inline iterator begin()
const {
return { *
this, 0 }; }
129 inline iterator end()
const {
return { *
this, polygonCount() }; }
137 return closestPointTo(query, dummy);
142 uint addPolygon(uint maxCount);
162 static constexpr
const uint kPointsPerPolygon = 4;
167 inline iterator begin()
const {
return { *
this, 0 }; }
168 inline iterator end()
const {
return { *
this, polygonCount() }; }
177 int32 edgeTarget(uint polygonI, uint pointI)
const;
178 bool findEvadeTarget(
196 void initializeFloydWarshall();
197 void calculateFloydWarshall();
198 bool canGoStraightThrough(
201 int32 fromContaining, int32 toContaining)
const;
202 void floydWarshallPath(
205 int32 fromContaining, int32 toContaining,
222 struct LinkPolygonIndices {
223 LinkPolygonIndices();
241 static constexpr
const uint kPointsPerPolygon = 4;
246 inline iterator begin()
const {
return { *
this, 0 }; }
247 inline iterator end()
const {
return { *
this, polygonCount() }; }
258 #endif // ALCACHOFA_SHAPE_H
Definition: alcachofa.h:45
Path finding is based on the Shape class with the invariant that every polygon is a convex polygon wi...
Definition: shape.h:159