Marker and length

Post questions on how to use or achieve an effect in Inkscape.
Gedep
Posts: 20
Joined: Sat Apr 21, 2012 8:58 pm

Marker and length

Postby Gedep » Sat Apr 21, 2012 9:13 pm

Hi there,

I'm new to using Inkscape. I've tried some things and I very impressed by the possibilities. I'm using Inkscape mainly to draw chemistry equipment and drawings for physics (for example refraction of light).
With physics drawings I'm experiencing some difficulties. I've searched the web for tutorials etc, but haven't found what I'm looking for.

I'm drawing an vector representing a force of 100 Newtons, so I draw a line of 100 pixels and the I add a arrow marker at the end. New my vector is not 100 pixels anymore? I adjusted this and the I wanted to draw another arrow meting the first one. Thus I drew a line meeting the end node of the firts line and added a arrow marker. All of you experts guessed it: the arrow heads don't meet exactly.

How can I fix this?

Thank you very much for helping me

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

Re: Marker and length

Postby brynn » Sat Apr 21, 2012 11:20 pm

Image
Welcome to InkscapeForum!

Hhhmm....interesting! Let me do some testing and I'll come back with what i learn :D

Edit
I tried several different markers. Of the arrows, they extended beyond the end of the path by anywhere from 1 to 2 px. There's one called Triangle Out where a triangle appears to be centered on the end node, and for a 1 px stroke wide, extends 5 px beyond the end node. In reading the manual info (http://tavmjong.free.fr/INKSCAPE/MANUAL ... ke-Markers) I learned that the size of the marker varies with stroke width. Certainly not an ideal situation, for those needing precision with arrows and arrowheads!

