Thursday, April 26, 2012

Solver, logger and tests updates

Today I commited the changes I had so far for the solver, and I will prepare a detailed explanation of how the solver works for the release.

Some of the main changes are:
- The shapes are ordered in the shapesList according to the level on which they are compared to the mouse point. The list has all the points, with the mouse position last, then any other shapes and constraints.
- The parameters and constraints are kept in an OrderedDictionary, which maintains the order in which the elements are inserted (Dictionary doesn't and SortedDictionary orders the elements by key).
- When editing a shape, the points are divided in two categories: free points, which are related to the point that is currently changed, and fixed points. Related points are those points which have the same ancestor on the shape reference list.
- When editing a shape, we try to find the solution with the minimum number of changed free points.
- When adding new shapes, there are no free points.

I've updated the constraint tests for the case when the lines are parallel to the y-axis. We check if two lines are parallel by comparing their slopes, but for lines parallel to the y-axis we had division by 0 or very large numbers. I've updated the method to return double.PositiveInfinity for this case and check for this value in the tests.

I've also updated the logger to write in the AppData folder and to save messages for NaroStarter.

There are several commits for these changes; the most recent one, which has everything, is here.

No comments: