realuptime / PolyDetector

Detect all closed polygons given a set of line segments
MIT License
5 stars 1 forks source link

Using this repo #1

Open PauRosello97 opened 3 years ago

PauRosello97 commented 3 years ago

Hello, I find this proposal really interesting. Where could I find a working example? How can I run it using Windows? The classes you're using like "PolyLine" are the ones from Ferreira's code? I feel like there are missing files. I'm working on a similar project, and maybe we could help each other.

My mail: paurosellodiaz@gmail.com

Thank you

realuptime commented 3 years ago

Hi,

Thank you. It is not finished and I know it's limitations. Most of Ferreira's code was removed. In my projects, I have my own implementation of polylines based on MathGeoLib ( https://github.com/juj/MathGeoLib/blob/master/src/Geometry/). Here is an example project compiled with WASI ( https://hacks.mozilla.org/2019/03/standardizing-wasi-a-webassembly-system-interface/). This is a module from a bigger project: ARPlanar ( https://youtu.be/IKnuUHhchT0?t=167). For example you can load "Curte" from the left side and select vertical walls. You can also press ctrl+a to select all walls. The detected polygons will be highlighted with their corresponding Area.

https://myapp.eu/wasi/

Regards, Stan.

On Sat, Mar 6, 2021 at 7:59 PM PauRosello97 notifications@github.com wrote:

Hello, I find this proposal really interesting. Where could I find a working example? The classes you're using like "PolyLine" are the ones from Ferreira's code? I'm working on a similar project, and maybe we could help each other.

My mail: paurosellodiaz@gmail.com

Thank you

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/realuptime/PolyDetector/issues/1, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEODTY7S4Q2HAILAF5LSMJLTCJUR3ANCNFSM4YW6SURA .

realuptime commented 3 years ago

Or you can use Select Vertical and the View. There is a minimal Area threshold for which the polys are not painted. Also webgl has some bugs with triangle winding order and it skips a few polys. On Metal they are painted properly.

On Sat, Mar 6, 2021 at 9:10 PM Catalin Stan catalinux@gmail.com wrote:

Hi,

Thank you. It is not finished and I know it's limitations. Most of Ferreira's code was removed. In my projects, I have my own implementation of polylines based on MathGeoLib ( https://github.com/juj/MathGeoLib/blob/master/src/Geometry/). Here is an example project compiled with WASI ( https://hacks.mozilla.org/2019/03/standardizing-wasi-a-webassembly-system-interface/). This is a module from a bigger project: ARPlanar ( https://youtu.be/IKnuUHhchT0?t=167). For example you can load "Curte" from the left side and select vertical walls. You can also press ctrl+a to select all walls. The detected polygons will be highlighted with their corresponding Area.

https://myapp.eu/wasi/

Regards, Stan.

On Sat, Mar 6, 2021 at 7:59 PM PauRosello97 notifications@github.com wrote:

Hello, I find this proposal really interesting. Where could I find a working example? The classes you're using like "PolyLine" are the ones from Ferreira's code? I'm working on a similar project, and maybe we could help each other.

My mail: paurosellodiaz@gmail.com

Thank you

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/realuptime/PolyDetector/issues/1, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEODTY7S4Q2HAILAF5LSMJLTCJUR3ANCNFSM4YW6SURA .

PauRosello97 commented 3 years ago

Dear Stan, Thank you so much for your response. I've imported your PolyDetector to my OpenFrameworks project and it's starting to work! I've been two weeks trying to make Ferreira's code work without success.

One question, how do you draw the polygons? Do you have a way to sort the points? Right now I have the points disordered and a simple square looks like: [image: image.png]

Thank you. Regards, Pau.

El sáb, 6 mar 2021 a las 20:21, realuptime (notifications@github.com) escribió:

Or you can use Select Vertical and the View. There is a minimal Area threshold for which the polys are not painted. Also webgl has some bugs with triangle winding order and it skips a few polys. On Metal they are painted properly.

On Sat, Mar 6, 2021 at 9:10 PM Catalin Stan catalinux@gmail.com wrote:

Hi,

Thank you. It is not finished and I know it's limitations. Most of Ferreira's code was removed. In my projects, I have my own implementation of polylines based on MathGeoLib ( https://github.com/juj/MathGeoLib/blob/master/src/Geometry/). Here is an example project compiled with WASI (

https://hacks.mozilla.org/2019/03/standardizing-wasi-a-webassembly-system-interface/ ). This is a module from a bigger project: ARPlanar ( https://youtu.be/IKnuUHhchT0?t=167). For example you can load "Curte" from the left side and select vertical walls. You can also press ctrl+a to select all walls. The detected polygons will be highlighted with their corresponding Area.

https://myapp.eu/wasi/

Regards, Stan.

On Sat, Mar 6, 2021 at 7:59 PM PauRosello97 notifications@github.com wrote:

Hello, I find this proposal really interesting. Where could I find a working example? The classes you're using like "PolyLine" are the ones from Ferreira's code? I'm working on a similar project, and maybe we could help each other.

My mail: paurosellodiaz@gmail.com

Thank you

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/realuptime/PolyDetector/issues/1, or unsubscribe < https://github.com/notifications/unsubscribe-auth/AEODTY7S4Q2HAILAF5LSMJLTCJUR3ANCNFSM4YW6SURA

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/realuptime/PolyDetector/issues/1#issuecomment-792032179, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALYWGHW7N7R7SGHQE2BL36DTCJ6CPANCNFSM4YW6SURA .

realuptime commented 3 years ago

Hi Pau,

Your primary goal is to find all polygons or speed? If speed is not a concern, AddLineid can be modified to increase how many collinear lines can be accepted.

For generating the tris, I use the algo from here:

https://github.com/juj/MathGeoLib/blob/master/src/Geometry/Polygon.cpp TriangleArray Polygon::Triangulate() const Make sure before calling that, each cycle points are CCW ordered.

PauRosello97 commented 3 years ago

Dear Stan, I need all the polygons, and speed is also important... 😂 I want to generate this kind of compositions: [image: image.png] [image: image.png] See that some of the intersecting lines end inside a polygon. CCW ordering the points and then triangulating the polygon would work for this kind of "weird" polygons?

Thank you.

El dom, 7 mar 2021 a las 7:31, realuptime (notifications@github.com) escribió:

Hi Pau,

Your primary goal is to find all polygons or speed? If speed is not a concern, AddLineid can be modified to increase how many collinear lines can be accepted.

For generating the tris, I use the algo from here:

https://github.com/juj/MathGeoLib/blob/master/src/Geometry/Polygon.cpp TriangleArray Polygon::Triangulate() const Make sure before calling that, each cycle points are CCW ordered.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/realuptime/PolyDetector/issues/1#issuecomment-792226429, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALYWGHVP6PDVVH4NZDCJZLLTCMMVRANCNFSM4YW6SURA .

PauRosello97 commented 3 years ago

Dear Stan, It works really well. Could I know your complete name to properly mention you when I use this code? [image: image.png] Thank you

El dom, 7 mar 2021 a las 13:23, Pau Rosello (paurosellodiaz@gmail.com) escribió:

Dear Stan, I need all the polygons, and speed is also important... 😂 I want to generate this kind of compositions: [image: image.png] [image: image.png] See that some of the intersecting lines end inside a polygon. CCW ordering the points and then triangulating the polygon would work for this kind of "weird" polygons?

Thank you.

El dom, 7 mar 2021 a las 7:31, realuptime (notifications@github.com) escribió:

Hi Pau,

Your primary goal is to find all polygons or speed? If speed is not a concern, AddLineid can be modified to increase how many collinear lines can be accepted.

For generating the tris, I use the algo from here:

https://github.com/juj/MathGeoLib/blob/master/src/Geometry/Polygon.cpp TriangleArray Polygon::Triangulate() const Make sure before calling that, each cycle points are CCW ordered.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/realuptime/PolyDetector/issues/1#issuecomment-792226429, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALYWGHVP6PDVVH4NZDCJZLLTCMMVRANCNFSM4YW6SURA .

realuptime commented 3 years ago

My name is Catalin Stan, You can do anything with the code, even omit my name. I wrote the PolyDetector after trying a few libraries and I saw how slow they are and in the hope that someone else finds it useful. It's good that it works. The algo has a few limitations when intersections are isolated (I call them islands) or have only a line connected to another cycle. The dissolve strategy can be enhanced. You will see in the code that each detected cycle is being removed from the remaining intersections, also lines taken twice (two separate cycles) are being removed. This dissolve algorithm continues until no cycles remain to be detected. There is a certain bug that I could reproduce in my tests where remaining polygons are not detected. This is caused by those isolated islands. In case this bug is very visible, I would increase the collinearity step to allow just two collinear lines. But this will slow the execution quite a bit. Do you consider it fast enough? Also try to compile without debugging symbols: -g0 -O3. It has a huge performance impact. I also disabled exceptions.

Regards, Stan.

On Sun, Mar 7, 2021 at 6:58 PM PauRosello97 notifications@github.com wrote:

Dear Stan, It works really well. Could I know your complete name to properly mention you when I use this code? [image: image.png] Thank you

El dom, 7 mar 2021 a las 13:23, Pau Rosello (paurosellodiaz@gmail.com) escribió:

Dear Stan, I need all the polygons, and speed is also important... 😂 I want to generate this kind of compositions: [image: image.png] [image: image.png] See that some of the intersecting lines end inside a polygon. CCW ordering the points and then triangulating the polygon would work for this kind of "weird" polygons?

Thank you.

El dom, 7 mar 2021 a las 7:31, realuptime (notifications@github.com) escribió:

Hi Pau,

Your primary goal is to find all polygons or speed? If speed is not a concern, AddLineid can be modified to increase how many collinear lines can be accepted.

For generating the tris, I use the algo from here:

https://github.com/juj/MathGeoLib/blob/master/src/Geometry/Polygon.cpp TriangleArray Polygon::Triangulate() const Make sure before calling that, each cycle points are CCW ordered.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub < https://github.com/realuptime/PolyDetector/issues/1#issuecomment-792226429 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/ALYWGHVP6PDVVH4NZDCJZLLTCMMVRANCNFSM4YW6SURA

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/realuptime/PolyDetector/issues/1#issuecomment-792310822, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEODTYZA2CN3ZZ6H6QPA5MDTCOWC5ANCNFSM4YW6SURA .

realuptime commented 3 years ago

Dear Stan, I need all the polygons, and speed is also important... 😂 I want to generate this kind of compositions: [image: image.png] [image: image.png] See that some of the intersecting lines end inside a polygon. CCW ordering the points and then triangulating the polygon would work for this kind of "weird" polygons? Thank you. El dom, 7 mar 2021 a las 7:31, realuptime (notifications@github.com) escribió: Hi Pau, Your primary goal is to find all polygons or speed? If speed is not a concern, AddLineid can be modified to increase how many collinear lines can be accepted. For generating the tris, I use the algo from here: https://github.com/juj/MathGeoLib/blob/master/src/Geometry/Polygon.cpp TriangleArray Polygon::Triangulate() const Make sure before calling that, each cycle points are CCW ordered. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#1 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALYWGHVP6PDVVH4NZDCJZLLTCMMVRANCNFSM4YW6SURA .

I am not able to see the attached photos :(

realuptime commented 3 years ago

And not to forget: Disable the prints: uncomment the top defines for logoutf. Those will also speed up the detection.

On Sun, 7 Mar 2021 at 19:10, Catalin Stan catalinux@gmail.com wrote:

My name is Catalin Stan, You can do anything with the code, even omit my name. I wrote the PolyDetector after trying a few libraries and I saw how slow they are and in the hope that someone else finds it useful. It's good that it works. The algo has a few limitations when intersections are isolated (I call them islands) or have only a line connected to another cycle. The dissolve strategy can be enhanced. You will see in the code that each detected cycle is being removed from the remaining intersections, also lines taken twice (two separate cycles) are being removed. This dissolve algorithm continues until no cycles remain to be detected. There is a certain bug that I could reproduce in my tests where remaining polygons are not detected. This is caused by those isolated islands. In case this bug is very visible, I would increase the collinearity step to allow just two collinear lines. But this will slow the execution quite a bit. Do you consider it fast enough? Also try to compile without debugging symbols: -g0 -O3. It has a huge performance impact. I also disabled exceptions.

Regards, Stan.

On Sun, Mar 7, 2021 at 6:58 PM PauRosello97 notifications@github.com wrote:

Dear Stan, It works really well. Could I know your complete name to properly mention you when I use this code? [image: image.png] Thank you

El dom, 7 mar 2021 a las 13:23, Pau Rosello (paurosellodiaz@gmail.com) escribió:

Dear Stan, I need all the polygons, and speed is also important... 😂 I want to generate this kind of compositions: [image: image.png] [image: image.png] See that some of the intersecting lines end inside a polygon. CCW ordering the points and then triangulating the polygon would work for this kind of "weird" polygons?

Thank you.

El dom, 7 mar 2021 a las 7:31, realuptime (notifications@github.com) escribió:

Hi Pau,

Your primary goal is to find all polygons or speed? If speed is not a concern, AddLineid can be modified to increase how many collinear lines can be accepted.

For generating the tris, I use the algo from here:

https://github.com/juj/MathGeoLib/blob/master/src/Geometry/Polygon.cpp TriangleArray Polygon::Triangulate() const Make sure before calling that, each cycle points are CCW ordered.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub < https://github.com/realuptime/PolyDetector/issues/1#issuecomment-792226429 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/ALYWGHVP6PDVVH4NZDCJZLLTCMMVRANCNFSM4YW6SURA

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/realuptime/PolyDetector/issues/1#issuecomment-792310822, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEODTYZA2CN3ZZ6H6QPA5MDTCOWC5ANCNFSM4YW6SURA .

PauRosello97 commented 3 years ago

Dear Catalin, Thank you for your help. I really appreciate it. One question. The algorithm is supposed to work when three or more lines intersect at the same point? Thank you

El dom, 7 mar 2021 a las 18:25, realuptime (notifications@github.com) escribió:

And not to forget: Disable the prints: uncomment the top defines for logoutf. Those will also speed up the detection.

On Sun, 7 Mar 2021 at 19:10, Catalin Stan catalinux@gmail.com wrote:

My name is Catalin Stan, You can do anything with the code, even omit my name. I wrote the PolyDetector after trying a few libraries and I saw how slow they are and in the hope that someone else finds it useful. It's good that it works. The algo has a few limitations when intersections are isolated (I call them islands) or have only a line connected to another cycle. The dissolve strategy can be enhanced. You will see in the code that each detected cycle is being removed from the remaining intersections, also lines taken twice (two separate cycles) are being removed. This dissolve algorithm continues until no cycles remain to be detected. There is a certain bug that I could reproduce in my tests where remaining polygons are not detected. This is caused by those isolated islands. In case this bug is very visible, I would increase the collinearity step to allow just two collinear lines. But this will slow the execution quite a bit. Do you consider it fast enough? Also try to compile without debugging symbols: -g0 -O3. It has a huge performance impact. I also disabled exceptions.

Regards, Stan.

On Sun, Mar 7, 2021 at 6:58 PM PauRosello97 notifications@github.com wrote:

Dear Stan, It works really well. Could I know your complete name to properly mention you when I use this code? [image: image.png] Thank you

El dom, 7 mar 2021 a las 13:23, Pau Rosello (<paurosellodiaz@gmail.com ) escribió:

Dear Stan, I need all the polygons, and speed is also important... 😂 I want to generate this kind of compositions: [image: image.png] [image: image.png] See that some of the intersecting lines end inside a polygon. CCW ordering the points and then triangulating the polygon would work for this kind of "weird" polygons?

Thank you.

El dom, 7 mar 2021 a las 7:31, realuptime (<notifications@github.com ) escribió:

Hi Pau,

Your primary goal is to find all polygons or speed? If speed is not a concern, AddLineid can be modified to increase how many collinear lines can be accepted.

For generating the tris, I use the algo from here:

https://github.com/juj/MathGeoLib/blob/master/src/Geometry/Polygon.cpp TriangleArray Polygon::Triangulate() const Make sure before calling that, each cycle points are CCW ordered.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <

https://github.com/realuptime/PolyDetector/issues/1#issuecomment-792226429

,

or unsubscribe <

https://github.com/notifications/unsubscribe-auth/ALYWGHVP6PDVVH4NZDCJZLLTCMMVRANCNFSM4YW6SURA

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub < https://github.com/realuptime/PolyDetector/issues/1#issuecomment-792310822 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/AEODTYZA2CN3ZZ6H6QPA5MDTCOWC5ANCNFSM4YW6SURA

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/realuptime/PolyDetector/issues/1#issuecomment-792315694, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALYWGHUF5E77HITGA7AT3SLTCOZG7ANCNFSM4YW6SURA .

realuptime commented 3 years ago

Hi,

Yes, it should work. I tested this scenario.

Stan.

On Mon, Mar 8, 2021 at 1:12 AM PauRosello97 notifications@github.com wrote:

Dear Catalin, Thank you for your help. I really appreciate it. One question. The algorithm is supposed to work when three or more lines intersect at the same point? Thank you

El dom, 7 mar 2021 a las 18:25, realuptime (notifications@github.com) escribió:

And not to forget: Disable the prints: uncomment the top defines for logoutf. Those will also speed up the detection.

On Sun, 7 Mar 2021 at 19:10, Catalin Stan catalinux@gmail.com wrote:

My name is Catalin Stan, You can do anything with the code, even omit my name. I wrote the PolyDetector after trying a few libraries and I saw how slow they are and in the hope that someone else finds it useful. It's good that it works. The algo has a few limitations when intersections are isolated (I call them islands) or have only a line connected to another cycle. The dissolve strategy can be enhanced. You will see in the code that each detected cycle is being removed from the remaining intersections, also lines taken twice (two separate cycles) are being removed. This dissolve algorithm continues until no cycles remain to be detected. There is a certain bug that I could reproduce in my tests where remaining polygons are not detected. This is caused by those isolated islands. In case this bug is very visible, I would increase the collinearity step to allow just two collinear lines. But this will slow the execution quite a bit. Do you consider it fast enough? Also try to compile without debugging symbols: -g0 -O3. It has a huge performance impact. I also disabled exceptions.

Regards, Stan.

On Sun, Mar 7, 2021 at 6:58 PM PauRosello97 notifications@github.com wrote:

Dear Stan, It works really well. Could I know your complete name to properly mention you when I use this code? [image: image.png] Thank you

El dom, 7 mar 2021 a las 13:23, Pau Rosello (< paurosellodiaz@gmail.com ) escribió:

Dear Stan, I need all the polygons, and speed is also important... 😂 I want to generate this kind of compositions: [image: image.png] [image: image.png] See that some of the intersecting lines end inside a polygon. CCW ordering the points and then triangulating the polygon would work for this kind of "weird" polygons?

Thank you.

El dom, 7 mar 2021 a las 7:31, realuptime (< notifications@github.com ) escribió:

Hi Pau,

Your primary goal is to find all polygons or speed? If speed is not a concern, AddLineid can be modified to increase how many collinear lines can be accepted.

For generating the tris, I use the algo from here:

https://github.com/juj/MathGeoLib/blob/master/src/Geometry/Polygon.cpp TriangleArray Polygon::Triangulate() const Make sure before calling that, each cycle points are CCW ordered.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <

https://github.com/realuptime/PolyDetector/issues/1#issuecomment-792226429

,

or unsubscribe <

https://github.com/notifications/unsubscribe-auth/ALYWGHVP6PDVVH4NZDCJZLLTCMMVRANCNFSM4YW6SURA

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub <

https://github.com/realuptime/PolyDetector/issues/1#issuecomment-792310822

,

or unsubscribe <

https://github.com/notifications/unsubscribe-auth/AEODTYZA2CN3ZZ6H6QPA5MDTCOWC5ANCNFSM4YW6SURA

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub < https://github.com/realuptime/PolyDetector/issues/1#issuecomment-792315694 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/ALYWGHUF5E77HITGA7AT3SLTCOZG7ANCNFSM4YW6SURA

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/realuptime/PolyDetector/issues/1#issuecomment-792371844, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEODTY54QW5Z6ULNY6E6ORTTCQB5LANCNFSM4YW6SURA .

PauRosello97 commented 3 years ago

Thank you for your help! You've helped me a lot. One more question: Do you know why some polygons are not being detected? What should I do? [image: image.png] Thanks

El lun, 8 mar 2021 a las 0:16, realuptime @.***>) escribió:

Hi,

Yes, it should work. I tested this scenario.

Stan.

On Mon, Mar 8, 2021 at 1:12 AM PauRosello97 @.***> wrote:

Dear Catalin, Thank you for your help. I really appreciate it. One question. The algorithm is supposed to work when three or more lines intersect at the same point? Thank you

El dom, 7 mar 2021 a las 18:25, realuptime @.***>) escribió:

And not to forget: Disable the prints: uncomment the top defines for logoutf. Those will also speed up the detection.

On Sun, 7 Mar 2021 at 19:10, Catalin Stan @.***> wrote:

My name is Catalin Stan, You can do anything with the code, even omit my name. I wrote the PolyDetector after trying a few libraries and I saw how slow they are and in the hope that someone else finds it useful. It's good that it works. The algo has a few limitations when intersections are isolated (I call them islands) or have only a line connected to another cycle. The dissolve strategy can be enhanced. You will see in the code that each detected cycle is being removed from the remaining intersections, also lines taken twice (two separate cycles) are being removed. This dissolve algorithm continues until no cycles remain to be detected. There is a certain bug that I could reproduce in my tests where remaining polygons are not detected. This is caused by those isolated islands. In case this bug is very visible, I would increase the collinearity step to allow just two collinear lines. But this will slow the execution quite a bit. Do you consider it fast enough? Also try to compile without debugging symbols: -g0 -O3. It has a huge performance impact. I also disabled exceptions.

Regards, Stan.

On Sun, Mar 7, 2021 at 6:58 PM PauRosello97 < @.***> wrote:

Dear Stan, It works really well. Could I know your complete name to properly mention you when I use this code? [image: image.png] Thank you

El dom, 7 mar 2021 a las 13:23, Pau Rosello (< @.*** ) escribió:

Dear Stan, I need all the polygons, and speed is also important... 😂 I want to generate this kind of compositions: [image: image.png] [image: image.png] See that some of the intersecting lines end inside a polygon. CCW ordering the points and then triangulating the polygon would work for this kind of "weird" polygons?

Thank you.

El dom, 7 mar 2021 a las 7:31, realuptime (< @.*** ) escribió:

Hi Pau,

Your primary goal is to find all polygons or speed? If speed is not a concern, AddLineid can be modified to increase how many collinear lines can be accepted.

For generating the tris, I use the algo from here:

https://github.com/juj/MathGeoLib/blob/master/src/Geometry/Polygon.cpp TriangleArray Polygon::Triangulate() const Make sure before calling that, each cycle points are CCW ordered.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <

https://github.com/realuptime/PolyDetector/issues/1#issuecomment-792226429

,

or unsubscribe <

https://github.com/notifications/unsubscribe-auth/ALYWGHVP6PDVVH4NZDCJZLLTCMMVRANCNFSM4YW6SURA

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub <

https://github.com/realuptime/PolyDetector/issues/1#issuecomment-792310822

,

or unsubscribe <

https://github.com/notifications/unsubscribe-auth/AEODTYZA2CN3ZZ6H6QPA5MDTCOWC5ANCNFSM4YW6SURA

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <

https://github.com/realuptime/PolyDetector/issues/1#issuecomment-792315694

, or unsubscribe <

https://github.com/notifications/unsubscribe-auth/ALYWGHUF5E77HITGA7AT3SLTCOZG7ANCNFSM4YW6SURA

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub < https://github.com/realuptime/PolyDetector/issues/1#issuecomment-792371844 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/AEODTY54QW5Z6ULNY6E6ORTTCQB5LANCNFSM4YW6SURA

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/realuptime/PolyDetector/issues/1#issuecomment-792372457, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALYWGHWTONU52OBYSPLHBDTTCQCLNANCNFSM4YW6SURA .

PauRosello97 commented 3 years ago

Hi Stan, Your implementation works perfectly. I've just increased minPointDiff and it worked! My plan is to finish this in June. I'll send you the results, and I'll recognise your incredible work. Thank you [image: image.png]

El lun, 15 mar 2021 a las 18:52, Pau Rosello @.***>) escribió:

Thank you for your help! You've helped me a lot. One more question: Do you know why some polygons are not being detected? What should I do? [image: image.png] Thanks

El lun, 8 mar 2021 a las 0:16, realuptime @.***>) escribió:

