The sine function has a very interesting characteristic - its second derivative equals to -sine(x).
With this knowledge we can draw it with very simple code and without using any trigonometric function.
It will only work in rabbit mode as we need to get the current position before executing the next command.
With this knowledge we can draw it with very simple code and without using any trigonometric function.
B4X:
Sub Turtle_Start
Turtle.RabbitMode.SetPenColor(xui.Color_Blue).SetPenSize(1)
Dim YZero As Float = 100
Turtle.SetY(YZero).SetX(10).SetAngle(-45)
For i = 1 To 600
Dim value As Float = Turtle.GetY - YZero 'f(x)
Turtle.TurnLeft(value * 0.01).MoveForward(1) 'TurnLeft = f''(x) * constant
Next
End Sub
It will only work in rabbit mode as we need to get the current position before executing the next command.