public Map<Point2D, Double> somePoints() { final Map<Point2D, Double> result = new HashMap<Point2D, Double>(); for (CubicCurve2D.Double bez : beziers) { final CubicCurve2D.Double left = new CubicCurve2D.Double(); final CubicCurve2D.Double right = new CubicCurve2D.Double(); bez.subdivide(left, right); result.put(left.getP1(), BezierUtils.getStartingAngle(left)); result.put(left.getP2(), BezierUtils.getEndingAngle(left)); result.put(right.getP1(), BezierUtils.getStartingAngle(right)); result.put(right.getP2(), BezierUtils.getEndingAngle(right)); } return result; }
public DotPath manageRect(Rectangle2D start, Rectangle2D end) { final List<CubicCurve2D.Double> list = new ArrayList<CubicCurve2D.Double>(this.beziers); while (true) { if (BezierUtils.isCutting(list.get(0), start) == false) { throw new IllegalStateException(); } if (BezierUtils.dist(list.get(0)) <= 1.0) { break; } final CubicCurve2D.Double left = new CubicCurve2D.Double(); final CubicCurve2D.Double right = new CubicCurve2D.Double(); list.get(0).subdivide(left, right); list.set(0, left); list.add(1, right); if (BezierUtils.isCutting(list.get(1), start)) { list.remove(0); } } return new DotPath(list); }
public Point2D getFrontierIntersection(Shape shape, Rectangle2D... notIn) { final List<CubicCurve2D.Double> all = new ArrayList<CubicCurve2D.Double>(beziers); for (int i = 0; i < 8; i++) { for (CubicCurve2D.Double immutable : all) { if (contains(immutable, notIn)) { continue; } final CubicCurve2D.Double bez = new CubicCurve2D.Double(); bez.setCurve(immutable); if (BezierUtils.isCutting(bez, shape)) { while (BezierUtils.dist(bez) > 1.0) { BezierUtils.shorten(bez, shape); } final Point2D.Double result = new Point2D.Double((bez.x1 + bez.x2) / 2, (bez.y1 + bez.y2) / 2); if (contains(result, notIn) == false) { return result; } } } cutAllCubic(all); } throw new IllegalArgumentException("shape=" + shape); }