Connect intersecting lines

Post questions on how to use or achieve an effect in Inkscape.
il_mix
Posts: 5
Joined: Wed Feb 27, 2013 2:16 am

Connect intersecting lines

Postby il_mix » Tue Oct 03, 2017 6:06 pm

Hi, everyone!

I have to ask for help for a quite basic (I suppose) operation.
I have to connect two arcs (or two lines in general) to create a new line. I've attached example "from-this to-this" images.
I'm doing a quite complicated procedure at the moment, and I hope there is a better way to do it. (so complicated that I feel ashamed to share...)
I've found this
http://www.inkscapeforum.com/viewtopic.php?t=1143
It describe some solutions (still quite tedious, imho...). The first one is promising, but I'm not able to generate the mid point by double-clicking with the pen tool. Also, the topic is quite old, so maybe some new feature for the task was created.

Any hints?
Many thanks!
Attachments
to-this.svg
(2.29 KiB) Downloaded 13 times
from-this.svg
(2.53 KiB) Downloaded 11 times

User avatar
brynn
Posts: 9614
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Connect intersecting lines

Postby brynn » Tue Oct 03, 2017 9:35 pm

Wow! Since all that time, there still is no easy way to do that. However, there is a new feature since then, which makes it possible to do it with precision. It's not easy, but at least it's not subjective as it used to be.

There's a new Snap feature, Snap to Intersection. I'm trying to learn how to make videos, so please forgive if this doesn't look professional. I'll be right back with the video.

User avatar
brynn
Posts: 9614
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Connect intersecting lines

Postby brynn » Tue Oct 03, 2017 10:06 pm

Here's the video which can be used under any circumstances, to join 2 paths at their intersection.

https://inkscapecommunity.com/jd/vids/tp.mp4

Here's a much easier way....at least I think it's easier. But it only works for this particular 2 paths. It would not necessarily work for any 2 paths.

https://inkscapecommunity.com/jd/vids/tp0.mp4

theozh
Posts: 413
Joined: Fri Mar 23, 2012 6:30 pm

Re: Connect intersecting lines

Postby theozh » Tue Oct 03, 2017 10:54 pm

well, it seems not so easy with Inkscape.
When I had similar geometric questions, I was told several times: "Inkscape is not a CAD-Tool" ;-).
Well, CAD-tools have a simple Trim-Tool deleting e.g. a "free path end" until the next intersection.
And I'm sure, all the ingredients are already there in Inkscape to implement such a useful feature.

Please, share your procedure, don't be ashamed!

When enabling "snapping to intersections" you should be able to create a node at the intersection by double clicking. However, I recently found that this doesn't always work as expected. See: viewtopic.php?f=5&t=32837#p100370
Bug report: https://bugs.launchpad.net/inkscape/+bug/1713439

Then, I would do it the following (haven't checked your and the other links):
1. drag a guide snap to the intersection
2. select Path1, use Node Tool (F2) and double click on the guide/path intersection to create a node
3. select Path2, use Node Tool (F2) and double click on the guide/path intersection to create a node
4. delete unwanted nodes of Path1 and Path2
5. select both paths and combine them (Ctrl+K)
6. if you don't want to have two nodes there, use Node Tool, select these two nodes and do "join selected nodes"
Done!
Win7/64, Inkscape 0.92.2

User avatar
brynn
Posts: 9614
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Connect intersecting lines

Postby brynn » Tue Oct 03, 2017 11:26 pm

When enabling "snapping to intersections" you should be able to create a node at the intersection by double clicking.

Unless there's a new feature that I'm not aware of, that will only work if you happen to click precisely on the intersection. Because I can place my mouse over the intersection, the snap notification is flashing away. But after I double-click, the node is relatively a mile away from the actual intersection.

tylerdurden
Posts: 1830
Joined: Sun Apr 14, 2013 12:04 pm
Location: Michigan, USA

Re: Connect intersecting lines

Postby tylerdurden » Wed Oct 04, 2017 12:47 am

Seems there may always be some precision issues due to arcs and booleans.

Image
Have a nice day.

I'm using Inkscape 0.92.2 (5c3e80d, 2017-08-06), 64 bit win8.1

The Inkscape manual has lots of helpful info! http://tavmjong.free.fr/INKSCAPE/MANUAL/html/

theozh
Posts: 413
Joined: Fri Mar 23, 2012 6:30 pm

Re: Connect intersecting lines

Postby theozh » Wed Oct 04, 2017 1:46 am

tylerdurden wrote:Seems there may always be some precision issues due to arcs and booleans.

Why do you think so? ;-) Inkscape claims to have a precision up to 16 digits! :lol:
See: viewtopic.php?f=22&t=32160
Win7/64, Inkscape 0.92.2

il_mix
Posts: 5
Joined: Wed Feb 27, 2013 2:16 am

Re: Connect intersecting lines

Postby il_mix » Thu Oct 05, 2017 6:54 pm

Here I am.
First of all, thanks for your hints!

I won't share my former workflow, since it is way more complicated than the ones explained here. But I share the one that I'm using right now taking inspiration from @brynn methot.

