1 #ifndef SPACE_AUTOPILOT_H_
2 #define SPACE_AUTOPILOT_H_
4 #include "../graphics/Vector.h"
16 Autopilot(Ship &ctrl, const Vector<float> &target);
19 void Update(float deltaT);
21 void Render(Canvas &, const Camera &) const;
24 // velocity is so small that the next integration makes no difference
25 bool StandingStill() const;
26 // can halt within the current frame
27 bool ReallySlow() const;
28 // can halt within one second
31 // pointing exactly at target
32 bool FacingTarget() const;
33 // pointing exactly away from target
34 bool FacingOpposite() const;
35 // ship pointing in direction of given normalized vector
36 bool Facing(Vector<float>) const;
37 bool OnTarget() const;
40 float Distance() const;
41 float DistanceToHalt() const;
42 bool ReallyClose() const;
43 bool InBrakingDistance() const;
46 float TargetVelAngle() const;
48 // point the ship towards the target
50 // point ship into direction of given normalized vector
51 void Face(Vector<float>);
54 // accelerate if it improves moving in given normalized direction
55 void AccelerateAlong(Vector<float>);
59 const Vector<float> *target;
68 Vector<float> normVel;