Friday, May 25, 2012

Improvements for the trimming tool

Today I worked on improving the Trimming tool so that when we want to trim something, we only need to click on the wire to be deleted.
Until now, trimming created a new node that was a generic trimmed wire, regardless of the shape that was trimmed and how many resulting wires we had. That wire was defined by several u-values which are now transformed in points and used to build new nodes for the resulting shapes: trimmed lines always result in lines, circles and arcs result in arcs.

The lines changes were pretty easy, but things were a bit more complicated for circles and arcs. When trimming a circle, we need to know which one it is, the minor or the major arc, and that is determined by the position of the mouse click. There was also a special case caused by the way the circle's curve is stored: an auxiliary axis is used for each circle, with the origin in the center and the first and last point on its oX. When trimming on this axis, we need to make sure that the point on oX is associated with the u-values of 0 and 2*Pi.

CSE arcs can be drawn clockwise or counterclockwise, and this affects the u-values of the extremities. When drawing clockwise, the u-values corresponding to the start and end points have an extra 2*Pi added to them, while the intersection points and mouse click don't. This led to wrong intervals and caused strange arcs to be drawn.

I will continue working on the SER arcs, see what can be done to improve spline and ellipse trimming and update the trimming unit tests.

No comments: