com.caffeineowl.graphics.bezier.flatnessalgos
Class ConvexHullFlatnessAlgo

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

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


Constructor Summary
ConvexHullFlatnessAlgo()
           
 
Method Summary
 double getFlatness(java.awt.geom.CubicCurve2D curve)
          Returns the square root of the getSquaredFlatness(CubicCurve2D) (so use getSquaredFlatness(CubicCurve2D) if possible instead of this one, it will be less computational intensive).
 double getFlatness(java.awt.geom.QuadCurve2D curve)
          Returns the square root of the getSquaredFlatness(QuadCurve2D) (so use getSquaredFlatness(QuadCurve2D) if possible instead of this one, it will be less computational intensive).
 double getSquaredFlatness(java.awt.geom.CubicCurve2D curve)
          Returns the maximum squared distance between the two control points and the segment defined by the curve's anchor points.
 double getSquaredFlatness(java.awt.geom.QuadCurve2D curve)
          Returns the square distance between the control point of the curve and the segment defined by its anchor points.
 boolean isDegenerationRobust()
          Always return true., and that's because the DistUtils.pointToSegSqEucDist(double, double, double, double, double, double) method is used, so if any of the anchor points is on the line defined by the anchor points but falls outside the segment, then the method will return a non-zero distance for it.
 boolean isSquaredFlatenessPreferred()
          Always return true.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConvexHullFlatnessAlgo

public ConvexHullFlatnessAlgo()
Method Detail

isDegenerationRobust

public final boolean isDegenerationRobust()
Always return true., and that's because the DistUtils.pointToSegSqEucDist(double, double, double, double, double, double) method is used, so if any of the anchor points is on the line defined by the anchor points but falls outside the segment, then the method will return a non-zero distance for it.

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

isSquaredFlatenessPreferred

public final boolean isSquaredFlatenessPreferred()
Always return true.

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

getFlatness

public final double getFlatness(java.awt.geom.QuadCurve2D curve)
Returns the square root of the getSquaredFlatness(QuadCurve2D) (so use getSquaredFlatness(QuadCurve2D) if possible instead of this one, it will be less computational intensive).

Specified by:
getFlatness in interface QuadFlatnessAlgorithm

getSquaredFlatness

public final double getSquaredFlatness(java.awt.geom.QuadCurve2D curve)
Returns the square distance between the control point of the curve and the segment defined by its anchor points.

Specified by:
getSquaredFlatness in interface QuadFlatnessAlgorithm

getFlatness

public final double getFlatness(java.awt.geom.CubicCurve2D curve)
Returns the square root of the getSquaredFlatness(CubicCurve2D) (so use getSquaredFlatness(CubicCurve2D) if possible instead of this one, it will be less computational intensive).

Specified by:
getFlatness in interface CubicFlatnessAlgorithm

getSquaredFlatness

public final double getSquaredFlatness(java.awt.geom.CubicCurve2D curve)
Returns the maximum squared distance between the two control points and the segment defined by the curve's anchor points.

Specified by:
getSquaredFlatness in interface CubicFlatnessAlgorithm