d3dx8: Implement D3DX8Vec2LengthSq with a test.
This commit is contained in:
parent
e4ba8eb450
commit
d404ec8c4b
|
@ -39,7 +39,19 @@ static void D3X8Vector2Test(void)
|
|||
expected=0.0f;
|
||||
got= D3DXVec2Length(NULL);
|
||||
ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got);
|
||||
|
||||
|
||||
/*_______________D3DXVec2LengthSq________________________*/
|
||||
expected = 25.0f;
|
||||
got = D3DXVec2LengthSq(&u);
|
||||
ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got);
|
||||
/* Tests the case NULL */
|
||||
expected=0.0f;
|
||||
got= D3DXVec2LengthSq(NULL);
|
||||
ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got);
|
||||
|
||||
}
|
||||
|
||||
START_TEST(math)
|
||||
{
|
||||
D3X8Vector2Test();
|
||||
|
|
|
@ -59,5 +59,6 @@ typedef struct D3DXCOLOR
|
|||
} D3DXCOLOR, *LPD3DXCOLOR;
|
||||
|
||||
FLOAT D3DXVec2Length(CONST D3DXVECTOR2 *pv);
|
||||
FLOAT D3DXVec2LengthSq(CONST D3DXVECTOR2 *pv);
|
||||
|
||||
#endif /* __D3DX8MATH_H__ */
|
||||
|
|
|
@ -25,4 +25,10 @@ extern inline FLOAT D3DXVec2Length(CONST D3DXVECTOR2 *pv)
|
|||
return sqrt( (pv->x) * (pv->x) + (pv->y) * (pv->y) );
|
||||
}
|
||||
|
||||
extern inline FLOAT D3DXVec2LengthSq(CONST D3DXVECTOR2 *pv)
|
||||
{
|
||||
if (!pv) return 0.0f;
|
||||
return( (pv->x) * (pv->x) + (pv->y) * (pv->y) );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue