Friday, September 28, 2012

Released NaroCAD 1.6.8 Beta

Today we made an important release version at Naro: NaroCAD 168. The main feature of this version is a new solver.

The constraints from scene are not displayed graphically yet, they currently can be seen with the Constraint Shapes tool from the Constraints tab. A constraint can be added or removed manually by the user with the Sketch Constraints tool.

Changes at 1.6.8:

Improved the existing Solver algorithm and added a new one
Replaced existing constraint error functions and added gradient functions
Added matrix and vector helper classes to simplify the Solver
Fixed circle constraints bugs
Fixed property grid editing for ellipse
Fixed tooltip display bug
Fixed floating point comparison bug
Refactored the Solver and constraints code and fixed dependency issues
Updated the constraints unit tests

You can download NaroCAD 1.6.8 here.

Thursday, September 27, 2012

New Solver

Aside from unit tests and individual constraint checks, we're using several 'scenarios' to test that the solver is finding good solutions:

Foating point comparison bug

While testing the new solver I found that in some cases, the solver behaved differently in debug and release mode. it turned out that the cause was the way floating point comparisons were done in some helper classes, using == instead of comparing the difference to a very small value.

Here's the behaviour without the fix, in release mode (the red line shouldn't be moving):

and after the fix:

The changes are commited here.

After some more reading I found Jon Skeet's article about .NET and floating point comparison where he mentions that the cause of the debug and release differences is JIT optimisation: in debug the JIT doesn't make as many optimisations and the == comparison returns true.

Wednesday, September 26, 2012

Ellipse property grid and tooltip fixes

Today I fixed the ellipse property grid bugs, and it's now possible to modify the major and minor radiuses and lock their values. If the typed major radius is smaller than the minor radius, the two values are automatically switched:

I've also fixed the tooltip displaying bug - the hinter helper text is displayed only when the mouse is in the correct position and it's removed immediately afterwards.

Friday, September 21, 2012

Solver and constraints updated

Today I commited the changes for the solver, constraints and all the fixes I did since I started working on the new solver. Here is a quick overview of the changes:
- updated error calculation for constraints
- added gradient calculation for all constraints
- added a new solver algorithm and improved the existing one
- added matrix and vector helper classes
- improved the solver classes structure
- updated unit tests
- fixed some circle constraints bugs

There are some minor issues to fix and then we'll have a release, probably at the beginning of next week.

Friday, September 7, 2012

Circle constraints bug fixes

Over the past few days I fixed some bugs that I found when testing the new Solver algorithm.

It's now possible to lock and unlock the circle radius from the property grid:

and the shapes that are connected to a circle through a constraint can be changed: