MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / byTransforming

Method byTransforming

src/main/java/field/graphics/FLine.java:1442–1458  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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) {

Callers 15

relativeToMethod · 0.95
byFixingEndpointsToMethod · 0.95
__sub__Method · 0.95
__rsub__Method · 0.95
__add__Method · 0.95
__radd__Method · 0.95
__mul__Method · 0.95
__div__Method · 0.95
__rmul__Method · 0.95
__rdiv__Method · 0.95
boxOriginMethod · 0.80

Calls 6

addMethod · 0.95
duplicateMethod · 0.65
applyMethod · 0.65
getMethod · 0.65
sizeMethod · 0.45

Tested by

no test coverage detected