Mariane
18th February 2006, 19:16
Hi,
I'm trying to draw a convex polygon but I don't understand how to give the
coordinates.
I understood that the first number is an array index (which gives a segmentation
fault if started at 0, so it must start at 1, yes?).
But stuff like :
pts.setPoints(1, 240, 210, 260, 230, 300, 150, 320, 170);
either does nothing visible or draws lines all over the place
And when I try to add points one by one with :
pts.setPoint(1, 240, 210);
pts.setPoint(2, 260, 230);
pts.setPoint(3, 300, 150);
pts.setPoint(4, 320, 170);
I get errors like:
QGArray::at: Absolute index 16 out of range
segmentation fault
(and I haven't used a "16" anywhere).
Then I call a "p.drawConvexPolygon( pts );", with p being a QPainter.
What I am trying to do is to draw a polygon with points at coordinates:
(X = 240, Y = 210) (X = 260, Y = 230) (X = 300, Y = 150) and (X = 320, Y = 170).
Please help.
Mariane
I'm trying to draw a convex polygon but I don't understand how to give the
coordinates.
I understood that the first number is an array index (which gives a segmentation
fault if started at 0, so it must start at 1, yes?).
But stuff like :
pts.setPoints(1, 240, 210, 260, 230, 300, 150, 320, 170);
either does nothing visible or draws lines all over the place
And when I try to add points one by one with :
pts.setPoint(1, 240, 210);
pts.setPoint(2, 260, 230);
pts.setPoint(3, 300, 150);
pts.setPoint(4, 320, 170);
I get errors like:
QGArray::at: Absolute index 16 out of range
segmentation fault
(and I haven't used a "16" anywhere).
Then I call a "p.drawConvexPolygon( pts );", with p being a QPainter.
What I am trying to do is to draw a polygon with points at coordinates:
(X = 240, Y = 210) (X = 260, Y = 230) (X = 300, Y = 150) and (X = 320, Y = 170).
Please help.
Mariane