HP Forums
Bolt Pattern - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: HP Prime Software Library (/forum-15.html)
+--- Thread: Bolt Pattern (/thread-3508.html)



Bolt Pattern - Eddie W. Shore - 03-30-2015 01:41 PM

From my blog: http://edspi31415.blogspot.com/2015/03/hp-prime-ti-84-bolt-pattern.html

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.


Code:
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;

Example:

Build a bolt pattern with 5 bolts of a circle of diameter of 3 units. The center of the circle has the center (1, 4). (X = 1, Y = 4, 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


RE: Bolt Pattern - rgallier - 07-05-2015 01:41 AM

This is my output with the given input:

x + y*i
(2.5,4)
(1.46352549156,5.42658477444)
(−0.21352549156,4.88167787844)
(−0.21352549156,3.11832212156)
(1.46352549156,2.57341522556)
OC-OC: 1.76335575688