Hi,

Yes, it should work. I tested this scenario.

Stan.

On Mon, Mar 8, 2021 at 1:12 AM PauRosello97 @.***> wrote:

Dear Catalin, Thank you for your help. I really appreciate it. One question. The algorithm is supposed to work when three or more lines intersect at the same point? Thank you

El dom, 7 mar 2021 a las 18:25, realuptime @.***>) escribió:

And not to forget: Disable the prints: uncomment the top defines for logoutf. Those will also speed up the detection.

On Sun, 7 Mar 2021 at 19:10, Catalin Stan @.***> wrote:

My name is Catalin Stan, You can do anything with the code, even omit my name. I wrote the PolyDetector after trying a few libraries and I saw how slow they are and in the hope that someone else finds it useful. It's good that it works. The algo has a few limitations when intersections are isolated (I call them islands) or have only a line connected to another cycle. The dissolve strategy can be enhanced. You will see in the code that each detected cycle is being removed from the remaining intersections, also lines taken twice (two separate cycles) are being removed. This dissolve algorithm continues until no cycles remain to be detected. There is a certain bug that I could reproduce in my tests where remaining polygons are not detected. This is caused by those isolated islands. In case this bug is very visible, I would increase the collinearity step to allow just two collinear lines. But this will slow the execution quite a bit. Do you consider it fast enough? Also try to compile without debugging symbols: -g0 -O3. It has a huge performance impact. I also disabled exceptions.

