Tinkertoy

Overview

This is a course project I did from CS 4496 computer animation class. In this project, I implemented a 2D particle-based constraint dynamic system with three different constraints: distance constraint, circle constraint, and a sine constraint.

Distance Constraint

For two points $p_1$, $p_2$, and the disired distance between them $d$, the constraint is $C(p_1,p_2) = \frac{1}{2}(p_1-p_2)^T(p_1-p_2)-\frac{1}{2}d^2$

Circle Constraint

For a point $p$, circle center $p_c$, and circle radius $r$, the constraint is $C(p) = \frac{1}{2}(p-p_c)^T(p-p_c)-\frac{1}{2}r^2$

Sine Constraint

For a point $p$, amplitude $A$, frequency $\omega$, and virtical offset $c$, the constraint is $C(p) = p_y-Asin(\omega p_x)+c$