/[hegemonie]/hegemonie/Headers/Common/Coord.h
ViewVC logotype

Diff of /hegemonie/Headers/Common/Coord.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by dam, Thu May 22 14:09:05 2003 UTC revision 1.2 by dam, Fri May 23 00:11:16 2003 UTC
# Line 24  Line 24 
24  #ifndef COORD_H  #ifndef COORD_H
25  #define COORD_H  #define COORD_H
26    
27  #define SWAP(_a,_b) \  #include "Common/Math.h"
        ({typeof(_a) _SWAP_aux = (_a); \  
          (_a) = (_b); (_b) = _SWAP_aux; })  
28    
29  /* 3D position */  /* 3D position */
30  typedef struct {  typedef struct {
# Line 74  SubCoord (coord_t coord1, coord_t coord2 Line 72  SubCoord (coord_t coord1, coord_t coord2
72  static inline coord_t  static inline coord_t
73  InterpolateCoord (coord_t coord1, coord_t coord2, double t)  InterpolateCoord (coord_t coord1, coord_t coord2, double t)
74  {  {
   NSCParameterAssert (t >= 0.0);  
   NSCParameterAssert (t <= 1.0);  
   
75    return AddCoord (coord1,    return AddCoord (coord1,
76                     MultCoord (SubCoord (coord2, coord1),                     MultCoord (SubCoord (coord2, coord1),
77                                t));                                t));
# Line 85  InterpolateCoord (coord_t coord1, coord_ Line 80  InterpolateCoord (coord_t coord1, coord_
80  static inline coord_t  static inline coord_t
81  NormalizeVector (coord_t vector)  NormalizeVector (coord_t vector)
82  {  {
83    double norm = sqrt(vector.x * vector.x    double norm = sqrt(SQUARE(vector.x)
84                       + vector.y * vector.y                       + SQUARE(vector.y)
85                       + vector.z * vector.z);                       + SQUARE(vector.z));
86    
87    NSCParemeterAssert (norm != 0);    NSCParameterAssert (norm != 0);
88    
89    vector.x /= norm;    vector.x /= norm;
90    vector.y /= norm;    vector.y /= norm;

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26