Argh, another cos/sin problem

Blitz3D Forums/Blitz3D Beginners Area/Argh, another cos/sin problem

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

No need to the distance functon ....


Graphics 640,480,16,2
SetBuffer BackBuffer()
Origin 320,240

Type StarField
	Field x#
	Field y#
End Type

For a=1 To 100	;Generate a bunch of positions
	b.StarField= New StarField
	b\x = Rand(-500,500)
	b\y = Rand(-500,500)
Next

;Mainloop
Global Angle=0
While Not KeyHit(1)
Cls
Draw()
Oval 0,0,10,10,1	;This is our center spot
angle=angle+1
If angle=360 Then angle=0
Flip
Wend


Function Draw()
	
	For s.StarField= Each StarField
		x# =  s\x * Cos( angle ) + s\y * Sin( angle ) 
		y# =  s\y * Cos( angle ) - s\x * Sin( angle )
		Oval x#,y#,10,10,0
		Plot x,y			;Positions stored in types (for comparison)
	Next

End Function


Stevie