Skip to content

Prakharprasun/CAD

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CAD — Parametric Curve Theory & Implementation

Interactive Jupyter notebooks exploring parametric curve fundamentals used in Computer-Aided Design, implemented from scratch with PyTorch and Matplotlib.

Notebooks

A deep-dive into Bézier curves covering three equivalent formulations:

Section Description
Bernstein Polynomial Form Constructs curves via weighted sums of Bernstein basis polynomials using binomial coefficients. Explains the relationship between control point count and curve degree.
De Casteljau's Algorithm Builds the same curve through recursive linear interpolation (lerp). Numerically stable and widely used in shaders and animation engines.
Matrix Bézier Form Expresses the curve as P(t) = T · M · G using the Bézier basis matrix. Discusses basis equivalence with Hermite curves, linear mapping of constraints, and geometric continuity.

Implementation of cubic Hermite curves using the matrix form P(t) = T · M · G, where:

  • G — Geometry matrix: two endpoints (P0, P1) and two tangent vectors (T0, T1)
  • M — Hermite basis matrix (4×4)
  • T — Parameter power vector [t³, t², t, 1]

Includes derivation of the basis matrix and visualization of the resulting curve with control points.

(Work in progress)

Tech Stack

  • Python 3.12
  • PyTorch — tensor operations and linear algebra
  • Matplotlib — curve and control point visualization

Getting Started

# Clone the repo
git clone https://github.com/prakharprasun/CAD.git
cd CAD

# Install dependencies
pip install torch matplotlib

# Launch notebooks
jupyter notebook

License

MIT © 2026 Prakhar Prasun

About

Interactive Jupyter notebooks exploring parametric curve fundamentals used in Computer-Aided Design, implemented from scratch with PyTorch and Matplotlib.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors