03-27-2017, 07:31 PM
What is the chkpos function supposed to actually do? Return a point c meters in front of the robot? (I'm too lazy to try to understand the whole code )
If so... why not just
I can't see any other immediate problems, other than the way you do the altitude choice could probably be done better - I'd just let the wasp stay at around z=max(topo(this.position), chkpos(20))+some_arbitrary_altitude_above_ground. Anyway, your code seems to work fine for me, unless you have some level with terrain changes big enough for it to break.
If so... why not just
Code:
point object::chkpos(int c)
{
point p;
p.x = this.position.x + cos(this.orientation) * c;
p.y = this.position.y + sin(this.orientation) * c;
p.z = topo(p);
return p;
}
I can't see any other immediate problems, other than the way you do the altitude choice could probably be done better - I'd just let the wasp stay at around z=max(topo(this.position), chkpos(20))+some_arbitrary_altitude_above_ground. Anyway, your code seems to work fine for me, unless you have some level with terrain changes big enough for it to break.