Post Reply 
Pitch vs Angle
09-21-2016, 12:18 PM
Post: #1
Pitch vs Angle
The program PITCH calculates the pitch and angle of various roof heights. The pitch of a roof is the number of inches of vertical rise per 12 inches. For example: a roof of 3/12 is pitch is a roof that rises 3 inches for every 12 horizontal inches.

This program demonstrates the angle computer given different roof pitches. You control the rise, anywhere for 0.5 ft to 12 ft. Use the up and down arrow keys to control the rise.

To exit the program: Press [Esc].

Code:
EXPORT PITCH()
BEGIN
// HP Prime, EWS 2061-09-21

Xmin:=−10;Xmax:=10;
Ymin:=−10;Ymax:=10;

LOCAL h,k,a,t,s1,s2;
k:=0; h:=6; a:=HAngle;
HAngle:=1;
RECT(0);
REPEAT

k:=GETKEY;

s1:="Pitch = "+h+"/12";
TEXTOUT(s1,−5,8,4,#7DF9FFh);

LINE(−4,−4,4,−4,#FF00h);
LINE(4,−4,4,−4+h,#EDC9AFh);
LINE(−4,−4,4,−4+h,#FF00h);

t:=ATAN(h/12);
s2:="Angle = "+t+"°";
TEXTOUT(s2,−5,−8,4,#7DF9FFh);

// UP
IF k==2 AND h≠12 THEN
RECT(0); h:=h+.5;
END;

// DOWN
IF k==12 AND h≠.5 THEN
RECT(0); h:=h-.5;
END

UNTIL k==4; // Esc

RETURN "Done.";

END;
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)