Over 10 Million Study Resources Now at Your Fingertips

Download as :
Rating : ⭐⭐⭐⭐⭐
Price : $10.99
Pages: 2

The trigono-metric functions sine and cosine return the and values the point the circle



Drawing in Space: Geometric Primitives and Buffers

// Flush drawing commands



Again, don’t get too distracted by the functions in this example that we haven’t covered yet (glPushMatrix, glPopMatrix, and glRotate). These functions are used to rotate the image around so you can better see the positioning of the points as they are drawn in 3D space. We cover these functions in some detail in Chapter 4. If we hadn’t used these features now, you wouldn’t be able to see the effects of your 3D drawings, and this and the following sample programs wouldn’t be very interesting to look at. For the rest of the sample code in this chapter, we show only the code that includes the glBegin and glEnd statements.

The figure in this box shows a circle drawn in the xy plane. A line segment from the origin (0,0) to any point on the circle makes an angle (a) with the x-axis. For any given angle, the trigono-metric functions sine and cosine return the x and y values of the point on the circle. By stepping a variable that represents the angle all the way around the origin, we can calculate all the points on the circle. Note that the C runtime functions sin() and cos() accept angle values measured in radians instead of degrees. There are 2*PI radians in a circle, where PI is a nonrational number that is approximately 3.1415. (Nonrational means it is a repeating decimal number that cannot be represented as a fraction.)

GLfloat sizes[2]; // Store supported point size range

GLfloat step; // Store supported point size increments

How It Works
Login account
Login Your Account
Add to cart
Add to Cart
Make payment
Document download
Download File
PageId: ELI3BDC7F4
Uploaded by :
Page 1 Preview
the trigonometric functions sine and cosine return
Sell Your Old Documents & Earn Wallet Balance