2012-07-20 03:14:20

Ahoy, I finally tested my attempt. I'm slightly less than convinced that it works exactly as it should.

Ignore the pitch-related things in here, unless I put them somewhere obviously wrong.

Specifically, the volume seems to be the most non-working.

 const double PI=3.14159265358979323846264;
 void position_sound_3d(sound@ snd, vector listener_position, double theta, vector sound_position, double pan_step=1.0, double volume_step=1.0, double pitch_step=5.0, double behind_pitch_decrease=0.5, double behind_volume_decrease=5.0, double pitch_range=25) {

 // We need distances:
  double xd=listener_position.x-sound_position.x;
 double yd=listener_position.y-sound_position.y;
 double zd=listener_position.z-sound_position.z;
// double d=square_root((xd*xd)+(yd*yd)); // Ignores vertical for now.
 vector v(xd, yd, zd); double d=v.length();
 // Could just be the length of a vector...

 double atheta; double rtheta;
 if((xd==0)&&(yd==0)) atheta=-1;
 if(xd>0) atheta=arc_tangent(yd/xd);

 if(xd<0) atheta=arc_tangent(yd/xd)+PI;
 atheta = (atheta * (180 / PI));
rtheta=atheta-theta;
 double pan=cosine(rtheta*PI/180);
 pan*=100.0*pan_step;
 double volume=sine(rtheta*PI/180);
double tempvolume=-absolute((d*-100)/volume_step); //?
 double pitch=100.0;
 if(volume>0) {tempvolume-=behind_volume_decrease; pitch-=behind_pitch_decrease;}

 // pitch_step indicates the maximum absolute value of pitch variation. So we multiply that by the vertical angle.
 double phi=(
(d!=0) ? arc_tangent(zd/d) : (zd!=0) ? PI/2.0*absolute(zd)/zd : 0 ); // Prease?

 double temppitch=-pitch_step*sine(phi);
 if(temppitch<0) temppitch=math_max(temppitch, -pitch_range);
 else temppitch=math_min(temppitch, pitch_range);
 pitch +=temppitch;
 snd.pan=pan; snd.volume=tempvolume; snd.pitch=pitch;
}// Position_sound_3d.

Is there anything wrong in there?

看過來!
"If you want utopia but reality gives you Lovecraft, you don't give up, you carve your utopia out of the corpses of dead gods."
MaxAngor wrote:
    George... Don't do that.

2012-07-24 20:21:05 (edited by CAE_Jones 2012-07-24 20:22:50)

Allrighty, I decided to rewrite it all from scratch, and the volume situation seems to be all fine and well.
Pan is acting weird, though.

I added a line to my code that would copy data to the clipboard, and then I pasted it at some specific points of interest.
The results have me quite confused, though they kinda explain what the problem is:

(These first two work as expected)
Listener:
0, 0, 0
Sound source:
-17, 4, 0
Theta: 0
atheta: -0.231090667195897
rtheta: -0.231090667195897
pan: -19.4683433666715
volume: -17.4642486572266
pitch: 0


Listener:
-14, 0, 0
Sound source:
-17, 4, 0
Theta: 0
atheta: -0.927295218001612
rtheta: -0.927295218001612
pan: -12
volume: -5
pitch: 0

(Then things get weird from here)
Listener:
-22, 0, 0
Sound source:
-17, 4, 0
Theta: 0
atheta: 0.674740942223553
rtheta: 0.674740942223553
pan: -15.6173761888606
volume: -11.403124332428
pitch: -2

Listener:
-17, 4, 0
Sound source:
-17, 4, 0
Theta: 0
atheta: 1.5707963267949
rtheta: 1.5707963267949
pan: -0.00000000000000122464679914735
volume: -5
pitch: -2


Pan always seems to have the same sign regardless of the sign of atheta and rtheta. To make things weirder, a sound will switch sides if one passes it y-wise, and the panning works perfectly if one stands still and spins around (changing theta).

Note that the data is copied after the sound has already had its pan and volume set, so the data matches the output.

It seems like the problem would have to be in this line of code:
double pan=cosine(rtheta)*-20.0; //?
But I see nothing that would explain the weirdness in that.
Questionmark?

看過來!
"If you want utopia but reality gives you Lovecraft, you don't give up, you carve your utopia out of the corpses of dead gods."
MaxAngor wrote:
    George... Don't do that.

2012-07-24 20:37:09

