com.caffeineowl.graphics.bezier.flatnessalgos
Class SimpleConvexHullFlatness

java.lang.Object
  extended by com.caffeineowl.graphics.bezier.flatnessalgos.SimpleConvexHullFlatness
All Implemented Interfaces:
CubicFlatnessAlgorithm, QuadFlatnessAlgorithm
Direct Known Subclasses:
SimpleConvexHullSubdivCriterion

public class SimpleConvexHullFlatness
extends java.lang.Object
implements CubicFlatnessAlgorithm, QuadFlatnessAlgorithm

Computes the flatness based on the maximum distance between any of the control points of a cubic Bezier (getFlatness(CubicCurve2D) or quadratic Bezier (getFlatness(QuadCurve2D) and the line defined by the anchor points of the Bezier curve.

Some notes:

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

Constructor Summary
SimpleConvexHullFlatness()
           
 
Method Summary
 double getFlatness(java.awt.geom.CubicCurve2D curve)
          Should return the value of the flatness for the provided curve.
 double getFlatness(java.awt.geom.QuadCurve2D curve)
          Should return the value of the flatness for the provided curve.
 double getSquaredFlatness(java.awt.geom.CubicCurve2D 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()
          Returns false
 boolean isSquaredFlatenessPreferred()
          Should return true if the squared flatness is computed easier (i.e.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleConvexHullFlatness

public SimpleConvexHullFlatness()
Method Detail

isDegenerationRobust

public final boolean isDegenerationRobust()
Returns false

Specified by:
isDegenerationRobust in interface CubicFlatnessAlgorithm
Specified by:
isDegenerationRobust in interface QuadFlatnessAlgorithm

isSquaredFlatenessPreferred

public final boolean isSquaredFlatenessPreferred()
Description copied from interface: CubicFlatnessAlgorithm
Should return true if the squared flatness is computed easier (i.e. less CPU expensive) than the flatness.

Specified by:
isSquaredFlatenessPreferred in interface CubicFlatnessAlgorithm
Specified by:
isSquaredFlatenessPreferred in interface QuadFlatnessAlgorithm

getFlatness

public final double getFlatness(java.awt.geom.CubicCurve2D curve)
Description copied from interface: CubicFlatnessAlgorithm
Should return the value of the flatness for the provided curve.

Specified by:
getFlatness in interface CubicFlatnessAlgorithm

getSquaredFlatness

public final double getSquaredFlatness(java.awt.geom.CubicCurve2D curve)
Description copied from interface: CubicFlatnessAlgorithm
Should return the value of the flatness for the provided curve.

Specified by:
getSquaredFlatness in interface CubicFlatnessAlgorithm

getFlatness

public final double getFlatness(java.awt.geom.QuadCurve2D curve)
Description copied from interface: QuadFlatnessAlgorithm
Should return the value of the flatness for the provided curve.

Specified by:
getFlatness in interface QuadFlatnessAlgorithm

getSquaredFlatness

public final double getSquaredFlatness(java.awt.geom.QuadCurve2D curve)
Description copied from interface: QuadFlatnessAlgorithm
Should return the value of the flatness for the provided curve.

Specified by:
getSquaredFlatness in interface QuadFlatnessAlgorithm