stefanszymanski / kiwi-scala

A Scala port of the Kiwi Java and Haxe implementations of the Cassowary constraint solving algorithm

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

kiwi-scala

Build Status

A Scala port of the Kiwi Java and Kiwi Haxe implementations of the Cassowary constraint solving algorithm

Example usage

val solver = new Solver
val x = new Variable
val y = new Variable

solver += x == 20
solver += x + 2 == y + 10
!solver

println(x.value, y.value)
// (20.0, 12.0)

Those three lines with solver use the short form of the following.

solver.addConstraint(Symbolics.equals(x, 20))
solver.addConstraint(Symbolics.equals(Symbolics.add(x, 2), Symbolics.add(y, 10)))
solver.updateVariables()

Links

About

A Scala port of the Kiwi Java and Haxe implementations of the Cassowary constraint solving algorithm

License:MIT License


Languages

Language:Scala 100.0%