Skip to content

Commit

Permalink
Hinge: Fix margin
Browse files Browse the repository at this point in the history
Do proper calculations instead of just using 3 * thickness as a rough
guess.

Resolves: #584
  • Loading branch information
florianfesti committed Mar 30, 2024
1 parent 3d688bf commit e669fa7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion boxes/edges.py
Original file line number Diff line number Diff line change
Expand Up @@ -1329,7 +1329,14 @@ def __init__(self, boxes, settings=None, layout: int = 1) -> None:
self.description = self.description + ('', ' (start)', ' (end)', ' (both ends)')[layout]

def margin(self) -> float:
return 3 * self.settings.thickness
t: float = self.settings.thickness
if self.settings.style == "outset":
r = 0.5 * self.settings.axle
alpha = math.degrees(math.asin(0.5 * t / r))
pos = math.cos(math.radians(alpha)) * r
return 1.5 * t + pos
else: # flush
return 0.5 * t + 0.5 * self.settings.axle + self.settings.hingestrength

def outset(self, _reversed: bool = False) -> None:
t: float = self.settings.thickness
Expand Down

0 comments on commit e669fa7

Please sign in to comment.