maths Archive

  • Many things are cool, like this screenshot of XCode for example… this is what happens when debugging iOS apps that use OpenGL, there’s a handy button to click that lets...

    Scenegraphs are cool…

    Many things are cool, like this screenshot of XCode for example… this is what happens when debugging iOS apps that use OpenGL, there’s a handy button to click that lets...

    Continue Reading...

  • So after creating a fun little iOS game using OpenGL ES 1.1 I decided the next thing I create should use ‘real’ 3D, rather than simply bashing OpenGL into managing...

    Debugging via telepathy

    So after creating a fun little iOS game using OpenGL ES 1.1 I decided the next thing I create should use ‘real’ 3D, rather than simply bashing OpenGL into managing...

    Continue Reading...

  • // Finds the angle that is 180 degrees from the given angle, but in radians fmodf((angle + M_PI), (M_PI * 2))

    Find opposite angle in radians

    // Finds the angle that is 180 degrees from the given angle, but in radians fmodf((angle + M_PI), (M_PI * 2))

    Continue Reading...

  • #include < stdio.h > #include < math.h >   #define M_PI 3.141 #define PI180 (M_PI/180) #define DEG2RAD(x) (x * PI180)   float getShortAngle(float a1, float a2) { float angle =...

    LERP between angles in radians

    #include < stdio.h > #include < math.h >   #define M_PI 3.141 #define PI180 (M_PI/180) #define DEG2RAD(x) (x * PI180)   float getShortAngle(float a1, float a2) { float angle =...

    Continue Reading...

  • // Between a and b, using steps of 'f' size float lerp(float a, float b, float f) { return a + f * (b - a); } // From http://stackoverflow.com/questions/4353525/floating-point-linear-interpolation

    LERP

    // Between a and b, using steps of 'f' size float lerp(float a, float b, float f) { return a + f * (b - a); } // From http://stackoverflow.com/questions/4353525/floating-point-linear-interpolation

    Continue Reading...

  • float getShortAngle(float a1, float a2) { float angle = abs(a1 - a2)%360;   if(angle > 180) angle = 360 - angle;   return angle; };   printf ("%f", getShortAngle(360, 720));

    Shortest distance between two angles

    float getShortAngle(float a1, float a2) { float angle = abs(a1 - a2)%360;   if(angle > 180) angle = 360 - angle;   return angle; };   printf ("%f", getShortAngle(360, 720));

    Continue Reading...

  • I spent some of today learning basic, but useful calculus. There are various bits of maths that never made sense to me, and which seemed really complicated. For example working...

    Basic calculus

    I spent some of today learning basic, but useful calculus. There are various bits of maths that never made sense to me, and which seemed really complicated. For example working...

    Continue Reading...

  • I spent this afternoon playing around with some basic school maths – calculating line/line intersections and distance from a point to a line stuff. And a little bit of vector...

    This is why you learnt geometry at school

    I spent this afternoon playing around with some basic school maths – calculating line/line intersections and distance from a point to a line stuff. And a little bit of vector...

    Continue Reading...