Created
June 1, 2011 15:50
-
-
Save aschreyer/1002603 to your computer and use it in GitHub Desktop.
Eigen Vector3D PostgreSQL extension
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT degrees('(3,0,0)'::vector3d @ '(5,5,0)'::vector3d) AS angle; | |
angle | |
------- | |
45 | |
(1 row) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT COUNT(*) FROM credo.atoms; | |
count | |
--------- | |
3716692 | |
(1 row) | |
SELECT vector3d_norm(coords) | |
FROM credo.atoms | |
ORDER BY 1 | |
LIMIT 20; | |
vector3d_norm | |
------------------- | |
0.266732071100181 | |
0.495048489244454 | |
0.646344318702224 | |
0.759123181442119 | |
0.884029956900807 | |
0.926277483712275 | |
0.926432929988672 | |
0.932031105419797 | |
0.967361873862429 | |
0.993470670604998 | |
1.00786357380269 | |
1.00977918256379 | |
1.01654514083277 | |
1.02094760913838 | |
1.02251455300799 | |
1.04313659046296 | |
1.09904459767644 | |
1.13930636319184 | |
1.14757132309494 | |
1.1507923657741 | |
(20 rows) | |
Time: 1164.410 ms |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT '(1,2,3)'::vector3d -> '(2,2,3)'::vector3d AS distance; | |
distance | |
---------- | |
1 | |
(1 row) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment