Mobile app version of vmapp.org
Login or Join
Turnbaugh909

: How to put one object both in front and behind another object at the same time? I've attempted (as a test) to make a circle with a bar going through it. The bar should go under one side

@Turnbaugh909

Posted in: #Inkscape

I've attempted (as a test) to make a circle with a bar going through it. The bar should go under one side of the circle and over the other.

I've done this by splitting the circle into two objects, however there are visible seams where the split was done, even though the paths match up exactly.



Also, the shadow under the left part of the circle doesn't go on top of the bar like it ought to, and I can't think of any way to fix this without splitting the shadow object too.

Is there a better way to do this?



If needed I can also upload the svg.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Turnbaugh909

1 Comments

Sorted by latest first Latest Oldest Best

 

@Turnbaugh909

The gap you see is due to an imperfect rendering by Inkscape and not necessarily a problem depending on how you export or use your SVG (as long as you cut precisely). The shadows however will likely cause problems, when cut up (which is the only way I can think of to make them right).

Here is my solution to this. As an example, I cut up a plain bar, because it’s easier. But cutting up the outer circles has some advantage, which I will mention later. First an image:



The left uses transparent objects (one blue, one red) for demonstration, the right shows the result.


In the top, I reproduced what you did and just cut my bar. This leads to the aforementioned gap on some zoom levels or pixel exports (it may also happen in some PDF renderers or similar).
In the middle, I let the two halves of the bar overlap, which avoids the gap but lets the bar appear slightly thicker around the cut (you may have to zoom in to see this).
In the bottom, I used what I recommend to do¹. The biggest overlap is half the bar’s width. I could not find any zoom level or export for which this produced an undesired aliasing effect (i.e., a gap or a thickened bar).


Now, let’s have a look at the shadows:



The order is the same as above. On the right, we have the shadows alone for better illustration.


The shadow for the simple cut looks okay, but we can see, that it’s somewhat weaker at the cutting position. This becomes more of a problem for fuzzier shadows.
In the middle, we have a significant problem.
In the bottom, we can make out the position of the cut, but the shadow is neither weaker nor stronger, just distributed differently. In particular, it does not get any worse, if the shadow gets fuzzier. The cut is even less visible, if it does not happen on a straight segment, which is why it may be advantageous better for you to cut the circles instead of the middle bar.




¹ You can achieve this as follows:


Make the cut as normal.
Add a node in the middle of each cut edge.
Move each node outwards by one quarter of the width² of whatever you cut.


² For this value, I empirically found the distortion of the shadow to be lowest.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme