Bug in display.newLine / line:append ?

(Sent via email as well.)

I've been working with a line-draw demo that I think Carlos wrote. It draws lines segments as you move your finger around the screen. After a certain point it stops drawing more line segments. Sometimes after just a second or two, sometimes after over 1000 segments are added.

It looked like a bug in the Lua code, so I spent some time narrowing it down. Eventually I boiled it down to this test program:

1
2
3
4
5
6
7
8
9
10
11
12
13
local pts = {}
 
table.insert(pts, {x=200, y=200}) -----MOVE THIS-----
table.insert(pts, {x=65, y=65})
table.insert(pts, {x=62, y=68})
table.insert(pts, {x=63, y=67})
 
local line = display.newLine(pts[1].x, pts[1].y, pts[2].x, pts[2].y)
for i = 3, #pts, 1 do 
    line:append(pts[i].x, pts[i].y)
end
line:setColor(255,128,0)
line.width=4

No response yet? OK here are four screenshots that illustrate what's happening.

The first is with the "MOVE THIS" line as the 1st line, then as the 2nd, the 3rd, and the 4th. All I'm doing is moving one line of code, and the lines are obviously being drawn incorrectly.

I hope this helps.

Thanks for the report. This is a bug in our rendering engine, which I've filed for an engineer to investigate. The issue, as it was explained to me, has to do with how our rendering engine computes/draws the miter joint when the angle created by the path is very small.

To better explain (not that it will necessarily be helpful to you) here's an interactive version of your bug sample w/three points, where the touch position on the screen determines the line's middle/second point. As the touch point approaches the same y-coordinate plane as the other two points (~65) the miter gets drawn way off stage.

local pts = {}
 
table.insert(pts, {x=5, y=65})
table.insert(pts, {x=62, y=68})
 
function drawLine(event)
        if event.phase == "began" or event.phase == "moved" then
                if line then
                        line:removeSelf()
                end
                line = display.newLine(pts[1].x, pts[1].y, event.x, event.y)
                line:append(pts[2].x, pts[2].y)
                line:setColor(255,128,0)
                line.width=4            
        end
end
 
 
Runtime:addEventListener("touch", drawLine)

Thanks for the reply, Tim, much appreciated. How can I track this? Right now I have a project that's on hold until this is fixed.

I added an issue to our issues database, and provided the number to our internal bug case for tracking.

http://developer.anscamobile.com/issues/5565

Eventually, we plan to make our bug base public so developers can more easily track bugs.

Tim

Thanks a bunch, Tim!

Hello,

I can't access the issue link.
Is is fixed?

I'm getting the same problem with this sample:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
-- LINES DEBUG
 pts = {
        {10,10},
        {50,10},
        {100,10},
        {200,10},
        {90,10}, -- THIS POINT BREAK THE LINE, COMMENT TO MAKE WORK
        {200,100}
 }
 l = display.newLine(pts[1][1], pts[1][2], pts[2][1], pts[2][2])
 for i = 3, #pts, 1 do
        l:append(pts[i][1], pts[i][2])
 end
 l.width = 4

I can't see the issue link.
Please, someone can say what is the status of this bug?

I'm with the same problem. My project is waiting this issue be fixed, and I can't check the link ...

Do you get any solution?
I'm trying to develop a way to avoid this problem by stoping the line and creating other lines until corona can fix this bug, someone can help with an idea?

This is in the queue, our internal tracking # is 3032. Currently it is marked as having high priority so there is a fair chance it will be addressed by the next release.

After a certain point it stops drawing more line segments. Sometimes after just a second or two, sometimes after over 1000 segments are added.

Is this totally unrelated to the miter bug?

c.

Thanks Tim,

I have a one year subscription but still can't see the linked page (bug track page). When you will make those pages public? I really need to see this bug fixed.

regards,
Mehran

views:1691 update:2011/10/11 22:13:38
corona forums © 2003-2011