/// <summary>
 /// Returns a vector in the desired direction, or straight forward if unspecified. The use of nullable types
 /// is for simplicity and being able to set default values.
 /// </summary>
 /// <param name="angle">The angle to turn. Defaults to null, which is converted to robot's ahead.</param>
 /// <param name="direction">Whether to cast the vector forwards or backwards. Default is the robot's direction</param>
 /// <param name="length">How long the vector should be</param>
 /// <returns>The vector</returns>
 public static Vector2D DirectionVector(this Garics robot, double angle, Direction?direction = null, double length = 1)
 {
     direction = direction ?? robot.MoveDirection;
     return(robot.PositionVector + Vector2DHelpers.VectorFromAngle(angle + HalfPi) * length *
            (int)direction.Value);
 }
Ejemplo n.º 2
0
        public Point2D FindTargetPosition(ScannedRobotEvent e)
        {
            var angle = HeadingRadians + e.BearingRadians;

            return(new Point2D(PositionVector - Vector2DHelpers.VectorFromAngle(-angle - Math.PI / 2, e.Distance)));
        }