heh, was playing around with this and got completely off-track from what I was originally planning
#Include Once "crt.bi"
Type vector2d
x As Single
y As Single
End Type
Sub polydraw(byval poly as vector2d Ptr ,ByVal x as integer, y as Integer, ByVal clr As UInteger = RGB(255,255,255), scale As single = 1)
For i As Integer = 0 To 2
Line (x+(poly[i].x*scale),y+(poly[i].y)*scale)-(x+(poly[i+1].x*scale),y+(poly[i+1].y*scale)),clr
next
Line (x+(poly[3].x*scale),y+(poly[3].y)*scale)-(x+(poly[0].x*scale),y+(poly[0].y*scale)),clr
End Sub
Sub polydrawpoints(byval poly as vector2d Ptr ,ByVal x as integer, y as Integer, ByVal clr As UInteger = RGB(255,255,255), scale As single = 1)
For i As Integer = 0 To 3
pset (x+(poly[i].x*scale),y+(poly[i].y)*scale),clr
next
End Sub
sub polyrotate (byval orig As vector2d Ptr, byval angle as integer)
dim as vector2d r(4)
dim as single mx, my
dim as single s,c, dx, dy
mx=(orig[0].x + orig[1].x + orig[2].x + orig[3].x)/4
my=(orig[0].y + orig[1].y + orig[2].y + orig[3].y)/4
s=sin(angle*0.01745)
c=cos(angle*0.01745)
for i as integer = 0 to 4
dx = orig[i].x - mx
dy = orig[i].y - my
r(i).x = mx + c * dx + s * dy
r(i).y = my - s * dx + c * dy
Next
memcpy (orig, @r(0), 4*SizeOf(vector2d))
End Sub
Dim As vector2d p1(3) => {(-2,0),(0,-2),(2,0),(0,2)}
Dim as vector2d p2(3) => {(-2,0),(0,-2),(2,0),(0,2)}
Dim as vector2d p3(3) => {(-2,0),(0,-2),(2,0),(0,2)}
Dim as vector2d p4(3) => {(-2,0),(0,-2),(2,0),(0,2)}
polyrotate (@p2(0), 22.5)
polyrotate (@p3(0), 45)
polyrotate (@p4(0), 67.5)
#Define swidth 600
#Define sheight 600
ScreenRes swidth,sheight,32
Dim As Single i = 0
Dim As single j = .4
Dim As Single r1,r2,r3,r4
r1 = Rnd*20
r2 = Rnd*20
r3 = Rnd*20
r4 = Rnd*20
Dim As Integer counter
While InKey = ""
ScreenLock
'Cls
polydrawpoints(@p1(0), swidth/2,sheight/2, RGB(255,rnd*255,0),i)
polydrawpoints(@p2(0), swidth/2,sheight/2, RGB(0,255,rnd*255),i)
polydrawpoints(@p3(0), swidth/2,sheight/2, RGB(rnd*255,0,255),i)
polydrawpoints(@p4(0), swidth/2,sheight/2, RGB(i,i,i),i)
ScreenUnLock
i += j
If i>=255 Then i=0
polyrotate (@p1(0), r1)
polyrotate (@p2(0), r2)
polyrotate (@p3(0), r3)
polyrotate (@p4(0), r4)
counter += 1
If counter >= 250000 Then
counter = 0
r1 = (Rnd*360) - (Rnd*360)
r2 = (Rnd*360) - (Rnd*360)
r3 = (Rnd*360) - (Rnd*360)
r4 = (Rnd*360) - (Rnd*360)
EndIf
Wend