fundamentals of computer graphics · 《fundamentals of computer graphics》 lecture 7 opengl 3d...

137
Fundamentals of Computer GraphicsLecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu

Upload: others

Post on 19-Aug-2020

8 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

《Fundamentals of Computer Graphics》

Lecture 7 OpenGL 3D Transformation

and Fractal Geometry

Yongjin Liu

Page 2: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

What about this lecture?

Scene layout of OpenGL

Three transformation matrix

glMatrixMode

Viewport and window of OpenGL

viewport

window

Page 3: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

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: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene
Page 5: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene
Page 6: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

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: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

Pixel

data

Vertex

data

Page 8: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

OpenGL 3D transformation

Scene layout of OpenGL

Three transformation matrix

glMatrixMode

Viewport and window of OpenGL

viewport

window

Page 9: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

Up direction

Observe direction

Near plane

Far plane

World coordinate

Viewing volume

Page 10: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

Matrix transformation of OpenGL

Model transformation

View transformation

Projection transformation

Near plane

Far plane

World coordinate

Viewing volume

Page 11: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

Matrix transformation of OpenGL

Model Transformation

View Transformation

Projection Transformation

Page 12: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

Matrix transformation of OpenGL

Model Transformation

View Transformation

Projection Transformation

glMatrixMode(parameter)

glMatrixMode(GL_MODELVIEW)

glMatrixMode(GL_PROJECTION)

Page 13: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

Transformation from world window to viewport

screen

World window

viewport

Page 14: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

screen

World window

viewport

glViewport(x, y, width, height)

Transformation from world window to viewport

Page 15: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

Example analysis

Page 16: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

1、Initialize window

glutInit(&argc, (char**) argv);

glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);

glutInitWindowSize(640,480);

glutInitWindowPosition(100,150);

glutCreateWindow("Sinc Function");

Page 17: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

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: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

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: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

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: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

screen

World window

viewport

glViewport(x, y, width, height)

Transformation from world window to viewport

Page 21: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

screen

World window Multiple viewport

Application window

Page 22: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

Example analysis

Page 23: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene
Page 24: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

Drawing hexagonal vortex

void render() {

glClear(GL_COLOR_BUFFER_BIT);

hexSwirl();

glutSwapBuffers();

glFlush();

}

Page 25: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

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: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

screen

World window Multiple viewport

Application window

Page 27: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

Topic 1

Recursive method and

fractal geometry

Page 28: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

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: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

A simple example

Iteration rule

Koch curve and Koch snow

Page 30: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

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: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

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: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

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: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

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: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

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: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

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: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

Hilbert fractal curve

• Iteration rule

Zero Hilbert curve

first Hilbert curve

Page 37: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

first Hilbert curve

first Hilbert curve

Page 38: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

second Hilbert curve

third Hilbert curve

Page 39: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

third Hilbert curve

fourth Hilbert curve

Page 40: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene
Page 41: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

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: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

Fractal geometry

Use simple basic shape

Use simple iteration and refinement

process

Obtain complicated nature object

Page 43: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

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: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

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: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

Golden ratio and IFS

Ancient Greek Parthenon

Page 46: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

Golden ratio

11

1 51.618033989

2

Page 47: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

Golden ratio and IFS

1 1 1 1 ( ) 1

1 11 ( )

1 11

11

1

f x x

f xx

Page 48: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

Golden rectangle

Golden triangle

Golden Rhombus

Golden Rhombohedron

Page 49: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

Golden rectangle

Logarithmic spiral baer

Page 50: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

Golden triangle a

b

Page 51: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

Golden diamond

Golden rhombohedral

Page 52: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

How to draw fractal geometry

shape effectively?

Turtle Graphics

turn(float angle)

forward(float dist, bool isVisible)

Page 53: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

Example analysis polyspiral

For (some iterations) { forward(length, 1); turn(angle); length += increment; }

Page 54: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

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: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

L-System and instruction generation

‘F’ means forward(1, 1)

‘+’ means turn(A)

‘’ means turn(A) F FF++FF

Page 56: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

A simple example

Iteration rule

Koch curve and Koch snow

Page 57: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

+, no substitution

Page 58: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

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: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

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: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

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: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene
Page 62: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

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: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

Dragon curve

‘F’‘F’

‘X’‘X+YF+’

‘Y’‘FXY’

Original instruction ‘FX’

‘FX+YF+’

‘FX+YF++FXYF+’

Page 64: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene
Page 65: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

Extension mode of instruction set

(original instruction, F extension mode, X extension

mode, Y extension mode, rotation angle)

Page 66: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene
Page 67: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

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: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

Example analysis

Original instruction ‘F’

Rotation angle 22o

Extension mode of instruction set

‘F’ ‘FF-[-F+F+F]+[+F-F-F]’

Bush

Page 69: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

bush after 4 iteration

Page 70: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene
Page 71: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene
Page 72: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene
Page 73: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

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: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene
Page 75: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

Application of

Stochastic L system

Page 76: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene
Page 77: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

L system in 3D space

Control the spatial orientation of turtle

Page 78: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene
Page 79: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene
Page 80: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene
Page 81: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene
Page 82: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

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: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene
Page 84: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene
Page 85: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

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: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

Design of 3D herb

Page 87: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene
Page 88: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

Design of 3D poplar

Page 89: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene
Page 90: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

Design of 3D willow

Page 91: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene
Page 92: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

Other example

maple

Page 93: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

pine

Page 94: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

camphor

Page 95: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

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: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

Content-independent L-System(3D)

Page 97: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

Content-based L-System

2L-System

(k,l)-system

Page 98: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene
Page 99: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene
Page 100: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene
Page 101: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

Extension of theory system

Basic L-System

Introduce branch

Stochastic L-System

3D L-System

Content-based L-System

Parameterized L-System

Page 102: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

Parameterized L-System

Parameterized 2L-System

Page 103: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene
Page 104: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

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: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

Application of L-System

Modeling of tree

Modeling of herb

Page 106: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene
Page 107: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene
Page 108: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene
Page 109: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene
Page 110: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene
Page 111: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

Application of L-System

Modeling of tree

Modeling of herb

Leaf arrangement

Defining the pattern

of different species

Page 112: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene
Page 113: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene
Page 114: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

More flowers and fruitages

Page 115: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

Tsinghua historic site: moonlight over the lotus pond

Page 116: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

More fruitage: pineapple, pinenut, etc

Page 117: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene
Page 118: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene
Page 119: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

Flower bud

Page 120: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

Application of L-System

Modeling of tree

Modeling of herb

Leaf arrangement

Automatic modeling of architecture

L system: Inheritance, mutation, crossover

Page 121: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene
Page 122: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene
Page 123: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene
Page 124: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene
Page 125: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene
Page 126: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

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: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene
Page 128: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene
Page 129: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene
Page 130: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene
Page 131: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene
Page 132: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

The Palace Museum

Page 133: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene
Page 135: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

Spiral fern leaf

Fractal landscape

Fractal Planet

Life-form in abyssal region

Ancient

Page 136: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

Art of mathematics?

Mathematics of art?

Page 137: Fundamentals of Computer Graphics · 《Fundamentals of Computer Graphics》 Lecture 7 OpenGL 3D Transformation and Fractal Geometry Yongjin Liu . What about this lecture? Scene

Week 13: this week

Week 14: one lecture

Week 15: everyone gives a presentation for your

course projects

Week 16: final mark evaluation