61 if (curpos == target) {
66 if ((x<=1) && (y<=1)) {
78 if (curpos == target) {
80 }
else if (
ABS(target.
x-curpos.
x)^
ABS(target.
y-curpos.
y)) {
87 return static_cast<double>(
ABS(target.
x - curpos.
x) +
ABS(target.
y - curpos.
y));
91 static std::string type(
"square");
96 static std::string squareGrid(
"Square Grid");
114 ModelCoordinate result(round(exact_layer_coords.
x), round(exact_layer_coords.
y), round(exact_layer_coords.
z));
120 double x =
static_cast<double>(cell.
x);
121 double y =
static_cast<double>(cell.
y);
129 std::vector<ModelCoordinate> coords;
130 std::vector<ModelCoordinate>::const_iterator it = orig.begin();
132 for (; it != orig.end(); ++it) {
136 coords.push_back(mc);
139 for (; it != orig.end(); ++it) {
143 coords.push_back(mc);
150 std::vector<ModelCoordinate> coords;
151 int32_t dx =
ABS(end.
x - start.
x);
152 int32_t dy =
ABS(end.
y - start.
y);
156 if (start.
x < end.
x) {
159 if (start.
y < end.
y) {
163 int32_t err = dx - dy;
164 int32_t err2 = err*2;
166 bool finished =
false;
168 coords.push_back(current);
169 if (current.
x == end.
x && current.
y == end.
y) {
177 }
else if (err2 < dx) {
const std::string & getName() const
Name of the cellgrid (DEPRECATED? -jwt)
double getAdjacentCost(const ModelCoordinate &curpos, const ModelCoordinate &target)
Returns distance const from curpos to target point only cells adjacent to curpos are considered in th...
void setZShift(const double zshift)
Set the cellgrid z shift.
void getVertices(std::vector< ExactModelCoordinate > &vtx, const ModelCoordinate &cell)
Fills given point vector with vertices from selected cell.
const std::string & getType() const
Type of cellgrid.
static Logger _log(LM_AUDIO)
DoubleMatrix m_inverse_matrix
void setXShift(const double &xshift)
Set the cellgrid x shift.
void setYScale(const double scale)
Set the cellgrid y-scaling.
void setXScale(const double scale)
Set the cellgrid x-scaling.
void setYShift(const double yshift)
Set the cellgrid y shift.
CellGrid * clone()
Returns clone of this cellgrid.
ModelCoordinate toLayerCoordinates(const ExactModelCoordinate &map_coord)
Transforms given point from map coordinates to layer coordinates.
bool isAccessible(const ModelCoordinate &curpos, const ModelCoordinate &target)
Tells if given target point is accessible from curpos only cells adjacent to curpos are considered in...
ExactModelCoordinate toExactLayerCoordinates(const ExactModelCoordinate &map_coord)
Transforms given point from map coordinates to layer coordinates.
void setAllowDiagonals(const bool allow_diagonals)
Set whether diagonal cell access is allowed.
ModelCoordinate toLayerCoordinatesFromExactLayerCoordinates(const ExactModelCoordinate &exact_layer_coords)
Transforms given point from exact layer coordinates to cell precision layer coordinates.
DoublePoint3D ExactModelCoordinate
double getHeuristicCost(const ModelCoordinate &curpos, const ModelCoordinate &target)
Returns distance const from curpos to target point.
void setRotation(const double rotation)
Set the cellgrid rotation.
std::vector< ModelCoordinate > toMultiCoordinates(const ModelCoordinate &position, const std::vector< ModelCoordinate > &orig, bool reverse)
Returns point vector with coordinates for a multi object.
std::vector< ModelCoordinate > getCoordinatesInLine(const ModelCoordinate &start, const ModelCoordinate &end)
Returns point vector with coordinates for a line from start to end.
ExactModelCoordinate toMapCoordinates(const ExactModelCoordinate &layer_coords)
Transforms given point from layer coordinates to map coordinates.