Created
          August 11, 2020 09:28 
        
      - 
      
- 
        Save nicoptere/b7875031c511f81c58ea3e7729fb4bc8 to your computer and use it in GitHub Desktop. 
Revisions
- 
        nicoptere revised this gist Aug 11, 2020 . 1 changed file with 0 additions and 2 deletions.There are no files selected for viewingThis file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,3 @@ /** original code https://gist.github.com/Dan-Piker/f7d790b3967d41bff8b0291f4cf7bd9e 
- 
        nicoptere created this gist Aug 11, 2020 .There are no files selected for viewingThis file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,38 @@ /** original code https://gist.github.com/Dan-Piker/f7d790b3967d41bff8b0291f4cf7bd9e need to declare the following: uniform vec3 origin; uniform float p; uniform float q; uniform float t; */ vec3 pos = position - origin; float xa = pos.x; float ya = pos.y; float za = pos.z; //reverse stereographic projection to hypersphere float pLength = (1. + xa * xa + ya * ya + za * za); float xb = 2. * xa / pLength; float yb = 2. * ya / pLength; float zb = 2. * za / pLength; float wb = (-1. + xa * xa + ya * ya + za * za) / pLength; //rotate hypersphere by amount t float xc = xb * cos(p * t) + yb * sin(p * t); float yc = -xb * sin(p * t) + yb * cos(p * t); float zc = zb * cos(q * t) - wb * sin(q * t); float wc = zb * sin(q * t) + wb * cos(q * t); //project stereographically back to flat 3D float xd = xc / (1. - wc); float yd = yc / (1. - wc); float zd = zc / (1. - wc); //the transformed point vec3 transformed = vec3(xd, yd, zd);