??(rotation) - PowerPoint PPT Presentation

About This Presentation
Title:

??(rotation)

Description:

4 - (rotation) (translation) – PowerPoint PPT presentation

Number of Views:87
Avg rating:3.0/5.0
Slides: 48
Provided by: j10101
Category:
Tags: rotation

less

Transcript and Presenter's Notes

Title: ??(rotation)


1
4? ???? ??? ?? ??
  • ????
  • ?? - ?????
  • ?? ??? ???
  • ??(rotation)
  • ??(translation)
  • ????(scaling)
  • ??(shear)
  • ???? ????? ??
  • ??? ?????? ??? ????? ???? ??? ??

2
???? ???
  • typedef GLfloat point33
  • point3 vertices8 -1.0,-1.0,1.0,-1.0,1.0,1.0
    ,
  • 1.0,1.0,1.0, 1.0,-1.0,1.0,
  • -1.0,-1.0,-1.0,-1.0,1.0,-1.0,
  • 1.0,1.0,-1.0, 1.0,-1.0,-1.0
  • glBegin(GL_POLYGON)
  • glVertex3fv(vertices0)
  • glVertex3fv(vertices3)
  • glVertex3fv(vertices2)
  • glVertex3fv(vertices1)
  • glEnd()
  • ?? ?? ?? ?? ???? ??? ? ??

3
???? ??
  • ??? ???? ??? ??? ???? ?? ??? ?? ????? ?????? ??

4
??? ??? ?? ????
  • 6?? glBegin(GL_POLYGON) ??
  • 24?? ???? ??? glBegin(GL_QUAD) ??
  • ?? ? ???? ???? ??? ? ??? ???? ??? ??? ???? ???

5
????
  • GLfloat vertices83-1.0,-1.0,1.0,-1.0,1.0,
    1.0,
  • 1.0,1.0,1.0, 1.0,-1.0,1.0,
  • -1.0,-1.0,-1.0,-1.0,1.0,-1.0,
  • 1.0,1.0,-1.0, 1.0,-1.0,-1.0
  • GLfloat colors830.0,0.0,0.0,1.0,0.0,0.0,
  • 1.0,1.0,0.0,0.0,1.0,0.0,
  • 0.0,0.0,1.0,1.0,0.0,1.0,
  • 1.0,1.0,1.0,0.0,1.0,1.0

6
????
  • void quad(int a, int b, int c, int d)
  • glBegin(GL_POLYGON)
  • glColor3fv(colorsa)
  • glVertex3fv(verticesa)
  • glColor3fv(colorsb)
  • glVertex3fv(verticesb)
  • glColor3fv(colorsc)
  • glVertex3fv(verticesc)
  • glColor3fv(colorsd)
  • glVertex3fv(verticesd)
  • glEnd()

7
????
  • void colorcube()
  • quad(0, 3, 2, 1)
  • quad(2, 3, 7, 6)
  • quad(0, 4, 7, 3)
  • quad(1, 2, 6, 5)
  • quad(4, 5, 6, 7)
  • quad(0, 1, 5, 4)

??? ?? ??? ??? ??? ??? ????? ????
8
??? ?? ?? ??
  • ??? ??

9
??? ?? ?? ??
  • ???? ??? ??

10
???
  • ?? ??? ??? ???????? ??? ???? ???? ??? ??? ??
    ????? ?? ??? ???.
  • ??? ???? ??? ?? ??? ?? ????? ??
  • 6 glBegin, 6 glEnd
  • 6 glColor
  • 24 glVertex
  • ???? ??? ???? ? ???

11
?? ??
  • OpenGL? ????(vertex array)??? ?? ??? ?????? ??
    ???? ??? ? ??? ??
  • ?? ?? ??? ??? ????
  • ??(vertex)
  • ??(color)
  • ?? ???(color index)
  • ??(normal)
  • ??? ??(texture coordinates)
  • ?? ???(edge flag)
  • ??? ??? ?? ???? ??? ??

12
???
  • ??? ?? ??? ???? ??? ??? ?? ??????
  • glEnableClientState(GL_COLOR_ARRAY)
  • glEnableClientState(GL_VERTEX_ARRAY)
  • ??? ??? ??
  • glVertexPointer(3, GL_FLOAT, 0, vertices)
  • glColorPointer(3, GL_FLOAT, 0, colors)

3?? ??
float? ??
?????
??? ???
13
????? ??? ??
  • ? ????? ??? ??
  • GLubyte cubeIndices24 0,3,2,1,
  • 2,3,7,6,
  • 0,4,7,3,
  • 1,2,6,5,
  • 4,5,6,7,
  • 0,1,5,4
  • ???? ? ?? ????? ???? ? ?? ??
  • ????? ???? ?? glVertex ? glColor ???? ????
    glDrawElements ? ???? ???

14
??? ???
  • ?? 1
  • ?? 2

??? ????
???? ?
for(i0 ilt6 i) glDrawElements(GL_POLYGON, 4,
GL_UNSIGNED_BYTE, cubeIndices4i)
??????? ??
??????? ??
glDrawElements(GL_QUADS, 24, GL_UNSIGNED_BYTE,
cubeIndices)
??? ??? ???? ??
15
???? ??
  • ??? ??? ?? ??? ???? (??? ?? ??? ??)

