Python implementation of "An efficiently computable metric for comparing polygonal shapes" (Arkin et al.)
Project description
Turning Function
This module contains Python bindings to a C-implementation of "An efficiently computable metric for comparing polygonal shapes" (Arkin et al., 1991).
Installation
pip install turning_function
Usage
Call turning_function.distance(shape_a, shape_b, brute_force_updates=False)
where shape_a
/shape_b
are Nx2-shaped lists of points (not numpy arrays). This function will return four values: distance, theta, ht_err, slope_err
. The error terms will be zero if brute_force_updates
is False
. Note that there is a maximum number of points (turning_function.max_points
) a shape can hold.
import turning_function
import random
def random_shape(num_points: int):
return [(random.random(), random.random()) for _ in range(num_points)]
shape_a = random_shape(turning_function.max_points)
shape_b = random_shape(42)
distance, theta, ht_err, slope_err = turning_function.distance(shape_a, shape_b, brute_force_updates=False)
print('Distance: ', distance)
License
The original source has this disclaimer:
Implementation (c) Eugene K. Ressler 91, 92 This source may be freely distributed and used for non-commercial purposes, so long as this comment is attached to any code copied or derived from it.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Hashes for turning_function-0.0.3-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e1944f92927fbd5f83b78421bc4838bca8928204ebd51c2a6f159e257c809ea6 |
|
MD5 | 297866ffb79334c301b7324c33639491 |
|
BLAKE2b-256 | f993251787b64604da3af0b67e025889992fd0bcbb115b2dbfad97d4e5584de5 |
Hashes for turning_function-0.0.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5e6a4b0bc3974ca8db26a067952c91e4a942b19fc0df7ea873af210c10e68115 |
|
MD5 | 52b447d7789f1bab40ff8c9bdb903b6b |
|
BLAKE2b-256 | b6125225fd2096486a2f2dc86a3b86ca4a1a850ca98c0542ffd1e1b6e76009f2 |
Hashes for turning_function-0.0.3-cp310-cp310-macosx_10_15_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ad71081de8c0288eb63476dafdb5db6eff8230fdb4d51f264bc4e8f26b767809 |
|
MD5 | cfa50673075eb0e30c2b23281d6fa4e4 |
|
BLAKE2b-256 | f384d0654625dfd7caa996f03da0592ae7658709e900fe0fcc3fc0b5e06de95e |
Hashes for turning_function-0.0.3-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 507145a6f2ea016fb0382f69914bbd7937a37623aee94cf5e08ea6448f8276f2 |
|
MD5 | b8a4a0bc73de6cfe5f53233a72a4960f |
|
BLAKE2b-256 | d5ff51f9cefe1b040b516692b137c9c3b718b134c5b6179b2db8ea5d2250233a |
Hashes for turning_function-0.0.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fea1175b16ef3d73465a329c0f408187a8d335ad42d7e50b10fe79a71a6c9d09 |
|
MD5 | 110b9d7c48b6c98aa7283843933a6f8b |
|
BLAKE2b-256 | 904fa565328fa889c00f7a67395e511bd0e7eec2fb8952653c3b304752849bc4 |
Hashes for turning_function-0.0.3-cp39-cp39-macosx_10_15_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aa11d3b75d3e88b13f0db3c56db66d1d6d46d7c67ef990dafb84eeede84a2ed2 |
|
MD5 | 0cd03d156acd4668687cb5f013438518 |
|
BLAKE2b-256 | c4183aeb1fc7c63f8a17c88cc7134319cd722fb328b54630597aec7ffa4e3ed5 |
Hashes for turning_function-0.0.3-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c6c5f85c94fed6eaba87fcf5d4b18f86c3f07ee255ea5e1142a78865e4ee1143 |
|
MD5 | ca8194538c80aefcbed94554c4e0c20a |
|
BLAKE2b-256 | a70d83cf13d50be8cade167877dbadb49635585eda2b0bb6320e62540a6c25be |
Hashes for turning_function-0.0.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 436ca8048743d4b478c49b68c780eeca4d8d9e7cd32025fee2697dfddf542b26 |
|
MD5 | f28f87ffadb36b216a8c159cfdbf4c5a |
|
BLAKE2b-256 | 9c6cb655040c0e02d6dfade1a2f7aecd62328fe94a11667ec160fbacf269155c |
Hashes for turning_function-0.0.3-cp38-cp38-macosx_10_15_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 862dab9e6c019971f8f42627e869a190e2447970f19123fc02ca1052306ca300 |
|
MD5 | 2e3676c0a36d0c9dbb8c87d8cbc0e5c1 |
|
BLAKE2b-256 | 91c8a2c6c89cf3d2eecade584b1601adc5f6333ce4d74d01ecbfaf41a2442cbc |
Hashes for turning_function-0.0.3-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 54d3cd6d428a2d9359504a120b638f2cd27d6eae8022c3b126e577ab73ec7ed9 |
|
MD5 | 436c9ad38de058cd30dedab84b9ca666 |
|
BLAKE2b-256 | 9396d0debca80cabdf8417f5ced25d5329f6122c81122ba250a110b995001683 |
Hashes for turning_function-0.0.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 233087b2f4b9d5b896c468db09f1bc575f16d6f84b14b8f70566e6e2f9b80c97 |
|
MD5 | 45494019898567efc0745d72c733dcaa |
|
BLAKE2b-256 | 6b0ebb3aaee676696f215aed939688f320b148d1316fd129d6d4eae1e9b8f3b5 |
Hashes for turning_function-0.0.3-cp37-cp37m-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9d0436b10811c663253281353cc22b771b7e49e8cdb15487fe496dad8cb67014 |
|
MD5 | e2af40c729a6c5e3b399a64c4158e32b |
|
BLAKE2b-256 | 7895c2e00e56fbbc8ae8bad8ca1a6d6846a2f6b70233b60f6f90cb57a5d6f554 |