gfloat.h File Reference
Main Page
Topics
Modules
Namespaces
Classes
Files
File List
File Members
Functions
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
32
{
33
#ifdef __USE_ASM_CODE_
34
__asm {
35
push ecx
36
fld dword ptr angle
37
fsincos
38
mov ecx, dword ptr[cosine]
39
fstp dword ptr [ecx]
40
mov ecx, dword ptr[sine]
41
fstp dword ptr [ecx]
42
pop ecx
43
}
44
#else
45
*sine = (float)sin (angle);
46
*cosine = (float)cos (angle);
47
#endif
48
}
float Sin
(
float
angle
)
inline
51
{
52
#ifdef __USE_ASM_CODE_
53
float
s, c;
54
SinCos
(angle, &s, &c);
55
return
s;
56
#else
57
return
(
float
)sin((
double
)angle);
58
#endif
59
}
SinCos
void SinCos(float angle, float *sine, float *cosine)
Definition:
gfloat.h:31
float Cos
(
float
angle
)
inline
62
{
63
#ifdef __USE_ASM_CODE_
64
float
s, c;
65
SinCos
(angle, &s, &c);
66
return
c;
67
#else
68
return
(
float
)cos((
double
)angle);
69
#endif
70
}
SinCos
void SinCos(float angle, float *sine, float *cosine)
Definition:
gfloat.h:31
float Sqrt
(
float
arg
)
inline
73
{
74
#ifdef __USE_ASM_CODE_
75
float
ans;
76
__asm {
77
fld dword ptr arg
78
fsqrt
79
fstp dword ptr [ans]
80
}
81
return
ans;
82
#else
83
return
(
float
)sqrt((
double
)arg);
84
#endif
85
}