Skip to content

Commit

Permalink
Fix typo in haussdorf -> hausdorff (#151)
Browse files Browse the repository at this point in the history
  • Loading branch information
chaitan94 committed May 26, 2020
1 parent 6b77583 commit 4799bfe
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions pygeos/measurement.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,9 @@ def length(geometry, **kwargs):


def hausdorff_distance(a, b, densify=None, **kwargs):
"""Compute the discrete Haussdorf distance between two geometries.
"""Compute the discrete Hausdorff distance between two geometries.
The Haussdorf distance is a measure of similarity: it is the greatest
The Hausdorff distance is a measure of similarity: it is the greatest
distance between any point in A and the closest point in B. The discrete
distance is an approximation of this metric: only vertices are considered.
The parameter 'densify' makes this approximation less coarse by splitting
Expand Down Expand Up @@ -173,7 +173,7 @@ def hausdorff_distance(a, b, densify=None, **kwargs):
if densify is None:
return lib.hausdorff_distance(a, b, **kwargs)
else:
return lib.haussdorf_distance_densify(a, b, densify, **kwargs)
return lib.hausdorff_distance_densify(a, b, densify, **kwargs)


@requires_geos("3.7.0")
Expand Down
12 changes: 6 additions & 6 deletions pygeos/test/test_measurement.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,28 +136,28 @@ def test_length_missing():
assert np.isnan(actual)


def test_haussdorf_distance():
def test_hausdorff_distance():
# example from GEOS docs
a = pygeos.linestrings([[0, 0], [100, 0], [10, 100], [10, 100]])
b = pygeos.linestrings([[0, 100], [0, 10], [80, 10]])
actual = pygeos.hausdorff_distance(a, b)
assert actual == pytest.approx(22.360679775, abs=1e-7)


def test_haussdorf_distance_densify():
def test_hausdorff_distance_densify():
# example from GEOS docs
a = pygeos.linestrings([[0, 0], [100, 0], [10, 100], [10, 100]])
b = pygeos.linestrings([[0, 100], [0, 10], [80, 10]])
actual = pygeos.hausdorff_distance(a, b, densify=0.001)
assert actual == pytest.approx(47.8, abs=0.1)


def test_haussdorf_distance_missing():
def test_hausdorff_distance_missing():
actual = pygeos.hausdorff_distance(point, None)
assert np.isnan(actual)


def test_haussdorf_densify_nan():
def test_hausdorff_densify_nan():
actual = pygeos.hausdorff_distance(point, point, densify=np.nan)
assert np.isnan(actual)

Expand All @@ -167,12 +167,12 @@ def test_distance_empty():
assert np.isnan(actual)


def test_haussdorf_distance_empty():
def test_hausdorff_distance_empty():
actual = pygeos.hausdorff_distance(point, empty)
assert np.isnan(actual)


def test_haussdorf_distance_densify_empty():
def test_hausdorff_distance_densify_empty():
actual = pygeos.hausdorff_distance(point, empty, densify=0.2)
assert np.isnan(actual)

Expand Down
8 changes: 4 additions & 4 deletions src/ufuncs.c
Original file line number Diff line number Diff line change
Expand Up @@ -705,8 +705,8 @@ static void equals_exact_func(char **args, npy_intp *dimensions,
static PyUFuncGenericFunction equals_exact_funcs[1] = {&equals_exact_func};


static char haussdorf_distance_densify_dtypes[4] = {NPY_OBJECT, NPY_OBJECT, NPY_DOUBLE, NPY_DOUBLE};
static void haussdorf_distance_densify_func(char **args, npy_intp *dimensions,
static char hausdorff_distance_densify_dtypes[4] = {NPY_OBJECT, NPY_OBJECT, NPY_DOUBLE, NPY_DOUBLE};
static void hausdorff_distance_densify_func(char **args, npy_intp *dimensions,
npy_intp *steps, void *data)
{
void *context_handle = geos_context[0];
Expand All @@ -730,7 +730,7 @@ static void haussdorf_distance_densify_func(char **args, npy_intp *dimensions,
}
}
}
static PyUFuncGenericFunction haussdorf_distance_densify_funcs[1] = {&haussdorf_distance_densify_func};
static PyUFuncGenericFunction hausdorff_distance_densify_funcs[1] = {&hausdorff_distance_densify_func};


static char frechet_distance_densify_dtypes[4] = {NPY_OBJECT, NPY_OBJECT, NPY_DOUBLE, NPY_DOUBLE};
Expand Down Expand Up @@ -1505,7 +1505,7 @@ int init_ufuncs(PyObject *m, PyObject *d)
DEFINE_CUSTOM (buffer, 7);
DEFINE_CUSTOM (snap, 3);
DEFINE_CUSTOM (equals_exact, 3);
DEFINE_CUSTOM (haussdorf_distance_densify, 3);
DEFINE_CUSTOM (hausdorff_distance_densify, 3);
DEFINE_CUSTOM (delaunay_triangles, 3);
DEFINE_CUSTOM (voronoi_polygons, 4);
DEFINE_CUSTOM (is_valid_reason, 1);
Expand Down

0 comments on commit 4799bfe

Please sign in to comment.