【发布时间】:2014-02-02 13:44:28
【问题描述】:
我正在尝试编写代码以在 XNA 中绘制椭圆。假设我们有以下参数:
- 半长轴 (a)。
- 短半轴 (b)。
- 椭圆中心 (h,k)。
- 和 2D 旋转 (theta)。
如何使用上述参数绘制椭圆。
这里是函数
public VertexPositionColor Set2dEllipse(int x, int y, int z, Color color)
{
VertexPositionColor vertices= new VertexPositionColor[100];
for(int i= 0;i<100;i++)
{
double angle = (i / 100 * Math.PI * 2);
vertices[i].Position = New Vector3((x + (Math.Cos(angle)) * size.Width), (y + Math.Sin(angle) * size.Height), z);
vertices[i].Color = color;
}
}
【问题讨论】:
-
到目前为止你尝试过什么?请显示一些代码,以便我们更好地帮助您。