CS335 Fall D Drawings: Circles and Curves

Similar documents
( ) ( ) ( ) ( ) ( ) ( y )

ENGR 1990 Engineering Mathematics The Integral of a Function as a Function

MTH 146 Class 11 Notes

Properties of Logarithms. Solving Exponential and Logarithmic Equations. Properties of Logarithms. Properties of Logarithms. ( x)

1.0 Electrical Systems

4.8 Improper Integrals

Motion. Part 2: Constant Acceleration. Acceleration. October Lab Physics. Ms. Levine 1. Acceleration. Acceleration. Units for Acceleration.

e t dt e t dt = lim e t dt T (1 e T ) = 1

Average & instantaneous velocity and acceleration Motion with constant acceleration

0 for t < 0 1 for t > 0

FM Applications of Integration 1.Centroid of Area

Chapter 2. Motion along a straight line. 9/9/2015 Physics 218

How to Prove the Riemann Hypothesis Author: Fayez Fok Al Adeh.

f t f a f x dx By Lin McMullin f x dx= f b f a. 2

Physics 2A HW #3 Solutions

September 20 Homework Solutions

How to prove the Riemann Hypothesis

The solution is often represented as a vector: 2xI + 4X2 + 2X3 + 4X4 + 2X5 = 4 2xI + 4X2 + 3X3 + 3X4 + 3X5 = 4. 3xI + 6X2 + 6X3 + 3X4 + 6X5 = 6.

22.615, MHD Theory of Fusion Systems Prof. Freidberg Lecture 10: The High Beta Tokamak Con d and the High Flux Conserving Tokamak.

A Structural Approach to the Enforcement of Language and Disjunctive Constraints

CHAPTER 11 PARAMETRIC EQUATIONS AND POLAR COORDINATES

MATH 124 AND 125 FINAL EXAM REVIEW PACKET (Revised spring 2008)

P441 Analytical Mechanics - I. Coupled Oscillators. c Alex R. Dzierba

01 = Transformations II. We ve got Affine Transformations. Elementary Transformations. Compound Transformations. Reflection about y-axis

2D Motion WS. A horizontally launched projectile s initial vertical velocity is zero. Solve the following problems with this information.

Three Dimensional Coordinate Geometry

IX.1.1 The Laplace Transform Definition 700. IX.1.2 Properties 701. IX.1.3 Examples 702. IX.1.4 Solution of IVP for ODEs 704

Honours Introductory Maths Course 2011 Integration, Differential and Difference Equations

PHYSICS 1210 Exam 1 University of Wyoming 14 February points

3 Motion with constant acceleration: Linear and projectile motion

A LOG IS AN EXPONENT.

Chapter 2: Evaluative Feedback

IX.1.1 The Laplace Transform Definition 700. IX.1.2 Properties 701. IX.1.3 Examples 702. IX.1.4 Solution of IVP for ODEs 704

The order of reaction is defined as the number of atoms or molecules whose concentration change during the chemical reaction.

A 1.3 m 2.5 m 2.8 m. x = m m = 8400 m. y = 4900 m 3200 m = 1700 m

Integral Transform. Definitions. Function Space. Linear Mapping. Integral Transform

Minimum Squared Error

Solutions to Problems from Chapter 2

Minimum Squared Error

3. Renewal Limit Theorems

A Kalman filtering simulation

Curves and Surfaces. Chap. 8 Intro. to Computer Graphics, Spring 2009, Y. G. Shin

EXERCISE - 01 CHECK YOUR GRASP

1. Consider a PSA initially at rest in the beginning of the left-hand end of a long ISS corridor. Assume xo = 0 on the left end of the ISS corridor.

INTEGRALS. Exercise 1. Let f : [a, b] R be bounded, and let P and Q be partitions of [a, b]. Prove that if P Q then U(P ) U(Q) and L(P ) L(Q).

graph of unit step function t

Physic 231 Lecture 4. Mi it ftd l t. Main points of today s lecture: Example: addition of velocities Trajectories of objects in 2 = =

(b) 10 yr. (b) 13 m. 1.6 m s, m s m s (c) 13.1 s. 32. (a) 20.0 s (b) No, the minimum distance to stop = 1.00 km. 1.

ECE Microwave Engineering. Fall Prof. David R. Jackson Dept. of ECE. Notes 10. Waveguides Part 7: Transverse Equivalent Network (TEN)

Version 001 test-1 swinney (57010) 1. is constant at m/s.

More on Magnetically C Coupled Coils and Ideal Transformers

Section P.1 Notes Page 1 Section P.1 Precalculus and Trigonometry Review

Contraction Mapping Principle Approach to Differential Equations

Physics 101 Lecture 4 Motion in 2D and 3D

PARABOLA. moves such that PM. = e (constant > 0) (eccentricity) then locus of P is called a conic. or conic section.

Check in: 1 If m = 2(x + 1) and n = find y when. b y = 2m n 2

Motion in a Straight Line

Collision Detection and Bouncing

Calculus Module C21. Areas by Integration. Copyright This publication The Northern Alberta Institute of Technology All Rights Reserved.

Particle Filtering. CSE 473: Artificial Intelligence Particle Filters. Representation: Particles. Particle Filtering: Elapse Time

Introduction to Algebra - Part 2

Mathematics 805 Final Examination Answers

, MATHS H.O.D.: SUHAG R.KARIYA, BHOPAL, CONIC SECTION PART 8 OF

Physics 201, Lecture 5

3D Transformations. Computer Graphics COMP 770 (236) Spring Instructor: Brandon Lloyd 1/26/07 1

EXISTENCE AND UNIQUENESS OF SOLUTIONS FOR A SECOND-ORDER ITERATIVE BOUNDARY-VALUE PROBLEM

Chapter Direct Method of Interpolation

Outline. Expectation Propagation in Practice. EP in a nutshell. Extensions to EP. EP algorithm Examples: Tom Minka CMU Statistics

CSC 373: Algorithm Design and Analysis Lecture 9

RESPONSE UNDER A GENERAL PERIODIC FORCE. When the external force F(t) is periodic with periodτ = 2π

BOX-JENKINS MODEL NOTATION. The Box-Jenkins ARMA(p,q) model is denoted by the equation. pwhile the moving average (MA) part of the model is θ1at

SOME USEFUL MATHEMATICS

NMR Spectroscopy: Principles and Applications. Nagarajan Murali Advanced Tools Lecture 4

Vector autoregression VAR. Case 1

Some Inequalities variations on a common theme Lecture I, UL 2007

M r. d 2. R t a M. Structural Mechanics Section. Exam CT5141 Theory of Elasticity Friday 31 October 2003, 9:00 12:00 hours. Problem 1 (3 points)

M344 - ADVANCED ENGINEERING MATHEMATICS

( β ) touches the x-axis if = 1

1. Find a basis for the row space of each of the following matrices. Your basis should consist of rows of the original matrix.

22.615, MHD Theory of Fusion Systems Prof. Freidberg Lecture 9: The High Beta Tokamak

An object moving with speed v around a point at distance r, has an angular velocity. m/s m

5.4. The Fundamental Theorem of Calculus. 356 Chapter 5: Integration. Mean Value Theorem for Definite Integrals

Inventory Analysis and Management. Multi-Period Stochastic Models: Optimality of (s, S) Policy for K-Convex Objective Functions

ANSWERS TO EVEN NUMBERED EXERCISES IN CHAPTER 2

Magnetostatics Bar Magnet. Magnetostatics Oersted s Experiment

REAL ANALYSIS I HOMEWORK 3. Chapter 1

EECE 301 Signals & Systems Prof. Mark Fowler

S Radio transmission and network access Exercise 1-2

