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

Method append

src/main/java/trace/util/Rasterizer.kt:26–90  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24
25 init {
26 this.filename_out = filename + ".exr"
27 this.out = FileOutputStream(File(filename))
28 }
29
30 fun append(f: FLine) {
31
32 val f2 = f.byTransforming { x -> transform(x).toVec3() }
33 out.write('B'.toInt())
34 for (n in f2.nodes) {
35 when (n) {
36 is FLine.CubicTo -> {
37 out.write('c'.toInt()); F(n.c1.x); F(n.c1.y); F(n.c2.x); F(n.c2.y); F(n.to.x); F(n.to.y)
38 }
39 is FLine.LineTo -> {
40 out.write('l'.toInt()); F(n.to.x); F(n.to.y)
41 }
42 is FLine.MoveTo -> {
43 out.write('m'.toInt()); F(n.to.x); F(n.to.y)
44 }
45 }
46 }
47
48
49 run {
50 val c = f2.attributes.getOr(StandardFLineDrawing.color, { Vec4(1, 1, 1, 1) })?.get()
51 if (c != null) {
52 out.write('s'.toInt())
53 F(c.x)
54 F(c.y)
55 F(c.z)
56 F(c.w)
57 out.write('f'.toInt())
58 F(c.x)
59 F(c.y)
60 F(c.z)
61 F(c.w)
62 }
63 }
64
65 run {
66 val c = f2.attributes.get(StandardFLineDrawing.strokeColor)?.get()
67 if (c != null) {
68 out.write('s'.toInt())
69 F(c.x)
70 F(c.y)
71 F(c.z)
72 F(c.w)
73 }
74 }
75 run {
76 val c = f2.attributes.get(StandardFLineDrawing.fillColor)?.get()
77 if (c != null) {
78 out.write('f'.toInt())
79 F(c.x)
80 F(c.y)
81 F(c.z)
82 F(c.w)
83 }

Callers 1

saveForRobotMethod · 0.45

Calls 10

byTransformingMethod · 0.80
getOrMethod · 0.80
isTrueMethod · 0.80
getMethod · 0.65
transformFunction · 0.50
FFunction · 0.50
runFunction · 0.50
Vec4Class · 0.50
toVec3Method · 0.45
writeMethod · 0.45

Tested by

no test coverage detected