计算机图形学画线

计算机图形学| 直接使用线方程 (Computer Graphics | Direct Use of Line Equation)

The standard line equation, as we all know is used for drawing a line. It is given by: y = mx + c.

众所周知,标准线方程式用于绘制线。 由下式给出: y = mx + c

We are discussing here in 2D so we all know that there are 2 axes: x and y. Both of the axes are required to give the equation of any 2D shape. The line is a straight path joining 2 points in the x-y plane. If both the points are given then we can find the equation of a line.

我们在这里以2D进行讨论,所以我们都知道有2个轴: xy 。 需要两个轴都可以给出任何2D形状的方程。 该线是连接xy平面中2个点的直线路径。 如果两个点都给出,那么我们可以找到一条线的方程。

直线的斜率 (The slope of a line)

The slope of a line defines the direction of a line. Its value is equal to the ratio of the difference of y coordinates and the difference. Assume that the two points are X( x1,y1 ) and Y( x2,y2 ). Its slope, 'm' will be: m = (y2 - y1) / (x2 - x1).

线的斜率定义了线的方向。 它的值等于y坐标差与差之比。 假设这两个点是X(x1,y1)Y(x2,y2) 。 它的斜率'm'将是: m =(y2-y1)/(x2-x1)

线描算法的性质 (Properties of Line Drawing Algorithm)

The following are the properties that a line must hold in any line drawing algorithm,

以下是任何线图绘制算法中线必须具有的属性,

  1. Line must be straight

    线必须是直的

  2. Line must terminate accurately

    线路必须准确终止

  3. Line must have constant density

    线必须具有恒定的密度

  4. Density must be independent of its length

    密度必须与长度无关

  5. Line must be drawn very fast

    线必须画得很快

线描算法 (Line Drawing Algorithms)

There are some set of rules and steps which help draw a line. These algorithms are given below,

有一些规则和步骤可以帮助您划清界限。 这些算法如下:

  1. Direct Use of line equation

    直接使用线方程

  2. DDA (Digital Differential Analyzer)

    DDA(数字差分分析仪)

  3. Bresenham's Algorithm

    布雷森纳姆算法

直接使用线方程 (Direct use of Line Equation)

This is the simplest form of drawing a line. We all know that the equation of the line is y = mx + c. Here m is slope and c is the length from origin to the point where the line cuts y-axis. In this method, we will be having the start and endpoint of the line and by the help of that points, we'll calculate the other points which lie on the line. We have to find the slope of the line by using the given points.

这是画线的最简单形式。 我们都知道直线的方程是y = mx + c 。 这里的m是斜率, c是从原点到直线切割y轴的点的长度。 在这种方法中,我们将获得直线的起点和终点,并借助这些点,计算出直线上的其他点。 我们必须使用给定的点找到线的斜率。

We'll understand this better with the help of an example,

我们将通过一个示例来更好地理解这一点,

Example:

例:

We have given two points X and Y. The coordinates of X are (0, 0) and the coordinates of Y are (5, 15). The slope of the line will be,

我们给出了XY两点。 X的坐标为(0,0)Y的坐标为(5,15) 。 线的斜率是

    m = (15 - 0) / (5-0)
m = 3

We have the slope of the line. Now let us put the slope in the line equation.

我们有直线的斜率。 现在让我们将斜率放在线方程中。

    y = 3x + c

Origin point is (0,0). So,

原点是(0,0)。 所以,

    c = 0

Putting c=0 in the above equation.

将c = 0放在上式中。

    y = 3x

Now we will calculate the intermediate points.

现在我们将计算中间点。

    Let x = 1 ⟹ y = 3 x 1 ⟹ y = 3
Let x = 2 ⟹ y = 3 x 2 ⟹ y = 6
Let x = 3 ⟹ y = 3 x 3 ⟹ y = 9
Let x = 4 ⟹ y = 3 x 4 ⟹ y = 12
Let x = 5 ⟹ y = 3 x 5 ⟹ y = 15

We got the intermediate points which are, (1, 3), (2, 6), (3, 9), (4, 12) and finally (5, 15)

我们得到的中间点是(1、3),(2、6),(3、9),(4、12),最后是(5、15)

Now we'll plot these points on the graph.

现在,我们将这些点绘制在图形上。

Hence, we have plotted the points that lie between the given points through the standard line equation. By doing so with a very small gap between these pints will give us the entire line.

因此,我们通过标准线方程式绘制了位于给定点之间的点。 这样,这些品脱之间的间隙很小,就可以给我们整条生产线。

翻译自: https://www.includehelp.com/computer-graphics/direct-use-of-line-equation.aspx

计算机图形学画线

