Coverage for /opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/site-packages/hypervehicle/components/revolved.py: 100%

12 statements  

« prev     ^ index     » next       coverage.py v7.6.4, created at 2024-10-29 02:51 +0000

1import numpy as np 

2from hypervehicle.geometry.geometry import RevolvedPatch 

3from hypervehicle.components.component import Component 

4from hypervehicle.components.constants import REVOLVED_COMPONENT 

5 

6 

7class RevolvedComponent(Component): 

8 componenttype = REVOLVED_COMPONENT 

9 

10 def __init__( 

11 self, 

12 revolve_line, 

13 stl_resolution: int = 4, 

14 verbosity: int = 1, 

15 name: str = None, 

16 ) -> None: 

17 """Create a revolved component. 

18 

19 Parameters 

20 ---------- 

21 revolve_line : Line|PolyLine|Bezier 

22 A line to be revolved about the primary axis. 

23 """ 

24 self.revolve_line = revolve_line 

25 super().__init__(stl_resolution=stl_resolution, verbosity=verbosity, name=name) 

26 

27 def generate_patches(self): 

28 for i in range(4): 

29 self.patches[f"revolved_fuse_{i}"] = RevolvedPatch( 

30 self.revolve_line, i * np.pi / 2, (i + 1) * np.pi / 2 

31 )