relund / gMOIP

2D and 3D plots of linear/integer programming models in R
https://relund.github.io/gMOIP/
5 stars 2 forks source link

Does vertices argument to inHull() need to give a convex hull? #6

Closed scottkosty closed 3 years ago

scottkosty commented 3 years ago

The help for inHull() says the following:

vertices: A mxp array of vertices of the convex hull.

If vertices is not a convex hull, does inHull() then convert it to be a convex hull?

relund commented 3 years ago

Vertices define the convex hull but may contain redundant (non-vertex) points.

Doc updated

scottkosty commented 3 years ago

Thanks, the documentation is clear. If my goal is to check whether a point is in the convex hull of a set of vertices, is it faster to first use convexHull() and then take that result and call inHull()? The advantage of this is that there would be no redundant points in the call to inHull(). I can run tests to see myself, but I'm also curious about your recommendation.

relund commented 3 years ago

Most of the time the algorithm for finding the convex hull is called one time. So it should not make a difference. It would make a difference if you call the algorithm multiple times with different pts but the same hull.

scottkosty commented 3 years ago

Most of the time the algorithm for finding the convex hull is called one time. So it should not make a difference. It would make a difference if you call the algorithm multiple times with different pts but the same hull.

Thanks!