Polygon Close Point Policy
Add or remove one exact repeated endpoint under an explicit polygon closure policy; no geometric simplification.
Description
Add or remove one exact repeated endpoint under an explicit polygon closure policy; no geometric simplification.
A polygon point list may explicitly repeat its first point to indicate closure. This policy adds or removes one such endpoint occurrence.
When to use this tool
Add or remove one exact repeated endpoint under an explicit polygon closure policy; no geometric simplification.
- Prepare the supplied points, close fields for this operation.
- Compare the complete example with the representation used by your own input before carrying the result into another step.
How to use the tool and how it works
- Enter points, close. Use the exact text syntax, units and index conventions explained below.
- Run the tool. If input validation fails, correct the supplied fields before interpreting any result.
- Read result.points, result.initiallyClosed. Interpret false, null and empty lists using the distinctions below; they can be valid outputs.
Require every points row to be an x/y pair and copy it. Detect exact equality of first and final points when length exceeds one. If close append the first when needed; otherwise remove one duplicate closing point. Return initiallyClosed.1
| Input field | Meaning and representation | Accepted input |
|---|---|---|
| points | points. | Numeric rows; at most 128 rows and 128 values per row |
| close | Explicit choice for close; supply a boolean rather than a text label. | true or false |
| Output field | Interpretation |
|---|---|
| result | Object containing the named outputs below. |
| result.points | The points list in the ordering and representation described above. |
| result.initiallyClosed | Whether the original first and final point coordinates matched exactly with more than one point. |
{
"input": {
"points": [
[
0,
0
],
[
1,
0
],
[
0,
0
]
],
"close": false
},
"output": {
"result": {
"points": [
[
0,
0
],
[
1,
0
]
],
"initiallyClosed": true
}
}
} Limitations and assumptions
- This changes only the list, without adding an SVG closepath command. Repeated closures may require another pass; a single point is not initially considered closed.
- Point pairs use [x,y], rectangles and viewBox use [x,y,width,height], and all coordinate units must be consistent. This tool does not read, render or modify an SVG document.
- Every declared top-level field is required and unexpected fields are rejected. Numeric inputs must be finite; ordinary text fields are bounded to 8,192 UTF-16 code units, with tighter operation-specific limits where stated.
- Lists are limited to 128 entries. JSON text must meet bounded size and depth checks, and numeric outputs beyond the safe finite magnitude are rejected. Exact large integers use decimal strings.
- Indexes are zero-based and spans have an exclusive end unless explicitly stated otherwise. A valid false, null or empty-list result is distinct from malformed input.
Alternative or Complementary methods
Use a full SVG parser or rendering engine when the task includes commands and CSS values outside the documented branch. Compare coordinates and transforms under the same units and viewport convention.
References
Similar or alternative tools
- Polyline Distance Point Lookup
Interpolate a point by Euclidean cumulative polyline distance without extrapolation; zero-length segments are skipped for interpolation.
- Absolute Line Command Differencer
Difference explicit absolute SVG M/L commands against the preceding current point, initially the origin; no curves or closepath.