Feature Request: Snap node to tangent of curve

Bug #519391 reported by bkgoodman
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
Wishlist
Diederik van Lierop

Bug Description

I don't think this was specifically covered in the other request for advanced snapping bugs.

The ability to snap a node, based on the line being drawn to the tangent of another curve is a feature in [I forget if it was in] Illustrator or Corel Draw that I used to use all the time, and really miss in Inkscape!

Tags: snapping
su_v (suv-lp)
tags: added: snapping
Changed in inkscape:
importance: Undecided → Wishlist
Changed in inkscape:
assignee: nobody → Diederik van Lierop (mail-diedenrezi)
Revision history for this message
LucaDC (lucadc) wrote :

Just reporting the idea expressed in lp:814457; maybe starting with guides can lead to a quicker and simpler (to implement) solution. A well placed guide makes life easier for a lot of tasks even without dedicated Inkscape's features.
Modifier1: the guide origin snaps to a path and the guide is always made tangent (where a tangent is defined).
Modifier2: the guide snaps to the nearest point in the portion of a path inside the snapping area where the tangent is equal to the guide angle (when this point exists).
Both modifiers should be active only if snapping to paths is activated (to prevent excessive overload when not needed).
I don't like the idea of yet-another-couple-of-modifiers too much so better if someone finds a different solution to trigger this two behaviours.

Revision history for this message
su_v (suv-lp) wrote :

As of revision 10886, Inkscape trunk now supports tangential and perpendicular snapping while drawing and node-editing paths as well as when placing and rotating guides:
<http://article.gmane.org/gmane.comp.graphics.inkscape.devel/37863>

@Diederik - you rock :)

Changed in inkscape:
milestone: none → 0.49
status: New → In Progress
Revision history for this message
bkgoodman (brad-bradgoodman) wrote :

Excellent! Thank you VERY much!

Revision history for this message
LucaDC (lucadc) wrote :

That's really a great news I was waiting for!
It's fantastic while drawing paths too.
Thanks a lot.

