mirror of
https://github.com/gumyr/build123d.git
synced 2025-12-06 02:30:55 -08:00
Merge pull request #695 from danieledapo/dev
Fix thicken normal calculation when no override is provided
This commit is contained in:
commit
debdf845bf
2 changed files with 13 additions and 2 deletions
|
|
@ -592,12 +592,12 @@ def thicken(
|
|||
logger.info("%d face(s) to thicken", len(to_thicken_faces))
|
||||
|
||||
for face in to_thicken_faces:
|
||||
normal_override = (
|
||||
face_normal = (
|
||||
normal_override if normal_override is not None else face.normal_at()
|
||||
)
|
||||
for direction in [1, -1] if both else [1]:
|
||||
new_solids.append(
|
||||
face.thicken(depth=amount, normal_override=normal_override * direction)
|
||||
face.thicken(depth=amount, normal_override=face_normal * direction)
|
||||
)
|
||||
|
||||
if context is not None:
|
||||
|
|
|
|||
|
|
@ -475,6 +475,17 @@ class TestThicken(unittest.TestCase):
|
|||
outer_sphere = thicken(non_planar, amount=0.1)
|
||||
self.assertAlmostEqual(outer_sphere.volume, (4 / 3) * pi * (1.1**3 - 1**3), 5)
|
||||
|
||||
wire = JernArc((0, 0), (-1, 0), 1, 180).edge().reversed() + JernArc(
|
||||
(0, 0), (1, 0), 2, -90
|
||||
)
|
||||
part = thicken(sweep((wire ^ 0) * RadiusArc((0, 0), (0, -1), 1), wire), 0.4)
|
||||
self.assertAlmostEqual(part.volume, 2.241583787221904, 5)
|
||||
|
||||
part = thicken(
|
||||
sweep((wire ^ 0) * RadiusArc((0, 0), (0, -1), 1), wire), 0.4, both=True
|
||||
)
|
||||
self.assertAlmostEqual(part.volume, 4.711747154435256, 5)
|
||||
|
||||
|
||||
class TestTorus(unittest.TestCase):
|
||||
def test_simple_torus(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue