HELP ME with a dead simple 3D routine PLEASE!

HELP ME with a dead simple 3D routine PLEASE!

Post by pj.. » Sat, 08 Feb 1992 01:20:14



Hi..

   I am trying to write a 3D graphics routine will transform a length and two
angles into x,y,z coordinates.

   L = distance of point from a constant centre of rotation (say xr,yr,zr)
  A1 = Rotation in x-y plane
  A2 = Rotation in x-z plane

Using these I believe I can represent the location of any point in 3D space?
Am I right...?

For displaying on the screen I need to convert these to x,y,z coords.  I have
been fiddling for a while with the following -

  x = xr + L*SIN(A1)*COS(A2)
  y = yr + L*COS(A1)
  z = zr + L*SIN(A2)

When complete, I hope to be able to pass this routine a couple of angles, and
it will draw a shape rotated by those angles, as shown here -

  x = xr + L*SIN(A1 + XYOFFSET)*COS(A2 + XZOFFSET)
  y = yr + L*COS(A1 + XYOFFSET)
  z = zr + L*SIN(A2 + XZOFFSET)

where XYOFFSET and XZOFFSET are the rotation of the whole shape in the x-y and
x-z planes respectively.

This, however, refuses to work... and I believe it.  My maths stopped after
A levels.

PPPLLLLLEEEEAAAASSSSE can someone help me... before I go completely mad!!!

Thanks in advance,


(can't think of a .sig at the mo)

 
 
 

HELP ME with a dead simple 3D routine PLEASE!

Post by Dan Shipl » Sat, 08 Feb 1992 06:58:51



writes:

Quote:> Hi..

>    I am trying to write a 3D graphics routine will transform a length and  
two
> angles into x,y,z coordinates.

>    L = distance of point from a constant centre of rotation (say xr,yr,zr)
>   A1 = Rotation in x-y plane
>   A2 = Rotation in x-z plane

> Using these I believe I can represent the location of any point in 3D  
space?
> Am I right...?

> For displaying on the screen I need to convert these to x,y,z coords.  I  
have
> been fiddling for a while with the following -

>   x = xr + L*SIN(A1)*COS(A2)
>   y = yr + L*COS(A1)
>   z = zr + L*SIN(A2)

At first I thought you were using a spherical coordinate system, but then I  
realized that it is a little different.  Anyway, I worked out the equations,  
and here they are ...

x = xr + L*COS(A1)*COS(A2)
y = yr + L*COS(A2)*SIN(A1)
z = zr + L*COS(A1)*SIN(A2)

These should work for you.  If you have any problems, feel free to e-mail!

-- Dan
*****************************************************************************
   dshipley at cs.umr.edu
or r092592  at apollo.civil.umr.edu     (The University of Missouri - Rolla)
or dan      at ee.umr.edu                    UMR ... The BLACK HOLE !!!
*****************************************************************************
!

 
 
 

1. Wanted: simple 3D routines for X

Hello!

I am looking for a set of routines to show 3D objects
on an X display, e.g.

draw_ball(x,y,z,radius,color)

I'm not too much concerned with the quality of the image. I just
want to recognize a ball as a ball and a cylinder as a cylinder.

Hope somebody can help,

- Joerg

*********************************************************************

MPI fuer molekulare Physiologie
Rheinlanddamm 201
44139 Dortmund
Germany                               +49 (0)231 1206 384
*********************************************************************

2. another animation

3. BICUBIC Image Scaling Routine Help Please !!!

4. Thumbnail Viewer

5. PLEASE help a newbie at cool graphics routines

6. key up events?

7. Simple 3D-mmodelling - pointers please.

8. - logo.gif (1/1) Please help with a really simple POV question

9. - logo.gif (0/1) Please help with a really simple POV question

10. Help with BMRT 2.6(I'm a newbie so please make it simple)

11. PLEASE HELP WITH SIMPLE QUESTION!?!?!?!?!?!?!?!?!?

12. please help: advice needed to solve simple gl programming problem