Regards, Stan.

On Sun, Mar 7, 2021 at 6:58 PM PauRosello97 < @.***> wrote:

Dear Stan, It works really well. Could I know your complete name to properly mention you when I use this code? [image: image.png] Thank you

El dom, 7 mar 2021 a las 13:23, Pau Rosello (< @.*** ) escribió:

Dear Stan, I need all the polygons, and speed is also important... 😂 I want to generate this kind of compositions: [image: image.png] [image: image.png] See that some of the intersecting lines end inside a polygon. CCW ordering the points and then triangulating the polygon would work for this kind of "weird" polygons?

Thank you.

El dom, 7 mar 2021 a las 7:31, realuptime (< @.*** ) escribió:

Hi Pau,

Your primary goal is to find all polygons or speed? If speed is not a concern, AddLineid can be modified to increase how many collinear lines can be accepted.

For generating the tris, I use the algo from here:

https://github.com/juj/MathGeoLib/blob/master/src/Geometry/Polygon.cpp

TriangleArray Polygon::Triangulate() const Make sure before calling that, each cycle points are CCW ordered.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <

https://github.com/realuptime/PolyDetector/issues/1#issuecomment-792226429

,

or unsubscribe <

https://github.com/notifications/unsubscribe-auth/ALYWGHVP6PDVVH4NZDCJZLLTCMMVRANCNFSM4YW6SURA

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub <

