Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I have been unable to explain the behavior of Graphics`Mesh`ConvexHull[] on the following (highly simplified) example:

pts = {{-1/6, -1/18}, {-4/31, 1/9}, {-1/26, -12/73},
       {1/6, 2/37}, {1/26, 12/73}, {4/31, -1/9}};

Graphics`Mesh`MeshInit[];

idx = ConvexHull[pts];

idx2 = Most[First[FindCurvePath[pts]]];

GraphicsRow[{Graphics[Line[pts]], Graphics[Line[pts[[idx]]]], Graphics[Line[pts[[idx2]]]]}]

I get the following result on my system (version 8.0.4 on Linux, if it matters):

convex hull attempts on my points

As you can see, ConvexHull[] does not seem to work properly on my set of points, while FindCurvePath[] has no problem. However, I had wanted to use ConvexHull[] because it consistently orders points in an anticlockwise manner (or at the very least it seems to), while FindCurvePath[] sometimes orders points clockwise. I can break down and just implement the Graham scan myself, but I'd prefer to understand why the hidden convex hull routine is not behaving in the manner I expect.

share|improve this question
2  
Why are you bothering with Graphics`Mesh? –  m_goldberg Feb 26 '13 at 6:30
    
See my comment to your answer. –  Carlos Culo Feb 26 '13 at 6:31
1  
Is Graphics``Mesh documented somewhere? –  belisarius Feb 26 '13 at 12:12

1 Answer 1

I can not reproduce your problem. When I carry out the following evaluations

Needs@"ComputationalGeometry`"

GraphicsRow@{
  Graphics[Line@pts], 
  Graphics[Line@pts[[ConvexHull[pts]]]]}

I get

enter image description here

share|improve this answer
1  
As I mentioned in my post, I was using Graphics`Mesh`ConvexHull[] and not the implementation from the Computational Geometry package (I am aware of that, but due to a number of reasons, I prefer not to have to load a package)... –  Carlos Culo Feb 26 '13 at 6:30
    
@CarlosCulo. If that's the case, then you are probably stick with the behavior you observe. –  m_goldberg Feb 26 '13 at 7:12

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.