Skip to content

Check for closed polygons is incorrect #3

@captbaritone

Description

@captbaritone

https://github.com/math-utils/area-polygon/blob/master/index.js#L7

Here we try check to see if the polygon ends where it begins, but because JavaScript compares object/arrays by reference, this comparison will return false even if the points of the head and tail of the polygon do match.

This does not pose a correctness issue, because adding the additional end point redundantly does not change the area of the polygon, but it is a bit wasteful/confusing.

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