Untitled
unknown
javascript
a year ago
3.4 kB
5
Indexable
const distanceToStop = round( (round(Math.abs(firstFootKeypointMean - currentFootKeypointMean) * pix2meters, 2) * 10) / this.breakPhaseMeter - 10, 2 ); // meter const runningTime = (this.breakPhaseTime - this.startTime) / 1000; const timeToStop = round((Date.now() - this.breakPhaseTime) / 1000 - (stopWithFinishLine ? 0 : 1), 2); const averageHorizontalDec = distanceToStop / timeToStop / timeToStop; var peakVelocity = Number.NEGATIVE_INFINITY; var peakVTime; var modifyVelocity = ReportFuncs.modifyVelocityList(this.velocityMoveNet).filter((v, i) => i % 6 === 0); var centerPeakTime; var centerDif = Number.POSITIVE_INFINITY; let closestValue = null; let minTimeDifference = Infinity; for (let i = 0; i < modifyVelocity.length; i++) { const element = modifyVelocity[i]; const timeDifference = Math.abs(element.time - runningTime); if (timeDifference < minTimeDifference) { minTimeDifference = timeDifference; closestValue = element.value; } if (element.time <= runningTime && element.value > peakVelocity) { peakVelocity = element.value; peakVTime = element.time; } if (element.time > runningTime) { var dif = Math.abs(element.value - closestValue / 2); if (centerDif > dif) { centerDif = dif; centerPeakTime = element.time; } } } const peakMoment = personMass * peakVelocity; const horivontalBreakImpulse = peakMoment / (runningTime - peakVTime + timeToStop); const earlyTime = centerPeakTime - runningTime; const avarageEarlyDec = round(closestValue / 2 / earlyTime, 2); const avarageLateDec = round(closestValue / 2 / (timeToStop - earlyTime), 2); const decRatio = round(avarageEarlyDec / avarageLateDec, 2); console.log("runningTime: ", runningTime); console.log("peakVelocity: ", peakVelocity); console.log("peakMoment: ", peakMoment); console.log("averageHorizontalDec: ", averageHorizontalDec); console.log("horivontalBreakImpulse: ", horivontalBreakImpulse); console.log("timeToStop: ", timeToStop); console.log("distanceToStop: ", distanceToStop); console.log("avarageEarlyDec: ", avarageEarlyDec); console.log("avarageLateDec: ", avarageLateDec); console.log("Early/Late DEC Ratio: ", decRatio); const myProps = new AdaStatesModel({ jumpType: this.jumpType, runningTime: runningTime, velocity: round(peakVelocity, 2), peakVTime: round(peakVTime, 2), centerBreakTime: round(centerPeakTime, 2), moment: round(peakMoment, 2), avarageHorizontalDec: round(averageHorizontalDec, 2), horizantalBrakingImpulse: round(horivontalBreakImpulse, 2), timeToStop: timeToStop, distanceToStop: distanceToStop, avarageEarlyDec: avarageEarlyDec, avarageLateDec: avarageLateDec, decRatio: decRatio, heights: this.heightMoveNet.filter((v, i) => i % 6 === 0), velecities: modifyVelocity, points: this.pointsMoveNet.filter((v, i) => i % 6 === 0), imgStanding: this.state.jumpImage1, imgBraking: this.state.jumpImage2, imgJumping: this.state.jumpImage3, imgSecondBraking: webcamRef.current.getScreenshot(), });
Editor is loading...
Leave a Comment