function f_splitBezier(points, t) {
const left = [points[0]]
const right = [points[points.length - 1]]
const temp = [...points]
while (temp.length > 1) {
for (let i = 0; i < temp.length - 1; i++) {
const sp1 = glMatrix.vec2.create()
glMatrix.vec2.scale(sp1, temp[i], 1 - t)
const sp2 = glMatrix.vec2.create()
glMatrix.vec2.scale(sp2, temp[i + 1], t)
const p = glMatrix.vec2.create()
glMatrix.vec2.add(p, sp1, sp2)
temp[i] = p
}
temp.pop()
left.push(temp[0])
right.push(temp[temp.length - 1])
}
return {
left,
right
}
}