There are significant differences between the basis and results of the standard trigonometric functions, such as implemented in other languages, and as implemented in Netlogo.
The differences are designed to make working with these functions easier and more intuitive for students and other modelers who are not familiar with traditional trigonometry.
There are also helper reporters designed to make certain difficult trig problems easier.
| NetLogo | “Standard” | |
|---|---|---|
| Angle measures | degrees | radians |
| 0 degrees | North/Up | East/Right |
| angles increase | clockwise | widdershins |
| tangent is | x over y | y over x |
Given a point with coordinates x and y and the heading h from the origin to that point, some useful things to know:
Note that the NetLogo atan reporter is quadrant-aware, that is, it accepts negative inputs, and reports the correct 0 to 360 degree heading. If both x and y are zero, a run-time error occurs.
With towards or towardsxy, if the target location is the same as the current location a runtime error occurs.
E.g. “ASK TURTLES [ SET HEADING TOWARDS SELF ]” will cause a runtime error (if there are any turtles)..
With FACE or FACEXY, no action or error occurs if the target location is the same as the current location.
E.g. “ASK TURTLES [ FACE SELF ]” will not cause a runtime error, and the turtles will not change heading.