License Delivery maintenance is expected to occur on Saturday, November 30, between 8 AM and 11 AM CET. This may cause a short 3-hours outage in which license-related tasks: license key upload, download, update, SSA validation, access to the license pool and Graphisoft ID authentication may not function properly. We apologize for any inconvenience.
Libraries & objects
About Archicad and BIMcloud libraries, their management and migration, objects and other library parts, etc.

Point inside a polygon using Polygon Operations Macro

psylo
Contributor
Hi !

First of all, english isn't my native langage, forgive me if my message isn't correct english

I post a message in official Graphisoft forum (http://gdl.graphisoft.com) but without any answer yet ...

----

I try to display a grid of items in a custom polygon.

I define a polygon with 3 hotspots, then I test a grid of points with the Polygon Operations Macro to know if the point are inside. I draw the item if the point is inside or on the contour of the polygon.

I often encounter strange results. Some points are considered on the contour of the polygon even they are not …

I did not find where the error or the bug is, it happens only with specific value.

I enclose a simplified version of the object with default values causing the problem …

Did someone or object of the official library use this macro for this purpose? Have you ever noticed this bad behavior ? Is there a way around this problem?

Thank you in advance,
SimPey.
3 REPLIES 3
psylo
Contributor
Example image
test polygon operation macro.jpg
Pertti Paasky
Expert
Try this:
Lines 41-42
! IF ret=1 OR ret=3 OR ret=4 THEN
IF ret=1 OR ret=4 THEN
Maybe ret=3 means that the point is on the line but not necessarily between the points.
Perhaps You should test it properly but it worked fine by me.
- AC-24 FIN - WIN 10 - HP Zbook -
“A winner is just a loser who tried one more time.”
George M. Moore, Jr.
psylo
Contributor
Hello !

I forgot to update this message with Graphisoft official response I got on the GDL forum (http://gdl.graphisoft.com/forums/topic/point-inside-a-polygon-using-polygon-operations-macro/).

You have well spotted the problem: the macro will not only find if a point is on a segment of the contour but also on the lines formed by the segments of the contour.

Too bad ! It looks like a bug to me but I do not think it will being fixed!

Thanks for your help.