Point center = new Point(); // 中心点
center.x = 5; // 中心点のX軸座標
center.y = 5; // 中心点のY軸座標
float r = 10; // 半径
float[] x = new float[6];
float[] y = new float[6];
double angle = Math.PI / 2.0; // 傾きを調整するための角度
// 正六角形の場合
for(int i=0; i<6; i++) {
x[i] = (float) (center.x + (r * (Math.cos(2.0 * i * Math.PI / 6.0 + angle))));
y[i] = (float) (center.y - (r * (Math.sin(2.0 * i * Math.PI / 6.0 + angle))));
}
// 正二十四角形の場合
float[] x24 = new float[24];
float[] y24 = new float[24];
for(int i=0; i<24; i++) {
x24[i] = (float) (center.x + (r * (Math.cos(2.0 * i * Math.PI / 24.0 + angle))));
y24[i] = (float) (center.y - (r * (Math.sin(2.0 * i * Math.PI / 24.0 + angle))));
}
-------------------------------------------------------------
