Math Is Fun Forum

  Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °

You are not logged in.

#1 2005-11-07 22:27:43

robjohns
Member
Registered: 2005-11-07
Posts: 2

circle to 3d coordinates

howdy,

I've been playing around with computer graphics after taking a course on it at uni. What I want to do is move a "camera" around an arbitary point ("origin") by a known distance... the method taught for this kind of thing was rotating the entire scene and leave the camera unchanged, but that's horribly inefficient for a scene with a high poly count...

The way I've been thinking to do this is to move the camera along an imaginary circle, always pointing at the origin. My attempts to figure this out myself have been pretty bad wink

So say the origin is at (0,0,0) (x,y,z) and the camera is (10, 10, 0). The y value will be constant (since it's the "up" axis) with new values for x and z simulating movement. I want the camera to move by, say, 5 degrees.

I can figure out where on the circle the camera has moved to (by finding the length of the arc), but how can I translate this back into 3d coordinates (with full 360 rotation)?

Cheers smile

Offline

#2 2005-11-07 23:12:58

robjohns
Member
Registered: 2005-11-07
Posts: 2

Re: circle to 3d coordinates

erm, nevermind. the horrible performance I was talking about was due to a couple of problems with my algorithm and the method of refreshing the scene. rotating the entire scene is just fine.

Offline

#3 2005-11-07 23:50:13

MathsIsFun
Administrator
Registered: 2005-01-21
Posts: 7,711

Re: circle to 3d coordinates

Hi robjohns, and welcome to the forum.

That's the second time this week someone has solved their own problem ... must be the big build up of karma happening here.


"The physicists defer only to mathematicians, and the mathematicians defer only to God ..."  - Leon M. Lederman

Offline

#4 2005-11-08 08:58:45

mikau
Member
Registered: 2005-08-22
Posts: 1,504

Re: circle to 3d coordinates

"the method taught for this kind of thing was rotating the entire scene and leave the camera unchanged, but that's horribly inefficient for a scene with a high poly count..."


HAH! Thats exactly what I did with my 3d engine. I thought it was a some what primitive and ineligant method but it seems to work. Also I'm sure the 3d rotation only effects what I call the virtual coordinates, (temporary copies of the real coordinates that are translated) so the objects real coordinates are unchanged so the world does not revolve around you! tongue

Last edited by mikau (2005-11-08 08:59:15)


A logarithm is just a misspelled algorithm.

Offline

Board footer

Powered by FluxBB