Hi all,
I need to find the intersection point between a rectangle and a line as shown in the following sketch.
How can this be done? I don't need to create a node on this point or something else, I just need the coordinates where the line and the rectangle intersect for processing outside of Inkscape.
Thanks for any hints on this
[solved] Find intersection point between line and rectangle
Re: Find intersection point between line and rectangle
Hi
Turn on all snapping options.
( or at least: Snap guides, Snap to intersections )
Pull in a guide from ruler on side, (by click and hold left mouse button on the ruler) drag line (mouse pointer) to
intersection point, release mouse button when it snaps to the intersection.
Double click on the created guide line to get the guide line properties window to open,
pop up window will state the coordinates of the "origin" of the guide line,
the coordinates will be the intersection point.
If you need an explanation with figures please chime back.
The "pathmonkey_mutual_cut_line.py" ( found here ) extension could easily be modified to list the coordinates as well.
The extension was created by Gary Kacmarcik. Link to pathmonkey.
Turn on all snapping options.
( or at least: Snap guides, Snap to intersections )
Pull in a guide from ruler on side, (by click and hold left mouse button on the ruler) drag line (mouse pointer) to
intersection point, release mouse button when it snaps to the intersection.
Double click on the created guide line to get the guide line properties window to open,
pop up window will state the coordinates of the "origin" of the guide line,
the coordinates will be the intersection point.
If you need an explanation with figures please chime back.
The "pathmonkey_mutual_cut_line.py" ( found here ) extension could easily be modified to list the coordinates as well.
The extension was created by Gary Kacmarcik. Link to pathmonkey.
Good Luck!
( ͡° ͜ʖ ͡°)
RGDS
Ragnar
( ͡° ͜ʖ ͡°)
RGDS
Ragnar
Re: Find intersection point between line and rectangle
ragstian, that worked great! thank you!
Re: [solved] Find intersection point between line and rectangle
Certainly, @ragstian's solution is the preferred solution.
If @srynoname doesn't mind creating a node at this location there should be another way even without guide.
1. set snap intersections
2. select line
3. use node tool (F2)
4. double click to create a new node when "Handle to path intersection" appears
5. select the newly created node and read the coordinates from the Tools control bar.
BUT: Inkscape doesn't behave as expected.
The node is NOT necessarily created precisely at the intersection as you might expect, but somewhere nearby. Why?
Bug or feature? Or wrong expectations?
If @srynoname doesn't mind creating a node at this location there should be another way even without guide.
1. set snap intersections
2. select line
3. use node tool (F2)
4. double click to create a new node when "Handle to path intersection" appears
5. select the newly created node and read the coordinates from the Tools control bar.
BUT: Inkscape doesn't behave as expected.
The node is NOT necessarily created precisely at the intersection as you might expect, but somewhere nearby. Why?
Bug or feature? Or wrong expectations?
Win7/64, Inkscape 0.92.2
Re: [solved] Find intersection point between line and rectangle
ok... FWIW...
Creating a node via snapping to intersection apparently behaves a bit special.
It seems that the relative position of the node tool/handle to the intersection determines where the new node will be created.
Assume you have one path selected and the other one unselected. If "Handle to path intersection" is displayed there are two cases:
a) If the position of the handle is closer to the selected path the new node will be created somewhere on the selected path but not necessarily at the intersection
b) If the position of the handle is closer to the unselected path the new node will be created at the intersection on both paths.
However, no nodes are created on objects like rectangles or circles. OK, fine.
However, at an intersection of a line/path with a circle there will be even no node created on the intersecting line. Strange?!
Phew! Pretty confusing and a bit inconsistent.
In any case I would expect a node being created at the intersection as soon as it says "Handle to path intersection".
Creating a node via snapping to intersection apparently behaves a bit special.
It seems that the relative position of the node tool/handle to the intersection determines where the new node will be created.
Assume you have one path selected and the other one unselected. If "Handle to path intersection" is displayed there are two cases:
a) If the position of the handle is closer to the selected path the new node will be created somewhere on the selected path but not necessarily at the intersection
b) If the position of the handle is closer to the unselected path the new node will be created at the intersection on both paths.
However, no nodes are created on objects like rectangles or circles. OK, fine.
However, at an intersection of a line/path with a circle there will be even no node created on the intersecting line. Strange?!
Phew! Pretty confusing and a bit inconsistent.
In any case I would expect a node being created at the intersection as soon as it says "Handle to path intersection".
Win7/64, Inkscape 0.92.2
-
- Posts: 2344
- Joined: Sun Apr 14, 2013 12:04 pm
- Location: Michigan, USA
Re: [solved] Find intersection point between line and rectangle
Seems to be some tolerance in the location-tooltip, so I'd avoid using the status display as an accurate indicator of location.
Snapping a guide to path intersection works pretty well, even with arcs & beziers.
Snapping a guide to path intersection works pretty well, even with arcs & beziers.
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/
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/
Re: [solved] Find intersection point between line and rectangle
@tylerdurden, yes, snapping guides to intersections works, no doubt. That's why @ragstian's solution with guides is the "secure" solution.
However, my point is that creating a node with the node tool together with snapping shows some inconsistency.
However, my point is that creating a node with the node tool together with snapping shows some inconsistency.
Win7/64, Inkscape 0.92.2
Re: [solved] Find intersection point between line and rectangle
@theozh : can you check if that bug is already reported? Especially a) is a bit of a nuisance... (I didn't know it could create two nodes, one on each path!)
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!
Inkscape FAQ - Learning Resources - Website with tutorials (German and English)
Inkscape FAQ - Learning Resources - Website with tutorials (German and English)
Re: [solved] Find intersection point between line and rectangle
@Moini, yes, a) is definitely not straightforward, especially when it doesn't snap to the intersection although it says so.
Although, I guess this behaviour with the proximity of the handle might be intentional (or still by accident?).
sorry, haven't mentioned it... already done...
https://bugs.launchpad.net/inkscape/+bug/1713439
Although, I guess this behaviour with the proximity of the handle might be intentional (or still by accident?).
sorry, haven't mentioned it... already done...
https://bugs.launchpad.net/inkscape/+bug/1713439
Win7/64, Inkscape 0.92.2