37 #define VuoPoint2d_SUPPORTS_COMPARISON
60 return (VuoPoint2d){x, y};
88 return (a.x*a.x + a.y*a.y);
106 if (fabs(a.x) < 0.000001)
107 a.x = copysign(0.000001, a.x);
108 if (fabs(a.y) < 0.000001)
109 a.y = copysign(0.000001, a.y);
119 return sqrtf(a.x*a.x + a.y*a.y);
128 return a / sqrtf(a.x * a.x + a.y * a.y);
146 return u.x*v.x+u.y*v.y;
155 return sqrtf( (a.x-b.x)*(a.x-b.x) + (a.y-b.y)*(a.y-b.y) );
164 return a * (1 - t) + b * t;
182 (float)
VuoReal_spring(timeSinceDrop, dropPosition.x, restingPosition.x, period, damping),
183 (float)
VuoReal_spring(timeSinceDrop, dropPosition.y, restingPosition.y, period, damping)
201 static inline VuoPoint2d
VuoPoint2d_clampn(VuoPoint2d point, VuoPoint2d limitA, VuoPoint2d limitB)
220 return (VuoPoint2d) {
229 static inline VuoPoint2d
VuoPoint2d_snap(VuoPoint2d a, VuoPoint2d center, VuoPoint2d snap)
232 return (VuoPoint2d) {
233 center.x + nonzeroSnap.x * (int)round( (a.x-center.x) / nonzeroSnap.x ),
234 center.y + nonzeroSnap.y * (
int)round( (a.y-center.y) / nonzeroSnap.y )