Point inside a polygon using Polygon Operations Macro

Home Forums Problems and solutions in GDL GDL add-ons Point inside a polygon using Polygon Operations Macro

Viewing 3 reply threads
  • Author
    • #2483
      Simon PEYRARD

      Hi !

      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 via the Polygon Operations Macro to know if the point is inside and I draw the item if it is inside.

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

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

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


    • #2492
      Simon PEYRARD

      This forum does not seem very active but perhaps it lacked a question to my previous post …

      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,

    • #2593
      Péter Baksa

      Hi SimPey,

      The macro you are calling returns “On edge” status for points that lie on the line of the edge, even if they are outside the start-end segment. You could check in your code if that is the case.
      The official library doesn’t use this macro with the OPERATION_POINT_INSIDE_POLYGON parameter.

      Péter Baksa
      Library Platform, Software Engineer

    • #2594
      Simon PEYRARD

      Hi Peter,

      Thank you for your answer, I was losing hope !

      You give me a good line of research, I had not noticed that the unwanted items were located on the extensions of segments.

      Unfortunately, my final object will not only have 3 segments, I do not know yet how to get out. Perhaps, I may do this by writing a function to determine if an item is on a segment.

      Thanks for your help !

Viewing 3 reply threads
  • The forum ‘GDL add-ons’ is closed to new topics and replies.