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

Method reader

src/main/java/trace/video/SimpleHead.kt:101–120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

99
100 }
101
102 @JvmStatic
103 fun reader(path: String): (Double) -> Frame {
104
105 val h = SimpleHead()
106 val lines = File(path).readLines().map { h.readLine(it) }
107
108 return { time ->
109
110 val left = Math.max(0.0, Math.min(lines.size - 1.0, time * lines.size)).toInt()
111 val right = Math.max(0.0, Math.min(lines.size - 1.0, time * lines.size + 1)).toInt()
112 val alpha = time * lines.size - left
113
114 val fl = lines[left]
115 val fr = lines[right]
116
117 blend(fl, fr, alpha)
118
119 }
120
121 }
122
123 private fun blend(a: Frame, b: Frame, alpha: Double): Frame {

Callers 3

startMethod · 0.80
ncMethod · 0.80
startMethod · 0.80

Calls 6

SimpleHeadClass · 0.85
FileFunction · 0.85
mapMethod · 0.45
readLineMethod · 0.45
maxMethod · 0.45
minMethod · 0.45

Tested by

no test coverage detected