-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathQuickTrig.cpp
35 lines (27 loc) · 885 Bytes
/
QuickTrig.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Copyright (c) 1999-2003 Robin Davies.
// Placed into the public domain.
// All uses permitted without attribution.
#include "QuickTrig.h"
#include <math.h>
void CQuickTrigConsts::Initialize()
{
int i;
for (i = 0; i <= kMsTableSize; ++i) {
double phi = (2*PI*i/kMsTableSize);
mMsBitsTable[i].msin = (float)sin(phi);
mMsBitsTable[i].mcos = (float)cos(phi);
}
for (i = 0; i <= kLsTableSize; ++i) {
double phi = (2*PI*i/(kMsTableSize*1.0*kLsTableSize));
mLsBitsTable[i].msin = (float)sin(phi);
mLsBitsTable[i].mcos = (float)cos(phi);
}
}
// Initialize QuickTrig constants with a global constructor.
class CQuickTrigInitialize: CQuickTrigConsts {
public:
CQuickTrigInitialize() {
CQuickTrigConsts::Initialize();
}
};
CQuickTrigInitialize gQuickTrigInitialize;