[solved] help understanding path operations

Post questions on how to use or achieve an effect in Inkscape.
User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

[solved] help understanding path operations

Postby brynn » Sun Aug 24, 2008 9:10 am

Hi Friends,
Oh those deceptive path operations! They sound so logical, but in practice, I find them SO confusing. Here are 4 screen shots of a spirograph path I'm working on:
(If they're taking up too much space or bandwidth for the forums, let me know and I can just use links to them)
# 1
Image
# 2
Image
# 3
Image
# 4
Image

# 1 shows the 2 paths. I want to have the part of the spirograph path beneath the pink circle disappear. At 1st I thought, use Difference, or I thought Exclusion might work also. # 3 is the result of both.

Why does it actually subtract a larger area than what the pink circle covers?
Why does it show a stroke where the pink circle was, when the pink circle actually has no stroke?

The rest of the images show my experiments to try and understand. I expected Union would show the whole spirograph path, plus a circle stroke for the pink circle. But instead, I got # 2, which is close to the result I want, and close to what I expected from Difference. Why does adding them (Union) actually appear to subtract them?

I expected Intersection to show the spirograph path which appears below the pink circle only. Instead, the result is # 4. Why does it take the whole spirograph path away?

PLEASE don't tell me I've got another bug....unless you have to :mrgreen:
But seriously, I'll appreciate any comments :D


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

Re: help understanding path operations

Postby brynn » Sun Aug 24, 2008 2:01 pm

Oh geez!
Serious?
Ok, it's a fairly large one, because I'm playing around with Spirograph. But I've got just the path in question inside the page border. So you should only get the one, if I understand how the uploading works. Here's a link to the svg file:

http://www.petaimg.com/uploads/1219596555.svg

Thanks micro

User avatar
microUgly
Site Admin
Posts: 2985
Joined: Sat Jun 02, 2007 3:13 pm
Contact:

Re: help understanding path operations

Postby microUgly » Sun Aug 24, 2008 3:12 pm

Bah! Sorry, I can't access PetaIMG. I don't know what it is but I suspect the service is blocking me.

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

Re: help understanding path operations

Postby brynn » Sun Aug 24, 2008 8:57 pm

Yeah, it seems you've had thist trouble with petaIMG before. Anything I can do to help with this? Unfortunately, it's the only way I have of uploading .svg's Could I email it to you? Or else maybe someone else will have a look?

User avatar
microUgly
Site Admin
Posts: 2985
Joined: Sat Jun 02, 2007 3:13 pm
Contact:

Re: help understanding path operations

Postby microUgly » Mon Aug 25, 2008 10:36 am

Off topic:
brynn wrote:Anything I can do to help with this? Unfortunately, it's the only way I have of uploading .svg's

There are lots of other file hosting sites. Most won't allow you to hotlink the file like PetaIMG does though. MediaFire is one that does not require registration to use. It seems the number of free file hosts has dwindled since I last looked.

Since there is no practical reason why I should not be able to access a file on PetaIMG I'll probably pull it from the list recommended hosts. It's not much good if we don't have confidence that everyone can access them. I'm sure it's an unintended bug with their system but there's no mechanism to report it.

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

Re: help understanding path operations

Postby brynn » Mon Aug 25, 2008 4:09 pm

Off topic:
Since there is no practical reason why I should not be able to access a file on PetaIMG I'll probably pull it from the list recommended hosts. It's not much good if we don't have confidence that everyone can access them. I'm sure it's an unintended bug with their system but there's no mechanism to report it.

Off topic:
Oh, I'd hate to see you not recommend it, since petaIMG is my only option of offering svg files to be examined. Granted I could still use it, whether you recommend it or not. What about including a comment after their name in the list of svg hosts, that some people are unable to access files hosted there?

Didn't you see this? http://www.petaimg.com/contact.php Can't you report it here? I would think they would be willing to help you troubleshoot, if you identify yourself, and let them know you'd like to keep recommending them, if only they can find the conflict. Is this a reasonable idea?

I'd be glad to take the lead on reporting and troubleshooting, since I have a stake in using it. It would be awfully complicated to have all your communications go through me, though. But I'll be glad to do anything I can to help you with this. Just let me know.

User avatar
microUgly
Site Admin
Posts: 2985
Joined: Sat Jun 02, 2007 3:13 pm
Contact:

Re: help understanding path operations

Postby microUgly » Mon Aug 25, 2008 6:26 pm

Off topic:
I've initiated contact with them. Why is MediaFire not an option for you?

User avatar
microUgly
Site Admin
Posts: 2985
Joined: Sat Jun 02, 2007 3:13 pm
Contact:

Re: help understanding path operations

Postby microUgly » Mon Aug 25, 2008 6:59 pm

Ok, it seems after 24 hours I can access the files--so back to the topic.

The reason why you get the shape you get is because operations like "difference" is performed on the enclosed area. If you apply a fill to your spiralgraph you'll see see the enclosed area as:
Image
All the lines are thrown out and you're left with just the lines that define the area. I suspect this is "by design".

What you want to do is "cut" the lines using the appropriately named "Cut Path" function. I think you'll figure out how to use it once you try.

These are complicated shapes. If you don't get the result you expect you may find the maths is correct but your understanding of it is not.

Oh geez!
Serious?
Ok, it's a fairly large one, because I'm playing around with Spirograph.

Why didn't you copy and paste the object in question into it's own document and upload that?

User avatar
EarlyBlake
Posts: 302
Joined: Tue Jun 03, 2008 5:42 pm

Re: help understanding path operations

Postby EarlyBlake » Tue Aug 26, 2008 1:58 am

You could post the number of corners, the spoke ratio and the rounded on the star. That would be a way around down loading the svg file. I have problems looking at svg files also.

Difference did not take out a wider area than displayed for me. It was spot on to what was displayed for both filled and unfilled areas. I did not even have to convert the objects to paths before I did the difference operations. I tired it on a 27 point start. What build are you using? And what was the stroke width on the path you used for the boolean operation. Cut is buggy, especially on curved sections of paths.

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

Re: help understanding path operations

Postby brynn » Tue Aug 26, 2008 5:14 am

I'm sorry this has been so frustrating. But I do appreciate your help and your patience :D

The reason why you get the shape you get is because operations like "difference" is performed on the enclosed area.

But the area I'm trying to remove IS in the enclosed part.
Image

You could post the number of corners, the spoke ratio and the rounded on the star. That would be a way around down loading the svg file. I have problems looking at svg files also.

I didn't use the Star shape to make this, I used the Spirograph Effect. That said, it IS a good idea that I could've posted the parameters of the spirograph path, if I still had them. Unfortunately, one cannot select a path made with the spirograph, to reveal the settings used. I guess if you want to remember them, you have to write them down. (I would submit a feature request, but doubt it would receive a very high priority, if any.)

EarlyBlake, you said it works properly for you -- is that on the svg I uploaded, or is that on a star shape? Yes, difference works as I expect on a star shape.

I did experiment with Cut Path, and Division as well (I tried everything, hoping to reveal clues to the problem.) Cut Path breaks it up into a bazillion teeny shapes. I'm not sure if I would be able to delete the right ones or not. But it's an option I may try, for sure. At this point, I'm thinking of adding nodes, breaking path and deleting the area I want.

Division also breaks it up into lots of little pieces, different pieces than Cut Path, and removes the same portion removed by Difference as well. But as I've said, it's not removing the portion under the pink circle.

I'm starting to get the feeling this is another bug :cry:

Why is MediaFire not an option for you?

Registration is not a problem. It's because of the security settings I use for IE 7. There is some evidence that file sharing may put me at risk. And otherwise, I don't use or need file sharing. If this problem with petaIMG continues, it may well prove to be worth the effort to DL Firefox, and go ahead and switch to the Firefox browser when I need to use MediaFire (because Firefox lacks this vulnerability). Can SVG's be viewed with Firefox? If so, maybe I'll get Firefox anyway...

Why didn't you copy and paste the object in question into it's own document and upload that?

I was lazy :mrgreen: ...Do you think the size of the image contributed to the problems you had opening the file? I didn't think it mattered, but if it does, I won't be so lazy next time.

It seems the number of free file hosts has dwindled since I last looked.

I wonder why? My understanding is that vector graphics is the rising star of the graphics world. Is it especially difficult to host SVG's?

User avatar
EarlyBlake
Posts: 302
Joined: Tue Jun 03, 2008 5:42 pm

Re: help understanding path operations

Postby EarlyBlake » Tue Aug 26, 2008 5:52 am

I used the star shape. I never even noticed the Spirograph in the effects menu before. What can you get with the Spirograph effect you can't get with the :tool_star: ?

User avatar
microUgly
Site Admin
Posts: 2985
Joined: Sat Jun 02, 2007 3:13 pm
Contact:

Re: help understanding path operations

Postby microUgly » Tue Aug 26, 2008 10:48 am

EarlyBlake wrote:What can you get with the Spirograph effect you can't get with the :tool_star: ?

I don't think any of the example on this page can be created with :tool_star: - http://wiki.inkscape.org/wiki/index.php/Spirograph

User avatar
microUgly
Site Admin
Posts: 2985
Joined: Sat Jun 02, 2007 3:13 pm
Contact:

Re: help understanding path operations

Postby microUgly » Tue Aug 26, 2008 11:34 am

brynn wrote:
The reason why you get the shape you get is because operations like "difference" is performed on the enclosed area.

But the area I'm trying to remove IS in the enclosed part.

That's right. You just said what I said. You are applying a difference to an enclosed area and the result is exactly what we expect.

There is no problem with this picture. It can't preserve the lines in the centre when those lines don't define the fill area.
Image

This picture shows the result of selecting the spirograph in step 4 and applying Union to it resulting in step 5. All the lines in the middle disappear because they don't define the fill area. I'm showing this to re-inforce the previous example.
Image

This is what you want (I think you owe me a beer for find this). In step 7 I've changed changed the option on the Fill palette to show holes where paths overlap. Now all those lines in the middle DO influence the fill area. In step 8 I've applied Union to the spirograph which doesn't create a visual difference, but it's changed the object so the lines no longer overlap (even though they look like they do). Step 9 shows the result of applying a difference to the spirograph from step 8.
Image

It might not makes sense, but everything I've just shown behaves exactly as it should. There are no bugs here. There is an area where things could be improved though. If you repeat steps 7 to 9 and ignore step 8 you'll end up with the same object as in 3 and 6. Perhaps difference should take into account the show holes option as union does.

I'm exhausted now...

User avatar
EarlyBlake
Posts: 302
Joined: Tue Jun 03, 2008 5:42 pm

Re: help understanding path operations

Postby EarlyBlake » Tue Aug 26, 2008 11:59 am

LOL I you could have just said shrink the circle you are using to do the difference with and I think can get what you want :lol: You have to kind of hunt and peck around. It seems like very other row of intersections encloses a space so you can get the result you are looking for if you circle lands there.

User avatar
microUgly
Site Admin
Posts: 2985
Joined: Sat Jun 02, 2007 3:13 pm
Contact:

Re: help understanding path operations

Postby microUgly » Tue Aug 26, 2008 2:11 pm

EarlyBlake wrote:LOL I you could have just said shrink the circle you are using to do the difference with and I think can get what you want :lol:

That's not correct. Shrinking the circle simply makes the hole smaller when you apply the difference--it doesn't change the effect.

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

Re: help understanding path operations

Postby brynn » Tue Aug 26, 2008 7:07 pm

Image
I'd buy you a beer any day, micro. You've helped me SO much, both by personally answering my many Image, and by running these forums so impeccably. I hope I will someday be able to "give something back", in some way.

:shock: OMG!
I'm just barely following the part about the fill area. Are you saying that the path operations basically are only recognizing the part of the path I've outlined in hot pink (excluding from discussion, for the moment, the "daisy petals")? Because the parts of the path under my light pink circle are not recognized as defining the fill area?

Image

That's confusing, because it's all the same single path! And shouldn't a 'path' operation operate on the path, rather than the fill? Maybe that's what you mean by
There is an area where things could be improved though.

So when I change the fill rule setting for holes where path overlaps, I get this

Image

I may still have a problem though. Can we just confirm the steps and the results? Using your format, starting with #1, doing Union, I get #2. It's no different than before I change the fill rule setting (see original message above).

Image

That looks different than your #8, where you've applied Union to the same path. I'm using 0.46, the last stable version. Am I doing something wrong? Is it a difference between versions?

Off topic:
What can you get with the Spirograph effect you can't get with the :tool_star: ?

:o Oh, the spirograph effect is amazing! I loved the Spirograph toy when I was a kid, and I'm loving the Inkscape version as well. I don't know if the SVG I linked (petaIMG) shows my whole file or just the one we're talking about. But I could send you a copy of this file, if you're interested. I must have 20 or 30 spirograp paths, and they're just the tip of the iceberg! Although none of them are as cool as the samples micro linked us to.

User avatar
loonquawl
Posts: 135
Joined: Thu May 15, 2008 7:57 pm

Re: help understanding path operations

Postby loonquawl » Tue Aug 26, 2008 7:59 pm

Hm. With me it works as advertised. 8-)

