beizer-curves
A python library for generating beizer curves.
Installation
pip install beizer-curves
Usage
def beizer_curve(
points,
output_points_count: int,
destructive: bool = False,
dtype: np.dtype = np.int64,
):
Generate a beizer curve.
points- Knots in format:[[x1, x2, ..., xn], [y1, y2, ..., yn], [z1, z2, ..., zn]].output_points_count- How many points of the curve to generate.destructive- Allow function to modifypointsarray. Don't set to true, if you want to usepointsarray later.dtype- dtype of array of returned points of the curve.
Points of a curve are returned in format: [[x1, x2, ..., xn], [y1, y2, ..., yn], [z1, z2, ..., zn]], where n is output_points_count.
def random_beizer_curve(
start_point,
end_point,
output_points_count: int,
random_points_count: int = 1,
point_spread: float = 1,
noise_max_offset: float = 0,
noise_rate: float = 0.5,
dtype=np.int64,
return_forming_points: bool = False,
):
Generate a random beizer curve, which starts at start_point and ends at end_point.
-
start_point,end_point- coordinates of start and end points of curve in format[x, y, z, ...]. -
output_points_count- How many points of the curve to generate.if output_points_count < 0: output_points_count = math.ceil(distance / -output_points_count)
Where
distanceis distance between start and end. -
random_points_count- How many knots to generate. -
point_spread- A scale of a rectangular figure with corners of start_point and end_point, in bounds of which random knots are generated. Has to be > 0. -
noise_max_offset- Max offset of a curve point.if output_points_count < 0: output_points_count = math.ceil(distance / -output_points_count)
Where
distanceis distance between start and end. -
noise_rate- A part of curve points to apply noise offset to. Has to belong to [0; 1]. -
dtype- dtype array of returned points of the curve. -
return_forming_points-return points, curve if return_forming_points else curve, wherepointsare randomly generated knots
Usage example
import random
import matplotlib.pyplot as plt
import numpy as np
from beizer_curves import *
def plot_curve(points_count, i):
start = [random.randrange(1, 2000), random.randrange(1, 2000)]
noise = -200 * i
end = [random.randrange(1, 2000), random.randrange(1, 2000)]
points, curve = random_beizer_curve(
start,
end,
output_points_count=50,
random_points_count=points_count,
noise_max_offset=noise,
noise_rate=0.25,
dtype=np.float64,
return_forming_points=True,
)
fig = plt.figure()
plt.axis("equal")
plt.scatter(curve[0], curve[1])
plt.scatter(points[0], points[1], color='red')
fig.savefig(f"example_{points_count}_{i + 1}.png")
Example curves
Metadata
Release files for beizer-curves 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| beizer-curves-0.0.1.tar.gz | 3.9 kB | Without provenance | Details for beizer-curves-0.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| beizer_curves-0.0.1-py3-none-any.whl | Python 3 | none | any | Details for beizer_curves-0.0.1-py3-none-any.whl |
Total release size: 8.3 kB
Release files / beizer-curves-0.0.1.tar.gz
| Download URL | beizer-curves-0.0.1.tar.gz |
|---|---|
| Size | 3.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
94513afe165b6d709c05ee3283eb02ce94686fac3c351bd4a83e1c4923dd455e
|
|
BLAKE2b-256 checksum How to use checksums |
aafc632abd72e8336b51628d3f7336957ab6f3ca2e0f281f3a1c3add25063944
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
|
Release files / beizer_curves-0.0.1-py3-none-any.whl
| Download URL | beizer_curves-0.0.1-py3-none-any.whl |
|---|---|
| Size | 4.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
425ef9ba984e494f2fbd040a34adff7674532316cce219376b4c116713ee5db4
|
|
BLAKE2b-256 checksum How to use checksums |
005885ba3ae1189daac9982e87decabe87e630beb03c970214b750acce6a3156
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
|
Security for beizer-curves 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.