Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/ode/ode-0.9/GIMPACT/src/gim_math.cpp @ 216

Last change on this file since 216 was 216, checked in by mathiask, 17 years ago

[Physik] add ode-0.9

File size: 1.7 KB
Line 
1/*
2-----------------------------------------------------------------------------
3This source file is part of GIMPACT Library.
4
5For the latest info, see http://gimpact.sourceforge.net/
6
7Copyright (c) 2006 Francisco Leon. C.C. 80087371.
8email: projectileman@yahoo.com
9
10 This library is free software; you can redistribute it and/or
11 modify it under the terms of EITHER:
12   (1) The GNU Lesser General Public License as published by the Free
13       Software Foundation; either version 2.1 of the License, or (at
14       your option) any later version. The text of the GNU Lesser
15       General Public License is included with this library in the
16       file GIMPACT-LICENSE-LGPL.TXT.
17   (2) The BSD-style license that is included with this library in
18       the file GIMPACT-LICENSE-BSD.TXT.
19
20 This library is distributed in the hope that it will be useful,
21 but WITHOUT ANY WARRANTY; without even the implied warranty of
22 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files
23 GIMPACT-LICENSE-LGPL.TXT and GIMPACT-LICENSE-BSD.TXT for more details.
24
25-----------------------------------------------------------------------------
26*/
27
28
29#include "GIMPACT/gim_math.h"
30#include "stdlib.h"
31#include "time.h"
32
33
34GREAL gim_inv_sqrt(GREAL f)
35{
36    GREAL r;
37    GIM_INV_SQRT(f,r);
38    return r;
39}
40
41GREAL gim_sqrt(GREAL f)
42{
43    GREAL r;
44    GIM_SQRT(f,r);
45    return r;
46}
47
48//!Initializes mathematical functions
49void gim_init_math()
50{
51    srand( static_cast< unsigned int >( time( 0 ) ) );
52}
53
54//! Generates an unit random
55GREAL gim_unit_random()
56{
57    GREAL rn = static_cast< GREAL >( rand() );
58    rn/=(GREAL)RAND_MAX;
59    return rn;
60}
Note: See TracBrowser for help on using the repository browser.