https://github.com/realuptime/PolyDetector/issues/1#issuecomment-792310822

,

or unsubscribe <

https://github.com/notifications/unsubscribe-auth/AEODTYZA2CN3ZZ6H6QPA5MDTCOWC5ANCNFSM4YW6SURA

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <

https://github.com/realuptime/PolyDetector/issues/1#issuecomment-792315694

, or unsubscribe <

https://github.com/notifications/unsubscribe-auth/ALYWGHUF5E77HITGA7AT3SLTCOZG7ANCNFSM4YW6SURA

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub < https://github.com/realuptime/PolyDetector/issues/1#issuecomment-792371844 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/AEODTY54QW5Z6ULNY6E6ORTTCQB5LANCNFSM4YW6SURA

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/realuptime/PolyDetector/issues/1#issuecomment-792372457, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALYWGHWTONU52OBYSPLHBDTTCQCLNANCNFSM4YW6SURA .

realuptime commented 3 years ago

Awesome, thanks for the update!

On Mon, 22 Mar 2021 at 19:50, PauRosello97 @.***> wrote:

Hi Stan, Your implementation works perfectly. I've just increased minPointDiff and it worked! My plan is to finish this in June. I'll send you the results, and I'll recognise your incredible work. Thank you [image: image.png]

El lun, 15 mar 2021 a las 18:52, Pau Rosello @.***>) escribió:

