Inkscape currently has a way to snap a drawing node to another drawing node. Is there a way to associate a "super snap node" with an object which would take precedence over the drawing nodes?
Let me give an example. Proteins sometimes exist in cell membranes. The protein SVG would be a complex drawing, as would the membrane, both packed full of the usual drawing nodes. So moving the protein to the membrane in the usual snap mode is not going to be at all helpful. The "super snap node" would consist of a vector defined by two points specifying a position and an orientation. It would be associated with a grouped object but would not normally be visible. It would indicate the proper insertion orientation and position for the protein. A matching "super snap node" would be associated with each element in the membrane. In those mode one could drag the protein to the membrane and drop it and it would center and orient on the nearest super snap node in the membrane. Since cell membranes have two sides moving the protein over to the other half and releasing it would flip it 180 degrees and insert it in the other direction. In the more general case, there could be types of super snap nodes, so that only a pair of the same type would interact.
(Note, my email is acting strangely today - I'm not sure what the subject is going to be on this message. )
Regards,
David Mathog mathog@...1176... Manager, Sequence Analysis Facility, Biology Division, Caltech
On 08-May-2019 13:20, David Mathog wrote:
Inkscape currently has a way to snap a drawing node to another drawing node. Is there a way to associate a "super snap node" with an object which would take precedence over the drawing nodes?
Having thought about this a little more, let us call this a HOOK (because super node is a mouthful) and define a HOOK as:
a two point path like: M 27.214285,42.244047 82.398808,93.648809 with a description field like: SPECIAL_HOOK text_tag A HOOK is not normally visible and like any other object may be part of a grouped object.
In HOOK alignment mode when an object containing a hook is dragged over another object containing a hook the program would locate all hooks (two points, special description field) and then compare all tags in the hooks in the two objects. If it finds a closest pair of hooks with matching tags it offers to align (as with nodes, currently). If accepted the dragged object is placed so that its first point is on the first point of the target object's hook and its second point is on the second point of the target object's hook. To do so the object is rotated and scaled as needed. Calculating the angles and scale factors is a trivial calculation, for two vectors in a plane.
Consider a simple use example. We have all seen the children's game with paper dolls and paper clothes. Now imagine that each doll has HOOKs that say "head", "torso", "left hand", "waist", "legs", "right hand", "left hand", and so forth located in the appropriate places. In the same drawing there are objects of clothes with matching HOOKs. A hat has "head", a belt, pants, or skirt have "waist", gloves have "right hand" or "left hand". These clothes may be arranged in any orientation on the screen and for the sake of argument are much smaller than the dolls. The dolls are standing on a drawing of a hill so that they are at different angles. Nevertheless, grab a dress and drag it onto a doll, and it will snap to fit in exactly the right way. There is no need for manual alignment, scaling, or rotation.
For this to work correctly the "unit vector" used when constructing the clothes must be compatible with that used for the dolls.
This doesn't seem to run afoul of anything in SVG, it is just a description of how the program manipulates objects which are so described.
Exists? Nearly exists? Wild pipe dream?
Thanks,
David Mathog mathog@...1176... Manager, Sequence Analysis Facility, Biology Division, Caltech
Hhmm.... I can't answer as to the do-ability of this. But just curious.
It would take some time to set up the hooks or super nodes, I guess. So the use case would have to include many needs for it (many dolls and/or doll dresses) before it makes sense. Right?
No idea if it could be done. But it's an interesting idea!
brynn
-----Original Message----- From: David Mathog Sent: Wednesday, May 08, 2019 5:35 PM To: inkscape-devel@lists.sourceforge.net Subject: Re: [Inkscape-devel] Super node snapping
On 08-May-2019 13:20, David Mathog wrote:
Inkscape currently has a way to snap a drawing node to another drawing node. Is there a way to associate a "super snap node" with an object which would take precedence over the drawing nodes?
Having thought about this a little more, let us call this a HOOK (because super node is a mouthful) and define a HOOK as:
a two point path like: M 27.214285,42.244047 82.398808,93.648809 with a description field like: SPECIAL_HOOK text_tag A HOOK is not normally visible and like any other object may be part of a grouped object.
In HOOK alignment mode when an object containing a hook is dragged over another object containing a hook the program would locate all hooks (two points, special description field) and then compare all tags in the hooks in the two objects. If it finds a closest pair of hooks with matching tags it offers to align (as with nodes, currently). If accepted the dragged object is placed so that its first point is on the first point of the target object's hook and its second point is on the second point of the target object's hook. To do so the object is rotated and scaled as needed. Calculating the angles and scale factors is a trivial calculation, for two vectors in a plane.
Consider a simple use example. We have all seen the children's game with paper dolls and paper clothes. Now imagine that each doll has HOOKs that say "head", "torso", "left hand", "waist", "legs", "right hand", "left hand", and so forth located in the appropriate places. In the same drawing there are objects of clothes with matching HOOKs. A hat has "head", a belt, pants, or skirt have "waist", gloves have "right hand" or "left hand". These clothes may be arranged in any orientation on the screen and for the sake of argument are much smaller than the dolls. The dolls are standing on a drawing of a hill so that they are at different angles. Nevertheless, grab a dress and drag it onto a doll, and it will snap to fit in exactly the right way. There is no need for manual alignment, scaling, or rotation.
For this to work correctly the "unit vector" used when constructing the clothes must be compatible with that used for the dolls.
This doesn't seem to run afoul of anything in SVG, it is just a description of how the program manipulates objects which are so described.
Exists? Nearly exists? Wild pipe dream?
Thanks,
David Mathog mathog@...1176... Manager, Sequence Analysis Facility, Biology Division, Caltech
_______________________________________________ Inkscape-devel mailing list Inkscape-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-devel
participants (2)
-
brynn
-
David Mathog