lecture 7 opengl 3d transformation and fractal geometry yongjin liu
TRANSCRIPT
![Page 1: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/1.jpg)
《Fundamentals of Computer Graphics》
Lecture 7 OpenGL 3D Transformation
and Fractal Geometry
Yongjin Liu
![Page 2: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/2.jpg)
What about this lecture?
Scene layout of OpenGL
Three transformation matrix
glMatrixMode
Viewport and window of OpenGL
viewport
window
![Page 3: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/3.jpg)
Contents
Transformation and observation control in
OpenGL
Provide a set of powerful and flexible functions
Linear algebra
Difference between viewport transformation
and projection transformation
Coordinate and matrix
Matrix operation command
Transformation pipeline
![Page 4: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/4.jpg)
![Page 5: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/5.jpg)
![Page 6: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/6.jpg)
Geometry transformation pipeline
Object Coordinate
Model Transformation
World Coordinate
Projection Variable
Perspective division
ViewPort Transformation
Window Coordinate
ModelView Matrix
Clipping
Coordinate Normalization
View Transformation
![Page 7: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/7.jpg)
Pixel
data
Vertex
data
![Page 8: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/8.jpg)
OpenGL 3D transformation
Scene layout of OpenGL
Three transformation matrix
glMatrixMode
Viewport and window of OpenGL
viewport
window
![Page 9: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/9.jpg)
Up direction
Observe direction
Near plane
Far plane
World coordinate
Viewing volume
![Page 10: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/10.jpg)
Matrix transformation of OpenGL
Model transformation
View transformation
Projection transformation
Near plane
Far plane
World coordinate
Viewing volume
![Page 11: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/11.jpg)
Matrix transformation of OpenGL
Model Transformation
View Transformation
Projection Transformation
![Page 12: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/12.jpg)
Matrix transformation of OpenGL
Model Transformation
View Transformation
Projection Transformation
glMatrixMode(parameter)
glMatrixMode(GL_MODELVIEW)
glMatrixMode(GL_PROJECTION)
![Page 13: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/13.jpg)
Transformation from world window to viewport
screen
World window
viewport
![Page 14: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/14.jpg)
screen
World window
viewport
glViewport(x, y, width, height)
Transformation from world window to viewport
![Page 15: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/15.jpg)
Example analysis
![Page 16: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/16.jpg)
1、Initialize window
glutInit(&argc, (char**) argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(640,480);
glutInitWindowPosition(100,150);
glutCreateWindow("Sinc Function");
![Page 17: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/17.jpg)
2、drawing function
void myDisplay(void) {// draw sinc function using world coordinate glClear( GL_COLOR_BUFFER_BIT );
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glBegin(GL_LINE_STRIP);
for(GLfloat x = -4.0; x < 4.0; x += 0.1)
glVertex2f(x, sin(pi * x) / (pi * x));
glEnd();
glFlush();
}
![Page 18: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/18.jpg)
3、Initialize status of drawing
myInit(void) {
glClearColor(1.0,1.0,1.0,0.0);
glColor3f(0.0f,0.0f,1.0f);
glLineWidth(1.0);
}
![Page 19: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/19.jpg)
4、Define world window
void setWindow(left, right, bottom, top) {
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(left, right, bottom, top);
//defines a 2D orthographic projection matrix
}
![Page 20: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/20.jpg)
screen
World window
viewport
glViewport(x, y, width, height)
Transformation from world window to viewport
![Page 21: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/21.jpg)
screen
World window Multiple viewport
Application window
![Page 22: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/22.jpg)
Example analysis
![Page 23: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/23.jpg)
![Page 24: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/24.jpg)
Drawing hexagonal vortex
void render() {
glClear(GL_COLOR_BUFFER_BIT);
hexSwirl();
glutSwapBuffers();
glFlush();
}
![Page 25: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/25.jpg)
Drawing function
void myDisplay(void) {
//set world window
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(140, 460, 40, 360);
int i, j, L=160;
for (i=0; i<4; i++) {
for (j=0; j<3; j++) {
glViewport(i*L, j*L, L, L);//set viewport } } glutSwapBuffers(); }
(140,40)
(460,360)
Width 320
Height 320
![Page 26: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/26.jpg)
screen
World window Multiple viewport
Application window
![Page 27: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/27.jpg)
Topic 1
Recursive method and
fractal geometry
![Page 28: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/28.jpg)
Fractal geometry
Create object using simple program
• Using the self-similarity of real world object
• Using the mathematical recursive method
Fractal was first proposed by Mandelbrot
• Create a branch of math
• Can generate and simulate many interesting objects
• Can not be achieved using general geometry
modeling method
![Page 29: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/29.jpg)
A simple example
Iteration rule
Koch curve and Koch snow
![Page 30: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/30.jpg)
fractal geometry
Two feature measure
• Dependence of the unit of measurement for geometry object
• Self-similarity for geometry object
Scale and length
• Drawing resolution
• Minimal unit used in measurement
• The level of detail depends on the distance between us and the
object
![Page 31: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/31.jpg)
Variable-length principle of Koch curve
• Segment of length 1 can be substituted by 4 off lines of
length 1/3
• For every iteration, the length of Koch curve increases 4/3
• Consider the limiting case (infinite iteration)
• Infinite curve, the first order derivative of each point is not
continuous
• It is not the usual one-dimensional curve, and not two-
dimensional object
• Fractal dimensional
![Page 32: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/32.jpg)
Definition of fractal dimension
• Consider segment, square, cube of unit length
• The resolution of iteration h = 1/n, n is integer
• Splice the segment into k = n parts
• Splice the square into k = n2 parts
• Splice the cube into k = n3 parts
![Page 33: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/33.jpg)
Definition of fractal dimension
• From the mathematical point of view, dimension is used
to characterize the geometric properties of the object
• To any object(segment, square, cube), there exists
equation:k = nd
• Solve k from the above equation, define d to be fractal
dimension: ln
ln
kd
n
![Page 34: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/34.jpg)
Fractal dimension of Koch snow
• In the limiting case, the curve has infinite length, the
first derivative of each point is not continuous
• It is neither the general one dimension curve, nor the
2D object
• Segment with length 1 can be substituted with 4 off line
with 1/3 length
• n = 3, k = 4
• Fractal dimension
ln ln 41.26186
ln ln3
kd
n
![Page 35: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/35.jpg)
Hilbert fractal curve
• Mathematician Hilbert discovered a very strange curve
• Can be proved that:
• The same as Koch curve,Hilbert curve extends
infinitely
• Hilbert curve never self-cross,but is limited in a box
• In the limiting case, Hilbert curve fill every point in the
box
• This curve is called space-filling curve
![Page 36: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/36.jpg)
Hilbert fractal curve
• Iteration rule
Zero Hilbert curve
first Hilbert curve
![Page 37: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/37.jpg)
first Hilbert curve
first Hilbert curve
![Page 38: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/38.jpg)
second Hilbert curve
third Hilbert curve
![Page 39: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/39.jpg)
third Hilbert curve
fourth Hilbert curve
![Page 40: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/40.jpg)
![Page 41: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/41.jpg)
David Hilbert (1862~1943)
• One of the most great mathematicians in the end of 19th
century, early of 20th century
• Fractal method,Dirichlet principal,methods of
mathematical physics
• 23 mathematical problem of Hilbert
– The second international congress of mathematicians in Pairs,
1900
– The eighth problem, prime problem,Jingrun Chen
– May 24, 2000,College de France in Pairs,announced 7 new
millennium mathematics problem, 1 million dollar bonus for each
– Poincare guess,P and NP problem, etc.
![Page 42: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/42.jpg)
Fractal geometry
Use simple basic shape
Use simple iteration and refinement
process
Obtain complicated nature object
![Page 43: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/43.jpg)
Uniform mathematical description
of iterative process
Iterated function system (IFS)
• d0
• d1 = f(d0)
• d2 = f(d1) = f(f(d0))
• d3 = f(f(f(d0)))
• … …
• dk = f [k](d0)
d0, d1, d2, d3, …is orbit of d0
![Page 44: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/44.jpg)
Iterated function system (IFS)
• f (x) = 2x
• f (x) = cos(x)
• f (x) = 4x(1x)
• f (x) = x2 + x
Uniform mathematical description
of iterative process
![Page 45: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/45.jpg)
Golden ratio and IFS
Ancient Greek Parthenon
![Page 46: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/46.jpg)
Golden ratio
11
1 51.618033989
2
![Page 47: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/47.jpg)
Golden ratio and IFS
1 1 1 1 ( ) 1
1 11 ( )
1 11
11
1
f x x
f xx
![Page 48: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/48.jpg)
Golden rectangle
Golden triangle
Golden Rhombus
Golden Rhombohedron
![Page 49: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/49.jpg)
Golden rectangle
Logarithmic spiral baer
![Page 50: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/50.jpg)
Golden triangle a
b
![Page 51: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/51.jpg)
Golden diamond
Golden rhombohedral
![Page 52: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/52.jpg)
How to draw fractal geometry
shape effectively?
Turtle Graphics
turn(float angle)
forward(float dist, bool isVisible)
![Page 53: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/53.jpg)
Example analysis polyspiral
For (some iterations) { forward(length, 1); turn(angle); length += increment; }
![Page 54: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/54.jpg)
for(int i=1; i<3; i++) { forward(L, 1); turn(60); forward(L, 1); turn(120); forward(L, 1); turn(60); forward(L, 1); turn(120); }
![Page 55: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/55.jpg)
L-System and instruction generation
‘F’ means forward(1, 1)
‘+’ means turn(A)
‘’ means turn(A) F FF++FF
![Page 56: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/56.jpg)
A simple example
Iteration rule
Koch curve and Koch snow
![Page 57: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/57.jpg)
+, no substitution
![Page 58: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/58.jpg)
atom:b
Generative form:b->a, a->ab
In mathematics, logic and
computer science, formal
language is a precise
mathematics or machine
that can handle language
defined by formula.
![Page 59: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/59.jpg)
The same as languages in linguistics,formal
language generally has two aspect: grammar and
semantic.
The branch of mathematics and computer
science specializing in the syntax is called
formal language theory, it only committed to
syntax of language but not semantic.
In formal language theory, formal language is
a set of strings composed by finite letter.
A formal language can contain infinite number
of strings.
![Page 60: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/60.jpg)
Formal definition of language
Operation between languages
A formal language can limit itself by many means:
Enumerate every string(applies only to finite string set)
Generate through formal grammar(see Chomsky pedigree)
Generate through regular expression
Recognize through certain automatic machine,such as
Turing machine, finite state machine
Representation method of language
Formal grammar, formal method, formal science,
formal system
Mathematical symbol, programming language
![Page 61: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/61.jpg)
![Page 62: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/62.jpg)
Extension of instruction set
Add other letter to instruction set, such as
X, Y
Only play a role in the iterative generation
process
Has no effect to Turtle motion
![Page 63: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/63.jpg)
Dragon curve
‘F’‘F’
‘X’‘X+YF+’
‘Y’‘FXY’
Original instruction ‘FX’
‘FX+YF+’
‘FX+YF++FXYF+’
![Page 64: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/64.jpg)
![Page 65: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/65.jpg)
Extension mode of instruction set
(original instruction, F extension mode, X extension
mode, Y extension mode, rotation angle)
![Page 66: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/66.jpg)
![Page 67: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/67.jpg)
Add branch into instruction set
And instruction ‘[’ and ‘]’ into instruciton set
‘[’: saveTurtle() records the current position of
turtle
‘]’: restoreTurtle() restores the position of turtle
Implement using stack
‘[’: push the position of turtle
‘]’: pop the position of turtle
![Page 68: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/68.jpg)
Example analysis
Original instruction ‘F’
Rotation angle 22o
Extension mode of instruction set
‘F’ ‘FF-[-F+F+F]+[+F-F-F]’
Bush
![Page 69: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/69.jpg)
bush after 4 iteration
![Page 70: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/70.jpg)
![Page 71: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/71.jpg)
![Page 72: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/72.jpg)
![Page 73: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/73.jpg)
Random and growing refinement of
object shape
Instruction set with branch is still too regular
Introduce a small random number at every
‘+’, ‘’
Set different line width according the depth
of stack
Inheritance, mutation, crossover
![Page 74: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/74.jpg)
![Page 75: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/75.jpg)
Application of
Stochastic L system
![Page 76: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/76.jpg)
![Page 77: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/77.jpg)
L system in 3D space
Control the spatial orientation of turtle
![Page 78: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/78.jpg)
![Page 79: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/79.jpg)
![Page 80: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/80.jpg)
![Page 81: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/81.jpg)
![Page 82: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/82.jpg)
Example design of 3D bamboo (Botany)
Bamboo generally has 4~8 branches
New branch grows on every branch
New branch generally has 4 growing direction
The angle between two branches is approximately
90o
The angle between branch and trunk is
approximately 33.4o
(9033.4)/90 = 0.618
![Page 83: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/83.jpg)
![Page 84: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/84.jpg)
![Page 85: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/85.jpg)
Example design of other 3D plants
Design the number of branch and trunk
Design the growing direction of new branch
Design the angle of two branches
Design the angle of branch and trunk
Design the affine transformation matrix
![Page 86: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/86.jpg)
Design of 3D herb
![Page 87: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/87.jpg)
![Page 88: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/88.jpg)
Design of 3D poplar
![Page 89: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/89.jpg)
![Page 90: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/90.jpg)
Design of 3D willow
![Page 91: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/91.jpg)
![Page 92: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/92.jpg)
Other example
maple
![Page 93: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/93.jpg)
pine
![Page 94: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/94.jpg)
camphor
![Page 95: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/95.jpg)
Extension of theory system
Biology organism evolution:
lower, middle, higher levels
Basic L-System
Extended L-system (X/Y instruction,branch [])
Stochastic L-System
3D L-System
Content-based L-System
![Page 96: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/96.jpg)
Content-independent L-System(3D)
![Page 97: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/97.jpg)
Content-based L-System
2L-System
(k,l)-system
![Page 98: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/98.jpg)
![Page 99: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/99.jpg)
![Page 100: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/100.jpg)
![Page 101: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/101.jpg)
Extension of theory system
Basic L-System
Introduce branch
Stochastic L-System
3D L-System
Content-based L-System
Parameterized L-System
![Page 102: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/102.jpg)
Parameterized L-System
Parameterized 2L-System
![Page 103: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/103.jpg)
![Page 104: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/104.jpg)
Application of L-System
Modeling of Nature
• D Cohen. Computer simulation of biological pattern generation processes. Nature, 216: 246-248, 1969
• H Honda, J.B.Fisher. Tree branch angle: maximizing effective leaf area. Science, 199:888-890, 1978
![Page 105: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/105.jpg)
Application of L-System
Modeling of tree
Modeling of herb
![Page 106: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/106.jpg)
![Page 107: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/107.jpg)
![Page 108: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/108.jpg)
![Page 109: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/109.jpg)
![Page 110: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/110.jpg)
![Page 111: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/111.jpg)
Application of L-System
Modeling of tree
Modeling of herb
Leaf arrangement
Defining the pattern
of different species
![Page 112: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/112.jpg)
![Page 113: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/113.jpg)
![Page 114: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/114.jpg)
More flowers and fruitages
![Page 115: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/115.jpg)
Tsinghua historic site: moonlight over the lotus pond
![Page 116: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/116.jpg)
More fruitage: pineapple, pinenut, etc
![Page 117: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/117.jpg)
![Page 118: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/118.jpg)
![Page 119: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/119.jpg)
Flower bud
![Page 120: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/120.jpg)
Application of L-System
Modeling of tree
Modeling of herb
Leaf arrangement
Automatic modeling of architecture
L system: Inheritance, mutation, crossover
![Page 121: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/121.jpg)
![Page 122: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/122.jpg)
![Page 123: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/123.jpg)
![Page 124: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/124.jpg)
![Page 125: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/125.jpg)
![Page 126: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/126.jpg)
Application of L-System
Modeling of tree
Modeling of herb
Leaf arrangement
Automatic modeling of architecture
Modeling of city
L system: Inheritance, mutation, crossover
![Page 127: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/127.jpg)
![Page 128: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/128.jpg)
![Page 129: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/129.jpg)
![Page 130: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/130.jpg)
![Page 131: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/131.jpg)
![Page 132: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/132.jpg)
The Palace Museum
![Page 133: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/133.jpg)
![Page 134: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/134.jpg)
Bibliography
Michael Barnsley.
Fractals everywhere, O177.3 FB26
Fractals in multimedia, O189.12 FF79
Superfractals, TP391.41 FB26
![Page 135: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/135.jpg)
Spiral fern leaf
Fractal landscape
Fractal Planet
Life-form in abyssal region
Ancient
![Page 136: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/136.jpg)
Art of mathematics?
Mathematics of art?
![Page 137: Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu](https://reader035.vdocument.in/reader035/viewer/2022071519/613c5f83f237e1331c5130aa/html5/thumbnails/137.jpg)
Week 13: this week
Week 14: one lecture
Week 15: everyone gives a presentation for your
course projects
Week 16: final mark evaluation