Advertisement

计算机图形学椭圆_椭圆算法| 计算机图形学

阅读量:

计算机图形学椭圆

椭圆的性质 (Properties of ellipse)

An ellipse is defined as the path traced by a point moving in such a way that the ratio of its distances from focus to directrix remains constant, this constant ratio must always be less than one.

椭圆被定义为平面上某一点的轨迹,在同一平面上以特定位置为焦点并以特定直线为基准线的情况下,“动点到焦点距离与到基准线距离之比”的比率必须始终保持不变,并且这一比率必须始终小于1.此比例值必须始终保持在低于1的情况下

For any point P=(x,y) lying on an ellipse, its distances to the two foci, denoted as d₁ and d₂, have a sum that remains constant. This relationship is expressed by the equation: The sum of these distances, when added together, equals a specific constant value for all points on the ellipse.

对于椭圆上的任一点P(x, y),其到两个焦点F₁和F₂的距离分别为d₁和d₂,则该椭圆满足的关系式为|d₁ - d₂| = 常数。

To express the distances d₁ and d₂ based on focal coordinates F₁ and F₂, we derive:- Ax² + By² + Cxy + Dx + Ey + F = 0 where A, B, C, D, E, and F are determined based on focal coordinates as well as the lengths of the major and minor axes of the ellipse.

基于焦点坐标F_1F_2来表示距离d_1d_2时,则存在以下方程:-Ax^2 + By^2 + Cxy + Dx + Ey + F = 0其中A、B、C、D、E以及F则取决于椭圆主轴与副轴的焦点位置及其尺寸。

中点椭圆算法 (Midpoint ellipse algorithm)

The midpoint ellipse method is utilized in two distinct sections within the first quadrant to achieve its purpose. Starting from the point (0, r y), we proceed along the elliptical path in a clockwise direction within the first quadrant.

中点椭圆法 被划分为两个阶段,在整个第一象限范围内分别实施。 现在,请我们从指定的起始点(0, ry)开始,在第一象限内按照顺时针顺序沿着椭圆路径逐步推进。

Ellipse function can be defined as:

椭圆函数可以定义为:

f ellipse(x,y)=ry2x2+rx2y2-rx2ry2

椭圆 (x,y)= r y 2 x 2 + r x 2 y 2 -r x 2 r y 2

This indicates that there exist certain characteristics, which are the result of being created from.

据此,生成了一些属性,这些属性是:

  1. f ellipse(x,y)<0 which means (x,y) is inside the ellipse boundary.

f 椭圆 (x,y)<0 ,表示**(x,y)** 在椭圆边界内。

  1. f ellipse(x,y)>0 which means (x,y) is outside the ellipse boundary.

f ellipse (x,y)> 0表示**(x,y)** 在椭圆边界之外。

  1. f ellipse(x,y)=0 which means (x,y) is on the ellipse boundary.

f ellipse (x,y)= 0意味着**(x,y)** 在椭圆边界上​​。

Ellipse Algorithm | Computer Graphics

初始决策参数 (Initial decision parameter)

In region 1, the initial value of a decision parameter is determined by establishing the starting position as (0, r y).

在区域1中 ,决策参数的初始值通过指定起始位置= (0,r y )获得

i.e. p1 0=ry2+1/4rx2-rx2ry

即p1 0 = r y 2 + 1 / 4r x 2 -r x 2 r y

The initial position within area 2 is established as the final point selected within area 1, and subsequently, the starting decision factor for area 2 is determined.

当我们在进入区域2时,在区域1中的最后一个选定位置将被用作初始位置;接着,在区域2中设置初始决策参数。

p2 0=ry2(x0+1/2)2+rx2(y0-1)2-rx2ry2

p2 0 = r y 2 (x 0 +1/2) 2 + r x 2 (y 0 -1) 2 -r x 2 r y 2

算法 (ALGORITHM)

Obtain the input data, along with the origin-centered ellipse's center, to determine the first point on the ellipse as (x, y₀) = (0, r_y).

取输入和椭圆中心,并以(x,y 0 )=(0,r y )获得以原点为中心的椭圆上的第一个点。

  1. Now calculate the initial decision parameter in region 1 as:

现在,将区域1中的初始决策参数计算为:

**p1 0=ry2+1/4rx2-rx2ry **

p1 0 = r y 2 + 1 / 4r x 2 -r x 2 r y

At each x_k position within region 1, execute the following task: if p_{1,k} < 0, then the subsequent point on the ellipse centered at (0,0) is (x_{k+1}, y_k).

在区域1中对每一个x_k位置实施相应的操作。当满足条件p_{1k} < 0时,则将位于中心椭圆周上的下一个点确定为(x_{k+1}, y_{k})的位置坐标。

i.e. p1 k+1=p1k+2ry2xk+1+ry2

即p1 k + 1 = p1 k + 2 r y 2 x k + 1 + r y 2

Otherwise the next point along the circle is (x

否则,沿圆的下一个点是[x

k+1,yk -1)

k + 1 ,y k -1)

i.e. p1 k+1=p1k+2ry2xk+1 – 2rx2yk+1+ry2

即p1 k + 1 = p1 k + 2r y 2 x k + 1 – 2r x 2 y k + 1 + r y 2

Determine the initial value in region ₂ based on the final coordinates (x₀, y₀) from region₁ using the formula: p₂₀ = rᵧ₂(x₀ + ½)² + rₓ₂(y₀ − 1)² − rₓ₂rᵧ₂

在此阶段,在区域1中已经获得最终点(x₀, y₀)后,在区域二中确定起始参数的过程如下:首先利用这些点来建立方程组。

For every position of y_k within region 2, starting from k=0 onward, carry out the subsequent action. If p_{2,k} < 0, then the next point along the ellipse centered at (0, 0) will be located at (x_{k}, y_{k-1})

在区域2中,在每一个yk的位置上,从k=0开始执行以下操作。 如果p2k<0,则以(0,0)为中心点的椭圆上的下一个点为(xk, yk-1)

i.e. p2 k+1=p2k-2rx2yk+1+rx2

即p2 k + 1 = p2 k -2r x 2 y k + 1 + r x 2

Otherwise the next point along the circle will be

否则,沿着圆的下一个点将是

(x k+1,yk -1)

(x k + 1 ,y k -1)

i.e. p2 k+1 =p2k+2ry2xk+1 -2rx2yk+1+rx2

即p2 k + 1 = p2 k + 2r y 2 x k + 1 -2r x 2 y k + 1 + r x 2

  1. Now determine the symmetric points in another three quadrants.

现在确定另外三个象限中的对称点。

  1. Plot the coordinate value as: x=x+x c , y=y+yc

将坐标值绘制为: x = x + x c ,y = y + y c

  1. Repeat the steps for region 1 until 2r y2x>=2rx2y.

对区域1重复上述步骤,直到2r y 2 x> = 2r x 2 y为止。

翻译自: https://www.includehelp.com/basics/ellipse-algorithm.aspx

计算机图形学椭圆

全部评论 (0)

还没有任何评论哟~