pfc-geometry 0.2.10__tar.gz → 0.2.11__tar.gz

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.
Files changed (35) hide show
  1. {pfc_geometry-0.2.10/pfc_geometry.egg-info → pfc_geometry-0.2.11}/PKG-INFO +1 -1
  2. {pfc_geometry-0.2.10 → pfc_geometry-0.2.11}/geometry/base.py +6 -0
  3. {pfc_geometry-0.2.10 → pfc_geometry-0.2.11}/geometry/coordinate_frame.py +9 -9
  4. {pfc_geometry-0.2.10 → pfc_geometry-0.2.11}/geometry/point.py +10 -5
  5. {pfc_geometry-0.2.10 → pfc_geometry-0.2.11}/geometry/quaternion.py +4 -1
  6. {pfc_geometry-0.2.10 → pfc_geometry-0.2.11/pfc_geometry.egg-info}/PKG-INFO +1 -1
  7. {pfc_geometry-0.2.10 → pfc_geometry-0.2.11}/.github/workflows/publish_pypi.yml +0 -0
  8. {pfc_geometry-0.2.10 → pfc_geometry-0.2.11}/.gitignore +0 -0
  9. {pfc_geometry-0.2.10 → pfc_geometry-0.2.11}/.vscode/settings.json +0 -0
  10. {pfc_geometry-0.2.10 → pfc_geometry-0.2.11}/LICENSE +0 -0
  11. {pfc_geometry-0.2.10 → pfc_geometry-0.2.11}/README.md +0 -0
  12. {pfc_geometry-0.2.10 → pfc_geometry-0.2.11}/geometry/__init__.py +0 -0
  13. {pfc_geometry-0.2.10 → pfc_geometry-0.2.11}/geometry/gps.py +0 -0
  14. {pfc_geometry-0.2.10 → pfc_geometry-0.2.11}/geometry/mass.py +0 -0
  15. {pfc_geometry-0.2.10 → pfc_geometry-0.2.11}/geometry/testing.py +0 -0
  16. {pfc_geometry-0.2.10 → pfc_geometry-0.2.11}/geometry/time.py +0 -0
  17. {pfc_geometry-0.2.10 → pfc_geometry-0.2.11}/geometry/transformation.py +0 -0
  18. {pfc_geometry-0.2.10 → pfc_geometry-0.2.11}/pfc_geometry.egg-info/SOURCES.txt +0 -0
  19. {pfc_geometry-0.2.10 → pfc_geometry-0.2.11}/pfc_geometry.egg-info/dependency_links.txt +0 -0
  20. {pfc_geometry-0.2.10 → pfc_geometry-0.2.11}/pfc_geometry.egg-info/requires.txt +0 -0
  21. {pfc_geometry-0.2.10 → pfc_geometry-0.2.11}/pfc_geometry.egg-info/top_level.txt +0 -0
  22. {pfc_geometry-0.2.10 → pfc_geometry-0.2.11}/pyproject.toml +0 -0
  23. {pfc_geometry-0.2.10 → pfc_geometry-0.2.11}/requirements-dev.txt +0 -0
  24. {pfc_geometry-0.2.10 → pfc_geometry-0.2.11}/requirements.txt +0 -0
  25. {pfc_geometry-0.2.10 → pfc_geometry-0.2.11}/setup.cfg +0 -0
  26. {pfc_geometry-0.2.10 → pfc_geometry-0.2.11}/tests/__init__.py +0 -0
  27. {pfc_geometry-0.2.10 → pfc_geometry-0.2.11}/tests/quat_body_diff_test.csv +0 -0
  28. {pfc_geometry-0.2.10 → pfc_geometry-0.2.11}/tests/test_base.py +0 -0
  29. {pfc_geometry-0.2.10 → pfc_geometry-0.2.11}/tests/test_coord.py +0 -0
  30. {pfc_geometry-0.2.10 → pfc_geometry-0.2.11}/tests/test_gps.py +0 -0
  31. {pfc_geometry-0.2.10 → pfc_geometry-0.2.11}/tests/test_mass.py +0 -0
  32. {pfc_geometry-0.2.10 → pfc_geometry-0.2.11}/tests/test_point.py +0 -0
  33. {pfc_geometry-0.2.10 → pfc_geometry-0.2.11}/tests/test_quaternion.py +0 -0
  34. {pfc_geometry-0.2.10 → pfc_geometry-0.2.11}/tests/test_remove_outliers.csv +0 -0
  35. {pfc_geometry-0.2.10 → pfc_geometry-0.2.11}/tests/test_transform.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pfc-geometry
3
- Version: 0.2.10
3
+ Version: 0.2.11
4
4
  Summary: A package for handling 3D geometry with a nice interface
5
5
  Author-email: Thomas David <thomasdavid0@gmail.com>
6
6
  License: GNU GPL v3
@@ -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())
@@ -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):
@@ -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 Point(np.tile([value,0,0], (count, 1)))
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 Point(np.tile([0,value,0], (count, 1)))
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 Point(np.tile([0,0,value], (count, 1)))
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
 
@@ -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
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pfc-geometry
3
- Version: 0.2.10
3
+ Version: 0.2.11
4
4
  Summary: A package for handling 3D geometry with a nice interface
5
5
  Author-email: Thomas David <thomasdavid0@gmail.com>
6
6
  License: GNU GPL v3
File without changes
File without changes
File without changes
File without changes