@brynn first method looks ok, while still quite tedious. As said, right now I'm using a method inspired by yours, but slightly different (and still tedious). The main difference is that I won't use an extra shape for cutting, but the paths themselfs; a little more "logically straightforward" imho.
- need to join path A and path B on intersection
- duplicate path A (will be on top); let's call it path A.1
- select path A.1 and path B, then Path->Cut Path
- path B will be split in 2 on the intersection. Path A.1 will be deleted
- deleted unwanted path B section
- duplicate remaining path B (will be on top); let's call it path B.1
- select path A and path B.1, then Path->Cut Path
- path B will be split in 2 on the intersection. Path A.1 will be deleted
- connect two paths and join nodes

As previously said, this method is still not precise, since the two cut paths won't have (in general) the end point overlapping. That's quite annoying...
Same happens with the shape method described by @brynn.

@brynn second method is interesting, and actually quite easyer, and probably targets 80% of my cases. I've noted that the intersection will still be skewed a little; but looks a little more precise than the first method.

The method described by @theozh looks wayyyy faster. Awfully, I second what @brynn says; I'm not able to create a node exactly on the intersection.
I've linked a solution that propose a similar solution, that is creating a node by double clicking with the pen tool. As said, double clicking with the pen tool won't even create a node.

theozh
Posts: 413
Joined: Fri Mar 23, 2012 6:30 pm

Re: Connect intersecting lines

Postby theozh » Thu Oct 05, 2017 9:16 pm

Hi @il_mix,
In order to get a new node at the intersection try the following:

1. set snap to intersections, all other snapping off
2. select one path, leave the other unselected
3. with the Node Tool (F2) cursor approach the intersection from direction of the other unselected(!) path
4. as soon as "Handle to path intersection" appears do a double click
Two nodes at the intersection should be created, one on each path.
As you can see below these two nodes seem to be pretty "identical".
5. select and delete the nodes of the two unwanted ends
6. combine your two paths (Ctrl+K), and if you prefer make the two "identical" nodes to one node

However, I had situations where it didn't create nodes on BOTH paths. I even had Inkscape crashing. But I couldn't reproduce these cases regularly.

TrimAtIntersection.gif
TrimAtIntersection.gif (170.94 KiB) Viewed 501 times
Win7/64, Inkscape 0.92.2

tylerdurden
Posts: 1830
Joined: Sun Apr 14, 2013 12:04 pm
Location: Michigan, USA

Re: Connect intersecting lines

Postby tylerdurden » Thu Oct 05, 2017 10:32 pm

^^ I can't get that to work reliably.^^
Have a nice day.

I'm using Inkscape 0.92.2 (5c3e80d, 2017-08-06), 64 bit win8.1

The Inkscape manual has lots of helpful info! http://tavmjong.free.fr/INKSCAPE/MANUAL/html/

theozh
Posts: 413
Joined: Fri Mar 23, 2012 6:30 pm

Re: Connect intersecting lines

Postby theozh » Thu Oct 05, 2017 10:36 pm

@tylerdurden, are you approaching the intersection with the cursor closer to the unselected path than to the selected one?
That seems to make the difference... (at least on my system)...
Win7/64, Inkscape 0.92.2

tylerdurden
Posts: 1830
Joined: Sun Apr 14, 2013 12:04 pm
Location: Michigan, USA

Re: Connect intersecting lines

Postby tylerdurden » Thu Oct 05, 2017 10:40 pm

No change... I'm using stock snap settings, btw.
Have a nice day.

I'm using Inkscape 0.92.2 (5c3e80d, 2017-08-06), 64 bit win8.1

The Inkscape manual has lots of helpful info! http://tavmjong.free.fr/INKSCAPE/MANUAL/html/

theozh
Posts: 413
Joined: Fri Mar 23, 2012 6:30 pm

Re: Connect intersecting lines

Postby theozh » Thu Oct 05, 2017 10:52 pm

hmm... strange, apparently, some more parameters determine whether it will work or not... :?
Win7/64, Inkscape 0.92.2

theozh
Posts: 413
Joined: Fri Mar 23, 2012 6:30 pm

Re: Connect intersecting lines

Postby theozh » Thu Oct 05, 2017 11:05 pm

...my suspicion: it depends on the zoom level ?!
The closer you are zoomed in, the less precise it will hit the intersection. So if you are zoomed out pretty far, it seems to hit the "exact" intersection best.
Maybe it has something to do with the "snap tolerance" and the (visual) stroke width?
Win7/64, Inkscape 0.92.2

tylerdurden
Posts: 1830
Joined: Sun Apr 14, 2013 12:04 pm
Location: Michigan, USA

Re: Connect intersecting lines

Postby tylerdurden » Fri Oct 06, 2017 12:35 am

Haha... yeah, that's it...

Ironic that the further zoomed away, the more accurate it is.

My doubleclicks only make a single node on one path tho.
Have a nice day.

I'm using Inkscape 0.92.2 (5c3e80d, 2017-08-06), 64 bit win8.1

