-
Notifications
You must be signed in to change notification settings - Fork 44
Description
In src/entities/lineEntity.js, the _getPolyLinePoints method does not process the bulge value on the last vertex of a closed polyline. As a result, the closing segment (from the last vertex back to the first) is never checked for a bulge and any arc on that segment is lost.
Root Cause
The loop always stops one vertex short, regardless of whether the polyline is closed:
for ( let i = 0, il = vertices.length; i < il - 1; ++i ) {
let fromv = vertices[i];
let tov = vertices[i + 1];
// ...
}For a closed polyline with N vertices, this skips the segment from vertices[N-1] back to vertices[0].
Expected Behavior
For closed polylines, the closing segment should be processed and its bulge respected.
Proposed Fix
Adjust the number of segments based on whether the polyline is closed, and wrap the index for the final segment:
const numSegments = closed ? vertices.length : vertices.length - 1;
for ( let i = 0; i < numSegments; ++i ) {
let fromv = vertices[i];
let tov = vertices[(i + 1) % vertices.length];
// ...
}Reproduction
Bug can be reproduced with any closed LWPOLYLINE or POLYLINE where the bulge value is on the last vertex (connecting back to the first vertex). The arc will render as a straight line.