[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: LOGO-L> Arcs once again



Arc is not written like "poly".

The 180 is the number of degrees to swing the arc by
not the number of iterations in a loop (which in my
opinion is the wrong way to draw an ARC [but we have gone
down that rat hole many times :-)].
ARC uses Sine and Cosine to do it right so you
can do stuff like this.

repeat 180 [arc2 0.25 30]

And you'd still get a perfect 45 degree arc.
It's as flexible as RT/LT and FD/BK.

In fact some folks have added ARCLEFT and ARCRIGHT
where ARCLEFT just inverts the sign like LT does.

But we can "simulate" ARC2 using the "poly" method.

ARC2 positive degrees implies an arc turning to the right.
ARC2 negative degrees implies an arc turning to the left.

If your using a "poly" style (i.e. RT 1 FD 1)

You can simulate ARC2 like this.

to ARC2 :ang
repeat abs :ang [rt sign :ang fd 1]
end

I'll let you figure out how to adjust the "1"
in FD 1 such that you can add a radius argument.

You probably don't have ABSsolute or SIGN either so here they are.

to sign :arg
if :arg > 0 [output 1]
if :arg < 0 [output -1]
output 0
end
bury "sign

to abs :arg
if :arg > 0 [output :arg]
output -:arg
end
bury "abs

I know I'm biased but ARC is really powerful function
and I built it in for performance reasons because
drawing a "curve" in Logo is expensive.

I've posted the LOGO code for an ARC written using sine
and cosine before.

JONESV@CCSUA.CTSTATEU.EDU wrote:
> 
> George - I'm using PC Logo which doesn't have arc2 in its library of
> functions.  Could you explain what how arc2 draws an arc?  I was
> guessing that 180 referred to the number of turns and 30 to the radius
> of the defining circle, but -180?
> Thanks.
> Ginny Jones

-- 
===============================================================
George Mills
email: mills@softronix.com
http://www.softronix.com
The www page contains some very powerful educational software.
Our single most important investment is our kids.
---------------------------------------------------------------
Please post messages to the Logo forum to logo-l@gsn.org.  Mail
questions about the list administration to logofdn@gsn.org.  To
unsubscribe send    unsubscribe logo-l    to majordomo@gsn.org.



Global SchoolNet Foundation - Linking Kids Around the World!
Copyright GSN - All Rights Reserved - Comments & Questions
Visit GSN's Global Schoolhouse for more exciting learning resources!
Search our Site - Home