Pixel Arc

Blitz3D Forums/Blitz3D Beginners Area/Pixel Arc

Blitz Is Kool(Posted 2004) [#1]
Hi,

First, many thanks for all those who helped me of late.

I have another minor issue with Blitz to resolve, if anyone can assist.

In the most simplistc terms, I want to plot a pixel, say, at the top centre of the screen, and have it move in a 90 degree arc, thus moving vertically to horizonally in a quarter circle path.

I guess this would have something to do with PI and Cosin, so if you can help me with the programming to move the pixel, I would appreciate that.

In the game, the pixel would be replaced by a graphic, but I need to understand how to get the arc done.

Many thanks in advance to you all.


Perturbatio(Posted 2004) [#2]
it's a start


For a = 1 To 90
	Plot 100+Cos(a)*100,100-Sin(A)*100
Next

waitkey()

End





Perturbatio(Posted 2004) [#3]
updated to be a function:






Kel(Posted 2004) [#4]
As you can see in the previous code, Sin and Cos are the x and y part of a circle section(1/4 of section) and they form a triangle....

If you study about sin and cos you will see that PI=180º because a complete circle has an area of 2pi*r (360º that is a complete circle and the radius you want it to be, if no radius specified the circle is a dot with the period of 2pi, even the radian to degrees and degrees to radians formulas are derived from this). well sorry about this mess but im writing from memory and maybe im a little wrong.

Execute this code and you will see it better. hope this helps . cheers.
Graphics 640,480,16,2
SetBuffer BackBuffer()
For a# = 1 To 360.0  		
	Cls
	Color 255,0,0
	Line (320,200,320+Cos(a#)*100,200+Sin(a#)*100)
	Color 0,255,0
	Line (320,200,320+Cos(a#-90)*100,200+Sin(a#-90)*100)
	Color 0,0,255
	Line (320+Cos(a#-90)*100,200+Sin(a#-90)*100,320+Cos(a#)*100,200+Sin(a#)*100)
	VWait
	Flip False
Next
For a#=1 To 360.0
	Color 255,255,255
	Plot 320+Cos(a#)*100,200+Sin(a#)*100
	VWait
	Flip False
Next

WaitKey()

End