First, select the spirogram. Fill -> Fill holes.
Then select the circle, press Shift, select the spirogram, and Use Union (Or Difference).

User avatar
microUgly
Site Admin
Posts: 2985
Joined: Sat Jun 02, 2007 3:13 pm
Contact:

Re: help understanding path operations

Postby microUgly » Tue Aug 26, 2008 8:32 pm

brynn wrote: Are you saying that the path operations basically are only recognizing the part of the path I've outlined in hot pink (excluding from discussion, for the moment, the "daisy petals")?

Yes. At least, it's a way to think about it.
brynn wrote:That's confusing, because it's all the same single path! And shouldn't a 'path' operation operate on the path, rather than the fill?

Yes, but the fill influences what Inkscape tries to cut away. If an area cannot be filled with colour it cannot be cut away. If it can be filled with colour then inkscape must preserve the path around that area so it remains to have colour. Inkscape can't create the following object because you can't fork a path, so it instead creates what you've seen:
Image

Can we just confirm the steps and the results? Using your format, starting with #1, doing Union, I get #2.

Do the union with ONLY the spirograph selected, not the spirograph and circle. You're doing a union on one object only.

User avatar
microUgly
Site Admin
Posts: 2985
Joined: Sat Jun 02, 2007 3:13 pm
Contact:

