You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I was doing some tests with the clipper2 Java port and I have the following doubt, what is the best approach to join polygons that share the same edge?, I mean adjacent forms.
I get some different behaviours:
Using Long(64)
Paths64 one = new Paths64();
Paths64 two = new Paths64();
one.add(Clipper.MakePath(new int[]{
0, 0, 0, 1, 1, 1, 1, 0}));
two.add(Clipper.MakePath(new int[]{
1, 0, 2, 0, 2, 1, 1, 1}));
Paths64 union = Clipper.Union(one, two, FillRule.NonZero);
System.out.println("Union: " + union);
//Result:
A = (1,0) (1,1) (0,1) (0,0)
B = (2,1) (1,1) (1,0) (2,0)
//It consider they do not intersect, so they can't be joined as one?
Using Doubles
PathsD oneDouble = new PathsD();
PathsD twoDouble = new PathsD();
oneDouble.add(Clipper.MakePath(new double[]{
0d, 1d, 1d, 1d, 1d, 0d, 0d, 0d}));
twoDouble.add(Clipper.MakePath(new double[]{
1d, 0d, 2d, 0d, 2d, 1d, 1d, 1d}));
PathsD unionDouble = Clipper.Union(oneDouble, twoDouble, FillRule.NonZero, 3);
System.out.println("Union with doubles: " + unionDouble);
//Result:
A = 1,000000,0,000000) (2,000000,0,000000) (2,000000,1,000000) (1,000000,1,000000) (0,000000,1,000000) (0,000000,0,000000)
//That would do, but my values are long too...
This discussion was converted from issue #854 on June 19, 2024 12:29.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi, I was doing some tests with the clipper2 Java port and I have the following doubt, what is the best approach to join polygons that share the same edge?, I mean adjacent forms.
I get some different behaviours:
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions