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