OpenGL Basic Transformations - OpenGL 基础变换原理(2)

简单的说,通过这些具体的变换,首先告诉系统观察者在那里看,其次看到的物体摆在那里,再次这个三维物体如何投影得到二维图形,最后把这个图形在窗口上用像素呈现出来。每个变换实际上是一个矩阵,所有变换叠加的结果,用矩阵表现出来就是这些矩阵照顺序相乘起来,并得到最终的变换矩阵。

 以下对每种变换分别作一个解释:

Viewing Transformations

By default, the point of observation in a perspective projection is at the origin (0,0,0) looking down the negative z-axis (“into” the monitor screen).

The viewing transformation allows you to place the point of observation anywhere you want and look in any direction. Determining the viewing transformation is like placing
and pointing a camera at the scene.

这个变换是移动观察者的位置,默认的观察位置是(0,0,0),观察方向指向屏幕内部。观察变换使你可以在任意位置或任意方向上进行观察。

Modeling Transformations

These transformations move objects into place, rotate them, and scale them.

模型变换包括平移,旋转和缩放。

Modelview Duality

The viewing and modeling transformations are, in fact, the same in terms of their internal effects as well as their effects on the final appearance of the scene. The distinction between the two is made purely as a convenience for the programmer. There is no real difference visually between moving an object backward and moving the reference system forward;

观察变换和模型变换式是等效的,只是为了使用者的方便而设,因为运动的相对性,你既可以一个方向上移动观察着,也可以在反方向上移动物体。

Projection Transformations
This projection actually defines the viewing volume and establishes clipping planes.

The clipping planes are plane equations in 3D space that OpenGL uses to determine whether geometry can be seen by the viewer. More specifically, the projection transformation specifies how a finished scene (after all the modeling is done) is projected to the final image on the screen.

Two types of projections—orthographic and perspective.

 投影变换确定了视觉空间和剪裁平面。剪裁平面确定了3D物体投影后得到的2D投影图形。OpenGL中存在两种投影方式, 正投影和透视投影 。

插入一点英文词汇解释,引自:http://www.dictall.com/indu54/63/54638430CA4.htm

1)  clipping planes
剪裁平面
2)  flat cutting
平面裁剪
1.
This article analysis and compare the characteristic, cutting process between solid cutting and flat cutting, explained two methods from its own system, each has its strong points also cannot substitute.
本文从分析比较立体裁剪与平面裁剪两种服装结构设计方法的特点及裁剪过程入手,说明两种方法自成体系,各有所长且不能被取代。
3)  OpenGL clip plane
OpenGL裁剪平面
4)  surface trimming
曲面裁剪
1.
Scan line algorithm for NURBS surface trimming;
用于非均匀有理B样条曲面裁剪的扫描线算法
2.
This paper discusses the algorithm and implementation of the advanced surface design functions in BSURF-GI (an interactive 3D surface modelling system), presents a method which can do surface trimming along with the suface / surface intersection curves and filleting surface boundaries, and also points out the system further research direction and the way of integration with solid modelling system.
提出了一种能沿曲面与曲面交线和过渡曲面边界线进行曲面裁剪的算法,指出了该系统今后进一步研究的方向及与实体造型系统集成的途径。
3.
In CAD/CAM engineering,surface trimming is one of the most important and complex problems and quadrangular meshes are widely employed.
曲面裁剪运算是CAD/CAM领域最重要、最复杂的问题之一,四边形网格在工程CAD/CAM的实际应用中较为广泛。
5)  trimmed surface
裁剪曲面
1.
Algorithm of trimmed surface triangulation of prepositive disposal in predicting RCS of aircraft;
飞行器RCS计算前置处理中裁剪曲面剖分算法
2.
Here the tool surface is represented by the analytical surface,the trimmed surface is approximated with the triangular patches, and the problem of interfer-ence avoidance is solved by transforming them to the test of relations between tool surface andtriangular patches.
在分析国内外三坐标数控加工刀具轨迹干涉检查和消除算法的基础上,提出了一种适合于球头刀、平底刀和圆角刀的刀具轨迹干涉检查和消除的算法,该算法将刀具看成解析曲面,裁剪曲面由三角片逼近表示,将刀具轨迹干涉检查与消除的问题转化为刀具曲面与三角片的相关性测试。
3.
That is referred to how a model represented by many trimmed surfaces is transferred to a watertight model.
曲面缝合是曲面造型过程中常用到的处理技术,即把由多张裁剪曲面表示的模型转换成一个"不漏水"的模型。
6)  trimmed surfaces
裁剪曲面
1.
An algorithm for triangulating multi trimmed surfaces is introduced in this paper.
提出一种新的多裁剪曲面三角划分的方法。

 

待续...

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
OpenGL支持二维变换,可以通过对矩阵进行变换来实现。下面是一个示例代码,展示如何使用OpenGL实现二维变换。 ```c++ #include <GL/glut.h> #include <cmath> void init() { glClearColor(0.0, 0.0, 0.0, 0.0); glMatrixMode(GL_PROJECTION); gluOrtho2D(-1.0, 1.0, -1.0, 1.0); } void display() { glClear(GL_COLOR_BUFFER_BIT); // 原始正方形 glColor3f(1.0, 1.0, 1.0); glBegin(GL_POLYGON); glVertex2f(-0.5, -0.5); glVertex2f(0.5, -0.5); glVertex2f(0.5, 0.5); glVertex2f(-0.5, 0.5); glEnd(); // 平移变换 glPushMatrix(); glTranslatef(0.5, 0.0, 0.0); glColor3f(1.0, 0.0, 0.0); glBegin(GL_POLYGON); glVertex2f(-0.5, -0.5); glVertex2f(0.5, -0.5); glVertex2f(0.5, 0.5); glVertex2f(-0.5, 0.5); glEnd(); glPopMatrix(); // 旋转变换 glPushMatrix(); glRotatef(45.0, 0.0, 0.0, 1.0); glColor3f(0.0, 1.0, 0.0); glBegin(GL_POLYGON); glVertex2f(-0.5, -0.5); glVertex2f(0.5, -0.5); glVertex2f(0.5, 0.5); glVertex2f(-0.5, 0.5); glEnd(); glPopMatrix(); // 缩放变换 glPushMatrix(); glScalef(0.5, 0.5, 0.5); glColor3f(0.0, 0.0, 1.0); glBegin(GL_POLYGON); glVertex2f(-0.5, -0.5); glVertex2f(0.5, -0.5); glVertex2f(0.5, 0.5); glVertex2f(-0.5, 0.5); glEnd(); glPopMatrix(); glFlush(); } int main(int argc, char** argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB); glutInitWindowSize(500, 500); glutInitWindowPosition(100, 100); glutCreateWindow("2D Transformations"); init(); glutDisplayFunc(display); glutMainLoop(); return 0; } ``` 在这个示例中,我们首先定义了一个正方形,并对其进行了三次变换:平移、旋转和缩放。在每次变换之前,我们都使用`glPushMatrix`将当前矩阵压入栈中,以便在变换结束后回到原始矩阵。在每次变换之后,我们使用`glPopMatrix`将矩阵弹出栈。 最后,我们在`display`函数中使用`glFlush`将绘制命令发送到OpenGL,以便将图形显示在屏幕上。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值