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

Method data

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

take 'many things' and turn them into a line based on the formatting string. 'm' - moveTo, needs a Vec2 or a Vec3 'l' - lineTo, needs a Vec2 or a Vec3 'c' - cubicTo, needs 3 Vec2 or Vec3; 's' - smoothTo, needs 1 Vec2 or Vec3 ' ' will loop the previous instruction; '+' will loop the whole set of

(String format, Object... input)

Source from the content-addressed store, hash-verified

677 Vec3 lastMove = null;
678 char[] cs = format.toCharArray();
679 boolean looping = false;
680 for (int i = 0; i < cs.length; i++) {
681 char c = cs[i];
682
683 if (c == '*') {
684 c = cs[i - 1];
685 i--;
686 looping = true;
687 }
688 if (c == '+') {
689 c = cs[0];
690 i = 0;
691 looping = true;
692 }
693 if (c == 't')
694 c = f.get(q) instanceof TaggedVec3 ? ((TaggedVec3) f.get(q)).tag : (i == 0 ? 'm' : 'l');
695
696 try {
697 switch (c) {
698
699 case 'b':
700 if (lastMove == null)
701 throw new IllegalArgumentException(" 'b' without previous 'm'");
702 f.add(q, lastMove);
703 break;
704 case 'm':
705 lastMove = f.get(q++);
706 moveTo(lastMove);
707 break;
708 case 'l':
709 lineTo(f.get(q++));
710 break;
711 case 'd':
712 q++;
713 break;
714 case 's':
715 smoothTo(f.get(q++));
716 break;
717 case 'c':
718 cubicTo(f.get(q++), f.get(q++), f.get(q++));
719 break;
720 case 'C':
721 cubicTo(f.get(q - 2), f.get(q - 1), f.get(q));
722 q++;
723 break;
724 case '1':
725 q++;
726 break;
727 case '2':
728 q++;
729 break;
730
731 default:
732 throw new IllegalArgumentException(" unknown format specification " + c);
733 }
734 } catch (IndexOutOfBoundsException e) {
735 if (looping) return this;
736 throw e;

Callers 14

fromSamplingMethod · 0.95
changehooks.jsFile · 0.80
nFunction · 0.80
taps.jsFile · 0.80
raphael-min.jsFile · 0.80
interventions.jsFile · 0.80
insertFloatSliderFunction · 0.80
insertXYSliderFunction · 0.80
insert4GraphSliderFunction · 0.80
insert14GraphSliderFunction · 0.80
insertBoolFunction · 0.80

Calls 7

flattenInputMethod · 0.95
moveToMethod · 0.95
lineToMethod · 0.95
smoothToMethod · 0.95
cubicToMethod · 0.95
getMethod · 0.65
addMethod · 0.45

Tested by

no test coverage detected