Workbook 5: Curves in 2D

CS559 Spring 2023 Sample Solution

This is a sample solution for the Workbook. You are welcome to refer to it to learn one way to do the assignment but only after you have turned in your own assignment

In this workbook, we’ll get beyond straight lines to consider curves in 2D.

You can work on this workbook together with Project 1 (the Train Project). The workbook is due on February 28th, but you may submit incomplete screenshots and recordings to WB5G, so this workbook and project are effectively due in 2 weeks.

The workbook is due the same week as the exam. The workbook is a good way to learn the key concepts (which will appear on the exam).

The “programming project” that goes with Curves is to make a train. It is now the next workbook (Project 1).

Several pages have required exercises on them. But, as always, feel free to tinker with all of the provided example demos.

A warning: some of the things you need to complete the later parts of the workbook will only be discussed in the second week of curve lectures.

Learning Goals

  1. To understand the concepts of parametric curves and parameterizations
  2. To understand curve tangents, derivatives, and continuity conditions
  3. To understand piecewise polynomial representations of curves
  4. To understand cubic segments, and the need for different forms
  5. To understand arc-length parameterizations and how we approximate it
  6. To understand the ideas and properties of Bezier curves including their geometric and algebraic formulations
  7. To understand how we draw curves, including adaptation
  8. To be able to use curves in various APIs, including curve format conversion

Required Reading/Watching

The basic concepts are best learned visually. The workbook has interactive gadgets. The lectures will use the interactive gadgets and handwaves. And there are fantastic videos online. Two excellent ones are The Continuity of Splines and The Beauty of Bezier Curves - these use fantastic animations to illustrate the concepts. Watch them. I don’t know if its better to watch them first, or to watch the lectures and read through the workbook first. The videos present things in a different way and a different order.

Textbook: You will want to look at the book to see a bit more formalism and to have the equations written out (although, most of them are in the workbook). Curves are covered in FCG4 Chapter 15. It is best to read this after you watch the lectures and videos - the intuitions were hard to explain in writing (Professor Michael Gleicher wrote the chapter).

  1. FCG 15.1 - basic ideas of curves, including parameterizations and piecewise representations
  2. FCG 15.2 - curve properties (especially continuity)
  3. FCG 15.3 - polynomial pieces - you need to have the basic intuitions, however, you will not need to do the derivations yourself.
  4. FCG 15.4 - putting pieces together - this makes things sound more complicated than they are
  5. FCG 15.5 - cubics - again, you won’t have to derive the different cubic types, but make sure you know what hermites and cardinals are
  6. FCG 15.6.1 - Bézier curves - very important, since they are what gets used in Canvas and many other things. The workbook and lectures will give you the intuitions, the book will show you the equations.

Section 15.6.2 discusses B-Splines, a really cool topic, but one we will only touch on in class. Reading about it (in FCG 15.6.2) is totally optional. It is useful for some of the advanced points at the end of the workbook - and if you want to do graphics beyond class.

Videos: The video The Continuity of Splines is a 60 minute crash course in splines. It is well animated with nice examples to motivate topics, and illustrations of what is going on with the math. The topics aren’t exactly the ones we do in class, but it provides excellent to many topics - and the animations are fantastic. It has an awesome explanation of continuity, local control, and a bunch of things we won’t get to in lecture or the workbook.

The YouTube Video The Beauty of Bezier Curves is a really nice introduction to Bezier curves. It is more focused than the longer video above. The video is a very nicely animated version of the same math in the workbook and my whiteboard derivations below. It goes on to explain arc length, and the methods for computing it. There is some overlap between this video and The Continuity of Splines - but the redundant parts are important, so seeing them multiple times isn’t a problem.

Professor Gleicher made some videos at the whiteboard to explain the algorithms for Bézier curves. The The Beauty of Bezier Curves shows it much better, but this is useful for showing you what you would actually do solving a problem yourself (like on an exam):

  • DeCastlejau 2 - Showing the algorithm for 3 points (a second degree curve)
  • DeCastlejau 3 - Showing the algorithm for 4 points (a third degree curve)
  • DeCastlejau 4 - Shows the connection between the geometric constructions and the polynomial forms

(Note: DeCastlejau is spelled as DeCasteljau this year during the lectures, they refer to the same algorithm.)

Rubric for Grading

This workbook has a lot of points - you can get an A without doing any advanced points, and you can earn a lot of advanced points if you try. As always, your best bet is to focus on the basic points first - you get a lot of them for doing (relatively) easier things; the advanced points are trickier.

Workbook Rubric (95 points total)
Points (83):
20 pt
correct WB5 Canvas Assignment submission
20 pt
correct WB5G Canvas Assignment submission on time
Box 05-01-02
2 pt
implement the correct tangent vector for the parabola
Box 05-03-01
2 pt
cubic coefficients question
Box 05-04-01
2 pt
evaluate Hermite
Box 05-07-03
4 pt
divide the Bezier curve
Box 05-09-01
3 pt
recreated the picture using canvas
Box 05-09-01
2 pt
didn't use quadratic commands but got the correct shape using cubics
Box 05-09-02
5 pt
draw a picture that demonstrate the use of bezierCurveTo in Canvas
Box 05-09-02
1 pt
explained where there is G(1) continuity between Bezier segments
Box 05-10-03
5 pt
make the green dot go around the triangle with arc-length parameterization
Box 05-11-01
5 pt
draw the spiral
Box 05-11-01
1 pt
checkbox control of lines
Box 05-11-01
2 pt
slider control of number of points
Box 05-12-01
2 pt
make a cardinal spline through the points
Box 05-12-02
2 pt
split the Bezier
Box 05-13-01
1 pt
time slider has range 0-2
Box 05-13-01
1 pt
something spins as time goes by
Box 05-13-02
1 pt
dots drawn - and can be dragged
Box 05-13-02
1 pt
lines connecting dots
Box 05-13-02
1 pt
initial hexagon - ui works
Advanced points (12):
Box 05-11-01
3 pt
approximate spiral with Beziers, have a switch for lines/Beziers
Box 05-12-01
4 pt
draw 20 distinct points on the curve
Box 05-12-01
5 pt
the 20 points have equal arc-length between consecutive points

As you go through the workbook pages, feel free to tinker with the programs we have given you as a way to understand how they work!

Get Started

Don’t forget to commit and push as you work!

Get started on Page  1  (Curves)!