Names Default To Here( 1 ); // This script determines whether a basketball free-throw "swishes" through the rim or not. // Constants (English units) x0=0; // x location of center of ball at time 0, ft g=32.2; // acceleration due to gravity, fps2 dRim=18/12; // rim diameter, ft dBall=9.55/12; // ball diameter, ft xRimCtr=15-6/12-dRim/2; // x location of center of rim from launch point of ball, ft yRimCtr=10; // y location of center of rim above floor, ft xFrontRim=xRimCtr-dRim/2; // x location of front of rim from launch point of ball, ft xBackRim=xRimCtr+dRim/2; // x location of rear of rim from launch point of ball, ft yFrontRim=yRimCtr; // y location of front of rim above floor, ft yBackRim=yRimCtr; // y location of rear of rim above floor, ft // create a text box for user to input height of release point of ball tb1 = New Window("Input Parameters", <=yRimCtr+dBall/2, ( finalT=(vy0+sqrt(vy0^2-2*g*(yRimCtr-y0)))/g; // time that ball center reaches rim height, on the way down finalY=yRimCtr; // ball center height when at rim height, on the way down. finalX=vx0*finalT; // ball x position when center is at rim height, on the way down. finalVx=vx0; // ball final x velocity when center is at rim height, on the way down. finalVy=vy0-g*finalT; // ball final y velocity when center is at rim height, on the way down. thetaFinal=atan(finalVy,finalVx); // final trajectory angle when ball center is at rim height, on the way down, radians. angleFinal=thetaFinal*180/pi(); // final trajectory angle when ball center is at rim height, on the way down, degrees. // now we have all the information needed to determine if ball "swishes" through the rim opening // determine eqn of line through front of rim at finalTheta m=tan(thetaFinal); // slope of either line passing through front or rear of rim bFront=yFrontRim-m*xFrontRim; // intercept of line passing through front of rim at ball trajectory slope bBack=yBackRim-m*xBackRim; // intercept of line passing through back of rim at ball trajectory slope d=abs(bBack-bFront)/sqrt(m^2+1); // shortest distance between 2 parallel lines (ball must fit between these lines) // assume shot is made unless criteria is not met makemiss=1; // Criteria: If any are false, makemiss=0, else makemiss=1. // 1. Ball must be smaller than d (else it won't fit between front & back of rim without hitting) // 2. Ball center must be to right of front rim line (else falls short) // 3. Ball center must be to left of back rim line (else too long) // 4. Minimum distance from front rim line to ball must be >= dBall/2 // 5. Minimum distance from back rim line to ball must be >= dBall/2 if( dBall>d | finalXxBackRim | abs(-m*finalX+finalY-bFront)/sqrt(m^2+1^2)=td, ( x=vx0*(time-td); y=y0+vy0*(time-td) - 0.5*g*(time-td)^2; ), ( x=0; y=y0; ); ); column(dt,1)[nr]=velocity; column(dt,2)[nr]=initTheta*180/pi(); column(dt,3)[nr]=time; column(dt,4)[nr]=x; column(dt,5)[nr]=y; column(dt,6)[nr]=makemiss; dt << Add Rows(1, after(nr)); nr=nr+1; ); td=td+Tdelay; show(td); show(initTheta); ); ) ); Bubble Plot( X( :Name( "x, ft" ) ), Y( :Name( "y, ft" ) ), Time( :Name( "Time" ) ), Coloring( :Name( "makemiss" ) ), ID( :Name( "Initial Angle, degrees" ) ), Speed( 59.1 ), Bubble Size( 12 ),//17.35 ), Time Index( 6.6145 ), Label( "All" ), Trail Lines( "All" ), Set Shape( "Custom" ), Color Theme( "Blue to Green to Red" ), Fit to Window( "Off" ), Title Position( 9.35, 0 ), SendToReport( Dispatch( {}, "Bubble Plot of y, ft by x, ft Across Time ID Initial Angle, degrees", OutlineBox, {Set Title( "Free Throw Swish vs. Release Angle, 22.4fps initial velocity, 8.5 ft high release point" )} ), Dispatch( {}, "1", ScaleBox, {Format( "Best", 12 ), Min( 0 ), Max( 20 ), Inc( 1 ), Minor Ticks( 1 )} ), Dispatch( {}, "2", ScaleBox, {Format( "Best", 12 ), Min( 0 ), Max( 20 ), Inc( 1 ), Minor Ticks( 1 )} ), Dispatch( {}, "Bubble Plot", FrameBox, {Frame Size( 640, 640 ), {Add Polygon Annotation( // rim & net Points( {416, 320}, {429, 352}, {451, 352}, {464, 320} ), Color( "Blue" ), closed(1) ), Add Line Annotation( // rim support Line( {464, 320}, {480, 320} ), Color( "Blue" ) ), Add Polygon Annotation( // backboard Points( {480, 341}, {486, 341}, {486, 229}, {480, 229} ), Color( "Blue" ), closed(1) ), Add Polygon Annotation( // stantion Points( {486, 336}, {608, 336}, {608, 640}, {624, 640}, {624, 320}, {486, 320} ), Color( "Blue" ) )}} ) ) ); // finally, save a new script to the data table to create the vel vs. trajectory window plot, so plot can be easily regenerated. Bubble Plot( X( :Name( "x, ft" ) ), Y( :Name( "y, ft" ) ), Time( :Name( "Time" ) ), Coloring( :Name( "makemiss" ) ), ID( :Name( "Initial Angle, degrees" ) ), Speed( 59.1 ), Bubble Size( 12 ),//17.35 ), Time Index( 6.6145 ), Label( "All" ), Trail Lines( "All" ), Set Shape( "Custom" ), Color Theme( "Blue to Green to Red" ), Fit to Window( "Off" ), Title Position( 9.35, 0 ), SendToReport( Dispatch( {}, "Bubble Plot of y, ft by x, ft Across Time ID Initial Angle, degrees", OutlineBox, {Set Title( "Free Throw Swish vs. Release Angle, 22.4fps initial velocity, 8.5 ft high release point" )} ), Dispatch( {}, "1", ScaleBox, {Format( "Best", 12 ), Min( 0 ), Max( 20 ), Inc( 1 ), Minor Ticks( 1 )} ), Dispatch( {}, "2", ScaleBox, {Format( "Best", 12 ), Min( 0 ), Max( 20 ), Inc( 1 ), Minor Ticks( 1 )} ), Dispatch( {}, "Bubble Plot", FrameBox, {Frame Size( 640, 640 ), {Add Polygon Annotation( // rim & net Points( {416, 320}, {429, 352}, {451, 352}, {464, 320} ), Color( "Blue" ), closed(1) ), Add Line Annotation( // rim support Line( {464, 320}, {480, 320} ), Color( "Blue" ) ), Add Polygon Annotation( // backboard Points( {480, 341}, {486, 341}, {486, 229}, {480, 229} ), Color( "Blue" ), closed(1) ), Add Polygon Annotation( // stantion Points( {486, 336}, {608, 336}, {608, 640}, {624, 640}, {624, 320}, {486, 320} ), Color( "Blue" ) )}} ) ) );