Thank you for your help! You've helped me a lot. One more question: Do you know why some polygons are not being detected? What should I do? [image: image.png] Thanks

El lun, 8 mar 2021 a las 0:16, realuptime @.***>) escribió:

Hi,

Yes, it should work. I tested this scenario.

Stan.

On Mon, Mar 8, 2021 at 1:12 AM PauRosello97 @.***> wrote:

Dear Catalin, Thank you for your help. I really appreciate it. One question. The algorithm is supposed to work when three or more lines intersect at the same point? Thank you

El dom, 7 mar 2021 a las 18:25, realuptime @.***>) escribió:

And not to forget: Disable the prints: uncomment the top defines for logoutf. Those will also speed up the detection.

On Sun, 7 Mar 2021 at 19:10, Catalin Stan @.***> wrote:

My name is Catalin Stan, You can do anything with the code, even omit my name. I wrote the PolyDetector after trying a few libraries and I saw how slow they are and in the hope that someone else finds it useful. It's good that it works. The algo has a few limitations when intersections are isolated (I call them islands) or have only a line connected to another cycle. The dissolve strategy can be enhanced. You will see in the code that each detected cycle is being removed from the remaining intersections, also lines taken twice (two separate cycles) are being removed. This dissolve algorithm continues until no cycles remain to be detected. There is a certain bug that I could reproduce in my tests where remaining polygons are not detected. This is caused by those isolated islands. In case this bug is very visible, I would increase the collinearity step to allow just two collinear lines. But this will slow the execution quite a bit. Do you consider it fast enough? Also try to compile without debugging symbols: -g0 -O3. It has a huge performance impact. I also disabled exceptions.

