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

Method sampleByDistance

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

returns a list of `Vec3` (i.e. positions) by repeatedly moving along the line by 'distance' and recording those positions. Note that while the start of the line will be in this list the end point will probably not (unless the length of the line just happens to be exactly divisible by `distance`)

(double distance)

Source from the content-addressed store, hash-verified

527 r.add(c.position());
528 double was = c.getD();
529 c.setD(c.getD() + distance);
530 double now = c.getD();
531 if (now - was < Math.abs(distance - tol) && Math.abs(now - c.lengthD()) < tol)
532 break;
533 }
534 return r;
535 }
536
537 /**
538 * returns a new `FLine` by trimming this line at `distance`
539 */
540 public FLine byTrimmingBefore(double distance) {
541 FLinesAndJavaShapes.Cursor c = cursor();
542 c.setD(distance);
543 Pair<FLine, FLine> m = c.split();
544 return m.first == null ? new FLine() : m.first;
545 }

Callers 1

writeFLineMethod · 0.80

Calls 7

cursorMethod · 0.95
getDMethod · 0.80
lengthDMethod · 0.80
setDMethod · 0.80
positionMethod · 0.65
minMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected