Harium / etyl-geometry

Etyl's geometry module
0 stars 0 forks source link

Path enhancements #8

Open yuripourre opened 3 years ago

yuripourre commented 3 years ago

Add helper methods:

yuripourre commented 3 years ago

Move:

    for (DataCurve curve : path.getCurves()) {
        move(curve.getStart(), x, y);
        move(curve.getEnd(), x, y);
        if (CurveType.QUADRATIC_BEZIER == curve.getType()) {
            QuadraticCurve c = (QuadraticCurve) curve;
            move(c.getControl1(), x, y);
        } else if (CurveType.CUBIC_BEZIER == curve.getType()) {
            CubicCurve c = (CubicCurve) curve;
            move(c.getControl1(), x, y);
            move(c.getControl2(), x, y);
        }
    }

Scale: // Calculate centroid // Move to centroid // Scale // Move back