koi2000 commented on code in PR #48695: URL: https://github.com/apache/doris/pull/48695#discussion_r1992873068
########## be/src/geo/geo_types.cpp: ########## @@ -476,6 +656,156 @@ std::string GeoPolygon::as_wkt() const { return ss.str(); } +bool GeoPolygon::intersects(const GeoShape* rhs) const { + switch (rhs->type()) { + case GEO_SHAPE_POINT: { + const GeoPoint* point = (const GeoPoint*)rhs; + // 1. when polygon contain the point return true + if (_polygon->Contains(*point->point())) { + return true; + } + // 2. calculate the distance between the point and the closest point on the boundary + S2Point closest_point = _polygon->ProjectToBoundary(*point->point()); + S1Angle distance(closest_point, *point->point()); + return distance.radians() < 1e-2; + } + case GEO_SHAPE_LINE_STRING: { + const GeoLine* line = (const GeoLine*)rhs; + // Review Comment: fixed -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org