Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
opvector3.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 1998,1999,2000 by Jorrit Tyberghein
3  Largely rewritten by Ivan Avramovic <ivan@avramovic.com>
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Library General Public
7  License as published by the Free Software Foundation; either
8  version 2 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Library General Public License for more details.
14 
15  You should have received a copy of the GNU Library General Public
16  License along with this library; if not, write to the Free
17  Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19 
20 #include <math.h>
21 #include <float.h>
25 #include "opvector3.h"
26 
27 //---------------------------------------------------------------------------
28 
29 float csVector3::Norm () const
30 {
31  return qsqrt (x*x + y*y + z*z);
32 }
33 
35 {
36  float sqlen = x*x + y*y + z*z;
37  if (sqlen < SMALL_EPSILON) return;
38  float invlen = qisqrt (sqlen);
39  *this *= invlen;
40 }
41 
42 
43 //---------------------------------------------------------------------------