@@ -534,6 +534,9 @@ def _intersections_normal(self, z: float):
534534 For more details refer to
535535 `Shapely's Documentaton <https://shapely.readthedocs.io/en/stable/project.html>`_.
536536 """
537+ if isclose (self .sidewall_angle , 0 ):
538+ return [shapely .Polygon (self .reference_polygon )]
539+
537540 z0 = self .center_axis
538541 z_local = z - z0 # distance to the middle
539542 dist = - z_local * self ._tanq
@@ -590,19 +593,18 @@ def _intersections_side(self, position, axis) -> list:
590593 h_length = h_top - h_base
591594
592595 # coordinate of each subsection
593- z_min , z_max = z_base + h_base , z_base + h_top
594-
595- # vertices for the base of each subsection
596- # move up by `fp_eps` in case vertices are degenerate at the base.
597- dist = - (h_base - self .length_axis / 2 + fp_eps ) * self ._tanq
598- vertices = self ._shift_vertices (self .middle_polygon , dist )[0 ]
596+ z_min = z_base + h_base
597+ z_max = np .inf if np .isposinf (h_top ) else z_base + h_top
599598
600599 # for vertical sidewall, no need for complications
601600 if isclose (self .sidewall_angle , 0 ):
602601 ints_y , ints_angle = self ._find_intersecting_ys_angle_vertical (
603- vertices , position , axis_ordered
602+ self . reference_polygon , position , axis_ordered
604603 )
605604 else :
605+ # for slanted sidewall, move up by `fp_eps` in case vertices are degenerate at the base.
606+ dist = - (h_base - self .length_axis / 2 + fp_eps ) * self ._tanq
607+ vertices = self ._shift_vertices (self .middle_polygon , dist )[0 ]
606608 ints_y , ints_angle = self ._find_intersecting_ys_angle_slant (
607609 vertices , position , axis_ordered
608610 )
@@ -884,12 +886,13 @@ def bounds(self) -> Bound:
884886
885887 # check for the maximum possible contribution from dilation/slant on each side
886888 max_offset = self .dilation
887- if self .reference_plane == "bottom" :
888- max_offset += max (0 , - self ._tanq * self .length_axis )
889- elif self .reference_plane == "top" :
890- max_offset += max (0 , self ._tanq * self .length_axis )
891- elif self .reference_plane == "middle" :
892- max_offset += max (0 , abs (self ._tanq ) * self .length_axis / 2 )
889+ if not isclose (self .sidewall_angle , 0 ):
890+ if self .reference_plane == "bottom" :
891+ max_offset += max (0 , - self ._tanq * self .length_axis )
892+ elif self .reference_plane == "top" :
893+ max_offset += max (0 , self ._tanq * self .length_axis )
894+ elif self .reference_plane == "middle" :
895+ max_offset += max (0 , abs (self ._tanq ) * self .length_axis / 2 )
893896
894897 # special care when dilated
895898 if max_offset > 0 :
0 commit comments