You are not logged in or registered. Please login or register to use the full functionality of this board...
SIGN IN Join Our Community For FREE


Spirograph
07-02-2017, 05:43 PM
Post: #11
 (Print Post)
RE: Spirograph
Hi Johnno,

pusedo code:
DimLimit = 100000
One could DIM px(DimLimit) and py(DimLimit) HUGE and then just use ptIndex to track where you are in loading arrays.
'start
ptIndex = 0
if ptIndex <= DimLimit then 'store
 'get a point x2, y2
 px(ptIndex) = x2
 py(pyIndex) = y2
 ptIndex = ptIndex + 1
end if

B += _
Find all posts by this user
Like Post
07-02-2017, 08:58 PM
Post: #12
 (Print Post)
RE: Spirograph
Brilliant! That worked like a charm... Many thanks for the solution. Smile

J

May your journey be free of incident.

Live long and prosper.
Find all posts by this user
Like Post
07-02-2017, 11:00 PM
Post: #13
 (Print Post)
RE: Spirograph
Hi Johnno,
Here is bonus! Wheels within wheels.

Code Snippet: [Select]
'Spirograph wheels within wheels.bas SmallBASIC 0.12.9 (B+=MGA) 2017-07-02
rO = ymax/2 - 10 ' fit screen radius of big circle
Ox = xmax/2
Oy = ymax/2
pIndex = 0
dim mark(4)
dim px(), py()
m = 0 : mark(0) = 0
for ir = 5 to 2 step -1
  rI = rO/ir       ' smaller circle that travels inside edge of larger
  OI = rO /rI      ' rate inner circle spins compared to angle on outer circle
  for a = 0 to 2 * pi step pi/360  'while the inner circle contacts outer at angle a
    cls
    circle Ox, Oy, rO, 1, 9
    'the origin of inner circle at same angle
    Ix = Ox + (rO - rI) * cos(a)
    Iy = Oy + (rO - rI) * sin(a)
    Ia = OI * a   'the angle of the inner points are OI * a on outer circle
    'draw line from origin of inner circle to outer edge
    color 12
    wheel Ix, Iy, rI, -Ia
    for i = 0 to pIndex-1
      pset px(i), py(i), 15
    next
    showpage
    delay 10
  next
  m++
  mark(m) = pIndex - 1
next
delay 2000
for j = 0 to m-1
  cls
  for i = mark(j) to mark(j+1)-1
    pset px(i), py(i), 15
  next
  ? "Press any..."
  showpage
  pause
next
sub wheel(x,y,r,a)
  local i, x1, y1, x2, y2, rI2, Ix2, Iy2, Ia2
  circle x, y, r
  for i = 1 to 12
    x1 = x + r*cos(i*2*pi/12 + a)
    y1 = y + r*sin(i*2*pi/12 + a)
    line x, y, x1, y1
    if i = 12 then
      x2 = x + r/2*cos(i*2*pi/12 + a)
      y2 = y + r/2*sin(i*2*pi/12 + a)
      px << x2
      py << y2
      pIndex = pIndex + 1
    fi
  next
  if r > 20 then
    rI2 = r / ir
    Ix2 = x + (r - rI2) * cos(a)
    Iy2 = y + (r - rI2) * sin(a)
    Ia2 = r / rI2 * a
    wheel Ix2, Iy2, rI2, -Ia2
  end if
end


Attached File(s) Image(s)
       

B += _
Find all posts by this user
Like Post
07-03-2017, 07:25 PM
Post: #14
 (Print Post)
RE: Spirograph
Brilliant! Many thanks.

J

May your journey be free of incident.

Live long and prosper.
Find all posts by this user
Like Post



Forum Jump:


User(s) browsing this thread: 1 Guest(s)




QB64 Member Project - 9 Board
QB64 Member Project - RGB Color Wheel
QB64 Member Project - Kobolts Monopoly
QB64 Member Project - Line Thickness
QB64 Member Project - Algeria Weather
QB64 Member Project - Rubix's Magic
QB64 Member Project - Swirl
QB64 Member Project - Color Rotating Text
QB64 Member Project - Input
QB64 Member Project - Full Color LED Sign
QB64 Member Project - Martin Fractals version three
QB64 Member Project - Amazon
QB64 Member Project - Quarto
QB64 Member Project - Martin Fractals version two
QB64 Member Project - Martin Fractals version one
QB64 Member Project - Pivet version one
QB64 Member Project - Dakapo
QB64 Member Project - Bowditch curve
QB64 Member Project - Othello
QB64 Member Project - Rotating Background
QB64 Member Project - Blokus
QB64 Member Project - Exit
QB64 Member Project - Martin Fractals version four
QB64 Member Project - MAPTRIANGLE
QB64 Member Project - ARB Checkers
QB64 Member Project - Sabotage
QB64 Member Project - Kings Court
QB64 Member Project - Touche
QB64 Member Project - Spinning Color Wheel
QB64 Member Project - Qubic
QB64 Member Project - Red Scrolling LED Sign
QB64 Member Project - Score 4
QB64 Member Project - Splatter
QB64 Member Project - STxAxTIC 3D World
QB64 Member Project - Pivot version two
QB64 Member Project - Foursight
QB64 Member Project - Domain
QB64 Member Project - Dreamy Clock
QB64 Member Project - Inside Moves
QB64 Member Project - Color Triangles
QB64 Member Project - Kings Vallery version two
QB64 Member Project - Point Blank
QB64 Member Project - Isolation
QB64 Member Project - OpenGL Triangles
QB64 Member Project - Spiro Roses
QB64 Member Project - Kings Valley verion one
QB64 Member Project - Overboard
QB64 Member Project - Connect Four
QB64 Member Project - Basic Dithering