Wednesday, March 4, 2009
If you worked with a tool that does design, one of the most used features is to create shapes with exact sizes. For this in NaroCAD you may use the grid. But there are some cases you will not get enough with that. So there is a need to consider other cases like: - middle of a line, the bounds of a line, or corners of a rectangle, etc. The solution should be specific enough and generic enough also.
Right now enters in scene a new Naro compoment: the Solver. What should this solver do? It should have a set of geometry and some rules that can make processing on top of that geometry. In future it may compute the interesting geometry beyond the points, as like shape constraints, etc.
Where is this solver used? When you input your values, the solver may offer the right values to you, or it may give to you the closest point that is interesting to you, or all points. The future extensions of solver may make Naro offer more visual hints to the user.
Where is the solver used right now? The solver right now processes the interesting line points and aligns the mouse to them (magnetic points). So at least is easy to draw a triangle made by three lines right now in Naro, without a grid.
Solver design (look to picture):
The solver consists of 2 components:
- a geometry tree (that resembles OCAF tree: a tree of nodes indexed by integers and a list of unique attributes, identified by a string)
- a RuleSet that can process the geometry tree
The RuleSet may be changed depending on geometry and needs. So if you add more rules, you will get a more complete solver.
The solver may be queried every time to give the most interesting geometry closed by a defined point, and it makes it easy to make mouse align to the returned solver geometry.