coordinate-system 5.2.2__cp313-cp313-win_amd64.whl → 6.0.1__cp313-cp313-win_amd64.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.
- coordinate_system/__init__.py +120 -145
- coordinate_system/differential_geometry.py +618 -298
- coordinate_system/fourier_spectral.py +115 -729
- coordinate_system/frames.py +1571 -0
- coordinate_system/qframes.py +747 -630
- coordinate_system/visualization.py +695 -292
- coordinate_system-6.0.1.dist-info/METADATA +721 -0
- coordinate_system-6.0.1.dist-info/RECORD +15 -0
- coordinate_system-5.2.2.dist-info/METADATA +0 -807
- coordinate_system-5.2.2.dist-info/RECORD +0 -14
- {coordinate_system-5.2.2.dist-info → coordinate_system-6.0.1.dist-info}/LICENSE +0 -0
- {coordinate_system-5.2.2.dist-info → coordinate_system-6.0.1.dist-info}/WHEEL +0 -0
- {coordinate_system-5.2.2.dist-info → coordinate_system-6.0.1.dist-info}/top_level.txt +0 -0
coordinate_system/__init__.py
CHANGED
|
@@ -1,49 +1,64 @@
|
|
|
1
1
|
# coordinate_system/__init__.py
|
|
2
|
+
"""
|
|
3
|
+
Coordinate System Package
|
|
4
|
+
=========================
|
|
5
|
+
|
|
6
|
+
A comprehensive 3D coordinate system library with differential geometry support.
|
|
7
|
+
|
|
8
|
+
Core Components:
|
|
9
|
+
- vec3, vec2: Vector types
|
|
10
|
+
- quat: Quaternion for rotations
|
|
11
|
+
- coord3: 3D coordinate frame
|
|
12
|
+
|
|
13
|
+
Modules:
|
|
14
|
+
- differential_geometry: Surface curvature computation
|
|
15
|
+
- frames: Complex frame algebra and spectral geometry
|
|
16
|
+
- visualization: Coordinate system visualization
|
|
17
|
+
- curve_interpolation: Curve and frame interpolation
|
|
18
|
+
|
|
19
|
+
Version: 6.0.1
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
__version__ = '6.0.1'
|
|
2
23
|
|
|
3
24
|
from .coordinate_system import vec3, vec2
|
|
4
25
|
from .coordinate_system import quat
|
|
5
26
|
from .coordinate_system import coord3
|
|
6
27
|
|
|
7
|
-
|
|
8
|
-
# Coordinate system handedness control (v5.2.1+)
|
|
9
|
-
from .coordinate_system import (
|
|
10
|
-
set_handedness,
|
|
11
|
-
get_handedness,
|
|
12
|
-
is_left_handed,
|
|
13
|
-
is_right_handed
|
|
14
|
-
)
|
|
15
|
-
# Differential geometry module (v3.3.0+)
|
|
28
|
+
# Differential geometry module (merged from differential_geometry.py and curvature.py)
|
|
16
29
|
from .differential_geometry import (
|
|
17
|
-
#
|
|
30
|
+
# Surface classes
|
|
18
31
|
Surface,
|
|
19
32
|
Sphere,
|
|
20
33
|
Torus,
|
|
34
|
+
|
|
35
|
+
# Core classes
|
|
21
36
|
MetricTensor,
|
|
37
|
+
GradientResult,
|
|
22
38
|
IntrinsicGradientOperator,
|
|
23
39
|
IntrinsicGradientCurvatureCalculator,
|
|
40
|
+
CurvatureCalculator,
|
|
24
41
|
|
|
25
|
-
#
|
|
26
|
-
compute_intrinsic_gradient,
|
|
42
|
+
# Intrinsic gradient method functions (default)
|
|
27
43
|
compute_gaussian_curvature,
|
|
28
44
|
compute_mean_curvature,
|
|
29
45
|
compute_riemann_curvature,
|
|
30
46
|
compute_all_curvatures,
|
|
31
|
-
|
|
47
|
+
compute_intrinsic_gradient,
|
|
32
48
|
|
|
33
|
-
#
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
49
|
+
# Classical method functions
|
|
50
|
+
gaussian_curvature_classical,
|
|
51
|
+
mean_curvature_classical,
|
|
52
|
+
principal_curvatures_classical,
|
|
53
|
+
all_curvatures_classical,
|
|
54
|
+
|
|
55
|
+
# Backward compatibility aliases
|
|
37
56
|
gaussian_curvature,
|
|
38
57
|
mean_curvature,
|
|
39
58
|
principal_curvatures,
|
|
40
59
|
all_curvatures,
|
|
41
60
|
|
|
42
|
-
#
|
|
43
|
-
intrinsic_gradient_gaussian_curvature,
|
|
44
|
-
intrinsic_gradient_mean_curvature,
|
|
45
|
-
intrinsic_gradient_principal_curvatures,
|
|
46
|
-
intrinsic_gradient_all_curvatures,
|
|
61
|
+
# Method comparison
|
|
47
62
|
compare_methods,
|
|
48
63
|
|
|
49
64
|
# Utility functions
|
|
@@ -52,105 +67,96 @@ from .curvature import (
|
|
|
52
67
|
richardson_extrapolation,
|
|
53
68
|
)
|
|
54
69
|
|
|
55
|
-
#
|
|
56
|
-
from .
|
|
57
|
-
# Core
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
70
|
+
# Complex frame module (ComplexFrame spectral geometry)
|
|
71
|
+
from .frames import (
|
|
72
|
+
# Core classes
|
|
73
|
+
ComplexFrame,
|
|
74
|
+
ComplexFrameSpectrum,
|
|
75
|
+
|
|
76
|
+
# Spectral geometry core
|
|
77
|
+
IntrinsicGradient,
|
|
78
|
+
CurvatureFromFrame,
|
|
79
|
+
BerryPhase,
|
|
80
|
+
ChernNumber,
|
|
81
|
+
SpectralDecomposition,
|
|
82
|
+
HeatKernel,
|
|
83
|
+
FrequencyProjection,
|
|
84
|
+
FrequencyBandState,
|
|
65
85
|
|
|
66
|
-
#
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
berry_phase_calculator,
|
|
70
|
-
topological_invariant_analyzer,
|
|
86
|
+
# Convenience functions
|
|
87
|
+
spectral_transform,
|
|
88
|
+
inverse_spectral_transform,
|
|
71
89
|
|
|
72
|
-
#
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
compute_spectral_density,
|
|
76
|
-
radial_spectrum_average,
|
|
90
|
+
# Constants
|
|
91
|
+
HBAR,
|
|
92
|
+
GPU_AVAILABLE,
|
|
77
93
|
)
|
|
78
94
|
|
|
79
|
-
# Visualization module
|
|
95
|
+
# Visualization module
|
|
80
96
|
from .visualization import (
|
|
81
|
-
# Visualizer classes
|
|
82
97
|
CoordinateSystemVisualizer,
|
|
83
98
|
CurveVisualizer,
|
|
84
99
|
ParametricCurve,
|
|
85
|
-
|
|
86
|
-
# Convenience functions
|
|
87
100
|
visualize_coord_system,
|
|
88
101
|
visualize_curve,
|
|
89
102
|
)
|
|
90
103
|
|
|
91
|
-
# Curve interpolation module
|
|
104
|
+
# Curve interpolation module
|
|
92
105
|
from .curve_interpolation import (
|
|
93
|
-
# Main class
|
|
94
106
|
InterpolatedCurve,
|
|
95
|
-
|
|
96
|
-
# Functions
|
|
97
107
|
generate_frenet_frames,
|
|
98
108
|
frame_field_spline,
|
|
99
109
|
frame_field_spline_c2,
|
|
100
110
|
reconstruct_curve_from_polygon,
|
|
101
111
|
compute_curvature_profile,
|
|
102
|
-
|
|
103
|
-
# Utility functions
|
|
104
112
|
catmull_rom,
|
|
105
113
|
squad_interp,
|
|
106
114
|
)
|
|
107
115
|
|
|
108
116
|
__all__ = [
|
|
109
117
|
# Constants
|
|
110
|
-
'ZERO3','UNITX','UNITY','UNITZ','ONE3','ONE4','ONEC',
|
|
118
|
+
'ZERO3', 'UNITX', 'UNITY', 'UNITZ', 'ONE3', 'ONE4', 'ONEC',
|
|
111
119
|
|
|
112
120
|
# Core types
|
|
113
121
|
'vec3', 'vec2', 'quat', 'coord3', 'lerp',
|
|
114
122
|
|
|
115
|
-
# Differential geometry classes
|
|
123
|
+
# Differential geometry - Surface classes
|
|
116
124
|
'Surface', 'Sphere', 'Torus',
|
|
117
|
-
'MetricTensor', 'IntrinsicGradientOperator', 'IntrinsicGradientCurvatureCalculator',
|
|
118
125
|
|
|
119
|
-
# Differential geometry
|
|
126
|
+
# Differential geometry - Core classes
|
|
127
|
+
'MetricTensor', 'GradientResult',
|
|
128
|
+
'IntrinsicGradientOperator', 'IntrinsicGradientCurvatureCalculator',
|
|
129
|
+
'CurvatureCalculator',
|
|
130
|
+
|
|
131
|
+
# Differential geometry - Intrinsic gradient method (default)
|
|
132
|
+
'compute_gaussian_curvature', 'compute_mean_curvature',
|
|
133
|
+
'compute_riemann_curvature', 'compute_all_curvatures',
|
|
120
134
|
'compute_intrinsic_gradient',
|
|
121
|
-
'compute_gaussian_curvature',
|
|
122
|
-
'compute_mean_curvature',
|
|
123
|
-
'compute_riemann_curvature',
|
|
124
|
-
'compute_all_curvatures',
|
|
125
135
|
|
|
126
|
-
#
|
|
127
|
-
'
|
|
136
|
+
# Differential geometry - Classical method
|
|
137
|
+
'gaussian_curvature_classical', 'mean_curvature_classical',
|
|
138
|
+
'principal_curvatures_classical', 'all_curvatures_classical',
|
|
139
|
+
|
|
140
|
+
# Differential geometry - Backward compatibility
|
|
128
141
|
'gaussian_curvature', 'mean_curvature',
|
|
129
142
|
'principal_curvatures', 'all_curvatures',
|
|
130
143
|
|
|
131
|
-
#
|
|
132
|
-
'intrinsic_gradient_gaussian_curvature',
|
|
133
|
-
'intrinsic_gradient_mean_curvature',
|
|
134
|
-
'intrinsic_gradient_principal_curvatures',
|
|
135
|
-
'intrinsic_gradient_all_curvatures',
|
|
144
|
+
# Differential geometry - Comparison and utilities
|
|
136
145
|
'compare_methods',
|
|
137
|
-
|
|
138
|
-
# Utility functions
|
|
139
146
|
'derivative_5pt', 'derivative_2nd_5pt', 'richardson_extrapolation',
|
|
140
147
|
|
|
141
|
-
#
|
|
142
|
-
'
|
|
143
|
-
'
|
|
144
|
-
'
|
|
145
|
-
'
|
|
146
|
-
'
|
|
147
|
-
'compute_spectral_density', 'radial_spectrum_average',
|
|
148
|
+
# Complex frame module
|
|
149
|
+
'ComplexFrame', 'ComplexFrameSpectrum',
|
|
150
|
+
'IntrinsicGradient', 'CurvatureFromFrame', 'BerryPhase', 'ChernNumber',
|
|
151
|
+
'SpectralDecomposition', 'HeatKernel', 'FrequencyProjection', 'FrequencyBandState',
|
|
152
|
+
'spectral_transform', 'inverse_spectral_transform',
|
|
153
|
+
'HBAR', 'GPU_AVAILABLE',
|
|
148
154
|
|
|
149
|
-
# Visualization
|
|
155
|
+
# Visualization
|
|
150
156
|
'CoordinateSystemVisualizer', 'CurveVisualizer', 'ParametricCurve',
|
|
151
157
|
'visualize_coord_system', 'visualize_curve',
|
|
152
158
|
|
|
153
|
-
# Curve interpolation
|
|
159
|
+
# Curve interpolation
|
|
154
160
|
'InterpolatedCurve', 'generate_frenet_frames', 'frame_field_spline',
|
|
155
161
|
'frame_field_spline_c2', 'reconstruct_curve_from_polygon', 'compute_curvature_profile',
|
|
156
162
|
'catmull_rom', 'squad_interp',
|
|
@@ -158,7 +164,7 @@ __all__ = [
|
|
|
158
164
|
|
|
159
165
|
# Constants for unit vectors and zero point
|
|
160
166
|
ZERO3 = vec3(0.0, 0.0, 0.0) # Zero vector (origin point)
|
|
161
|
-
UNITX = vec3(1.0, 0.0, 0.0) # Unit vector in X direction
|
|
167
|
+
UNITX = vec3(1.0, 0.0, 0.0) # Unit vector in X direction
|
|
162
168
|
UNITY = vec3(0.0, 1.0, 0.0) # Unit vector in Y direction
|
|
163
169
|
UNITZ = vec3(0.0, 0.0, 1.0) # Unit vector in Z direction
|
|
164
170
|
ONE3 = vec3(1.0, 1.0, 1.0) # Unit scale vector (1,1,1)
|
|
@@ -169,125 +175,93 @@ ONE4 = quat(1.0, 0.0, 0.0, 0.0)
|
|
|
169
175
|
# World coordinate system (the fundamental unit one in 3D space)
|
|
170
176
|
ONEC = coord3(ZERO3, ONE4, ONE3)
|
|
171
177
|
|
|
178
|
+
|
|
172
179
|
def lerp(a: vec3, b: vec3, t: float) -> vec3:
|
|
173
180
|
"""
|
|
174
|
-
Linear interpolation between two points in 3D space
|
|
175
|
-
|
|
176
|
-
The concept of interpolation embodies the metaphysical principle of
|
|
177
|
-
continuum - the smooth transition between states that preserves
|
|
178
|
-
the fundamental unity of spatial relationships
|
|
179
|
-
|
|
181
|
+
Linear interpolation between two points in 3D space.
|
|
182
|
+
|
|
180
183
|
Args:
|
|
181
|
-
a: Starting point
|
|
182
|
-
b: End point
|
|
183
|
-
t: Interpolation ratio [0,1]
|
|
184
|
-
|
|
184
|
+
a: Starting point
|
|
185
|
+
b: End point
|
|
186
|
+
t: Interpolation ratio [0, 1]
|
|
187
|
+
|
|
185
188
|
Returns:
|
|
186
|
-
|
|
189
|
+
Interpolated point: a + (b - a) * t
|
|
187
190
|
"""
|
|
188
191
|
return a + (b - a) * t
|
|
189
192
|
|
|
193
|
+
|
|
190
194
|
class CoordTuple(tuple):
|
|
191
195
|
"""
|
|
192
|
-
Custom tuple subclass that supports operations with coord3 objects
|
|
193
|
-
|
|
194
|
-
This class represents the metaphysical concept of 'potentiality' -
|
|
195
|
-
the tuple as pure mathematical form that can interact with the
|
|
196
|
-
actualized coordinate system (coord3) to produce new actualities
|
|
196
|
+
Custom tuple subclass that supports operations with coord3 objects.
|
|
197
197
|
"""
|
|
198
|
-
|
|
198
|
+
|
|
199
199
|
def __mul__(self, other):
|
|
200
|
-
"""Multiplication operation supporting coord3 interaction"""
|
|
200
|
+
"""Multiplication operation supporting coord3 interaction."""
|
|
201
201
|
if isinstance(other, coord3):
|
|
202
202
|
return self._mul_coord3(other)
|
|
203
203
|
return super().__mul__(other)
|
|
204
|
-
|
|
204
|
+
|
|
205
205
|
def __rmul__(self, other):
|
|
206
|
-
"""Right multiplication operation supporting coord3 interaction"""
|
|
206
|
+
"""Right multiplication operation supporting coord3 interaction."""
|
|
207
207
|
if isinstance(other, coord3):
|
|
208
208
|
return self._mul_coord3(other)
|
|
209
209
|
return super().__rmul__(other)
|
|
210
|
-
|
|
210
|
+
|
|
211
211
|
def __truediv__(self, other):
|
|
212
|
-
"""Division operation supporting coord3 interaction"""
|
|
212
|
+
"""Division operation supporting coord3 interaction."""
|
|
213
213
|
if isinstance(other, coord3):
|
|
214
214
|
return self._div_coord3(other)
|
|
215
215
|
return super().__truediv__(other)
|
|
216
|
-
|
|
216
|
+
|
|
217
217
|
def _mul_coord3(self, coord: coord3) -> tuple:
|
|
218
|
-
"""
|
|
219
|
-
Tuple multiplication with coordinate system
|
|
220
|
-
|
|
221
|
-
Represents the metaphysical operation where mathematical forms
|
|
222
|
-
(tuple) interact with actualized space (coord3) to produce
|
|
223
|
-
new spatial relationships
|
|
224
|
-
"""
|
|
218
|
+
"""Tuple multiplication with coordinate system."""
|
|
225
219
|
if len(self) != 3:
|
|
226
220
|
raise ValueError("Tuple must have exactly 3 elements for spatial operations")
|
|
227
|
-
|
|
221
|
+
|
|
228
222
|
x, y, z = self
|
|
229
223
|
scale_vec = vec3(x, y, z)
|
|
230
224
|
result = scale_vec * coord
|
|
231
225
|
return (result.x, result.y, result.z)
|
|
232
|
-
|
|
226
|
+
|
|
233
227
|
def _div_coord3(self, coord: coord3) -> tuple:
|
|
234
|
-
"""
|
|
235
|
-
Tuple division with coordinate system
|
|
236
|
-
|
|
237
|
-
The inverse operation of multiplication, representing the
|
|
238
|
-
decomposition of spatial relationships into their mathematical
|
|
239
|
-
components
|
|
240
|
-
"""
|
|
228
|
+
"""Tuple division with coordinate system."""
|
|
241
229
|
if len(self) != 3:
|
|
242
230
|
raise ValueError("Tuple must have exactly 3 elements for spatial operations")
|
|
243
|
-
|
|
231
|
+
|
|
244
232
|
x, y, z = self
|
|
245
|
-
# Check for division by zero (preservation of metaphysical integrity)
|
|
246
233
|
if x == 0 or y == 0 or z == 0:
|
|
247
|
-
raise ZeroDivisionError("Division by zero
|
|
248
|
-
|
|
234
|
+
raise ZeroDivisionError("Division by zero")
|
|
235
|
+
|
|
249
236
|
scale_vec = vec3(x, y, z)
|
|
250
237
|
result = scale_vec / coord
|
|
251
238
|
return (result.x, result.y, result.z)
|
|
252
239
|
|
|
253
|
-
|
|
240
|
+
|
|
241
|
+
# Store original coord3 operators
|
|
254
242
|
_original_coord3_mul = coord3.__mul__
|
|
255
243
|
_original_coord3_rmul = coord3.__rmul__
|
|
256
244
|
_original_coord3_truediv = getattr(coord3, '__truediv__', None)
|
|
257
245
|
|
|
246
|
+
|
|
258
247
|
def _new_coord3_mul(self, other):
|
|
259
|
-
"""
|
|
260
|
-
Enhanced multiplication operator for coord3
|
|
261
|
-
|
|
262
|
-
Enables interaction between actualized coordinate systems (coord3)
|
|
263
|
-
and mathematical forms (tuples), embodying the Aristotelian concept
|
|
264
|
-
of actuality interacting with potentiality
|
|
265
|
-
"""
|
|
248
|
+
"""Enhanced multiplication operator for coord3."""
|
|
266
249
|
if isinstance(other, tuple):
|
|
267
|
-
# Transform pure form (tuple) into operational entity (CoordTuple)
|
|
268
250
|
other = CoordTuple(other)
|
|
269
251
|
return other * self
|
|
270
252
|
return _original_coord3_mul(self, other)
|
|
271
253
|
|
|
254
|
+
|
|
272
255
|
def _new_coord3_rmul(self, other):
|
|
273
|
-
"""
|
|
274
|
-
Enhanced right multiplication operator for coord3
|
|
275
|
-
|
|
276
|
-
The commutative property in spatial operations reflects the
|
|
277
|
-
metaphysical principle of reciprocity in relationships
|
|
278
|
-
"""
|
|
256
|
+
"""Enhanced right multiplication operator for coord3."""
|
|
279
257
|
if isinstance(other, tuple):
|
|
280
258
|
other = CoordTuple(other)
|
|
281
259
|
return other * self
|
|
282
260
|
return _original_coord3_rmul(self, other)
|
|
283
261
|
|
|
262
|
+
|
|
284
263
|
def _new_coord3_truediv(self, other):
|
|
285
|
-
"""
|
|
286
|
-
Enhanced division operator for coord3
|
|
287
|
-
|
|
288
|
-
Division represents the analytical decomposition of spatial
|
|
289
|
-
relationships, revealing the underlying mathematical structure
|
|
290
|
-
"""
|
|
264
|
+
"""Enhanced division operator for coord3."""
|
|
291
265
|
if isinstance(other, tuple):
|
|
292
266
|
other = CoordTuple(other)
|
|
293
267
|
return other / self
|
|
@@ -295,7 +269,8 @@ def _new_coord3_truediv(self, other):
|
|
|
295
269
|
return _original_coord3_truediv(self, other)
|
|
296
270
|
raise TypeError(f"unsupported operand type(s) for /: 'coord3' and {type(other).__name__}")
|
|
297
271
|
|
|
298
|
-
|
|
272
|
+
|
|
273
|
+
# Apply enhancements to coord3 operators
|
|
299
274
|
coord3.__mul__ = _new_coord3_mul
|
|
300
275
|
coord3.__rmul__ = _new_coord3_rmul
|
|
301
|
-
coord3.__truediv__ = _new_coord3_truediv
|
|
276
|
+
coord3.__truediv__ = _new_coord3_truediv
|