Re: help understanding path operations

Postby microUgly » Tue Aug 26, 2008 8:36 pm

loonquawl wrote:First, select the spirogram. Fill -> Fill holes.
Then select the circle, press Shift, select the spirogram, and Use Union (Or Difference).

You did that and got the shape above numbered 9 (not 3 or 6)? Are you using 0.46 or a development build of 0.47?

User avatar
loonquawl
Posts: 135
Joined: Thu May 15, 2008 7:57 pm

Re: help understanding path operations

Postby loonquawl » Tue Aug 26, 2008 9:10 pm

I did that with the Apr1 build of 0.46 on XP. -> I did not use the same spirogram, though, because i still can't access the site it is hosted on. I created a spirogram that has a lot of self-overlappings, though, and the problems are the same as described by Brynn, if i simply try to do a "Difference".

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

Re: help understanding path operations

Postby brynn » Wed Aug 27, 2008 5:52 am

Do the union with ONLY the spirograph selected, not the spirograph and circle. You're doing a union on one object only.

Oooooooohh! I didn't get that part.

The good news is that I have finally gotten the result I wanted! The not necessarily bad news, but not quite good either, is that when I apply Union to the spirogram alone, I don't get the same result you do. But still, when I apply Difference to both the Unioned spirogram and pink circle, I get what I want.

