Go to the documentation of this file.
23 int value = random()%255;
28 for (
int x = 0; x <=
width; x++)
35 offset = (random()%70)-35;
40 for (
int y = 1; y <=
length; y++)
43 offset = (random()%70)-35;
48 for (
int x = 0; x <=
width; x++)
55 offset = (random()%70)-35;
65 for (
int y = 0; y <
length; y++)
67 for (
int x = 0; x <=
width; x++)
71 for (
int dx = -1; dx <= 1; dx++)
73 for (
int dy = -1; dy <= 1; dy++)
75 if (
Valid(x+dx, y+dy))
82 tmp[x+y*(
length+1)] = sum/cnt;
87 for (
int y = 0; y <
length; y++)
89 for (
int x = 0; x <=
width; x++)
97 for (
int y = 0; y <
length; y++)
99 for (
int x = 0; x <=
width; x++)
123 for (
int y = 0; y <=
length; y++)
125 for (
int x = 0; x <=
width; x++)
171 return x >= 0 && x <= width && y >= 0 && y <=
length;
187 if (x1 >= x2-1 || y1 >= y2-1)
189 int middlex = (x1+x2)/2;
190 int middley = (y1+y2)/2;
210 neighbors.push_back(s);
263 else if (dir.
turn == 0)
331 glEnable(GL_LIGHTING);
332 for (
int y = 0; y <
length; y++)
334 glBegin(GL_TRIANGLE_STRIP);
335 for (
int x = 0; x <=
width; x++)
350 glColor3f(c.
r, c.
g, c.
b);
353 glNormal3f(tmp.
x, tmp.
y, tmp.
z);
354 glVertex3f(a.
x, a.
y, a.
z);
362 glColor3f(c.
r, c.
g, c.
b);
365 glNormal3f(tmp.
x, tmp.
y, tmp.
z);
366 glVertex3f(b.
x, b.
y, b.
z);
370 glDisable(GL_LIGHTING);
371 glColor3f(1.0, 1.0, 1.0);
384 GLfloat x = (l.
x-40.0)/40.0;
385 GLfloat y = (l.
y-40.0)/40.0;
386 GLfloat z = -l.
height/80.0;
387 glEnable(GL_LIGHTING);
389 glTranslatef(x, y, z);
390 glRotatef(360*l.
heading/8.0, 0, 0, 1);
405 GLfloat x1 = (o.
x-40.0)/40.0;
406 GLfloat y1 = (o.
y-40.0)/40.0;
407 GLfloat z1 = -o.
height/80.0;
408 GLfloat h1 = 360*o.
heading/8.0;
410 GLfloat x2 = (n.
x-40.0)/40.0;
411 GLfloat y2 = (n.
y-40.0)/40.0;
412 GLfloat z2 = -n.
height/80.0;
413 GLfloat h2 = 360*n.
heading/8.0;
418 glEnable(GL_LIGHTING);
420 glTranslatef((1-perc)*x1+perc*x2, (1-perc)*y1+perc*y2, (1-perc)*z1+perc*z2);
421 glRotatef((1-perc)*h1+perc*h2, 0, 0, 1);
rgbColor GetColor(float v, float vmin, float vmax, int type)
Given min/max values, get a color from a color schema.
bool GoalTest(const airplaneState &node, const airplaneState &goal) const
A color; r/g/b are between 0...1.
void GLDrawLine(const airplaneState &a, const airplaneState &b) const
A generic vector (essentially the same as a point, but offers normalization)
double min(double a, double b)
void RecurseGround(int x1, int y1, int x2, int y2)
recVec & GetNormal(int x, int y)
void DrawCylinder(GLfloat xx, GLfloat yy, GLfloat zz, GLfloat innerRad, GLfloat outerRad, GLfloat height)
uint64_t GetStateHash(const airplaneState &node) const
virtual void ApplyAction(airplaneState &s, airplaneAction dir) const
std::vector< airplaneAction > internalActions
void GetSuccessors(const airplaneState &nodeID, std::vector< airplaneState > &neighbors) const
void DrawBoxFrame(GLfloat xx, GLfloat yy, GLfloat zz, GLfloat rad)
bool operator==(const airplaneState &s1, const airplaneState &s2)
virtual void GetNextState(const airplaneState ¤ts, airplaneAction dir, airplaneState &news) const
virtual double HCost(const airplaneState &node1, const airplaneState &node2) const
Heuristic value between two arbitrary nodes.
std::vector< uint8_t > ground
void SetGround(int x, int y, uint8_t val)
recVec GetCoordinate(int x, int y, int z) const
virtual rgbColor GetColor() const
virtual void UndoAction(airplaneState &s, airplaneAction dir) const
void GetActions(const airplaneState &nodeID, std::vector< airplaneAction > &actions) const
uint8_t GetGround(int x, int y) const
virtual void OpenGLDraw() const
uint64_t GetActionHash(airplaneAction act) const
virtual double GCost(const airplaneState &node1, const airplaneState &node2) const
void normalise()
Normalize a vector.
Nodes to be stored within a Graph.
std::vector< recVec > groundNormals