The Inkscape manual has lots of helpful info! http://tavmjong.free.fr/INKSCAPE/MANUAL/html/

User avatar
brynn
Posts: 9614
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Connect intersecting lines

Postby brynn » Fri Oct 06, 2017 12:44 am

I can't get double-click to add a new node precisely (or even necessarily close) at the intersection, under any zoom level.

Oh, interesting! If I have the mouse over top of the non-selected path (which is counter-intuitive, since one would normally have their mouse over the path where they want to add the node) and I'm at 100% zoom, it does place the new node at the intersection.

Note that I don't see the expected "finger" pointer, which I typically look for before I double-click to add a new node. (Because typically, a new node won't be placed at all, if you don't see the finger pointer to indicate you're over the path.) This places the node even if you're not on top of the path where you want the new node. In fact, if I am on top of the selected path at all (if the finger pointer is showing), it does not place the node at the intersection. The mouse has to be on the non-selected path only, and close enough for the snap indicator to show up.

I don't have to be very close to the intersection at all. It works for 6 or 8 stroke widths away.....maybe related to the strength of the snap (as I think of it) which is set in Document Properties (where it is called the snap distance).

Also, if both paths are selected (which is sort of intuitive to me) it won't work.

I don't know if any of that is intended....it certainly seems to be too specific not to be intended....or if it's meant to work with the mouse anywhere close, but doesn't for some reason.

Oh, holy crap! It must be intended, because it adds a new node to both paths!

I change my mind now. I think this is the best solution, at least for adding the new node. And for il_mix, it appears to add both nodes, precisely at the intersection. Both nodes are precisely on top of each other.

However, there certainly needs to be some clue for the user. I doubt if any user has discovered this serendipitously. Because why would you double-click to add a node, if you don't see the finger pointer? Maybe a tool tip or something? (edit - or maybe a special snap indicator?)

theozh
Posts: 413
Joined: Fri Mar 23, 2012 6:30 pm

Re: Connect intersecting lines

Postby theozh » Fri Oct 06, 2017 12:46 am

tylerdurden wrote:My doubleclicks only make a single node on one path tho.

Well, I once had this too... but somehow it changed somewhen for some reason... haven't found out yet why... haven't changed anything intentionally... painful... :?
Win7/64, Inkscape 0.92.2

theozh
Posts: 413
Joined: Fri Mar 23, 2012 6:30 pm

Re: Connect intersecting lines

Postby theozh » Fri Oct 06, 2017 3:51 am

...on Launchpad you might want to vote that this bug also affects you... in order to catch the developer's attention...
https://bugs.launchpad.net/inkscape/+bug/1713439
and maybe to a given time we might get an explanation by them...
Win7/64, Inkscape 0.92.2

il_mix
Posts: 5
Joined: Wed Feb 27, 2013 2:16 am

Re: Connect intersecting lines

Postby il_mix » Fri Oct 06, 2017 6:22 pm

Well, that's something...
@theoxh method is working and is by far the faster and more precise. Although not really in the top of the chart of the "intuitive methods"...
Regarding the "approach the intersection from the unselected line", what I've noticed is that, instead of really "approaching", it is enough to move the mouse to the intersection having the pointer near the unselected line, so that the line gets "pre-selected" (the path becomes red); a double click generate the intersection node on both paths, as said.

Anyway, I'm experiencing different behaviors with diffetent software versions.
Looks like Inkscape 0.91 doesn't have this feature. The node tool never snaps on the intersection; a hand cursor appears when you are in the proximity, but I wasn't able to create the node in the right spot.
Inkscape 0.92 (tested 0.92.2) implements the feature. Sort of... The Windows version works as described; a double click generates the node on both paths. The Linux version works in a slightly different way;
- if you "approach" from the other path (the path becomes red), what happens is that the first click selects the path, the second generates the node on the new selected path
- is you approach from the selected path, the node will be created on this path
- in both cases, if you are too zoomed in, the node won't be created on the intersection; one have to be quite far from the path, so that the node tool snaps on the intersection instead of snapping on the path

I think that the Linux approach, although it requires 2 clicks to generate the 2 nodes, is more "logic"; one creates the node on the selected path. Anyway, the path-snap that requires to be zoomed out is still a little confusing.

theozh
Posts: 413
Joined: Fri Mar 23, 2012 6:30 pm

Re: Connect intersecting lines

Postby theozh » Sat Oct 07, 2017 6:31 am

Thanks, @il_mix, for further testing on different versions and operating systems.
Of course, instead of "approaching" I actually meant that the double click should be closer to the unselected than the selected path as long as (or as soon as) "Handle to path intersection" pops up. Yes, "approaching" along the path is not necessary.

il_mix wrote:Anyway, the path-snap that requires to be zoomed out is still a little confusing.
My guess is that the position where the node is put, probably depends on the visual stroke width and the "grab tolerance" (although in Preferences it is called "grab sensitivity"), therefore the thinner the stroke the better.

However, it would be pretty strange if Win and Linux versions behaved different... :?
Win7/64, Inkscape 0.92.2


Return to “Help with using Inkscape”

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 7 guests