Wow, it's going to take me some time to understand effectively what we've covered.

So you came up not only with changing the Fill Rule, you also thought of applying an operation to one path alone -- brilliant!! Here's some more beer Image (need more? I've got an endless supply, lol!) How did you ever think of applying a path operation to only one path? In general, what kind of circumstances might call for a path operation on only one path? I have a very basic kind of understanding of the Fill Rule stuff, but the path operation on only one path, it just sails right on over my head!

Do we need to worry about me not getting the same result as you, for Union on the spirogram only? Should we discuss it, to round out this discussion for other potential readers of this topic thread? I'm thinking it's probably due to our different versions. What do you think?

Off topic:
...because i still can't access the site it is hosted on.

I'm sorry you're having so much trouble loonquawl. Is there anything I can do to help? Of course it's up to you whether to contact them about your problems, but it might strengthen the gravity of the issue, in case petaIMG is unaware of it.

I guess my biggest concern is that
1 - There are so few hosts available for SVG's.
2 - Inkscape users, or graphic artists in general my have their systems set up similarly, such that they can't access the petaIMG files. If this is the problem, they could significantly increase, potentially, the number of people using them to host SVG's, by resolving this problem. Therefore, petaIMG should have a significantly vested interest in resolving these issues.
3 - And because I need to use them, or else go and get a new Firefox browser and switch over to use it for the file-sharing type of host.

In any case, if it would be helpful for me to contact petaIMG as well, for either one of you (or both), I'll be glad to do it.

Oh geez, now I can't access the file either (although I could after I uploaded it). Well good then, I have an opportunity to share my concerns with them as well!

Sorry this is getting so wordy. But I see from petaIMG's blog that they have just switched to a new host, as of August 19th, so maybe there are some kinks they need to work out?


Just to make sure I've done everything I can do, I've uploaded the image again. Who knows, cross fingers Image
Here's the new link: http://www.petaimg.com/uploads/1219847417.svg
And at this moment, I've been able to open it. And yikes, you do get the whole bunch of spirograms I've made :oops: OK, another lesson learned!

Sorry this got to be so long, this reply AND the whole thread. But I do appreciate everyone's efforts, especially microUgly. And I hope the main content of this thread will be helpful to others. (And maybe we'll help petaIMG as well.)

Good work, everyone! And many, many thanks for everyone's time and attention to this problem :D

[Edit -- PS, I'll be sure and post my final image to the Show It Off forum. I'm thinking of doing a collage of spirograms....but we'll see what I can do :mrgreen: ]


Return to “Help with using Inkscape”