Node Bevel - a feature in search of a programmer

Flesh out your ideas for new or improved Inkscape features before submitting a request.
User avatar
druban
Posts: 1917
Joined: Fri Nov 20, 2009 10:48 pm

Node Bevel - a feature in search of a programmer

Postby druban » Thu Apr 04, 2013 7:08 am

I was about to make a post to a thread about rounding angular corners after also having recently replied to a thread about concave corners when I realized that what we really need is a "Bevel Node" button in the :tool_node: control bar that automatically does all these steps I do manually! So here are my suggestions.
bevelButton.png
bevelButton.png (1.71 KiB) Viewed 10936 times


This is how I see it working:

You select a Node or nodes (this button should probably only be active for cusp nodes); the "Bevel" button will have a checkbox for flat or curved and a 'Radius' spinbox (that's a numerical entry box with up/down arrows) next to it for the value to bevel with. If the flat option is checked then the radius value is only used for the distance to move the new nodes from the original node's position. If the flat option is unchecked, then the nodes will be moved and the path curved, convex for positive and concave for negative radius values.

Each selected node will be split into two (joined nodes) and each one moved along the existing path in opposite directions for the distance specified in "Radius". The radius of the arc itself would have to be calculated from the tangents to the path at each node.
Last edited by druban on Fri Apr 05, 2013 2:35 am, edited 8 times in total.
Your mind is what you think it is.

User avatar
ragstian
Posts: 1181
Joined: Thu Oct 11, 2012 2:44 am
Location: Stavanger-Norway

Re: Can you create a rectangle with 2 rounded corners?

Postby ragstian » Thu Apr 04, 2013 8:20 am

Hi

For something like this?
Image

RGDS
Ragnar
Good Luck!
( ͡° ͜ʖ ͡°)
RGDS
Ragnar

Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Re: Can you create a rectangle with 2 rounded corners?

Postby Lazur » Thu Apr 04, 2013 8:50 am

There is a way to draw something alike in most cases, mostly automatically.
That is like, adding a line with of r, then converting the outline to path, uncombining it and adding a line width of r to the smaller path, with rounded edges style,
then converting the outline to path.
It points out the difficulties of how many nodes each bevel curve should have, and where would they placed.

And, another thought: beveled paths can be "constructed" automatically that way.
But what's with reversing it?
How could line width added to a path, and the corners maintain the curve to the end on the outer edge arch?
"Sharp" path corners use straight lines to extrapolate the missing parts. Guess changing that would take deep modification in the svg standard.
Attachments
ftr3.png
ftr3.png (11.24 KiB) Viewed 10929 times

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

Re: Can you create a rectangle with 2 rounded corners?

Postby druban » Thu Apr 04, 2013 9:59 am

ragstian wrote:For something like this?


Hi Ragnar, I was thinking along the lines that the extra Node in the middle of the segment or arc would actually not be necessary, and that a 'radius' of 0 would be a flat bevel, >0 would be a convex bevel and <0 would produce a concave bevel as this post originally was about. This is pretty easy to do with simple node editing but it would be nice to have as a button.
Were you planning on writing a little code, Ragnar? Thanks in advance! :lol:
beveldiagram.png
beveldiagram.png (24.4 KiB) Viewed 10871 times
Last edited by druban on Fri Apr 05, 2013 2:54 am, edited 4 times in total.
Your mind is what you think it is.

User avatar
ragstian
Posts: 1181
Joined: Thu Oct 11, 2012 2:44 am
Location: Stavanger-Norway

Re: Can you create a rectangle with 2 rounded corners?

Postby ragstian » Thu Apr 04, 2013 11:32 am

Hi druban

I like your figures - shadows and all! (don't tell the moderator (SWMBO :D ) I said this!! :D )

Your idea of how to implement this is good apart from the one with the bevel (r=0),
how far from the corner to place the nodes? All CAD programs (that I know of) "needs" a "chamfer size".
In addition it would be nice to have different sizes on the horizontal and vertical edge as well.
I am really surprised this has not been implemented in the "core" inkscape yet as it must be
one of the most requested CAD-like (Computer Aided Design) features.
(This is not a complaint -I am impressed with the developers work!! )
Were you planning on writing a little code, Ragnar? Thanks in advance!

Might have a go at writing an extension ;)
Don't hold your breath waiting for it! - The "upside/down" coordinates in SVG
and Inkscape gives me a headache!!
(The decision to have "origo" in the upper left corner must have been made in collaboration with the guys who
"invented" the "degree,minutes and decimal minutes" - way of writing latitude and longitude!!

RGDS
Ragnar
Good Luck!
( ͡° ͜ʖ ͡°)
RGDS
Ragnar

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

Re: Node Bevel - a feature in search of a programmer

Postby druban » Fri Apr 05, 2013 2:42 am

ragstian wrote:Your idea of how to implement this is good apart from the one with the bevel (r=0),
how far from the corner to place the nodes? All CAD programs (that I know of) "needs" a "chamfer size".


Good catch, Ragnar, I mixed two different conceptions here without noting the conflict. I have corrected the drawing so there is no conflict anymore and I'll pop the quote in here too:
druban wrote:You select a Node or nodes (this should only be active for cusp nodes) and the "Bevel" button will have a 'Radius' spinbox (that's a numerical entry box with up/down arrows) next to it for the value to bevel with, and a checkbox for flat or curved. If the flat option is checked then the radius value is only used for the distance to move the new nodes from the original node's position. If not then the nodes will be moved and the path curved either convex for positive radii or concave for negative values.


An extension would be fine but it would be cooler to have it on the control bar! You can do it! ;)

controlbar.png
controlbar.png (8.98 KiB) Viewed 10830 times


I'm sure you have all the math down already but here are two threads that might be helpful (although I contributed to both) in formulating an approach.
Finding a bisector and Rounding a corner.
Your mind is what you think it is.

User avatar
RobA
Posts: 335
Joined: Fri Aug 10, 2007 1:22 am

Re: Node Bevel - a feature in search of a programmer

Postby RobA » Fri Apr 05, 2013 4:38 am

There is a CAD blueprint: http://wiki.inkscape.org/wiki/index.php/CAD
and a GSOC project to implement some CAD features: http://wiki.inkscape.org/wiki/index.php ... echDrawing

I believe some were available if you build Inkscape yourself, enabling the experimental stuff...

EDIT: Here was a (old) post on this subject: viewtopic.php?t=2110&f=28

-Rob A>

Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Re: Node Bevel - a feature in search of a programmer

Postby Lazur » Fri Apr 05, 2013 9:39 am

Taking another look at the idea.
Cannot construct bevels accurately for curved paths. How would you implement that?

Setting tangent r as an input parameter for the bevel would need two other parameters, if described by r,
and would cause problems with the setting of the minimum size of the r as it differs with each bevel field.
Image
Style: O=in, arc=in, r>r tangent should be avoided as it cuts out the bevel arch's starting points.
Flat bevels could be achieved with two style setting, so
a spiro-like input would be better: tangent r length, and control point position.

Image
Attachments
ftr3II.svg
(119.69 KiB) Downloaded 431 times

User avatar
ragstian
Posts: 1181
Joined: Thu Oct 11, 2012 2:44 am
Location: Stavanger-Norway

Re: Node Bevel - a feature in search of a programmer

Postby ragstian » Fri Apr 05, 2013 12:14 pm

Hi Lazur URH

Now I understand what "flamingolady" means when she talks about "tech" and "artsy" user types!
Nice idea by the way. Might be difficult to program!

RGDS
Ragnar
Good Luck!
( ͡° ͜ʖ ͡°)
RGDS
Ragnar

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

Re: Node Bevel - a feature in search of a programmer

Postby druban » Fri Apr 05, 2013 1:17 pm

I'm sorry if I did not understand at all what you were trying to say, and upon several readings it still remains completely impenetrable.

A very wild guess is that you have mistaken my idea to mean that the radius value I proposed should also double as the radius of the arc constructed on the corner. This would almost never be the case for non-right angles although I would not want to go out on a limb and actually say impossible.

Another guess is that you think the same arc radius should work for every node in a path, which would also be very unlikely. The radius of the arc rounding the corner would have to be derived from a construction (using two tangents) far less hair-raising than the ones implied by your illustrations.

Are you saying that concave corners would not be continuous with the curve before and after? This I completely agree with. The only way to construct concavity would be to make the rounded corvexity and then reflect the circle across the endnodes. No other interpretation, to me, could be anything but random. My verbal description of the process is sorely lacking, I fear.

The final illustration seems to imply that a curve can have several tangent circles at the same point, a phenomenon possible in mathematics of a much higher order than I can claim familiarity with. Did you look at the various methods proposed elsewhere in this forum for manual solutions to the rounding problem using geometric construction, only two of which I provided links for in my incurable laziness? I shall take another look at them to see if I can find any obvious error in them.... I felt it sufficient to provide a link to the thread that shows a way - (mine, therefore perhaps inaccurate) of how to construct an arc that rounds a corner to a particular size, rather than repeat the whole tedious explanation.

I repeat again that I have not understood your post, so do not take it as a criticism. Rather please assume that I am just not smart enough to understand your point and that as I pore over it the realization will come over me like glorious dawn overtaking a lumbering rhinoceros on the african veldt.

P.S. Maybe Ragstian will explain it to me since he seems to have understood it right away! :D
Your mind is what you think it is.

Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Re: Node Bevel - a feature in search of a programmer

Postby Lazur » Fri Apr 05, 2013 3:34 pm

druban wrote:...A very wild guess is that you have mistaken my idea to mean that the radius value I proposed should also double as the radius of the arc constructed on the corner. This would almost never be the case for non-right angles although I would not want to go out on a limb and actually say impossible. ...


The image shown in the second post of yours in the topic has the writing r=/=0 at the flat bevel, and two curved ones with r>0 and r<0.
I thought of it as you give r as a basic input to your bevel tool.
I assumed that every bevel method as you mentioned -positive or inverse, and the flat one- was managed by the r, they should work with the same method.
Thus I was thinking of it as r<o is an incorrect form. No lenght, no curvature can be less then zero, so I came up with the solutions on my first image of that post.

druban wrote:...Another guess is that you think the same arc radius should work for every node in a path, which would also be very unlikely. The radius of the arc rounding the corner would have to be derived from a construction (using two tangents) far less hair-raising than the ones implied by your illustrations...


Thinking of the actual use, how would you make any user to use only paths with straight lines, and avoid selecting more nodes than one at the same time?
I think it would be a fair to expect that from a tool like that.

druban wrote:...Are you saying that concave corners would not be continuous with the curve before and after? This I completely agree with. The only way to construct concavity would be to make the rounded corvexity and then reflect the circle across the endnodes. No other interpretation, to me, could be anything but random. My verbal description of the process is sorely lacking, I fear....


I wasn't thinking of concave corners yet.

druban wrote:...The final illustration seems to imply that a curve can have several tangent circles at the same point, a phenomenon possible in mathematics of a much higher order than I can claim familiarity with. Did you look at the various methods proposed elsewhere in this forum for manual solutions to the rounding problem using geometric construction, only two of which I provided links for in my incurable laziness? I shall take another look at them to see if I can find any obvious error in them.... I felt it sufficient to provide a link to the thread that shows a way - (mine, therefore perhaps inaccurate) of how to construct an arc that rounds a corner to a particular size, rather than repeat the whole tedious explanation.


There can be only one exact tangent in this case.
I didn't look for constructing tangent circles for curved paths. That would be impossible to do in an accurate way of its nature.
Bezier splines are approximations of points rendered to the actual display, and, drawing tangents to it would need the knowledge of every point with curvatures.
Anyway, constructing tangent circles to circles can be complicated geometrically alone.

That many circles on the image that might made you think that was about to show more bevel options.
By the positive, flat and inverse rounded corners, comes a question of how the inverse corners would be presented.
As, they have little visual connection with the positive rounded bevels, I was thinking, why not to have an option of different outsetting of the arch's origo?
Then again as I tried to describe above thinking of origos and radiuses is not an efficient way of making such a bevel, as there would be problems with the minimal and with the maximal radius lengths.

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

Re: Node Bevel - a feature in search of a programmer

Postby druban » Fri Apr 05, 2013 6:16 pm

OK I understand much better now! Your points are well made indeed! There are very definitely many situations where a node is asymmetric and curved, the rounding solutions for such points must also necessarily be asymmetric.
The rounding option I was proposing was only in reference to a node with straight line segments leading in and out of it.
I should have made that more clear, because the programming solutions for curved and asymmetrical paths become nontrivially difficult! Your last illustration appeaed to show straight line paths going in and out and that's what led me to believe you were offering tangent solutions. The manual construction of a solution is quite challenging and i'm not even sure there is a solution, although limiting solutions to quadratics may be the answer. The programming solution might well consider 'circularity' as a criterion for choosing between all the solutions that satisfy the tangent requirement. what do you think?

rect7371.jpg
Inaccurate but close quadratic solution
rect7371.jpg (178.24 KiB) Viewed 10708 times


I feel that this method is perhaps not as precise as you might want but has the advantage that it could be translated into a simpler bit of code since the intersecting tangent method could be applied to symmetrical curved nodes and straight segment nodes as well.

In any case i think i understand your point now and thanks for bringing up such an interesting problem.
Your mind is what you think it is.

Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Re: Node Bevel - a feature in search of a programmer

Postby Lazur » Sat Apr 06, 2013 3:03 am

I didn't know about that draw tangent LPE.
Looks similar to the draw handles extension.
Well if any two points are given on a path with its tangents, you can always precisely construct tangent ellipses from them.
Using Rytz-construction.
http://www.ceometric.com/support/examples/v-ellipse-projection-using-rytz-construction.html
Besides that, the basic bevel idea seemed about to create circular tangent curves to the corners, which would take different method in selecting the starting and end points.
That is, by constructing parallel curves to the basic path, to construct the origos of the arches . Which I tried to give an easy way to achieve in my first post.

Also, about your last post one can think that you want the bevel tool to be able to work as the rounded corners used by the rectangle tool.
Which is, far more complicated than constructing tangent circular lines.

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

Re: Node Bevel - a feature in search of a programmer

Postby druban » Sat Apr 06, 2013 11:04 am

Thanks for the link to the Rytz page and especially for the code snippet. Now Ragnar can just drop that into his Inkscape branch. You are a great source of info! :lol:

I did not know about the Rytz construction but I did something similar by copying the two axes from the diagram and shearing an ellipse in a rectangle to snap to them. (Sorry for using the 'S' word!) :lol: One could as well use a transform matrix to do this, since it is just a shear to be copied between objects of the same proportions.

Lazur URH wrote:Looks similar to the draw handles extension.


That would make sense, wouldn't it, since hadles for smooth nodes are tangent to the curve. But the LPE does much more, because it computes a tangent to any point on the curve, not just nodes. I'm very fond of it. :)

Lazur URH wrote:Besides that, the basic bevel idea seemed about to create circular tangent curves to the corners, which would take different method in selecting the starting and end points.


I still did not understand I guess because I thought you were trying to say that smoothly continuous circular paths were not possible in the case of asymmetrical curved paths leading into the node, and I agreed. I do not think it is possible to find a circular rounding solution to every kind of node. Naturally I am prepared to be corrected.

Lazur URH wrote:Also, about your last post one can think that you want the bevel tool to be able to work as the rounded corners used by the rectangle tool.


No, i am sorry to have been unclear once again. The rounded corner rectangle is part od the SVG standard and can be read as such by a renderer. All other changes to paths have to be done as node edits. To be perfectly clear, i was envisioning this feature to be a button on the nodetool control bar rather like the merge nodes or break nodes into two buttons, i.e. you select a node and press the button which applies an edit to the path automatically, not in an interactive way. Like all other node edits once you move on you can't return to the original condition without undoing everything that follows, i.e. it's not an editable parameter associated with the object. Like stroke width or rounded corners on rectangles. I hope I'm still not being confusing. i'm not an SVG standards expert anyway.

Since I'm not doing the coding I don't really want to go on about it, but it doesn't have to do a whole lot of things for it to be quite functional, IMHO.
Your mind is what you think it is.

Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Re: Node Bevel - a feature in search of a programmer

Postby Lazur » Sat Apr 06, 2013 8:13 pm

Glad you liked that Rytz-construction. It can be handy in some ortographic drawing situations.
Maybe that could be implemented as a modify path extension.

I still couldn't find that tangent LPE, I use the basic tools too much I guess.
Speaking of the snapping tool I would use it all the time if it worked in all casesbut I just can't seem to get it right.

About the ellipse archs in the corners: I know its in the svg standards only for the rectangle, but
the function of it could be copied -or should be followed?
Guess it would raise far more questions to answer that it is not a good idea to include it in a bevel tool.

BUT if there would be a bevel tool existing, it would be more than necessary to set the length of the tangent circle arch's radius.
What if you wanted to add different sized bevels to the same path? Would you edit it in the preferences every time?

User avatar
flamingolady
Posts: 687
Joined: Wed Jun 10, 2009 1:40 pm

Re: Node Bevel - a feature in search of a programmer

Postby flamingolady » Sun Apr 07, 2013 4:39 am

well, I finally had to stop reading the posts as they went WAY over my head (though I did smile that Ragnar understands when I keep saying artsy vs techie), I probably should not even step foot to post in this thread, as when I saw Lazur's circles, all I could think of was my college trig class where the professor drew about 100 circles on the board trying to explain trig, and I could swear my brain tore open and fell apart right there and then (and then it turned out that trig was sort of/kind of simple, if he hadn't of made it so hard).

