void Render(Canvas &, const Camera &) const;
+private:
+ // velocity is so small that the next integration makes no difference
+ bool StandingStill() const;
+ // can halt within the current frame
+ bool ReallySlow() const;
+ // can halt within one second
+ bool Slow() const;
+
+ // pointing exactly at target
+ bool FacingTarget() const;
+ // pointing exactly away from target
+ bool FacingOpposite() const;
+ // ship pointing in direction of given normalized vector
+ bool Facing(Vector<float>) const;
+ bool OnTarget() const;
+
+ float Speed() const;
+ float Distance() const;
+ float DistanceToHalt() const;
+ bool ReallyClose() const;
+ bool InBrakingDistance() const;
+ bool FarAway() const;
+
+ float TargetVelAngle() const;
+
+ // point the ship towards the target
+ void FaceTarget();
+ // point ship into direction of given normalized vector
+ void Face(Vector<float>);
+ // stop the ship asap
+ void Halt();
+ // accelerate if it improves moving in given normalized direction
+ void AccelerateAlong(Vector<float>);
+
private:
Ship *ctrl;
const Vector<float> *target;
- // cache members for debug drawing
- Vector<float> planFrom;
- Vector<float> planTo;
+ float dt;
+
+ Vector<float> dp;
+ float dist;
+ Vector<float> normDP;
+
+ float speed;
+ Vector<float> normVel;
+
+ Vector<float> proj;
};