public void RestoreAngle() { if (_savedPositions.Count > 0) { _curPos = _savedPositions.Pop(); } }
public TurtlePosition Forward(double len = 5.0) { var angleRad = Math.PI * (_curPos.Angle / 180.0); double x = _curPos.Point.X + Math.Cos(angleRad) * len; double y = _curPos.Point.Y + Math.Sin(angleRad) * len; _curPos = new TurtlePosition(new Point(x, y), _curPos.Angle); return(_curPos); }
public void Turn(double angle) { _curPos = new TurtlePosition(_curPos.Point, _curPos.Angle + angle); }
public Turtle(Point startPoint, double currentAngle = 0.0) { StartPoint = startPoint; _curPos = new TurtlePosition(startPoint, currentAngle); }