已阅读5页,还剩6页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
计算机科学与技术学院计算机科学与技术学院 天津理工大学天津理工大学 计算机科学与技术学院计算机科学与技术学院 实验报告实验报告 2015 至至 2016 学年学年 第第 二二 学期学期 课程名称课程名称计算机图形学计算机图形学 学号学号学生姓名学生姓名年级年级 专业专业课程号课程号实验地点实验地点 实验时间实验时间 主讲教师主讲教师 辅导教师辅导教师 计算机科学与技术学院计算机科学与技术学院 2 实验 实验 三三 实验名称实验名称几何变换几何变换 软件环境软件环境 Visual Studio 2010 OSG 3 1 0 Windows 7 硬件环境硬件环境 2G 内存 显卡 GT610 CPU 奔腾双核 硬盘 320G 实验目的实验目的 1 掌握平移变换 放缩变换 旋转变换 错切变换 对称变换和复合变换的基 本原理 2 掌握 OpenGL OpenSceneGraph 变换矩阵的操作方法 3 掌握组合变换原理 实验内容 应包括实验题目 实验要求 实验任务等 实验内容 应包括实验题目 实验要求 实验任务等 实验题目 实验题目 1 起重设备工作时的运动过程 2 人的行走 奔跑等运动过程 3 以上任选一 实验要求 实验要求 1 实现人机交互功能 键入不同的键可实现不同部分的运动 模型的形状和结 构自行设计 雷同视为抄袭 2 提交电子版实验报告及工程代码 试验报告模板可参考计算机学院统一模板 3 提交的工程代码必须删除其中的 Debug 或 Release 文件夹 计算机科学与技术学院计算机科学与技术学院 3 实验过程与实验结果 可包括实验实施的步骤 算法描述 流程 结论等 实验过程与实验结果 可包括实验实施的步骤 算法描述 流程 结论等 计算机科学与技术学院计算机科学与技术学院 4 节点模型 节点模型 实验步骤 实验步骤 1 在纸上绘制草图 建立三维坐标系 并在坐标系中确定机器人各部分的大 小 及坐标 为机器人确定好空间状态 2 创建MatrixTransform 根节点及身体各部分的MatrixTransform子节点 各子节 点 下的 Geode 节点 3 对身体各部分基本图形进行绘制 并调整其状态 4 建立键盘事件 对不同的按键处理不同的操作 主要为前进 后退 转身 5 将程序各部分组合在一起形成完整的程序 实验结果实验结果 Group MatrixTransform MatrixTr ansform Head MatrixTr ansform body MatrixTr ansform left arm MatrixTra nsform right arm MatrixTr ansform left leg MatrixTran sform right leg GeodeGeodeGeodeGeodeGeodeGeode 头脖子身体右臂左臂右腿左腿 计算机科学与技术学院计算机科学与技术学院 5 附录 可包括源程序清单或其它说明 附录 可包括源程序清单或其它说明 源代码 源代码 include include include include include include include include 计算机科学与技术学院计算机科学与技术学院 6 include include include osg ref ptr root Tr new osg MatrixTransform osg ref ptr head Tr new osg MatrixTransform osg ref ptr body Tr new osg MatrixTransform osg ref ptr left arm Tr new osg MatrixTransform osg ref ptr right arm Tr new osg MatrixTransform osg ref ptr left leg Tr new osg MatrixTransform osg ref ptr right leg Tr new osg MatrixTransform class UseEventHandler public osgGA GUIEventHandler private float angle1 float angle float move float scale int singal public UseEventHandler angle1 0 angle 0 move 1 scale 1 singal 0 static void rotate float angle osg MatrixTransform joint osg Matrix zRot zRot makeRotate angle 1 0 0 0 0 0 joint setMatrix zRot joint getMatrix virtual bool handle const osgGA GUIEventAdapter if ea getKey w if singal 0 left leg Tr setMatrix osg Matrix translate 1 5 0 8 osg Matrix rotate angle osg Vec3 1 0 0 osg Matrix translate 1 5 0 8 osg Matrix translate 0 move 0 else if singal 1 body Tr setMatrix osg Matrix translate 0 move 0 head Tr setMatrix osg Matrix translate 0 move 0 left arm Tr setMatrix osg Matrix translate 0 move 0 right arm Tr setMatrix osg Matrix translate 0 move 0 left leg Tr setMatrix osg Matrix translate 1 5 0 8 osg Matrix rotate angle osg Vec3 1 0 0 osg Matrix translate 1 5 0 8 left leg Tr setMatrix osg Matrix translate 0 move 0 right leg Tr setMatrix osg Matrix translate 0 move 0 singal singal 2 move else if ea getKey s if singal 0 right leg Tr setMatrix osg Matrix translate 1 5 0 8 osg Matrix rotate angle osg Vec3 1 0 0 osg Matrix translate 1 5 0 8 osg Matrix translate 0 move 0 计算机科学与技术学院计算机科学与技术学院 8 else if singal 1 body Tr setMatrix osg Matrix translate 0 move 0 head Tr setMatrix osg Matrix translate 0 move 0 left arm Tr setMatrix osg Matrix translate 0 move 0 right arm Tr setMatrix osg Matrix translate 0 move 0 left leg Tr setMatrix osg Matrix translate 1 5 0 8 osg Matrix rotate angle osg Vec3 1 0 0 osg Matrix translate 1 5 0 8 left leg Tr setMatrix osg Matrix translate 0 move 0 right leg Tr setMatrix osg Matrix translate 0 move 0 singal singal 2 move else if ea getKey a angle1 osg PI 2 root Tr setMatrix osg Matrix rotate angle1 osg Vec3 0 0 1 else if ea getKey d angle1 osg PI 2 root Tr setMatrix osg Matrix rotate angle1 osg Vec3 0 0 1 return true break default break return false 计算机科学与技术学院计算机科学与技术学院 9 osg Group createPerson osg ref ptr node new osg Node osg ref ptr group new osg Group group addChild root Tr get osg ref ptr head new osg Geode head Tr addChild head get osg ref ptr body new osg Geode body Tr addChild body get osg ref ptr left arm new osg Geode 左 胳膊 left arm Tr addChild left arm get osg ref ptr right arm new osg Geode 右胳 膊 right arm Tr addChild right arm get osg ref ptr left leg new osg Geode 左腿 left leg Tr addChild left leg get osg ref ptr right leg new osg Geode 右腿 right leg Tr addChild right leg get root Tr addChild head Tr get root Tr addChild body Tr get root Tr addChild left arm Tr get root Tr addChild right arm Tr get root Tr addChild left leg Tr get 计算机科学与技术学院计算机科学与技术学院 10 root Tr addChild right leg Tr get osg ref ptr head sp new osg Sphere osg Vec3 0 0 0 20 2 osg ref ptr head ShapeDrawable new osg ShapeDrawable head sp get head addDrawable head ShapeDrawable get osg ref ptr eye1 sp new osg Sphere osg Vec3 0 7 1 7 21 0 5 osg ref ptr eye1 ShapeDrawable new osg ShapeDrawable eye1 sp get head addDrawable eye1 ShapeDrawable get osg ref ptr eye2 sp new osg Sphere osg Vec3 0 7 1 7 21 0 5 osg ref ptr eye2 ShapeDrawable new osg ShapeDrawable eye2 sp get head addDrawable eye2 ShapeDrawable get osg ref ptr ear1 sp new osg Sphere osg Vec3 0 1 7 20 0 5 osg ref ptr ear1 ShapeDrawable new osg ShapeDrawable ear1 sp get head addDrawable ear1 ShapeDrawable get osg ref ptr head Cylinder new osg Cylinder osg Vec3 0 0 18 1 2 osg ref ptr cylinderDrawable new osg ShapeDrawable head Cylinder get head addDrawable cylinderDrawable osg ref ptr body Shape new osg ShapeDrawable new osg Box osg Vec3 0 0f 0 0f 13 0f 6 0f 3 0f 8 0f body addDrawable body Shape get osg ref ptr left arm shape new osg Cylinder osg Vec3 4 0 14 1 6 osg ref ptr left arm Drawable new osg ShapeDrawable left arm shape get left arm addDrawable left arm Drawable osg ref ptr right arm shape new osg Cylinder osg Vec3 4 0 14 1 6 osg ref ptr right arm Drawable new 计算机科学与技术学院计算机科学与技术学院 11 osg ShapeDrawable right arm shape
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 英语阅读竞赛培训试题及答案解析
- 安全生产中毒事故应对培训试题及答案
- DB15-T 353.9-2020 建筑消防设施检验规程 第9部分:防火门、防火卷帘系统
- 2025年物业管理师专业素养考查试题及参考答案
- (人教A版)必修第二册高一数学下册期末复习训练专题17 事件的相互独立性(解析版)
- 讲解员考试题及答案
- 记账实操-水利建设基金账务处理 SOP
- 咖啡厂设施建设与安装方案
- 护理学妇产科试题及答案
- 2025年人力资源管理师资格考试试题及答案
- 专题03 地球上的大气+三年(2023-2025)高考政治真题分类汇编(全国适用)(解析版)
- 民事检察业务培训课件
- 铁路防寒过冬知识培训
- 项目报批报建全流程解析
- 废弃晶体硅及钙钛矿光伏组件回收研究
- 2026届北京市育英学校高二化学第一学期期中统考试题含解析
- 医院三大中心建设
- 急性附睾炎护理查房
- 赤眼蜂防治水稻二化螟技术
- 江苏省盐城市龙冈共同体市级名校2026届中考冲刺卷物理试题含解析
- 2025年总助面试题目及答案
评论
0/150
提交评论