Closed ppiastucki closed 4 years ago
Add proper checks before advancing the position in the special case in pixelateLine to avoid creating pixels outside of the given range.
Here is a test case to reproduce the issue:
QtRegion testRegion; testRegion.encompass(Point2f(0.020345052078482695,0.03306070963481034)); ShapeMap testShapeMap; testShapeMap.init(1, testRegion); Line line = Line(Point2f(0.000000,0.007629394531193157), Point2f(0.010172526039241347,0.000000)); PixelRefVector pixels = testShapeMap.pixelateLine(line); for (size_t i = 0; i < pixels.size(); i++) { PixelRef pix = pixels[i]; printf("Pixel %d, %d\n", pix.x, pix.y); }
Result:
Pixel 0, 4 Pixel 1, 4 Pixel 1, 3 Pixel 2, 3 Pixel 3, 3 Pixel 3, 2 Pixel 4, 2 Pixel 5, 2 Pixel 5, 1 Pixel 6, 1 Pixel 7, 1 Pixel 7, 0 Pixel 8, 0 Pixel 9, 0 Pixel 10, 0 Pixel 10, -1
Or by running the following command with the attached DXF file:
./depthmapXcli -m IMPORT -f ./shape_250_4810.dxf -o shape.graph
row out of range
shape_250_4810.zip
Moved to https://github.com/SpaceGroupUCL/depthmapX/pull/372
Add proper checks before advancing the position in the special case in pixelateLine to avoid creating pixels outside of the given range.
Here is a test case to reproduce the issue:
Result:
Or by running the following command with the attached DXF file:
Result:
shape_250_4810.zip