/* This produces a bent rod in a vice that slowly closes. The ends of the rod are constrained to remain parallel to the vice faces. */ #include "Head.h" #include #define ln 13 #define poly 7 #define vice 1 /* ln=9, poly=5, leads to stretching and twisting and disintegration. */ /* The guts */ vert u[(poly+1)*(ln+1)]; simp s[3*poly*ln]; int n_vert=(poly+1)*(ln+1); link segs[2*poly*(ln+1) + poly*ln]; float mu[2] = {-.2, -.4}, lam[2] = {-.05, -.5}; typedef struct{short e[poly], cent;} slice; typedef struct{float c, s;} ur; ur cir[poly]; slice zb[(ln+1)]; int xq=0; double pi = 3.1415926535897932385; static slice cut(float q) {slice s; int j; float bend = vice?0.01*q*q:0.; for (j=0; j