+ public Vector3d getPathLegEndpointVector() {
+ PipeControlPoint a = findPreviousEnd();
+ PipeControlPoint b = findNextEnd();
+
+ if (a == null || b == null) {
+ return getPathLegDirection();
+ }
+
+ Vector3d p1 = a.getWorldPosition();
+ Vector3d p2 = b.getWorldPosition();
+ p2.sub(p1);
+ double l = p2.length();
+ if (l != 0.0) {
+ p2.scale(1.0 / l);
+ return p2;
+ }
+ else {
+ return getPathLegDirection();
+ }
+ }