zak
14-03-2010, 07:33
Hi
those figures resemble the protozoa, look at this page:
http://www.madteddy.com/biomorph.htm
i have tried the quick basic code in this page (i have attached it here) and it display the same figure in the page.
( if you want to run qb45 programs comfortably then use DosBox emulator)
ok, i have tried the same code in thinbasic, and yes it produce the same paramecium like creature, but its nucleus is black and not as the qb output. i am surely miss something, i have a low level of neurotransmiters in my brain neurons.
try other equations from the web there are all sorts of creatures avaiable.
Uses "TBGL"
Begin Const
%constreal = .5
%constimag = 0
%screenheight = 500
%screenwidth = 500
%listPoints = 1
End Const
Dim As Double aspectratio = %screenwidth / %screenheight
Dim As Double ymax = 2.5
Dim As Double ymin = -ymax
Dim As Double xmax = ymax * aspectratio
Dim As Double xmin = -xmax
Dim As Integer ilimit = %screenheight - 1
Dim As Integer jlimit = %screenwidth - 1
Dim x,y,x0,y0,xx,yy As Double
Dim i,j,n As Integer
Function TBMAIN()
Local hWnd As DWord
Local FrameRate As Double
Local width, height As Long
' -- Create and show window
hWnd = TBGL_CreateWindowEx("BioMorphs", 500, 500, 32, %TBGL_WS_WINDOWED Or %TBGL_WS_CLOSEBOX)
TBGL_ShowWindow
TBGL_GetWindowClient( hWnd, width, height )
' -- Background color to white
TBGL_BackColor 255, 255, 255, 255
' -- Cache the image to display list
' -- Please note the display lists are garbage collected,
' -- so no need to explicitly create/destroy them
'''''''''''''''''''''''''''''''
TBGL_NewList %listPoints
TBGL_BeginPoly(%GL_POINTS)
For i = 0 To ilimit
For j = 0 To jlimit
x0 = xmin + (xmax - xmin) * j / jlimit
y0 = -ymin - (ymax - ymin) * i / ilimit
x = x0
y = y0
For n = 1 To 100
xx = x * (x * x - 3 * y * y) + %constreal: ' THIS Line And the Next give the cube
yy = y * (3 * x * x - y * y) + %constimag: ' of the Number, plus a constant
x = xx
y = yy
If Abs(x) > 10 Or Abs(y) > 10 Or x * x + y + y > 10 ^ 2 Then
n = 100
End If
Next n
If Abs(x) < 10 Or Abs(y) < 10 Then
TBGL_Color( 0, 0, 0 )
TBGL_Vertex j, i
'PSET (j, i), black
Else
TBGL_Color( 255, 255, 255 )
TBGL_Vertex j, i
'PSET (j, i), white
End If
Next j
Next i
TBGL_EndPoly
TBGL_EndList
' -- Resets status of all keys
TBGL_ResetKeyState()
' -- Main loop
While TBGL_IsWindow(hWnd)
' -- Read the current frame rate.
FrameRate = TBGL_GetFrameRate
' -- As we don't draw a full background, we need to clear the framebuffer
TBGL_ClearFrame
' -- Set the resolution and the coordinate system
TBGL_RenderMatrix2D (0, jlimit, ilimit, 0)
TBGL_CallList %listPoints
'Show the rendered stuff
TBGL_DrawFrame
' -- ESCAPE key to exit application
If TBGL_GetWindowKeyState(hWnd, %VK_ESCAPE) Then
Exit While
End If
Wend
TBGL_DestroyWindow
End Function
those figures resemble the protozoa, look at this page:
http://www.madteddy.com/biomorph.htm
i have tried the quick basic code in this page (i have attached it here) and it display the same figure in the page.
( if you want to run qb45 programs comfortably then use DosBox emulator)
ok, i have tried the same code in thinbasic, and yes it produce the same paramecium like creature, but its nucleus is black and not as the qb output. i am surely miss something, i have a low level of neurotransmiters in my brain neurons.
try other equations from the web there are all sorts of creatures avaiable.
Uses "TBGL"
Begin Const
%constreal = .5
%constimag = 0
%screenheight = 500
%screenwidth = 500
%listPoints = 1
End Const
Dim As Double aspectratio = %screenwidth / %screenheight
Dim As Double ymax = 2.5
Dim As Double ymin = -ymax
Dim As Double xmax = ymax * aspectratio
Dim As Double xmin = -xmax
Dim As Integer ilimit = %screenheight - 1
Dim As Integer jlimit = %screenwidth - 1
Dim x,y,x0,y0,xx,yy As Double
Dim i,j,n As Integer
Function TBMAIN()
Local hWnd As DWord
Local FrameRate As Double
Local width, height As Long
' -- Create and show window
hWnd = TBGL_CreateWindowEx("BioMorphs", 500, 500, 32, %TBGL_WS_WINDOWED Or %TBGL_WS_CLOSEBOX)
TBGL_ShowWindow
TBGL_GetWindowClient( hWnd, width, height )
' -- Background color to white
TBGL_BackColor 255, 255, 255, 255
' -- Cache the image to display list
' -- Please note the display lists are garbage collected,
' -- so no need to explicitly create/destroy them
'''''''''''''''''''''''''''''''
TBGL_NewList %listPoints
TBGL_BeginPoly(%GL_POINTS)
For i = 0 To ilimit
For j = 0 To jlimit
x0 = xmin + (xmax - xmin) * j / jlimit
y0 = -ymin - (ymax - ymin) * i / ilimit
x = x0
y = y0
For n = 1 To 100
xx = x * (x * x - 3 * y * y) + %constreal: ' THIS Line And the Next give the cube
yy = y * (3 * x * x - y * y) + %constimag: ' of the Number, plus a constant
x = xx
y = yy
If Abs(x) > 10 Or Abs(y) > 10 Or x * x + y + y > 10 ^ 2 Then
n = 100
End If
Next n
If Abs(x) < 10 Or Abs(y) < 10 Then
TBGL_Color( 0, 0, 0 )
TBGL_Vertex j, i
'PSET (j, i), black
Else
TBGL_Color( 255, 255, 255 )
TBGL_Vertex j, i
'PSET (j, i), white
End If
Next j
Next i
TBGL_EndPoly
TBGL_EndList
' -- Resets status of all keys
TBGL_ResetKeyState()
' -- Main loop
While TBGL_IsWindow(hWnd)
' -- Read the current frame rate.
FrameRate = TBGL_GetFrameRate
' -- As we don't draw a full background, we need to clear the framebuffer
TBGL_ClearFrame
' -- Set the resolution and the coordinate system
TBGL_RenderMatrix2D (0, jlimit, ilimit, 0)
TBGL_CallList %listPoints
'Show the rendered stuff
TBGL_DrawFrame
' -- ESCAPE key to exit application
If TBGL_GetWindowKeyState(hWnd, %VK_ESCAPE) Then
Exit While
End If
Wend
TBGL_DestroyWindow
End Function