compas-dev / compas-dev/compas

`Polygon.normal` with `normal_polygon` instead of `normal_triangle`?

Open
#1,487 0 comments 1 reaction 1 assignee Assigned to @Copilot View on GitHub
Dominant language
Python
Stars
386
Forks
122
Avg merge
11d 46m
Merged PRs (30d)
1

Description

Currently, the polygon's normal is calculated as the normal of one of its triangles: `normal_triangle([polygon.centroid, polygon.points[0], polygon.points[1]])`. However, this is problematic when the polygon is simple but concave, because the first two points might be on the concave ears, as pointed out by the comments inside `polygon.plane`.

The `compas.geometry.normal_polygon` seem to offer a more robust method of calculating such normal, with O(n) instead of O(1) for calculating the normal.

Is it possible to incorporate such method into `polygon.normal`, since the code is already available in compas? Or let the user choose if they would sacrifice computation efficiency for more accurate handling with concave polygons?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.