Search in sources :

Example 1 with CubicBezierCurve

use of com.xenoage.zong.util.math.CubicBezierCurve in project Zong by Xenoage.

the class DefaultCurvedLineStrategy method computeCurvedLine.

@Override
public CubicBezierCurve computeCurvedLine(List<Point2f> points, VSide side) {
    ConvexHull convexHull = ConvexHull.create(points, side);
    List<QuadraticCurve> quadCurves = QuadraticCurvesTools.computeOverConvexHull(convexHull, ENDPOINT_TOLERANCE_LP, ENDPOINT_TOLERANCE_LP);
    QuadraticCurve bestQuadCurve = QuadraticCurvesTools.getBestCurve(quadCurves, convexHull);
    CubicBezierCurve bestBezierCurve = BezierCurveTools.computeBezierFrom(bestQuadCurve, points.get(0).x, points.get(points.size() - 1).x);
    bestBezierCurve = BezierCurveTools.correctBezier(bestBezierCurve, side);
    return bestBezierCurve;
}
Also used : QuadraticCurve(com.xenoage.utils.math.QuadraticCurve) ConvexHull(com.xenoage.utils.math.geom.ConvexHull) CubicBezierCurve(com.xenoage.zong.util.math.CubicBezierCurve)

Aggregations

QuadraticCurve (com.xenoage.utils.math.QuadraticCurve)1 ConvexHull (com.xenoage.utils.math.geom.ConvexHull)1 CubicBezierCurve (com.xenoage.zong.util.math.CubicBezierCurve)1