Sunday, March 1, 2015

HP Prime & TI-84+: Bolt Pattern

HP Prime & TI-84+:  Bolt Pattern


Bolt Pattern


The program BOLTPAT will calculate a bolt pattern given:
X = center, X coordinate
Y = center, Y coordinate
N = number of bolts
D = diameter of the circle

No angle of rotation is assumed.

Coordinates of each bolt can be calculated by:

X_k = (d/2*COS(360*k/n)+xc)
Y_k = (d/2*SIN(360*k/n)+yc)

Where k = 0 to n-1

The OC-Distance between each bolt is calculated by calculating the linear distance between neighboring bolts.

Output:
Each point where the bolt should be placed.  In addition, the on-center distance between bolts is displayed.  Finally, each of the coordinates will be presented in a list.  For the TI-84+ version, the list will be stored in list L6.

HP Prime:  BOLTPAT

EXPORT BOLTPAT()
BEGIN
// EWS 2012-02-28
// No pre angle tilt

// Degrees
HAngle:=1;

// Data
LOCAL z0,z1,xc,yc;
LOCAL z,n,d,k,l,xp,yp;
INPUT({xc,yc,n,d},"Bolt Spacing",
{"xc:","yc:","n :","d :"},
{"x center","y center",
"number of bolts",
"diameter"});
l:={};

// Calculation
PRINT();
PRINT("x + y*i");
FOR k FROM 0 TO n-1 DO
xp:=(d/2*COS(360*k/n)+xc);
yp:=(d/2*SIN(360*k/n)+yc);
IF k==0 THEN
z0:=xp+i*yp;
END;
IF k==1 THEN
z1:=xp+i*yp;
END;
l:=CONCAT(l,{xp+yp*i});
PRINT("("+xp+","+yp+")");
END;
PRINT("OC-OC: "+ABS(z1-z0));

RETURN l;

END;

TI-84+: BOLTPAT

a+bi
Degree
Disp “X: X CENTER”
Disp “Y: Y CENTER”
Disp “N: NO. BOLTS”
Disp “D: DIAMETER”
Prompt X,Y,N,D
For(K,0,N-1)
D/2*cos(360*K/N)+X→S
D/2*sin(360*K/N)+Y→T
If K=0
Then
S+T*i→U
{U}→L6
End
If K>0
Then
Augment(L6,{S+T*i})→L6
End
If K=1
Then
S+T*i→V
End
Disp “POINT”,K
Disp S
Disp T
Pause
End
Disp “OC-OC:”
Pause abs(U-V)
Disp L6

Example:

Build a bolt pattern with 5 bolts of a circle of diameter of 3 units.  The center of the circle has the center (4, 1).  (X = 4, Y = 1, N = 5, D = 3)

Bolts should be placed at the following points:
(5.5, 1)
(4.4635, 2.4266)
(2.7865, 1.8817)
(2.7865, 0.1183)
(4.4635, -0.4266)

OC-Distance:  1.7634

Note:  Bolt Patterns can easily be calculated with the Machinist Calc Pro, original (Model 4087) or Pro 2 (Model 4088) (including angle of rotation). 

This blog is property of Edward Shore – 2015.

No comments:

Post a Comment

Retro Review: HP 95LX

Retro Review:  HP 95LX Essentials Company:  Hewlett Packard Years:  1991 - 2003 Type:  Palmtop PC (a very early versi...