/// Constrain field of all items as being equal
Constrain field of all items as being equal
Constrain field of all items as being equal
pub fn equalize(&mut self, field: Field, items: &[NodeId], strength: f64) {
        for item_ids in items.windows(2) {
            let item_a = self.nodes.get(&item_ids[0]).unwrap();
            let item_b = self.nodes.get(&item_ids[1]).unwrap();
            self.solver
                .add_constraint(item_a.get_var(field) | EQ(strength) | item_b.get_var(field))
                .unwrap();
        }
    }
pub fn equalize ( & mut self , field : Field , items : & [ NodeId ] , strength : f64 ) { for item_ids in items . windows ( 2 ) { let item_a = self . nodes . get ( & item_ids [ 0 ] ) . unwrap ( ) ; let item_b = self . nodes . get ( & item_ids [ 1 ] ) . unwrap ( ) ; self . solver . add_constraint ( item_a . get_var ( field ) | EQ ( strength ) | item_b . get_var ( field ) ) . unwrap ( ) ; } }
Constrain field of all items as being equal
Constrain field of all items as being equal
&mut self
field
Field
items
&[NodeId]
strength
f64