MAT 266 Calculus for Engineers II Notes on Chapter 6 Professor: John Quigg Semester: spring 2017

A Simple Method to Solve Quartic Equations. Key words: Polynomials, Quartics, Equations of the Fourth Degree INTRODUCTION

3.1.3 INTRODUCTION TO DYNAMIC OPTIMIZATION: DISCRETE TIME PROBLEMS. A. The Hamiltonian and First-Order Conditions in a Finite Time Horizon

Computing with diode model

Ch.4 Motion in 2D. Ch.4 Motion in 2D

GEOMETRIC EFFECTS CONTRIBUTING TO ANTICIPATION OF THE BEVEL EDGE IN SPREADING RESISTANCE PROFILING

5.1-The Initial-Value Problems For Ordinary Differential Equations

T-Match: Matching Techniques For Driving Yagi-Uda Antennas: T-Match. 2a s. Z in. (Sections 9.5 & 9.7 of Balanis)

A Novel Method for Trajectory Planning of Cooperative Mobile Manipulators

PHY2048 Exam 1 Formula Sheet Vectors. Motion. v ave (3 dim) ( (1 dim) dt. ( (3 dim) Equations of Motion (Constant Acceleration)

Science Advertisement Intergovernmental Panel on Climate Change: The Physical Science Basis 2/3/2007 Physics 253

Phys 110. Answers to even numbered problems on Midterm Map

Transcription:

CS5 Fll 7 D Drwings: Circles nd Curves

Reresening A Circle Elici reresenion: r ± Imlici reresenion:, r F, r F c c rmeric reresenion: θ θ sin cos r r

Drwing Circles Equion for circle: Given: cener c, c nd rdius r c c r c r c ± r c c No n idel roch: Non-uniform scing during evluion cuses noicele rifcs Figure - Also, we hve o evlue ^, nd sqr

Drwing Circles rmeric olr Reresenion for circle: c r cosθ c r sinθ θ se c Allows uniform scing vi he θ vrile θse size is ofen se o e /r. c We cn render djcen oins vi lines o void gs θ se

Drwing Circles Onl need o comue ocn We cn reduce he numer of clculion: Eloi Smmer of Circle Need onl o comue θ,45 or 9,45

The Circle Midoin Algorihm, M E SE Gols: Imlici formulion Finie differences incremenl Ineger rihmeic Ke ide: ech se, decide which iel E or SE is closes o he circle. Choose h iel nd drw i.

The Imlici Circle Equion If M lies inside he circle, drw iel E If M lies ouside he circle, drw iel SE, M E SE

Imlici Formulion, r F r > Noice h r r r > > >, r F > mens, > F, < F oins ouside circle oins inside circle

The Midoin Tes, M, M E SE The sign of FM gives he nswer s o which iel, E or SE, o drw

Formuling n Algorihm Le d e decision vrile which mkes he midoin es. Then he es o decide which iel o drw is jus if d < hen // he midoin is inside he circle // he circle sses closer o he uer iel drw he E iel else // he midoin is ouside he circle // he circle sses closer o he lower iel drw he SE iel

Formuling n Algorihm MidoinCircle rdius, _cener, _cener ; rdius; Circleoins _cener, _cener,, ; while > { if d < // he midoin is inside he circle // he circle is closer o E iel ; Circleoins _cener, _cener,, ; else // he midoin is ouside he circle // he circle is closer o SE iel ; - ; Circleoins _cener, _cener,, ; end

Formuling n Algorihm Circleoins,,, end Drwoin, ; Drwoin, - ; Drwoin -, ; Drwoin -, - ; Drwoin, ; Drwoin, - ; Drwoin -, ; Drwoin -, - ;

Mking he Algorihm Incremenl,,, E SE M M M M, M M,,

Incremenl Formulion d firs F M F, r If we choose E fer his comuion, we mus comue F M ne. Wh is he relionshi eween d firs F M nd F M

Incremenl Formulion Noice h if we consider moving Es: d d firs ne r r since d ne F M so h we cn comue Or jus d d ne ne d firs d firs

Incremenl Formulion Noice h if we consider moving Souhes: d d firs ne r r since d ne F M so h we cn comue Or jus d d ne ne d firs d firs 5 5

Iniil Condiion The firs oin lies on he circle oin, r. The firs midoin is hus F, r, r M E The sring vlue for he es vrile is SE d sr 5 r r 4 r

The Algorihm MidoinCircle r, c, c ; ; r; r; d 5/4 - r; r; Circleoins c, c,,, ; while > do do if if d d < d d * ; ; ; else d d * - 5; 5; ; --; Circleoins c, c,,, ; end end Hern/Bker err: Algorihm on ge should e: * else *-5 see eq ove

Second Order Differences Noice h he incremens re funcions of he oin of evluion, rher hn simle consns: Es: Souhes: d d ne ne d firs d firs 5 Ke ide: incremenl roch cn e lied gin, o he incremens hemselves

Second Order Differences Four cses Es curren ierion/oin of evluion: Es incremen Δ Souhes incremen: Δ E firs, Δ E ne, E ne Δ E firs Δ, 5 SE firs Δ SE ne, 5 Δ SE ne Δ SE firs

Second Order Differences Souhes curren ierion/oin of evluion: Es incremen Δ Souhes incremen: SE firs Δ SE ne Δ E firs, Δ, E ne E ne Δ E firs Δ, 5 Δ, SE ne Δ SE firs 4 5

An Ineger Algorihm h d 4 h Le so h 4 Since nd we ge d 5 5 d sr 4 r susiuion r h sr r h sr Now, if he originl midoin es is d < The new midoin es ecomes h < 4 4 4 Bu since h srs s n ineger nd is onl incremened inegers, he sme es for h will hold: h <

The Finl Algorihm MidoinCircle r, c, c ; r; h - r; dele ; delse *r 5; Circleoins c, c,, ; while > do if h < h h dele; dele dele ; delse delse ; ;

The Finl Algorihm else h h delse; dele dele ; delse delse 4; ; ; Circleoins c, c,, ; end end

Drwing Ellises r r Using olr Coordines c c r cosθ c r sinθ Imlici c f, ellise r c r - c -r r -,, Midoin Ellise Algorihm Hern ge 9 Eloi Smmer -,-,-

Oher Algeric Surfces Bresenhm roch is icll used for low-level scn conversion of Lines, Circles & Ellises. In rincile, n lgeric curve cn e eressed in he Bresenhm sle.. Mesure error o cul curve mke decision. Find ineger form of error. Find incremenl ude of error crieri In rcice, curve eond conics re drwn s series of shor Bresenhm srigh lines.

CS5 Grhics nd Mulimedi D Drwings: Slines

D Freeform Curves or Slines 4 5 7 6

Slines A icl free form curve designed o ss hrough or ner sequence of oins. Slines re rmeerized curves h generlize liner inerolion of srigh lines o higher owers of inerolion rmeer.

Liner inerolion s order Sline sr : end : r,, z, K r,, z, K where : nd Jgged Lines : 4 5 7 6 G : geomeric coninui: he endoins coincide

Qudric inerolion c A B C mches derivives u nd derivive is cho G : ngens hve he sme sloe

Cuic Sline & Inerolion r r A r B r C r D α β γ δ C : firs derivive on oh curves mch join oin Emles: Nurl Cuic Sline Hermie Bezier B-sline The "seed" is he sme efore nd fer

Reresening Curves Cuic curve o minin C coninui Mri Reresenion d c d c ] [ ] [ d c d c

Solving for Coefficiens Coninui C, C, ec.

The Grdien of Cuic Curve d d d d d c d c ] [ ] [ d c d c d d d d c c Mri noion:

The Hermie Secificion s Mri Equion d d d d d d d d d c d c

Solving he Hermie Coefficiens d d d d d d d d d c d c M Hermie G Hermie Cuic Hermie Sline Equion: Hermie Hermie ] [ ] [ G M

Anoher W o Think Aou Slines Cuic Hermie Sline Equion Afer reordering mulilicions Hermie Hermie ] [ ] [ G M 4 ] [ f f f f T

Hermie Blending Funcions

Bezier Sline Conrol oin Conrol oin Anchor oin 4 Anchor oin 4

Convering from Bezier o Hermie Since Susiuing gives: 4 4 d d d d d d d d 4 4 Hermie T M d c d c T 6 M Bezier

Blending Funcions for Bezier Slines B B4 B B 4 B B B B

Bezier Curve roeries Blending funcions lws Curve lws Sum o riion of uni Are non-negive Sisf B B B4 B sses inside he conve hull of he conrol oins Goes hrough he wo endoins Is ngen o he conrol olgon he endoins

Conve Hull roer

Drwing Sline Curves for eween nd gives ll he oins on he curve: /6 / / / 5/6 4 8 8 8 8 7 4 ], [

Disling Cuic Curves Divide inervl [, ] ino n even ieces Evlue he curve ech vlue of wihin he inervl Drw line segmens connecing he oins Wh is he cos of disling curves his w? 4 An incremenl roch is ossile

Forwrd Differencing The incremenl roch used he Midoin lgorihm for lines is form of forwrd differencing Consider he following liner equion: Δ Δ

Forwrd Differencing Δ Δ In his liner cse olnomil of degree, he forwrd difference lied once gives consn erm which cn e used o comue successive vlues of For cuic curve, we hve generl form which is cuic equion, nd clculing single difference will no reduce he equion immediel o consn

Forwrd Differencing d c d c Δ B ending he difference equion nd simlifing we ge c Δ

Cuic Slines: Forwrd Differencing c Δ This difference is he firs order difference, which reduces he degree of he cuic equion, i.e., i is now qudric The second order difference cn e comued ling he sme differencing echnique o he equion for Δ c Δ c Δ

Second-Order Differencing Δ Δ 6 Δ 6 Δ c We wish o evlue oins on he curve for hese vlues of : {,,,,...,} Using he curren differencing scheme firs nd second-order differencing, we ge he following lgorihm for comuing oins on he curve:

Comuing Curve oins ; n d d c 6 6 6 Δ c c Δ

Comuing Curve oins Drwoinin,in; // lso mus comue // he -coordine for i; i < n; i Δ Δ Δ Δ 6 Δ 6 Drwoinin,in;

Third-Order Differencing 6 6 Δ 6 6 Δ 6 Δ Δ Δ Now we hve n incremenl formulion h uses onl simle ddiions in he loo where curve oins re comued:

Algorihm: rd Order Differencing ; ; n d ; Δ c Δ c Δ 6 Δ 6 Δ 6 Δ 6 Drwoinin,in; for i; i < n; i Δ Δ Δ Δ Δ Δ Δ Drwoinin,in; d Δ Δ Δ Δ Δ Δ Δ

A Few Things o Consider We hve n incremenl, fs lgorihm for evluing he oins on cuic sline, where he curve equion is of he form d c α Bu he Bezier curve s we hve develoed i is of he form How cn we formule he incremenl lgorihm for Bezier curves? 4 4 4 B α

We cn ke he originl form of he Bezier curve And regrou erms so h i is rewrien s groued cuic: In his form, Regrouing 4 B α 4 6 B α 4 6 d c

Incremenl Bezier c Δ Using he ming of he conrol oins of he Bezier o he coefficiens of he incremenl cuic, we oin he following equions: The oher equions cn e similrl convered 4 6 d c 6 4 Δ

Jv Code for Drwing Bezier Curve imor jv.w.*; imor jv.le.ale; ulic clss Bezier { rive in oins[], oins[]; rive in limi4; rive in coun; rive in widh; rive in heigh; rive in inervls5; ulic Bezier { oins new in[limi]; oins new in[limi]; coun ; }

Drwing he Curve ulic void incurve Grhics g { doule,, old, old, A, B, C; doule,, ; doule del, del, del; doule del, del, del; if coun! limi reurn; // Iniilize vlues for fs Bezier./inervls; *; *; oins[]; oins[]; old ; old ;

Drwing he Curve: Iniilizions // se u dels for he -coords A -oins[] *oins[] - *oins[] oins[]; B *oins[] - 6*oins[] *oins[]; C -*oins[] *oins[]; del A* B* C*; del 6*A* *B*; del 6*A*;

Drwing he Curve: Iniilizions // se u dels for he -coords A -oins[] *oins[] - *oins[] oins[]; B *oins[] - 6*oins[] *oins[]; C -*oins[] *oins[]; del A* B* C*; del 6*A* *B*; del 6*A*;

Drwing he Curve: Forwrd Differencing for in i ; i < inervls; i { del; del del; del del; del; del del; del del; g.drwline inold, inold, in, in; old ; old ; } // end of for loo } // end of incurve

Mnging he Conrol oins ulic void drwolline Grhics g { for in i ; i < coun-; i { g.fillovl oins[i]-widh/, oins[i]-heigh/, widh, heigh; g.drwline oins[i], oins[i], oins[i], oins[i]; } } g.fillovl oins[coun-]-widh/, oins[coun-]-heigh/, widh, heigh;

Mnging he Conrol oins ulic void ddoin in, in { if coun > limi reurn; oins[coun] ; oins[coun] ; coun; } ulic void resecurve { coun ;} } ulic void seinervl in i { inervls i;}

Mulile Conneced Curve Segmens One long curve cn e formed from mulile conneced curve segmens rincil of locli: chnge in he osiion of single conrol oin will ffec mos curve segmens. This is imorn for efficien inercive mniulion of he curves

Smoohness Join oins G G C C n geomeric coninui: he endoins coincide ngens hve he sme sloe firs derivive on oh curves mch join oin nh derivive on oh curves mch join oin

Smooher Joins Bezier slines cn e joined o form chins, u he join oins gurnee onl geomeric G coninui, no derivive C coninui. Thus he re no s smooh in he derivive sense s we migh like. Oher Choices for Curves: Nurl cuic slines Hermie curves Non-rionl rmeric cuic B-slines B-Slines B-sline: Bsis-sline - curve is reresened wih sis funcions Uniform: curve joins re equll sced in rmeer sce Non-rionl: sis funcions re no consrined o e rionl rmeric cuic: sis funcions re cuic funcions of rmeer

B-Slines Curve segmens overl shring conrol oins ou of he four h re required o define curve segmen. This gurnees ver smooh join oins, u comlices he disl rocess slighl rincile of Locli: how mn curve segmens re ffeced mos when conrol oin is moved?

B-Slines: Single Curve Segmen TM sline G B sline B α [ ] 4 4 4 6 4-4 6 sline B α

Bezier vs. B-sline Curve Definiions [ ] sline B 4 4 4 6 α [ ] Bezier 4 4 6 α

Blending Funcions B B4 B B 4 B B B B B B4 B B 4 4 6 B B B B Bezier Blending Funcions B-sline Blending Funcions

Conrol oins nd he rmeer 5 4 4,,,,,,,,, Q Q Q

Gins nd Losses wih B-Slines Gins: Locli Comc form for mulile segmens C coninui Blending funcion/conve hull roeries Losses: Conrol over ec osiion of curve inerolion vs. roimion

Addiionl Toics o Sud Kno osiion nd conrol Aroimion vs. Inerolion Insering/deleing conrol oins Oher lending funcions

Summr Coninui of free-form curves G, G, C, C, C Cuic Curves Slines Hermie Mri reresenion Blending Bezier B-Sline