

PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 
java.lang.Object com.caffeineowl.graphics.bezier.flatnessalgos.LineDefectFlatnessAlgo
public class LineDefectFlatnessAlgo
The algorithm computes the defected as the distance between the actual location control point(s) and the location of the control point(s) of a totally degenerated Bezier segment:
1/3
and 2/3
positions of the segment that connects the anchor points.
Field Summary  

static int 
CBSV_DIST
Use the Chebyshev (chessboard) distance to compute the distance between two points 
protected int 
distType
The distance to use in computing the flatness. 
static int 
EUCL_DIST
Use the Euclidian norm to compute the distance between two points 
static int 
MNHT_DIST
Use the Manhattan (taxicab) distance to compute the distance between two points 
protected boolean 
usingSum
Relevant only if this flatness algo is applied for the cubic: when true ,
the flatness is returned as the sum of the distances between the
control points and their ideal position of the degenerate cubic. 
Constructor Summary  

LineDefectFlatnessAlgo()
Defaults to LineDefectFlatnessAlgo(int, boolean) ,
with a EUCL_DIST for
the distance type and using the sum for the case
of cubics. 

LineDefectFlatnessAlgo(boolean useSumation)
Defaults to LineDefectFlatnessAlgo(int, boolean) ,
with a EUCL_DIST for
the distance type and using the specified behaviour for the use of
sum/max when computing the flatness for cubics. 

LineDefectFlatnessAlgo(int distType)
Defaults to LineDefectFlatnessAlgo(int, boolean) ,
with the specified distance type and using the
sum for the case
of cubics. 

LineDefectFlatnessAlgo(int distType,
boolean useSum)
Initialised this instance with the specified distance type and summation behaviour. 
Method Summary  

double 
getFlatness(java.awt.geom.CubicCurve2D curve)
Computes the flatness of the cubic using the distance type and sum/max strategy used in initialisation. 
double 
getFlatness(java.awt.geom.QuadCurve2D curve)
Computes the flatness of the quad curve using the distance type and sum/max strategy used in initialisation. 
double 
getSquaredFlatness(java.awt.geom.CubicCurve2D curve)
Computes the squared flatness of the cubic using the distance type and sum/max strategy used in initialisation. 
double 
getSquaredFlatness(java.awt.geom.QuadCurve2D curve)
Computes the squared flatness of the quad curve using the distance type and sum/max strategy used in initialisation. 
boolean 
isDegenerationRobust()
Yes, works fine for degenerated curves (curves on which the control point(s) are on the line defined by its anchors). 
boolean 
isSquaredFlatenessPreferred()
Returns true if the distance type is
EUCL_DIST (since computing the squared distance is less
computational expensive than computing the distance), false if
the distance type is MNHT_DIST or CBSV_DIST (for those two,
computing the distance is less computational expensive than computing the
squared distance}. 
Methods inherited from class java.lang.Object 

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait 
Field Detail 

public static final int EUCL_DIST
public static final int MNHT_DIST
public static final int CBSV_DIST
protected int distType
EUCL_DIST
, MNHT_DIST
or CBSV_DIST
.
protected boolean usingSum
true
,
the flatness is returned as the sum of the distances between the
control points and their ideal position of the degenerate cubic.
If false
, the maximum of the two is returned as the
flatness.
Constructor Detail 

public LineDefectFlatnessAlgo()
LineDefectFlatnessAlgo(int, boolean)
,
with a EUCL_DIST for
the distance type and using the sum for the case
of cubics.
public LineDefectFlatnessAlgo(int distType)
LineDefectFlatnessAlgo(int, boolean)
,
with the specified distance type and using the
sum for the case
of cubics.
public LineDefectFlatnessAlgo(boolean useSumation)
LineDefectFlatnessAlgo(int, boolean)
,
with a EUCL_DIST for
the distance type and using the specified behaviour for the use of
sum/max when computing the flatness for cubics.
public LineDefectFlatnessAlgo(int distType, boolean useSum)
distType
 the distance type. Must be one of
EUCL_DIST
, MNHT_DIST
or CBSV_DIST
. If it is not, the
EUCL_DIST
will be used.useSum
 sumormax strategy to be used when computing the flatness of a cubic.Method Detail 

public final boolean isDegenerationRobust()
isDegenerationRobust
in interface CubicFlatnessAlgorithm
isDegenerationRobust
in interface QuadFlatnessAlgorithm
public final boolean isSquaredFlatenessPreferred()
true
if the distance type is
EUCL_DIST
(since computing the squared distance is less
computational expensive than computing the distance), false
if
the distance type is MNHT_DIST
or CBSV_DIST
(for those two,
computing the distance is less computational expensive than computing the
squared distance}.
isSquaredFlatenessPreferred
in interface CubicFlatnessAlgorithm
isSquaredFlatenessPreferred
in interface QuadFlatnessAlgorithm
public final double getFlatness(java.awt.geom.CubicCurve2D curve)
getFlatness
in interface CubicFlatnessAlgorithm
public final double getSquaredFlatness(java.awt.geom.CubicCurve2D curve)
getSquaredFlatness
in interface CubicFlatnessAlgorithm
public final double getFlatness(java.awt.geom.QuadCurve2D curve)
getFlatness
in interface QuadFlatnessAlgorithm
public final double getSquaredFlatness(java.awt.geom.QuadCurve2D curve)
getSquaredFlatness
in interface QuadFlatnessAlgorithm


PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 