CSC 202 I NTRO. T O C OMPUTER ANIMATION Techniques and mathematical algorithms By Uzoma James...

15
CSC 202 INTRO. TO COMPUTER ANIMATION Techniques and mathematical algorithms By Uzoma James Chikwem

Transcript of CSC 202 I NTRO. T O C OMPUTER ANIMATION Techniques and mathematical algorithms By Uzoma James...

Page 1: CSC 202 I NTRO. T O C OMPUTER ANIMATION Techniques and mathematical algorithms By Uzoma James Chikwem.

CSC 202 INTRO. TO COMPUTER ANIMATIONTechniques and mathematical algorithms

By Uzoma James Chikwem

Page 2: CSC 202 I NTRO. T O C OMPUTER ANIMATION Techniques and mathematical algorithms By Uzoma James Chikwem.

SALARY OF MATHEMATICIANS

The power of Problem Solving

Page 3: CSC 202 I NTRO. T O C OMPUTER ANIMATION Techniques and mathematical algorithms By Uzoma James Chikwem.

MATH IN COMPUTER ANIMATION

Math is used to perform many Animation Techniques Perception of Vision Character Position & Effects Object Motion Texture Mapping

Mathematical Algorithms Transformatoions Vectors Matrices Curved surfaces Polygons

Page 4: CSC 202 I NTRO. T O C OMPUTER ANIMATION Techniques and mathematical algorithms By Uzoma James Chikwem.

TECHNICAL BACKGROUND(ALGORITHMS)

Section will cover: Basics of computer graphic

display pipeline Coordinate spaces or

systems Transformations Perspective

Mathematical Algorithms 2D Space 3D Space Matrices Polygons Curves

Page 5: CSC 202 I NTRO. T O C OMPUTER ANIMATION Techniques and mathematical algorithms By Uzoma James Chikwem.

DISPLAY PIPELINE Refers to an object created in it’s

own defined space going through transformations to be displayed on screen.

Object space is where an object is originally defined.

World space is where the object can be viewed, or environment.

Eye Space simply relates to what the camera or viewer sees, which is transformed into image space.

Lastly the data is translated, rotated, and scaled into the screen space, or pixels.

Page 6: CSC 202 I NTRO. T O C OMPUTER ANIMATION Techniques and mathematical algorithms By Uzoma James Chikwem.

TRANSFORMATIONS, OR CHANGE, IN COORDINATES OVER TIME CREATES ANIMATION

Point(x,y) MOVED by amount Dx, Dy to new location (x’,y’)

Point (x,y) enlarges, shrinks, reflects to new location (x’,y’)

TRANSLATION IN 2D SCALING IN 2D

Page 7: CSC 202 I NTRO. T O C OMPUTER ANIMATION Techniques and mathematical algorithms By Uzoma James Chikwem.

TRANSFORMATIONS, OR CHANGE, IN COORDINATES OVER TIME CREATES ANIMATION

Scales an object inversely usually by multiplying by a negative scalar.

Flips an object off a point, line or plane

Very useful to know when modeling in 3D as well as animating in 2D

REFLECTION IN 2D

Page 8: CSC 202 I NTRO. T O C OMPUTER ANIMATION Techniques and mathematical algorithms By Uzoma James Chikwem.

TRANSFORMATIONS, OR CHANGE, IN COORDINATES OVER TIME CREATES ANIMATION

REFLECTION IN 2D

•These rules should help in calculating new location.

Page 9: CSC 202 I NTRO. T O C OMPUTER ANIMATION Techniques and mathematical algorithms By Uzoma James Chikwem.

TRANSFORMATIONS, OR CHANGE, IN COORDINATES OVER TIME CREATES ANIMATION

Rotates Point(x,y) about the origin of the scene, not object.

Theta represents the angle of change.

To better visualize think of the unit circle used in trig class to help graph sine, cosine and tangent.

ROTATION IN 2D

Page 10: CSC 202 I NTRO. T O C OMPUTER ANIMATION Techniques and mathematical algorithms By Uzoma James Chikwem.

TRANSFORMATIONS, OR CHANGE, IN COORDINATES OVER TIME CREATES ANIMATION

Remember graphing these in Precalc?

Now you get to visualize them and how each angle is used to animate rotation.

Remember these angles and their coordinates to help better understand.

ROTATION IN 2D

Page 11: CSC 202 I NTRO. T O C OMPUTER ANIMATION Techniques and mathematical algorithms By Uzoma James Chikwem.

TRANSFORMATIONS, OR CHANGE, IN COORDINATES OVER TIME CREATES ANIMATION

ROTATION IN 2D

Page 12: CSC 202 I NTRO. T O C OMPUTER ANIMATION Techniques and mathematical algorithms By Uzoma James Chikwem.

2D COORDINATE SYSTEM

Commonly used to graph algorithms to show Constant motion Acceleration/deceleration No movement

Programming Math Javascript C++ OpenGL Python Plenty more…

for ( i = 0; i <= 1; i += 0.1 ) {x = i;y = i;…}

Page 13: CSC 202 I NTRO. T O C OMPUTER ANIMATION Techniques and mathematical algorithms By Uzoma James Chikwem.

2D COORDINATE SYSTEM

for ( i = 0; i <= 1; i += 0.1 ) {

  x = i;  y = i * i;}

for ( i = 0; i <= 1; i += 0.1 ) {  x = i;  y = Math.pow( i, 4 );}

Page 14: CSC 202 I NTRO. T O C OMPUTER ANIMATION Techniques and mathematical algorithms By Uzoma James Chikwem.

SINE WAVES FOR SMOOTH ANIMATIONvar counter = 0;// 100 iterationsvar increase = Math.PI / 100;for ( i = 0; i <= 1; i += 0.01 ) {

 x = i;y = Math.sin(counter);counter += increase;

}

var counter = 0;// 100 iterationsvar increase = Math.PI *?? / 100;for ( i = 0; i <= 1; i += 0.01 ) {  x = i;

y = Math.sin(counter);counter += increase;

}

Page 15: CSC 202 I NTRO. T O C OMPUTER ANIMATION Techniques and mathematical algorithms By Uzoma James Chikwem.

TRANSFORMATIONS

ROTATION

TRANSLATION

SCALE