misc type hint fixes
This commit is contained in:
parent
c3534beb3f
commit
0e34242ba5
@ -21,7 +21,7 @@ def ell(
|
|||||||
*,
|
*,
|
||||||
spacing: float | ArrayLike | None = None,
|
spacing: float | ArrayLike | None = None,
|
||||||
set_rotation: float | None = None,
|
set_rotation: float | None = None,
|
||||||
) -> dict[str, float]:
|
) -> dict[str, numpy.float64]:
|
||||||
"""
|
"""
|
||||||
Calculate extension for each port in order to build a 90-degree bend with the provided
|
Calculate extension for each port in order to build a 90-degree bend with the provided
|
||||||
channel spacing:
|
channel spacing:
|
||||||
|
@ -233,7 +233,7 @@ class Arc(Shape):
|
|||||||
r0, r1 = self.radii
|
r0, r1 = self.radii
|
||||||
|
|
||||||
# Convert from polar angle to ellipse parameter (for [rx*cos(t), ry*sin(t)] representation)
|
# Convert from polar angle to ellipse parameter (for [rx*cos(t), ry*sin(t)] representation)
|
||||||
a_ranges = cast(tuple[tuple[float, float], tuple[float, float]], self._angles_to_parameters())
|
a_ranges = cast(_array2x2_t, self._angles_to_parameters())
|
||||||
|
|
||||||
# Approximate perimeter via numerical integration
|
# Approximate perimeter via numerical integration
|
||||||
|
|
||||||
@ -286,6 +286,7 @@ class Arc(Shape):
|
|||||||
thetas = thetas[::-1]
|
thetas = thetas[::-1]
|
||||||
return thetas
|
return thetas
|
||||||
|
|
||||||
|
thetas_inner: NDArray[numpy.float64]
|
||||||
if wh in (r0, r1):
|
if wh in (r0, r1):
|
||||||
thetas_inner = numpy.zeros(1) # Don't generate multiple vertices if we're at the origin
|
thetas_inner = numpy.zeros(1) # Don't generate multiple vertices if we're at the origin
|
||||||
else:
|
else:
|
||||||
@ -320,7 +321,7 @@ class Arc(Shape):
|
|||||||
|
|
||||||
If the extrema are innaccessible due to arc constraints, check the arc endpoints instead.
|
If the extrema are innaccessible due to arc constraints, check the arc endpoints instead.
|
||||||
"""
|
"""
|
||||||
a_ranges = self._angles_to_parameters()
|
a_ranges = cast(_array2x2_t, self._angles_to_parameters())
|
||||||
|
|
||||||
mins = []
|
mins = []
|
||||||
maxs = []
|
maxs = []
|
||||||
@ -431,7 +432,7 @@ class Arc(Shape):
|
|||||||
[[x2, y2], [x3, y3]]], would create this arc from its corresponding ellipse.
|
[[x2, y2], [x3, y3]]], would create this arc from its corresponding ellipse.
|
||||||
```
|
```
|
||||||
"""
|
"""
|
||||||
a_ranges = self._angles_to_parameters()
|
a_ranges = cast(_array2x2_t, self._angles_to_parameters())
|
||||||
|
|
||||||
mins = []
|
mins = []
|
||||||
maxs = []
|
maxs = []
|
||||||
@ -479,3 +480,5 @@ class Arc(Shape):
|
|||||||
angles = f' a°{numpy.rad2deg(self.angles)}'
|
angles = f' a°{numpy.rad2deg(self.angles)}'
|
||||||
rotation = f' r°{numpy.rad2deg(self.rotation):g}' if self.rotation != 0 else ''
|
rotation = f' r°{numpy.rad2deg(self.rotation):g}' if self.rotation != 0 else ''
|
||||||
return f'<Arc o{self.offset} r{self.radii}{angles} w{self.width:g}{rotation}>'
|
return f'<Arc o{self.offset} r{self.radii}{angles} w{self.width:g}{rotation}>'
|
||||||
|
|
||||||
|
_array2x2_t = tuple[tuple[float, float], tuple[float, float]]
|
||||||
|
@ -271,7 +271,7 @@ class Path(Shape):
|
|||||||
# TODO: Path.travel() needs testing
|
# TODO: Path.travel() needs testing
|
||||||
direction = numpy.array([1, 0])
|
direction = numpy.array([1, 0])
|
||||||
|
|
||||||
verts = [numpy.zeros(2)]
|
verts: list[NDArray[numpy.float64]] = [numpy.zeros(2)]
|
||||||
for angle, distance in travel_pairs:
|
for angle, distance in travel_pairs:
|
||||||
direction = numpy.dot(rotation_matrix_2d(angle), direction.T).T
|
direction = numpy.dot(rotation_matrix_2d(angle), direction.T).T
|
||||||
verts.append(verts[-1] + direction * distance)
|
verts.append(verts[-1] + direction * distance)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user