After running the quad demo. I tried adding a horizontal distance constraint to an edge .
cle = c.Expression.fromConstant(db[0].x).plus(15);
cleq = new c.Equation(db[1].x, cle);
Which generated this error.
Constraint.js:219 Uncaught Bad initializer to c.Equation
So I Modified Expression.plus similarly to Expression.times
plus: function(expr /*c.Expression*/) {
if (typeof expr == 'number') {
return (this.clone()).addMe(expr);
} else {
if (expr instanceof c.Expression) {
return this.clone().addExpression(expr, 1);
} else if (expr instanceof c.Variable) {
return this.clone().addVariable(expr, 1);
}
}
},
And added this addMe method similar to multiplyMe
addMe: function(x /*double*/) {
this.constant += x;
var t = this.terms;
t.each(function(clv, coeff) { t.set(clv, coeff + x); });
return this;
},
Are these basic expressions not developed or am I missing something? This does generate a valid result.
After running the quad demo. I tried adding a horizontal distance constraint to an edge .
Which generated this error.
So I Modified Expression.plus similarly to Expression.times
And added this addMe method similar to multiplyMe
Are these basic expressions not developed or am I missing something? This does generate a valid result.