Re: Super node snapping

David Mathog <[email protected]> Wed, 08 May 2019 16:35:02 -0700
Newsgroups gmane.comp.graphics.inkscape.devel
Message-ID <[email protected]>
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
[email protected]
Manager, Sequence Analysis Facility, Biology Division, Caltech