pfc-geometry 0.2.10__py3-none-any.whl → 0.2.11__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- geometry/base.py +6 -0
- geometry/coordinate_frame.py +9 -9
- geometry/point.py +10 -5
- geometry/quaternion.py +4 -1
- {pfc_geometry-0.2.10.dist-info → pfc_geometry-0.2.11.dist-info}/METADATA +1 -1
- pfc_geometry-0.2.11.dist-info/RECORD +15 -0
- {pfc_geometry-0.2.10.dist-info → pfc_geometry-0.2.11.dist-info}/WHEEL +1 -1
- pfc_geometry-0.2.10.dist-info/RECORD +0 -15
- {pfc_geometry-0.2.10.dist-info → pfc_geometry-0.2.11.dist-info}/LICENSE +0 -0
- {pfc_geometry-0.2.10.dist-info → pfc_geometry-0.2.11.dist-info}/top_level.txt +0 -0
geometry/base.py
CHANGED
|
@@ -353,3 +353,9 @@ class Base:
|
|
|
353
353
|
self.data,
|
|
354
354
|
)).ffill().bfill().to_numpy()
|
|
355
355
|
)
|
|
356
|
+
|
|
357
|
+
def ffill(self):
|
|
358
|
+
return self.__class__(pd.DataFrame(self.data).ffill().to_numpy())
|
|
359
|
+
|
|
360
|
+
def bfill(self):
|
|
361
|
+
return self.__class__(pd.DataFrame(self.data).bfill().to_numpy())
|
geometry/coordinate_frame.py
CHANGED
|
@@ -9,7 +9,7 @@ FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
|
9
9
|
You should have received a copy of the GNU General Public License along with
|
|
10
10
|
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
11
11
|
"""
|
|
12
|
-
|
|
12
|
+
from __future__ import annotations
|
|
13
13
|
from geometry import Point, Quaternion, PX, PY, PZ, P0
|
|
14
14
|
from typing import List
|
|
15
15
|
import numpy as np
|
|
@@ -33,7 +33,7 @@ class Coord(Base):
|
|
|
33
33
|
self.z_axis=Point(self.data[:,9:12])
|
|
34
34
|
|
|
35
35
|
@staticmethod
|
|
36
|
-
def from_axes(o:Point, x:Point, y:Point, z:Point):
|
|
36
|
+
def from_axes(o:Point, x:Point, y:Point, z:Point) -> Coord:
|
|
37
37
|
assert len(o) == len(x) == len(y) == len(z)
|
|
38
38
|
return Coord(np.concatenate([
|
|
39
39
|
o.data,
|
|
@@ -43,25 +43,25 @@ class Coord(Base):
|
|
|
43
43
|
],axis=1))
|
|
44
44
|
|
|
45
45
|
@staticmethod
|
|
46
|
-
def zero(count=1):
|
|
46
|
+
def zero(count=1) -> Coord:
|
|
47
47
|
return Coord.from_nothing(count)
|
|
48
48
|
|
|
49
49
|
@staticmethod
|
|
50
|
-
def from_nothing(count=1):
|
|
50
|
+
def from_nothing(count=1) -> Coord:
|
|
51
51
|
return Coord.from_axes(P0(count), PX(1,count), PY(1,count), PZ(1,count))
|
|
52
52
|
|
|
53
53
|
@staticmethod
|
|
54
|
-
def from_xy(origin: Point, x_axis: Point, y_axis: Point):
|
|
54
|
+
def from_xy(origin: Point, x_axis: Point, y_axis: Point) -> Coord:
|
|
55
55
|
z_axis = x_axis.cross(y_axis)
|
|
56
56
|
return Coord.from_axes(origin, x_axis, z_axis.cross(x_axis), z_axis)
|
|
57
57
|
|
|
58
58
|
@staticmethod
|
|
59
|
-
def from_yz(origin: Point, y_axis: Point, z_axis: Point):
|
|
59
|
+
def from_yz(origin: Point, y_axis: Point, z_axis: Point) -> Coord:
|
|
60
60
|
x_axis = y_axis.cross(z_axis)
|
|
61
61
|
return Coord.from_axes(origin, x_axis, y_axis, x_axis.cross(y_axis))
|
|
62
62
|
|
|
63
63
|
@staticmethod
|
|
64
|
-
def from_zx(origin: Point, z_axis: Point, x_axis: Point):
|
|
64
|
+
def from_zx(origin: Point, z_axis: Point, x_axis: Point) -> Coord:
|
|
65
65
|
y_axis = z_axis.cross(x_axis)
|
|
66
66
|
return Coord.from_axes(origin, y_axis.cross(z_axis), y_axis, z_axis)
|
|
67
67
|
|
|
@@ -71,7 +71,7 @@ class Coord(Base):
|
|
|
71
71
|
def inverse_rotation_matrix(self):
|
|
72
72
|
return Quaternion.from_rotation_matrix(self.rotation_matrix()).inverse().to_rotation_matrix()
|
|
73
73
|
|
|
74
|
-
def rotate(self, rotation=Quaternion):
|
|
74
|
+
def rotate(self, rotation=Quaternion) -> Coord:
|
|
75
75
|
return Coord.from_axes(
|
|
76
76
|
self.origin,
|
|
77
77
|
rotation.transform_point(self.x_axis),
|
|
@@ -82,7 +82,7 @@ class Coord(Base):
|
|
|
82
82
|
def __eq__(self, other):
|
|
83
83
|
return self.data == other.data
|
|
84
84
|
|
|
85
|
-
def translate(self, point):
|
|
85
|
+
def translate(self, point) -> Coord:
|
|
86
86
|
return Coord.from_axes(self.origin + point, self.x_axis, self.y_axis, self.z_axis)
|
|
87
87
|
|
|
88
88
|
def axes(self):
|
geometry/point.py
CHANGED
|
@@ -14,6 +14,8 @@ from .base import Base
|
|
|
14
14
|
import numpy as np
|
|
15
15
|
import pandas as pd
|
|
16
16
|
from warnings import warn
|
|
17
|
+
from numbers import Number
|
|
18
|
+
import numpy.typing as npt
|
|
17
19
|
|
|
18
20
|
|
|
19
21
|
class Point(Base):
|
|
@@ -62,16 +64,16 @@ class Point(Base):
|
|
|
62
64
|
return abs(Point.angles(self, p2))
|
|
63
65
|
|
|
64
66
|
@staticmethod
|
|
65
|
-
def X(value=1, count=1):
|
|
66
|
-
return
|
|
67
|
+
def X(value: Number | npt.NDArray=1, count=1):
|
|
68
|
+
return np.tile(value, count) * Point(1,0,0)
|
|
67
69
|
|
|
68
70
|
@staticmethod
|
|
69
71
|
def Y(value=1, count=1):
|
|
70
|
-
return
|
|
72
|
+
return np.tile(value, count) * Point(0,1,0)
|
|
71
73
|
|
|
72
74
|
@staticmethod
|
|
73
75
|
def Z(value=1, count=1):
|
|
74
|
-
return
|
|
76
|
+
return np.tile(value, count) * Point(0,0,1)
|
|
75
77
|
|
|
76
78
|
def rotate(self, rmat=np.ndarray):
|
|
77
79
|
if len(rmat.shape) == 3:
|
|
@@ -108,6 +110,9 @@ class Point(Base):
|
|
|
108
110
|
def zeros(count=1):
|
|
109
111
|
return Point(np.zeros((count,3)))
|
|
110
112
|
|
|
113
|
+
def bearing(self):
|
|
114
|
+
return np.arctan2(self.y, self.x)
|
|
115
|
+
|
|
111
116
|
def Points(*args, **kwargs):
|
|
112
117
|
warn("Points is deprecated, you can now just use Point", DeprecationWarning)
|
|
113
118
|
return Point(*args, **kwargs)
|
|
@@ -136,7 +141,7 @@ def ppmeth(func):
|
|
|
136
141
|
|
|
137
142
|
|
|
138
143
|
@ppmeth
|
|
139
|
-
def cross(a, b) -> Point:
|
|
144
|
+
def cross(a: Point, b: Point) -> Point:
|
|
140
145
|
return Point(np.cross(a.data, b.data))
|
|
141
146
|
|
|
142
147
|
|
geometry/quaternion.py
CHANGED
|
@@ -253,7 +253,10 @@ class Quaternion(Base):
|
|
|
253
253
|
# does the rotation reverse the Z axis?
|
|
254
254
|
return np.sign(self.transform_point(PZ()).z) > 0
|
|
255
255
|
|
|
256
|
-
|
|
256
|
+
def bearing(self, p: Point=None):
|
|
257
|
+
if p is None:
|
|
258
|
+
p = Point.X()
|
|
259
|
+
return self.transform_point(p).bearing()
|
|
257
260
|
|
|
258
261
|
|
|
259
262
|
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
geometry/__init__.py,sha256=HNhMyemIJzDq1nDjrr09eX5PS7q9ULscSbYsXss3JRM,1253
|
|
2
|
+
geometry/base.py,sha256=yNiO7Fe-S5c4wtvgNmQ2jrX7Yt4tB3eBekYHK0_psYc,11926
|
|
3
|
+
geometry/coordinate_frame.py,sha256=YTCAtCUuIq5LAsO-P9FwFs55f4qpWP9pUP6mf-Nhk54,3145
|
|
4
|
+
geometry/gps.py,sha256=Fs3hakSQ754HUqRsA7NWg_MSEdYxNqyiu4gu6EDrFqI,3381
|
|
5
|
+
geometry/mass.py,sha256=BUWBSITwpdRfpJR5-oJTd16BI7FLZt8rhxdzr0cx1HY,1675
|
|
6
|
+
geometry/point.py,sha256=XF7sdCaCD-si9UAumpyvxzMOTX3utVogJ2tt_7vt7b0,5185
|
|
7
|
+
geometry/quaternion.py,sha256=nggmRu_8xCQNYlf8GcilC4zJZLsac3dwUQKu5pxL_38,9522
|
|
8
|
+
geometry/testing.py,sha256=o8yMBAdU5Vy0EspBYaof4fPGgRSFZhRDhzBjRPsLd0M,375
|
|
9
|
+
geometry/time.py,sha256=ZWO6yThXesHkNsROJfUruF-G4Lpcx149x0H__0HPLvw,1206
|
|
10
|
+
geometry/transformation.py,sha256=eunEC924zPBLhaVSEWE-IClrRfitvUKjSdOTaa2tdDQ,4705
|
|
11
|
+
pfc_geometry-0.2.11.dist-info/LICENSE,sha256=z72U6pv-bQgJ_Svr4uCXnMjemsp38aSerhHEdEAOMJ4,7632
|
|
12
|
+
pfc_geometry-0.2.11.dist-info/METADATA,sha256=lEO6DesuEkg7KVSx98UNygwFmmH4eyYTTA6q80cTcK0,1979
|
|
13
|
+
pfc_geometry-0.2.11.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
|
14
|
+
pfc_geometry-0.2.11.dist-info/top_level.txt,sha256=RWbWhWYclEM-OFtXLCB4eLv-jxNnlJB-NPC2YM587Fo,9
|
|
15
|
+
pfc_geometry-0.2.11.dist-info/RECORD,,
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
geometry/__init__.py,sha256=HNhMyemIJzDq1nDjrr09eX5PS7q9ULscSbYsXss3JRM,1253
|
|
2
|
-
geometry/base.py,sha256=rJSDViQlW6zHwP6n2VT7uulfargKIDEmUCV5sPhghOM,11735
|
|
3
|
-
geometry/coordinate_frame.py,sha256=qO3jqUWF4PW4BOkw5rBMTXfOzBjlA1HYwGYmPtu2M8M,3039
|
|
4
|
-
geometry/gps.py,sha256=Fs3hakSQ754HUqRsA7NWg_MSEdYxNqyiu4gu6EDrFqI,3381
|
|
5
|
-
geometry/mass.py,sha256=BUWBSITwpdRfpJR5-oJTd16BI7FLZt8rhxdzr0cx1HY,1675
|
|
6
|
-
geometry/point.py,sha256=7lWj1NyQsKRJZnNeyDrssAtfZLfWl4vTK9EDOscLjxw,5038
|
|
7
|
-
geometry/quaternion.py,sha256=PH7YKAVnQ8vZ8RZdtnrIaqx3FmHHwQ2aTEEdofrng_U,9392
|
|
8
|
-
geometry/testing.py,sha256=o8yMBAdU5Vy0EspBYaof4fPGgRSFZhRDhzBjRPsLd0M,375
|
|
9
|
-
geometry/time.py,sha256=ZWO6yThXesHkNsROJfUruF-G4Lpcx149x0H__0HPLvw,1206
|
|
10
|
-
geometry/transformation.py,sha256=eunEC924zPBLhaVSEWE-IClrRfitvUKjSdOTaa2tdDQ,4705
|
|
11
|
-
pfc_geometry-0.2.10.dist-info/LICENSE,sha256=z72U6pv-bQgJ_Svr4uCXnMjemsp38aSerhHEdEAOMJ4,7632
|
|
12
|
-
pfc_geometry-0.2.10.dist-info/METADATA,sha256=aIrRdNxRV07oKLdlKXzsjcano6Y_q36vR2ONr-XRrew,1979
|
|
13
|
-
pfc_geometry-0.2.10.dist-info/WHEEL,sha256=Mdi9PDNwEZptOjTlUcAth7XJDFtKrHYaQMPulZeBCiQ,91
|
|
14
|
-
pfc_geometry-0.2.10.dist-info/top_level.txt,sha256=RWbWhWYclEM-OFtXLCB4eLv-jxNnlJB-NPC2YM587Fo,9
|
|
15
|
-
pfc_geometry-0.2.10.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|