Polygon Returning Incorrect Result
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 184
- Forks
- 23
- PR merge metrics
- No merged PRs in 30d
Description
For this test case polygon() seems to return an incorrect result:
// Bounding box
var bbp = [-123.5006568260586, -268.5301901840667, -113.19703085688374, -261.59299895444263];
// Test polygon
var poly = [
[-127.7861230010377, -316.24149777631044],
[-116.70896693414316, -294.6055724833417],
[-112.85776301568613, -270.41743161420106],
[-108.94104548638926, -246.3102843974042],
[-113.9284569854127, -222.40054013470888],
[-100.48054530104075, -224.3864178730988],
[-95.49313380201731, -248.2961621357941],
[-99.40985133131419, -272.40330935259095],
[-103.26105524977122, -296.5914502217316],
[-114.33821131666575, -318.2273755147003]
];
let t1 = lineclip.polyclip(poly, bb);
// t1 = [[-113.19703085688374, -268.5301901840667],
[-113.19703085688374, -261.59299895444263],
[-113.19703085688374, -261.59299895444263],
[-113.19703085688374, -268.5301901840667]];
Note that the x coordinate of the intersection box is exactly xmax. It looks to me like the polygon hits the bounding box in exactly the upper right corner. I think that case should return no intersection or just the point intersection, but what actually gets returned is the entire right side of the bounding box.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the supplied polygon and bounding-box case through lineclip.polyclip, using the coordinates in the issue. Compare the returned right edge with the stated expected point or no-intersection behavior; done means the exact-corner case no longer returns the entire box side.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100