Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Diff of /branches/lamont/src/include/Diderot/inline-vec2.h
ViewVC logotype

Diff of /branches/lamont/src/include/Diderot/inline-vec2.h

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

revision 2417, Mon Aug 19 14:15:03 2013 UTC revision 2418, Tue Sep 3 15:10:19 2013 UTC
# Line 60  Line 60 
60      return vec2(s, s) * v;      return vec2(s, s) * v;
61  }  }
62    
 STATIC_INLINE Diderot_real_t dist2 (Diderot_vec2_t u, Diderot_vec2_t v)  
 {  
     Diderot_union2_t uv = __extension__ (Diderot_union2_t)((v-u) * (v-u));  
     return SQRT(uv.r[0] + uv.r[1]);  
 }  
   
63  STATIC_INLINE Diderot_vec2_t clamp2 (Diderot_vec2_t lo, Diderot_vec2_t hi, Diderot_vec2_t v)  STATIC_INLINE Diderot_vec2_t clamp2 (Diderot_vec2_t lo, Diderot_vec2_t hi, Diderot_vec2_t v)
64  {  {
65    // FIXME: there is probably a vectorized way to compute this    // FIXME: there is probably a vectorized way to compute this
# Line 111  Line 105 
105      return uv.r[0] + uv.r[1];      return uv.r[0] + uv.r[1];
106  }  }
107    
108    STATIC_INLINE Diderot_real_t lengthSq2 (Diderot_vec2_t v)
109    {
110        return dot2(v, v);
111    }
112    
113  STATIC_INLINE Diderot_real_t length2 (Diderot_vec2_t v)  STATIC_INLINE Diderot_real_t length2 (Diderot_vec2_t v)
114  {  {
115      return SQRT(dot2(v, v));      return SQRT(lengthSq2(v));
116    }
117    
118    STATIC_INLINE Diderot_real_t dist2 (Diderot_vec2_t u, Diderot_vec2_t v)
119    {
120        return length2(v-u);
121  }  }
122    
123  STATIC_INLINE Diderot_vec2_t normalize2 (Diderot_vec2_t v)  STATIC_INLINE Diderot_vec2_t normalize2 (Diderot_vec2_t v)

Legend:
Removed from v.2417  
changed lines
  Added in v.2418

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0