Regards, Stan.

On Sun, Mar 7, 2021 at 6:58 PM PauRosello97 < @.***> wrote:

Dear Stan, It works really well. Could I know your complete name to properly mention you when I use this code? [image: image.png] Thank you

El dom, 7 mar 2021 a las 13:23, Pau Rosello (< @.*** ) escribió:

Dear Stan, I need all the polygons, and speed is also important... 😂 I want to generate this kind of compositions: [image: image.png] [image: image.png] See that some of the intersecting lines end inside a polygon. CCW ordering the points and then triangulating the polygon would work for this kind of "weird" polygons?

Thank you.

El dom, 7 mar 2021 a las 7:31, realuptime (< @.*** ) escribió:

Hi Pau,

Your primary goal is to find all polygons or speed? If speed is not a concern, AddLineid can be modified to increase how many collinear lines can be accepted.

For generating the tris, I use the algo from here:

https://github.com/juj/MathGeoLib/blob/master/src/Geometry/Polygon.cpp

TriangleArray Polygon::Triangulate() const Make sure before calling that, each cycle points are CCW ordered.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <

https://github.com/realuptime/PolyDetector/issues/1#issuecomment-792226429

,

or unsubscribe <

https://github.com/notifications/unsubscribe-auth/ALYWGHVP6PDVVH4NZDCJZLLTCMMVRANCNFSM4YW6SURA

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub <

