Today we released a new version of NaroCAD, which includes all the changes of the past month:

- Added constraints for points, circles, arcs and their combinations (an overview of all existing constraints is here)

- Added the fixed point constraint

- Added point to point constraint

- Added point to edge constraint

- Improved the Solver speed

- Fixed the code that handles constraints removal

- Fixed property grid bugs

- Added the posibility to view existing constraints (per shape or entire sketch)

You can download NaroCAD 1.6.7 here.

For the next release we'll work on improving the Solver's solution finding algorithm and processing speed.

## Thursday, July 26, 2012

## Wednesday, July 25, 2012

### Solver speed improvements

Over the last few days I did some investigations and improvements to the SolverRef method.

I did tests with several shapes and constraint combinations, and for each set of changes I compared the performance using a saved file and changing just one value, in the property grid. This ensured that I was comparing the performance on the same steps.

Here is one of the cases I tested:

When changing the height of the main rectangle (where the mouse cursor is) the performance of the old code is:

There are 21 calls to the Solver method, and most of the time was spent accessing array values and calculating the constraints. The main problem is that most of the matrices have the number of rows with non-zero elements equal to the number of free points, and total row/column count equal to the number of constraints.

After limiting the number of processed rows, checking for zero values used in multiplications and using the 'rough' convergence (1e-8 instead of 1e-10), the results improved significantly:

There are more improvements to be done for constraint calculation, and I want to investigate more efficient ways of doing the multiplications considering that they're most of the time sparse matrices.

I did tests with several shapes and constraint combinations, and for each set of changes I compared the performance using a saved file and changing just one value, in the property grid. This ensured that I was comparing the performance on the same steps.

Here is one of the cases I tested:

When changing the height of the main rectangle (where the mouse cursor is) the performance of the old code is:

There are 21 calls to the Solver method, and most of the time was spent accessing array values and calculating the constraints. The main problem is that most of the matrices have the number of rows with non-zero elements equal to the number of free points, and total row/column count equal to the number of constraints.

After limiting the number of processed rows, checking for zero values used in multiplications and using the 'rough' convergence (1e-8 instead of 1e-10), the results improved significantly:

There are more improvements to be done for constraint calculation, and I want to investigate more efficient ways of doing the multiplications considering that they're most of the time sparse matrices.

## Wednesday, July 18, 2012

### Fixed point constraint fixes

Today I fixed two problems with the fixed point constraint. Now it's possible to view existing constraints after they've been added and they can be removed by clicking the point a second time.

I've also fixed a bug in the line editing handler action which didn't revert the line points to the original position if no solver solution was found.

You can find the changes here

I've also fixed a bug in the line editing handler action which didn't revert the line points to the original position if no solver solution was found.

You can find the changes here

## Tuesday, July 17, 2012

### Point to edge constraint and constraint viewer

Today I improved the property grid, added the possibility to view the existing constraints on the sketch or the selected node and improved the point to edge constraint. Tomorrow I'll work improving the point to edge constraint speed and bug fixing.

## Monday, July 16, 2012

### Arc improvements and point to edge constraint

I've imrpoved the arc angle constraint and added an arc panel for the property grid. The property grid now displays the arc radius, start and end angle (in degrees). The arc angle soft constraint is not fully fixed because we still need to project the point that wasn't modified by the solver and that affects the angle value.

I've also worked on implementing the point to edge constraint. For this constraint, a new point is added on the target edge, obtained by projecting the point on the edge. The resulting line (the original point and the projected point) should have a constant length and be perpendicular on the edge in the intersection point for the constraint to be satisfied. For a line this is easy to implement, and for other shapes we need to find the line that is tangent to the edge in the projection point and use that for the perpendicular constraint.

I've also worked on implementing the point to edge constraint. For this constraint, a new point is added on the target edge, obtained by projecting the point on the edge. The resulting line (the original point and the projected point) should have a constant length and be perpendicular on the edge in the intersection point for the constraint to be satisfied. For a line this is easy to implement, and for other shapes we need to find the line that is tangent to the edge in the projection point and use that for the perpendicular constraint.

## Thursday, July 12, 2012

### Removing constraints

Today I fixed the code that removed soft constraints if no solution was found after they were added and fixed the code that allows the removal of generic constraints and the line length constraint.

The changes are here

The changes are here

## Wednesday, July 11, 2012

### Point to point constraint

