# [−][src]Crate beziercurve_wkt

# beziercurve-wkt

## About

This libary exists because PostGis (current version 12.0) does not support Bezier curves. However, keeping data in tables is still very useful. It's also sometimes necessary to have a human-readable format of Bezier curves. So instead of keeping the data in a binary format, the data is kept in string format and this libary provides a serializer / deserializer for it.

The string format for Bezier curves looks like this:

BEZIERCURVE((0.0 1.0, 2.0 1.0), (2.0 1.0, 46.0 20.0, 0.0 0.0), (0.0 0.0, 40.0, 47.0, 50.0 30.0, 2.0 1.0))

The parser looks at the points and determines the type of point by its length:

(x1 y1, x2 y2) -> Line from p1 to p2 (x1 y1, x2 y2, x3 y3) -> Quadratic bezier curve from p1 to p3 with control point p2 (x1 y1, x2 y2, x3 y3, x4 y4) -> Cubic bezier curve from p1 to p4 with control points p2 and p3

The reason for duplicating the point on each "item" / section is so that the BezierCurve can be constructed in parallel, if necessary.

Additional to serialization / deserialization, this library features tools to:

- calculate the bounding box of a curve (necessary for calculating intersection of curves using a quadtree)

# Work in progress

- calculate intersection(s) between curve-curve and curve-line
- calculate the angles of intersections (necessary for ex. to put texts on curves)
- cutting curves

# License

MIT

## Structs

Bbox | |

BezierCurve | |

BezierCurveCache | |

BezierNormalVector | |

CurveIndex | |

Point |

## Enums

BezierCommand | |

BezierCurveItem | |

InfiniteIntersections | When two curves are the same, they have infinite intersections Currently, this is treated the same as having no intersections |

Intersection | |

IntersectionResult | |

ParseError | |

ParseErrorWithContext |

## Type Definitions

CubicCurve | |

Line | |

QuadraticCurve |