https://github.com/realuptime/PolyDetector/issues/1#issuecomment-792310822

,

or unsubscribe <

https://github.com/notifications/unsubscribe-auth/AEODTYZA2CN3ZZ6H6QPA5MDTCOWC5ANCNFSM4YW6SURA

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <

https://github.com/realuptime/PolyDetector/issues/1#issuecomment-792315694

, or unsubscribe <

https://github.com/notifications/unsubscribe-auth/ALYWGHUF5E77HITGA7AT3SLTCOZG7ANCNFSM4YW6SURA

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub <

https://github.com/realuptime/PolyDetector/issues/1#issuecomment-792371844

, or unsubscribe <

https://github.com/notifications/unsubscribe-auth/AEODTY54QW5Z6ULNY6E6ORTTCQB5LANCNFSM4YW6SURA

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub < https://github.com/realuptime/PolyDetector/issues/1#issuecomment-792372457 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/ALYWGHWTONU52OBYSPLHBDTTCQCLNANCNFSM4YW6SURA

.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/realuptime/PolyDetector/issues/1#issuecomment-804267707, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEODTY2K4GKU5T5KIVXVFUDTE57MZANCNFSM4YW6SURA .

PauRosello97 commented 3 years ago

Dear Catalin, here's the adaptation I've done of your code: https://github.com/PauRosello97/ofxPolygonDetector . I've published it as a library for OpenFrameworks

El mar, 23 mar 2021 a las 20:06, realuptime @.***>) escribió:

Awesome, thanks for the update!

