'Blends' this line 'towards' 'target. This algorithm is very straightfoward, target should have the same number of nodes as this FLine otherwise nodes of this line will be dropped or nodes of the target will be ignored
(FLine target, double amount)
| 430 | Node n2 = target.nodes.get(i); |
| 431 | if (n1 instanceof MoveTo) { |
| 432 | n1.to.lerp(n2.to, amount); |
| 433 | } else if (n1 instanceof LineTo) { |
| 434 | if (n2 instanceof LineTo) { |
| 435 | n1.to.lerp(n2.to, amount); |
| 436 | } else { |
| 437 | Vec3 before = nodes.get(i - 1).to; |
| 438 | nodes.set(i, n1 = new CubicTo(new Vec3(before).lerp(n1.to, 1 / 3f), new Vec3(before).lerp(n1.to, 2 / 3f), n1.to)); |
| 439 | n1.to.lerp(n2.to, amount); |
| 440 | ((CubicTo) n1).c1.lerp(((CubicTo) n2).c1, amount); |
| 441 | ((CubicTo) n1).c2.lerp(((CubicTo) n2).c2, amount); |
| 442 | } |
| 443 | } else if (n1 instanceof CubicTo) { |
| 444 | if (n2 instanceof LineTo) { |
| 445 | Vec3 before = target.nodes.get(i - 1).to; |
| 446 | n1.to.lerp(n2.to, amount); |
| 447 | ((CubicTo) n1).c1.lerp(new Vec3(before).lerp(n2.to, 1 / 3), amount); |
| 448 | ((CubicTo) n1).c2.lerp(new Vec3(before).lerp(n2.to, 2 / 3), amount); |
| 449 | } else { |
| 450 | n1.to.lerp(n2.to, amount); |
| 451 | ((CubicTo) n1).c1.lerp(((CubicTo) n2).c1, amount); |
| 452 | ((CubicTo) n1).c2.lerp(((CubicTo) n2).c2, amount); |
| 453 | } |
| 454 | } |
| 455 | } |
| 456 | return this; |
| 457 | } |
| 458 | |
| 459 | /** |
| 460 | * draws a curve that starts by heading in the `theta1` direction for a distance of roughly `r1` then ends up heading to `x, y` coming in at angle `theta2` from roughly `r2` away |
| 461 | */ |
| 462 | public FLine polarCubicTo(float r1, float theta1, float r2, float theta2, float x, float y) { |
| 463 | Vec2 destination = new Vec2(x, y); |
| 464 | return polarCubicTo(r1, theta1, r2, theta2, destination); |
| 465 | } |
| 466 | |
| 467 | /** |