Create a vertex

Blitz3D Forums/Blitz3D Beginners Area/Create a vertex

Try this ...

This example creates a filled circle of radius 100 :

SUN = MESHring( 0 , 100 , 7.5,7.5, 15 )

This example creates a hollow circle with inner radius of 4 and outer radius of 5 :

CURSOR = MESHring( 4,5,15,15, 30 )

Try this also ..

POINTER = MESHring( 20 , 25 , 0,5,90 )

Function MESHring( Min# , Max#, MinA#, MaxA#, Segs = 30 )

	mesh = CreateMesh()
	s = CreateSurface( mesh )

	Closed = ( MinA = MaxA And MinA = Segs * .5 )
	For a = 1 To 360 
		If ( a Mod segs ) = 0
			If ( Not Closed )
				v0 = AddVertex( s, Max * Cos( a - MaxA ) , Max * Sin( a - MaxA ) , 0 )
				v1 = AddVertex( s, Max * Cos( a + MaxA ) , Max * Sin( a + MaxA ) , 0 )
				v2 = AddVertex( s, Min * Cos( a + MinA ) , Min * Sin( a + MinA ) , 0 )
				v3 = AddVertex( s, Min * Cos( a - MinA ) , Min * Sin( a - MinA ) , 0 )
				AddTriangle s, v2, v1, v0
				AddTriangle s, v0, v3, v2
			Else
				AddVertex( s, Max * Cos( a ) , Max * Sin( a ) , 0 )
				AddVertex( s, Min * Cos( a ) , Min * Sin( a ) , 0 )
			EndIf
		EndIf				
	Next	

	If Closed
		Points = 360.0 / Segs
		For l = 0 To Points - 1
			n = ( l + 1 ) Mod Points
			V0 = l * 2
			V1 = V0+1
			V3 = n * 2
			V2 = v3 + 1	
			AddTriangle s, v0, v1, v2
			AddTriangle s, v2, v3, v0
		Next
	EndIf	

	Return Mesh	

End Function