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

SCM Repository

[diderot] Diff of /branches/vis12-cl/src/include/Diderot/cl-inline-image.h
ViewVC logotype

Diff of /branches/vis12-cl/src/include/Diderot/cl-inline-image.h

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

revision 3117, Sun Mar 22 08:30:03 2015 UTC revision 3118, Mon Mar 23 18:05:45 2015 UTC
# Line 23  Line 23 
23    
24  // check if pos is inside the img, assuming that we have a border of width s.  // check if pos is inside the img, assuming that we have a border of width s.
25  //  //
26  inline bool Inside1f (float pos, __global Diderot_image1D_t *img, int s)  inline bool Inside1 (Diderot_real_t pos, __global Diderot_image1D_t *img, int s)
27  {  {
28      return ((s-1 < pos) && (pos < (img->size[0] - s)));      return ((s-1 < pos) && (pos < (img->size[0] - s)));
29  }  }
30    
31  inline float ToImageSpace1f ( __global Diderot_image1D_t *img, float pos)  inline Diderot_real_t ToImageSpace1 ( __global Diderot_image1D_t *img, Diderot_real_t pos)
32  {  {
33      return img->s * pos + img->t;      return img->s * pos + img->t;
34  }  }
# Line 37  Line 37 
37    
38  // check if pos is inside the img, assuming that we have a border of width s.  // check if pos is inside the img, assuming that we have a border of width s.
39  //  //
40  inline bool Inside2f (float2 posArg, __global Diderot_image2D_t *img, int s)  inline bool Inside2 (Diderot_vec2_t posArg, __global Diderot_image2D_t *img, int s)
41  {  {
42      return ((s-1 < posArg.s0) && (posArg.s0 < (img->size[0] - s))      return ((s-1 < posArg.s0) && (posArg.s0 < (img->size[0] - s))
43          &&  (s-1 < posArg.s1) && (posArg.s1 < (img->size[1] - s)));          &&  (s-1 < posArg.s1) && (posArg.s1 < (img->size[1] - s)));
44  }  }
45    
46  inline float2 ToImageSpace2f (__global Diderot_image2D_t *img, float2 p)  inline Diderot_vec2_t ToImageSpace2 (__global Diderot_image2D_t *img, Diderot_vec2_t p)
47  {  {
48      return (float2)(dot(img->w2i[0], p), dot(img->w2i[1], p)) + img->tVec;      return (Diderot_vec2_t)(dot(img->w2i[0], p), dot(img->w2i[1], p)) + img->tVec;
49  }  }
50    
51  inline float2 ToWorldSpace2f (__global Diderot_image2D_t *img, float2 g)  inline Diderot_vec2_t ToWorldSpace2 (__global Diderot_image2D_t *img, Diderot_vec2_t g)
52  {  {
53      return (float2)(      return (Diderot_vec2_t)(
54          dot(img->w2iT[0], g),          dot(img->w2iT[0], g),
55          dot(img->w2iT[1], g));          dot(img->w2iT[1], g));
56  }  }
57    
58  inline void ToWorldSpace2x2f ( Diderot_Mat2x2_t dst, __global Diderot_image2D_t *img,  Diderot_Mat2x2_t src)  inline void ToWorldSpace2x2 ( Diderot_Mat2x2_t dst, __global Diderot_image2D_t *img,  Diderot_Mat2x2_t src)
59  {  {
60      /* Diderot_Mat2x2_t tmp;      /* Diderot_Mat2x2_t tmp;
61      mulMat2x2Mat2x2f (tmp, img->w2iT, src);      mulMat2x2Mat2x2f (tmp, img->w2iT, src);
# Line 63  Line 63 
63    
64      Diderot_Mat2x2_t tmp;      Diderot_Mat2x2_t tmp;
65    
66      tmp[0] = (float2)(      tmp[0] = (Diderot_vec2_t)(
67          dot(img->w2iT[0], (float2)(src[0].s0, src[1].s0)),          dot(img->w2iT[0], (Diderot_vec2_t)(src[0].s0, src[1].s0)),
68          dot(img->w2iT[0], (float2)(src[0].s1, src[1].s1)));          dot(img->w2iT[0], (Diderot_vec2_t)(src[0].s1, src[1].s1)));
69      tmp[1] = (float2)(      tmp[1] = (Diderot_vec2_t)(
70          dot(img->w2iT[1], (float2)(src[0].s0, src[1].s0)),          dot(img->w2iT[1], (Diderot_vec2_t)(src[0].s0, src[1].s0)),
71          dot(img->w2iT[1], (float2)(src[0].s1, src[1].s1)));          dot(img->w2iT[1], (Diderot_vec2_t)(src[0].s1, src[1].s1)));
72    
73      dst[0] = (float2)(      dst[0] = (Diderot_vec2_t)(
74          dot(tmp[0], (float2)(img->w2i[0].s0, img->w2i[1].s0)),          dot(tmp[0], (Diderot_vec2_t)(img->w2i[0].s0, img->w2i[1].s0)),
75          dot(tmp[0], (float2)(img->w2i[0].s1, img->w2i[1].s1)));          dot(tmp[0], (Diderot_vec2_t)(img->w2i[0].s1, img->w2i[1].s1)));
76      dst[1] = (float2)(      dst[1] = (Diderot_vec2_t)(
77          dot(tmp[1], (float2)(img->w2i[0].s0, img->w2i[1].s0)),          dot(tmp[1], (Diderot_vec2_t)(img->w2i[0].s0, img->w2i[1].s0)),
78          dot(tmp[1], (float2)(img->w2i[0].s1, img->w2i[1].s1)));          dot(tmp[1], (Diderot_vec2_t)(img->w2i[0].s1, img->w2i[1].s1)));
79    
80  }  }
81    
# Line 83  Line 83 
83    
84  // check if pos is inside the img, assuming that we have a border of width s.  // check if pos is inside the img, assuming that we have a border of width s.
85  //  //
86  inline bool Inside3f (float3 posArg, __global Diderot_image3D_t *img, int s)  inline bool Inside3f (Diderot_vec3_t posArg, __global Diderot_image3D_t *img, int s)
87  {  {
88      return ((s-1 < posArg.s0) && (posArg.s0 < (img->size[0] - s))      return ((s-1 < posArg.s0) && (posArg.s0 < (img->size[0] - s))
89          &&  (s-1 < posArg.s1) && (posArg.s1 < (img->size[1] - s))          &&  (s-1 < posArg.s1) && (posArg.s1 < (img->size[1] - s))
90          &&  (s-1 < posArg.s2) && (posArg.s2 < (img->size[2] - s)));          &&  (s-1 < posArg.s2) && (posArg.s2 < (img->size[2] - s)));
91  }  }
92    
93  inline float3 ToImageSpace3f (__global Diderot_image3D_t *img, float3 p)  inline Diderot_vec3_t ToImageSpace3f (__global Diderot_image3D_t *img, Diderot_vec3_t p)
94  {  {
95      return VEC3(dot(img->w2i[0], p), dot(img->w2i[1], p), dot(img->w2i[2], p)) + img->tVec;      return VEC3(dot(img->w2i[0], p), dot(img->w2i[1], p), dot(img->w2i[2], p)) + img->tVec;
96  }  }
97    
98  inline float3 ToWorldSpace3f (__global Diderot_image3D_t *img, float3 g)  inline Diderot_vec3_t ToWorldSpace3f (__global Diderot_image3D_t *img, Diderot_vec3_t g)
99  {  {
100      return VEC3(      return VEC3(
101          dot(img->w2iT[0], g),          dot(img->w2iT[0], g),

Legend:
Removed from v.3117  
changed lines
  Added in v.3118

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