3D椭球出离散单位 [英] 3D Ellipsoid out of discrete units

查看:109
本文介绍了3D椭球出离散单位的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想绘制三维空间中的椭球出单个块。

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

我有2D椭圆没有问题,但至于3D的推移,我遇到了一些麻烦。我使用的是布氏圈算法,绘制2D椭圆。我想要做的就是绘制2D椭圆的层,增加(从底部开始往上走,采用对称的另一半)半径在X半径和Y半径上都。

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.

这一切听起来像它会工作,但是当我去实现它,我无法弄清楚如何改变的X半径和Y半径,使椭圆形的曲线。

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.

推荐答案

您的二维切片都应该具有相同的方向和纵横比。

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

如果(X0,Y0)为x轴和y宽度最大的片,(X,Y)=(规模* X0,规模* Y0)为x轴和y宽度片的高度以Z 的。

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.

这篇关于3D椭球出离散单位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