Skip to main content

Interactive Bezier Curve Editor with Streamlit

Project description

Bezier Curve Editor

An interactive application for creating, manipulating, and comparing multiple Bezier curves.

🔗 Try the live demo

Bezier Curve Editor Screenshot

Features

  • Display multiple predefined curves simultaneously
  • Fine adjustment of curve parameters with small steps
  • Color selection for each curve
  • JSON import/export functionality
  • CSV data export for all visible curves
  • Organized UI with intuitive tab structure

Installation

From PyPI (recommended)

pip install bezier-editor

From Source

  1. Clone the repository
git clone https://github.com/yourusername/bezier-editor.git
cd bezier-editor
  1. Install the package
pip install -e .

Usage

Launch the application

bezier-editor

Or if installed from source:

streamlit run bezier_editor/app.py

Basic UI Overview

The application is divided into two main sections:

  1. Control Panel (Left): Adjust parameters for each curve

    • Key Points: Set the start, peak, and end positions
    • Control Points: Fine-tune the curve shape
    • Appearance: Change colors and visualization options
  2. Visualization (Right): Interactive graph showing all curves

    • Display multiple curves simultaneously
    • Show/hide control points and handles
    • Export data as CSV

Working with Curves

  • Select a curve to edit from the dropdown menu
  • Use slider controls for quick adjustments or number inputs for precise values
  • Toggle visibility of individual curves using the checkboxes
  • Export your creations to JSON for future use or sharing

Using as a Library

The bezier-editor package can also be used as a library in your own Python scripts. Here's how to import and use its main functionalities:

# Import core mathematical functions
from bezier_editor.core.bezier import cubic_bezier, generate_controlled_curve, create_simple_bezier_curve

# Get predefined configurations
from bezier_editor.core.presets import get_presets, ensure_float

# Use input/output functions
from bezier_editor.io.file_operations import prepare_curves_for_csv_export

# Example: create and calculate a curve
presets = get_presets()
curve_config = presets['Curve 1']

# Create a simple Bezier curve
key_points, control_points = create_simple_bezier_curve(
    curve_config['x0'], 
    curve_config['x1'], 
    curve_config['x2'], 
    curve_config['max_y'], 
    curve_config['control_config']
)

# Generate points on the curve
x_points, y_points = generate_controlled_curve(key_points, control_points, num_points=500)

# Use the points for visualization, analysis, or export
import matplotlib.pyplot as plt
plt.plot(x_points, y_points)
plt.show()

Development

Project Structure

bezier-editor/
├── bezier_editor/
│   ├── core/         # Mathematical functions
│   ├── io/           # File operations
│   ├── ui/           # User interface components
│   └── app.py        # Main application
├── tests/            # Unit tests
└── examples/         # Example configurations

Running Tests

pytest

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bezier_editor-0.1.1.post1.tar.gz (13.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bezier_editor-0.1.1.post1-py3-none-any.whl (16.7 kB view details)

Uploaded Python 3

File details

Details for the file bezier_editor-0.1.1.post1.tar.gz.

File metadata

  • Download URL: bezier_editor-0.1.1.post1.tar.gz
  • Upload date:
  • Size: 13.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.7

File hashes

Hashes for bezier_editor-0.1.1.post1.tar.gz
Algorithm Hash digest
SHA256 9f201d76c01e2306ccd4126af649d00511f284ec550bc18065e4260e46482d92
MD5 aeca1351a690f7adae8c7af792141cd2
BLAKE2b-256 660871f6810a0235cf7374282f45a7d8c18a011fb02e295d025ac73ad0cde352

See more details on using hashes here.

File details

Details for the file bezier_editor-0.1.1.post1-py3-none-any.whl.

File metadata

File hashes

Hashes for bezier_editor-0.1.1.post1-py3-none-any.whl
Algorithm Hash digest
SHA256 805c6aa11b4a4367e588c59c9431464e2ad0582c37c81250dda8c9a63ed09c61
MD5 21033ad1eaf69e7f70d0c478a8906a7e
BLAKE2b-256 6b2a3744a4efd23463ee050251129e0ba0163a3092ce1501aa9928df8e267085

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page