1

使用 NetTopologySuite,这些表达式是错误的:

Point.Empty.Equals(Point.Empty); // false    
Polygon.Empty.Equals(Polygon.Empty); // false

调试表明此行为是由

    // Geometry
    public IntersectionMatrix Relate(IGeometry g)
    {        
        return RelateOp.Relate(this, g); // Point.Empty, Point.Empty
    }

    // IntersectionMatrix
    public bool IsEquals(Dimension dimensionOfGeometryA, Dimension dimensionOfGeometryB)
    {
        if (dimensionOfGeometryA != dimensionOfGeometryB)
            return false;

        return IsTrue(_matrix[(int)Location.Interior, (int)Location.Interior]) &&
               _matrix[(int)Location.Interior, (int)Location.Exterior] == Dimension.False &&
               _matrix[(int)Location.Boundary, (int)Location.Exterior] == Dimension.False &&
               _matrix[(int)Location.Exterior, (int)Location.Interior] == Dimension.False &&
               _matrix[(int)Location.Exterior, (int)Location.Boundary] == Dimension.False;
    }

我想知道这背后的原因是什么。据推测,这种行为也发生在相关库(jts、GEOS)中,我还假设地理代数内部人员知道这是有道理的。有人可以解释吗?

4

0 回答 0