Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typo in haussdorf -> hausdorff #151

Merged
merged 1 commit into from
May 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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