Skip to content

Commit a1ed447

Browse files
committed
updated primitives.py and reverted monitor.py to its original state (I think)
1 parent 6c65db5 commit a1ed447

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

tidy3d/components/geometry/primitives.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,8 @@ def _update_from_bounds(self, bounds: tuple[float, float], axis: Axis) -> Cylind
378378

379379
@verify_packages_import(["trimesh"])
380380
def _do_intersections_tilted_plane(
381-
self, normal: Coordinate, origin: Coordinate, to_2D: MatrixReal4x4
381+
self, normal: Coordinate, origin: Coordinate, to_2D: MatrixReal4x4,
382+
transpose: bool = False,
382383
) -> list[Shapely]:
383384
"""Return a list of shapely geometries at the plane specified by normal and origin.
384385
@@ -390,6 +391,8 @@ def _do_intersections_tilted_plane(
390391
Vector defining the plane origin.
391392
to_2D : MatrixReal4x4
392393
Transformation matrix to apply to resulting shapes.
394+
transpose : bool = False
395+
Optional: Swap coordinates in the plane perpendicular to the normal vector?
393396
394397
Returns
395398
-------
@@ -400,7 +403,7 @@ def _do_intersections_tilted_plane(
400403
"""
401404
import trimesh
402405

403-
z0, (x0, y0) = self.pop_axis(self.center, self.axis)
406+
z0, (x0, y0) = self.pop_axis(self.center, self.axis, transpose=transpose)
404407
half_length = self.finite_length_axis / 2
405408

406409
z_top = z0 + half_length
@@ -442,7 +445,7 @@ def _do_intersections_tilted_plane(
442445
x = np.hstack((x_bot, x_top))
443446
y = np.hstack((y_bot, y_top))
444447
z = np.hstack((np.full_like(x_bot, z_bot), np.full_like(x_top, z_top)))
445-
vertices = np.vstack(self.unpop_axis(z, (x, y), self.axis)).T
448+
vertices = np.vstack(self.unpop_axis(z, (x, y), self.axis, transpose=transpose)).T
446449

447450
if x_bot.shape[0] == 1:
448451
m = 1

tidy3d/components/monitor.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -993,7 +993,6 @@ def local_origin(self) -> Coordinate:
993993
def window_parameters(
994994
self,
995995
custom_bounds: Bound = None,
996-
transpose: bool = False,
997996
) -> tuple[Size, Coordinate, Coordinate]:
998997
"""Return the physical size of the window transition region based on the monitor's size
999998
and optional custom bounds (useful in case the monitor has infinite dimensions). The window
@@ -1008,7 +1007,7 @@ def window_parameters(
10081007
if self.size.count(0.0) != 1:
10091008
return window_size, window_minus, window_plus
10101009

1011-
_, plane_inds = self.pop_axis([0, 1, 2], axis=self.size.index(0.0), transpose=transpose)
1010+
_, plane_inds = self.pop_axis([0, 1, 2], axis=self.size.index(0.0))
10121011

10131012
for i, ind in enumerate(plane_inds):
10141013
if custom_bounds:

0 commit comments

Comments
 (0)