I couldn't figure out how to choose between perpendicular and tangential snap for guides (if it's possible): sometimes it snaps only tangential, others only perpendicular and others it gives me the impression of being able to choose between them based on the approaching direction (but I'm not so sure).
Thanks again.

Revision history for this message
Diederik van Lierop (mail-diedenrezi) wrote :

You're welcome!

Indeed, you don't have much control yet, Inkscape will snap automagically ;-). It will try to snap to any path, and subsequently look for tangential and perpendicular snap points on that path. If it finds one such point within range then this point will be preferred over snapping to the path itself, and if multiple snap points are available then the closest snappoint will be preferred. So the only thing you can do is to move the pointer to there where you want snapping to occur.

Likely two new snap buttons will be added someday, as children of the "snap to paths" button.

Revision history for this message
LucaDC (lucadc) wrote :

@Diederik
Ok, I realized I didn't express myself too well.
I agree with the idea of having a button to toggle the new snapping tangential/perpendicular snapping (one could be enough for both, I think), but maybe not as a child of the "snap to path" one (you'll see why).

I was trying to make a guide tangent to a curve in a given point. So I drew a curve (three nodes, the central made smooth), picked up a guide and snapped its origin to the middle node. Then with shift I started rotating the guide: if you snap to the center of the guide the guide is made either perpendicular or tangent or one of the two depending of something I can't figure out nor reproduce.
From your reply, I guess that you dind't consider this case and probably what happens is a side-effect of the new code toghether with rounding errors (when the two points are really coincident, the guide becomes vertical).
I can't see a different way of having a guide tangent (or perpendicular) at a given point of a curve other than placing the guide origin in that point and then rotating the guide. But as you're not snapping to the path while looking for the two, the only way to recognize this is checking if the guide's origin is on a path (or maybe even more than one if it's on an intersection) and considering the calculated angles (tangent(s) and perpendicular(s) in that particular point) for rotation snapping. This option could be active also without snapping to path on (you can snap the guide's origin directly to a node).
What do you think?

Revision history for this message
Diederik van Lierop (mail-diedenrezi) wrote :

Yes, now I see what you want to achieve. It's useful indeed so I will implement this, but it will take some weeks before I can get to it.

Revision history for this message
su_v (suv-lp) wrote :

@Diederik - what would you think about allowing to node-snap perpendicular to a (slanted) guide when drawing a path with the pencil or pen tool? This would be a handy shortcut (it can be achieved in trunk - tested in r10938, default prefs, default template - by first drawing a path snapped to the guide, then start the new path and snap perpendicular to the auxiliary path drawn on top of the guide).

Revision history for this message
Diederik van Lierop (mail-diedenrezi) wrote :

@LucaDC: See rev. #10975:

"1) Add checkboxes for perpendicular and tangential snapping to the document properties dialog (on the snap tab)
2) Newly created guides (dragged off the ruler) will take on the angle of the curve that's being snapped to (either perpendicularly or tangentialy, depending of the settings in the document properties dialog)"

No additional modifier keys needed, this will only work for newly created guides. If you don' t want this behavior then just drop a guide on the canvas, and drag it to where you want it to be.

@~suv: Yes, that behaviour seems very natural and is quite easy to implement. Will do!

Revision history for this message
Diederik van Lierop (mail-diedenrezi) wrote :

@~suv: implemented in rev. #10976

Changed in inkscape:
status: In Progress → Fix Released
Revision history for this message
LucaDC (lucadc) wrote :

@Diederik: great news you did work on it. Unfortunately compiling under Windows is still broken so I'll have to wait for testing this new feature. Not having added a new modifier is a good thing because there already are so many; but, what about adding a right mouse click (while holding the left clicked, of course) for cycling between no tangent - tangent - perpendicular options (starting from the one specified by the preference)? I'd find it really cool. Forget it if it's too difficult to implement.

Revision history for this message
Diederik van Lierop (mail-diedenrezi) wrote : Re: [Bug 519391] Re: Feature Request: Snap node to tangent of curve

@LucaDC: Implementing that is probably not too difficult, but I'd
rather not implement such a trick specificly for this relatively small
snapping feature. Nobody will discover this because we don't use this
trick everywhere in Inkscape. Everybody understands the modifiers
because they're being used in all tools, although the keys have
different effects in the different tools... which is already annoying.
Adding even more tool-specific tricks makes things even harder to
discover for the users, and requires adding stuff like this to the
manual and adding extra code. This is all bad for maintainability IMHO.
We're already pushing the limits, because the behaviour for new guides
is now different from that of existing guides. How easily will people
discover this?

Anyway, we have a workaround now (i.e. using the document properties
dialog), which is good enough for now. Of course we can always make
things more fancy, but this comes at a cost. I'm not saying that your
idea is bad, on the contrary! But we would need to think of the
consequences Inkscape wide and see if we can make things consistent.

Revision history for this message
LucaDC (lucadc) wrote :

@Diederik: ok, I understand and agree.
Actually, I don't like having differences between old and new guides too and that's why I was looking for a different solution: I fear people will soon report a bug about guides not always snapping tangential or perpendicular because they don't realize this is going to happen only when it's created and not after.
Also, having to go into the preferences every time you need a tangential rather than orthogonal guide is not practical too and probably when people will discover this feature, someone will ask for a shortcut on it (I've already done so I promise I won't ;).
Anyway, this is already a good enhancement. Thanks again.

By the way, would you mind commenting https://bugs.launchpad.net/inkscape/+bug/927898/comments/6 ? We could free some space on the snapping toolbar...

Revision history for this message
Diederik van Lierop (mail-diedenrezi) wrote :

> because they don't realize this is going to happen only when it's created and not after

Yes, I agree. But at least they have discovered the feature :-)

> having to go into the preferences every time you

I was thinking about adding a button at the bottom (or close to the top?) of the snap toolbar which opens the document properties dialog, with the snap tab in the front. That would help for discoverability, to make users realize that there are more preferences than the ones visible on the toolbar.

> By the way, would you mind commenting

I will, don' t worry. I was contemplating a brilliant response, but haven' t been very succesfull so far ;-)

Revision history for this message
su_v (suv-lp) wrote :

Reverting bug status to 'Fix Committed': the report itself is a feature request to implement additional snap modes which will be released with Inkscape 0.49.

Please revert the status change if you don't agree.

Changed in inkscape:
status: Fix Released → Fix Committed
Bryce Harrington (bryce)
Changed in inkscape:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.