Today I updated the point to point constraint to use the existing line length constraint (which I've modified to take any two points from the scene) and draw a Dimension for it.

Tomorrow I'll do some more testing, fix bugs and fix the code that handles the removal of existing constraints.

Tomorrow I'll do some more testing, fix bugs and fix the code that handles the removal of existing constraints.

## Tuesday, July 10, 2012

### Line Lenght Constraint and Point to Point Constraint

Until now we had several ways of defining and displaying the distance between two points, with or without a constraint. Today I started changing the code so that we only use two elements for these:

- distance between two points constraint, which is effectively the current line length constraint

- the dimension function which displays the distance.

This way we'll be able to use the new constraint format and call the solver on all changes and display the length independently of the old Execute method. For now I've modified the code that adds a line length constraint and tomorrow I'll add the logic for the point to point constraint.

- distance between two points constraint, which is effectively the current line length constraint

- the dimension function which displays the distance.

This way we'll be able to use the new constraint format and call the solver on all changes and display the length independently of the old Execute method. For now I've modified the code that adds a line length constraint and tomorrow I'll add the logic for the point to point constraint.

## Monday, July 9, 2012

### Property grid improvements

Today I added the arc start and end angle soft constraint, but it needs some more tweaking because of the way the solver modifies the arc points.

I've continued my investigation on the point to point constraint: it currently works for some cases, but because of the way the references are passed, doesn't work correctly for shapes which are already in a constraint.

I also fixed the property grid editing event, so that any changes are processed through the solver:

I've continued my investigation on the point to point constraint: it currently works for some cases, but because of the way the references are passed, doesn't work correctly for shapes which are already in a constraint.

I also fixed the property grid editing event, so that any changes are processed through the solver:

## Friday, July 6, 2012

### Line and arc radius soft constraints

Today I added the soft constraints for line length and arc radius. There are still some small problems for the line tangent to an arc constraint, but the resize visible in the original video is not quite as bad. I'll continue working on this and add the arc angle soft constraint.

As the problem was most obvious with concentric arcs, I recorded a video that shows the concentric arcs constraint applied without and with the arc radius soft constraint. All soft constraints will be applied automatically; if adding a soft constraint causes the sketch to be over defined, it will not be used.

As the problem was most obvious with concentric arcs, I recorded a video that shows the concentric arcs constraint applied without and with the arc radius soft constraint. All soft constraints will be applied automatically; if adding a soft constraint causes the sketch to be over defined, it will not be used.

## Thursday, July 5, 2012

### Circle and arc constraints

Today I fixed the arc constraint solve problem: as the solver only modifies the minimum number of values needed to find a solution, only one of the arc points was modified and updated, leaving the end point of the arc unchanged. I've added a fix that projects the end point on the new arc, obtaining the correct end point. The changes are here.

I started investigating the 'soft constraints' that would allow the shapes keep their main attributes (line length, circle and arc radius, arc start and end angle) after the solver is called. There are some constraints for line length and circle radius, but they're using the old structure and can't be used by the current solver, so the next step is porting these to the new structure.

I also recorded the constraints videos for the last two shapes:

The current constraints for circles are:

- concentric circles

- circles with equal radius

- point on circle (shown in the point video)

- line tangent to circle

The current constraints for arcs are:

- concentric arcs

- arcswith equal radius

- point on arc (shown in the point video)

- line tangent to arc

The current constraints for arcs and circles are:

- concentric arc and circle

- arc and circle with equal radius

I started investigating the 'soft constraints' that would allow the shapes keep their main attributes (line length, circle and arc radius, arc start and end angle) after the solver is called. There are some constraints for line length and circle radius, but they're using the old structure and can't be used by the current solver, so the next step is porting these to the new structure.

I also recorded the constraints videos for the last two shapes:

The current constraints for circles are:

- concentric circles

- circles with equal radius

- point on circle (shown in the point video)

- line tangent to circle

The current constraints for arcs are:

- concentric arcs

- arcswith equal radius

- point on arc (shown in the point video)

- line tangent to arc

The current constraints for arcs and circles are:

- concentric arc and circle

- arc and circle with equal radius

## Wednesday, July 4, 2012

### Point constraints

Today I finished making the fixes for the parameters array, checked all the constraints and added the point on circle constraint. There is something wrong with the arc drawing after a constraint is applied, and the start point position isn't correctly displayed (the new correct position is used only when we start editing the shape). I'll fix this tomorrow.

Today's changes are here.

The current constraints for point shapes are:

- point on point

- point on line

- point on line midpoint

- point on arc

- point on circle

For now the editing behaviour for the point on circle and point on arc is different - in one case dragging the point moves the point, in the other it changes the radius. I'll return to this when the arc drawing issue is fixed.

Today's changes are here.

The current constraints for point shapes are:

- point on point

- point on line

- point on line midpoint

- point on arc

- point on circle

For now the editing behaviour for the point on circle and point on arc is different - in one case dragging the point moves the point, in the other it changes the radius. I'll return to this when the arc drawing issue is fixed.

## Tuesday, July 3, 2012

### Line constraints fixes

Today I realised there was a problem with the way the shapes are mapped to the parameters array and had to revert some of the code commited after the 1.6.6 release. The problem is that by mapping the shapes and their points, the order of the points returned from the DocumentToSolverAdapter is lost and the Solver doesn't update the correct values.

I've reverted to the initial code, where the points are stored and the constraint shapes reference the points, and fixed the lines constraints. I've made a list of all the checks for line constraints and recorded the current behaviour for all of them:

- a rectangle can be rotated and resized by dragging a corner

- we can add constraints to existing lines:

- after drawing parallel lines and fixing a point (adding a constraint point) dragging the other point causes the other line to be updated so that the constraint is maintained.

I've reverted to the initial code, where the points are stored and the constraint shapes reference the points, and fixed the lines constraints. I've made a list of all the checks for line constraints and recorded the current behaviour for all of them:

- a rectangle can be rotated and resized by dragging a corner

- we can add constraints to existing lines:

* parallel * perpendicular * horizontal * vertical * equal length * collinear- after drawing two parallel lines, any of them can be moved/resized by dragging any of the points

- after drawing parallel lines and fixing a point (adding a constraint point) dragging the other point causes the other line to be updated so that the constraint is maintained.

## Monday, July 2, 2012

### Updates to the constraints

Today I continued working on the constraints, updated the Fixed Points constraint to use the new structure and as all the constraints are converted, removed all the old code. There is still some cleaning up to do, but it involves more complex changes and I'll leave that until all the constraint issues are fixed.

I've also started working on the distance constraint, but before continuing with that I'll work on setting some 'soft' constraints to force line length to be kept if possible when solving (in this video you can see how the line being dragged changes size even if it doesn't have to).

You can find the changes here

I've also started working on the distance constraint, but before continuing with that I'll work on setting some 'soft' constraints to force line length to be kept if possible when solving (in this video you can see how the line being dragged changes size even if it doesn't have to).

You can find the changes here

Subscribe to:
Posts (Atom)