Skip to content

Function contains in class math.geom2d.polygon.SimplePolygon2D. #9

Closed
@smallwood-d

Description

@smallwood-d

Hello,
I would appreciate your help understanding the contains function in simplePolygon2D.
The return statement check if the area is larger than zero (according to your explanation checking if the polygon is clockwise or counter-clockwise) and then re-check with the winding number of the polygon.
return area > 0.0D?winding == 1:winding==0;

  1. If the winding number of a simple polygon is zero does it mean the point don’t contained in the polygon?
  2. I get unexpected result with this input :
  • Polygon:
    • (34.85738, 32.283905)
    • (34.85825, 32.294194999999995)
    • (34.88468, 32.29320499999999)
    • (34.88303, 32.283125)
    • (34.85738, 32.283905)
  • Point :
    • (34.870909999999995, 32.289199999999994)
  • Area :
    • -2.6633249990482E-4
  • Winding numer :
    • -1

Thank you very much.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions