@@ -367,9 +367,9 @@ def calculate_extents(self):
367367 return (x_min , x_max , y_min , y_max )
368368
369369 def draw_radius (self , pt , r , theta , n , anti = True ):
370- """Adds a radius of points to the points list - centered at point *pt*,
371- with radius *r*, starting at angle *theta*, with *n* points. If r = 0,
372- adds pt only.
370+ """Adds a quarter radius of points to the points list - centered at
371+ point *pt*, with radius *r*, starting at angle *theta*, with *n*
372+ points. If r = 0, adds pt only.
373373
374374 :param pt: Centre of radius *(x,y)*
375375 :type pt: list[float, float]
@@ -909,35 +909,12 @@ def __init__(self, d, b, t_f, t_w, r, n_r, shift=[0, 0]):
909909 self .points .append ([b , t_f ])
910910
911911 # construct the bottom right radius
912- if r == 0 :
913- self .points .append ([b * 0.5 + t_w * 0.5 , t_f ])
914- else :
915- for i in range (n_r ):
916- # determine polar angle
917- theta = 3.0 / 2 * np .pi * (
918- 1 - i * 1.0 / max (1 , n_r - 1 ) * 1.0 / 3 )
919-
920- # calculate the locations of the radius points
921- x = b * 0.5 + t_w * 0.5 + r + r * np .cos (theta )
922- y = t_f + r + r * np .sin (theta )
923-
924- # append the current points to the points list
925- self .points .append ([x , y ])
912+ pt = [b * 0.5 + t_w * 0.5 + r , t_f + r ]
913+ self .draw_radius (pt , r , 1.5 * np .pi , n_r , False )
926914
927915 # construct the top right radius
928- if r == 0 :
929- self .points .append ([b * 0.5 + t_w * 0.5 , d - t_f ])
930- else :
931- for i in range (n_r ):
932- # determine polar angle
933- theta = np .pi * (1 - i * 1.0 / max (1 , n_r - 1 ) * 0.5 )
934-
935- # calculate the locations of the radius points
936- x = b * 0.5 + t_w * 0.5 + r + r * np .cos (theta )
937- y = d - t_f - r + r * np .sin (theta )
938-
939- # append the current points to the points list
940- self .points .append ([x , y ])
916+ pt = [b * 0.5 + t_w * 0.5 + r , d - t_f - r ]
917+ self .draw_radius (pt , r , np .pi , n_r , False )
941918
942919 # add the next four points
943920 self .points .append ([b , d - t_f ])
@@ -946,34 +923,12 @@ def __init__(self, d, b, t_f, t_w, r, n_r, shift=[0, 0]):
946923 self .points .append ([0 , d - t_f ])
947924
948925 # construct the top left radius
949- if r == 0 :
950- self .points .append ([b * 0.5 - t_w * 0.5 , d - t_f ])
951- else :
952- for i in range (n_r ):
953- # determine polar angle
954- theta = np .pi * 0.5 * (1 - i * 1.0 / max (1 , n_r - 1 ))
955-
956- # calculate the locations of the radius points
957- x = b * 0.5 - t_w * 0.5 - r + r * np .cos (theta )
958- y = d - t_f - r + r * np .sin (theta )
959-
960- # append the current points to the points list
961- self .points .append ([x , y ])
926+ pt = [b * 0.5 - t_w * 0.5 - r , d - t_f - r ]
927+ self .draw_radius (pt , r , 0.5 * np .pi , n_r , False )
962928
963929 # construct the bottom left radius
964- if r == 0 :
965- self .points .append ([b * 0.5 - t_w * 0.5 , t_f ])
966- else :
967- for i in range (n_r ):
968- # determine polar angle
969- theta = - np .pi * i * 1.0 / max (1 , n_r - 1 ) * 0.5
970-
971- # calculate the locations of the radius points
972- x = b * 0.5 - t_w * 0.5 - r + r * np .cos (theta )
973- y = t_f + r + r * np .sin (theta )
974-
975- # append the current points to the points list
976- self .points .append ([x , y ])
930+ pt = [b * 0.5 - t_w * 0.5 - r , t_f + r ]
931+ self .draw_radius (pt , r , 0 , n_r , False )
977932
978933 # add the last point
979934 self .points .append ([0 , t_f ])
@@ -1049,35 +1004,12 @@ def __init__(self, d, b_t, b_b, t_fb, t_ft, t_w, r, n_r, shift=[0, 0]):
10491004 self .points .append ([x_central + b_b * 0.5 , t_fb ])
10501005
10511006 # construct the bottom right radius
1052- if r == 0 :
1053- self .points .append ([x_central + t_w * 0.5 , t_fb ])
1054- else :
1055- for i in range (n_r ):
1056- # determine polar angle
1057- theta = 3.0 / 2 * np .pi * (
1058- 1 - i * 1.0 / max (1 , n_r - 1 ) * 1.0 / 3 )
1059-
1060- # calculate the locations of the radius points
1061- x = x_central + t_w * 0.5 + r + r * np .cos (theta )
1062- y = t_fb + r + r * np .sin (theta )
1063-
1064- # append the current points to the points list
1065- self .points .append ([x , y ])
1007+ pt = [x_central + t_w * 0.5 + r , t_fb + r ]
1008+ self .draw_radius (pt , r , 1.5 * np .pi , n_r , False )
10661009
10671010 # construct the top right radius
1068- if r == 0 :
1069- self .points .append ([x_central + t_w * 0.5 , d - t_ft ])
1070- else :
1071- for i in range (n_r ):
1072- # determine polar angle
1073- theta = np .pi * (1 - i * 1.0 / max (1 , n_r - 1 ) * 0.5 )
1074-
1075- # calculate the locations of the radius points
1076- x = x_central + t_w * 0.5 + r + r * np .cos (theta )
1077- y = d - t_ft - r + r * np .sin (theta )
1078-
1079- # append the current points to the points list
1080- self .points .append ([x , y ])
1011+ pt = [x_central + t_w * 0.5 + r , d - t_ft - r ]
1012+ self .draw_radius (pt , r , np .pi , n_r , False )
10811013
10821014 # add the next four points
10831015 self .points .append ([x_central + b_t * 0.5 , d - t_ft ])
@@ -1086,34 +1018,12 @@ def __init__(self, d, b_t, b_b, t_fb, t_ft, t_w, r, n_r, shift=[0, 0]):
10861018 self .points .append ([x_central - b_t * 0.5 , d - t_ft ])
10871019
10881020 # construct the top left radius
1089- if r == 0 :
1090- self .points .append ([x_central - t_w * 0.5 , d - t_ft ])
1091- else :
1092- for i in range (n_r ):
1093- # determine polar angle
1094- theta = np .pi * 0.5 * (1 - i * 1.0 / max (1 , n_r - 1 ))
1095-
1096- # calculate the locations of the radius points
1097- x = x_central - t_w * 0.5 - r + r * np .cos (theta )
1098- y = d - t_ft - r + r * np .sin (theta )
1099-
1100- # append the current points to the points list
1101- self .points .append ([x , y ])
1021+ pt = [x_central - t_w * 0.5 - r , d - t_ft - r ]
1022+ self .draw_radius (pt , r , 0.5 * np .pi , n_r , False )
11021023
11031024 # construct the bottom left radius
1104- if r == 0 :
1105- self .points .append ([x_central - t_w * 0.5 , t_fb ])
1106- else :
1107- for i in range (n_r ):
1108- # determine polar angle
1109- theta = - np .pi * i * 1.0 / max (1 , n_r - 1 ) * 0.5
1110-
1111- # calculate the locations of the radius points
1112- x = x_central - t_w * 0.5 - r + r * np .cos (theta )
1113- y = t_fb + r + r * np .sin (theta )
1114-
1115- # append the current points to the points list
1116- self .points .append ([x , y ])
1025+ pt = [x_central - t_w * 0.5 - r , t_fb + r ]
1026+ self .draw_radius (pt , r , 0 , n_r , False )
11171027
11181028 # add the last point
11191029 self .points .append ([x_central - b_b * 0.5 , t_fb ])
@@ -1391,35 +1301,12 @@ def __init__(self, d, b, t_f, t_w, r, n_r, shift=[0, 0]):
13911301 self .points .append ([b , t_f ])
13921302
13931303 # construct the bottom right radius
1394- if r == 0 :
1395- self .points .append ([t_w , t_f ])
1396- else :
1397- for i in range (n_r ):
1398- # determine polar angle
1399- theta = 3.0 / 2 * np .pi * (1 - i * 1.0 / max (
1400- 1 , n_r - 1 ) * 1.0 / 3 )
1401-
1402- # calculate the locations of the radius points
1403- x = t_w + r + r * np .cos (theta )
1404- y = t_f + r + r * np .sin (theta )
1405-
1406- # append the current points to the points list
1407- self .points .append ([x , y ])
1304+ pt = [t_w + r , t_f + r ]
1305+ self .draw_radius (pt , r , 1.5 * np .pi , n_r , False )
14081306
14091307 # construct the top right radius
1410- if r == 0 :
1411- self .points .append ([t_w , d - t_f ])
1412- else :
1413- for i in range (n_r ):
1414- # determine polar angle
1415- theta = np .pi * (1 - i * 1.0 / max (1 , n_r - 1 ) * 0.5 )
1416-
1417- # calculate the locations of the radius points
1418- x = t_w + r + r * np .cos (theta )
1419- y = d - t_f - r + r * np .sin (theta )
1420-
1421- # append the current points to the points list
1422- self .points .append ([x , y ])
1308+ pt = [t_w + r , d - t_f - r ]
1309+ self .draw_radius (pt , r , np .pi , n_r , False )
14231310
14241311 # add last three points
14251312 self .points .append ([b , d - t_f ])
@@ -1635,19 +1522,8 @@ def __init__(self, d, b, t_f, t_w, r, n_r, shift=[0, 0]):
16351522 self .points .append ([b * 0.5 + t_w * 0.5 , 0 ])
16361523
16371524 # construct the top right radius
1638- if r == 0 :
1639- self .points .append ([b * 0.5 + t_w * 0.5 , d - t_f ])
1640- else :
1641- for i in range (n_r ):
1642- # determine polar angle
1643- theta = np .pi * (1 - i * 1.0 / max (1 , n_r - 1 ) * 0.5 )
1644-
1645- # calculate the locations of the radius points
1646- x = b * 0.5 + t_w * 0.5 + r + r * np .cos (theta )
1647- y = d - t_f - r + r * np .sin (theta )
1648-
1649- # append the current points to the points list
1650- self .points .append ([x , y ])
1525+ pt = [b * 0.5 + t_w * 0.5 + r , d - t_f - r ]
1526+ self .draw_radius (pt , r , np .pi , n_r , False )
16511527
16521528 # add next four points
16531529 self .points .append ([b , d - t_f ])
@@ -1656,19 +1532,8 @@ def __init__(self, d, b, t_f, t_w, r, n_r, shift=[0, 0]):
16561532 self .points .append ([0 , d - t_f ])
16571533
16581534 # construct the top left radius
1659- if r == 0 :
1660- self .points .append ([b * 0.5 - t_w * 0.5 , d - t_f ])
1661- else :
1662- for i in range (n_r ):
1663- # determine polar angle
1664- theta = np .pi * 0.5 * (1 - i * 1.0 / max (1 , n_r - 1 ))
1665-
1666- # calculate the locations of the radius points
1667- x = b * 0.5 - t_w * 0.5 - r + r * np .cos (theta )
1668- y = d - t_f - r + r * np .sin (theta )
1669-
1670- # append the current points to the points list
1671- self .points .append ([x , y ])
1535+ pt = [b * 0.5 - t_w * 0.5 - r , d - t_f - r ]
1536+ self .draw_radius (pt , r , 0.5 * np .pi , n_r , False )
16721537
16731538 # build the facet list
16741539 for i in range (len (self .points )):
@@ -1730,50 +1595,16 @@ def __init__(self, d, b, t, r_r, r_t, n_r, shift=[0, 0]):
17301595 self .points .append ([b , 0 ])
17311596
17321597 # construct the bottom toe radius
1733- if r_t == 0 :
1734- self .points .append ([b , t ])
1735- else :
1736- for i in range (n_r ):
1737- # determine polar angle
1738- theta = i * 1.0 / max (1 , n_r - 1 ) * np .pi * 0.5
1739-
1740- # calculate the locations of the radius points
1741- x = b - r_t + r_t * np .cos (theta )
1742- y = t - r_t + r_t * np .sin (theta )
1743-
1744- # append the current points to the points list
1745- self .points .append ([x , y ])
1598+ pt = [b - r_t , t - r_t ]
1599+ self .draw_radius (pt , r_t , 0 , n_r )
17461600
17471601 # construct the root radius
1748- if r_r == 0 :
1749- self .points .append ([t , t ])
1750- else :
1751- for i in range (n_r ):
1752- # determine polar angle
1753- theta = 3.0 / 2 * np .pi * (1 - i * 1.0 / max (
1754- 1 , n_r - 1 ) * 1.0 / 3 )
1755-
1756- # calculate the locations of the radius points
1757- x = t + r_r + r_r * np .cos (theta )
1758- y = t + r_r + r_r * np .sin (theta )
1759-
1760- # append the current points to the points list
1761- self .points .append ([x , y ])
1602+ pt = [t + r_r , t + r_r ]
1603+ self .draw_radius (pt , r_r , 1.5 * np .pi , n_r , False )
17621604
17631605 # construct the top toe radius
1764- if r_t == 0 :
1765- self .points .append ([t , d ])
1766- else :
1767- for i in range (n_r ):
1768- # determine polar angle
1769- theta = i * 1.0 / max (1 , n_r - 1 ) * np .pi * 0.5
1770-
1771- # calculate the locations of the radius points
1772- x = t - r_t + r_t * np .cos (theta )
1773- y = d - r_t + r_t * np .sin (theta )
1774-
1775- # append the current points to the points list
1776- self .points .append ([x , y ])
1606+ pt = [t - r_t , d - r_t ]
1607+ self .draw_radius (pt , r_t , 0 , n_r )
17771608
17781609 # add the next point
17791610 self .points .append ([0 , d ])
@@ -2039,76 +1870,32 @@ def __init__(self, d, b, t, r, n_r, shift=[0, 0]):
20391870 self .points .append ([t * 0.5 , - d * 0.5 ])
20401871
20411872 # construct the bottom right radius
2042- if r == 0 :
2043- self .points .append ([0.5 * t , - 0.5 * t ])
2044- else :
2045- for i in range (n_r ):
2046- # determine polar angle
2047- theta = np .pi - i * 1.0 / max (1 , n_r - 1 ) * np .pi * 0.5
2048-
2049- # calculate the locations of the radius points
2050- x = 0.5 * t + r + r * np .cos (theta )
2051- y = - 0.5 * t - r + r * np .sin (theta )
2052-
2053- # append the current points to the points list
2054- self .points .append ([x , y ])
1873+ pt = [0.5 * t + r , - 0.5 * t - r ]
1874+ self .draw_radius (pt , r , np .pi , n_r , False )
20551875
20561876 # add the next two points
20571877 self .points .append ([0.5 * b , - t * 0.5 ])
20581878 self .points .append ([0.5 * b , t * 0.5 ])
20591879
20601880 # construct the top right radius
2061- if r == 0 :
2062- self .points .append ([0.5 * t , 0.5 * t ])
2063- else :
2064- for i in range (n_r ):
2065- # determine polar angle
2066- theta = 1.5 * np .pi - i * 1.0 / max (1 , n_r - 1 ) * np .pi * 0.5
2067-
2068- # calculate the locations of the radius points
2069- x = 0.5 * t + r + r * np .cos (theta )
2070- y = 0.5 * t + r + r * np .sin (theta )
2071-
2072- # append the current points to the points list
2073- self .points .append ([x , y ])
1881+ pt = [0.5 * t + r , 0.5 * t + r ]
1882+ self .draw_radius (pt , r , 1.5 * np .pi , n_r , False )
20741883
20751884 # add the next two points
20761885 self .points .append ([t * 0.5 , 0.5 * d ])
20771886 self .points .append ([- t * 0.5 , 0.5 * d ])
20781887
20791888 # construct the top left radius
2080- if r == 0 :
2081- self .points .append ([- 0.5 * t , 0.5 * t ])
2082- else :
2083- for i in range (n_r ):
2084- # determine polar angle
2085- theta = - i * 1.0 / max (1 , n_r - 1 ) * np .pi * 0.5
2086-
2087- # calculate the locations of the radius points
2088- x = - 0.5 * t - r + r * np .cos (theta )
2089- y = 0.5 * t + r + r * np .sin (theta )
2090-
2091- # append the current points to the points list
2092- self .points .append ([x , y ])
1889+ pt = [- 0.5 * t - r , 0.5 * t + r ]
1890+ self .draw_radius (pt , r , 0 , n_r , False )
20931891
20941892 # add the next two points
20951893 self .points .append ([- 0.5 * b , t * 0.5 ])
20961894 self .points .append ([- 0.5 * b , - t * 0.5 ])
20971895
20981896 # construct the bottom left radius
2099- if r == 0 :
2100- self .points .append ([- 0.5 * t , - 0.5 * t ])
2101- else :
2102- for i in range (n_r ):
2103- # determine polar angle
2104- theta = np .pi * 0.5 - i * 1.0 / max (1 , n_r - 1 ) * np .pi * 0.5
2105-
2106- # calculate the locations of the radius points
2107- x = - 0.5 * t - r + r * np .cos (theta )
2108- y = - 0.5 * t - r + r * np .sin (theta )
2109-
2110- # append the current points to the points list
2111- self .points .append ([x , y ])
1897+ pt = [- 0.5 * t - r , - 0.5 * t - r ]
1898+ self .draw_radius (pt , r , 0.5 * np .pi , n_r , False )
21121899
21131900 # build the facet list
21141901 for i in range (len (self .points )):
0 commit comments