Given the lines of various length from a single vertex and the angles between the lines, the area of the field can be calculated.
FANAREA(list of lengths, list of angles in degrees)
The result is a list of two elements.
First element: area of the field
Second element: list: length of the connecting lines
Example:
AT&T Park (see the above figure)
Dimensions from Clem's Blog:
http://www.andrewclem.com/Baseball/ATTPark.html
Angles measured with a protractor. So, realistically, my estimate of area is rough.
L1:={339,382,404,399,421,365,309}
L2:={30,6,9,20,9,16}
FANAREA(L1,L2) returns
{109337.870804, {191.1175010192, 46.6352856001, 63.1995292625,
144.030366611, 83.1849883392, 108.96879942}}
Area of the field: approximately 109,337.871
Note: CHAR(10) gives a line break in a string.
PROGRAM:
// Declare Subs
SUB1();
SUB2();
EXPORT FANAREA(L1,L2);
BEGIN
// 20140111 EWS
// Area of a field
// lines from vertex w/angles
LOCAL I,T:=0,L3:=L2;
// Degree
HAngle:=1;
// Validate
IF SIZE(L1)≠SIZE(L2)+1 THEN
MSGBOX("Error: Wrong"+CHAR(10)
+"Size"+CHAR(10)
+"L2≠L1+1");
KILL; END;
// Calculation
FOR I FROM 1 TO SIZE(L2) DO
L3(I):=SUB1(L1(I),L1(I+1),L2(I));
T:=T+SUB2(L1(I),L1(I+1),L3(I));
END;
MSGBOX("Area: "+T);
RETURN {T, L3};
END;
// Law of Cosines
SUB1(A,B,C)
BEGIN
RETURN √(A^2+B^22*A*B*COS(C));
END;
//Heron's Formula
SUB2(A,B,C)
BEGIN
LOCAL S:=(A+B+C)/2;
RETURN √(S*(SA)*(SB)*(SC));
END;
A blog is that is all about mathematics and calculators, two of my passions in life.
Saturday, January 11, 2014
HP Prime: Area of a FanShaped Field (Baseball Field)
Subscribe to:
Post Comments (Atom)
TINspire: Templates to Plot Functions, Parametric Equations, and Sequences
TINspire: Templates to Plot Functions, Parametric Equations, and Sequences Introduction The following are sample templates to plot functi...

The Odds of Hitting it Big The number of possible combinations is fairly easy to calculate. You multiply the number symbols each slot has ...

Casio fx991EX Classwiz Review Casio FX991EX The next incarnation of the fx991 line of Casio calculators is the fx991 EX. ...

Over the next month, maybe month and a half, I plan to post programming tutorials for the HP (Hewlett Packard) Prime. If you have program...
Fabulous product! Love reading your blog :)
ReplyDeleteSbobet777 login