|
7 | 7 | import pathlib |
8 | 8 | import more_itertools |
9 | 9 | import numpy as np |
10 | | -from shapely.geometry import ( |
| 10 | +from shapely import ( |
11 | 11 | Polygon, |
12 | 12 | MultiPolygon, |
13 | 13 | LineString, |
14 | 14 | LinearRing, |
15 | 15 | Point, |
16 | | - box, |
17 | 16 | GeometryCollection, |
| 17 | + box, |
| 18 | + affinity, |
18 | 19 | ) |
19 | 20 | from shapely.ops import split, unary_union |
20 | | -import shapely |
21 | 21 | import matplotlib |
22 | 22 | import matplotlib.pyplot as plt |
23 | 23 | import sectionproperties.pre.pre as pre |
@@ -51,7 +51,7 @@ class Geometry: |
51 | 51 |
|
52 | 52 | def __init__( |
53 | 53 | self, |
54 | | - geom: shapely.geometry.Polygon, |
| 54 | + geom: Polygon, |
55 | 55 | material: pre.Material = pre.DEFAULT_MATERIAL, |
56 | 56 | control_points: Optional[Union[Point, List[float, float]]] = None, |
57 | 57 | tol=12, |
@@ -544,11 +544,11 @@ def shift_section( |
544 | 544 | # Move assigned control point |
545 | 545 | new_ctrl_point = None |
546 | 546 | if self.assigned_control_point: |
547 | | - new_ctrl_point = shapely.affinity.translate( |
| 547 | + new_ctrl_point = affinity.translate( |
548 | 548 | self.assigned_control_point, x_offset, y_offset |
549 | 549 | ).coords[0] |
550 | 550 | new_geom = Geometry( |
551 | | - shapely.affinity.translate(self.geom, x_offset, y_offset), |
| 551 | + affinity.translate(self.geom, x_offset, y_offset), |
552 | 552 | self.material, |
553 | 553 | new_ctrl_point, |
554 | 554 | ) |
@@ -585,11 +585,11 @@ def rotate_section( |
585 | 585 | rotate_point = rot_point |
586 | 586 | if rot_point == "center": |
587 | 587 | rotate_point = box(*self.geom.bounds).centroid |
588 | | - new_ctrl_point = shapely.affinity.rotate( |
| 588 | + new_ctrl_point = affinity.rotate( |
589 | 589 | self.assigned_control_point, angle, rotate_point, use_radians |
590 | 590 | ).coords[0] |
591 | 591 | new_geom = Geometry( |
592 | | - shapely.affinity.rotate(self.geom, angle, rot_point, use_radians), |
| 592 | + affinity.rotate(self.geom, angle, rot_point, use_radians), |
593 | 593 | self.material, |
594 | 594 | new_ctrl_point, |
595 | 595 | ) |
@@ -625,13 +625,13 @@ def mirror_section( |
625 | 625 | x_mirror = -x_mirror |
626 | 626 | elif axis == "y": |
627 | 627 | y_mirror = -y_mirror |
628 | | - mirrored_geom = shapely.affinity.scale( |
| 628 | + mirrored_geom = affinity.scale( |
629 | 629 | self.geom, xfact=y_mirror, yfact=x_mirror, zfact=1.0, origin=mirror_point |
630 | 630 | ) |
631 | 631 |
|
632 | 632 | new_ctrl_point = None |
633 | 633 | if self.assigned_control_point: |
634 | | - new_ctrl_point = shapely.affinity.scale( |
| 634 | + new_ctrl_point = affinity.scale( |
635 | 635 | self.assigned_control_point, |
636 | 636 | xfact=y_mirror, |
637 | 637 | yfact=x_mirror, |
@@ -677,7 +677,7 @@ def split_section( |
677 | 677 | The following example splits a 200PFC section about the y-axis:: |
678 | 678 |
|
679 | 679 | import sectionproperties.pre.library.steel_sections as steel_sections |
680 | | - from shapely.geometry import LineString |
| 680 | + from shapely import LineString |
681 | 681 |
|
682 | 682 | geometry = steel_sections.channel_section(d=200, b=75, t_f=12, t_w=6, r=12, n_r=8) |
683 | 683 | right_geom, left_geom = geometry.split_section((0, 0), (0, 1)) |
@@ -1672,7 +1672,7 @@ def split_section( |
1672 | 1672 | The following example splits a 200PFC section about the y-axis:: |
1673 | 1673 |
|
1674 | 1674 | import sectionproperties.pre.library.steel_sections as steel_sections |
1675 | | - from shapely.geometry import LineString |
| 1675 | + from shapely import LineString |
1676 | 1676 |
|
1677 | 1677 | geometry = steel_sections.channel_section(d=200, b=75, t_f=12, t_w=6, r=12, n_r=8) |
1678 | 1678 | right_geom, left_geom = geometry.split_section((0, 0), (0, 1)) |
|
0 commit comments