how is the type of node determined

This is NOT a support forum. You are welcome to discuss software issues here, but all issues should be reported on Launchpad if you want them fixed.
User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

how is the type of node determined

Postby brynn » Wed Aug 13, 2008 4:28 pm

Hi Friends,
I'm pretty sure this belongs in this forum, but if not, I'm sure it will be moved :?

Mostly I'm just curious, when one creates a shape, switch to the Node tool :tool_node: revealing the nodes -- how does Inkscape decide which type of node to use? I'm asking because I've noticed that sometimes gently curved lines contain smooth nodes, and sometimes they contain cusp nodes. But just looking at gently curving lines which are otherwise alike, it seems impossible to predict whether they will display smooth or cusp nodes. So I wonder how Inkscape determines the node type.

And a related question. I've noticed that when one deletes a smooth node, which has smooth nodes on either side, the remaining nodes, formerly smooth, become cusp. Why is that? Because it seems to me the node type should not change, unless deleting the node really does create a noticable angle. But when it's a very smooth and gentle curve, why does the node type change when the curve doesn't change?

Thanks for helping me understand this :D

User avatar
sas
Posts: 404
Joined: Sat Oct 06, 2007 5:42 am

Re: how is the type of node determined

Postby sas » Wed Aug 13, 2008 6:26 pm

brynn wrote:I've noticed that when one deletes a smooth node, which has smooth nodes on either side, the remaining nodes, formerly smooth, become cusp. Why is that?

Originally, deleting a node didn't change the adjacent nodes or their handles at all - but that usually causes the resulting curve to be a very different shape (typically much flatter) than it was before the deletion. So a new behaviour was introduced that attempts to preserve the curve shape as much as possible by adjusting the handles of the adjacent nodes - but this comes at the cost of making the adjacent nodes into corner nodes.

You can still get the original behaviour by holding down the Ctrl key while pressing Delete.

Because it seems to me the node type should not change, unless deleting the node really does create a noticable angle.

How far from 180 degrees is noticeable? Maybe this could be a preference setting.

What I would really like to see, however, is a different default behaviour: attempting to preserve the curve shape as much as possible while keeping the handles pointing in the same direction, so that smooth nodes always remain smooth. This wouldn't preserve curve shape as well as the current default behaviour, but it would be considerably less annoying.

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

Re: how is the type of node determined

Postby brynn » Wed Aug 13, 2008 10:05 pm

Well, I guess I'm not qualified to really debate the issue. I just wanted to try to understand. That said, I might also comment that preserving the shape is sometimes a pain as well. But I guess there really is no middle ground. I mean, I can see how given the same curve, some users might need the curve to be retained as much as possible, while others actually want to change the shape by deleting nodes.

Hhhm....what about putting a new button beside the Delete Nodes button, so that the user can choose whether they want to preserve the shape or not? Or set up a keyboard shortcut that does the same? Although again, not that I'm qualified for a serious debate.

You can still get the original behaviour by holding down the Ctrl key while pressing Delete.

I am glad to know about this, for sure. And by "original behavior" you mean that the adjacent nodes and handles don't change when a node is deleted, right? Or are there other aspects of original behavior?

How far from 180 degrees is noticeable? Maybe this could be a preference setting.

I guess I was initially thinking anything greater than one degree (> 1), but I do get your point. Could I really differentiate between one degree and 3? I doubt it.

I'm not sure about a preference setting, because wouldn't that affect all a user's projects? Unless they actually go and change their preference from one project, or even one object to another. I guess I'm thinking a button on the Node tool control would allow a user the most flexibility. [This is a topic for another day, but I find it annoying to have to keep the Doc Prop iconified, to access the grid, guide and snap settings. I typically change them many times per image. So going to change a Pref for work on different objects would be equally annoying, to me.][To me, and again, all my comments are from a user's perspective, as I know little about the development end of Inkscape.]

So anyway, I'm glad to know the Contol key tip, sas. Thanks for that and for your other comments.

All best :D

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

Re: how is the type of node determined

Postby microUgly » Thu Aug 14, 2008 7:43 am

I agree that I think this area has room for improvement.

I think it should be possible to preserve the path without converting a smooth node to a cusp. I can appreciate the maths may be a lot more complicated and perhaps nodes would need to move to do so. But I rarely if ever use cusp nodes so it becomes a bit of hinderance than a convienence.

I wouldn't care if when attempting the preserve the path shape, the shape wasn't preserved exactly as long as it kept the nodes smooth. This is different to when pressing Ctrl + Del because that deletes the node without adjusting the adjascent nodes at all. I think there is room for behaviour that is somewhere in the middle.

Likewise, it bugs me that simplify turns all nodes into cusp nodes. But I usually just simplify as much as I need then select them all and press Shift + S to get around that.

Simarilius
Posts: 626
Joined: Wed Jun 06, 2007 2:37 am

Re: how is the type of node determined

Postby Simarilius » Thu Aug 14, 2008 8:06 am

File a bug/feature request. Sounds like something that could do with some tweaks.


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

Re: how is the type of node determined

Postby brynn » Fri Aug 15, 2008 1:44 am

Well done!

Meanwhile, is there a simplifiable explanation about how Inkscape decides which type of node it uses? Like rectangle always use cusp (duh!) and circle always use smooth (also duh!). But what about more complex shapes, for example those created with the Paint Bucket Tool?

User avatar
kelan
Posts: 178
Joined: Thu Sep 06, 2007 12:55 am
Location: Unicorn of Open Source
Contact:

Re: how is the type of node determined

Postby kelan » Fri Aug 15, 2008 3:43 am

brynn wrote:Well done!

Meanwhile, is there a simplifiable explanation about how Inkscape decides which type of node it uses? Like rectangle always use cusp (duh!) and circle always use smooth (also duh!). But what about more complex shapes, for example those created with the Paint Bucket Tool?


Actually a circle doesn't always use smooth nodes. Make a circle and then do Path -> Object to Path. Three of the nodes are smooth, but one is cusp.

Thinking about it, I'm a bit surprised that Inkscape-generated shapes ever have smooth nodes. Since cusp nodes can technically be used in every situation, it would be easier to make the user convert any nodes to smooth that they wanted smooth. There's probably just some heuristic in the code that when the handle angles are close enough to opposite, make the node smooth. However, the heuristic may have other aspects, too, that aren't obvious but are not met sometimes, which is why we see a converted circle with a cusp node. Or it may just be a bug that hasn't mattered enough to anyone to fix.

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

Re: how is the type of node determined

Postby microUgly » Fri Aug 15, 2008 7:39 am

brynn wrote:But what about more complex shapes, for example those created with the Paint Bucket Tool?

That's a good question. I thought it may have always used cusp nodes but testing now I see a mixture. Looking at my object I can't see any reason why it chose to use cusp in some places and not others. Perhaps it is a qestion that can only be answered by a developer.

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

Re: how is the type of node determined

Postby brynn » Fri Aug 15, 2008 1:26 pm

Perhaps it is a qestion that can only be answered by a developer.

Ok then. That's good enough for me. It's not important enough that I want to bother the developers. I tend to be curious about things I don't understand, it seems that's my nature. But in this case, it sounds like the answer is going to be more technical than I could really understand. So no problem. Good discussion and now there's a new feature request, as well!

Thanks for everyone's comments :D


Return to “Discuss Software Issues”