#Region Project Attributes
#MainFormWidth: 600
#MainFormHeight: 600
#End Region
Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Private turtle As B4XTurtle
Dim a As Int 'semi-major axis
Dim b As Int 'semi-minor axis
Dim xui As XUI
Dim xval, yval As Float
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.RootPane.LoadLayout("main") 'Load the layout file.
MainForm.Show
Dim zeroX As Float = turtle.Width/2
Dim zeroY As Float = turtle.Height/2
a = 200 'semi-major axis
b = 75 'semi-minor axis
turtle.SetPenColor(xui.Color_Red)
turtle.SetX(zeroX + (a * Cos(0*2*cPI/360)))
turtle.SetY(zeroY + (b * Sin(0*2*cPI/360)))
For i = 0 To 360
xval = zeroX + (a * Cos(i*2*cPI/360))
yval = zeroY + (b * Sin(i*2*cPI/360))
turtle.MoveTo(xval, yval)
Next
turtle.SetPenColor(xui.Color_Blue)
a = a + 50
b = b + 12
turtle.SetX(zeroX + (a * Cos(0*2*cPI/360)))
turtle.SetY(zeroY + (b * Sin(0*2*cPI/360)))
For i = 0 To 360
xval = zeroX + (a * Cos(i*2*cPI/360))
yval = zeroY + (b * Sin(i*2*cPI/360))
turtle.MoveTo(xval, yval)
Next
a = 250
b = -250 'negative value = change direction of drawing
turtle.SetPenColor(xui.Color_Green)
turtle.SetX(zeroX + (a * Cos(0*2*cPI/360)))
turtle.SetY(zeroY + (b * Sin(0*2*cPI/360)))
For i = 0 To 360
xval = zeroX + (a * Cos(i*2*cPI/360))
yval = zeroY + (b * Sin(i*2*cPI/360))
turtle.MoveTo(xval, yval)
Next
a = 125
b = 250 'negative value = change direction of drawing
turtle.SetPenColor(xui.Color_Magenta)
turtle.SetX(zeroX + (a * Cos(0*2*cPI/360)))
turtle.SetY(zeroY + (b * Sin(0*2*cPI/360)))
For i = 0 To 360
xval = zeroX + (a * Cos(i*2*cPI/360))
yval = zeroY + (b * Sin(i*2*cPI/360))
turtle.MoveTo(xval, yval)
Next
a = 75
b = 250 'negative value = change direction of drawing
turtle.SetPenColor(xui.Color_Cyan)
turtle.SetX(zeroX + (a * Cos(0*2*cPI/360)))
turtle.SetY(zeroY + (b * Sin(0*2*cPI/360)))
For i = 0 To 360
xval = zeroX + (a * Cos(i*2*cPI/360))
yval = zeroY + (b * Sin(i*2*cPI/360))
turtle.MoveTo(xval, yval)
Next
turtle.SetTurtleVisible(False)
End Sub
'Return true to allow the default exceptions handler to handle the uncaught exception.
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
Return True
End Sub