3D Ellipsoid out of discrete units

大城市里の小女人 提交于 2020-01-05 08:06:22

问题


I'm trying to draw an ellipsoid in 3d space out of individual blocks.

I have no problem with 2D ellipses, but as far as 3D goes I'm having some trouble. I'm using Bresenham's circle algorithm to draw 2D ellipses. What I'm trying to do is draw 2D ellipses in layers with an increasing (starting from the bottom going up, using symmetry for the other half) radius on both the X radius and Y radius.

It all sounds like it would work, but when I go to implement it, I can't figure out how to alter the x radius and y radius to make the curve of the ellipsoid.


回答1:


Your 2D slices should all have the same orientation and aspect ratio.

If your ellipsoid is axis-aligned, they should also have the same center.

Your slices should scale proportionally to:

scale = sqrt(1 - ((center-z)/half_vsize)^2)

where:
  z = height of the current slice
  center = height of the largest slice
  half_vsize = half the vertical size of the ellipsoid

If (x0, y0) is the x- and y-width of the largest slice, (x, y) = (scale*x0, scale*y0) is the x- and y-width of the slice at height z.



来源:https://stackoverflow.com/questions/9811582/3d-ellipsoid-out-of-discrete-units

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!