coordinate-system 7.0.0__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 +324 -0
- coordinate_system/complex_geometric_physics.py +519 -0
- coordinate_system/coordinate_system.cp313-win_amd64.pyd +0 -0
- coordinate_system/curve_interpolation.py +507 -0
- coordinate_system/differential_geometry.py +986 -0
- coordinate_system/spectral_geometry.py +1602 -0
- coordinate_system/u3_frame.py +885 -0
- coordinate_system/visualization.py +1069 -0
- coordinate_system-7.0.0.dist-info/LICENSE +9 -0
- coordinate_system-7.0.0.dist-info/METADATA +312 -0
- coordinate_system-7.0.0.dist-info/RECORD +13 -0
- coordinate_system-7.0.0.dist-info/WHEEL +5 -0
- coordinate_system-7.0.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
# coordinate_system/__init__.py
|
|
2
|
+
"""
|
|
3
|
+
Coordinate System Library
|
|
4
|
+
=========================
|
|
5
|
+
|
|
6
|
+
High-performance 3D coordinate system and differential geometry library.
|
|
7
|
+
|
|
8
|
+
Core Components (C++ Layer):
|
|
9
|
+
- vec3, vec2: Vector types
|
|
10
|
+
- quat: Quaternion for rotations (SU(2))
|
|
11
|
+
- coord3: 3D coordinate frame (Sim(3) group)
|
|
12
|
+
|
|
13
|
+
Python Modules:
|
|
14
|
+
- differential_geometry: Surface curvature via intrinsic gradient / Lie bracket
|
|
15
|
+
- spectral_geometry: FourierFrame (GL(1,C)), spectral analysis, heat kernel
|
|
16
|
+
- u3_frame: U3Frame (U(3)), gauge field theory, symmetry breaking
|
|
17
|
+
- complex_geometric_physics: Christmas Equation, unified field theory (CFUT)
|
|
18
|
+
- visualization: Coordinate system visualization
|
|
19
|
+
- curve_interpolation: C2-continuous curve and frame interpolation
|
|
20
|
+
|
|
21
|
+
Group Correspondence:
|
|
22
|
+
- coord3 ∈ Sim(3) = R³ ⋊ (SO(3) × R⁺)
|
|
23
|
+
- FourierFrame ∈ GL(1,C) = U(1) × R⁺
|
|
24
|
+
- U3Frame ∈ U(3) = SU(3) × U(1)
|
|
25
|
+
|
|
26
|
+
Version: 7.0.0-alpha
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
__version__ = '7.0.0-alpha'
|
|
30
|
+
|
|
31
|
+
from .coordinate_system import vec3, vec2
|
|
32
|
+
from .coordinate_system import quat
|
|
33
|
+
from .coordinate_system import coord3
|
|
34
|
+
|
|
35
|
+
# Differential geometry module (merged from differential_geometry.py and curvature.py)
|
|
36
|
+
from .differential_geometry import (
|
|
37
|
+
# Surface classes
|
|
38
|
+
Surface,
|
|
39
|
+
Sphere,
|
|
40
|
+
Torus,
|
|
41
|
+
|
|
42
|
+
# Core classes
|
|
43
|
+
MetricTensor,
|
|
44
|
+
GradientResult,
|
|
45
|
+
IntrinsicGradientOperator,
|
|
46
|
+
IntrinsicGradientCurvatureCalculator,
|
|
47
|
+
CurvatureCalculator,
|
|
48
|
+
|
|
49
|
+
# Intrinsic gradient method functions (default)
|
|
50
|
+
compute_gaussian_curvature,
|
|
51
|
+
compute_mean_curvature,
|
|
52
|
+
compute_riemann_curvature,
|
|
53
|
+
compute_all_curvatures,
|
|
54
|
+
compute_intrinsic_gradient,
|
|
55
|
+
|
|
56
|
+
# Classical method functions
|
|
57
|
+
gaussian_curvature_classical,
|
|
58
|
+
mean_curvature_classical,
|
|
59
|
+
principal_curvatures_classical,
|
|
60
|
+
all_curvatures_classical,
|
|
61
|
+
|
|
62
|
+
# Backward compatibility aliases
|
|
63
|
+
gaussian_curvature,
|
|
64
|
+
mean_curvature,
|
|
65
|
+
principal_curvatures,
|
|
66
|
+
all_curvatures,
|
|
67
|
+
|
|
68
|
+
# Method comparison
|
|
69
|
+
compare_methods,
|
|
70
|
+
|
|
71
|
+
# Utility functions
|
|
72
|
+
derivative_5pt,
|
|
73
|
+
derivative_2nd_5pt,
|
|
74
|
+
richardson_extrapolation,
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
# Spectral geometry module (FourierFrame, GL(1,C) group)
|
|
78
|
+
from .spectral_geometry import (
|
|
79
|
+
# Core classes
|
|
80
|
+
FourierFrame,
|
|
81
|
+
FourierFrameSpectrum,
|
|
82
|
+
|
|
83
|
+
# Spectral geometry core
|
|
84
|
+
IntrinsicGradient,
|
|
85
|
+
CurvatureFromFrame,
|
|
86
|
+
BerryPhase,
|
|
87
|
+
ChernNumber,
|
|
88
|
+
SpectralDecomposition,
|
|
89
|
+
HeatKernel,
|
|
90
|
+
FrequencyProjection,
|
|
91
|
+
FrequencyBandState,
|
|
92
|
+
|
|
93
|
+
# Convenience functions
|
|
94
|
+
spectral_transform,
|
|
95
|
+
inverse_spectral_transform,
|
|
96
|
+
|
|
97
|
+
# Constants
|
|
98
|
+
HBAR,
|
|
99
|
+
GPU_AVAILABLE,
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
# U(3) Frame module (U(3) group, gauge field theory)
|
|
103
|
+
from .u3_frame import (
|
|
104
|
+
# Core U(3) classes
|
|
105
|
+
U3Frame,
|
|
106
|
+
SU3Component,
|
|
107
|
+
|
|
108
|
+
# Gauge field classes
|
|
109
|
+
GaugeConnection,
|
|
110
|
+
FieldStrength,
|
|
111
|
+
|
|
112
|
+
# Symmetry breaking
|
|
113
|
+
SymmetryBreakingPotential,
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
# Complex Geometric Physics module (Christmas Equation, CFUT)
|
|
117
|
+
from .complex_geometric_physics import (
|
|
118
|
+
# Core classes
|
|
119
|
+
ComplexFrame,
|
|
120
|
+
EnergyMomentumTensor,
|
|
121
|
+
ChristmasEquation,
|
|
122
|
+
|
|
123
|
+
# Utility functions
|
|
124
|
+
create_flat_spacetime_frame,
|
|
125
|
+
create_curved_spacetime_frame,
|
|
126
|
+
create_gauge_field_frame,
|
|
127
|
+
|
|
128
|
+
# Constants
|
|
129
|
+
M_PLANCK,
|
|
130
|
+
LAMBDA_TOPO,
|
|
131
|
+
)
|
|
132
|
+
|
|
133
|
+
# Visualization module
|
|
134
|
+
from .visualization import (
|
|
135
|
+
CoordinateSystemVisualizer,
|
|
136
|
+
CurveVisualizer,
|
|
137
|
+
ParametricCurve,
|
|
138
|
+
visualize_coord_system,
|
|
139
|
+
visualize_curve,
|
|
140
|
+
)
|
|
141
|
+
|
|
142
|
+
# Curve interpolation module
|
|
143
|
+
from .curve_interpolation import (
|
|
144
|
+
InterpolatedCurve,
|
|
145
|
+
generate_frenet_frames,
|
|
146
|
+
frame_field_spline,
|
|
147
|
+
frame_field_spline_c2,
|
|
148
|
+
reconstruct_curve_from_polygon,
|
|
149
|
+
compute_curvature_profile,
|
|
150
|
+
catmull_rom,
|
|
151
|
+
squad_interp,
|
|
152
|
+
)
|
|
153
|
+
|
|
154
|
+
__all__ = [
|
|
155
|
+
# Constants
|
|
156
|
+
'ZERO3', 'UNITX', 'UNITY', 'UNITZ', 'ONE3', 'ONE4', 'ONEC',
|
|
157
|
+
|
|
158
|
+
# Core types
|
|
159
|
+
'vec3', 'vec2', 'quat', 'coord3', 'lerp',
|
|
160
|
+
|
|
161
|
+
# Differential geometry - Surface classes
|
|
162
|
+
'Surface', 'Sphere', 'Torus',
|
|
163
|
+
|
|
164
|
+
# Differential geometry - Core classes
|
|
165
|
+
'MetricTensor', 'GradientResult',
|
|
166
|
+
'IntrinsicGradientOperator', 'IntrinsicGradientCurvatureCalculator',
|
|
167
|
+
'CurvatureCalculator',
|
|
168
|
+
|
|
169
|
+
# Differential geometry - Intrinsic gradient method (default)
|
|
170
|
+
'compute_gaussian_curvature', 'compute_mean_curvature',
|
|
171
|
+
'compute_riemann_curvature', 'compute_all_curvatures',
|
|
172
|
+
'compute_intrinsic_gradient',
|
|
173
|
+
|
|
174
|
+
# Differential geometry - Classical method
|
|
175
|
+
'gaussian_curvature_classical', 'mean_curvature_classical',
|
|
176
|
+
'principal_curvatures_classical', 'all_curvatures_classical',
|
|
177
|
+
|
|
178
|
+
# Differential geometry - Backward compatibility
|
|
179
|
+
'gaussian_curvature', 'mean_curvature',
|
|
180
|
+
'principal_curvatures', 'all_curvatures',
|
|
181
|
+
|
|
182
|
+
# Differential geometry - Comparison and utilities
|
|
183
|
+
'compare_methods',
|
|
184
|
+
'derivative_5pt', 'derivative_2nd_5pt', 'richardson_extrapolation',
|
|
185
|
+
|
|
186
|
+
# Spectral geometry module (FourierFrame, GL(1,C))
|
|
187
|
+
'FourierFrame', 'FourierFrameSpectrum',
|
|
188
|
+
'IntrinsicGradient', 'CurvatureFromFrame', 'BerryPhase', 'ChernNumber',
|
|
189
|
+
'SpectralDecomposition', 'HeatKernel', 'FrequencyProjection', 'FrequencyBandState',
|
|
190
|
+
'spectral_transform', 'inverse_spectral_transform',
|
|
191
|
+
'HBAR', 'GPU_AVAILABLE',
|
|
192
|
+
|
|
193
|
+
# U(3) Frame module (Gauge theory)
|
|
194
|
+
'U3Frame', 'SU3Component',
|
|
195
|
+
'GaugeConnection', 'FieldStrength',
|
|
196
|
+
'SymmetryBreakingPotential',
|
|
197
|
+
|
|
198
|
+
# Complex Geometric Physics (Christmas Equation, CFUT)
|
|
199
|
+
'ComplexFrame', 'EnergyMomentumTensor', 'ChristmasEquation',
|
|
200
|
+
'create_flat_spacetime_frame', 'create_curved_spacetime_frame', 'create_gauge_field_frame',
|
|
201
|
+
'M_PLANCK', 'LAMBDA_TOPO',
|
|
202
|
+
|
|
203
|
+
# Visualization
|
|
204
|
+
'CoordinateSystemVisualizer', 'CurveVisualizer', 'ParametricCurve',
|
|
205
|
+
'visualize_coord_system', 'visualize_curve',
|
|
206
|
+
|
|
207
|
+
# Curve interpolation
|
|
208
|
+
'InterpolatedCurve', 'generate_frenet_frames', 'frame_field_spline',
|
|
209
|
+
'frame_field_spline_c2', 'reconstruct_curve_from_polygon', 'compute_curvature_profile',
|
|
210
|
+
'catmull_rom', 'squad_interp',
|
|
211
|
+
]
|
|
212
|
+
|
|
213
|
+
# Constants for unit vectors and zero point
|
|
214
|
+
ZERO3 = vec3(0.0, 0.0, 0.0) # Zero vector (origin point)
|
|
215
|
+
UNITX = vec3(1.0, 0.0, 0.0) # Unit vector in X direction
|
|
216
|
+
UNITY = vec3(0.0, 1.0, 0.0) # Unit vector in Y direction
|
|
217
|
+
UNITZ = vec3(0.0, 0.0, 1.0) # Unit vector in Z direction
|
|
218
|
+
ONE3 = vec3(1.0, 1.0, 1.0) # Unit scale vector (1,1,1)
|
|
219
|
+
|
|
220
|
+
# Unit quaternion (no rotation)
|
|
221
|
+
ONE4 = quat(1.0, 0.0, 0.0, 0.0)
|
|
222
|
+
|
|
223
|
+
# World coordinate system (the fundamental unit one in 3D space)
|
|
224
|
+
ONEC = coord3(ZERO3, ONE4, ONE3)
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
def lerp(a: vec3, b: vec3, t: float) -> vec3:
|
|
228
|
+
"""
|
|
229
|
+
Linear interpolation between two points in 3D space.
|
|
230
|
+
|
|
231
|
+
Args:
|
|
232
|
+
a: Starting point
|
|
233
|
+
b: End point
|
|
234
|
+
t: Interpolation ratio [0, 1]
|
|
235
|
+
|
|
236
|
+
Returns:
|
|
237
|
+
Interpolated point: a + (b - a) * t
|
|
238
|
+
"""
|
|
239
|
+
return a + (b - a) * t
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
class CoordTuple(tuple):
|
|
243
|
+
"""
|
|
244
|
+
Custom tuple subclass that supports operations with coord3 objects.
|
|
245
|
+
"""
|
|
246
|
+
|
|
247
|
+
def __mul__(self, other):
|
|
248
|
+
"""Multiplication operation supporting coord3 interaction."""
|
|
249
|
+
if isinstance(other, coord3):
|
|
250
|
+
return self._mul_coord3(other)
|
|
251
|
+
return super().__mul__(other)
|
|
252
|
+
|
|
253
|
+
def __rmul__(self, other):
|
|
254
|
+
"""Right multiplication operation supporting coord3 interaction."""
|
|
255
|
+
if isinstance(other, coord3):
|
|
256
|
+
return self._mul_coord3(other)
|
|
257
|
+
return super().__rmul__(other)
|
|
258
|
+
|
|
259
|
+
def __truediv__(self, other):
|
|
260
|
+
"""Division operation supporting coord3 interaction."""
|
|
261
|
+
if isinstance(other, coord3):
|
|
262
|
+
return self._div_coord3(other)
|
|
263
|
+
return super().__truediv__(other)
|
|
264
|
+
|
|
265
|
+
def _mul_coord3(self, coord: coord3) -> tuple:
|
|
266
|
+
"""Tuple multiplication with coordinate system."""
|
|
267
|
+
if len(self) != 3:
|
|
268
|
+
raise ValueError("Tuple must have exactly 3 elements for spatial operations")
|
|
269
|
+
|
|
270
|
+
x, y, z = self
|
|
271
|
+
scale_vec = vec3(x, y, z)
|
|
272
|
+
result = scale_vec * coord
|
|
273
|
+
return (result.x, result.y, result.z)
|
|
274
|
+
|
|
275
|
+
def _div_coord3(self, coord: coord3) -> tuple:
|
|
276
|
+
"""Tuple division with coordinate system."""
|
|
277
|
+
if len(self) != 3:
|
|
278
|
+
raise ValueError("Tuple must have exactly 3 elements for spatial operations")
|
|
279
|
+
|
|
280
|
+
x, y, z = self
|
|
281
|
+
if x == 0 or y == 0 or z == 0:
|
|
282
|
+
raise ZeroDivisionError("Division by zero")
|
|
283
|
+
|
|
284
|
+
scale_vec = vec3(x, y, z)
|
|
285
|
+
result = scale_vec / coord
|
|
286
|
+
return (result.x, result.y, result.z)
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
# Store original coord3 operators
|
|
290
|
+
_original_coord3_mul = coord3.__mul__
|
|
291
|
+
_original_coord3_rmul = coord3.__rmul__
|
|
292
|
+
_original_coord3_truediv = getattr(coord3, '__truediv__', None)
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
def _new_coord3_mul(self, other):
|
|
296
|
+
"""Enhanced multiplication operator for coord3."""
|
|
297
|
+
if isinstance(other, tuple):
|
|
298
|
+
other = CoordTuple(other)
|
|
299
|
+
return other * self
|
|
300
|
+
return _original_coord3_mul(self, other)
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
def _new_coord3_rmul(self, other):
|
|
304
|
+
"""Enhanced right multiplication operator for coord3."""
|
|
305
|
+
if isinstance(other, tuple):
|
|
306
|
+
other = CoordTuple(other)
|
|
307
|
+
return other * self
|
|
308
|
+
return _original_coord3_rmul(self, other)
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
def _new_coord3_truediv(self, other):
|
|
312
|
+
"""Enhanced division operator for coord3."""
|
|
313
|
+
if isinstance(other, tuple):
|
|
314
|
+
other = CoordTuple(other)
|
|
315
|
+
return other / self
|
|
316
|
+
if _original_coord3_truediv:
|
|
317
|
+
return _original_coord3_truediv(self, other)
|
|
318
|
+
raise TypeError(f"unsupported operand type(s) for /: 'coord3' and {type(other).__name__}")
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
# Apply enhancements to coord3 operators
|
|
322
|
+
coord3.__mul__ = _new_coord3_mul
|
|
323
|
+
coord3.__rmul__ = _new_coord3_rmul
|
|
324
|
+
coord3.__truediv__ = _new_coord3_truediv
|