8 Snap Object::get_snap_node(unsigned) const
10 throw out_of_range("Object::get_snap_node");
13 bool Object::snap(Snap &sn, float limit, SnapType what) const
17 unsigned nsn = get_n_snap_nodes();
18 for(unsigned i=0; i<nsn; ++i)
20 Snap node = get_snap_node(i);
21 Vector span = sn.position-node.position;
22 if(dot(span, span)<limit*limit)
33 bool Object::snap_to(const Object &other, float limit, SnapType what)
35 if(what==SNAP_DEFAULT)
36 what = get_default_snap_type_to(other);
41 unsigned nsn = get_n_snap_nodes();
42 for(unsigned i=0; i<nsn; ++i)
44 Snap sn = get_snap_node(i);
46 if(other.snap(ssn, limit, what))
48 set_rotation(rotation+ssn.rotation-sn.rotation-Angle::half_turn());
49 sn = get_snap_node(i);
50 position += ssn.position-sn.position;
58 Object *Object::get_link(unsigned) const
60 throw out_of_range("Object::get_link");
63 bool Object::break_link(Object &other)
65 unsigned nls = get_n_link_slots();
66 for(unsigned i=0; i<nls; ++i)
67 if(get_link(i)==&other)
73 void Object::break_links()
75 unsigned nls = get_n_link_slots();
76 for(unsigned i=0; i<nls; ++i)