Download src/geometry.py from upstage/dp-bench: direct link, hf CLI and curl.
- Browser
- Download file 300 Bytes
-
https://huggingface.co/datasets/upstage/dp-bench/resolve/main/src/geometry.py
- Command line
-
hf download hf://datasets/upstage/dp-bench/src/geometry.py
-
curl -L -o geometry.py https://huggingface.co/datasets/upstage/dp-bench/resolve/main/src/geometry.py
300 Bytes
| from shapely.geometry import Polygon | |
| from shapely import affinity | |
| def is_included(points_0, points_1, soft=0.2): | |
| polygon_0 = Polygon(points_0) | |
| polygon_1 = Polygon(points_1) | |
| polygon_1 = affinity.scale(polygon_1, xfact=1. - soft, yfact=1. - soft) | |
| return polygon_0.contains(polygon_1) | |