Home
Categories
Dictionary
Download
Project Details
Changes Log
FAQ
License

ShapeNormalizer


    1  Algorithm
    2  Example
    3  Limitations
    4  Notes
    5  See also

The ShapeNormalizer class converts a Shape to a list of simple Shapes[1]
Bezier Curves will be converted to list of Arcs
The class uses internally a CurveConverter to convert CubicCurve or QuadCurve shapes. Note that this class correctly takes into account disconnected paths in the Shape.

Conversion of full-circle arcs will be made to Ellipse2D only if ShapeNormalizer.allowCircles(boolean) is set with the true argument.

Algorithm

Main Article: CurveConverter

The class will try to approximate each CubicCurve and QuadCurve to:
  • A line if the curve is flat
  • The closest Arc if the curve is not flat

Consecutive CubicCurve or QuadCurve can form an unique Arc if their center and computed "radius" are close enough.

Example

Suppose the following GeneralPath constructed with a series of moveTo, lineTo, and curveTo:
shapenormalizer1
After conversion, we have the following result (in red superposed to the original shape):
shapenormalizer2

Limitations

Main Article: CurveConverter

Notes

  1. ^ Bezier Curves will be converted to list of Arcs

See also


Categories: geom | packages

Copyright 2006-2024 Herve Girod. All Rights Reserved. Documentation and source under the LGPL v2 and Apache 2.0 licences