knotsInitialize = {
mutable points;
mutable numPointTracker = points.length
if(inputFormat == "Text File"){
mutable knots = mutable tmpKnots;
mutable knots = mutable knots;
mutable degreeTracker = tmpKnots.length - points.length - 1
mutable degreeTracker = mutable degreeTracker
update()
}else{
if(clampedTracker){
console.log(1111)
while(mutable knots.length > 0){
mutable knots.pop()
}
const numInTotal = (mutable points).length + numDegree + 1
const numRealValue = numInTotal - 2*(numDegree + 1)
for(let i = 0; i < numDegree + 1; i++){
mutable knots.push(0)
}
let j = 0
for(j=0; j < numRealValue; j++){
mutable knots.push(j+1)
}
j += 1
for(let k=0; k < numDegree + 1; k++){
mutable knots.push(j)
}
mutable previousTrack = "Clamped"
mutable knots = mutable knots;
update()
document.querySelector(".reset").click()
// mutable knots = mutable knots
}else if(uniformTracker){
console.log(2222)
const knotsLength = knots.length
while(mutable knots.length > 0){
mutable knots.pop()
}
const newKnotsLength = (mutable points).length + numDegree + 1
for(let i = 0;i<newKnotsLength;i++){
mutable knots.push(i)
}
// ////
// while(mutable backup.length > 0){
// mutable backup.pop()
// }
// for(let j=length - numDegree; j<length; j++){
// (mutable backup).push([... points[j]])
// }
// ////
// let indexHelper = 0
// if(previousTrack == "Close"){
// for(let j=points.length - numDegree; j<length; j++){
// mutable points[j] = [mutable backup[indexHelper][0], mutable backup[indexHelper][1]]
// indexHelper ++
// }
// }
mutable previousTrack = "Uniform"
mutable knots = mutable knots;
update()
document.querySelector(".reset").click()
}else if(closeTracker){
console.log(3333)
const length = mutable points.length
let indexHelper = 0
for(let j=length - numDegree; j<length; j++){
mutable points[j] = mutable points[indexHelper]
indexHelper ++
}
mutable previousTrack = "Close"
mutable points = mutable points
update()
document.querySelector(".reset").click()
}else if(openTracker){
console.log(4444)
const length = mutable points.length
if(previousTrack == "Close"){
console.log("Open Tracker")
for(let j=length - numDegree; j<length; j++){
mutable points.pop()
}
for(let j=length - numDegree; j<length; j++){
mutable points.push([0.1 + Math.round(Math.random()*10) * 0.5/(numPoints), 0.5 + (Math.random()-0.5)*0.6])
}
}
mutable previousTrack = "Open"
mutable points = mutable points
update()
document.querySelector(".reset").click()
}
// mutable knots = mutable knots
}
// dos()
}