25 static constexpr float kUnreachable = 3.4e38f;
38 void resize(
int width,
int height,
float cellSize,
float originX,
float originY);
44 bool valid()
const {
return width_ > 0 && height_ > 0 && cellSize_ > 0.f; }
63 void setBlocked(
int cx,
int cy,
bool blocked);
66 bool isBlocked(
int cx,
int cy)
const;
72 void setCellCost(
int cx,
int cy,
float cost);
75 float getCellCost(
int cx,
int cy)
const;
78 void setAllCellCost(
float cost);
85 void setGoal(
int gx,
int gy);
88 void addGoal(
int gx,
int gy);
92 int goalCount()
const {
return int(goals_.size() / 2); }
101 float costAtCell(
int cx,
int cy)
const;
104 bool isReachable(
int cx,
int cy)
const;
113 void flowAtCell(
int cx,
int cy,
float &
dx,
float &
dy)
const;
121 float costAtWorld(
float wx,
float wy)
const;
130 void flowAtWorld(
float wx,
float wy,
float &
dx,
float &
dy)
const;
143 bool resolvePenetration(
float &
wx,
float &
wy,
float radius)
const;
148 const std::vector<float> &
flowX()
const {
return flowX_; }
150 const std::vector<float> &
flowY()
const {
return flowY_; }
153 bool inBounds(
int cx,
int cy)
const {
return cx >= 0 &&
cy >= 0 &&
cx < width_ &&
cy < height_; }
155 void worldToCell(
float wx,
float wy,
float &fx,
float &fy)
const;
160 float cellSize_ = 0.f;
161 float originX_ = 0.f;
162 float originY_ = 0.f;
163 std::vector<float> cost_;
164 std::vector<float> integ_;
165 std::vector<float> flowX_;
166 std::vector<float> flowY_;
167 std::vector<int> goals_;