计算机图形学画线_在计算机图形学中直接使用线方程相关推荐

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

    计算机图形学 顶点定义 After studying the implementation of lines in computer graphics, we will now be dealing ...

  2. 计算机图形学画圆vc代码,计算机图形学实验--完整版-带结果--vc++实现.doc

    计算机图形学实验--完整版-带结果--vc实现 计算机图形学实验报告 信息学院计算机专业 20081060183 周建明 综括: 利用计算机编程语言绘制图形,主要实现以下内容: (1).中点算法生成任 ...

  3. 用计算机图形学画一个小球移动,计算机图形学-三维物体的平移、旋转、防缩...

    /* 矩阵初始化,正对角线上设为1,其余为0 */ void Matrix4x4SetIdentity(Matrix4x4 matIdent4x4) { GLint row, col; for (ro ...

  4. 计算机图形学中向量点乘和叉乘的用途_图形学笔记(一):基础知识

    从这便文章开始整理学习到的计算机图像学相关知识,原则是只写我没在网上找到清楚解释的内容,如果有很好的文章介绍相关内容,我会直接把链接贴上. 首先弄清 Computer Graphics和 Comput ...

  5. 计算机图形什么叫参数连续性,计算机图形学3-中国大学mooc-题库零氪

    第一讲 计算机图形学概论 第一周测验题 1.显示颜色64K,分辨率为1024*1024的显示器,至少需要的帧缓存容量为 A.2MB B.1MB C.3MB D.512KB 2.在下列有关显示器的叙述中 ...

  6. 《 线性代数及其应用 (原书第4版)》—— 2.7 计算机图形学中的应用

    本节书摘来自华章出版社< 线性代数及其应用 (原书第4版)>一书中的第2章,第2.7节,作者:(美)戴维C. 雷(David C. Lay)马里兰大学帕克学院 著刘深泉 张万芹 陈玉珍 包 ...

  7. 欧拉公式在计算机图形学中的,计算机图形学 第九章课件.ppt

    <计算机图形学 第九章课件.ppt>由会员分享,提供在线免费全文阅读可下载,此文档格式为ppt,更多相关<计算机图形学 第九章课件.ppt>文档请在天天文库搜索. 1.甘朝华第 ...

  8. 请简述gouraud光照模型_《计算机图形学》试卷及答案

    一.填空题(每空0.5分,共 1 0 分) 1. 计算机图形学中的图形是指由点.线.面.体等 和明暗.灰度(亮度).色 彩等 构成的,从现实世界中抽象出来的带有灰度.色彩及形状的图或形. 2. 一个计 ...

  9. 计算机图形学中需要掌握的数学基础知识有哪些?

    计算机图形学中使用了大量数学知识,尤其是矩阵和线性代数.虽然我们倾向于认为3D图形编程是紧跟最新技术的领域之一(它在很多方面确实是),但它用到的很多技术实际上可以追溯到上百年前,其中一些甚至是由文艺复 ...

最新文章

  1. 如何为计算机视觉任务选择正确的标注类型
  2. Android复习07【创建数据库、insert()插入数据、查看数据库、根据列索引获取参数值、根据列名-返回索引、增删改查数据、数据分页、修改表结构、Room框架】
  3. 关于重写equals()与hashCode()
  4. python中int是什么的缩写_python中int是什么类型
  5. Oracle收购Sun
  6. webpack之react开发前准备
  7. 我的css家园博客开通了
  8. 忆芯科技发布新一代国产主控芯片STAR1000P!4月完成量产版本
  9. Vue开发环境搭建详解
  10. 软考中级软件设计师——数据库系统
  11. 两步路轨迹文件位置_关于两步路
  12. 信息系统项目管理师考试经验和心得
  13. mac M1安装SVN错误Error: Command failed with exit 128: git
  14. 未来的计算机能帮人类炒股,未来计算机能帮人类炒股吗
  15. Set与List的前辈是Collection,Map自成一派
  16. Visual Studio 2019的安装教程
  17. 已知含税单价、税率、数量,计算不含税单价、不含税金额、税额
  18. 输入电阻值,计算出并联电阻、串联电阻
  19. 【微信】h5跳转微信小程序
  20. ArrayIndexOutOfBoundsException数组下标越界异常的解决过程

热门文章

  1. Web安全-伪静态网页
  2. JS文件信息收集工具-LinkFinder
  3. flex弹性布局操练2
  4. option标签selected=selected属性失效的问题
  5. 统计一个panel中lable的个数
  6. break、continue、return的区别
  7. python web开发-flask访问请求数据request
  8. spark SQL(三)数据源 Data Source----通用的数据 加载/保存功能
  9. Scikit-Learn机器学习入门
  10. C# DataRow数组转换为DataTable