[futurebasic] Re: Pixel rotatin'/3D links

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : May 1998 : Group Archive : Group : All Groups

From: Robert Covington <t88@...>
Date: Wed, 27 May 1998 14:13:08 -0800
>My trigs and maths aren't very good (neither is my spellin) so...
>
>If you have some points on a grid (X,Y) and you want to rotate them (sort
>of like a bit map rotate in a paint program but these are points),
>ah...er...ahem...cough... how do you do it?
>
>COS I just TAN figger it out..._sine...
>
>
>Mel Patrick - theWabbitGuy - mel@...

Mel,
I suppose that is a _sine of your despair that you would use such wea-puns
on us.TAN's a lot.

Swiped, neh, commandeered with honors from
<http://www.osha.igs.net/~dandelong/nw/ms_r2d.htm> (Nash's World) rather
than spattering it forth as my own knowledge, though I knew it too, because
I have been working with this stuff a bit, but wasn't quite sure, not this
time, so I digress, here it is. Help stamp out and abolish redundancy.
Other links below too for a 3D treasure trove of helpful stuff.

<Begin Swipe>:

NewX = OriginalX*cos(angle*RADIANS) - OriginalY*sin(angle*RADIANS)
NewY = OriginalX*sin(angle*RADIANS) + OriginalY*cos(angle*RADIANS)

Oops, did I forget to mention RADIANS? It's a floating point value that
scales angles in degrees (0 - 360) down to radians (0 - (2*PI)) so that
means that 6.28318 in RADIANS equals 360 in DEGREES.
The sin/cos functions in "math.h" require an angle to be in RADIANS
format so unless you adjust your program to use the RADIAN scale of
angles you will need to make this conversion when you rotate
(Unless you make a look-up table of sin/cos values, this is a necessity
if you're looking for speed and aren't concerned with size or exact
accuracy)

You could define RADIANS like this ...
#define RADIANS (3.14159/180.0)
  //The ratio between 2*pi and 360o

<End Swipe>

Cool program and helpful source (C):

<http://raru.adelaide.edu.au/craig/rotater/>

This link below, for all things 3D and code/theory too. (More C/Pascal)

<http://www.maths.bath.ac.uk/~pjw/NOTES/graphics/graphics.html>

And Paul D. Bourke's site. Lot of stuff, code snippets, etc.
Modeling/Rendering/DXF/File Formats, etc.

<http://www.mhri.edu.au/~pdb/>