Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Isn't a triangle a polygon in masking? #757

Open
biochem-fan opened this issue Sep 17, 2024 · 2 comments
Open

Isn't a triangle a polygon in masking? #757

biochem-fan opened this issue Sep 17, 2024 · 2 comments
Labels

Comments

@biochem-fan
Copy link
Member

Our polygon masking code rejects polygons with 3 or less vertices.

void mask_untrusted_polygon(scitbx::af::ref<bool, scitbx::af::c_grid<2> > mask,
const scitbx::af::const_ref<vec2<double> > &polygon) {
DXTBX_ASSERT(polygon.size() > 3);

It makes sense to reject cases with one vertex (i.e. point) or two vertices (i.e. line) but why do we reject triangles?

Changing this to

DXTBX_ASSERT(polygon.size() >= 3); 

seems working but am I missing some corner cases?

@dagewa
Copy link
Member

dagewa commented Sep 30, 2024

Perhaps this was always meant to be >=? I can't think of any reason to reject a triangle

@biochem-fan
Copy link
Member Author

@dagewa Thanks for confirmation. I made a pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants