Fillet Tools: a small JOSM plugin for rounding corners

@darkonus has shared his first pre-alpha version of the JOSM plugin, which allows you to round the corners of lines and polygons. He asks that you try it out and provide feedback.

15 Likes

Thanks to @andygol for starting the topic.

Over the last week, stability has been improved and the styling has been slightly refined. Circles no longer include an inner dot, and the native JOSM crosshair and move cursors are now used. Points are now pre-rendered along the arc, making it easier to understand how many segments will be created.

ezgif-5c7d358cac88e979

ezgif-591c6e3f85355966

The latest build of the plugin is available at the link below:

FilletTools.jar

For those who tested the previous version: please make sure to delete the old file first, as the new build has a slightly different name.

4 Likes

FilletTools is now available for installation in JOSM through the plugin list in the settings. If you tested the first version, the file was named fillettools.jar, so please go and manually remove it from the folder. This is to avoid duplicate files — the file is now named FilletTools.jar.

In the latest version, it is possible to round off corners at the junction point of two lines while preserving the node history. Thanks to @Paul_Berry for the feature suggestion.

ezgif-817c5349d0d013bd

Thanks everyone for the feedback.

6 Likes

Nice little tool! Now using it regularly.

I have been looking for a similar but slightly different smoothing tool, for ways that represent curves but were drawn with too few nodes. I spend way too much time just entering intermediate nodes to make it look round (not circular, though).

Could that be an idea for an addition to the tool?

1 Like

Thank you! I see exactly which feature you mean. I’ve been experimenting with something in that direction, but so far, I’m not quite satisfied with the results. Specifically, I’m struggling to find the right balance between the smoothness of the resulting line, the number of nodes, and the degree of deviation from the original line. If I manage to get it working properly, I’ll definitely add it.

1 Like

My thoughts were:

Don’t move existing nodes, only add intermediate nodes.

Start with the first three nodes (first triangle) of the selected way

Basically halving the corners which exceed x (10?) degrees, by inserting a node in the middle of the first leg of the triangle.

If a node was inserted, restart from the node before the inserted node. Else move up the starting point one node.

a.s.o until the end.

So there is no complicated curving to perform. Bézier can rest in piece.

About smoothness (value of x): If I create a circle in JOSM with shift-O, it should have twice the nodes to be smooth enough (40 instead of 20). I have no idea what the angle is.

PS just saw the angle measurement tool in JOSM. Have been ignoring that all this time!
In the shift-O circle with 20 nodes, the angle is about 20 degrees, and I think there should be 40, so a 10 degree angle would suffice. A crudely drawn rounded corner with three nodes would become a 7 node corner. For a roundabout way, a slightly better rounding gives a better visual on maps. So I’d say x=8 degrees would give fine results for most cases I can think of.

I’m actually trying to do this with Bézier: convert a polyline into a smoothed curve and then back into a polyline. :)

In any case, whether it works or not, I’ll post about it here. Thanks for sharing your ideas.

1 Like

An update on FilletTools.

The plugin now includes the first version of a new mode: Smooth Trace.

Smooth Trace turns a freehand stroke into a smooth way. It can reshape part of an existing way or create a new one, including closed ways.

If you’re interested in trying it out, I’d appreciate any testing and feedback.

Controls:
D — activate mode
Enter / double-click — apply stroke
Esc — cancel
Alt — switch between reshape and create new way
Shift + mouse wheel — rewind stroke and redraw tail

I like rounded corners ;) but I am worried that this, especially the newest addition, will lead mappers to do pretty painting and not count inflation over and above what is justified by available imagery. Like someone who measures their height with a tape measure and their weight with a household scales and then says their BMI is 22.3473622251423.

I think that, unless we have very precise aerial imagery (and reason to believe that the trees are actually still in precisely the form they were in when the image was taken), we should leave the beziering of natural features to renderers. Click here for a blast from the past.

2 Likes

Thanks! Quite a high early evaluation. I very much doubt that my plugin, still in a rather rough early stage, is able to lead mappers anywhere :slight_smile:

Moreover, this is not the first tool of this kind in the plugin list.

Tried it, nice tool but not for me, because my freehand drawing is nowhere near good enough, and have the impression that other mappers are even worse in this respect. Or they are even lazier than I am. My use case is smoothening ways that have been too crudely drawn, where the existing nodes are correct but just too few.

1 Like

Thanks very much for the feedback. I designed this mode with the idea that it’s more valuable when the mapper actively tries to draw the line where it should actually go, rather than just smoothing it afterward. Here, the Bézier curve is only an attempt to average out the imperfections of the mouse as an input device. I personally find it much easier to draw smooth curves with a pen or pencil than with a mouse (maybe because the school I went to taught cursive writing to everyone by default :)).

I tried another approach — it’s still very rough, so I haven’t published a new version of the plugin yet. Would something like this smoothing method work for you?

ezgif-82a1cded2c2fa76d

Yes it looks like it would!

Version 0.3.0 with Smooth Section mode has been released and is available for installation/update via the JOSM preferences plugin list.

The mode can be enabled through the menu, the side toolbar, or with the keyboard shortcut Ctrl+G / Command+G.

If the curve deviates too far from the way, hold the Shift key and scroll the mouse wheel to adjust how strongly it bends.

Double-clicking applies the smoothing.

Smooth Section mode in action

Tried the new tool. TBH: it is useful onely in a minority of cases. In my regular cases, just adding intermediate nodes by hand works better, sorry. Nice try though, maybe it’s easy to adjust.

What I tried:

Smoothing a circle of too few nodes.
Maybe I need more practice, but I can’t make the tool handle the whole circle, and it won’t add nodes outside the “circle”, instead it removes and moves correct nodes, making the circle worse. So I still need to put nodes at all the pluses, move them just a tad outward, then hit O; which I feel could be automated fairly easy.

1 Like

Is that in JOSM? There is the w tool to easily move nodes with a single click, but also add nodes with a crtl-click. It is very convenient to align paths e.g. with a terrain model where under canopy so often off quite a bit. Use of this tool only gets difficult, when the original way is mapped with lots of nodes, it will become hard to catch the right node to move. So I try to get by with no additions, if possible, to not make life harder for the next person.

2 Likes

w Ctrl-click-click-click… helps speed up the process of adding nodes, thanks. In the circle, this tool still requires manually adding all intermediate nodes one by one, then round the full circle with O.

I am looking for automation of a tedious repetetive task, not adding exact precision. For instance in the circle, a tool which adds all the intermediate nodes is more helpful than the exact positioning, because I can do that with a single O, but since such a tool would need to process and split all the angles, it might as well calculate the exact position for the inserted node.

For a winding or curving way, reducing the angles all along the way is automation. The problem there is mainly that some angles are to be excluded, simply because they represent real angles in the way. Probably the tool would allow the user to optionally select a start node and an end node, if not selected then process the whole way.

This process would assume that existing nodes correctly represent the real curves, just with low precision. The mapper needs to ensure that before applying the tool, and maybe add small refinements afterwards using tools like the w tools and the fillet tools.

are you aware of the method to create a single way, 2 nodes, shift+O creates a circle, you can set the number of nodes in the settings

I like the plugin.

I am getting used to using the Trace Smooth Curve tool for road alignment.

I would like the Spacebar to have the same function as the right mouse button click, similar to the FastDraw plugin.

Thank you! Perhaps you meant the left mouse button? That is, as long as the spacebar is held down, the line should be drawn?