gtrack 0.3.1__py3-none-any.whl → 0.3.2__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.
gtrack/point_rotation.py
CHANGED
|
@@ -148,6 +148,55 @@ class PointCloud:
|
|
|
148
148
|
xyz = LatLon2XYZ(latlon)
|
|
149
149
|
return cls(xyz=xyz, properties=properties or {})
|
|
150
150
|
|
|
151
|
+
@classmethod
|
|
152
|
+
def from_xyz(
|
|
153
|
+
cls,
|
|
154
|
+
xyz: np.ndarray,
|
|
155
|
+
properties: Optional[Dict[str, np.ndarray]] = None,
|
|
156
|
+
normalize_to_earth: bool = False
|
|
157
|
+
) -> "PointCloud":
|
|
158
|
+
"""
|
|
159
|
+
Create PointCloud from Cartesian XYZ coordinates.
|
|
160
|
+
|
|
161
|
+
This is a convenience classmethod that provides symmetry with from_latlon.
|
|
162
|
+
It can optionally normalize points to Earth's surface.
|
|
163
|
+
|
|
164
|
+
Parameters
|
|
165
|
+
----------
|
|
166
|
+
xyz : np.ndarray
|
|
167
|
+
Cartesian coordinates, shape (N, 3).
|
|
168
|
+
properties : dict, optional
|
|
169
|
+
Properties to attach to the points.
|
|
170
|
+
normalize_to_earth : bool, default=False
|
|
171
|
+
If True, normalize points to Earth's radius (~6.3781e6 m).
|
|
172
|
+
Useful when input points are on a unit sphere.
|
|
173
|
+
|
|
174
|
+
Returns
|
|
175
|
+
-------
|
|
176
|
+
PointCloud
|
|
177
|
+
New PointCloud with the given XYZ coordinates.
|
|
178
|
+
|
|
179
|
+
Examples
|
|
180
|
+
--------
|
|
181
|
+
>>> # Points already at Earth's radius
|
|
182
|
+
>>> xyz = np.array([[6378100, 0, 0], [0, 6378100, 0]])
|
|
183
|
+
>>> cloud = PointCloud.from_xyz(xyz)
|
|
184
|
+
>>>
|
|
185
|
+
>>> # Points on unit sphere, scale to Earth
|
|
186
|
+
>>> xyz_unit = np.array([[1, 0, 0], [0, 1, 0]])
|
|
187
|
+
>>> cloud = PointCloud.from_xyz(xyz_unit, normalize_to_earth=True)
|
|
188
|
+
"""
|
|
189
|
+
from .geometry import EARTH_RADIUS
|
|
190
|
+
xyz = np.asarray(xyz)
|
|
191
|
+
|
|
192
|
+
if normalize_to_earth:
|
|
193
|
+
# Normalize to unit sphere, then scale to Earth's radius
|
|
194
|
+
norms = np.linalg.norm(xyz, axis=1, keepdims=True)
|
|
195
|
+
norms = np.maximum(norms, 1e-10) # Avoid division by zero
|
|
196
|
+
xyz = xyz / norms * EARTH_RADIUS
|
|
197
|
+
|
|
198
|
+
return cls(xyz=xyz, properties=properties or {})
|
|
199
|
+
|
|
151
200
|
def add_property(self, name: str, values: np.ndarray) -> None:
|
|
152
201
|
"""
|
|
153
202
|
Add or update a property.
|
|
@@ -8,10 +8,10 @@ gtrack/io_formats.py,sha256=_zXOdn7rqlcD0fORNQmh8hemYKzABCax1X1W-WVGpiE,12769
|
|
|
8
8
|
gtrack/logging.py,sha256=6N8QivpVq0oahwi0K62zUgQici-rK40V9CEOPDSpwp0,4930
|
|
9
9
|
gtrack/mesh.py,sha256=BCgGWXLnflK_aiD9B6GBY0X_OJur645Sc1lVX6O4Q6Q,2733
|
|
10
10
|
gtrack/mor_seeds.py,sha256=mFF89nKOq7yIEOIE41AnNTJdbQ3Q5OLYGnAu6KbeXg8,13395
|
|
11
|
-
gtrack/point_rotation.py,sha256=
|
|
11
|
+
gtrack/point_rotation.py,sha256=WKnpbQWR_KR1DkfIi2YlNP94GnW3B2VocoBrr17ok9U,28014
|
|
12
12
|
gtrack/polygon_filter.py,sha256=5wDChgkxF7IU7of2JfkAWVbzxOHSgnuIQsg-eA0Yyoo,6333
|
|
13
13
|
gtrack/spatial.py,sha256=70UXaH1TyaQDR1P_1j2FoCdUTTa8a921h7Wt6kj1hZw,14475
|
|
14
|
-
gtrack-0.3.
|
|
15
|
-
gtrack-0.3.
|
|
16
|
-
gtrack-0.3.
|
|
17
|
-
gtrack-0.3.
|
|
14
|
+
gtrack-0.3.2.dist-info/METADATA,sha256=mQYXx_Z18QUTixWhcZtZCWpEJemwcG0rx5mYFST1Xk0,2268
|
|
15
|
+
gtrack-0.3.2.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
16
|
+
gtrack-0.3.2.dist-info/top_level.txt,sha256=x1GottZL9pxdL8Ff3ARhF6tAhM4-CIKgnS9Hl7PZzyQ,7
|
|
17
|
+
gtrack-0.3.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|