0
我想在C#中的球壳中排列点。我有代码来安排一组点(我正在进行有限元分析),球体模式的半径为double earthRadius
。我不知道如何做一个球壳like the type pictured here相同。想法?如何绘制球壳?
for (double x = -earthRadius; x < earthRadius; x += pointIncrement) //taken from http://stackoverflow.com/questions/8671385/sphere-drawing-in-java and slightly altered to make more efficient
{
for (double y = -earthRadius; y < earthRadius; y += pointIncrement)
{
for (double z = -earthRadius; z < earthRadius; z += pointIncrement)
{
if ((x * x) + (y * y) + (z * z) <= earthRadius * earthRadius)
{
earth.AddPoint(new Vector(x, y, z), 0);
totalPoints++;
}
}
}
}
我建议你循环[球形坐标](https://en.wikipedia.org/wiki/Spherical_coordinate_system)来查找你的观点。之后,将它们转换为笛卡尔坐标。 – gdir