coordinate-system 4.0.0__tar.gz → 4.0.2__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.
- {coordinate_system-4.0.0/coordinate_system.egg-info → coordinate_system-4.0.2}/PKG-INFO +26 -26
- {coordinate_system-4.0.0 → coordinate_system-4.0.2}/README.md +26 -26
- {coordinate_system-4.0.0 → coordinate_system-4.0.2}/coordinate_system/differential_geometry.py +1 -1
- {coordinate_system-4.0.0 → coordinate_system-4.0.2/coordinate_system.egg-info}/PKG-INFO +26 -26
- {coordinate_system-4.0.0 → coordinate_system-4.0.2}/coordinate_system_binding.cpp +4 -4
- {coordinate_system-4.0.0 → coordinate_system-4.0.2}/pmsys_minimal.hpp +52 -23
- {coordinate_system-4.0.0 → coordinate_system-4.0.2}/setup.py +2 -2
- {coordinate_system-4.0.0 → coordinate_system-4.0.2}/LICENSE +0 -0
- {coordinate_system-4.0.0 → coordinate_system-4.0.2}/MANIFEST.in +0 -0
- {coordinate_system-4.0.0 → coordinate_system-4.0.2}/MATHEMATICAL_FOUNDATION.md +0 -0
- {coordinate_system-4.0.0 → coordinate_system-4.0.2}/coordinate_system/__init__.py +0 -0
- {coordinate_system-4.0.0 → coordinate_system-4.0.2}/coordinate_system/curvature.py +0 -0
- {coordinate_system-4.0.0 → coordinate_system-4.0.2}/coordinate_system/fourier_spectral.py +0 -0
- {coordinate_system-4.0.0 → coordinate_system-4.0.2}/coordinate_system.egg-info/SOURCES.txt +0 -0
- {coordinate_system-4.0.0 → coordinate_system-4.0.2}/coordinate_system.egg-info/dependency_links.txt +0 -0
- {coordinate_system-4.0.0 → coordinate_system-4.0.2}/coordinate_system.egg-info/not-zip-safe +0 -0
- {coordinate_system-4.0.0 → coordinate_system-4.0.2}/coordinate_system.egg-info/top_level.txt +0 -0
- {coordinate_system-4.0.0 → coordinate_system-4.0.2}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: coordinate_system
|
|
3
|
-
Version: 4.0.
|
|
3
|
+
Version: 4.0.2
|
|
4
4
|
Summary: High-performance 3D coordinate system library with right-handed conventions, Intrinsic Gradient Operator method for curvature computation, achieving machine-precision accuracy
|
|
5
5
|
Home-page: https://github.com/panguojun/Coordinate-System
|
|
6
6
|
Author: PanGuoJun
|
|
@@ -48,7 +48,7 @@ License-File: LICENSE
|
|
|
48
48
|
[](LICENSE)
|
|
49
49
|
|
|
50
50
|
**Author:** PanGuoJun
|
|
51
|
-
**Version:**
|
|
51
|
+
**Version:** 4.0.2
|
|
52
52
|
**License:** MIT
|
|
53
53
|
|
|
54
54
|
## 🆕 What's New in v4.0.0
|
|
@@ -71,24 +71,24 @@ License-File: LICENSE
|
|
|
71
71
|
|
|
72
72
|
## 🆕 What's New in v3.0.0
|
|
73
73
|
|
|
74
|
-
**Critical Coordinate System Update -
|
|
74
|
+
**Critical Coordinate System Update - Left-Hand System!**
|
|
75
75
|
|
|
76
|
-
- ⚠️ **BREAKING CHANGE:
|
|
77
|
-
- `vec3.cross()` now uses
|
|
78
|
-
- Quaternion rotations follow
|
|
76
|
+
- ⚠️ **BREAKING CHANGE: Left-Hand Coordinate System** - Unified all operations to standard left-hand coordinate system
|
|
77
|
+
- `vec3.cross()` now uses left-hand rule (common in computer graphics)
|
|
78
|
+
- Quaternion rotations follow left-hand convention (clockwise is positive)
|
|
79
79
|
- `coord3.look_at()` and `coord3.from_forward()` updated accordingly
|
|
80
80
|
- **Migration Guide:** See [HANDEDNESS_CHANGE.md](HANDEDNESS_CHANGE.md) for details
|
|
81
|
-
- `
|
|
82
|
-
- ✅ **Verified Correctness** - Complete test suite validates
|
|
81
|
+
- `cross_right()` method retained for backward compatibility
|
|
82
|
+
- ✅ **Verified Correctness** - Complete test suite validates left-hand system behavior
|
|
83
83
|
- 📚 **Updated Documentation** - All examples and documentation reflect new coordinate system
|
|
84
84
|
- 🎯 **Enhanced Clarity** - Comments and docstrings clarified throughout
|
|
85
85
|
|
|
86
86
|
**Why This Change:**
|
|
87
|
-
1.
|
|
88
|
-
2. Better Interoperability: Compatible with
|
|
89
|
-
3. Improved Readability: Standard cross product formulas match
|
|
87
|
+
1. Graphics Standard: Left-hand system is common in computer graphics and DirectX
|
|
88
|
+
2. Better Interoperability: Compatible with DirectX, Unity, and many game engines
|
|
89
|
+
3. Improved Readability: Standard cross product formulas match graphics pipeline definitions
|
|
90
90
|
|
|
91
|
-
Perfect for
|
|
91
|
+
Perfect for computer graphics, game development, and 3D visualization applications!
|
|
92
92
|
|
|
93
93
|
---
|
|
94
94
|
|
|
@@ -210,7 +210,7 @@ lerped = vec3.lerp(v1, v2, 0.5) # Linear interpolation
|
|
|
210
210
|
|
|
211
211
|
## Coordinate System Type
|
|
212
212
|
|
|
213
|
-
This library uses a **
|
|
213
|
+
This library uses a **left-handed coordinate system** for all vector and quaternion operations (as of v3.0.0).
|
|
214
214
|
|
|
215
215
|
```
|
|
216
216
|
+Y
|
|
@@ -218,18 +218,18 @@ This library uses a **right-handed coordinate system** for all vector and quater
|
|
|
218
218
|
|
|
|
219
219
|
|
|
|
220
220
|
+-----> +X
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
221
|
+
\
|
|
222
|
+
\
|
|
223
|
+
+Z
|
|
224
224
|
```
|
|
225
225
|
|
|
226
|
-
**
|
|
227
|
-
- Point your
|
|
226
|
+
**Left-Hand Rule:**
|
|
227
|
+
- Point your left hand's fingers along the +X axis
|
|
228
228
|
- Curl them toward the +Y axis
|
|
229
229
|
- Your thumb points along the +Z axis
|
|
230
|
-
- Cross product: **X × Y = Z** (
|
|
230
|
+
- Cross product: **X × Y = Z** (common in computer graphics)
|
|
231
231
|
|
|
232
|
-
**Migration from v2.x:** If your code relied on the previous
|
|
232
|
+
**Migration from v2.x:** If your code relied on the previous right-handed system, see [HANDEDNESS_CHANGE.md](HANDEDNESS_CHANGE.md) for migration instructions.
|
|
233
233
|
|
|
234
234
|
---
|
|
235
235
|
|
|
@@ -267,7 +267,7 @@ v3 = v1 * v2 # Component-wise multiplication
|
|
|
267
267
|
|
|
268
268
|
```python
|
|
269
269
|
dot = v1.dot(v2) # Dot product (float)
|
|
270
|
-
cross = v1.cross(v2) # Cross product (vec3)
|
|
270
|
+
cross = v1.cross(v2) # Cross product (vec3) - Left-hand rule
|
|
271
271
|
length = v.length() # Vector length
|
|
272
272
|
v.normalize() # Normalize in-place
|
|
273
273
|
normalized = v.normcopy() # Return normalized copy
|
|
@@ -451,7 +451,7 @@ v4 = v1 * 5 # vec3(5, 0, 0)
|
|
|
451
451
|
|
|
452
452
|
# Dot and cross products
|
|
453
453
|
dot = v1.dot(v2) # 0.0 (perpendicular)
|
|
454
|
-
cross = v1.cross(v2) # vec3(0, 0, 1) in
|
|
454
|
+
cross = v1.cross(v2) # vec3(0, 0, -1) in left-handed system (X × Y = -Z)
|
|
455
455
|
|
|
456
456
|
# Length and normalization
|
|
457
457
|
length = v1.length() # 1.0
|
|
@@ -516,8 +516,8 @@ child_in_world = child * parent
|
|
|
516
516
|
# Create look-at transformation (custom implementation needed)
|
|
517
517
|
def look_at(eye, target, up=vec3(0, 1, 0)):
|
|
518
518
|
forward = (target - eye).normcopy()
|
|
519
|
-
right =
|
|
520
|
-
up_corrected =
|
|
519
|
+
right = forward.cross(up).normcopy() # Left-hand cross product
|
|
520
|
+
up_corrected = right.cross(forward)
|
|
521
521
|
return coord3.from_axes(right, up_corrected, forward)
|
|
522
522
|
|
|
523
523
|
camera = look_at(vec3(10, 10, 10), vec3(0, 0, 0))
|
|
@@ -537,8 +537,8 @@ class Camera:
|
|
|
537
537
|
|
|
538
538
|
def create_look_at(self, eye, target, up):
|
|
539
539
|
forward = (target - eye).normcopy()
|
|
540
|
-
right =
|
|
541
|
-
up_corrected =
|
|
540
|
+
right = forward.cross(up).normcopy() # Left-hand cross product
|
|
541
|
+
up_corrected = right.cross(forward)
|
|
542
542
|
|
|
543
543
|
c = coord3()
|
|
544
544
|
c.o = eye
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
[](LICENSE)
|
|
9
9
|
|
|
10
10
|
**Author:** PanGuoJun
|
|
11
|
-
**Version:**
|
|
11
|
+
**Version:** 4.0.2
|
|
12
12
|
**License:** MIT
|
|
13
13
|
|
|
14
14
|
## 🆕 What's New in v4.0.0
|
|
@@ -31,24 +31,24 @@
|
|
|
31
31
|
|
|
32
32
|
## 🆕 What's New in v3.0.0
|
|
33
33
|
|
|
34
|
-
**Critical Coordinate System Update -
|
|
34
|
+
**Critical Coordinate System Update - Left-Hand System!**
|
|
35
35
|
|
|
36
|
-
- ⚠️ **BREAKING CHANGE:
|
|
37
|
-
- `vec3.cross()` now uses
|
|
38
|
-
- Quaternion rotations follow
|
|
36
|
+
- ⚠️ **BREAKING CHANGE: Left-Hand Coordinate System** - Unified all operations to standard left-hand coordinate system
|
|
37
|
+
- `vec3.cross()` now uses left-hand rule (common in computer graphics)
|
|
38
|
+
- Quaternion rotations follow left-hand convention (clockwise is positive)
|
|
39
39
|
- `coord3.look_at()` and `coord3.from_forward()` updated accordingly
|
|
40
40
|
- **Migration Guide:** See [HANDEDNESS_CHANGE.md](HANDEDNESS_CHANGE.md) for details
|
|
41
|
-
- `
|
|
42
|
-
- ✅ **Verified Correctness** - Complete test suite validates
|
|
41
|
+
- `cross_right()` method retained for backward compatibility
|
|
42
|
+
- ✅ **Verified Correctness** - Complete test suite validates left-hand system behavior
|
|
43
43
|
- 📚 **Updated Documentation** - All examples and documentation reflect new coordinate system
|
|
44
44
|
- 🎯 **Enhanced Clarity** - Comments and docstrings clarified throughout
|
|
45
45
|
|
|
46
46
|
**Why This Change:**
|
|
47
|
-
1.
|
|
48
|
-
2. Better Interoperability: Compatible with
|
|
49
|
-
3. Improved Readability: Standard cross product formulas match
|
|
47
|
+
1. Graphics Standard: Left-hand system is common in computer graphics and DirectX
|
|
48
|
+
2. Better Interoperability: Compatible with DirectX, Unity, and many game engines
|
|
49
|
+
3. Improved Readability: Standard cross product formulas match graphics pipeline definitions
|
|
50
50
|
|
|
51
|
-
Perfect for
|
|
51
|
+
Perfect for computer graphics, game development, and 3D visualization applications!
|
|
52
52
|
|
|
53
53
|
---
|
|
54
54
|
|
|
@@ -170,7 +170,7 @@ lerped = vec3.lerp(v1, v2, 0.5) # Linear interpolation
|
|
|
170
170
|
|
|
171
171
|
## Coordinate System Type
|
|
172
172
|
|
|
173
|
-
This library uses a **
|
|
173
|
+
This library uses a **left-handed coordinate system** for all vector and quaternion operations (as of v3.0.0).
|
|
174
174
|
|
|
175
175
|
```
|
|
176
176
|
+Y
|
|
@@ -178,18 +178,18 @@ This library uses a **right-handed coordinate system** for all vector and quater
|
|
|
178
178
|
|
|
|
179
179
|
|
|
|
180
180
|
+-----> +X
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
181
|
+
\
|
|
182
|
+
\
|
|
183
|
+
+Z
|
|
184
184
|
```
|
|
185
185
|
|
|
186
|
-
**
|
|
187
|
-
- Point your
|
|
186
|
+
**Left-Hand Rule:**
|
|
187
|
+
- Point your left hand's fingers along the +X axis
|
|
188
188
|
- Curl them toward the +Y axis
|
|
189
189
|
- Your thumb points along the +Z axis
|
|
190
|
-
- Cross product: **X × Y = Z** (
|
|
190
|
+
- Cross product: **X × Y = Z** (common in computer graphics)
|
|
191
191
|
|
|
192
|
-
**Migration from v2.x:** If your code relied on the previous
|
|
192
|
+
**Migration from v2.x:** If your code relied on the previous right-handed system, see [HANDEDNESS_CHANGE.md](HANDEDNESS_CHANGE.md) for migration instructions.
|
|
193
193
|
|
|
194
194
|
---
|
|
195
195
|
|
|
@@ -227,7 +227,7 @@ v3 = v1 * v2 # Component-wise multiplication
|
|
|
227
227
|
|
|
228
228
|
```python
|
|
229
229
|
dot = v1.dot(v2) # Dot product (float)
|
|
230
|
-
cross = v1.cross(v2) # Cross product (vec3)
|
|
230
|
+
cross = v1.cross(v2) # Cross product (vec3) - Left-hand rule
|
|
231
231
|
length = v.length() # Vector length
|
|
232
232
|
v.normalize() # Normalize in-place
|
|
233
233
|
normalized = v.normcopy() # Return normalized copy
|
|
@@ -411,7 +411,7 @@ v4 = v1 * 5 # vec3(5, 0, 0)
|
|
|
411
411
|
|
|
412
412
|
# Dot and cross products
|
|
413
413
|
dot = v1.dot(v2) # 0.0 (perpendicular)
|
|
414
|
-
cross = v1.cross(v2) # vec3(0, 0, 1) in
|
|
414
|
+
cross = v1.cross(v2) # vec3(0, 0, -1) in left-handed system (X × Y = -Z)
|
|
415
415
|
|
|
416
416
|
# Length and normalization
|
|
417
417
|
length = v1.length() # 1.0
|
|
@@ -476,8 +476,8 @@ child_in_world = child * parent
|
|
|
476
476
|
# Create look-at transformation (custom implementation needed)
|
|
477
477
|
def look_at(eye, target, up=vec3(0, 1, 0)):
|
|
478
478
|
forward = (target - eye).normcopy()
|
|
479
|
-
right =
|
|
480
|
-
up_corrected =
|
|
479
|
+
right = forward.cross(up).normcopy() # Left-hand cross product
|
|
480
|
+
up_corrected = right.cross(forward)
|
|
481
481
|
return coord3.from_axes(right, up_corrected, forward)
|
|
482
482
|
|
|
483
483
|
camera = look_at(vec3(10, 10, 10), vec3(0, 0, 0))
|
|
@@ -497,8 +497,8 @@ class Camera:
|
|
|
497
497
|
|
|
498
498
|
def create_look_at(self, eye, target, up):
|
|
499
499
|
forward = (target - eye).normcopy()
|
|
500
|
-
right =
|
|
501
|
-
up_corrected =
|
|
500
|
+
right = forward.cross(up).normcopy() # Left-hand cross product
|
|
501
|
+
up_corrected = right.cross(forward)
|
|
502
502
|
|
|
503
503
|
c = coord3()
|
|
504
504
|
c.o = eye
|
|
@@ -714,4 +714,4 @@ Built with ❤️ using:
|
|
|
714
714
|
|
|
715
715
|
---
|
|
716
716
|
|
|
717
|
-
**Note**: For the latest updates and documentation, visit the [GitHub repository](https://github.com/panguojun/Coordinate-System).
|
|
717
|
+
**Note**: For the latest updates and documentation, visit the [GitHub repository](https://github.com/panguojun/Coordinate-System).
|
{coordinate_system-4.0.0 → coordinate_system-4.0.2}/coordinate_system/differential_geometry.py
RENAMED
|
@@ -6,7 +6,7 @@ This module provides tools for discrete differential geometry computations on su
|
|
|
6
6
|
using the CORRECT Intrinsic Gradient Operator framework based on the proven algorithm.
|
|
7
7
|
|
|
8
8
|
Key Formula:
|
|
9
|
-
G_μ = (c(u+h) - c(u-h)) / (2h)
|
|
9
|
+
G_μ = (c(u+h) - c(u-h)) / (2h) / c(u) then extract normal derivative using .VZ()
|
|
10
10
|
|
|
11
11
|
Author: PanGuoJun
|
|
12
12
|
Date: 2025-10-31
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: coordinate_system
|
|
3
|
-
Version: 4.0.
|
|
3
|
+
Version: 4.0.2
|
|
4
4
|
Summary: High-performance 3D coordinate system library with right-handed conventions, Intrinsic Gradient Operator method for curvature computation, achieving machine-precision accuracy
|
|
5
5
|
Home-page: https://github.com/panguojun/Coordinate-System
|
|
6
6
|
Author: PanGuoJun
|
|
@@ -48,7 +48,7 @@ License-File: LICENSE
|
|
|
48
48
|
[](LICENSE)
|
|
49
49
|
|
|
50
50
|
**Author:** PanGuoJun
|
|
51
|
-
**Version:**
|
|
51
|
+
**Version:** 4.0.2
|
|
52
52
|
**License:** MIT
|
|
53
53
|
|
|
54
54
|
## 🆕 What's New in v4.0.0
|
|
@@ -71,24 +71,24 @@ License-File: LICENSE
|
|
|
71
71
|
|
|
72
72
|
## 🆕 What's New in v3.0.0
|
|
73
73
|
|
|
74
|
-
**Critical Coordinate System Update -
|
|
74
|
+
**Critical Coordinate System Update - Left-Hand System!**
|
|
75
75
|
|
|
76
|
-
- ⚠️ **BREAKING CHANGE:
|
|
77
|
-
- `vec3.cross()` now uses
|
|
78
|
-
- Quaternion rotations follow
|
|
76
|
+
- ⚠️ **BREAKING CHANGE: Left-Hand Coordinate System** - Unified all operations to standard left-hand coordinate system
|
|
77
|
+
- `vec3.cross()` now uses left-hand rule (common in computer graphics)
|
|
78
|
+
- Quaternion rotations follow left-hand convention (clockwise is positive)
|
|
79
79
|
- `coord3.look_at()` and `coord3.from_forward()` updated accordingly
|
|
80
80
|
- **Migration Guide:** See [HANDEDNESS_CHANGE.md](HANDEDNESS_CHANGE.md) for details
|
|
81
|
-
- `
|
|
82
|
-
- ✅ **Verified Correctness** - Complete test suite validates
|
|
81
|
+
- `cross_right()` method retained for backward compatibility
|
|
82
|
+
- ✅ **Verified Correctness** - Complete test suite validates left-hand system behavior
|
|
83
83
|
- 📚 **Updated Documentation** - All examples and documentation reflect new coordinate system
|
|
84
84
|
- 🎯 **Enhanced Clarity** - Comments and docstrings clarified throughout
|
|
85
85
|
|
|
86
86
|
**Why This Change:**
|
|
87
|
-
1.
|
|
88
|
-
2. Better Interoperability: Compatible with
|
|
89
|
-
3. Improved Readability: Standard cross product formulas match
|
|
87
|
+
1. Graphics Standard: Left-hand system is common in computer graphics and DirectX
|
|
88
|
+
2. Better Interoperability: Compatible with DirectX, Unity, and many game engines
|
|
89
|
+
3. Improved Readability: Standard cross product formulas match graphics pipeline definitions
|
|
90
90
|
|
|
91
|
-
Perfect for
|
|
91
|
+
Perfect for computer graphics, game development, and 3D visualization applications!
|
|
92
92
|
|
|
93
93
|
---
|
|
94
94
|
|
|
@@ -210,7 +210,7 @@ lerped = vec3.lerp(v1, v2, 0.5) # Linear interpolation
|
|
|
210
210
|
|
|
211
211
|
## Coordinate System Type
|
|
212
212
|
|
|
213
|
-
This library uses a **
|
|
213
|
+
This library uses a **left-handed coordinate system** for all vector and quaternion operations (as of v3.0.0).
|
|
214
214
|
|
|
215
215
|
```
|
|
216
216
|
+Y
|
|
@@ -218,18 +218,18 @@ This library uses a **right-handed coordinate system** for all vector and quater
|
|
|
218
218
|
|
|
|
219
219
|
|
|
|
220
220
|
+-----> +X
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
221
|
+
\
|
|
222
|
+
\
|
|
223
|
+
+Z
|
|
224
224
|
```
|
|
225
225
|
|
|
226
|
-
**
|
|
227
|
-
- Point your
|
|
226
|
+
**Left-Hand Rule:**
|
|
227
|
+
- Point your left hand's fingers along the +X axis
|
|
228
228
|
- Curl them toward the +Y axis
|
|
229
229
|
- Your thumb points along the +Z axis
|
|
230
|
-
- Cross product: **X × Y = Z** (
|
|
230
|
+
- Cross product: **X × Y = Z** (common in computer graphics)
|
|
231
231
|
|
|
232
|
-
**Migration from v2.x:** If your code relied on the previous
|
|
232
|
+
**Migration from v2.x:** If your code relied on the previous right-handed system, see [HANDEDNESS_CHANGE.md](HANDEDNESS_CHANGE.md) for migration instructions.
|
|
233
233
|
|
|
234
234
|
---
|
|
235
235
|
|
|
@@ -267,7 +267,7 @@ v3 = v1 * v2 # Component-wise multiplication
|
|
|
267
267
|
|
|
268
268
|
```python
|
|
269
269
|
dot = v1.dot(v2) # Dot product (float)
|
|
270
|
-
cross = v1.cross(v2) # Cross product (vec3)
|
|
270
|
+
cross = v1.cross(v2) # Cross product (vec3) - Left-hand rule
|
|
271
271
|
length = v.length() # Vector length
|
|
272
272
|
v.normalize() # Normalize in-place
|
|
273
273
|
normalized = v.normcopy() # Return normalized copy
|
|
@@ -451,7 +451,7 @@ v4 = v1 * 5 # vec3(5, 0, 0)
|
|
|
451
451
|
|
|
452
452
|
# Dot and cross products
|
|
453
453
|
dot = v1.dot(v2) # 0.0 (perpendicular)
|
|
454
|
-
cross = v1.cross(v2) # vec3(0, 0, 1) in
|
|
454
|
+
cross = v1.cross(v2) # vec3(0, 0, -1) in left-handed system (X × Y = -Z)
|
|
455
455
|
|
|
456
456
|
# Length and normalization
|
|
457
457
|
length = v1.length() # 1.0
|
|
@@ -516,8 +516,8 @@ child_in_world = child * parent
|
|
|
516
516
|
# Create look-at transformation (custom implementation needed)
|
|
517
517
|
def look_at(eye, target, up=vec3(0, 1, 0)):
|
|
518
518
|
forward = (target - eye).normcopy()
|
|
519
|
-
right =
|
|
520
|
-
up_corrected =
|
|
519
|
+
right = forward.cross(up).normcopy() # Left-hand cross product
|
|
520
|
+
up_corrected = right.cross(forward)
|
|
521
521
|
return coord3.from_axes(right, up_corrected, forward)
|
|
522
522
|
|
|
523
523
|
camera = look_at(vec3(10, 10, 10), vec3(0, 0, 0))
|
|
@@ -537,8 +537,8 @@ class Camera:
|
|
|
537
537
|
|
|
538
538
|
def create_look_at(self, eye, target, up):
|
|
539
539
|
forward = (target - eye).normcopy()
|
|
540
|
-
right =
|
|
541
|
-
up_corrected =
|
|
540
|
+
right = forward.cross(up).normcopy() # Left-hand cross product
|
|
541
|
+
up_corrected = right.cross(forward)
|
|
542
542
|
|
|
543
543
|
c = coord3()
|
|
544
544
|
c.o = eye
|
|
@@ -361,9 +361,9 @@ PYBIND11_MODULE(coordinate_system, m) {
|
|
|
361
361
|
.def("to_local", [](const coord3& c, const vec3& world) { return coord3_to_local(c, world); }, "Transform to local coordinates", py::arg("world"))
|
|
362
362
|
|
|
363
363
|
// Advanced accessors
|
|
364
|
-
.def("VX",
|
|
365
|
-
|
|
366
|
-
|
|
364
|
+
.def("VX", static_cast<vec3(coord3::*)() const>(&coord3::VX), "Get scaled X axis")
|
|
365
|
+
.def("VY", static_cast<vec3(coord3::*)() const>(&coord3::VY), "Get scaled Y axis")
|
|
366
|
+
.def("VZ", static_cast<vec3(coord3::*)() const>(&coord3::VZ), "Get scaled Z axis")
|
|
367
367
|
.def("X", &coord3::X, "Get X axis with position offset")
|
|
368
368
|
.def("Y", &coord3::Y, "Get Y axis with position offset")
|
|
369
369
|
.def("Z", &coord3::Z, "Get Z axis with position offset")
|
|
@@ -531,7 +531,7 @@ PYBIND11_MODULE(coordinate_system, m) {
|
|
|
531
531
|
m.attr("EPSILON") = (real)EPSILON;
|
|
532
532
|
m.attr("VERSION") = GCU_VERSION;
|
|
533
533
|
|
|
534
|
-
m.attr("__version__") = "
|
|
534
|
+
m.attr("__version__") = "4.0.1";
|
|
535
535
|
m.attr("__author__") = "PanGuoJun";
|
|
536
536
|
m.attr("__coordinate_system__") = "right-handed";
|
|
537
537
|
}
|
|
@@ -878,10 +878,10 @@ struct vector3
|
|
|
878
878
|
DEVICE_CALLABLE vector3 cross(const vector3& v) const
|
|
879
879
|
{
|
|
880
880
|
vector3 n;
|
|
881
|
-
//
|
|
882
|
-
n.x = (y * v.z - z * v.y);
|
|
883
|
-
n.y = (z * v.x - x * v.z);
|
|
884
|
-
n.z = (x * v.y - y * v.x);
|
|
881
|
+
// 默认使用左手顺序!
|
|
882
|
+
n.x = -(y * v.z - z * v.y);
|
|
883
|
+
n.y = -(z * v.x - x * v.z);
|
|
884
|
+
n.z = -(x * v.y - y * v.x);
|
|
885
885
|
return n;
|
|
886
886
|
}
|
|
887
887
|
DEVICE_CALLABLE vector3 cross_left(const vector3& v) const
|
|
@@ -2580,8 +2580,17 @@ inline real vv_angle(crvec2 v1, crvec2 v2)
|
|
|
2580
2580
|
if (angle < 0)
|
|
2581
2581
|
angle += 2 * PI;
|
|
2582
2582
|
return v1.cross(v2) > 0 ? angle : -angle;
|
|
2583
|
-
}
|
|
2584
|
-
|
|
2583
|
+
}
|
|
2584
|
+
/**************************************************************************************************************\
|
|
2585
|
+
* _______ _ _____ _ _ _ _____ _ *
|
|
2586
|
+
* |__ __| | / ____| | (_) | | / ____| | | *
|
|
2587
|
+
* | | | |__ ___ | | ___ ___ _ __ __| |_ _ __ __ _| |_ ___ | (___ _ _ ___| |_ ___ _ __ ___ *
|
|
2588
|
+
* | | | '_ \ / _ \| | / _ \ / _ \| '__/ _` | | '_ \ / _` | __/ _ \ \___ \| | | / __| __/ _ \ '_ ` _ \ *
|
|
2589
|
+
* | | | | | | __/| |___| (_) | (_) | | | (_| | | | | | (_| | || __/ ____) | |_| \__ \ || __/ | | | | | *
|
|
2590
|
+
* |_| |_| |_|\___| \_____\___/ \___/|_| \__,_|_|_| |_|\__,_|\__\___||_____/ \__, |___/\__\___|_| |_| |_| *
|
|
2591
|
+
* __/ | *
|
|
2592
|
+
* |___/ *
|
|
2593
|
+
** [Coordinate System (Coordinate Frame)] **
|
|
2585
2594
|
*
|
|
2586
2595
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
2587
2596
|
* The Coordinate System class is specifically encapsulated to simplify coordinate transformations
|
|
@@ -2591,12 +2600,12 @@ inline real vv_angle(crvec2 v1, crvec2 v2)
|
|
|
2591
2600
|
*
|
|
2592
2601
|
* * * * * * * * * * * * Detailed Explanation * * * * * * * * * * * * * *
|
|
2593
2602
|
* Coordinate system transformation is divided into three steps:
|
|
2594
|
-
*
|
|
2603
|
+
* projection (/), translation (^), and restoration (*).
|
|
2595
2604
|
*
|
|
2596
2605
|
* The coordinate system itself is denoted as C. Transformations between coordinate systems
|
|
2597
2606
|
* can be expressed as G = C2 / C1 - I, where G represents the geometric gradient.
|
|
2598
|
-
*
|
|
2599
|
-
*
|
|
2607
|
+
* oper(/) = C1 * C2^-1
|
|
2608
|
+
* oper(\) = C1^-1 * C2
|
|
2600
2609
|
*
|
|
2601
2610
|
* Specifically:
|
|
2602
2611
|
* Define a vector V in an intrinsic coordinate system (assuming a flat space where vectors can
|
|
@@ -2605,27 +2614,47 @@ inline real vv_angle(crvec2 v1, crvec2 v2)
|
|
|
2605
2614
|
*
|
|
2606
2615
|
* Take vectors V1 and V2 at adjacent points (1) and (2) respectively,
|
|
2607
2616
|
* corresponding to coordinate systems C1 and C2. Then:
|
|
2608
|
-
*
|
|
2609
|
-
*
|
|
2610
|
-
*
|
|
2617
|
+
* V = V1 * C1 = V2 * C2 =>
|
|
2618
|
+
* V2 = V1 * C1 / C2, let R12 = C1 / C2 =>
|
|
2619
|
+
* V2 = V1 * R12
|
|
2611
2620
|
*
|
|
2612
|
-
* Based on the frame
|
|
2613
|
-
* the
|
|
2614
|
-
*
|
|
2621
|
+
* Based on the dual-frame normalization theory proposed in this paper,
|
|
2622
|
+
* the geometric connection operator is:
|
|
2623
|
+
* G_μ = (c(u+h_μ) - c(u))/h_μ
|
|
2615
2624
|
* where c is the intrinsic frame field and C is the embedding frame field.
|
|
2616
2625
|
*
|
|
2617
2626
|
* The coordinate system can be used to compute spatial curvature. In the u,v coordinate system,
|
|
2618
2627
|
* the curvature tensor is:
|
|
2619
|
-
*
|
|
2628
|
+
* R_uv = G_u·G_v - G_v·G_u - G_[u,v]
|
|
2620
2629
|
* where:
|
|
2621
|
-
*
|
|
2622
|
-
*
|
|
2623
|
-
*
|
|
2624
|
-
*
|
|
2630
|
+
* G_u = (c(u+Δ,v) - c(u,v)) / Δ
|
|
2631
|
+
* G_v = (c(u,v+Δ) - c(u,v)) / Δ
|
|
2632
|
+
* G_[u,v] = connection operator for coordinate commutator [∂_u, ∂_v]
|
|
2633
|
+
*
|
|
2634
|
+
* For holonomic coordinate systems (spherical, toroidal, etc.), coordinate basis vectors commute:
|
|
2635
|
+
* [∂_u, ∂_v] = 0 ⇒ G_[u,v] = 0
|
|
2636
|
+
* Thus the formula simplifies to: R_uv = G_u·G_v - G_v·G_u
|
|
2637
|
+
*
|
|
2638
|
+
* **Measurement Function for Curvature Extraction:**
|
|
2639
|
+
*
|
|
2640
|
+
* The measurement function bridges frame bundle curvature to Riemannian geometry:
|
|
2641
|
+
* M_{ijkl} = √det(g) · ⟨X e_l, e_k⟩
|
|
2642
|
+
* where:
|
|
2643
|
+
* X = [G_u, G_v] (Lie bracket curvature operator)
|
|
2644
|
+
* e_k, e_l (tangent basis vectors)
|
|
2645
|
+
* det(g) (determinant of metric tensor)
|
|
2646
|
+
* ⟨·,·⟩ (inner product in embedding space)
|
|
2647
|
+
*
|
|
2648
|
+
* **Riemann Curvature Extraction:**
|
|
2649
|
+
* R_{ijkl} = M_{ijkl} / √det(g)
|
|
2650
|
+
*
|
|
2651
|
+
* **Gaussian Curvature Calculation (verified implementation):**
|
|
2652
|
+
* K = R_{1212} / det(g)
|
|
2653
|
+
*
|
|
2654
|
+
*
|
|
2655
|
+
* This approach provides O(n³) computational complexity for full curvature analysis,
|
|
2656
|
+
* significantly faster than traditional O(n⁶) methods.
|
|
2625
2657
|
*
|
|
2626
|
-
* Compared with traditional methods, this framework avoids the complex Christoffel symbol
|
|
2627
|
-
* computation chain and directly extracts geometric invariants through frame field combinations,
|
|
2628
|
-
* offering higher computational efficiency and geometric intuitiveness.
|
|
2629
2658
|
*/
|
|
2630
2659
|
|
|
2631
2660
|
// #define NON_UNIFORM_SCALE
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
setup.py - Cross-platform setup for coordinate_system package
|
|
3
3
|
|
|
4
4
|
Author: PanGuoJun
|
|
5
|
-
Version: 4.0.
|
|
5
|
+
Version: 4.0.2
|
|
6
6
|
License: MIT
|
|
7
7
|
"""
|
|
8
8
|
|
|
@@ -69,7 +69,7 @@ ext_modules = [
|
|
|
69
69
|
|
|
70
70
|
setup(
|
|
71
71
|
name='coordinate_system',
|
|
72
|
-
version='4.0.
|
|
72
|
+
version='4.0.2',
|
|
73
73
|
packages=find_packages(),
|
|
74
74
|
ext_modules=ext_modules, # Add extension modules
|
|
75
75
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{coordinate_system-4.0.0 → coordinate_system-4.0.2}/coordinate_system.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
{coordinate_system-4.0.0 → coordinate_system-4.0.2}/coordinate_system.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|