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

SCM Repository

[diderot] Diff of /trunk/test/MIP/mip_c.c
ViewVC logotype

Diff of /trunk/test/MIP/mip_c.c

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

revision 446, Thu Oct 21 04:18:15 2010 UTC revision 447, Thu Oct 21 04:24:00 2010 UTC
# Line 91  Line 91 
91      self->maxval = M_INF;      self->maxval = M_INF;
92  }  }
93    
94  void RayCast_update (GlobalState_t *glob, RayCast_t *self)  // thie C code for the actor's update method.  This is a general version that takes
95    // two self pointers; selfIn is the state at the beginning of the iteration and
96    // selfOut is the new state at the end of the step.  For this example, we could get
97    // away with just one self pointer, since there are no actor-actor interactions.
98    //
99    void RayCast_update (GlobalState_t *glob, RayCast_t *selfIn, RayCast_t *selfOut)
100  {  {
101  //    pos = pos + stepSz*dir;  //    pos = pos + stepSz*dir;
102  //    if (inside (pos,F)) {  //    if (inside (pos,F)) {
# Line 102  Line 107 
107  //      stabilize;  //      stabilize;
108  //    t = t + stepSz;  //    t = t + stepSz;
109    
110      Diderot_vec3_t dir = self->dir;      Diderot_vec3_t dir = selfIn->dir;
111      Diderot_vec3_t pos = self->pos;      Diderot_vec3_t pos = selfIn->pos;
112      pos = Diderot_AddV3(pos, Diderot_ScaleV3(glob->stepSz, dir));      pos = Diderot_AddV3(pos, Diderot_ScaleV3(glob->stepSz, dir));
113    
114      Diderot_Vec3_t imgPos = Diderot_TransformVec3 (pos, img->mInv);      Diderot_Vec3_t imgPos = Diderot_TransformVec3 (pos, img->mInv);
115      if (Diderot_Inside3D(imgPos, img)) {      if (Diderot_Inside3D(imgPos, img)) {
116          /* ?? probe ?? */          /* ?? probe ?? */
117          Diderot_real_t maxval = self->maxval;          Diderot_real_t maxval = selfIn->maxval;
118          maxval = Diderot_Max(val, maxval);          maxval = Diderot_Max(val, maxval);
119          self->maxval = maxval;          selfOut->maxval = maxval;
120        }
121        else {
122            selfOut->maxval = selfIn->maxval;
123      }      }
124    
125      Diderot_real_t t = self->t;      Diderot_real_t t = selfIn->t;
126      if (t > 20.0f) {      if (t > 20.0f) {
127          self->pos = pos;          selfOut->pos = pos;
128          // self->t = t; /* not needed, since t has not changed */          self->t = t;
129          RayCast_stabilize (glob, self);          RayCast_stabilize (glob, self);
130          return;          return;
131      }      }
132    
133      t = t + glob->stepSz;      t = t + glob->stepSz;
134    
135      self->pos = pos;      selfOut->pos = pos;
136      self->t = t;      selfOut->t = t;
137    
138  }  }
139    

Legend:
Removed from v.446  
changed lines
  Added in v.447

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