All pastes #443521 Raw Edit

Untitled

public text v1 · immutable
·published 2007-04-16 21:12 UTC
rendered paste body
local function CirclePoints( radius, divisions, xoff, yoff )

	local circle = {}
	local step	 = 360 / divisions
	local xoff, yoff = xoff or 0, yoff or 0

	for ang = 0, 360, step do
	
		local coords = {}
		ang = math.rad( ang )

		coords.x = ( math.cos( ang ) * radius ) + xoff
		coords.y = ( math.sin( ang ) * radius ) + yoff

		table.insert( circle, coords )
	end

	return circle

end

function surface.DrawOutlinePoly( coords )

	for i = 1,#coords-1 do
		surface.DrawLine( coords[i].x, coords[i].y, coords[i+1].x, coords[i+1].y )
	end

	surface.DrawLine( coords[#coords].x, coords[#coords].y, coords[1].x, coords[1].y )

end