kewur / poly2tri

Automatically exported from code.google.com/p/poly2tri
Other
0 stars 0 forks source link

Python crashes when create CDT object #85

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Under windows XP/7 with python 2.7
Build poly2tri by MSVC 2008/2010
When I run 
python test.py data/dude.dat 100 -200 1
    ##
    ## Step 1: Initialize
    ## NOTE: polyline must be a simple polygon. The polyline's points
    ## constitute constrained edges. No repeat points!!!
    ##
    cdt = CDT(polyline)
Python crashes at this line

Original issue reported on code.google.com by icearea on 30 Sep 2013 at 7:43

GoogleCodeExporter commented 9 years ago
When I modify cdt.pxi
def __init__(self, list polyline):
    self.polyline = pointvec_factory(0)
    for point in polyline:
        self.polyline.push_back(new_Point(point.x, point.y))
    self.me = new_CDT(self.polyline)
to
def __init__(self, list polyline):
    cdef point_vec poly = pointvec_factory(0)
    for point in polyline:
        poly.push_back(new_Point(point.x, point.y))
    self.me = new_CDT(poly)
test.py works correctly

Original comment by icearea on 1 Oct 2013 at 5:07