Skip to content

Two polygons with shared coords doesn't return intersecting but union works #12

@Falke-Design

Description

@Falke-Design

I want to check if two polygons with are intersecting.
When the polygons have overlapping coords, intersection still returns that they are not intersecting

Example:

const poly1 = [
			[
				[72.723999, 18.976429],
				[72.723999, 19.324103],
				[73.100281, 19.324103], // <-- overlapping coords
				[73.100281, 18.976429], // <-- overlapping coords
				[72.723999, 18.976429],
			],
		];

const poly2 = [
			[
				[73.100281, 18.976429], // <-- overlapping coords
				[73.100281, 19.324103], // <-- overlapping coords
				[74.900281, 19.324103],
				[74.900281, 18.976429],
				[73.100281, 18.976429],
			],
		];
polyclip.intersection(poly1, poly2);

Is not intersecting ... Why? Bounds are overlapping:
[]

polyclip.union(poly1, poly2);

Union returns single polygon (correctly), because bounds are overlapping:
[[[[72.723999,18.976429],[74.900281,18.976429],[74.900281,19.324103],[72.723999,19.324103],[72.723999,18.976429]]]]

https://plnkr.co/edit/qDSAFfMQUsJFog2S

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions