From Inkscape Wiki
Jump to: navigation, search

Conceptually, most path operations can be considered as a transform from regular affine space into a curved space found by generating a matching orthonormal basis using the curve's normals:

However, as you can see from this, we also need to normalise along the length of the curve:

The difficulty comes from the fact that none of the primatives provided by inkscape are invariant under this transformation. Thus, we need to re-match a curve to the transformed polygonal approximation. inkscape already include a bezier curve fitter, but the curve fitter is unaware of corners. This turns out not to be a big problem because we can work out where the corners are and simply perform the curve fit on segments.

With this strategy we can transform almost any shape into the path coordinate system.

What things do people want? a simple offset function that moves the curve f(t) to f(t)+o*∇f(t) and the matching outline stroke function were requested on PathEstimation. Other interesting operations include:

  • mapping text to the path. This required simply rotating and translating each glyph to sit on the curve in the direction of the normal. This get a little trickier with sharp bends such as this:
  • tingham 11.21.03:: What if we have a configurable parameter for text-path mapping which states that we should split characters on curves under N degrees. This would cause characters to sit on either side of the sharper curve where the normals are more "sane". njh: This will solve the outside curve problem, there is still a problem with the inside of the curve.

  • mapping shapes to the path. At the basic level we can perform the same approach for mapping shapes to the curve, namely to rotate each and line it up with the glyphs, then translate. Or, we could map the shape properly into the appropriate curve space. This is harder, but gives more predictable results.

If arbitrary shapes are allowed to be mapped to curves, then we immediately have a way to provide stroke styles. For example:

A simple regular language can be provided to allow the artist to build more powerful styles. for example, the style (<greendiamond>(<leopardcircle><dot>)*<greendiamond>) would generate this path:

The style can include specific points to match in the curve (lengths, fractions of total, knot points). Some kind of stretchiness should be provided, most likely using the TeX glue idea. Combine this with the dynamic programming solution to line breaking and we can have text mapped to multiple curves.

Representing a style in the document probably should be implemented as a special group with the metadata specific to the style and the original path, and also a rendered version. Clearly the user needs to be able to edit the original path rather than a 'flattened' version. Clicking on the convert to curve button will 'flatten' the style path so the artist can then moving things around.

There seems to be some common ground with markers. (That is, PathOps is a superset of markers)