Loading [MathJax]/extensions/MathMenu.js
Cytopia  0.3
A city building simulation game
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PointFunctions.hxx
Go to the documentation of this file.
1 #ifndef POINTFUNCTIONS_HXX_
2 #define POINTFUNCTIONS_HXX_
3 
4 #include "Point.hxx"
5 #include "../../util/LOG.hxx"
6 #include "betterEnums.hxx"
7 #include <vector>
8 
9 BETTER_ENUM(NeighborNodesPosition, unsigned char, BOTTOM_LEFT = 1U << 6, LEFT = 1U << 2, TOP_LEFT = 1U << 4, BOTTOM = 1U << 1,
10  CENTER = 0U, TOP = 1U, BOTTOM_RIGHT = 1U << 7, RIGHT = 1U << 3, TOP_RIGHT = 1U << 5);
11 
13 {
14 public:
20  static std::vector<Point> getLine(Point isoCoordinatesStart, Point isoCoordinatesEnd);
21 
27  static std::vector<Point> getStraightLine(const Point &isoCoordinatesStart, const Point &isoCoordinatesEnd);
28 
34  static std::vector<Point> getArea(const Point &isoCoordinatesStart, const Point &isoCoordinatesEnd);
35 
41  static std::vector<Point> getNeighbors(const Point &isoCoordinates, const bool includeCentralNode, int distance = 1);
42 
49  static NeighborNodesPosition getNeighborPositionToOrigin(const Point &neighboringPoint, const Point &originPoint);
50 };
51 
52 #endif
BETTER_ENUM
BETTER_ENUM(NeighborNodesPosition, unsigned char, BOTTOM_LEFT=1U<< 6, LEFT=1U<< 2, TOP_LEFT=1U<< 4, BOTTOM=1U<< 1, CENTER=0U, TOP=1U, BOTTOM_RIGHT=1U<< 7, RIGHT=1U<< 3, TOP_RIGHT=1U<< 5)
PointFunctions
Definition: PointFunctions.hxx:12
PointFunctions::getArea
static std::vector< Point > getArea(const Point &isoCoordinatesStart, const Point &isoCoordinatesEnd)
Gets all nodes in a rectangular area between start and end point.
Definition: PointFunctions.cxx:156
PointFunctions::getLine
static std::vector< Point > getLine(Point isoCoordinatesStart, Point isoCoordinatesEnd)
Creates a line between two points using the Bresenham Line algorithm.
Definition: PointFunctions.cxx:10
PointFunctions::getStraightLine
static std::vector< Point > getStraightLine(const Point &isoCoordinatesStart, const Point &isoCoordinatesEnd)
Gets all nodes in a straight line from start and end point.
Definition: PointFunctions.cxx:108
PointFunctions::getNeighbors
static std::vector< Point > getNeighbors(const Point &isoCoordinates, const bool includeCentralNode, int distance=1)
Get all neighboring coordinates from provided map node isocoordinate.
Definition: PointFunctions.cxx:175
PointFunctions::getNeighborPositionToOrigin
static NeighborNodesPosition getNeighborPositionToOrigin(const Point &neighboringPoint, const Point &originPoint)
Get the position of the neighboring node to the originpoint (center of the neighborgroup).
Definition: PointFunctions.cxx:202
Point
Definition: Point.hxx:7
Point.hxx