Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

not detecting intersections in this case. #16

Open
tanmoyAtb opened this issue Feb 23, 2023 · 1 comment
Open

not detecting intersections in this case. #16

tanmoyAtb opened this issue Feb 23, 2023 · 1 comment

Comments

@tanmoyAtb
Copy link

The algorithm did not detect intersections in the following coordinates of a polygon.

const box = {
  type: "Polygon",
  coordinates: [
    [
      [90.39974817514972, 23.873991637113175],
      [90.40572498813789, 23.872911671285607],
      [90.40575223587952, 23.874804784092955],
      [90.4053503301788, 23.875873772177464],
      [90.40030947983682, 23.87861920694433],
      [90.39621276706808, 23.878127145947108],
      [90.3921160542993, 23.87747811375598],
      [90.39023118436477, 23.882439106594358],
      [90.38922437638114, 23.88382080428333],
      [90.38693010807042, 23.88390756033242],
      [90.38277413010324, 23.877399629023042],
      [90.37991123348131, 23.875909945040224],
      [90.37897952735014, 23.873517645288647],
      [90.37864863603832, 23.871792452376454],
      [90.37969103574207, 23.869125362621826],
      [90.3834212654788, 23.86583190806136],
      [90.38663651108469, 23.86556034446246],
      [90.39203703403477, 23.865488168279917],
      [90.3940094372637, 23.865251113185526],
      [90.3959818404927, 23.86548501039226],
      [90.39992664695066, 23.865638836372778],
      [90.40017732859211, 23.874030880518813],
      [90.39974817514972, 23.873991637113175],
      [90.39974817514972, 23.873991637113175],
      [90.39974817514972, 23.873991637113175],
    ],
  ],
};

It is a geoJSON coordinate list, the screenshot from geoJSON.io (Maybe the intersection only happens in spherical surfaces)

Screenshot 2023-02-23 at 1 42 03 PM

@rowanwins
Copy link
Owner

Hi @tanmoyAtb

I'd recommend checking out my sweepline-intersections library, it detects the intersection. The sweepline-intersections library has a slightly different API and returns all the intersections points, rather than just a boolean when the first self-intersection is discovered.

I'd need to look more closely as to why this case is failing in this lib, but passing in the other, because they use a fair bit of the same logic for the actual segment-to-segment intersection check. I suspect it's because the queueing logic is more complex in this library and it's not running a check on those overlapping segments.

Cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants