| 1 |
h1. Introduction |
| 2 |
|
| 3 |
This manual focuses on the lib2geom computational geometry framework. |
| 4 |
The main goal of this framework is the eventual replacement of |
| 5 |
Inkscape's multiple and shoddy geometry frameworks. As with any decent |
| 6 |
module or lib, 2geom is designed to achieve the desired functionality |
| 7 |
while maintaining a generality encouraging usage within other |
| 8 |
applications. The focus on robust, accurate algorithms, as well as |
| 9 |
utilization of newer and better representations makes the lib |
| 10 |
very attractive for many applications. |
| 11 |
|
| 12 |
h2. Design Considerations |
| 13 |
|
| 14 |
2Geom is written with a functional programming style in mind. |
| 15 |
Generally data structures are considered immutable and rather than |
| 16 |
assignment we use labeling. However, C++ can become unwieldy if |
| 17 |
this is taken to extreme and so a certain amount of pragmatism is |
| 18 |
used in practice. In particular, usability is not forgotten in the |
| 19 |
mires of functional zeal. |
| 20 |
|
| 21 |
The code relies strongly on the type system and uses some of the more |
| 22 |
'tricky' elements of C++ to make the code more elegant and 'correct'. |
| 23 |
Despite this, the intended use of 2Geom is a serious vector graphics |
| 24 |
application. In such domains, performance is still used as a quality |
| 25 |
metric, and as such we consider inefficiency to be a bug, and have |
| 26 |
traded elegance for efficiency where it matters. |
| 27 |
|
| 28 |
In general the data structures used in 2Geom are relatively 'flat' |
| 29 |
and require little from the memory management. Currently most data |
| 30 |
structures are built on standard STL headers, and new and delete are |
| 31 |
used sparingly. It is intended for 2Geom to be fully compatible with |
| 32 |
Boehm garbage collector though this has not yet been tested. |
| 33 |
|
| 34 |
h2. Toy-Based Development |
| 35 |
|
| 36 |
We have managed to come up with a method of library development |
| 37 |
which is perfect for geometry - the development of toys exemplifying |
| 38 |
a feature while the feature is perfected. This has somewhat subsumed |
| 39 |
the role of tests, and provides immediate motivation/reward for work. |
| 40 |
|
| 41 |
!media/gear.png! |