This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
KingofGamesYami's profile picture

Where to modify for CC Pixels?

Started by KingofGamesYami, 23 December 2014 - 12:00 AM
KingofGamesYami #1
Posted 23 December 2014 - 01:00 AM

local function getY( centerx, centery, radius, x )
	local origin = math.sqrt( radius^2 - (x - centerx) ^2 )
	return (centery + origin), (centery - origin)
end

Using this function, you can draw a circle. However, I'm unsure of what to adjust for. I've heard multiply by .66, but if I multiply the entire result, it doesn't start at the center. Ditto for everything else I've tried. Anyone got any ides?
ByteMe #2
Posted 23 December 2014 - 01:03 AM
take a look at this, the maths might help.
KingofGamesYami #3
Posted 23 December 2014 - 02:03 AM
take a look at this, the maths might help.

That is using real blocks in game, which are perfectly square. I'm trying to adjust for CC's pixels, which are rectangles roughly
2/3 by 1.
Bomb Bloke #4
Posted 23 December 2014 - 06:40 AM
Characters have a width to height ratio of 2:3, so multiplying your y offsets by two thirds should indeed do the trick. If you want the center to remain where it would've been, then I suppose just add one third of your radius to all your y offsets afterwards.
theoriginalbit #5
Posted 23 December 2014 - 07:52 AM
I have a Circle Drawing function here, which you can see on line 8 deals with the non-squared pixels.