计算机图形学 顶点定义_在计算机图形学中定义一个圆

计算机图形学 顶点定义

After studying the implementation of lines in computer graphics, we will now be dealing with how to draw different polygons and shapes using programs, and we will be first starting with the circle.

在研究了计算机图形中线条的实现之后,我们现在将开始处理如何使用程序绘制不同的多边形和形状,并且我们将从圆形开始。

什么是圆? (What is a circle?)

A circle is defined as a set of points that all are the same distance from a common point. The common point is known as the center and the distance from the center of the circle to any point on its circumference is called the radius.

圆定义为一组点,这些点到一个公共点的距离都相同。 公共点称为圆心,从圆心到圆周上任意点的距离称为半径。

It is an eight-way symmetric figure which can be divided into four quadrants and each quadrant has two octants. This symmetry helps in drawing a circle on a computer by knowing only one point of any octant.

它是一个八向对称图形,可以分为四个象限,每个象限有两个八分之一。 这种对称性有助于通过仅知道任何八分圆点的一点来在计算机上绘制圆。

Circle 1

如何在计算机图形学中定义一个圆? (How to define a circle in computer graphics?)

There are two methods to define a circle in computer graphics, namely:

有两种方法可以在计算机图形学中定义圆 ,即:

  1. Direct or Polynomial method and

    直接或多项式方法

  2. Polar coordinates method

    极坐标法

Let us have a look at both these methods and learn about them in brief.

让我们看一下这两种方法并简要了解它们。

1.直接或多项式方法 (1. Direct or Polynomial Method)

In this method, a circle is defined with the help of a polynomial equation i.e.

在这种方法中,借助多项式方程定义圆,即

    (x - xc)2  + (y - yc)2  =  r2

Where, (xc, yc) are coordinates of circle and r is radius of circle.

其中, (x c ,y c )是圆的坐标, r是圆的半径。

For each value of x, value of y can be calculated using,

对于x的每个值,可以使用以下公式计算y的值:

    y = yc ± √r2 – (x - xc)2

The initial points will be: x = xc – r, and y = yc

初始点将是: x = x c – r ,并且y = y c

This is a very ineffective method because for each point value of xc, x and r are squared and then subtracted and then the square root is calculated, which leads to high time complexity.

这是一种非常无效的方法,因为对于x c的每个点值,将xr平方,然后相减,然后计算平方根,这会导致较高的时间复杂度。

2.极坐标法 (2. Polar coordinates Method)

In this method, the coordinates are converted into polar coordinates. The coordinates are thus given by:

在这种方法中,将坐标转换为极坐标。 因此,坐标由下式给出:

    x = r cosθ              ...(1)
    y = r sinθ              ...(2)
    r = radius
    Where, θ = current angle

circle 2

For the first octant i.e. from θ = 00 to θ = 450,

对于第一个八分圆,即从θ= 0 0到θ= 45 0

The values of x and y are calculated using equations (1) and (2).

使用等式(1)和(2)计算x和y的值。

Simultaneously, all the eight points for the rest of the octants can be calculated using the eight-way symmetry property of the circle.

同时,可以使用圆的八向对称性来计算其余八分圆的所有八个点。

Then, the plotting of the circle is done.

然后,绘制圆。

We will study this plotting through various algorithms in the upcoming sections.

在接下来的部分中,我们将通过各种算法研究该绘图。

翻译自: https://www.includehelp.com/computer-graphics/defining-a-circle.aspx

计算机图形学 顶点定义

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值