* is nonnegative. We add epsilon to |AxB| to avoid division
* by zero.
*
+ * r
+ * cost = delta
+ * Q,e
+ *
* Normalisation:
*
- * We want the answer to remain unchanged when the vertices lie
- * on circles. Interposing M and N so that we have P-M-Q-N-R
+ * We want the minimum energy to remain unchanged with changes in
+ * triangle densitiy, when the vertices lie evenly spaced on
+ * circles, and we do this by normalising the force ie the
+ * derivative of the energy with respect to linear motions of the
+ * vertices.
+ *
+ * We consider only the force on Q due to PQR, wlog. (Forces on
+ * P qnd R due to PQR are equal and opposite so normalising
+ * forces on Q will normalise them too.)
+ *
+ * Force on Q is in the plnae PQR and normal to PR, so we can
+ * consider it only linearly in that dimension. WLOG let that be
+ * the x dimension. So with f' representing df'/dx_Q:
+ *
+ * , d
+ * F = cost = --
+ * Q,e Q,e err looks like we can only do
+ * this if we make some kind of
+ * assumption about delta or
+ * something give up
+ *
+ *
+ * Interposing M and N so that we have P-M-Q-N-R
* generates half as much delta for each vertex. So
*
- * , -1
+
+ In that case the force on Q
+ * due to PQR
+ *
+ *Normalising for equal linear
+ * forces:
+ *
+ * d
+ * linear force on Q due to e = ------- cost
+ * d coord Q,e
+ * Q
+ *
+ * (we will consider only one e and one coord and hope
+ * that doesn't lead us astray.)
+ *
+ *
+ * , -r
* cost = D . cost
* Q,e Q,e
*
* where D is the linear density.
*
- * , -1
+ * , -r
* Sigma cost = N . D . Sigma cost
* Q,e Q,e Q,e Q,e
*
- *
- */
+ * */
double line_bending_adjcost(const Vertices vertices) {
static const double axb_epsilon= 1e-6;
/*---------- edge length variation ----------*/
+ /*
+ * Definition:
+ *
+ * See the diagram above.
+ *
+ * cost =
+ * Q,e
+
double edge_length_variation_cost(const Vertices vertices) {
double diff, cost= 0;
- int v0, efwd,vfwd, eback;
+ int q, e,r, eback;
- FOR_EDGE(v0,efwd,vfwd) {
- eback= edge_reverse(v0,efwd);
- diff= edge_lengths[v0][efwd] - edge_lengths[v0][eback];
+ FOR_EDGE(q,e,r) {
+ eback= edge_reverse(q,e);
+ diff= edge_lengths[q][e] - edge_lengths[q][eback];
cost += diff*diff;
}
return cost;