A query utility meant to query along a cubic bezier curve. Generate accompanying curve at https://querycurve.com
Project description
QueryCurve
This tool allows you to invoke queries against a curve you've laid out at https://querycurve.com
Once you have a curve in the shape you'd like:
You'll get a resulting encoded curve that'll look like this:
2BLnMW-2BLnMW--KyjA--KyjA-0-KyjA-CaR6-XZAG-KyjA-TN1E-KyjA-KyjA-KyjA-CaR6-TN1E-8OI4-fxSK-KyjA
Time to query!
Installation from PyPi
$ pip install query-curve
Usage
from query_curve import query_encoded_curve
Querying with a dynamically loaded curve
If you are pulling your curve from a db or otherwise need it to be dynamic:
dynamically_loaded_curve = 'fxSK-fxSK-0-0-0-0-KyjA-0-KyjA-fxSK-fxSK-fxSK' # assume this was loaded from db
my_x_value = 0.35
# Gets the corresponding y value along the curve for a given x
result = query_encoded_curve(dynamically_loaded_curve, my_x_value)
Note: While decoding the curve is fast, repeatedly querying against the same curve can be optimized by preloading the curve. If you anticipate multiple queries against the same curve, consider using:
Querying with a preloaded or reused curve
If the curve you're using will be used to facilitate multiple queries, this alternative for querying will bypass the need to decode the curve on every query.
from query_curve import get_encoded_curve_query_function
fixed_curve = 'fxSK-fxSK-0-0-0-0-KyjA-0-KyjA-fxSK-fxSK-fxSK'
# Returns a function with a reference to the decoded curve
query_my_curve = get_encoded_curve_query_function(fixed_curve)
query_my_curve(0)
query_my_curve(0.5)
query_my_curve(0.37)
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 Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file query_curve-0.1.0.tar.gz.
File metadata
- Download URL: query_curve-0.1.0.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c5014aa2e53558fbb9114b2f725c4e2d4e161e788fbe80cab519b397656d4345
|
|
| MD5 |
f74d02506955dd6423d26bce00f25ef0
|
|
| BLAKE2b-256 |
f1eda5c67156d6c2765ef456b2dc4fd6136705560423165e3aff811bb2d80bdc
|
File details
Details for the file query_curve-0.1.0-py3-none-any.whl.
File metadata
- Download URL: query_curve-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1b622878c08013a4440e55a90e98faba0be801a8f5e08c134ff67c8e23b988e5
|
|
| MD5 |
bfa0689726be8978b0ea66701b35594a
|
|
| BLAKE2b-256 |
a1109f69f63098f6d68972ae6788e5627546e56967b2caa281ab0161b09fa430
|