vR(u)
QT(P)
16
????
q f (p)
q f (?p1 ?p2) ? f(p1) ? f(p2)
???? ????
??? ???? ????
17
????
18
?? ??
  • ?? ??
  • ????? ??? ?? ???? ??
  • ???? ??, ??
  • ????, ??
  • ??????? ???? ??? ? ???? ???? ???? ??? ??? ? ??
    ???? ??? ??? ?? ??? ???

19
????? ??
20
??
  • P,Q, R ?? ????? ?
  • u, v, w ?? ????? ??
  • a, b, g ???
  • p, q, r ?? ??
  • -?? ?????? 4 ??? ??
  • u, v, w ??? ??
  • -?? ?????? 4 ??? ??

21
??
  • ??? ??? ?? ??
  • ?? d? ??? ???? ??
  • 3 ???
  • PPd

22
??? ?? ??? ????
  • ??? ?? ??? ??? ???? ??? ??? ?? ?? ? ??? ?? ???
    ???? ??? ?? ? ??? ?? ? ??

??
???? ?? ?? ?? ???? ??
23
??? ??? ??
  • ?? ?????? ???? ??? ????
  • p x y z 1T
  • px y z 1T
  • ddx dy dz 0T
  • ??? p p d , ?
  • xxdx
  • yydy
  • zzdz

24
????
  • ?? ????? 4 x 4 ?? T ? ???? ??? ??? ? ??
  • pTp
  • ???
  • T T(dx, dy, dz)
  • ?? ?? ??? ? ???? ??? ? ?? ?? ?? ??? ??? ? ????,
    ??? ??? ?? ????

25
?? (2D)
  • ??? ???? ? q ?? ??
  • ???? ?? ??? q ? ?? ??

x r cos (f q) y r sin (f q)
xx cos q y sin q y x sin q y cos q
x r cos f y r sin f
26
z ?? ???? ? ??
  • 3???? z ?? ???? ? ??? ?? ???? z ??? ??? ???
  • ?? z ?? ?? ????? 2?? ??? ??????
  • ???????
  • pRz(q)p

x x cos q y sin q y x sin q y cos q z z
27
?? ??
R Rz(q)
28
x ?? y ?? ???? ? ??
  • z ?? ???? ? ????? ?????
  • x ?? ???? ? ????, x ? ??? ???
  • y ?? ???? ? ????, y ? ??? ???

29
????
? ? ???? ?? ?? ?? (???? ??)
xsxx ysyx zszx
pSp
  • S S(sx, sy, sz)

30
??
  • ?? ???? ??? ??

sx -1 sy 1
original
sx -1 sy -1
sx 1 sy -1
31
? ??
  • ??? ???? ???? ?? ? ??? ??? ???? ??? ??? ? ??
  • ?? T-1(dx, dy, dz) T(-dx, -dy, -dz)
  • ?? R -1(q) R(-q)
  • ??? ????? ???
  • cos(-q) cos(q), sin(-q)-sin(q) ???
  • R -1(q) R T(q)
  • ???? S-1(sx, sy, sz) S(1/sx, 1/sy, 1/sz)

32
??(shear)
  • ??? ?? ??? ???? ?? ??
  • ??? ?????? ?? ?? ????

33
?? ??
  • x ????? ??? ??

x x y cot q y y z z
34
??
  • ??, ??, ???? ???? ????? ??? ???? ??? ??? ? ??
  • ??? ??? ?? ???? ????? ?? MABCD ? ??? ??? ?? ???
    p ? ??? Mp? ???? ?? ??? ??? ???
  • ???? ??? ????? ??? ??? ????? ??? ???? ??? ????

35
??? ??
  • ???? ??? ???? ???? ??
  • ????? ??? ?????
  • p ABCp A(B(Cp))
  • ?? ???? ?? ???? ??? ???? ??. ???? ????,
  • pT pTCTBTAT

36
??? ???? ? ??? ??
??? ?????? ??? x, y, z ?? ???? ? ???? ??? ??? ?
??
R(q) Rz(qz) Ry(qy) Rx(qx)
qx qy qz Euler ???? ??
???? ??? ????? ??? ?? ?? ??? ??? ? ??? ??? ????
37
??? ???? ? ??? ??
38
??? ?? ???? ???? ? ??
  • ???? ???? ??
  • ??
  • ???? ??? ??? ??
  • M T(pf) R(q) T(-pf)

39
???(instancing)
  • ?????, ?? ??? ? ???? ?? ???? ??? ??? ????? ????
  • ???? ????(instance transformation)? ??
  • ????
  • ????
  • ????

40
???(instancing)
41
??? ?? ?? 3D ??
  • 1. Po ? ???? ??
  • 2. u ? z-?? ????
  • 3. z-? ???? ? ?? ??
  • 4. 2? ??
  • 5. 1? ??

42
??? ?? ?? 3D ??
  • u? ???
  • v ? x-z ??? ?? ??? x?? ???? ??
  • v ? z ?? ?? ??? y?? ???? ??

43
??? ?? ?? 3D ??
??? ???
44
??? ?? ?? 3D ??
  • ?x ? ?y ? ??
  • ?? ????

45
??? ?? ?? 3D ??
x ??? ??
46
??? ?? ?? 3D ??
y ??? ??
47
??? ?? ?? 3D ??
Write a Comment
User Comments (0)
About PowerShow.com