Skip to content

Point in polygon algorithm creates spurious lines #48

@danielwboyce

Description

@danielwboyce

Discovered at the end of fixing NanoComp/meep#864. The version of node_in_or_on_polygon (in geom.c) that was added with commit da42dcf creates small lines in polygons that shouldn't be there. For example, in these images show the error (with the correct form of the polygon on the left and the incorrect on the right):

random2opt_128_8

reg_polygon_12_sides

More examples of this error can be seen in this imgur gallery. The lines only seem to form to the left of a vertex in the polygon. The even-odd algorithm that was used (from this paper) accounts for this sort of problem, and running through the algorithm on paper with problematic polygons doesn't show the lines appearing. Perhaps the occurrence of the lines is caused by a floating-point problem?

This problem could potentially be addressed by using a winding number algorithm instead of an even-odd algorithm.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions