Skip to content

Conversation

@Akash504-ai
Copy link

This PR fixes the return value semantics of HPolytope::is_in().

Currently, is_in() returns -1 for points that are inside the polytope and
0 for points that are outside. While this works for explicit comparisons
(e.g. is_in(p) == 0), it breaks natural boolean-style usage of the function,
such as if (is_in(p)), and can lead to silent logic errors.

This change updates the function to return a positive value (1) for inside
points, while preserving 0 for outside points. The function signature and
overall API remain unchanged, ensuring backward compatibility.

The fix restores expected predicate semantics without affecting existing code
that relies on explicit comparisons.

Closes #385

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HPolytope::is_in returns -1 for inside points

1 participant