0

30°と半径がわかっている場合は、「a」度ごとに三角形の x 座標と y 座標を取得したいと考えています。また、もっとコーナーで使いたいです。

画像は次のとおりです: https://dl.dropboxusercontent.com/u/104060836/Image.png

どんな助けでもいただければ幸いです。

私はすでにこのコードを試しました:

/**
 * Gets the points on the shape around the location.
 * @param location
 * @param diameter
 * @param amount
 * @param degreesBetweenPoint
 * @return points
 */
public static List<Location> getShapeLinePoints(Location location, NecroPlane plane, double diameter, int amount, int degreesBetweenPoint) {
    List<Location> points = new ArrayList<Location>();

    double r = diameter / 2;

    int c1 = 180 / amount;
    int c2 = c1 / 2;

    for (int i = 0; i < (360 / degreesBetweenPoint); i++) {
        int d = i * degreesBetweenPoint;

        int d1 = d;
        while (d1 >= c1) {
            d1 -= c1;
        }

        int d2 = 180 - c2 - d1;

        double z = (r * Math.sin(Math.toRadians(c2))) / Math.sin(Math.toRadians(d2));
        double x = Math.sin(Math.toRadians(d)) * z;
        double y = Math.cos(Math.toRadians(d)) * z;

        switch (plane) {
            case XZ:
                points.add(new Location(location.getWorld(), location.getX() + x, location.getY(), location.getZ() + y));
                break;
            case YZ:
                points.add(new Location(location.getWorld(), location.getX(), location.getY() + y, location.getZ() + x));
                break;
            case XY:
            default:
                points.add(new Location(location.getWorld(), location.getX() + x, location.getY() + y, location.getZ()));
        }
    }

    return points;
}

私はそれを機能させました。誰かがそれを必要とする場合の解決策は次のとおりです: http://pastie.org/8022687

4

1 に答える 1

0

象限 I. の場合は簡単です: この (ASA) ルールを使用して "z" の長さを計算します: http://www.mathsisfun.com/algebra/trig-solving-asa-triangles.html

これで z が得られました。辺が x、y、z の三角形を取ります。角度 a) と 90° の角度がわかるので、3 つの角度すべてを計算できます。上記と同じルールを使用して、x と y の長さを計算できます。これが x と y 座標になります。

したがって、象限 IV. についても同様のルールを使用します。

完全な三角形は正三角形なので、三角形と x の交点は -r/2 です。3 辺の長さは (3r)/sqrt(3) です。

私は数学者ではないので、誰かがここから II を手伝ってくれることを願っています。およびIII。四分円。

于 2013-06-08T09:56:10.787 に答える