HTML and CSS Reference
In-Depth Information
Chapter 10
Coordinate Rotation and Bouncing Off Angles
What we'll cover in this chapter:
Simple coordinate rotation
Advanced coordinate rotation
Bouncing off an angle
This chapter covers a technique known as coordinate rotation , which as its name implies, involves rotating
a coordinate around a point. While useful all by itself, coordinate rotation is indispensable for several very
interesting effects, including how to bounce something off an angled surface. We'll cover how to do that in
this chapter.
Coordinate rotation is also useful for calculating the reactions of two objects that bounce off each other.
You'll see how to do that in the next chapter, where we discuss the conservation of momentum. Since the
next chapter builds off the knowledge presented in this chapter, make sure you have a fairly good
understanding of coordinate rotation before moving on.
Simple coordinate rotation
The technique for simple coordinate rotation was covered in Chapter 3 when discussing trigonometry. You
have a center point, an object, a radius (orbit), and an angle (in radians). You increase or decrease the
angle, and use basic trigonometry to place the object around the center point. You can set a variable such
as vr (velocity/speed of rotation) to control how much the angle is increased or decreased. Using pseudo-
code, the program setup would look like this:
 
Search WWH ::




Custom Search