|
5 | 5 | from typing import Optional, cast |
6 | 6 |
|
7 | 7 | import numpy as np |
8 | | -from matplotlib.axes import Axes |
9 | | -from mpl_toolkits.mplot3d import Axes3D |
10 | 8 |
|
11 | 9 | from skspatial.objects._base_line_plane import _BaseLinePlane |
12 | 10 | from skspatial.objects.point import Point |
13 | 11 | from skspatial.objects.points import Points |
14 | 12 | from skspatial.objects.vector import Vector |
15 | | -from skspatial.plotting import _connect_points_2d, _connect_points_3d |
16 | 13 | from skspatial.transformation import transform_coordinates |
17 | 14 | from skspatial.typing import array_like |
18 | 15 |
|
@@ -265,7 +262,7 @@ def to_point(self, t: float = 1) -> Point: |
265 | 262 | """ |
266 | 263 | vector_along_line = t * self.direction |
267 | 264 |
|
268 | | - return self.point + vector_along_line |
| 265 | + return cast(Point, self.point + vector_along_line) |
269 | 266 |
|
270 | 267 | def project_point(self, point: array_like) -> Point: |
271 | 268 | """ |
@@ -787,7 +784,7 @@ def transform_points(self, points: array_like) -> np.ndarray: |
787 | 784 |
|
788 | 785 | return column.flatten() |
789 | 786 |
|
790 | | - def plot_2d(self, ax_2d: Axes, t_1: float = 0, t_2: float = 1, **kwargs) -> None: |
| 787 | + def plot_2d(self, ax_2d, t_1: float = 0, t_2: float = 1, **kwargs) -> None: |
791 | 788 | """ |
792 | 789 | Plot a 2D line. |
793 | 790 |
|
@@ -821,12 +818,14 @@ def plot_2d(self, ax_2d: Axes, t_1: float = 0, t_2: float = 1, **kwargs) -> None |
821 | 818 | >>> grid = ax.grid() |
822 | 819 |
|
823 | 820 | """ |
| 821 | + from skspatial.plotting import _connect_points_2d |
| 822 | + |
824 | 823 | point_1 = self.to_point(t_1) |
825 | 824 | point_2 = self.to_point(t_2) |
826 | 825 |
|
827 | 826 | _connect_points_2d(ax_2d, point_1, point_2, **kwargs) |
828 | 827 |
|
829 | | - def plot_3d(self, ax_3d: Axes3D, t_1: float = 0, t_2: float = 1, **kwargs) -> None: |
| 828 | + def plot_3d(self, ax_3d, t_1: float = 0, t_2: float = 1, **kwargs) -> None: |
830 | 829 | """ |
831 | 830 | Plot a 3D line. |
832 | 831 |
|
@@ -862,6 +861,8 @@ def plot_3d(self, ax_3d: Axes3D, t_1: float = 0, t_2: float = 1, **kwargs) -> No |
862 | 861 | >>> line.point.plot_3d(ax, s=100) |
863 | 862 |
|
864 | 863 | """ |
| 864 | + from skspatial.plotting import _connect_points_3d |
| 865 | + |
865 | 866 | point_1 = self.to_point(t_1) |
866 | 867 | point_2 = self.to_point(t_2) |
867 | 868 |
|
|
0 commit comments