com.caffeineowl.graphics.bezier
Interface QuadFlatnessAlgorithm

All Known Implementing Classes:
ConvexHullFlatnessAlgo, ConvexHullSubdivCriterion, LineDefectFlatnessAlgo, LineDefectSubdivCriterion, SimpleConvexHullFlatness, SimpleConvexHullSubdivCriterion

public interface QuadFlatnessAlgorithm

Interface to be adopted by classes able to compute the flatness of quadratic Bezier. Flatness: how well a quadratic curve is approximated by a straight segment.

For some of the algorithms will be easier (less computational expensive) to compute the square of the flatness, for others the unsquared flatness will be preferred: the consumer of a QuadFlatnessAlgorithm's services can obtain which way is the preferred one by calling the isSquaredFlatenessPreferred() method.

Also, a flatness computation algorithm may or may not be robust in concerning degenerate quadratic Bezier curves (i.e. curves with all the points collinear): such cases may show a 0 flatness without any warranty that, indeed, the curve can be approximated by the segment connecting the anchor points. Whether this is the case or not can be obtained by calling the isDegenerationRobust() method.

Author:
Adrian Colomitchi (acolomitchi(monkey_tail)gmail.com)

Method Summary
 double getFlatness(java.awt.geom.QuadCurve2D curve)
          Should return the value of the flatness for the provided curve.
 double getSquaredFlatness(java.awt.geom.QuadCurve2D curve)
          Should return the value of the flatness for the provided curve.
 boolean isDegenerationRobust()
          Must return true if the flatness is non-zero for any cubic curve that is not equal with the segment connecting the cubic's anchors (can handle degenerated cubic curves), false otherwise.
 boolean isSquaredFlatenessPreferred()
          Should return true if the squared flatness is computed easier (i.e.
 

Method Detail

isDegenerationRobust

boolean isDegenerationRobust()
Must return true if the flatness is non-zero for any cubic curve that is not equal with the segment connecting the cubic's anchors (can handle degenerated cubic curves), false otherwise.


isSquaredFlatenessPreferred

boolean isSquaredFlatenessPreferred()
Should return true if the squared flatness is computed easier (i.e. less CPU expensive) than the flatness.


getFlatness

double getFlatness(java.awt.geom.QuadCurve2D curve)
Should return the value of the flatness for the provided curve.


getSquaredFlatness

double getSquaredFlatness(java.awt.geom.QuadCurve2D curve)
Should return the value of the flatness for the provided curve.