# Lib2geom Goals

## Contents

## Functionality

This section outlines 2geom's domain - what it will do, and current state.

This is actually more of a class outline than features. A lot is implemented for the classes below, in current state, and certainly much more is possible (arguably infinite, but most would be out of the scope of the project).

## Current State

### Basic geometric primitives

Point and D2<T> provide the classical two dimensional point. A rectangle is a D2<Interval>, a 2d parametric polynomial is a D2<SBasis>. Most operations are lifted from T automatically, so for example, a matrix multiply applied to a Rect produces the smallest rect that would contain the result.

Matrix provides a 2D affine transformation(scale, rotate, translate). There is also a NR:Matrix which provides general linear algebra (using blas etc).

Polynomials (SBasis and Bezier) which can be cheaply transformed between basis. There are many operations on polynomials, ranging from traditional arithmetic (+, -, *, /), through higher functions (sin, sqrt) to geometric operators (unit_vector, curvature).

There are paths with various operations like intersection and bounding.

There are special geometric types like Circle, ConvexHull and Ray with optimised representations and operators (intersection, nearest point, roots).

## To do list 2009

- Clothoid support (clothoids where the curvature is a not-necessarily linear function, perhaps piecewise SBasis, add fitting)
- Special geometric shapes (stuff like circles, oriented rectangles, spirals, triangles, regular polygons, inkscape-like polygons, etc)
- Constraint system for advanced handle stuff

- complete and tidy up intersection apis
- complete offset implementation: at this stage only the hard part has been implemented
- conic sections: we currently support line and ellipse from xAx form, add parabola and hyperbola; intersection
- NURBS (2geom handles division approximation of polynomials, code just needs to be added to convert between standard forms (say x/w, y/w in bernstein and pw<d2<sb>>(t))
- T-mesh form for 2D (and higher?) piecewise polynomials
- enhance contour tracing algorithm (sb-2d-solver)
- transform an svg stroke in an outline (extends offset curve code to handle SVG options)
- variable width curve tracing (variant on path along path idea)
- collinear tangent (find a line that smoothly connects two curves); extension of bezier clipping idea
- tranform a path into a single curve (fitting) - improvements required
- exploiting modern architecture features (cache coherence, multi-core, packet instruction set, gpgpu)
- finish boolops (use faster and more robust sweep-window algorithm, add support for dB @ dB, dB @ B, B @ B where @ is any of the 16 boolean operators that make sense)
- bucket fill (variant of bool ops for bucket filling)
- path topology and numerical soundness graph

## Design Decisions

- Small, algebraic objects (Point/Matrix) will be mutable, whereas large objects like a pathset will be immutable. <justification here>
- We are using an original development method we've dubbed "Toy Driven Development". Under this process graphical toys are implemented which allow playing with the features of the library.