## A GraphicsMeshConvexHull[] peculiarity

4

1

I have been unable to explain the behavior of GraphicsMeshConvexHull[] 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}};

GraphicsMeshMeshInit[];

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):

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.

2Why are you bothering with Graphics\Mesh? – m_goldberg – 2013-02-26T06:30:57.423

See my comment to your answer. – Carlos Culo – 2013-02-26T06:31:52.133

1Is GraphicsMesh documented somewhere? – Dr. belisarius – 2013-02-26T12:12:25.520

## Answers

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

1As I mentioned in my post, I was using GraphicsMeshConvexHull[] 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 – 2013-02-26T06:30:38.733

@CarlosCulo. If that's the case, then you are probably stick with the behavior you observe. – m_goldberg – 2013-02-26T07:12:37.200