Skip to main content

Python library to create 3D mesh from a 2D curve by revolving.

Project description

Python application Upload Python Package Python package

curve2mesh

Overview

curve2mesh is a Python module designed for generating 3D meshes from 2D curves. This module simplifies the process of revolving a 2D curve around the Z-axis to create a 3D mesh. It is optimized for performance with NumPy, but also works with standard Python math operations when NumPy is not available.

Features

  • Ease of Use: Simple interface for revolving 2D curves.

  • Performance: Optimized with NumPy for efficient computation.

  • Fallback Compatibility: Works with standard Python math operations in the absence of NumPy.

  • Flexible: Suitable for a wide range of applications in graphics, modeling, and educational purposes.

Installation

To install curve2mesh, simply run the following command:

pip install curve2mesh

Or Install directly from Github using

pip install git+https://github.com/ckesanapalli/curve2mesh

Note: NumPy is an optional dependency but is recommended for performance enhancement.

Usage

Here's a basic example of how to use curve2mesh:

from curve2mesh import revolve_curve
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d.art3d import Poly3DCollection

# Sample 2D curve coordinates
x = np.linspace(0, 1, 100)
z = x ** 2  # Example curve (parabola)

# Revolve the curve
angle_count = 50
faces = revolve_curve(x, z, angle_count, revolve_angle=2*np.pi)

# Plotting
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.add_collection3d(Poly3DCollection(faces, facecolors='g', linewidths=1, alpha=0.5))
ax.set_xlim(-x.max(), x.max())
ax.set_ylim(-x.max(), x.max())
ax.set_zlim(z.min(), z.max())
plt.show()

asdas

Requirements

  • Python 3.7+
  • NumPy (optional but recommended)

Contributing

Contributions to curve2mesh are welcome! Please read our Contributing Guidelines for details on how to submit pull requests, bug reports, and feature requests.

License

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

Authors

Chaitanya Kesanapalli

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

curve2mesh-0.1.4.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

curve2mesh-0.1.4-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file curve2mesh-0.1.4.tar.gz.

File metadata

  • Download URL: curve2mesh-0.1.4.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for curve2mesh-0.1.4.tar.gz
Algorithm Hash digest
SHA256 e8065f3de9ca46e9fd3d3ad46ec6026e81b5a62e21d86432211fe6e08fa8924e
MD5 4cacba70e18785367af565c165ba1c17
BLAKE2b-256 75c9935dfdbc3bb61b8058fb0b0e3c2c6f57c29446bccba137716ecae5a751ac

See more details on using hashes here.

File details

Details for the file curve2mesh-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: curve2mesh-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for curve2mesh-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 7b6ecb75277e4f21a2889cf851538513dcaac9a7a905fb7ba09ff6156cc6ef3c
MD5 aeb4f08b3c25fa67256d5b2c9b7756ff
BLAKE2b-256 673ce948d69e8321fbd6f5e030fff550a2e7e6bd819acb0864b457832b2aa8b2

See more details on using hashes here.

Supported by

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