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

This topic contains 3 replies, has 3 voices, and was last updated by  Simon PEYRARD 1 year, 11 months ago.

  • 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
    Software Engineer, Library Team

  • #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 !

You must be logged in to reply to this topic.