Please do not top-post. Zhang Qun wrote:
Hi Adam I think I have figured it out. Because of the precision, the two polygons are not the same.
That also explains that why sometimes the intersection() gives me two intersection points looking "exactly" the same but if you look at the double precision, they are actually two different points. In reality, these two points can be safely considered the same point. I can solve this by comparing the two points distance. However, sometimes also because of the precision, the intersection() does not even give me any intersection points especially when the line is right across the vertex of the polygon. How do I solve this kind of problem?
Could you paste the WKTs of geometries (with sufficient precision) [1] and say what do you get and what do you expect? [1] e.g. std::cout << std::setprecision(20) << bg::wkt(polygon) << std::endl; Adam