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 d(sn.position.x-node.position.x, sn.position.y-node.position.y, sn.position.z-node.position.z);
22 if(d.x*d.x+d.y*d.y<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-M_PI);
49 sn = get_snap_node(i);
50 position.x += ssn.position.x-sn.position.x;
51 position.y += ssn.position.y-sn.position.y;
52 position.z += ssn.position.z-sn.position.z;
60 Object *Object::get_link(unsigned) const
62 throw out_of_range("Object::get_link");
65 bool Object::break_link(Object &other)
67 unsigned nls = get_n_link_slots();
68 for(unsigned i=0; i<nls; ++i)
69 if(get_link(i)==&other)
75 void Object::break_links()
77 unsigned nls = get_n_link_slots();
78 for(unsigned i=0; i<nls; ++i)