对任意三角形或平行四边形对任意轴y=ax+b做对称_第1页
对任意三角形或平行四边形对任意轴y=ax+b做对称_第2页
对任意三角形或平行四边形对任意轴y=ax+b做对称_第3页
对任意三角形或平行四边形对任意轴y=ax+b做对称_第4页
对任意三角形或平行四边形对任意轴y=ax+b做对称_第5页
已阅读5页,还剩12页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

人机接口与计算机图形学大作业人机接口与计算机图形学大作业 课程名称 人机接口与计算机图形学 学院名称 计算机工程学院 专 业 计算机科学与技术 班 级 xxxxxxx 学 号 xxxxxxxx 姓 名 xxxxx 教师姓名 xxxxx 学 分 3 成 绩 2014 年 5 月 JIANGSU UNIVERSITY OF TECHNOLOGY 对任意三角形或平行四边形对任意轴对任意三角形或平行四边形对任意轴 y ax b 做对称 反射 变换 做对称 反射 变换 1 程序 include include include using namespace std void polygon void Middle Bresenham int int int int void move to zero b void axis of symmetry void positive rotate void reverse rotate void give change to x direction void recovery int ax 100000 ay 100000 cx 100000 cy 100000 int length 0 temp temp1 int max x min x int a b int main polygon move to zero b positive rotate give change to x direction reverse rotate recovery return 0 void recovery ofstream out d polygon symmetry6 txt out x for int i 0 i length i out ax i out ax i 1 out endl out y for int j 0 j length j out ay j b out ay j 1 b endl out plot x y endl out hold on endl out x1 for i temp i temp1 i out ax i out ax i 1 out endl out y1 for j temp j temp1 j out ay j b out ay j 1 b endl out plot x1 y1 endl out hold on endl out x2 for i 0 i length i out cx i out cx i 1 out endl out y2 for j 0 j length j out cy j out cy j 1 endl out plot x2 y2 endl void reverse rotate ofstream out d polygon symmetry5 txt out x int bx 100000 for int i 0 i length i bx i ax i ax i ax i cos atan a ay i sin atan a out ax i out ax i 1 out endl out y for int j 0 j length j ay j bx j sin atan a ay j cos atan a out ay j out ay j 1 endl out plot x y endl out hold on endl out x1 for i temp i temp1 i bx i ax i ax i ax i cos atan a ay i sin atan a out ax i out ax i 1 out endl out y1 for j temp j temp1 j ay j bx j sin atan a ay j cos atan a out ay j out ay j 1 endl out plot x1 y1 endl void give change to x direction ofstream out d polygon symmetry4 txt out x for int i 0 i length i out ax i out ax i 1 out endl out y for int j 0 j length j ay j ay j out ay j out ay j 1 endl out plot x y endl out hold on endl out x1 for i temp i temp1 i out ax i out ax i 1 out endl out y1 for j temp j temp1 j ay j ay j out ay j out ay j 1 endl out plot x1 y1 endl void positive rotate ofstream out d polygon symmetry3 txt out x int bx 100000 for int i 0 i length i bx i ax i ax i ax i cos atan a ay i sin atan a out ax i out ax i 1 out endl out y for int j 0 j length j ay j bx j sin atan a ay j cos atan a out ay j out ay j 1 endl out plot x y endl out hold on endl out x1 for i temp i temp1 i bx i ax i ax i ax i cos atan a ay i sin atan a out ax i out ax i 1 out endl out y1 for j temp j temp1 j ay j bx j sin atan a ay j cos atan a out ay j out ay j 1 endl out plot x1 y1 endl void move to zero b ofstream out d polygon symmetry2 txt out x for int i 0 i length i out ax i out ax i 1 out endl out y for int j 0 j length j ay j b out ay j out ay j 1 endl out plot x y endl out hold on endl out x1 for i temp i temp1 i out ax i out ax i 1 out endl out y1 for j temp j temp1 j ay j b out ay j out ay j 1 endl out plot x1 y1 endl void axis of symmetry cout 输入对称轴 y ax b 中 a 和 b 两个常数 a b min x 400 max x 400 Middle Bresenham min x a min x b max x a max x b void polygon int n cout 输入想要生成多边形的边数 n cout 按多边形的顺时针方向输入顶点坐标 point x point y tempx point x tempy point y max x min x point x for int i 1 i point x point y if point x max x max x point x if point x min x min x point x Middle Bresenham temp x temp y point x point y Middle Bresenham point x point y tempx tempy ofstream out d polygon symmetry1 txt out x for i 0 i length i cx i ax i out ax i out tempx out endl out y for int j 0 j length j cy j ay j out ay j out tempy endl out plot x y endl out hold on endl temp length axis of symmetry out x1 for i temp i length i out ax i out ax i 1 out endl out y1 for j temp j length j out ay j out ay j 1 endl out plot x1 y1 x1 1 1 int s2 y2 y1 1 1 bool interchange false if dy dx int temp dx dx dy dy temp interchange true int p 2 dy dx for int i 0 i 0 if interchange y s2 else x s1 p 2 dx if interchange x s1 else y s2 p 2 dy 2 步骤 A 输入一个平行四边形的四个坐标 100 150 250 400 750 400 600 150 B 用中点 Bresenham 算法 每两个点生成一条直线 C 输入要生成的多边形的边数 顶点坐标 任意轴的参数设定 a b 的取值 a b 的取值为 5 520 对 a b 数值的设定为

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论