# Problem with PlanarGraphPlot And ConvexHull

I'm getting a lot of strange errors when using PlanarGraphPlot with a simple list of 11 points. This is using Mma 9.0.1 64-bit Mac OS X.

<< ComputationalGeometry;
x = {{184978.59580704456, 77909.66948289984},
{184978.27815712072,77909.76595227784},
{184978.27082673783, 77909.74177736834},
{184977.5543690799, 77909.95958192856},
{184977.65873976916, 77910.2913545858},
{184977.87393886593, 77910.32174601014},
{184978.3127146399, 77911.75682671613},
{184979.13720817852, 77911.37094455786},
{184979.40459261995, 77911.34308556134},
{184979.6157774594, 77912.04232488069},
{184980.40222282038, 77911.69604330455}};
PlanarGraphPlot[x]


Errors I get are

Mod::indet: Indeterminate expression Mod[-1,0] encountered. >>

Part::partw: Part 1 of {} does not exist. >>

Part::pspec: Part specification Indeterminate is neither a machine-sized integer nor a list of machine-sized integers. >>

Part::pspec: Part specification {{4,2},{1,4,6},{6},{7,2,1},{6,6},{2,5,6,3,5},{11,10,9,4},{},{7,10},{9,7,11},{10,7}}[[8,1]] is neither a machine-sized integer nor a list of machine-sized integers. >>

Part::pspec: Part specification {{4,2},{1,4,6},{6},{7,2,1},{6,6},{2,5,6,3,5},{11,10,9,4},{},{7,10},{9,7,11},{10,7}}[[8,1]] is neither a machine-sized integer nor a list of machine-sized integers. >>

General::stop: Further output of Part::pspec will be suppressed during this calculation. >>

Part::partw: Part 1 of {} does not exist. >>

Set::shape: Lists {ComputationalGeometryPrivatemerge$30945[[ComputationalGeometryPrivatel0$30945]],ComputationalGeometryPrivatemerge$30945[[ComputationalGeometryPrivater0$30945]]} and ComputationalGeometryPrivateinsert[{{4,2},{1,4,6},{6},{7,2,1},{6,6},{2,5,6,3,5},{11,10,9,4},{},{7,10},{9,7,11},{10,7}}[[{6,{{4,2},{1,4,6},{6},{7,2,1},{6,6},{2,5,6,3,5},{11,10,9,4},{},{7,10},{9,7,11},{10,7}}[[8,1]]}]],6,{{4,2},{1,4,6},{6},{7,2,1},{6,6},{2,<<3>>,5},<<1>>,{},{7,10},{9,7,11},{10,7}}[[<<1>>]],2,3] are not the same shape. >>

Mod::indet: Indeterminate expression Mod[-1,0] encountered. >>

Part::partw: Part 1 of {} does not exist. >>

General::stop: Further output of Part::partw will be suppressed during this calculation. >>

Set::shape: Lists {ComputationalGeometryPrivatemerge$33935[[ComputationalGeometryPrivatel0$33935]],ComputationalGeometryPrivatemerge$33935[[ComputationalGeometryPrivater0$33935]]} and ComputationalGeometryPrivateinsert[{{4,2},{1,4,6},{6},{7,2,1},{6,6},{2,5,6,3,5},{11,10,9,4},{},{7,10},{9,7,11},{10,7}}[[{6,{{4,2},{1,4,6},{6},{7,2,1},{6,6},{2,5,6,3,5},{11,10,9,4},{},{7,10},{9,7,11},{10,7}}[[8,1]]}]],6,{{4,2},{1,4,6},{6},{7,2,1},{6,6},{2,<<3>>,5},<<1>>,{},{7,10},{9,7,11},{10,7}}[[<<1>>]],2,3] are not the same shape. >>

Mod::indet: Indeterminate expression Mod[-1,0] encountered. >>

General::stop: Further output of Mod::indet will be suppressed during this calculation. >>

Set::shape: Lists {ComputationalGeometryPrivatemerge$35305[[ComputationalGeometryPrivatel0$35305]],ComputationalGeometryPrivatemerge$35305[[ComputationalGeometryPrivater0$35305]]} and ComputationalGeometryPrivateinsert[{{4,2},{1,4,6},{6},{7,2,1},{6,6},{2,5,6,3,5},{11,10,9,4},{},{7,10},{9,7,11},{10,7}}[[{6,{{4,2},{1,4,6},{6},{7,2,1},{6,6},{2,5,6,3,5},{11,10,9,4},{},{7,10},{9,7,11},{10,7}}[[8,1]]}]],6,{{4,2},{1,4,6},{6},{7,2,1},{6,6},{2,<<3>>,5},<<1>>,{},{7,10},{9,7,11},{10,7}}[[<<1>>]],2,3] are not the same shape. >>

General::stop: Further output of Set::shape will be suppressed during this calculation. >>


Removing certain points from the list (like the last one) causes the plot to succeed.

Also this set of points fails to give proper ConvexHull

y = {{1.8497859580704457, 0.7790966948289985},
{1.8497827815712071, 0.7790976595227784},
{1.8497827082673783, 0.7790974177736835},
{1.849775543690799, 0.7790995958192857},
{1.8497765873976917, 0.779102913545858},
{1.8497787393886593, 0.7791032174601015},
{1.849783127146399, 0.7791175682671613},
{1.8497913720817853, 0.7791137094455786},
{1.8497940459261994, 0.7791134308556135},
{1.849796157774594, 0.7791204232488069},
{1.849804022228204, 0.7791169604330455},
{1.849803552734635, 0.7791159289575218},
{1.8498057134522492, 0.7791151852825192},
{1.8498006729413692, 0.7790991813917657},
{1.8498002121744468, 0.7790984699581178},
{1.8497995890919037, 0.7790977401058187},
{1.8497986151981813, 0.7790973602143807},
{1.8497975924352397, 0.7790973993547065},
{1.8497955957785752, 0.77909842160827},
{1.8497951821355425, 0.7790997823117062},
{1.8497944840038416, 0.779101624213374},
{1.8497934996381435, 0.7791037516125543},
{1.8497920021456453, 0.779106194441444},
{1.849792775326504, 0.7791094914607818},
{1.8497897908134828, 0.7791098506337076}}
Graphics@Point@y[[ ConvexHull[y] ]]


Thanks

-
It looks like the number of points needs to be even. Add a point, or remove the last one, and the error goes away! You currently have in x 11 (odd) number of points. This is a guess based on trial and error. –  Nasser Apr 26 at 23:23
@Nasser This is not what I'm seeing. Removing last point works but removing second point doesn't. –  Kartik Apr 26 at 23:33
Yes, I see the same problem here also. Well, it was a guess any way. So there is a bug :) –  Nasser Apr 26 at 23:41
–  Nasser Apr 27 at 6:34

<< ComputationalGeometry

Thanks. That works nicely. Does my ConvexHull example have a similar problem? Translating that to the origin doesn't help. I get all the input points back from ConvexHull –  Kartik Apr 27 at 14:10
@Kartik For similar reasons p = 10^6 Transpose[Transpose@y - Mean[y]];convexHull = ConvexHull[p];PlanarGraphPlot[p, convexHull] –  belisarius Apr 27 at 17:44