Thread: Inverse Trig
View Single Post
  #2   Spotlight this post!  
Unread 01-03-2002, 18:32
Skabana159's Avatar
Skabana159 Skabana159 is offline
Robotics and Field Hockey
AKA: Jesse C. Owens
#0159 (Alpine Robotics)
Team Role: Mentor
 
Join Date: Mar 2002
Rookie Year: 2000
Location: Ft. Collins, CO
Posts: 92
Skabana159 is on a distinguished road
Send a message via AIM to Skabana159
I predict that you may have some trouble accomplishing this.

First, the two trig functions available for use in the BASIC stamp, SIN and COS, are tricky in and of themselves. Due to the fact that the BASIC stamp functions on relatively rudimentary binary, it uses completely different units than what you may be used to. Let us draw comparisons between the Stamp's trig and normal trig. While, in most situations, we divide a circle into 2*pi radians, or 360 degrees, neither of these units are of much use in binary. So, the stamp uses a unit call the binary radian (brad). This unit is defined in two ways: there are 255 brads in a circle, and one brad is about 1.406 degrees. In addition, we are used to sin giving us the y component of a point on the unit circle (where the radius of a circle is 1). In PBASIC, however, you will find that sin gives the y component of a point on the 127-unit circle.

Second, you may have trouble interpreting the values returned by trig functions. All unary operators (those that have 1 argument, like square root, sine, absolute value) on the BASIC stamp are performed in the space of a word. This means 16 bits, 2 bytes, or in base-10, 0 to 65535. But this is not nesecarily the value you will find. You have to make sure that the variable you are storing it in is a word.

Third, that word is an unsigned integer. It is in a format that I do not completely understand called the two's complement. Someone else will have to tell you what this means because I really have no idea. It will be a positive integer, but there is some way to tell if it is a negative value.

Hope I have been of some help. You can read about all of this in the PBASIC Programming Manual available from Parallax, Inc. In short, it is possible, but it will be a terribly difficult task.

-Jesse, Team 159
__________________
"What most people do not understand is that the Buddha, the Godhead, resides just as comfortably in gears and circuits as in hills and trees. To believe otherwise is to dilute the Godhead."
-Robert Pirsig, Zen and the Art of Motorcycle Maintenance