Sub-issue of #50.
Problem
Path.to_polygons() returns closed polygon sequences by default — it
appends the starting vertex to the end so fill operations can use the
vertex list directly. For filled polygons this duplicate edge is hidden
under the fill. For open curves emitted via \draw, the duplicate vertex
produces a visible diagonal segment cutting across the figure (e.g. from
the top-left of an indifference curve back down to its lower-right tail).
Proposed fix
Strip the auto-appended closing vertex when rgbFace is None:
def draw_path(self, gc, path, transform, rgbFace=None):
for poly in path.to_polygons(transform):
if rgbFace is None and len(poly) > 2 and np.allclose(poly[0], poly[-1]):
poly = poly[:-1]
pts = ' -- '.join(
f'({x*self.scale:.4f},{y*self.scale:.4f})' for x, y in poly
)
self._commands.append(f'{self._cmd(gc, rgbFace)} {pts};')
The np.allclose guard avoids stripping legitimate closed shapes that
arrive with rgbFace set (budget polygons, shaded regions).
Acceptance criteria
Sub-issue of #50.
Problem
Path.to_polygons()returns closed polygon sequences by default — itappends the starting vertex to the end so fill operations can use the
vertex list directly. For filled polygons this duplicate edge is hidden
under the fill. For open curves emitted via
\draw, the duplicate vertexproduces a visible diagonal segment cutting across the figure (e.g. from
the top-left of an indifference curve back down to its lower-right tail).
Proposed fix
Strip the auto-appended closing vertex when
rgbFace is None:The
np.allcloseguard avoids stripping legitimate closed shapes thatarrive with
rgbFaceset (budget polygons, shaded regions).Acceptance criteria
\drawcontain no spurious closingsegment.
example has strictly monotonic vertex ordering (no return-to-origin).