Jump to content




Where to modify for CC Pixels?


  • You cannot reply to this topic
4 replies to this topic

#1 KingofGamesYami

  • Members
  • 3,002 posts
  • LocationUnited States of America

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?

#2 ByteMe

  • Members
  • 124 posts
  • LocationAdelaide, Australia

Posted 23 December 2014 - 01:03 AM

take a look at this, the maths might help.

#3 KingofGamesYami

  • Members
  • 3,002 posts
  • LocationUnited States of America

Posted 23 December 2014 - 02:03 AM

View PostByteMe, on 23 December 2014 - 01:03 AM, said:

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.

#4 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

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.

#5 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

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.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users