make a new line by transforming all of the positions of this line by a function. For example `someLine.byTransforming( (p) => p + vec(10,0) )` will yield a line 10 units to the right of `someLine` (of course `someLine + vec(10,0)` does the same). You might need a little more JavaScript syntax th
(Function<Vec3, Vec3> spaceTransform)
| 1440 | for (Node n : nodes) { |
| 1441 | if (n instanceof MoveTo) f.add(new MoveTo(spaceTransform.apply(n.to.duplicate()))); |
| 1442 | else if (n instanceof LineTo) f.add(new LineTo(spaceTransform.apply(n.to.duplicate()))); |
| 1443 | else if (n instanceof CubicTo) |
| 1444 | f.add(new CubicTo(spaceTransform.apply(((CubicTo) n).c1.duplicate()), spaceTransform.apply(((CubicTo) n).c2.duplicate()), |
| 1445 | spaceTransform.apply(n.to.duplicate()))); |
| 1446 | f.nodes.get(f.nodes.size() - 1).attributes = n.attributes.duplicate(); |
| 1447 | } |
| 1448 | |
| 1449 | if (auxProperties != null) f.setAuxPropertiesFunctions(new LinkedHashMap<>(auxProperties)); |
| 1450 | return f; |
| 1451 | } |
| 1452 | |
| 1453 | /** |
| 1454 | * make a new line by splitting every drawing `.lineTo` and `.cubicTo` in this line into two drawing instructions. |
| 1455 | */ |
| 1456 | public FLine bySubdividing() { |
| 1457 | |
| 1458 | FLine f = new FLine(); |
| 1459 | f.attributes = attributes.duplicate(f); |
| 1460 | |
| 1461 | for (Node n : nodes) { |
no test coverage detected