Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Faster computation #26

Merged
merged 1 commit into from
Apr 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 19 additions & 16 deletions www/js/calculatesCalibrationStuff.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,23 +286,26 @@ function computeFurthestFromCenterOfMass(lines, lastGuess) {

const maxError = Math.max(Math.abs(tlX), Math.abs(tlY), Math.abs(trX), Math.abs(trY), Math.abs(brX))

var divisor = -10
if (maxError == Math.abs(tlX)) {
//console.log("Move tlY by: " + tlY/divisor);
lastGuess.tl.x = lastGuess.tl.x + tlX / divisor
var scalor = -1;
if(maxError == Math.abs(tlX)){
//console.log("Move tlY by: " + tlY/divisor);
lastGuess.tl.x = lastGuess.tl.x + tlX*scalor;
}
if (maxError == Math.abs(tlY)) {
//console.log("Move tlY by: " + tlY/divisor);
lastGuess.tl.y = lastGuess.tl.y + tlY / divisor
} else if (maxError == Math.abs(trX)) {
//console.log("Move trX by: " + trX/divisor);
lastGuess.tr.x = lastGuess.tr.x + trX / divisor
} else if (maxError == Math.abs(trY)) {
//console.log("Move trY by: " + trY/divisor);
lastGuess.tr.y = lastGuess.tr.y + trY / divisor
} else if (maxError == Math.abs(brX)) {
//console.log("Move brX by: " + brX/divisor);
lastGuess.br.x = lastGuess.br.x + brX / divisor
if(maxError == Math.abs(tlY)){
//console.log("Move tlY by: " + tlY/divisor);
lastGuess.tl.y = lastGuess.tl.y + tlY*scalor;
}
else if(maxError == Math.abs(trX)){
//console.log("Move trX by: " + trX/divisor);
lastGuess.tr.x = lastGuess.tr.x + trX*scalor;
}
else if(maxError == Math.abs(trY)){
//console.log("Move trY by: " + trY/divisor);
lastGuess.tr.y = lastGuess.tr.y + trY*scalor;
}
else if(maxError == Math.abs(brX)){
//console.log("Move brX by: " + brX/divisor);
lastGuess.br.x = lastGuess.br.x + brX*scalor;
}

return lastGuess
Expand Down