1 SIC / CoC / Georgia Tech MAGIC Lab Rossignac Bezier example  Interaction  Animation  Tracking  Menus  Debugging.

Slides:



Advertisements
Similar presentations
Creative Computing. \\ aims By the end of the session you will be able to: 1.Move objects around 2.Write simple interactive programs 3.Use the mouse position.
Advertisements

Animation Marco Gillies. Computer Animation Making things move A key aspect of computer graphics Non-realtime for films Realtime for virtual worlds and.
1 Georgia Tech, IIC, GVU, 2006 MAGIC Lab Rossignac Project P3: CSG Lecture 08, File P3.ppt Due Feb 14 Individual.
Programming in Processing Taught by Ms. Madsen Assistants: Ms. Fischer and Ms. Yen Winsor School, 2/13/08.
Game with US Beginner Tutorial. Welcome!! Who I am What is Processing? Basic Coding Input Methods Images Classes Arrays.
A Quick Introduction to Processing
© Calvin College, Being abstract is something profoundly different from being vague... The purpose of abstraction is not to be vague, but to create.
1 Georgia Tech, IIC, GVU, 2006 MAGIC Lab Rossignac Programming Project 2 SORTING Lecture 05, file P2 Due January.
1 Georgia Tech, IIC, GVU, 2006 MAGIC Lab Rossignac Programming Project 1 Truth Table Lecture 03, file P1 Due January.
Parametric Curves Ref: 1, 2.
© University of Wisconsin, CS559 Spring 2004
#8: Curves and Curved Surfaces CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006.
Grundaufbau import processing.core.PApplet; public class Proc_Minimal extends PApplet { public void setup(){ size(1024, 768); frameRate(60.0f);
Translate, Rotate, Matrix Pages Function Function Definition Calling a function Parameters Return type and return statement.
Computer graphics & visualization Key frame Interpolation.
FUNDAMENTALS OF PROGRAMMING SM1204 Semester A 2011.
CSCE 441 Computer Graphics: Keyframe Animation/Smooth Curves Jinxiang Chai.
IAT 800 Lab 1: Loops, Animation, and Simple User Interaction.
, Fall 2006IAT 800 Lab 2: Polygons, Transformations, and Arrays.
ICM Week 2. Structure - statements and blocks of code Any single statement ends with semicolon ; When we want to bunch a few statements together we use.
PROCESSING Animation. Objectives Be able to create Processing animations Be able to create interactive Processing programs.
Programming for Artists ART 315 Dr. J. R. Parker Art/Digital Media Lab Lec 10 Fall 2010.
Review of Interpolation. A method of constructing a function that crosses through a discrete set of known data points.
Processing Lecture.2 Mouse and Keyboard
Vector Computer Graphic. Vector entities Line Circle, Ellipse, arc,… Curves: Spline, Bezier’s curve, … … Areas Solids Models.
Points, lines, circles, and arcs In this lecture we focus on geometric construction techniques that are needed to do manual drafting assignments.  Dividing.
INTERPOLATION & APPROXIMATION. Curve algorithm General curve shape may be generated using method of –Interpolation (also known as curve fitting) Curve.
Chi-Cheng Lin, Winona State University CS430 Computer Graphics Vectors Part II Application of Linear Combination.
CS 445/645 Fall 2001 Splines/Film/Animation. Final Exam Thursday, December 13 th from 7 – 10 p.m. –Room Olsson 011 You may use one sheet of notes (8.5.
Review Inheritance Overloading and overriding. example1.pde.
CIS 3.5 Lecture 2.2 More programming with "Processing"
1 Georgia Tech, IIC, GVU, 2006 MAGIC Lab Rossignac Lecture 09: SEQUENCES Section 3.2 Jarek Rossignac CS1050: Understanding.
12/3/2015Jarek Rossignac, CoC, GT, ©Copyright 2003Transformations, slide 1 Human-Shape Interaction modalities CS4451 Prof. Jarek Rossignac College of Computing.
Mouse Inputs in Processing. Interacting with the Mouse mouseX and mouseY: pg mouseXmouseY –The position of the mouse in the canvas pmouseX and.
CSCE 441 Computer Graphics: Keyframe Animation/Smooth Curves Jinxiang Chai.
1 Georgia Tech, IIC, GVU, 2006 MAGIC Lab Rossignac Project P9 Graphs Jarek Rossignac CS1050: Understanding and Constructing.
Animation Pages Function Function Definition Calling a function Parameters Return type and return statement.
Computation as an Expressive Medium Lab 2: Polygons, Transformations, and Arrays Evan.
CSCE 441 Computer Graphics: Keyframe Animation/Smooth Curves Jinxiang Chai.
______________________________________________________________________________________ SCHOOL OF INTERACTIVE ARTS + TECHNOLOGY [SIAT] |
Designing Parametric Cubic Curves 1. 2 Objectives Introduce types of curves ­Interpolating ­Hermite ­Bezier ­B-spline Analyze their performance.
FUNDAMENTALS OF PROGRAMMING SM1204 SEMESTER A 2012.
Computation as an Expressive Medium Lab 2: Polygons, Transformations, and Arrays (Oh My) Micah.
College of Computer and Information Science, Northeastern UniversityFebruary 27, CS U540 Computer Graphics Prof. Harriet Fell Spring 2009 Lectures.
1 SIC / CoC / Georgia Tech MAGIC Lab Rossignac Processing  Install Processing  Learn how to edit, run, save, export,
What is Computing? What can be Programmed? Creative Computing Processing Downloading Processing Dropbox Primitive Shapes – point – line – triangle – quad.
1 Georgia Tech, IIC, GVU, 2006 MAGIC Lab Rossignac Lecture 05: SORTING Section 2.1 Jarek Rossignac CS1050: Understanding.
Review Random numbers mouseX, mouseY setup() & draw() frameRate(), loop(), noLoop() Mouse and Keyboard interaction Arcs, curves, bézier curves, custom.
Computer Science I Text input. Transformations. Yet another jigsaw. Classwork/Homework: Create new application making use of transformations.
1 Georgia Tech, IIC, GVU, 2006 MAGIC Lab Rossignac.
Int fact (int n) { If (n == 0) return 1; else return n * fact (n – 1); } 5 void main () { Int Sum; : Sum = fact (5); : } Factorial Program Using Recursion.
CS552: Computer Graphics Lecture 19: Bezier Curves.
Loops. About the Midterm Exam.. Exam on March 12 Monday (tentatively) Review on March 5.
CSCI480/582 Lecture 9 Chap.2.2 Cubic Splines – Hermit and Bezier Feb, 11, 2009.
CS 445 / 645 Introduction to Computer Graphics
Chapter 14, Translate & Rotate
Polygons, Transformations, and Arrays
CSCE 441 Computer Graphics: Keyframe Animation/Smooth Curves
Computation as an Expressive Medium
Use Simpson's Rule with n = 10 to estimate the length of the arc of the twisted cubic {image} , from the origin to the point (3, 9, 27)
CS U540 Computer Graphics Prof. Harriet Fell Spring 2007
Mouse Inputs in Processing
More programming with "Processing"
Control structures Chapter 3.
IAT 265 Lecture 2: Java Loops, Arrays Processing setup, draw, mouse Shapes Transformations, Push/Pop.
Translate, Rotate, Matrix
Animation Pages
PPT10: Global and local approximation
Processing Environment
Computation as an Expressive Medium
Presentation transcript:

1 SIC / CoC / Georgia Tech MAGIC Lab Rossignac Bezier example  Interaction  Animation  Tracking  Menus  Debugging

2 SIC / CoC / Georgia Tech MAGIC Lab Rossignac Point on cubic Bezier curve pt cubicBezier(pt A, pt B, pt C, pt D, float t) { return( s( s( s(A,t,B),t, s(B,t,C) ), t, s( s(B,t,C),t, s(C,t,D) ) ) ); } pt s(pt A, float s, pt B) {return(new pt( A.x+s*(B.x-A.x), A.y+s*(B.y-A.y) ) ); };

3 SIC / CoC / Georgia Tech MAGIC Lab Rossignac Draw cubic Bezier curve void draw() { background(121); noFill(); stroke(dred); strokeWeight(3); drawCubicBezier(PP[0],PP[1],PP[2],PP[3]); void drawCubicBezier(pt A, pt B, pt C, pt D) { beginShape(); for (float t=0; t<=1; t+=0.02) {cubicBezier(A,B,C,D,t).v(); }; endShape(); }

4 SIC / CoC / Georgia Tech MAGIC Lab Rossignac Manual control of time float t=0.5; void draw() { if ((mousePressed)&&(keyPressed)&& mouseIsInWindow()&&(key=='t')) { t+=2.0*(mouseX-pmouseX)/height; fill(black); text("t="+t,20,40); }; pt P = cubicBezier(PP[0],PP[1],PP[2],PP[3],t); P.show();

5 SIC / CoC / Georgia Tech MAGIC Lab Rossignac Automatic control of time float t=0.5, tt=0.5; void draw() { if (animate) {tt+=PI/180; if(tt>=PI*2) tt=0; t=(cos(tt)+1)/2;} else {… manual control …}; pt P = cubicBezier(PP[0],PP[1],PP[2],PP[3],t); P.show(); void mousePressed() { k= Toggles.click(); m=-1; … if(k==++m) {animate=Toggles.v(m); if(animate) tt=acos(t*2-1); else t=(cos(tt)+1)/2; }

6 SIC / CoC / Georgia Tech MAGIC Lab Rossignac TRACKING

7 SIC / CoC / Georgia Tech MAGIC Lab Rossignac Frame frame T= new frame (); void draw() { pt P = cubicBezier(PP[0],PP[1],PP[2],PP[3],t); vec V = cubicBezierTangent(PP[0],PP[1],PP[2],PP[3],t); V.normalize(); vec N=V.left(); T.setTo(P,V,N); fill(dgreen); stroke(orange); T.show(); pushMatrix(); T.apply(); ellipse(0,0,40,20); popMatrix(); class frame { // frame [O I J] pt O = new pt(); vec I = new vec(1,0); vec J = new vec(0,1) void setTo(pt pO, vec pI, vec pJ) {O.setTo(pO); I.setTo(pI); J.setTo(pJ); } void apply() {translate(O.x,O.y); rotate(angle());} void show() {float d=height/20; O.show(); I.makeScaledBy(d).showArrowAt(O); J.makeScaledBy(d).showArrowAt(O); }

8 SIC / CoC / Georgia Tech MAGIC Lab Rossignac Ghost frame frame T= new frame (), F= new frame (), G= new frame (), H= new frame (); void draw() {…. compute P, V, N as above T.setTo(P,V,N); H.moveTowards(T,0.1); G.moveTowards(H,0.1); F.moveTowards(G,0.1); if(showGhostFrame) {fill(yellow); stroke(yellow); F.show(); pushMatrix(); F.apply(); ellipse(0,0,40,20); popMatrix();}; class frame {pt O = new pt(); vec I = new vec(1,0); vec J = new vec(0,1); void moveTowards(frame B, float s) {O.translateTowards(s,B.O); rotateBy(s*(B.angle()-angle()));} void rotateBy(float a) {I.rotateBy(a); J.rotateBy(a); } class vec { float x=0,y=0; void rotateBy (float a) {float xx=x, yy=y; x=xx*cos(a)-yy*sin(a); y=xx*sin(a)+yy*cos(a); };

9 SIC / CoC / Georgia Tech MAGIC Lab Rossignac MENU void setup() { size(1100, 800); loadButtons(); loadToggles(); void draw() { if(showMenu) {Buttons.show(); Toggles.show(); … void loadButtons() { Buttons.add(new button("recursions",0,rec,7,1,7)); … void loadToggles() { Toggles.add(new toggle("Animate",animate)); … void mousePressed() { int k= Buttons.click(); int m=-1; if(k== ++m) {rec=int(Buttons.v(m));}; … k= Toggles.click(); m=-1; if(k==++m) {animate=Toggles.v(m); if(animate) tt=acos(t*2-1); …};… if(k==++m) {Toggles.B[m].V=false; reset(); }; // one time action, not toggle

10 SIC / CoC / Georgia Tech MAGIC Lab Rossignac DEBUGGING boolean printIt=false; void draw() { … if (printIt) P.write(); … printIt=false; } void keyPressed() { if (key=='?') printIt=true;

11 SIC / CoC / Georgia Tech MAGIC Lab Rossignac Fitting a Bezier span  Hermite problem: –You are given 2 points and associated tangent directions –Find a “nice”smooth curve that interpolates these end conditions –Why do you need a cubic?

12 SIC / CoC / Georgia Tech MAGIC Lab Rossignac Fit Bezier to point and tangent constraints  We create a joining curve with thickness between Pj and Pm as a cubic Bezier arc.  d=|PmPj|, a=|PiPj|, b=|PmPn|  Pk=Pj+dPiPj/3a, Pl=Pm+dPnPm/3b  rk=rj+d(rj-ri)/3a, rl=rm+d(rm-rn)/2a  rs=A(A(A(rj,s,rk),s, A(rk,s,rl)),s, A(A(rk,s,rl),s, A(rl,s,rm))), Bezier construction of r  Ps=A(A(A(Pj,s,Pk),s, A(Pk,s,Pl)),s, A(A(Pk,s,Pl),s, A(Pl,s,Pm))), Bezier construction of P  A(X,s,Y) = X+s(Y-X), linear interpolation Pi Pj PkPkPkPk Pl Pm Pn