Skip to main content
. 2022 Aug 20;22(16):6276. doi: 10.3390/s22166276
Algorithm 2 Parallel Resampling of Proposed Method
  1:  struct vertex
  2:  float x,y,z;
  3:  float tx,tx,tz; /* original position */
  4:  procedure SampleTetrahedron (Mat4 X0¯, vertex A, B, C, D, Tex3D outGrid, Tex3D inVolume)
  5:   aabb boundingBox = outGrid.computeAABB(A, B, C, D);
  6:   foreach (voxel in boundingBox)
  7:    float4 baryCoords = computeBaryCoords (voxel.center, A, B, C, D);  /* b=X1¯1(x11) in Equation (3) */
  8:    if (centerLiesInsideTetrahedron(baryCoords))
  9:     float4 inpos = X0¯ * baryCoords;
10:     float4 newValue = tex3D (inVolume, inpos.xyz);
11:    setValue (voxel, newValue);
12:   end if
13:  end foreach
14: end procedure