Page 1 of 1
Something wrong with my geometry
Posted: Thu Jun 04, 2015 12:14 pm
by richmond62
I have a stack with a 'turtle' and buttons to set the angle (currently only offering 90, 180,270 and 0 degrees) of travel, a field to input the distance of travel and a button "FORWARD" to get the
turtle to travel.
However, something seems wrong with my Pythagoras.
See script inside "FORWARD" button to see how I've gone wrong.
Re: Something wrong with my geometry
Posted: Thu Jun 04, 2015 2:30 pm
by dunbarx
Hi.
Fun stuff. I only glanced at your code, but I think you should rechoose the browse tool at the end of your handler.
Oh, and it is important to know that the trig functions in LC work only in radians, not degrees. This could be important
If you are more comfortable in degrees, can you write a function to translate, transparently, so that you never have to think about it again?
Craig Newman
Re: Something wrong with my geometry
Posted: Thu Jun 04, 2015 2:48 pm
by SparkOut
Radians, not degrees!
Code: Select all
put DD * pi / 180 into tRadians
put cos(tRadians) into tCos
put tCos * FW into RITE
put sin(tRadians) into tSin
put tSin * FW into DOON
Aha, Craig answered while I was tapping. And yes, make it a functions.
Re: Something wrong with my geometry
Posted: Thu Jun 04, 2015 7:09 pm
by richmond62
Ah! Radians! Says he pretending he's happy and wonder-struck by that, but, instead, feeling a "right Wally" for not working that out.
Of course, awkward sods [what, me? surely not?] would ask why, if "set the angle" works in degree, sine and cosine only works with radians?
So, now I've got to pop an algorithm in "there" to convert degrees into radians - that sucks a bit . . .