IjzerenHein / kiwi.js

Fast TypeScript implementation of the Cassowary constraint solving algorithm 🖖
Other
249 stars 24 forks source link

Multiply two variables or expressions #33

Open wrnrlr opened 3 years ago

wrnrlr commented 3 years ago

I'd hoped to be able to constrain two lines to be parallel by rewriting the equation for the slope.

m1 == (p1.y - q1.y) / (p1.x - q1.x)
m2 == (p2.y - q2.y) / (p2.x - q2.x)
m1 == m2

algebra-cadabra:

(p1.y - q1.y) * (p2.x - q2.x) == (p2.y - q2.y) * (p1.x - q1.x)

Turns out I can't multiply two expression or variables, is this a fundamental restriction of kiwi or can it be extended in some way to support such things?

Kind Regards