ST_FrechetDistance — 두 도형 사이의 3차원 최단(shortest) 라인을 반환합니다.
float ST_FrechetDistance(
geometry g1, geometry g2, float densifyFrac = -1)
;
Implements algorithm for computing the Fréchet distance restricted to discrete points for both geometries, based on Computing Discrete Fréchet Distance. The Fréchet distance is a measure of similarity between curves that takes into account the location and ordering of the points along the curves. Therefore it is often better than the Hausdorff distance.
When the optional densifyFrac is specified, this function performs a segment densification before computing the discrete Fréchet distance. The densifyFrac parameter sets the fraction by which to densify each segment. Each segment will be split into a number of equal-length subsegments, whose fraction of the total length is closest to the given fraction.
Units are in the units of the spatial reference system of the geometries.
현재 구현된 함수는 불연속 위치로 꼭짓점만 지원합니다. 이를 임의 밀도의 포인트들을 사용할 수 있도록 확장할 수 있습니다. |
The smaller densifyFrac we specify, the more acurate Fréchet distance we get. But, the computation time and the memory usage increase with the square of the number of subsegments. |
GEOS 모듈로 실행
Availability: 2.4.0 - requires GEOS >= 3.7.0
postgres=# SELECT st_frechetdistance('LINESTRING (0 0, 100 0)'::geometry, 'LINESTRING (0 0, 50 50, 100 0)'::geometry); st_frechetdistance -------------------- 70.7106781186548 (1 row)
SELECT st_frechetdistance('LINESTRING (0 0, 100 0)'::geometry, 'LINESTRING (0 0, 50 50, 100 0)'::geometry, 0.5); st_frechetdistance -------------------- 50 (1 row)