博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
计算机图形学 顶点定义_在计算机图形学中定义一个圆
阅读量:2535 次
发布时间:2019-05-11

本文共 2659 字,大约阅读时间需要 8 分钟。

计算机图形学 顶点定义

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.

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

翻译自:

计算机图形学 顶点定义

转载地址:http://scvzd.baihongyu.com/

你可能感兴趣的文章
小D课堂 - 零基础入门SpringBoot2.X到实战_第8节 数据库操作之整合Mybaties和事务讲解_34、SpringBoot整合Mybatis实操和打印SQL语句...
查看>>
小D课堂 - 零基础入门SpringBoot2.X到实战_第8节 数据库操作之整合Mybaties和事务讲解_36、SpringBoot整合mybatis之事务处理实战...
查看>>
小D课堂 - 零基础入门SpringBoot2.X到实战_第8节 数据库操作之整合Mybaties和事务讲解_35、事务介绍和常见的隔离级别,传播行为...
查看>>
小D课堂 - 零基础入门SpringBoot2.X到实战_第9节 SpringBoot2.x整合Redis实战_40、Redis工具类封装讲解和实战...
查看>>
小D课堂 - 零基础入门SpringBoot2.X到实战_第9节 SpringBoot2.x整合Redis实战_37、分布式缓存Redis介绍...
查看>>
小D课堂 - 零基础入门SpringBoot2.X到实战_第10节 SpringBoot整合定时任务和异步任务处理_42、SpringBoot常用定时任务配置实战...
查看>>
小D课堂 - 零基础入门SpringBoot2.X到实战_第9节 SpringBoot2.x整合Redis实战_39、SpringBoot2.x整合redis实战讲解...
查看>>
小D课堂 - 零基础入门SpringBoot2.X到实战_第14节 高级篇幅之SpringBoot多环境配置_59、SpringBoot多环境配置介绍和项目实战...
查看>>
小D课堂 - 零基础入门SpringBoot2.X到实战_第10节 SpringBoot整合定时任务和异步任务处理_41、SpringBoot定时任务schedule讲解...
查看>>
小D课堂 - 零基础入门SpringBoot2.X到实战_第10节 SpringBoot整合定时任务和异步任务处理_43、SpringBoot2.x异步任务实战(核心知识)...
查看>>
小D课堂 - 新版本微服务springcloud+Docker教程_1_01课程简介
查看>>
小D课堂 - 零基础入门SpringBoot2.X到实战_第11节 Logback日志框架介绍和SpringBoot整合实战_45、SpringBoot2.x日志讲解和Logback配置实战...
查看>>
小D课堂 - 新版本微服务springcloud+Docker教程_1_02技术选型
查看>>
小D课堂 - 新版本微服务springcloud+Docker教程_汇总
查看>>
小D课堂 - 新版本微服务springcloud+Docker教程_2_01传统架构演进到分布式架构
查看>>
小D课堂 - 新版本微服务springcloud+Docker教程_2_02 微服务核心基础讲解
查看>>
小D课堂 - 新版本微服务springcloud+Docker教程_2_04微服务下电商项目基础模块设计...
查看>>
小D课堂 - 新版本微服务springcloud+Docker教程_3-01 什么是微服务的注册中心
查看>>
小D课堂 - 新版本微服务springcloud+Docker教程_3-03CAP原理、常见面试题
查看>>
小D课堂 - 新版本微服务springcloud+Docker教程_3-04 SpringCloud微服务核心组件Eureka介绍和闭源后影响...
查看>>