gfloat.h File Reference
 
 
 
gfloat.h File Reference

This reference page is linked to from the following overview topics: Computing Vertex Normals by Weighting.


#include <math.h>

Functions

void  SinCos (float angle, float *sine, float *cosine)
float  Sin (float angle)
float  Cos (float angle)
float  Sqrt (float arg)

Function Documentation

void SinCos ( float  angle,
float *  sine,
float *  cosine 
) [inline]
{
#ifdef __USE_ASM_CODE_
        __asm {
                push            ecx
        fld         dword ptr angle
        fsincos
                mov             ecx, dword ptr[cosine]
        fstp        dword ptr [ecx]
                mov             ecx, dword ptr[sine]
        fstp        dword ptr [ecx]
                pop                     ecx
    }
#else
    *sine   = (float)sin (angle);
    *cosine = (float)cos (angle);
#endif
}
float Sin ( float  angle ) [inline]
{
#ifdef __USE_ASM_CODE_
        float s, c;
        SinCos(angle, &s, &c);
        return s;
#else
        return (float)sin((double)angle);
#endif
}
float Cos ( float  angle ) [inline]
{
#ifdef __USE_ASM_CODE_
        float s, c;
        SinCos(angle, &s, &c);
        return c;
#else
        return (float)cos((double)angle);
#endif
}
float Sqrt ( float  arg ) [inline]
{
#ifdef __USE_ASM_CODE_
        float ans;
    __asm {
        fld         dword ptr arg
        fsqrt
        fstp        dword ptr [ans]
        }
        return ans;
#else
        return (float)sqrt((double)arg);
#endif
}