-
-
Save hug0hq/e09ef0808ce62f9027c381912d2c9e96 to your computer and use it in GitHub Desktop.
Revisions
-
patriciogonzalezvivo revised this gist
Nov 4, 2014 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This 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 @@ -54,8 +54,8 @@ mat4 RotateY(float theta){ mat4 RotateZ(float psi){ return mat4( vec4(cos(psi),-sin(psi),0.,0), vec4(sin(psi),cos(psi),0.,0.), vec4(0.,0.,1.,0.), vec4(0.,0.,0.,1.)); } -
patriciogonzalezvivo revised this gist
Oct 31, 2014 . 1 changed file with 18 additions and 0 deletions.There are no files selected for viewing
This 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 @@ -18,6 +18,24 @@ float cosd(float a){return cos(a * PI180);} From <http://duriansoftware.com/joe/An-intro-to-modern-OpenGL.-Chapter-3:-3D-transformation-and-projection.html> ``` mat4 scale(float x, float y, float z){ return mat4( vec4(x, 0.0, 0.0, 0.0), vec4(0.0, y, 0.0, 0.0), vec4(0.0, 0.0, z, 0.0), vec4(0.0, 0.0, 0.0, 1.0) ); } mat4 translate(float x, float y, float z){ return mat4( vec4(1.0, 0.0, 0.0, 0.0), vec4(0.0, 1.0, 0.0, 0.0), vec4(0.0, 0.0, 1.0, 0.0), vec4(x, y, z, 1.0) ); } mat4 RotateX(float phi){ return mat4( vec4(1.,0.,0.,0), -
patriciogonzalezvivo renamed this gist
Oct 18, 2014 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
patriciogonzalezvivo revised this gist
Jul 29, 2014 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This 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 @@ -15,6 +15,8 @@ float cosd(float a){return cos(a * PI180);} ``` From <http://duriansoftware.com/joe/An-intro-to-modern-OpenGL.-Chapter-3:-3D-transformation-and-projection.html> ``` mat4 RotateX(float phi){ return mat4( -
patriciogonzalezvivo revised this gist
Jul 29, 2014 . 1 changed file with 26 additions and 0 deletions.There are no files selected for viewing
This 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 @@ -15,6 +15,32 @@ float cosd(float a){return cos(a * PI180);} ``` ``` mat4 RotateX(float phi){ return mat4( vec4(1.,0.,0.,0), vec4(0.,cos(phi),-sin(phi),0.), vec4(0.,sin(phi),cos(phi),0.), vec4(0.,0.,0.,1.)); } mat4 RotateY(float theta){ return mat4( vec4(cos(theta),0.,-sin(theta),0), vec4(0.,1.,0.,0.), vec4(sin(theta),0.,cos(theta),0.), vec4(0.,0.,0.,1.)); } mat4 RotateZ(float psi){ return mat4( vec4(cos(psi),sin(psi),0.,0), vec4(-sin(psi),cos(psi),0.,0.), vec4(0.,0.,1.,0.), vec4(0.,0.,0.,1.)); } ``` ### [IQ Functions](http://iquilezles.org/www/articles/functions/functions.htm) by Iñigo Quilez ``` -
patriciogonzalezvivo revised this gist
Jul 9, 2014 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This 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 @@ -5,6 +5,7 @@ const float PI = 3.1415926535897932384626433832795; const float PI_2 = 1.57079632679489661923; const float PI_4 = 0.785398163397448309616; float PHI = (1.0+sqrtf(5.0))/2.0; ``` ``` -
patriciogonzalezvivo revised this gist
Jul 2, 2014 . No changes.There are no files selected for viewing
-
patriciogonzalezvivo revised this gist
Jul 2, 2014 . 1 changed file with 2 additions and 3 deletions.There are no files selected for viewing
This 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,4 @@ ### Trigonometry ``` const float PI = 3.1415926535897932384626433832795; @@ -15,7 +14,7 @@ float cosd(float a){return cos(a * PI180);} ``` ### [IQ Functions](http://iquilezles.org/www/articles/functions/functions.htm) by Iñigo Quilez ``` float almostIdentity( float x, float m, float n ){ -
patriciogonzalezvivo revised this gist
Jul 1, 2014 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This 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,14 +1,14 @@ # Angles ``` const float PI = 3.1415926535897932384626433832795; const float PI_2 = 1.57079632679489661923; const float PI_4 = 0.785398163397448309616; ``` ``` float PI180 = float(PI / 180.0); float sind(float a){return sin(a * PI180);} float cosd(float a){return cos(a * PI180);} -
patriciogonzalezvivo revised this gist
Jul 1, 2014 . 1 changed file with 49 additions and 0 deletions.There are no files selected for viewing
This 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 @@ -14,3 +14,52 @@ float sind(float a){return sin(a * PI180);} float cosd(float a){return cos(a * PI180);} ``` # [IQ Functions](http://iquilezles.org/www/articles/functions/functions.htm) by Iñigo Quilez ``` float almostIdentity( float x, float m, float n ){ if( x>m ) return x; const float a = 2.0f*n - m const float b = 2.0f*m - 3.0f*n; const float t = x/m; return (a*t + b)*t*t + n; } ``` ``` float impulse( float k, float x ){ const float h = k*x; return h*expf(1.0f-h); } ``` ``` float cubicPulse( float c, float w, float x ){ x = fabsf(x - c); if( x>w ) return 0.0f; x /= w; return 1.0f - x*x*(3.0f-2.0f*x); } ``` ``` float expStep( float x, float k, float n ){ return expf( -k*powf(x,n) ); } ``` ``` float parabola( float x, float k ){ return powf( 4.0f*x*(1.0f-x), k ); } ``` ``` float pcurve( float x, float k ){ float k = powf(a+b,a+b) / (pow(a,a)*pow(b,b)); return k * powf( x, a ) * powf( 1.0-x, b ); } ``` -
patriciogonzalezvivo revised this gist
Jun 29, 2014 . 1 changed file with 7 additions and 1 deletion.There are no files selected for viewing
This 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,10 +1,16 @@ ``` const float PI = 3.1415926535897932384626433832795; const float PI_2 = 1.57079632679489661923; const float PI_4 = 0.785398163397448309616; ``` ``` float PI180 = float(PI / 180.0); float sind(float a){return sin(a * PI180);} float cosd(float a){return cos(a * PI180);} ``` -
patriciogonzalezvivo revised this gist
Jun 29, 2014 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This 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,4 +1,4 @@ ``` const float PI = 3.1415926535897932384626433832795; const float PI_2 = 1.57079632679489661923; const float PI_4 = 0.785398163397448309616; @@ -7,4 +7,4 @@ float PI180 = float(PI / 180.0); float sind(float a){return sin(a * PI180);} float cosd(float a){return cos(a * PI180);} ``` -
patriciogonzalezvivo revised this gist
Jun 29, 2014 . 1 changed file with 2 additions and 3 deletions.There are no files selected for viewing
This 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,4 @@ ˜˜˜ const float PI = 3.1415926535897932384626433832795; const float PI_2 = 1.57079632679489661923; const float PI_4 = 0.785398163397448309616; @@ -8,4 +7,4 @@ float PI180 = float(PI / 180.0); float sind(float a){return sin(a * PI180);} float cosd(float a){return cos(a * PI180);} ˜˜˜ -
patriciogonzalezvivo revised this gist
Jun 29, 2014 . 1 changed file with 5 additions and 1 deletion.There are no files selected for viewing
This 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,7 +1,11 @@ ''' const float PI = 3.1415926535897932384626433832795; const float PI_2 = 1.57079632679489661923; const float PI_4 = 0.785398163397448309616; float PI180 = float(PI / 180.0); float sind(float a){return sin(a * PI180);} float cosd(float a){return cos(a * PI180);} ''' -
patriciogonzalezvivo revised this gist
Jun 29, 2014 . 1 changed file with 6 additions and 4 deletions.There are no files selected for viewing
This 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,7 @@ const float PI = 3.1415926535897932384626433832795; const float PI_2 = 1.57079632679489661923; const float PI_4 = 0.785398163397448309616; float PI180 = float(PI / 180.0); float sind(float a){return sin(a * PI180);} float cosd(float a){return cos(a * PI180);} -
patriciogonzalezvivo created this gist
Jun 29, 2014 .There are no files selected for viewing
This 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,5 @@ #define PI 3.1415926535897932384626433832795 #define PI180 0.0174532925199 #define sind(a) sin(float(a) * PI180) #define cosd(a) cos(float(a) * PI180)