Thanks a lot both of you!

]]>So I wrote my own sin function, like I described, and a hash table, but it seems to be about 10-15 times as slow as the function included in the C library (which are the same ones that you use in C++).

I see no way to optimize my solution unless you take out the function call (which might give it large overhead). This makes me really curious about how the trig functions actually work...

]]>and 89.99 degrees. But with a little thought, it would probably still be a good idea. Just need to create a

binary tree instead of a hash table, so you can test less or greater or equal, and get down to the right element to

use quickly. That's what I would do for the arctan().]]>

Cx = Ax + 50 cos(arctan(slope))

Cy = Ay + 50 sin(arctan(slope))

Haven't really check to see if these are the right answers, I'm just going to assume they are. Oh, and if speed of your program doesn't matter, none of the below will...

sin and cos are normally very slow functions (depending on how your compiler implements them). Always try to avoid using them if possible. But, if you have to use them, heres how:

Using sin and arctan functions in whatever language your using, generate a file that just lists these values of certain numbers. If you were doing it in C++, it would be:

```
for (x = 0; x < 2*PI; x+=PI/720.0)
{
o << sin(x) << endl;
}
```

Now generate that file for whatever trig functions you are using. Then, in the beginning of your program, you load up these data values into a hash table. From this, you can then approximate each trig function in O(1) time, which means constant time, the fastest you can get. I picked the value PI/720. This will generate a fairly small file (1440 lines). You can use higher values such as PI/1000 or even PI/2000, and you will get a very close approximation. With 2000, that will probably be as close an approximation as just sin(x) is.

The downside of using larger variable is that it uses more hard drive space (the file) and it uses more RAM (the hash table).

Edit: If you wish to do this, but got lost in my mumbo jumbo, just say so. I'm going to be doing this very soon for a project of my own (Pool, aka billards), so I might as well do it now.

]]>Got one weird behavior though, as soon as the ball hits the ground the cam is reversed and actually point A (the new point) gets in between the old point (B) and C (the cam). Quite strange, let's see if I can figure out why that happens.

Thanks a lot John!

]]>Cx = Ax + 50 cos(arctan(slope))

Cy = Ay + 50 sin(arctan(slope))

]]>I started with this using pythagoras from the old days back at school and I think I will get there at the end but as this is part of a program I think I will need at least 10 lines with if statements and defining imaginary coordinates when using pythagoras while it should be as fast as possible.

Hope someone can help me with this, thanks!

]]>