Hi
I am building the basics to a new game and in the game I have a circle and then I let the player draw two lines over the circle. After the two lines are drawn I get all values from the lines and now my knowledge in math ends… 
What I want now is to slice the circle where the lines where drawn and make each slice like a piece of a pie as a separate form/shape. I also want to calculate the size of the slice from the circle so I can get a percentage value of each slice.
It is like some levels in the game slice it.
[lua]-- Define Corona Stuff
display.setStatusBar( display.HiddenStatusBar )
– Draw background rectangle fill white for the moment
local bg = display.newRect( 0, 0, display.contentWidth,display.contentHeight ) – Create a rectangle for background
bg:setFillColor(100,100,100)
bg:toBack()
local roundCircle = display.newCircle(display.contentWidth/2+50,display.contentHeight/2,145 ) – Create a circle same size as pizzaSlice
roundCircle:setFillColor(0,255,0)
roundCircle:toFront()
roundCircle.alpha=1.0
local startLineX = {}
local startLineY = {}
local endLineX = {}
local endLineY = {}
local drawText = nil
local myLine = {}
local lineNo = 0
myLine[lineNo] = nil
local runSlicer = function( event )
if (event.phase == “began”) then
print (" start line " … lineNo)
elseif (event.phase == “moved”) then
print ("moving line " … lineNo)
if ( myLine[lineNo]) then
myLine[lineNo].parent:remove( myLine[lineNo] ) – erase previous line, if any
end
myLine[lineNo] = display.newLine( event.xStart,event.yStart, event.x,event.y )
myLine[lineNo]:setColor( 255, 255, 0 )
myLine[lineNo].width = 8
elseif (event.phase == “ended”) then
print(" end line " … lineNo)
if ( myLine[lineNo] ) then
startLineX[lineNo] = event.xStart
startLineY[lineNo] = event.yStart
endLineX[lineNo] = event.x
endLineY[lineNo] = event.y
end
lineNo = lineNo + 1
if lineNo > 1 then
Runtime:removeEventListener(“touch”, runSlicer)
– Summarize line 1 by printing values to screen
drawText = display.newText( “Line 1 xStart:” … startLineX[0], 10, 10, native.systemFont, 12 )
drawText = display.newText( “Line 1 yStart:” … startLineY[0], 10, 25, native.systemFont, 12 )
drawText = display.newText( “Line 1 xEnd:” … endLineX[0], 10, 40, native.systemFont, 12 )
drawText = display.newText( “Line 1 yEnd:” … endLineX[0], 10, 55, native.systemFont, 12 )
– Summarize line 2 by printing values to screen
drawText = display.newText( “Line 2 xStart:” … startLineX[1], 10, 80, native.systemFont, 12 )
drawText = display.newText( “Line 2 yStart:” … startLineY[1], 10, 95, native.systemFont, 12 )
drawText = display.newText( “Line 2 xEnd:” … endLineX[1], 10, 110, native.systemFont, 12 )
drawText = display.newText( “Line 2 yEnd:” … endLineX[1], 10, 125, native.systemFont, 12 )
return true
end
end
return true
end
Runtime:addEventListener(“touch”, runSlicer)[/lua]
Can anyone help me accomplish this? [import]uid: 22737 topic_id: 6656 reply_id: 306656[/import]