@@ -236,7 +236,7 @@ def intersections_tilted_plane(
236
236
"""
237
237
238
238
def intersections_plane (
239
- self ,
239
+ self ,
240
240
x : Optional [float ] = None ,
241
241
y : Optional [float ] = None ,
242
242
z : Optional [float ] = None ,
@@ -453,7 +453,9 @@ def zero_dims(self) -> list[Axis]:
453
453
return zero_dims
454
454
455
455
def _pop_bounds (
456
- self , axis : Axis , transpose : bool = False
456
+ self ,
457
+ axis : Axis ,
458
+ transpose : bool = False
457
459
) -> tuple [Coordinate2D , tuple [Coordinate2D , Coordinate2D ]]:
458
460
"""Returns min and max bounds in plane normal to and tangential to ``axis``.
459
461
@@ -561,9 +563,7 @@ def plot(
561
563
ax = self .add_ax_lims (axis = axis , ax = ax , transpose = transpose )
562
564
ax .set_aspect ("equal" )
563
565
# Add the default axis labels, tick labels, and title
564
- ax = Box .add_ax_labels_and_title (
565
- ax = ax , x = x , y = y , z = z , plot_length_units = plot_length_units , transpose = transpose
566
- )
566
+ ax = Box .add_ax_labels_and_title (ax = ax , x = x , y = y , z = z , plot_length_units = plot_length_units , transpose = transpose )
567
567
return ax
568
568
569
569
def plot_shape (self , shape : Shapely , plot_params : PlotParams , ax : Ax ) -> Ax :
@@ -649,9 +649,7 @@ def _get_plot_limits(
649
649
_ , ((xmin , ymin ), (xmax , ymax )) = self ._pop_bounds (axis = axis , transpose = transpose )
650
650
return (xmin - buffer , xmax + buffer ), (ymin - buffer , ymax + buffer )
651
651
652
- def add_ax_lims (
653
- self , axis : Axis , ax : Ax , buffer : float = PLOT_BUFFER , transpose : bool = False
654
- ) -> Ax :
652
+ def add_ax_lims (self , axis : Axis , ax : Ax , buffer : float = PLOT_BUFFER , transpose : bool = False ) -> Ax :
655
653
"""Sets the horizontal and vertical axis limits based on ``self.bounds``.
656
654
657
655
Parameters
@@ -670,9 +668,7 @@ def add_ax_lims(
670
668
matplotlib.axes._subplots.Axes
671
669
The supplied or created matplotlib axes.
672
670
"""
673
- (xmin , xmax ), (ymin , ymax ) = self ._get_plot_limits (
674
- axis = axis , buffer = buffer , transpose = transpose
675
- )
671
+ (xmin , xmax ), (ymin , ymax ) = self ._get_plot_limits (axis = axis , buffer = buffer , transpose = transpose )
676
672
677
673
# note: axes limits dont like inf values, so we need to evaluate them first if present
678
674
xmin , xmax , ymin , ymax = self ._evaluate_inf ((xmin , xmax , ymin , ymax ))
@@ -767,6 +763,7 @@ def pop_axis(
767
763
axis : int
768
764
Integer index into 'xyz' (0,1,2).
769
765
766
+
770
767
Returns
771
768
-------
772
769
Any, Tuple[Any, Any]
@@ -797,8 +794,8 @@ def pop_axis_and_swap(
797
794
Tuple of three values in original coordinate system.
798
795
axis : int
799
796
Integer index into 'xyz' (0,1,2).
800
- transpose : bool = False
801
- Optional: Swap the order of the data from the two remaining axes in the output tuple.
797
+ transpose: bool = False
798
+ Optional: Swap the order of the data from the two remaining axes in the output tuple?
802
799
803
800
Returns
804
801
-------
@@ -865,7 +862,7 @@ def unpop_axis_and_swap(
865
862
axis : int
866
863
Integer index into 'xyz' (0,1,2).
867
864
transpose: bool = False
868
- Optional: Swap the order of the entries in plane_coords[].
865
+ Optional: Swap the order of the entries in plane_coords[]?
869
866
870
867
Returns
871
868
-------
@@ -1682,7 +1679,7 @@ def intersections_tilted_plane(
1682
1679
axis = np .argmax (np .abs (normal )).item ()
1683
1680
coord = "xyz" [axis ]
1684
1681
kwargs = {coord : origin [axis ]}
1685
- section = self .intersections_plane (** kwargs )
1682
+ section = self .intersections_plane (** kwargs ) # <-- BUG?: X,Y axis order ignores normal axis direction +/-
1686
1683
# Apply transformation in the plane by removing row and column
1687
1684
to_2D_in_plane = np .delete (np .delete (to_2D , 2 , 0 ), axis , 1 )
1688
1685
@@ -1869,7 +1866,11 @@ def _order_axis(self, axis: int) -> int:
1869
1866
return axis_index [axis ]
1870
1867
1871
1868
def _order_by_axis (
1872
- self , plane_val : Any , axis_val : Any , axis : int , transpose : bool = False
1869
+ self ,
1870
+ plane_val : Any ,
1871
+ axis_val : Any ,
1872
+ axis : int ,
1873
+ transpose : bool = False
1873
1874
) -> tuple [Any , Any ]:
1874
1875
"""Orders a value in the plane and value along axis in correct (x,y) order for plotting.
1875
1876
Note: sometimes if axis=1 and we compute cross section values orthogonal to axis,
@@ -2159,9 +2160,9 @@ def _do_intersections_tilted_plane(
2159
2160
return path .polygons_full
2160
2161
2161
2162
def intersections_plane (
2162
- self ,
2163
- x : Optional [float ] = None ,
2164
- y : Optional [float ] = None ,
2163
+ self ,
2164
+ x : Optional [float ] = None ,
2165
+ y : Optional [float ] = None ,
2165
2166
z : Optional [float ] = None ,
2166
2167
transpose : bool = False ,
2167
2168
):
@@ -2264,10 +2265,7 @@ def intersections_with(self, other, transpose: bool = False):
2264
2265
shapes_plane = other .intersections_plane (** xyz_kwargs , transpose = transpose )
2265
2266
2266
2267
# intersect all shapes with the input self
2267
- bs_min , bs_max = (
2268
- self .pop_axis_and_swap (bounds , axis = normal_ind , transpose = transpose )[1 ]
2269
- for bounds in self .bounds
2270
- )
2268
+ bs_min , bs_max = (self .pop_axis_and_swap (bounds , axis = normal_ind , transpose = transpose )[1 ] for bounds in self .bounds )
2271
2269
2272
2270
shapely_box = self .make_shapely_box (bs_min [0 ], bs_min [1 ], bs_max [0 ], bs_max [1 ])
2273
2271
shapely_box = Geometry .evaluate_inf_shape (shapely_box )
@@ -2362,8 +2360,7 @@ def _plot_arrow(
2362
2360
arrow_base : :class:`.Coordinate` = None
2363
2361
Custom base of the arrow. Uses the geometry's center if not provided.
2364
2362
transpose : bool = False
2365
- Swap horizontal and vertical axes. (This overrides the default
2366
- lexicographic axis order.)
2363
+ Swap horizontal and vertical axes. (This overrides the default lexicographic axis order.)
2367
2364
2368
2365
Returns
2369
2366
-------
@@ -2376,9 +2373,7 @@ def _plot_arrow(
2376
2373
2377
2374
# conditions to check to determine whether to plot arrow, taking into account the
2378
2375
# possibility of a custom arrow base
2379
- arrow_intersecting_plane = (
2380
- len (self .intersections_plane (x = x , y = y , z = z , transpose = transpose )) > 0
2381
- )
2376
+ arrow_intersecting_plane = len (self .intersections_plane (x = x , y = y , z = z , transpose = transpose )) > 0
2382
2377
center = self .center
2383
2378
if arrow_base :
2384
2379
arrow_intersecting_plane = arrow_intersecting_plane and any (
0 commit comments