Small Basic Forum

Full Version: Callenge 6 - Draw conics
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Draw a circle, ellipse, parabola and hyperbola - Wikipedia is a good source for more info.
Hello.  Shy

I also like cycloids around the circle.  Blush
Here is my cycloid  Blush
Code:
GraphicsWindow.BackgroundColor = "White"
GraphicsWindow.PenColor = "Blue"
GraphicsWindow.PenWidth = 2

' Let's set the parameters
radius1 = 9 ' Radius of a rolling circle
radius2 = 90 ' Radius of a fixed circle
lineLength = radius1 + 15 ' Length of line from the center of rolling circle
centerX = 200 ' Center of the fixed circle along X
centerY = 200 ' Center of the fixed circle along Y

' Initial coordinates of the point at the end of the line
x = centerX + radius2 + lineLength
y = centerY

' Angle of rotation
angle = 0

While (angle < 360 * 5) ' Draw several turns
  ' ВCalculate the coordinates of the center of the rolling circle
  rollingCenterX = centerX + (radius2 + radius1) * Math.Cos(angle * Math.Pi / 180)
  rollingCenterY = centerY + (radius2 + radius1) * Math.Sin(angle * Math.Pi / 180)
 
  ' Calculate the coordinates of the point at the end of the line
  x = rollingCenterX - lineLength * Math.Cos((radius2 + radius1) / radius1 * angle * Math.Pi / 180)
  y = rollingCenterY - lineLength * Math.Sin((radius2 + radius1) / radius1 * angle * Math.Pi / 180)
 
  ' Draw a dot
  GraphicsWindow.DrawEllipse(x, y, 2, 2)
 
  ' Increasing the angle
  angle = angle + 1
EndWhile
How about the 4 conic shapes?
SBJN892.000
Hello.  Shy

I knew that the cycloid was the most beautiful.  Tongue
MKHW723.000

What is interesting about this is the program was created by Microsoft Copilot!

JR
Ha,

That's pretty much my experience with AI - looks good, but usually wrong in the detail - it's not a hyperbola!
Maybe chatgpt could do better in my small basic extension 50% I have learnt from chatgpt
LitDev,

So, why do you say it isn't a hyperbola? Looks OK to me!

JR
Pages: 1 2