To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.legosOpen lugnet.robotics.rcx.legos in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / legOS / 1858
1857  |  1859
Subject: 
Re: C standard functions with legOS?
Newsgroups: 
lugnet.robotics.rcx.legos
Date: 
Fri, 27 Apr 2001 00:29:46 GMT
Viewed: 
1367 times
  
On Thu, 26 Apr 2001, Bernardo Dal Seno wrote:

"Ross Crawford" <rcrawford@csi.com> writes:

In lugnet.robotics.rcx.legos, Michael Wisse writes:
Is it possible to use functions from C standard libraries with legOS,
e.g. sin() from math.h or abs() from stdlib.h?

One way to get sin, cos etc would be to use lookup tables, though this also
uses memory.

An alternative is using fixed point math.  There was some posts time ago,
with C source for trigonometric functions.  If you are interested, I should
have links to them, somewhere (or do a `search' :-).

I've been meaning to butt in on this discussion sometime, but I got caught
up in things, but better late than never. The source you refer to is
probably mine. I wrote a suite of fixed-point math routines for
multiplication, division, and vector rotation (which takes care of trig
pretty easily). Unfortunately I never got around to documenting them like
I promised I would. :( I seemed to recall them being posted on the
sourceforge site, but I can't find them there now. Anyway, I happen to
have them on my web site, at
<http://www.mikeash.com/lego-code/fixedpoint.c> and .h for the header. It
is not documented at all. Most of it should be pretty self-explanatory,
but if you have any questions please do not hesitate to ask. The algorithm
for vector rotation, which does any trig function you'd want, gets
reasonably accurate results using only 18 lookup-table entries, and it
should be fairly easy to adapt to floating-point if you prefer that. If
you want more info on the algorithm, or have any other questions, please
just ask.

--
"From now on, we live in a world where man has walked on the moon.
And it's not a miracle, we just decided to go." -- Jim Lovell

Mike Ash - <http://www.mikeash.com/>, <mailto:mail@mikeash.com>



Message is in Reply To:
  Re: C standard functions with legOS?
 
(...) An alternative is using fixed point math. There was some posts time ago, with C source for trigonometric functions. If you are interested, I should have links to them, somewhere (or do a `search' :-). bye Bernardo New e-mail: (...) (23 years ago, 26-Apr-01, to lugnet.robotics.rcx.legos)

5 Messages in This Thread:


Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR