issacszc

The function of Disjoint return 1

Discussion created by issacszc on Jul 26, 2010
Latest reply on Jul 26, 2010 by issacszc
I define a line and a polygon, and the line is within the polygon, but the function of Disjoint return 1.

My code is :

IPolylinePtr ipLine(CLSID_Polyline);
WKSPoint* pPoints = new WKSPoint[10];
pPoints[0].X = 407535.701637;
pPoints[0].Y = 83032.227084;
pPoints[1].X = 407535.806488;
pPoints[1].Y = 83031.968238;
pPoints[2].X = 407536.697724;
pPoints[2].Y = 83029.058616;
pPoints[3].X = 407537.816137;
pPoints[3].Y = 83025.502412;
pPoints[4].X = 407538.576309;
pPoints[4].Y = 83023.256848;
pPoints[5].X = 407539.371430;
pPoints[5].Y = 83021.378263;
pPoints[6].X = 407540.035488;
pPoints[6].Y = 83020.067623;
pPoints[7].X = 407541.494668;
pPoints[7].Y = 83017.271590;
pPoints[8].X = 407542.534443;
pPoints[8].Y = 83015.515332;
pPoints[9].X = 407543.654907;
pPoints[9].Y = 83013.813834;
IPointCollection4Ptr ipPointC4(ipLine);
hr = ipPointC4->AddWKSPoints(10, pPoints);

IPolygonPtr ipPolygon(CLSID_Polygon);
IRingPtr ipRing(CLSID_Ring);
WKSPoint* pPoints1 = new WKSPoint[5];
pPoints1[0].X = 407450;
pPoints1[0].Y = 82970;
pPoints1[1].X = 407450;
pPoints1[1].Y = 83030;
pPoints1[2].X = 407550;
pPoints1[2].Y = 83030;
pPoints1[3].X = 407550;
pPoints1[3].Y = 82970;
pPoints1[4].X = 407450;
pPoints1[4].Y = 82970;
IPointCollection4Ptr ipPointC(ipRing);
hr = ipPointC->AddWKSPoints(5, pPoints1);
IGeometryCollectionPtr ipGC(ipPolygon);
hr = ipGC->AddGeometry(ipRing);
hr = ipPolygon->SimplifyPreserveFromTo();

IRelationalOperatorPtr ipRR(ipLine);
VARIANT_BOOL vb;
hr = ipRR->Disjoint(ipPolygon, &vb); In theory, the line is not Disjoint with the polygon, but the function return 1,


Who know the reason of this error?

Outcomes