public class LineDefectFlatnessAlgo extends Object implements CubicFlatnessAlgorithm, QuadFlatnessAlgorithm
1/3 and 2/3
positions of the segment that connects the anchor points.
| Modifier and Type | Field and Description |
|---|---|
static int |
CBSV_DIST
Use the Chebyshev (chess-board) 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 (taxi-cab) 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 and Description |
|---|
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.
|
| Modifier and Type | Method and Description |
|---|---|
double |
getFlatness(CubicCurve2D curve)
Computes the flatness of the cubic using the
distance type and
sum/max strategy used in
initialisation.
|
double |
getFlatness(QuadCurve2D curve)
Computes the flatness of the quad curve using the
distance type and
sum/max strategy used in
initialisation.
|
double |
getSquaredFlatness(CubicCurve2D curve)
Computes the squared flatness of the cubic using the
distance type and
sum/max strategy used in
initialisation.
|
double |
getSquaredFlatness(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}. |
public static final int EUCL_DIST
public static final int MNHT_DIST
public static final int CBSV_DIST
protected int distType
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.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)
public final boolean isDegenerationRobust()
isDegenerationRobust in interface CubicFlatnessAlgorithmisDegenerationRobust in interface QuadFlatnessAlgorithmpublic 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 CubicFlatnessAlgorithmisSquaredFlatenessPreferred in interface QuadFlatnessAlgorithmpublic final double getFlatness(CubicCurve2D curve)
getFlatness in interface CubicFlatnessAlgorithmpublic final double getSquaredFlatness(CubicCurve2D curve)
getSquaredFlatness in interface CubicFlatnessAlgorithmpublic final double getFlatness(QuadCurve2D curve)
getFlatness in interface QuadFlatnessAlgorithmpublic final double getSquaredFlatness(QuadCurve2D curve)
getSquaredFlatness in interface QuadFlatnessAlgorithmCopyright © 2016. All rights reserved.