I tested "Intersect" from ITopologicalOperator, and found out that the result was not precision.
My test is very simple. I created two polylines, each of which had two vertices:
the first polyline: (0,0) and (1,1)
the second polyline: (0,1) and (1,0)
When I used the "intersect" function of ITopologicalOperator, I got an intersection, whose coordinates were 0.50000190734863281, 0.50000190734863281, which are not precision.
Does anybody know why? It's better to get a more precision result.
Thank you very much!
Below are my codes:
object Missing = Type.Missing;
IPointCollection pCol1 = new PolylineClass();
IPoint ipt1 = new PointClass(); ipt1.PutCoords(0, 0);
IPoint ipt2 = new PointClass(); ipt2.PutCoords(1, 1);
pCol1.AddPoint(ipt1, ref Missing, ref Missing);
pCol1.AddPoint(ipt2, ref Missing, ref Missing);
IPolyline ipl1=pCol1 as IPolyline ;
IPointCollection pCol2 = new PolylineClass();
IPoint ipt3 = new PointClass(); ipt3.PutCoords(0, 1);
IPoint ipt4 = new PointClass(); ipt4.PutCoords(1, 0);
pCol2.AddPoint(ipt3, ref Missing, ref Missing);
pCol2.AddPoint(ipt4, ref Missing, ref Missing);
IPolyline ipl2=pCol2 as IPolyline ;
ITopologicalOperator pTop = ipl1 as ITopologicalOperator;
IGeometry pGeoIntersect = pTop.Intersect(ipl2, esriGeometryDimension.esriGeometry0Dimension);
IPointCollection pColIntersect = pGeoIntersect as IPointCollection;
for (int j = 0; j < pColIntersect.PointCount; j++)
{
double dblx = pColIntersect.get_Point(j).X;
double dbly = pColIntersect.get_Point(j).Y;
}
My test is very simple. I created two polylines, each of which had two vertices:
the first polyline: (0,0) and (1,1)
the second polyline: (0,1) and (1,0)
When I used the "intersect" function of ITopologicalOperator, I got an intersection, whose coordinates were 0.50000190734863281, 0.50000190734863281, which are not precision.
Does anybody know why? It's better to get a more precision result.
Thank you very much!
Below are my codes:
object Missing = Type.Missing;
IPointCollection pCol1 = new PolylineClass();
IPoint ipt1 = new PointClass(); ipt1.PutCoords(0, 0);
IPoint ipt2 = new PointClass(); ipt2.PutCoords(1, 1);
pCol1.AddPoint(ipt1, ref Missing, ref Missing);
pCol1.AddPoint(ipt2, ref Missing, ref Missing);
IPolyline ipl1=pCol1 as IPolyline ;
IPointCollection pCol2 = new PolylineClass();
IPoint ipt3 = new PointClass(); ipt3.PutCoords(0, 1);
IPoint ipt4 = new PointClass(); ipt4.PutCoords(1, 0);
pCol2.AddPoint(ipt3, ref Missing, ref Missing);
pCol2.AddPoint(ipt4, ref Missing, ref Missing);
IPolyline ipl2=pCol2 as IPolyline ;
ITopologicalOperator pTop = ipl1 as ITopologicalOperator;
IGeometry pGeoIntersect = pTop.Intersect(ipl2, esriGeometryDimension.esriGeometry0Dimension);
IPointCollection pColIntersect = pGeoIntersect as IPointCollection;
for (int j = 0; j < pColIntersect.PointCount; j++)
{
double dblx = pColIntersect.get_Point(j).X;
double dbly = pColIntersect.get_Point(j).Y;
}