Hi.
I am not sure this is the cause of your problem but most of the sound editing and playing software I use rounds off the numbers to three digits past the period,
instead of,
pan: -19.4683433666715
volume: -17.4642486572266
you could try,
pan: -19.468
volume: -17.464

2012-07-24 22:32:48

CAE, the first thing that jumps out and concerns me is that your relative and absolute angles show up the same in every situation.

- Aprone
Please try out my games and programs:
Aprone's software

2012-07-25 15:02:24 (edited by CAE_Jones 2012-07-25 15:03:45)

Well, they would, seeing as I didn't change the angle I was facing during that particular test. tongue

[edit] For what it's worth, here's the new code (I think it's a little cleaner than the last version):

 void position_sound_3d(sound@ snd, vector listener_position, double theta, vector sound_position, double pan_step=1.0, double volume_step=1.0, double pitch_step=5.0, double behind_pitch_decrease=0.5, double behind_volume_decrease=5.0, double pitch_range=25) {

 double xd=listener_position.x-sound_position.x;
//sound_position.x-listener_position.x;
 double yd=listener_position.y-sound_position.y;
 double zd=listener_position.z-sound_position.z;
 vector vd(xd, yd, zd);
 double d=vd.length();

double atheta=(xd==0) ? (yd>=0) ? PI/2 : -PI/2 : arc_tangent(yd/xd);
 double rtheta=atheta-theta;

 double pan=cosine(rtheta)*-20.0; //?
 // volume is based on distance:
 double volume=-absolute(d*volume_step);

 // Do we calculate phi, or just use zd on its own?
 double pitch=zd*pitch_step;
 double tempv=sine(rtheta);
 if(tempv>0) {volume-=behind_volume_decrease; pitch-=behind_pitch_decrease;}
 if(pitch<-absolute(pitch_range)) pitch=-absolute(pitch_range); else if(pitch>absolute(pitch_range)) pitch=absolute(pitch_range);
 snd.pan=pan;
 snd.volume=volume;
 snd.pitch=100.0+pitch;
 // Adjust this for start values, or something. :(.

 // Debug:
 clipboard_copy_text("Listener:\r\n" + listener_position.x + ", " + listener_position.y + ", " + listener_position.z + "\r\nSound source:\r\n" + sound_position.x + ", " + sound_position.y + ", " + sound_position.z + "\r\nTheta: " + theta + "\r\natheta: " + atheta + "\r\nrtheta: " + rtheta + "\r\npan: " + pan + "\r\nvolume: " + volume + "\r\npitch: " + pitch);
}// Position sound 3d remake, 10:45 AM 7/24/2012

[/edit]

看過來!
"If you want utopia but reality gives you Lovecraft, you don't give up, you carve your utopia out of the corpses of dead gods."
MaxAngor wrote:
    George... Don't do that.

2012-08-03 11:12:59

The first thing that popped out at me is this line of your code.
double xd=listener_position.x-sound_position.x;
I think you need to reverse the listener and sound_position.
double xd=sound_position.x-listener_position.x;

Leave the Y coordinate line as it is though.  The order is reversed for the Y coordinate line.  Since you're trying to have this handle a Z dimension as well, I have no idea how it should be handled.  For now I'd actually just leave it out because it is entirely possible that modifying my 2D code example to handle 3D might take a lot more changing to make the math work.  I would have to sit down and figure it out, but that's my recommendation for now.

double yd=listener_position.y-sound_position.y;

This line needs to be reversed as well.
if(xd>0) atheta=arc_tangent(yd/xd);
I think it should be arc_tangent(xd/yd) instead of yd/xd.

The same is true for the other line.
if(xd<0) atheta=arc_tangent(yd/xd)+PI;
Flip the yd and xd

This line is missing something I think.
atheta = (atheta * (180 / PI));
I believe it needs to have 90 subtracted from it in order to correctly orient the axis.
atheta = (atheta * (180 / PI))-90;

Here's another line that I think needs to be shifted.
double pan=cosine(rtheta*PI/180);
I also think it would need 90 subtracted from it.
double pan=cosine((rtheta-90)*PI/180);

Also this one.
double volume=sine(rtheta*PI/180);
I think would be
double volume=sine((rtheta-90)*PI/180);

I think that's it.  It's 5:11am and I haven't been to bed yet, so please be sure to make a backup copy of your current code before you go and make any of these adjustments, ROFL!  Especially since I'm tired, I wouldn't put a whole lot of faith in these.  smile

- Aprone
Please try out my games and programs:
Aprone's software

2012-08-03 13:36:25

It's worth a try at least. Thanks!

看過來!
"If you want utopia but reality gives you Lovecraft, you don't give up, you carve your utopia out of the corpses of dead gods."
MaxAngor wrote:
    George... Don't do that.

2013-06-04 11:58:52

wow... just looked through this stuff and unfortunately, i don't get it... i understood the simplified explanation that ghorth gave earlier though.  If only making grids and such was simpler.  I tried doing that once in DFE and it didn't do what i was trying to make it do... its a shame really.

But at least aprone, you're doing amazing work in trying to tell people how you do things!  you're an inspiration!
The Doctor.
p.s. i might use your vb code from the other thread to work on a project i've had in the back of my mind for some time.  that is, if i can be bothered! smile

My TARDIS: time and relative dimension in space machine.  its bigger. on the inside.  infinitely bigger on the inside.

2013-06-04 12:50:09

I think I've since come up with a more versatile solution that simplifies things tremendously, but there's no guarantee that it'll be that easy for whatever you're trying to do.

This solution is to simply use a generic rotation function.

In BGT (based on a javascript example):

 vector rotate(vector p, vector o, double theta) {
 vector r;
r.x = (cosine(theta) * (p.x-o.x)) - (sine(theta) * (p.y-o.y)) + o.x;
r.y = (sine(theta) * (p.x-o.x)) + (cosine(theta) * (p.y-o.y)) + o.y;
 return r;
 }// Rotate.

Where a vector is just a variable with x, y, and optionally z components.
p is the point you're rotating, and o is the point around which it rotates.
If you were trying to make something first person, o would be the player or camera position, and p would be the sound source.
Theta is the angle in radians. If you would rather have theta in degrees, add this as the first line of the function:
theta=3.14*theta/180;
All you'd need to do for a different language would be to replace vector with the appropriate class or type, and rename cosine and sine to whatever the trig functions are in that language (Math.cos / Math.sin, for instance).
You can use this for movement (create a velocity vector, then rotate it to match the player angle), sounds (just play the sound from the returned position), etc.
The rotate function is in my math include for BGT, and is used by my modified sound_pool (in the same package; I think it has a datatype problem somewhere that makes rotation a bit choppy, but I haven't figured out which ints to change to doubles yet).

看過來!
"If you want utopia but reality gives you Lovecraft, you don't give up, you carve your utopia out of the corpses of dead gods."
MaxAngor wrote:
    George... Don't do that.

2013-06-04 16:03:10

Is that vector projection?  For some reason I'm failing trig this morning.  It doesn't look like an actual rotation, however, unless there's a major simplification of the formula I have in mind in computer land: to rotate point p around point q, shift p by -q.x and -q.y, convert to polar, add to theta, and convert back.  Or use a transformation matrix, but that is probably more inefficient in this case.
Can you link the page you found this?  I want to see their explanation.  I thought I had enough math to derive any vector formula I needed-guess not.  My particular solution means I don't have to, however, but I'm still curious.

My Blog
Twitter: @ajhicks1992

2013-06-04 16:10:02

I don't remember where I found it. It does appear to work correctly, though (I was testing something with it just before I got here).

看過來!
"If you want utopia but reality gives you Lovecraft, you don't give up, you carve your utopia out of the corpses of dead gods."
MaxAngor wrote:
    George... Don't do that.

2013-06-04 16:21:57

Yes, but I'm not sure what it's doing.  It's not rotation, it appears to be some sort of projection of a vector onto another vector, and I'd like to find out because that's just a bit weird.  I'm going to have to go review some trig now I think.
If I pass in the point (0,1) for p, the point (0,0) for O, and pi/2 for theta, do I get (1,0)?  Or is it doing something else?

My Blog
Twitter: @ajhicks1992

2013-06-04 16:40:07

My education inconveniently skipped a lot of things related to vectors (it was bad enough that I still don't really understand the cross and dot products), so I have no idea. All I know is that it works as desired (the example you gave should work as described).
(Yeah, I've tried researching these things to make up for it, but everything I find is written as though you already know the material. Someone in the Wikipedia article's talk page said as much, as though cross product is taught in eighth grade (it sure as heck is not, at least not in rural America.).).

看過來!
"If you want utopia but reality gives you Lovecraft, you don't give up, you carve your utopia out of the corpses of dead gods."
MaxAngor wrote:
    George... Don't do that.

2013-06-04 16:47:06 (edited by camlorn 2013-06-04 16:55:22)

Actually, some of that isn't really far beyond 8th grade if you take any honors math.  I had enough trig for this stuff by tenth grade.  My implementation is less efficient than yours, involving two square roots and 4 square operations.  Yours is multiplying by the 2d transformation matrix, but I can't find an explanation of why the 2d  transformation matrix works, only that it does.  Oddly, I have some stuff wherein I derived the 3d transformation matrix, so maybe I need to look at that.

edit: I derived the simple case of ignoring z and not wishing to do any rotations, only transformations, so it doesn't have the info I needed.
Also, the theta in your example is clockwise, I believe.  This isn't a big deal unless you know trig or beyond, in which all theta values are counterclockwise for everything.  The math convention is that theta of zero is to the right and that positive theta means counterclockwise-theta of pi/4 points upright, and 3pi/4 points up left instead of down right and down left respectively.  If anyone comes after me, thinks this is a cool function, and knows the basics of trig, beware of this.  I suspect that my example of (0,1) about (0,0) and theta of pi/2 will actually return (0,-1), but have not tried.

My Blog
Twitter: @ajhicks1992

2013-06-04 18:13:28

Camlorn, I think the reason it is flipped to clockwise instead of counterclockwise is because the Y axis (if we're talking 2D) within the computer is flipped from the way it is presented in normal math.  On the coordinate system we normally think of rising Y values as going up, but for the computer it usually means down.

- Aprone
Please try out my games and programs:
Aprone's software

2013-06-04 18:48:08 (edited by camlorn 2013-06-04 21:18:29)

I know that.  Even so, if one is expecting the trigonometric theta, one is in for a surprise.  I understand the typical coordinate system (except, it's actually not so typical once you go into 3d graphics) for computers.  My personal preference--since Open AL lets you change the coordinate system easily--is to make the coordinate system match the standard trigonometric one.  For OpenGL, you basically specify your own, and if you get outside the trap of "because graphics says so"--we aren't rendering graphics in many cases--you can basically have whatever you want.  Changing that function to make theta go counterclockwise again is simply flipping a minus to a plus.
I still want to find out why the 2d transformation matrix works; everyone simply gives it as a given, and the explanations I can find involve complex numbers and Euler's identities and theorems.  Given that I can algebraically derive a less efficient approach (multiply the hypotenuse by the sine and cosine with the desired theta), I suspect there is a small step from what I have to what this function has.  I can't find it.  I do have to learn those things anyway, so i may just need to build up to it; one of my areas of interest involves the DFT and convolution, both of which use those concepts heavily anyway.

edit:
For those looking for the steps to get from general trig knowledge to these formulas, this thread:
http://www.gamedev.net/topic/286454-sim … -rotation/
Has it in a reasonably accessible form as post 2.  The last step that I didn't have was a very interesting algebra trick that I really should have seen coming and a couple of trig identities no one remembers off the top of their head (for some value of no one anyway).   You combine the formulas for converting to polar with the formula for a rotation in polar coordinates, expand with a trig identity, and do a clever substitution using an earlier step in the problem to get to the formulas in CAE_Jones's post.

My Blog
Twitter: @ajhicks1992

2015-01-21 11:22:28 (edited by frastlin 2015-01-21 12:56:11)

Hello,
Going through the code on the first page, I just want to make sure I have the correct understanding of the terms as some could have a couple interpretations:
sqr is square root and not squared correct? In most languages sqrt?
Atn is arc tangent
and it probably doesn't matter as it does something in python, but I can't seem to find it, what does ^ stand for? I thought it meant sqrt, but it doesn't.
*note* I just realized, after speaking out what the equation is to find the Hypotenuse... and that means that ^ is ** and sqr is sqrt.
thanks,

2015-01-21 14:24:25

Hello,
So taken my assumptions from the above post, I did:
#start code
import math
sqrt = math.sqrt

sound = (5,2)
player = (10,2)
theta = 270
mya, myb = player
sounda, soundb = sound


temp1 = sounda - mya
temp2 = myb - soundb
if temp1 == 0 and temp2 == 0:
    absolutetheta = -1
elif temp2 > 0:
    absolutetheta = math.atan(temp1/temp2)
elif temp2 <= 0:
    if temp2 == 0:
        absolutetheta = 3.14
    else:
        absolutetheta = math.atan(temp1/temp2) + 3.14
absolutetheta = (absolutetheta * (180 / 3.14))
relativetheta = absolutetheta - theta

print(relativetheta)
#end of code

There is something strange going on. If I change the sound coords to 15,2 the result that comes out is still -90 instead of 90.
I think the problem is with the temp1 and temp2 lines, but I am not going to pretend to understand what is going on mathematically to error-check the other lines. I put in a check in the last elif statement that defaults absolutetheta to 3.14 if temp2 is 0 as most calculators really don't like dividing anything by 0, but that is the only change I did to what Aprone wrote on the first post.
After this gets figured out, I went ahead and worked out the panning line:
h = math.cos(relativetheta * 3.14 / 180)

And it returns a positive number, even though the sound should be negative.
If anyone can let me know what is going on, I would love to know!
Thanks,

2015-01-21 23:38:06 (edited by camlorn 2015-01-21 23:38:57)

I think your problem may be the integers.  Is this Python 2 or 3?  Because if it's 2, you've got a truncating division or 10.  Replace 5 with 5.0, etc, or wrap your variables in float() before using them in denominators.
Also replace 3.14 with math.pi, just use math.sqrt instead of assigning it, or:
from math import pi, sqrt, cos
Alternatively, as a very bad practice:
from math import *
But this makes introspection and stuff harder and is a pretty bad habit to get into.
I can't check the math without working through it with a comb.  I do this sort of thing using what is known as a transformation matrix, which lets me cut down on the needed variables and number of lines that this takes by an order of magnitude.  Unfortunately, this is not something that can be easily explained in a forum post, though I may try doing some tutorials at some point.  The magic of transformation matrices is such that you can take a world like this and make it look like a world where you're standing at the origin with the y axis coming out your nose; if you get them it's so, so much easier to work out the rest.  In either case, I've not gone through this with raw trig in a really, really long time.

My Blog
Twitter: @ajhicks1992

2015-01-22 00:08:57

Hello,
I changed everything to floats and entered pi and I still get the wrong result.
I believe with the player at 10,2 and the sound at 5,2 the result should be -90, but with the sound at 15,2 the sound should be at 90?
What is a good transformation matrices library?
Because I would rather use something someone else made than create my own...

2015-01-22 00:38:33

A good transformation matrix library in Python is gameobjects.  The tutorial I need to write is the important bit here: it's like having the sine and cosine functions in that you can call them but probably have no idea what's going on.  Transformation matrices are super, super useful but also kinda complicated even in library form-said library isn't giving you a pan this sound primitive, it's giving you the stuff you need to work with transformation matrices.  I'm putting the explanation here, but you probably just want to fight with that code-there are too many prerequisites for how and why this works for me to just give you my mental model.
The general approach, however, is to construct a 3d transformation matrix in which the left-most column is a unit vector in the direction which the player is facing, the middle column is a unit vector in the direction to the right of the player, and the third column is the unit vector pointing along the positive z axis.  The fourth column is much more complicated, and I can't remember-but that's why we have libraries.  This entire construction is usually one function call to the matrix library (usually called lookAt or similar). You then pad all your coordinates with 0 for z, feed them through it, and then compute the angle with the y axis to get the value you need.
If you're wondering why I'd go through all the effort, there's a few reasons: the formulas that involve dot products and cross products are usually much, much simpler than the formulas involving trig functions; this is because the dot and cross products have direct physical interpretations.  The second is that literally anything you use from the sighted world is going to expect you to use 2D transformation matrices at least.  The third is that moving the entire world like this is super useful for a variety of other things like radars.  And fourth, this is how sighted game programers have been doing it for years; I can leverage all that wonderful and highly capable code.
To put it in a much simpler way.  You can say that you are ten feet east of the flagpole facing northeast, which is fine.  But you could also say that you're at the origin facing north and that the flagpole is 10 feet southwest of you.  Which is also fine and describes exactly the same thing, just in a different way.  What transformation matrices are doing is allowing you to change how you look at the world--with them, you can make the player literally the center of the universe whenever you want.
This is probably the most literal interpretation of the universe revolving around you anywhere, and it's a powerful concept.  Just really, really complicated to learn in the first place as a blind person as we don't have all the pictures sighted people do.  Most tutorials on the subject say "look at this picture. Got it? Good, how about this one." with barely any text.

My Blog
Twitter: @ajhicks1992

2015-01-22 01:05:20

I didn't even see any good documentation on gameobjects, just the API...
I think I'm closer to figuring this out than gameobjects...
But I don't know what atan does, so don't know how to error-check it. I'm actually completely lost at what any of the math is doing... I can just tell we're working with circles and I want a 90 degree angle one positive and one negative I think...

2015-01-22 04:07:00

You probably don't have the background to understand either of these fully.  There is no gameobjects documentation because anyone who understands 3d transformation matrices will immediately get it from the function names.  I do not know of a 3d transformation matrix library with documentation.  You can't say anything useful in it-that's why I said you need the tutorials as to what these actually are in the first place.  It's like how math.sin says it computes the sine function, but it's still up to you to know what that means.  The only ambiguity with matrix transformation libraries is what the conventions in use are, as I can point the coordinate axis in many different directions (like how positive y is north except in graphics where positive y is down, etc).
Tan is tangent. Atan is inverse tangent. Same with sin and cos.
You're finding the angle between a line coming out of your nose and going straight ahead and a line coming out of your head and going straight to the sound, and then using the cosine function to turn that into a value between -1 and 1.  Proper explanations of what these functions do needs a trigonometry course or at least some diagrams.  What Aprone is doing is performing the same exact thing you'd do with a 2d transformation matrix, just he's going about it the way that doesn't involve them for simplicity.
If I understand the conventions right, you're facing south and the sound is west.  I think you should be getting 90 in the first case and -90 in the second case.  If the final number that comes out is not reading as 90.0, you've got a floating point issue.  Is this python 2.7 or 3?  If it's 3, I can stop wondering if it's a floating point issue and try to untangle the nice if block and/or just replace the entire thing with atan2 for you.  There's basically no reason whatsoever that it cant' be made to work with atan2, I think.

My Blog
Twitter: @ajhicks1992

2015-01-22 10:40:34 (edited by frastlin 2015-01-22 13:54:00)

Hello,
I'm using python2, but I converted all numbers to a floatingpoint.
Here is what aprone says about pa:
If relativetheta was equal to zero, then the sound is exactly in front of us.  If relativetheta equals 45 then the sound is 45 degrees to our right, putting it halfway between being in front of us and being exactly to our right.  180 would be behind us and 270 would be directly off to our left.
According to aprone's first post, 270 is facing north. His  equation:
elif temp2 <= 0:
        a = atan(temp1/temp2) + pi

doesn't work because you can't divide a number by 0.
It also doesn't take into account the temp1 variable if temp2 is 0.
Then what is happening is you have a equal to pi and then you multiply 180/pi by a and it comes back to 180. Then you subtract 270 (pa) from 180.
a = (a * (180.0 / pi))
pa = float(a - pa)



from math import pi, sqrt, cos, atan

sound = (5.0,2.0)
player = (10.0,2.0)
pa = 270.0


temp1 = float(sound[0] - player[0])
temp2 = float(player[1] - sound[1])
if temp1 == 0 and temp2 == 0:
    a = -1.0
elif temp2 > 0:
    a = atan(temp1/temp2)
elif temp2 <= 0:
    if temp2 == 0:
        a = pi
    else:
        a = atan(temp1/temp2) + pi
a = (a * (180.0 / pi))
pa = float(a - pa)


print(pa)

*edit*
Looking at Aprone's post 31, he says something completely different.
He says it should look like:

if temp1 == 0 and temp2 == 0:
    a = -1.0
elif temp1 > 0:
    a = atan(temp1/temp2)
elif temp1 <= 0:
    if temp2 == 0:
        a = pi
    else:
        a = atan(temp1/temp2) + pi
a = (a * (180.0 / pi))-90


Aprone really likes dividing his numbers by 0 doesn't he big_smile
This doesn't give the right numbers either. It just changes the -90 to +90...

2015-01-22 14:29:08

frastlin wrote:

Aprone really likes dividing his numbers by 0 doesn't he big_smile

When there's nothing good on TV, I often sit around dividing numbers by zero.  big_smile  It's fun!  ROFL!

I'd weigh in and help with this math discussion, but I can't remember the what's and why's of this code.  It's been a while, and I have this vague remembrance that someone (I want to say Ghorthalon or CAE Jones) spotted a typo in it.  The code in this thread wasn't pulled from Swamp, it was typed out right from my head, if memory serves me.  So I wouldn't be surprised if it contains a mistake somewhere.  I hope it doesn't... but it just wouldn't surprise me.

- Aprone
Please try out my games and programs:
Aprone's software