1. NodeBox 1
    1. Homepage
    2. NodeBox 3Node-based app for generative design and data visualization
    3. NodeBox OpenGLHardware-accelerated cross-platform graphics library
    4. NodeBox 1Generate 2D visuals using Python code (Mac OS X only)
  2. Gallery
  3. Documentation
  4. Forum
  5. Blog

Crash

Posted by Patrick on Jan 25, 2009

When I run the following script, nodebox crashes. It doesn't always crash right away, and sometimes I get to see the output, but it crashes every time. I would really appreciate any insight.

def circle(x,y,r):
    d = 2*r
    return oval(x-r,y-r,d,d, draw=False)
    
 
def sunshape(x,y,r1,r2=100,segments=7,width=.4):
    a = circle(x,y,r1)
    b = circle(x,y,r2)
    
    autoclosepath(False)
    beginpath()
    
    for i in range(segments):
        t1 = float(i)/segments
        t2 = float(i+width)/segments
        
        a1 = a.point(t1)
        a2 = a.point(t2)
        b1 = b.point(t1)
        b2 = b.point(t2)
        
        moveto(a1.x, a1.y)
        lineto(a2.x, a2.y)
        lineto(b2.x, b2.y)
        lineto(b1.x, b1.y)
        lineto(a1.x, a1.y)
    
    p = endpath(draw = False)
    p = p.union(a)
    return p
    
q = sunshape(150,200,50)
 
fill(0.4,0.2,0,0.2)
stroke(0.6,0.2,0,0.3)
strokewidth(3)
drawpath(q)
Thanks for your help


 
Posted by Tom De Smedt on Jan 29, 2009

The crash happens when calling p.union(a). A memory problem in the underlying GPC module occurs. Unfortunately C-code is a little harder to evaluate so the bug hasn't been fixed yet. We'll have a look at it.



Posted by Patrick on Feb 17, 2009

Thanks Tom. Is there a bug report with GPC or some sort of resolution in the works? Is there anything unusual about the paths in my script that make GPC fail?Thanks for your help.



Posted by Patrick on Mar 04, 2009

Does anyone have any more information regarding this bug? Thanks,