张世豪
4 天以前 dc9dce0555beb85d1262893fd5d56747d6a83855
src/gecaoji/Gecaoji.java
@@ -179,6 +179,38 @@
        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;