On Mon, 22 Mar 2021 at 19:50, PauRosello97 @.***> wrote:

Hi Stan, Your implementation works perfectly. I've just increased minPointDiff and it worked! My plan is to finish this in June. I'll send you the results, and I'll recognise your incredible work. Thank you [image: image.png]

El lun, 15 mar 2021 a las 18:52, Pau Rosello @.***>) escribió:

Thank you for your help! You've helped me a lot. One more question: Do you know why some polygons are not being detected? What should I do? [image: image.png] Thanks

El lun, 8 mar 2021 a las 0:16, realuptime @.***>) escribió:

Hi,

Yes, it should work. I tested this scenario.

Stan.

On Mon, Mar 8, 2021 at 1:12 AM PauRosello97 @.***> wrote:

Dear Catalin, Thank you for your help. I really appreciate it. One question. The algorithm is supposed to work when three or more lines intersect at the same point? Thank you

El dom, 7 mar 2021 a las 18:25, realuptime @.***>) escribió:

And not to forget: Disable the prints: uncomment the top defines for logoutf. Those will also speed up the detection.

On Sun, 7 Mar 2021 at 19:10, Catalin Stan @.***> wrote:

My name is Catalin Stan, You can do anything with the code, even omit my name. I wrote the PolyDetector after trying a few libraries and I saw how slow they are and in the hope that someone else finds it useful. It's good that it works. The algo has a few limitations when intersections are isolated (I call them islands) or have only a line connected to another cycle. The dissolve strategy can be enhanced. You will see in the code that each detected cycle is being removed from the remaining intersections, also lines taken twice (two separate cycles) are being removed. This dissolve algorithm continues until no cycles remain to be detected. There is a certain bug that I could reproduce in my tests where remaining polygons are not detected. This is caused by those isolated islands. In case this bug is very visible, I would increase the collinearity step to allow just two collinear lines. But this will slow the execution quite a bit. Do you consider it fast enough? Also try to compile without debugging symbols: -g0 -O3. It has a huge performance impact. I also disabled exceptions.

Regards, Stan.

On Sun, Mar 7, 2021 at 6:58 PM PauRosello97 < @.***> wrote:

Dear Stan, It works really well. Could I know your complete name to properly mention you when I use this code? [image: image.png] Thank you

El dom, 7 mar 2021 a las 13:23, Pau Rosello (< @.*** ) escribió:

Dear Stan, I need all the polygons, and speed is also important... 😂 I want to generate this kind of compositions: [image: image.png] [image: image.png] See that some of the intersecting lines end inside a polygon. CCW ordering the points and then triangulating the polygon would work for this kind of "weird" polygons?

Thank you.

El dom, 7 mar 2021 a las 7:31, realuptime (< @.*** ) escribió:

Hi Pau,

Your primary goal is to find all polygons or speed? If speed is not a concern, AddLineid can be modified to increase how many collinear lines can be accepted.

For generating the tris, I use the algo from here:

https://github.com/juj/MathGeoLib/blob/master/src/Geometry/Polygon.cpp

TriangleArray Polygon::Triangulate() const Make sure before calling that, each cycle points are CCW ordered.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <

https://github.com/realuptime/PolyDetector/issues/1#issuecomment-792226429

,

or unsubscribe <

https://github.com/notifications/unsubscribe-auth/ALYWGHVP6PDVVH4NZDCJZLLTCMMVRANCNFSM4YW6SURA

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub <

https://github.com/realuptime/PolyDetector/issues/1#issuecomment-792310822

,

or unsubscribe <

https://github.com/notifications/unsubscribe-auth/AEODTYZA2CN3ZZ6H6QPA5MDTCOWC5ANCNFSM4YW6SURA

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <

https://github.com/realuptime/PolyDetector/issues/1#issuecomment-792315694

, or unsubscribe <

https://github.com/notifications/unsubscribe-auth/ALYWGHUF5E77HITGA7AT3SLTCOZG7ANCNFSM4YW6SURA

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub <

https://github.com/realuptime/PolyDetector/issues/1#issuecomment-792371844

, or unsubscribe <

https://github.com/notifications/unsubscribe-auth/AEODTY54QW5Z6ULNY6E6ORTTCQB5LANCNFSM4YW6SURA

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <

https://github.com/realuptime/PolyDetector/issues/1#issuecomment-792372457

,

or unsubscribe <

https://github.com/notifications/unsubscribe-auth/ALYWGHWTONU52OBYSPLHBDTTCQCLNANCNFSM4YW6SURA

.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub < https://github.com/realuptime/PolyDetector/issues/1#issuecomment-804267707 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/AEODTY2K4GKU5T5KIVXVFUDTE57MZANCNFSM4YW6SURA

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/realuptime/PolyDetector/issues/1#issuecomment-805158464, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALYWGHVHEA7I2GK4PUUXNQLTFDRB7ANCNFSM4YW6SURA .