1 2 3 #include "toonz/iknode.h" 4 5 TPointD DVAPI rotatePoint(TPointD &point, double theta); 6 7 // Compute the global position of a single node computeS(void)8void IKNode::computeS(void) { 9 IKNode *y = this->getParent(); 10 IKNode *w = this; 11 12 s = r; // Initialize to local (relative) position 13 14 while (y) { 15 s = rotatePoint(s, y->theta); 16 y = y->getParent(); 17 w = w->getParent(); 18 s += w->r; 19 m_pos = s; 20 } 21 } 22 setPurpose(Purpose purpose)23void IKNode::setPurpose(Purpose purpose) { m_purpose = purpose; } 24 rotatePoint(TPointD & point,double theta)25TPointD rotatePoint(TPointD &point, double theta) { 26 double costheta = cos(theta); 27 double sintheta = sin(theta); 28 double tempx = point.x * costheta - point.y * sintheta; 29 point.y = point.y * costheta + point.x * sintheta; 30 point.x = tempx; 31 return point; 32 } 33