Welcome to Curvetopia-Adobe, a project dedicated to bringing order and beauty to the world of 2D curves! This repository is a journey into identifying, regularizing, and beautifying various types of curves in 2D Euclidean space, with a focus on closed curves, symmetry, and curve completion techniques.
The mission of Curvetopia-Adobe is to develop a comprehensive process for identifying,regularizing, and beautifying curves, starting with simple shapes and progressing to more complex forms. The project is designed to work with curves represented by cubic Bézier curves and polylines, with outputs visualized in SVG format.
Identify and categorize regular shapes from a given set of curves:
- Straight Lines: Detect straight lines within the curve data.
- Circles and Ellipses: Identify circular shapes where all points are equidistant from a center or ellipses with two focal points.
- Rectangles and Rounded Rectangles: Distinguish between sharp-edged and rounded rectangles.
- Regular Polygons: Detect polygons with equal sides and angles.
- Star Shapes: Identify star-shaped curves with a central point and radial arms.
Focus on closed shapes and identify various types of symmetry, including reflection symmetry. The project aims to transform curves into sets of points and fit Bézier curves to points that exhibit symmetry.
Develop algorithms to naturally complete 2D curves that have gaps due to occlusion removal. The project explores different levels of shape occlusion:
- Fully Contained Shapes: One shape completely inside another.
- Partially Contained Shapes: Shapes that are connected but partially occluded.
- Disconnected Shapes: Curves that are fragmented due to occlusion.
To get started, clone this repository and use the provided Python scripts to read, process, and visualize curves. The scripts require numpy
and matplotlib
for processing and visualization, and svgwrite
and cairosvg
for rendering SVG outputs.
import numpy as np
def read_csv(csv_path):
np_path_XYs = np.genfromtxt(csv_path, delimiter=',')
# Additional processing code here...
def plot(paths_XYs):
fig, ax = plt.subplots(tight_layout=True, figsize=(8, 8))
# Visualization code here...
def polylines2svg(paths_XYs, svg_path):
# SVG conversion code here...
The repository includes examples for various scenarios:
- Isolated Curves: Single polylines representing simple shapes.
- Fragmented Shapes: Complex shapes built from multiple polylines.
- Occluded Shapes: Shapes with partial or complete occlusion requiring completion.
Regularization and symmetry are evaluated based on the number of regular geometric shapes and symmetry detected. For occlusion, rasterization techniques are used to ensure the correctness of curve completion.
Contributions are welcome! Please fork the repository and submit a pull request with your improvements or bug fixes.
This project is licensed under the MIT License - see the LICENSE file for details.
- Rishabh Mittal: GitHub Profile
- Pinak Gupta: GitHub Profile
- Mehak Singla: GitHub Profile