`
bulote
  • 浏览: 1353908 次
文章分类
社区版块
存档分类
最新评论

优秀课件笔记之2D Viewing

 
阅读更多

1、本文所以内容来自 著名高校课件和学生笔记(校园里面经常见到有人高价买笔记)
2、任课教师不会提供参考文献,所以只能对作者表示感谢,如果引用了您的作品,可以用回复方式补充参考文献。
3、我不对文章无关问题进行解答,文章内容也比较难,我也很难解答您遇到的问题,如果发现BUG可以用回复方式帮我修正。
4、本课 属于Computer Graphics
,适用于计算机图形学课程,教材为电子工业出版社Computer Graphics(计算机图形学,中文版和英文版)
本课其他部分的导航条见页面底部

Chapter 6 2D Viewing
2D Viewing Pipeline

The mapping of a 2D, world-coordinate scene description to device coordinate is called a 2D viewing transformation .
Sometimes this transformation is simplified as the window-to-viewport transformation.
§6.2 The Clipping Window

We could define our clipping window with any shape, size and direction.
But graphics library commonly allow rectangle clipping windows aligned with the x and y axes.
Rectangular clipping windows in standard positions are easily defined by giving the coordinates of two opposite corners.
Viewing-Coordinate Clipping Window

When the clipping window is any rectangle in world coordinate, we use Translation and Rotate transformation to convert it.

§6.3 Normalization and View-Port Transformations

We first consider a view-port defined with normalized coordinate values between 0 and 1.
§6.4 OpenGL 2D Viewing Functions

Actually the basic OpenGL library has no functions specifically for 2D viewing.
But we can adapt the 3D viewing routines to a 2D scene.
In addiction, the GLU library does provide a 2D function for specifying the clipping window, and we have GLUT function for handling display windows.

OpenGL Projection Mode(投影模式)

For 2D viewing, we first select the projection mode.
glMatrixMode (GL_PROJECTION);
// designate the projection matrix as the current matrix
If we are going to loop back through this statement for other views of a scene, we can also set the initialization as:
glLoadIndentity ( );
// designate the identity as the current matrix
GLU Clipping-Window Function

To define a 2D clipping window,
gluOrtho2D (Xwmin, Xwmax, Ywmin, Ywmax);
The parameters are double numbers.
If this function is not invoked, the default coordinates are:

OpenGL View-Port Function

We specify the view-port parameters with the OpenGL function:
glViewport (Xvmin, Yvmin, vpWidth, vpHeight);
Where all parameters values are given in integer screen coordinates relative to the display window.
If this function is not invoked, the default viewport size and position are the same as the size and position of the display window.
Get View-Port Parameters

Multiple view-ports can be created in OpenGL for a variety of applications.
We can obtain the parameters for the currently active view-port:
glGetInterv ( GL_VIEWPORT, vpArray);
Where vpArray is a single-subscript, 4-element array.
This Get function returns the parameters for the current view-port to vpArray with the order Xvmin, Yvmin, vpWidth, vpHeight.
Creating a GLUT Window

glutInit (&argc, argv); // initialize GLUT
glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
//single frame and RGB color mode
glutInitWindowPosition ( 50, 100);
// position of the window
glutInitWindowSize ( 400, 300); // size of the window
glutCreateWindow(“Hello");
// create the window named “Hello”
glClearColor ( Red, Green, Blue, Alpha );
// set the background color
GLUT Display-Window Identifier

Multiple display windows can be created for an application, and each is assigned a positive-integer display-window identifier, starting with 1 for the first window.
We can get its identifier with the statement:
windowID = glutCreateWindow ( “Hello” );
Once we have saved the ID of a display window, we can change the window through the ID.
Deleting a GLUT Display-Window

We can delete a display window using
glDestroyWindow ( windowID );
Current GLUT Display-Window

All display-window operations are applied to the current display window .
The current window is defaulted as the last created window.
Or we can select with:
glSetWindow ( windowID );
We can query the current window:
currentWindowID = glGetWindow ( );
Relocating and Resizing a GLUT Display-Window

glutPositionWindow ( xNewTopLeft, yNewTopLeft); // Relocating the current window
glutReshapeWindow ( dwNewWidth, dwNewHeight);
// Resizing the current window
glutReshapeFunc ( winReshapeFcn);
// Reshaping the current window when it is resized // by the interactive input
// There winReshapeFcn is a callback function
Managing Multiple GLUT Windows

glutInIconifyWindow ( );
// Convert the current window to an icon
glutSetIconTitle ( “Icon Name”); // Rename the icon
glutSetWindow ( WindowID ); glutPopWindow ( );
// put a window in front of any other windows
glutSetWindow ( WindowID ); glutPushWindow ( );
// put a window back of any other windows
glutHideWindow ( );
// take the current window off the screen
glutShowWindow ( ); // Re-display a window
GLUT Subwindows

glutCreateSubWindow ( windowID, xBottomLeft, yBottomLeft, width, height );
// where windowID identify the display window
in which we want to set up the subwindow.
we reshape, reposition, push, pop, hide and show subwindows, but we can NOT convert a subwindow to an icon.
Selecting a Display-Window Cursor

glutSelectCursor ( shape );
// where shape is a constant which identify the shape of cursor
GLUT_CURSOR_UP_DOWN: an up-down, bi-direction arrow
GLUT_CURSOR_CYCLE: a rotating arrow
GLUT_CURSOR_WAIT: a wrist watch
GLUT_CURSOR_DESTROY: a skull and crossing bones
Executing the Application Program
glutMainLoop ( );
// The last command.
// After this command, display window and their graphics contents are sent to the screen.
// The program also enters the GLUT processing loop.
Viewing Graphics Objects in a GLUT Display Window

glutDisplayFUnc ( pictureDescription );
// where pictureDescription is a callback function which describe the object
§6.5 Clipping Algorithms

Generally, any procedure that eliminates those portions of a picture that are either inside or outside of a specified region is referred to as a clipping algorithm , or simplify clipping.
Point Clipping
Line Clipping ( straight-line segments )
Fill-Area Clipping ( polygons )
Curve Clipping
Text Clipping
§6.6 2D Point Clipping

For a clipping rectangle in standard position, we save a 2D point for display if the following inequalities(不等式) are satisfied:
Point clipping can be used in particular models, such as clouds, sea foam(泡沫), smoke etc.
§6.7 2D Line Clipping

The following figure illustrates possible positions for straight-line segments in relationship to a standard clipping window:
2D Line Clipping Algorithm

A line clipping algorithm processes each line to determine whether the line or any part of it is to be saved,
through a series of test and intersection(交点) calculations.
The expensive part of a line-clipping algorithm is in calculating the intersections.
Therefore, a major goal for many line-clipping algorithm is to minimize the calculations of intersections.
2D Line Clipping Algorithm

We first test a line to determine whether it is completely inside or outside of the clipping window.
Shown in the figure, since the points and are all in the clipping widow, the line is completely inside of the window.

分享到:
评论

相关推荐

    Flexible Camera Calibration By Viewing a Plane From Unknown Orientations课件

    在"Flexible Camera Calibration By Viewing a Plane From Unknown Orientations"中,主要探讨了相机模型的灵活性以及在不同未知方向下对相机进行校准的方法。 1. **透视变换** 摄像头模型基于透视原理,即三维...

    2d toolkit 2.0 hotfix 2

    2D Toolkit UI Sprite handles - you can resize / move(click and drag) / rotate(alt) sprites using the handles. Turn them off in preferences if you don't like them. Static sprite batcher - supports all ...

    flexible camera calibration by viewing a plane from unknown orientations_张正友

    《Flexible Camera Calibration by Viewing a Plane from Unknown Orientations》是由微软研究院的张正友博士发表的一篇关于摄像机标定的重要论文。该方法是一种新颖且灵活的技术,旨在简化摄像机标定的过程。与传统...

    RHCSA8课堂笔记-RH124

    RHCSA8课堂笔记,第一门课 1. Getting Started with Red Hat Enterprise Linux 2. Accessing the Command Line 3. Managing Files From the Command Line 4. Getting Help in Red Hat Enterprise Linux 5. ...

    Fast Extraction of Viewing Frustum Planes from the World-View-Projection Matrix.pdf

    本文档介绍了一种快速准确地从世界、视图与投影(World-View-Projection, WVP)矩阵中提取视锥体(Viewing Frustum)平面的方法。这种方法在游戏开发和其他三维图形应用领域非常实用,能够有效提高渲染效率,减少...

    Wide-viewing-angle integral three-dimensional imaging

    其中,视角限制是当前的主要挑战之一。通常情况下,在积分成像中,每个微透镜都有对应的显示区域,即所谓的“元素图像区域”。只有当每个元素图像通过对应的微透镜观察时,才能形成完整的图像。这一机制导致了视角...

    建筑专业英文笔记整理大全.doc

    【建筑专业英文笔记整理大全】 在建筑行业中,掌握专业英文词汇是至关重要的,尤其是在与国际团队合作或阅读英文图纸和规范时。以下是一些常见的景观和造价相关的英文词汇及其详细解释: 1. **主入口大门/岗亭 ...

    Flexible Camera Calibration By Viewing a Plane From Unknown Orientations

    ### 灵活相机校准方法:通过观察未知方向的平面 #### 摘要与背景 本文介绍了一种灵活的新型相机校准技术,该技术仅需相机观测到一个处于不同位置(至少两个)的平面图案即可实现。无论是移动相机还是平面图案本身...

    Viewing e.Reports

    根据提供的文件信息,我们可以推断出“Viewing e.Reports”是关于如何查看或操作名为e.Reports的软件产品中的报告。尽管文档中没有提供具体的使用指南或技术细节,但可以基于上下文推测出一些关键知识点。 ### 一、...

    postman parsing data viewing

    在“Postman parsing data viewing”这个主题中,我们将深入探讨如何使用Postman解析和查看数据。解析数据是理解API响应的关键步骤,它允许我们有效地处理和分析返回的信息。 1. **数据解析的基本概念** - 数据...

    Uploading and Viewing Files the Easy Way

    "Uploading and Viewing Files the Easy Way" 这个主题聚焦于简化这一过程的技术和最佳实践。我们将探讨如何实现高效、安全且用户体验良好的文件上传与查看功能。 首先,上传功能的核心在于前端和后端的交互。前端...

    Database explorer for viewing all tables and queries in a da

    Database explorer for viewing all tables and queries in a database. Also includes an SQL editor similar to SQL Query Analyzer.

    react-native-image-viewing:用于查看图像的微小的纯TS模式组件:cityscape:

    React本机图像查看React Native模态组件,用于以滑动画廊的形式查看图像。...viewing 要么npm install --save react-native-image-viewing用法import ImageView from " react-native-image-viewing " ;co

    Viewing_Image:来自相机目录的应用程序视图图像

    "Viewing Image: 来自相机目录的应用程序视图图像"这个标题暗示了我们要讨论的是如何在Android应用中显示从相机目录获取的图片。在描述中提到了"android application tugas",这可能是印尼语中的"任务"或"作业",...

    Viewing angle-enhanced integral imaging system using three lens arrays

    Compared with the conventional integral imaging system, the proposed system can remarkably enhance the viewing angle. The maximum viewing angle can be enlarged to 48o, which is 4.8 times wider than ...

    Viewing PCX files查看PCX文件(69KB)

    标题中的“Viewing PCX files”指的是学习如何查看或处理PCX格式的图像文件。PCX,全称为Paintbrush File Format,是由ZSoft Corporation开发的一种早期的位图图像格式,广泛用于DOS时代。现在虽然不如JPEG、PNG等...

    Viewing Transformations: Generation of 3D CAD Images.pdf

    本文档聚焦于在计算机屏幕上生成三维CAD(计算机辅助设计)图像的过程,特别关注视图变换(Viewing Transformations)以及三维模型的投影生成。三维CAD软件在机械工程和工业设计课程中的传播和应用日益普及,但是...

    Viewing Network-开源

    【标题】"Viewing Network-开源" 在信息技术领域,开源软件是至关重要的一个部分,它意味着源代码可以被公众自由地查看、使用、修改和分发。"Viewing Network"作为一个开源项目,遵循这一原则,提供了透明度和社区...

    A class for Printing and Viewing MS Access Reports打印察看Ac

    标题中的"A class for Printing and Viewing MS Access Reports"指的是一个专门用于打印和查看Microsoft Access报表的类。这个类可能是一个编程工具或组件,旨在简化开发者在处理Access数据库中的报告时的工作流程,...

    Viewing requests sent by Burp extensions using Logger

    Extensions使您能够向 Burp Suite 的工具添加新功能,或增强现有工具。 许多扩展程序会修改您发送的请求,甚至生成自己的请求。

Global site tag (gtag.js) - Google Analytics