| | |
| | | return new Point2D.Double(position.x, position.y); |
| | | } |
| | | |
| | | /** |
| | | * 设置割草机位置(用于导航预览等场景) |
| | | * @param x X坐标 |
| | | * @param y Y坐标 |
| | | */ |
| | | public void setPosition(double x, double y) { |
| | | ensurePosition(); |
| | | position.x = x; |
| | | position.y = y; |
| | | positionValid = true; |
| | | } |
| | | |
| | | /** |
| | | * 设置割草机方向(用于导航预览等场景) |
| | | * @param headingDegrees 方向角度(度,0-360) |
| | | */ |
| | | public void setHeading(double headingDegrees) { |
| | | double normalized = headingDegrees % 360.0; |
| | | if (normalized < 0) { |
| | | normalized += 360.0; |
| | | } |
| | | this.headingDegrees = normalized; |
| | | } |
| | | |
| | | /** |
| | | * 获取割草机方向 |
| | | * @return 方向角度(度,0-360) |
| | | */ |
| | | public double getHeading() { |
| | | return headingDegrees; |
| | | } |
| | | |
| | | public double getWorldRadius(double scale) { |
| | | if (!positionValid) { |
| | | return Double.NaN; |