450 likes | 601 Views
Chapter 3 the foundation of Computer graphics. 教学要求和教学提示. 教学提示: 本章主要介绍计算机绘图软件的类型和功能、绘图程序的基本设计方法、图形软件标准和图形变换 ( 二维图形和三维图形的几何变换 教学要求: 了解计算机绘图系统的类型及组成 掌握图形变换(比例、对称、错切、平移、旋转、复合变换等)的原理和方法 了解常用自由曲线. Contents. 1.Outline of computer drawing 2.Computer drawing software 3.Coordinate system
E N D
Chapter 3 the foundation of Computer graphics
教学要求和教学提示 教学提示: • 本章主要介绍计算机绘图软件的类型和功能、绘图程序的基本设计方法、图形软件标准和图形变换(二维图形和三维图形的几何变换 教学要求: • 了解计算机绘图系统的类型及组成 • 掌握图形变换(比例、对称、错切、平移、旋转、复合变换等)的原理和方法 • 了解常用自由曲线 上理机械 吴恩启
Contents • 1.Outline of computer drawing • 2.Computer drawing software • 3.Coordinate system • 4.Graphics transformation • 5.Transform of 3D graphics • 6.Projection transform of 3D graphics • 7.Free form curve and surface 上理机械 吴恩启
3.1 Outline of computer drawing • 计算机绘图是CAD/CAM的重要组成部分。 • 其发展有力地推动了CAD/CAM的研究和应用,为CAD/CAM提供了高效的工具和手段; • CAD/CAM的发展又不断提出新的要求和设想,其中包括对计算机绘图的要求 • 因此CAD/CAM的发展与计算机绘图的发展有着密不可分的关系。 Computer drawing is the important part of CAD/CAM. The development of computer drawing powerfully drove the researches and applications of CAD/CAM, and provided highly effective tools and methods for CAD/CAM; in addition, the development of CAD/CAM constantly sets forth new requirements and ideas, including the requirements for computer drawing. Thus, there is a inseparable relationship between the development of CAD/CAM and the development of computer drawing. 上理机械 吴恩启
3.1 Outline of computer drawing Applications: • Mechanics • Architecture • Costume design • Video 上理机械 吴恩启
3.2 Computer drawing software • 计算机绘图软件的主要功能 • Graphic descriptions • Graphic edit and transformation • Graphic control • Graphic files processing • Interactive processing • 可画点、线、圆、圆弧、文本、多边形、椭圆、曲线等 • 能进行几何计算。如求交点、切点等 • 对图形进行删除、修改 • 实现图形的几何变换,如缩放、旋转、投影等 • 显示控制、图形输出控制 • 可将不同方位或不同内容的图形定义成文件进行处理,便于统一调度管理 • 人机界面良好,因为CAD过程是个反复试探、修改的过程 上理机械 吴恩启
3.3 coordinate system class DCS: device coordinate system VDCS: virtual device coordinate system NDCS: normalized device coordinate system WCS: world coordinate system MCS: modeling coordinate system VCS: viewing coordinate system 直角坐标系 仿射坐标系 圆柱坐标系 球坐标系 coordinate system 上理机械 吴恩启
3.3 coordinate system DCS: 用于在图形显示设备上定义图形或窗口的位置。 • 计算机对图形对象进行了必要的处理之后,要将它在图形显示器或者绘图纸上绘制出来,这就要在显示屏幕上或绘图纸上定义一个坐标系,这个坐标系叫做屏幕坐标系或者设备坐标系 • 设备坐标系的z轴垂直于屏幕平面。 • 利用设备坐标系编写图形程序时,在不同显示设备上显示图形是不同的。 上理机械 吴恩启
3.3 coordinate system NDCS and VDCS: • 规格化设备坐标系是直角坐标系,它是将二维的设备坐标系规格化到(0.0,0.0)~(1.0,1.0)的坐标范围内形成的,规范化坐标系保证了观察变换独立于输出设备。其原点常位于显示器左下角,x,y分别指向右方和上方。规格化坐标系是用于定义视图的。 • 虚拟设备坐标系和规格化坐标 系类似,是编写图形程序时采用的。 上理机械 吴恩启
3.3 coordinate system WCS: 用于描述现实世界的整体布局,又称为用户坐标系。 1)直角坐标系,又称笛卡尔坐标系,由一个原点(坐标为(0,0,0))和三个通过原点的、相互垂直的坐标轴构成。分右手坐标系和左手坐标系两种。任一点可用p(x,y,z)表示。 上理机械 吴恩启
3.3 coordinate system 2)仿射坐标系 其三个坐标轴不是相互垂直的 上理机械 吴恩启
3.3 coordinate system 3)圆柱坐标系 用来描述旋转体的形状。 上理机械 吴恩启
3.3 coordinate system 4)球坐标系 上理机械 吴恩启
3.3 coordinate system MCS: 用于描述世界坐标系中每个具体物体的形状,又称为局部坐标系。当物体空间位置发生变化时,由造型坐标系定义的物体上各点的坐标值不变。 上理机械 吴恩启
3.3 coordinate system VCS: 为了在世界坐标系中实现对三维物体的观察而建立的坐标系。 • 有两个主要用途: • 用于指定裁剪空间确定的那一部分形体的显示输出; • 通过定义观察平面,把三维形体的世界坐标变换成规格化的设备坐标 上理机械 吴恩启
3.3 coordinate system Coordinates transform: 上理机械 吴恩启
MCS 造型变换 WCS 观察变换 VCS 投影变换 VDCS DCS 3.3 coordinate system 不同的坐标系之间通过变换矩阵建立联系 上理机械 吴恩启
3.4 Transform of 2D graphics 1.二维图形几何变换的一般表示 将二维空间中的任意点P(x,y)变换到一个新位置,其数学表达为: 矩阵表达 令 ,称该矩阵为变换矩阵 上理机械 吴恩启
3.4 Transform of 2D graphics • 二维基本变换 • 比例变换 • 对称变换 • 旋转变换 • 错切变换 • 平移变换 上理机械 吴恩启
3.4 Transform of 2D graphics 1)比例变换 将原有图形在x、y两个方向上进行放大或缩小的变换,其变换矩阵为: 当 a=d=1,变换为恒等变换,即变换后点的坐标不变 当 a=d≠1,变换为等比例变换,即变换为等比例放大或缩小 当 a ≠ d , 变换后的图形会产生畸变 上理机械 吴恩启
3.4 Transform of 2D graphics 2)对称变换 对称变换又称为镜像变换,主要包括以下几种: • 对x轴的对称变换 • 对y轴的对称变换 • 对直线y = x的对称变换 • 对直线y = -x的对称变换 • 对坐标原点的对称变换 上理机械 吴恩启
3.4 Transform of 2D graphics • 关于x轴的对称变换: x’=x,y’=-y • 变换矩阵为: • 点关于x轴的对称变换为: 上理机械 吴恩启
3.4 Transform of 2D graphics • 关于y轴的对称变换: x’=-x,y’=y • 变换矩阵: • 点关于y轴的对称变换: 上理机械 吴恩启
3.4 Transform of 2D graphics • 关于直线y=x的对称变换: x’= y,y’=x • 变换矩阵: • 点关于直线y=x的对称变换为: 上理机械 吴恩启
3.4 Transform of 2D graphics • 关于直线y=-x的对称变换: x’= -y,y’=-x • 变换矩阵为: • 点关于直线y=-x的对称变换为: 上理机械 吴恩启
3.4 Transform of 2D graphics • 关于坐标原点的对称变换: x’=-x,y’=-y • 变换矩阵为: • 点关于坐标原点的对称变换为: 上理机械 吴恩启
(x’,y’) ρ θ (x,y) α 3.4 Transform of 2D graphics 3)旋转变换: 逆时针方向为正 绕原点旋转的变换矩阵为: 点绕原点旋转的变换为: 上理机械 吴恩启
cy bx 3.4 Transform of 2D graphics 4)错切变换 • 使图形沿错切方向的坐标发生变化,而另一方向的坐标值不变,从而达到使原图形发生特定变化的目的,分为以下两种形式: • 沿x轴方向的错切 • 沿y轴方向的错切 上理机械 吴恩启
cy 3.4 Transform of 2D graphics • 沿x轴方向的错切变换: x’=x+x,y’=y, • 变换矩阵为: • 点沿x轴措切变换 上理机械 吴恩启
bx 3.4 Transform of 2D graphics • 沿y轴方向的错切变换: x’=x,y’=y + y , • 变换矩阵为: • 点沿y轴方向的错切变换为: 上理机械 吴恩启
3.4 Transform of 2D graphics 5)平移变换 x’=x+m y’=y+n • 矩阵表示: • [x’ y’]=[x y]+[m n]=[x y]+Ti • 变换矩阵?? 上理机械 吴恩启
3.4 Transform of 2D graphics 2. 点的齐次坐标表示 所谓齐次坐标表示法就是用n+1维向量表示一个n维向量 [x y] [hx hy h] ; 令 h=1 [x y 1] 齐次坐标的正常化 上理机械 吴恩启
3.4 Transform of 2D graphics • 点的矩阵表达: • 齐次坐标: 上理机械 吴恩启
3.4 Transform of 2D graphics 引入齐次坐标后,可以用一个统一的3X3矩阵来描述包括平移在内的全部二维图形变换,即: 其中: 产生比例、对称、旋转和错切 变换; 产生平移变换; [pq]产生投影变换,通常不做投影变换时取p=0,q=0 [s]为全比例因子,使图形产生总体的比例变化,通常取S=1; 上理机械 吴恩启
Y P’(x’y’) m n P(x,y) X 3.4 Transform of 2D graphics 引入坐标的齐次表示法,各基本变换的矩阵: • 平移变换: 点的平移变换则可用矩阵表示为: 上理机械 吴恩启
3.4 Transform of 2D graphics • 比例变换 a=d=1 a=d>1 a=d<1 a≠d 上理机械 吴恩启
3.4 Transform of 2D graphics • 对称变换 • 以x轴对称 上理机械 吴恩启
3.4 Transform of 2D graphics • 对称变换 • 以y轴对称 上理机械 吴恩启
3.4 Transform of 2D graphics • 对称变换 • 以原点对称 上理机械 吴恩启
3.4 Transform of 2D graphics • 对称变换 • 以y=x直线对称 上理机械 吴恩启
3.4 Transform of 2D graphics • 对称变换 • 以y=-x直线对称 上理机械 吴恩启
cy bx 3.4 Transform of 2D graphics • 错切变换 变换矩阵: 上理机械 吴恩启
3.4 Transform of 2D graphics • 旋转变换 • 逆时针方向为正 上理机械 吴恩启
3.4 Transform of 2D graphics 3.二维组合变换:here ex:一平面图形绕任意点旋转角,求其旋转矩阵 T1 –旋转中心平移到坐标原点的变换矩阵 T2 –绕坐标原点旋转角的变换矩阵 T3 –将旋转中心平移回原位置的变换矩阵 上理机械 吴恩启
3.4 Transform of 2D graphics • 上机作业: • 利用VB语言编写程序:实现矩形绕任意一点的旋转变换 上理机械 吴恩启