• Create Account

Banner advertising on our site currently available from just \$5!

### #Actualbelfegor

Posted 26 April 2013 - 06:24 AM

+1 What kauna said.

Alternative fast sin/cos

float fast_sin(float rad)
{
static const float B = 4 / D3DX_PI;
static const float C = -4 / (D3DX_PI * D3DX_PI);

return y;
}

{
static const float B = 4 / D3DX_PI;
static const float C = -4 / (D3DX_PI * D3DX_PI);

return y;
}


http://devmaster.net/forums/topic/4648-fast-and-accurate-sinecosine/

My code above is just an example, you could precalculate most stuff at init time, no need to do that every frame.

### #2belfegor

Posted 26 April 2013 - 06:21 AM

+1 What kauna said.

Alternative fast sin/cos

float fast_sin(float rad)
{
static const float B = 4 / D3DX_PI;
static const float C = -4 / (D3DX_PI * D3DX_PI);

return y;
}

{
static const float B = 4 / D3DX_PI;
static const float C = -4 / (D3DX_PI * D3DX_PI);

return y;
}


http://devmaster.net/forums/topic/4648-fast-and-accurate-sinecosine/

### #1belfegor

Posted 26 April 2013 - 06:20 AM

Fast sin/cos

float fast_sin(float rad)
{
static const float B = 4 / D3DX_PI;
static const float C = -4 / (D3DX_PI * D3DX_PI);

return y;
}

{
static const float B = 4 / D3DX_PI;
static const float C = -4 / (D3DX_PI * D3DX_PI);