[Gambas-user] A few questions.

Oliver Stieber oliver_stieber at ...370...
Wed Dec 22 13:56:28 CET 2004


> > > 4: where can I request some which list
> functions...
> > > the kind of things I always seem to re-write,
> like
> > > (and I know this is a hack)
> > >
> > > PUBLIC FUNCTION ang(xvalue AS Float, yvalue AS
> Float)
> > > AS Float
> > >
> > >   DIM tanvalue AS Float
> > >   IF xvalue = 0 THEN
> > >     tanvalue = 90
> > >   ELSE
> > >     tanvalue= Deg(ATan(yvalue/xvalue))
> > >   END IF
> > >   IF tanvalue < 0 THEN tanvalue = tanvalue + 360
> > >   IF xvalue > 0  THEN
> > >     tanvalue = tanvalue + 180
> > >   END IF
> > >   IF tanvalue > 360 THEN tanvalue = tanvalue -
> 360
> > >
> > >   RETURN tanvalue
> > >
> > > END
> > >
> > > and
> > >
> > > PUBLIC FUNCTION mag(xvalue AS Float, yvalue AS
> Float)
> > > AS Float
> > >
> > >   RETURN  Sqr(xvalue*xvalue + yvalue*yvalue)
> > >
> > > END
> > >
> >
> > There - I will insert them in the TODO list.
> >
> > Note that I try to keep the interpreter size under
> 150K, so I don't try to
> > insert as many functions as possible inside.
> >
> > What does exactly your ang() function ?
Calculates the angle of a vector[x,y] from the origin.
(possibly the only time I ever use atan).



	
	
		
___________________________________________________________ 
ALL-NEW Yahoo! Messenger - all new features - even more fun! http://uk.messenger.yahoo.com




More information about the User mailing list