+/* The square root in the distance computation for the string and
+ * stick constraints can be aproximated using Newton:
+ *
+ * distance =
+ * (model->sticks[i].length +
+ * (dx * dx + dy * dy) / model->sticks[i].length) / 2;
+ *
+ * This works really well, since the constraints aren't typically
+ * violated much. Thus, the distance is really close to the stick
+ * length, which then makes a good initial guess. However, the
+ * approximation seems to be slower that just calling sqrt()...
+ */
+
+static inline double
+estimate_distance (double dx, double dy, double r)
+{
+#ifdef APPROXIMATE_SQUARE_ROOTS
+ return (r + (dx * dx + dy * dy) / r) / 2;
+#else
+ return sqrt (dx * dx + dy * dy);
+#endif
+}
+