Anyway - I just wanted to thank all of you'll for attempting this!!!!! I am so very excited at the prospect of a concave rectangle that I just had to pop on really quick to say it! yee-hawwww! This forum rocks!

v1nce
Posts: 696
Joined: Wed Jan 13, 2010 4:36 am

Re: Node Bevel - a feature in search of a programmer

Postby v1nce » Wed Apr 10, 2013 9:31 am

angle.jpg
angle.jpg (33.83 KiB) Viewed 10541 times


Sorry my comment went off. Too lazy to rewrite 'em now.

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

Re: Node Bevel - a feature in search of a programmer

Postby druban » Wed Apr 10, 2013 4:28 pm

Vince! You understand perfectly! You da l'homme.
Your mind is what you think it is.

User avatar
Maestral
Posts: 982
Joined: Sat Aug 27, 2011 7:10 am

Re: Node Bevel - a feature in search of a programmer

Postby Maestral » Thu Apr 11, 2013 12:34 am

@ v1nce
Chapeau bas!
:tool_zoom: <<< click! - but, those with a cheaper tickets should go this way >>> :!:

v1nce
Posts: 696
Joined: Wed Jan 13, 2010 4:36 am

Re: Node Bevel - a feature in search of a programmer

Postby v1nce » Thu Apr 11, 2013 7:28 am

It sounds like the image was self explanatory.

After I drew the whole thing, I finally remembered where I saw this stuff
It's in xara extreme http://www.xaraxtreme.org/ (Linux GPL version) and probably in xara designer tools family http://www.xara.com/eu/products/ (Windows closed & commercial)
As Linux version is GPL, one can have a look at source code to see how it's done.
The -1;+1 scale used is intuitive, but the algorithm could be not what we're after : if you look at 0.5 figure this is not a "real" circle, the "tangents" are not tangents anymore


I attached some screenshots.
You can see on the left there are two sliders. The second could be used to make the shape look like a sigmoid (or step response). Probably not usefull in our case coz it supposed there's a privilegied direction (one node matters more than the other)

xara.jpeg
xara.jpeg (37.08 KiB) Viewed 10480 times

Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Re: Node Bevel - a feature in search of a programmer

Postby Lazur » Thu Apr 11, 2013 8:21 am

This one looks different than the previous.
It's more like some superellipses.
http://mathworld.wolfram.com/Superellipse.html


Return to “Inkscape Ideas”