But I also found in the manual, instructions for making custom markers (http://tavmjong.free.fr/INKSCAPE/MANUAL ... es-Markers). It appears that you can adjust the offset of the marker origin from the node. So that might be the best option for you :D

Gedep
Posts: 20
Joined: Sat Apr 21, 2012 8:58 pm

Re: Marker and length

Postby Gedep » Sun Apr 22, 2012 1:04 am

For example:
Image

I drew two lines of which the nodes overlap and added endmarkers.

User avatar
druban
Posts: 1823
Joined: Fri Nov 20, 2009 10:48 pm

Re: Marker and length

Postby druban » Sun Apr 22, 2012 6:15 am

This is a miter limit issue if you know what that is. In the fill and stroke dialog you can set the miter limit to something shorter, but then it will just get cut off at the tip of the arrow.
Your best option is to manually move the end nodes back so that the arrow tips are where you want them to be.
Your mind is what you think it is.

dvlierop
Posts: 139
Joined: Sat Sep 08, 2007 4:25 am

Re: Marker and length

Postby dvlierop » Sun Apr 22, 2012 9:34 pm

Yes, this is very annoying indeed! I've thought about ways how to improve Inkscape's code to handle this properly, but there doesn't seem to be an easy way to do this. You might want to experiment with the custom markers as suggested by Brynn, and combine this with Druban's advice and see if that helps. If so, then we should make these markers default I guess!

Gedep
Posts: 20
Joined: Sat Apr 21, 2012 8:58 pm

Re: Marker and length

Postby Gedep » Sun Apr 22, 2012 10:46 pm

I'm proud! I altered code for the first time.
It didn't solve the problem completely thought.

I copied the code of my favorite marker, changed the name to my own marker and edited the offset.
The result is that the marker now end EXACTLY at the end of my line. Now I have this problem (I changed the line color):
Image

I tried druban's advice of "miter limit". At least I think I did, because I'm working with a Dutch version of Inkscape. Is "miter limit" the value that's default on 4,00 in the same windows where I can add a marker? I tried several values, but I didn't see any effect...

Is it maybe possible to add a button with a different line end? Now I've got three choices: "Chopped", "Rounded" and "Square" (I translated back from my Dutch version)
If there is a pointy end, maybe the problem is solved? The slope of the point has to match the slope of the marker...

dvlierop
Posts: 139
Joined: Sat Sep 08, 2007 4:25 am

Re: Marker and length

Postby dvlierop » Mon Apr 23, 2012 5:17 am

You can take this one step further, by drawing additional white areas. These white areas then overlap with the triangular pieces of stroke you want to hide:

Code: Select all

<!-- 1 LARGE with tip aligned with node -->
    <marker style="overflow:visible" id="Arrow1LstartAligned" refX="0.0" refY="0.0" orient="auto" inkscape:stockid="Arrow1LstartAligned">
      <path transform="scale(0.8) translate(12.5,0)" style="fill-rule:evenodd;fill:#000000;stroke-width:0.0pt" d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "/>
      <path transform="scale(0.8) translate(12.5,0)" style="fill-rule:evenodd;fill:#FFFFFF;stroke-width:0.0pt" d="M 5.0,-5.0 L -12.5,-5.0 L -12.5,0.0 L 5.0,-5.0 z "/>
      <path transform="scale(0.8) translate(12.5,0)" style="fill-rule:evenodd;fill:#FFFFFF;stroke-width:0.0pt" d="M 5.0,5.0 L -12.5,5.0 L -12.5,0.0 L 5.0,5.0 z "/>
    </marker>
    <marker style="overflow:visible;" id="Arrow1LendAligned" refX="0.0" refY="0.0" orient="auto" inkscape:stockid="Arrow1LendAligned">
      <path transform="scale(0.8) rotate(180) translate(12.5,0)" style="fill-rule:evenodd;fill:#000000;stroke-width:0.0pt;" d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "/>
      <path transform="scale(0.8) rotate(180) translate(12.5,0)" style="fill-rule:evenodd;fill:#FFFFFF;stroke-width:0.0pt" d="M 5.0,-5.0 L -12.5,-5.0 L -12.5,0.0 L 5.0,-5.0 z "/>
      <path transform="scale(0.8) rotate(180) translate(12.5,0)" style="fill-rule:evenodd;fill:#FFFFFF;stroke-width:0.0pt" d="M 5.0,5.0 L -12.5,5.0 L -12.5,0.0 L 5.0,5.0 z "/>
    </marker>


The result has been attached below. However, this will only work on a perfectly white background :-(. What we'd want is to clip the stroke of the line itself, or to stop the line shortly. But as I understand from the specifications the markers are drawn simply on top of the stroke and only after the stroke has been drawn, and there's no way to affect that.
Attachments
marker.png
marker.png (131.16 KiB) Viewed 6741 times

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

Re: Marker and length

Postby brynn » Mon Apr 23, 2012 5:41 am

I tried changing the miter limit too, but apparently it does not affect the markers.

dvlierop
Posts: 139
Joined: Sat Sep 08, 2007 4:25 am

Re: Marker and length

Postby dvlierop » Mon Apr 23, 2012 6:55 am

marker2.png
marker2.png (110.44 KiB) Viewed 6723 times
This illustrates the remaining problem, with the white areas that should in fact be transparent. I've tried fixing this with a filter, but haven't succeeded yet. Not that that would not be an attractive workaround anyway, because of the computational cost of the filter (which can make Inkscape crawl). I've attached the original file and the markers.svg file, should anyone be interested
Attachments
Arrow_with_custom_marker.svg
(4.04 KiB) Downloaded 147 times
markers.svg
(30.54 KiB) Downloaded 145 times

Gedep
Posts: 20
Joined: Sat Apr 21, 2012 8:58 pm

Re: Marker and length

Postby Gedep » Mon Apr 23, 2012 7:42 am

How about this for a solution:
I use my costum marker and then convert my line to a path. The two corners sticking out from under the marker become nodes, which I can move back a little, without changing the location of the marker.

Still I think it shouldn't be this hard...

User avatar
druban
Posts: 1823
Joined: Fri Nov 20, 2009 10:48 pm

Re: Marker and length

Postby druban » Mon Apr 23, 2012 10:59 am

My mistake. although it is a miter limit thing, the miter limit on that arrowhead is not editable until you do a stroke to path.... by then you could just remove the stroke and move the arrow anyway
Your mind is what you think it is.

dvlierop
Posts: 139
Joined: Sat Sep 08, 2007 4:25 am

Re: Marker and length

Postby dvlierop » Sat Oct 13, 2012 6:13 am

Someone from the SVG working group is looking into this!

See this blog: http://tavmjong.free.fr/blog/?p=646

Marker Clipping: At the moment, in order to avoid the path from showing under the tip of an arrowhead, the arrowhead must extend past the end of the path. In Inkscape, this prevents things like snapping the arrow tip to a line since the path end is not at the same place as the arrow tip. One of the SVG group members is going to work out a way to specify a clipping region for a marker that would apply to the path below thus eliminating this problem.

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

Re: Marker and length

Postby brynn » Sat Oct 13, 2012 10:21 am

Image


Return to “Help with using Inkscape”

Who is online

Users browsing this forum: No registered users and 3 guests