# Workbook 5: Curves in 2D

## CS559 Spring 2021 Sample Solution - Workbook 5

Written by CS559 course staff

You can try out the example solutions here. The interesting code is on page 9, page 11 and page 12.

This workbook is due on Monday, March 1, 2021.

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

The “programming project” that goes with Curves is to make a train. Originally, we had the train as part of this workbook - but it was too much for one week (the train is a pretty big thing unto itself). So, this workbook covers the basics of curves, and then next week you’ll use some of it to make the train.

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

## Learning Goals

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

## Required Reading

Note: you will want to mix the required reading, the optional reading, and the workbook together.

**Textbook:** Curves are covered in FCG4_Ch15.pdf (0.5mb). Since this chapter is a little mathematical, mix the reading with the lectures and the workbook to connect the intuitions. Hart20-jan19.pdf (2.4mb) is optional, as it covers much of the same material in a different way. We won’t cover all the material in class. The required sections are:

- FCG 15.1 - basic ideas of curves, including parameterizations and piecewise representations
- FCG 15.2 - curve properties (especially continuity)
- FCG 15.3 - polynomial pieces - you need to have the basic intuitions, however, you will not need to do the derivations yourself.
- FCG 15.4 - putting pieces together - this makes things sound more complicated than they are
- 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
- 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.

In Hart, you should read this to clarify and reinforce the required material above, but there isn’t anything new, so this can be considered optional.

- Hart 20.0 - basics of curves, a good review of the terms discussed in FCG 15.1-15.3
- Hart 20.1 - the wiggle theorem - make sure you have the intuition that an nth degree polynomial has n-1 wiggles.
- Hart 20.2 - Lagrangian curves - this is also 15.3.6 in FCG - understand the basic idea to know why we don’t use these things.
- Hart 20.3 - Hermite curves - these are in 15.3.4 and 15.5.2 of FCG. You won’t need to derive them, but understanding what they are will be useful for Beziers and Cardinals, which we will use a lot.
- Hart 20.4 - Bézier curves - these are important, so seeing them more than once may help.

The rest of the Chapter focuses on B-Splines and rational curves, which we won’t cover in class.

**Videos:** A few years ago, we made some videos to explain the algorithms for Bezier curves (they are optional but helpful):

- 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

## Rubric for Grading

Note: there aren’t many bonus points this week. Next week, there will be many bonus point opportunities.

## Workbook Rubric (92 points total)

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!