# camera rotation

Page 1 of 1

## 1 Replies - 434 Views - Last Post: 22 April 2010 - 10:36 PMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'http://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=169696&amp;s=372577052cbcf662e8ea8d0cf0a82b91&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #1 sribhargavi

Reputation: 0
• Posts: 1
• Joined: 22-April 10

# camera rotation

Posted 22 April 2010 - 07:40 PM

a program that will fly a 3D camera in a circle around the origin where a shaded teapot is
drawn. Use glutSolidTeapot() with the size parameter set to 1.0 to place a unit teapot at the origin. The
circle that the camera moves on should have a radius big enough so that the view of the teapot fits nicely
in your window. Use the GLUT Idle() callback to update the display to simulate animation. In Idle() a
rotation amount, say theta, is incremented by a small amount and the new camera position is calculated,
and then glutPostRedisplay() is called to invoke your programs GLUT draw() function.
A circle in 3D has one of its parameters, x, y, or z held constant. To rotate in the (x, y) plane, set z=0,
and then the x and y coordinates of the camera can be found, by trigonometry, as x = r cos(theta) and y
= r sin(theta).
Start the camera at 0° degrees, and rotate it through 360°. The visual effect should be to fly around the
teapot in a circle. The teapot should be shaded. For reference look at the displaySolid() function on page
254 of the prescribed Hill and Kelley textbook and use the same materials values etc., as used in that
example.

Is This A Good Question/Topic? 0

## Replies To: camera rotation

### #2 Martyn.Rae

• The programming dinosaur

Reputation: 543
• Posts: 1,406
• Joined: 22-August 09

## Re: camera rotation

Posted 22 April 2010 - 10:36 PM

sribhargavi, on 23 April 2010 - 01:40 AM, said:

A program that will fly a 3D camera in a circle around the origin where a shaded teapot is drawn. Use glutSolidTeapot() with the size parameter set to 1.0 to place a unit teapot at the origin. The circle that the camera moves on should have a radius big enough so that the view of the teapot fits nicely in your window. Use the GLUT Idle() callback to update the display to simulate animation. In Idle() a rotation amount, say theta, is incremented by a small amount and the new camera position is calculated, and then glutPostRedisplay() is called to invoke your programs GLUT draw() function.

A circle in 3D has one of its parameters, x, y, or z held constant. To rotate in the (x, y) plane, set z=0, and then the x and y coordinates of the camera can be found, by trigonometry, as x = r cos(theta) and y = r sin(theta).

Start the camera at 0° degrees, and rotate it through 360°. The visual effect should be to fly around the
teapot in a circle. The teapot should be shaded. For reference look at the displaySolid() function on page
254 of the prescribed Hill and Kelley textbook and use the same materials values etc., as used in that
example.

Congratulations, you have scored 9 out of 10 for showing us you can copy a question and post it here. No wait, I will give you an extra point for finding this site! That's 10 out of 10! Well done indeed.

Now to the problem at hand. Oh, I see there is no problem, no question asked. Now forgive me for asking some questions. Have you read the forum rules where is states we don't do your assignment for you?

[rules][/rules]

This post has been edited by Martyn.Rae: 22 April 2010 - 10:36 PM