returns a new FLine by translating, rotating and scaling this line such that it's endpoints are 'start' and 'end'
(Vec3 start, Vec3 end)
| 1507 | Vec3 center = new Vec3().lerp(cStart, cEnd, 0.5); |
| 1508 | Vec3 center2 = new Vec3().lerp(start, end, 0.5); |
| 1509 | |
| 1510 | Vec3 t = new Vec3(center2).sub(center); |
| 1511 | |
| 1512 | Vec3 cD = new Vec3(cEnd).sub(cStart).normalize(); |
| 1513 | Vec3 d = new Vec3(end).sub(start); |
| 1514 | |
| 1515 | Quat q = cD.isNaN() || d.isNaN() ? new Quat() : new Quat().rotateTo(d, cD); |
| 1516 | |
| 1517 | double s = end.distance(start) / cEnd.distance(cStart); |
| 1518 | |
| 1519 | if (Double.isNaN(s)) s = 1; |
| 1520 | |
| 1521 | double fs = s; |
| 1522 | |
| 1523 | return byTransforming(x -> q.transform(new Vec3(x).sub(center)) |
| 1524 | .mul(fs) |
| 1525 | .add(center) |
| 1526 | .add(t)); |
| 1527 | |
| 1528 | } |
| 1529 | |
| 1530 | /** |
| 1531 | * handy method that sets the z coordinate of all the nodes in this FLine to be the `depth` of this box (or 0) |
| 1532 | * |
| 1533 | * @param of |
| 1534 | */ |
| 1535 | public void depthTo(Box of) { |
| 1536 | float d = of.properties.getFloat(depth, 0f); |
| 1537 | for (Node n : nodes) |
| 1538 | n.setZ(d); |
no test coverage detected