Difference between revisions of "SpecFilletChamfer"

From Inkscape Wiki
Jump to navigation Jump to search
Line 14: Line 14:
== Design ==
== Design ==
=== User Interface ===
=== User Interface ===
In terms of implementation, the filleting tool must be implemented as a first class citizen along with the rest of the toolbox - having a tool commands toolbar, a cursor, status messages etc., just like other tools. In terms of the UI for activating the tool - this could be added as another icon in the toolbox, but it might be better to hide the tool away in a well chosen location (discuss), so as not to clutter the toolbox with a new tool that is really very specialist.
In terms of implementation, the filleting tool must be implemented as a sub-feature within the node edit tool. With the node tool selected, the user will select a series of points that they would like to fillet. The user will the click the fillet button in the node context toolbar.


To fillet a corner, the user will first select the object to modify, then activate the fillet tool, then click on the cusp point with the mouse. It might be possible to show a preview of the fillet as the user hovers over the point with the mouse. It might also be possible to add a button in the tool commands bar that fillets all the corners in a shape.
With this fillet-tool-button clicked, and the an interractive fillet mode activated. The node edit context toolbar will change to a fillet toolbar. The fillet-tool-button will remain present on the toolbar, but will be shown depressed while in the filleting in mode. An edit box with spinner will be placed in the tool commands bar so that the user can choose the radius for the numerically. At the same time a handles will be shown on the canvas to allow the user to edit the radius interactively.


An edit box with spinner will be placed in the tool commands bar so that the user can choose the radius for the fillet.
Once the user is happy with the fillet the result can be committed by selecting a different tool or clicking fillet-tool-button on toolbar so as to un-depress it. To cancel the user can press Esc, or can apply the change then Undo.


It might be helpful (discuss) to give the choice between placing a full circle object into the corner, a tangential arc object of the fillet, or actually filleting the corner with an arc which will modify the parent path to replace the cusp.
It might be helpful to give the choice between placing a full circle object into the corner, a tangential arc object of the fillet, or actually filleting the corner with an arc which will modify the parent path to replace the cusp.


This tool could give the option to chamfer the corner - where instead smoothing the corner with an arc, the corner is smoothed with a straight line - simply snipping the tip off.
This tool will give the option to chamfer the corner - where instead smoothing the corner with an arc, the corner is smoothed with a straight line - simply snipping the tip off.
 
A good starting point for this tool would be the code from the node editor tool, because it already has UI code for selecting of nodes in a path. Code from this tool can be used, to fillet when the user clicks on a point.


=== Back End ===
=== Back End ===

Revision as of 23:17, 6 February 2008

Launchpad Entry: https://blueprints.launchpad.net/inkscape/+spec/fillet-tool

Summary

The filleting tool will allow the user to replace the cusp of a corner on a path, with a rounding arc of specified radius. This is rather simple to the way we can round off the corners rectangles, but for arbitrary geometry.

Note that this proposed tool will only work on corners in individual paths - not on the intersections of the strokes of separate objects.

Release Note

Rationale

A fillet/chamfer tool is useful for technical drawings where fillets and chamfers are needed often, and smoothing corners in artwork.

Design

User Interface

In terms of implementation, the filleting tool must be implemented as a sub-feature within the node edit tool. With the node tool selected, the user will select a series of points that they would like to fillet. The user will the click the fillet button in the node context toolbar.

With this fillet-tool-button clicked, and the an interractive fillet mode activated. The node edit context toolbar will change to a fillet toolbar. The fillet-tool-button will remain present on the toolbar, but will be shown depressed while in the filleting in mode. An edit box with spinner will be placed in the tool commands bar so that the user can choose the radius for the numerically. At the same time a handles will be shown on the canvas to allow the user to edit the radius interactively.

Once the user is happy with the fillet the result can be committed by selecting a different tool or clicking fillet-tool-button on toolbar so as to un-depress it. To cancel the user can press Esc, or can apply the change then Undo.

It might be helpful to give the choice between placing a full circle object into the corner, a tangential arc object of the fillet, or actually filleting the corner with an arc which will modify the parent path to replace the cusp.

This tool will give the option to chamfer the corner - where instead smoothing the corner with an arc, the corner is smoothed with a straight line - simply snipping the tip off.

Back End

The illustration below shows the steps involved in filleting the corner of a path:

Fillet.png

Filleting a corner is a 3-step process. First, the centre point for the arc must be calculated (X and Y in fig 1 and fig 2a). Second, the arc's sweep must be calculated so that it merges with the parent path at the tagents (fig 2b). Third, the point of the corner must be snipped off, and the arc welded on (fig 2c).

All shapes must be converted to paths before filleting can occur.

Finding point X is mathematically trivial. Finding Y is very much harder, and will require a numerical solution to a set of simultaneous equations. Note that there could potentially be more than one possible solution (as shown in fig 2a), so the closest solution to the cusp along the the length of bezier should be selected.

More ideas

See [1]

TODO

Discussion

Existing Code?

  • Q: Does anyone know of any existing code in the codebase that makes these sorts of calculations? So as to avoid reinventing the wheel and duplicating code?