+grafixbmp Posted May 10, 2008 Share Posted May 10, 2008 I would like some help with this classic equasion for use on the 2600. There is a project I have been working on for a bit and still have not rigged a good way to accomplish this in a timely maner. The idea is that if I have a given distance from one point and another distance from the other end of the distance with intercection of both lines ALWAYS being 90 degrees, I want to calculate the hypotenuse and the angle at the starting point. I am thinking I may need to use 2 bytes to get the level of high numerical values I need for greater distances but I can also just use single bytes for shorter distances which will allow less clock cycles to be used. But when it comes to the bigger numbers, I would like to speed things up any way I can. I think that some well designed look up tables would help thigs alot too. Any thoughts on calculating right angle triangles? Quote Link to comment Share on other sites More sharing options...
+SpiceWare Posted May 10, 2008 Share Posted May 10, 2008 (edited) I calculated the hypotenuse in MM, all the versions of the source are available in my blog. My original routine used 16 bit math to do it. Basically I had a table of ^2 values. ie: 0, 1, 4, 9, 16, 25, ... I didn't take the square root of the results as I didn't need to know that - just needed to know which of the fireballs was closest. In the blog entry for September 2nd, 2006 I revised the routines to use 8 bit math due to lack of CPU time. Basically I used a^2/100 + b^2/100 = x^2/100 so the ^2 table became ^2/100. Edited May 10, 2008 by SpiceWare Quote Link to comment Share on other sites More sharing options...
+grafixbmp Posted May 13, 2008 Author Share Posted May 13, 2008 Something else that might help or substitute some of this is calculating slope of a line on a grid if this can be faster than the angles of a triangle but I still will need the distance or length of the hypotenuse. man it has been a long time since geometry class. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.