55 int const width = this->
vol->width();
56 int const height = this->
vol->height();
58 int const base_x = (this->iter / 6) % (width - 1);
59 int const base_y = (this->iter / (6 * (width - 1))) % (height - 1);
60 int const base_z = (this->iter / (6 * (width - 1) * (height - 1)));
61 int const base = base_z * width * height + base_y * width + base_x;
63 float spacing = 1.0f / (float)(width - 1);
65 this->cube_vids[0] = base;
66 this->cube_vids[1] = base + 1;
67 this->cube_vids[2] = base + 1 + width * height;
68 this->cube_vids[3] = base + width * height;
69 this->cube_vids[4] = base + width;
70 this->cube_vids[5] = base + 1 + width;
71 this->cube_vids[6] = base + 1 + width + width * height;
72 this->cube_vids[7] = base + width + width * height;
75 math::Vec3f basepos(base_x * spacing - 0.5f, base_y * spacing - 0.5f, base_z * spacing - 0.5f);
76 this->cube_pos[0] = basepos;
77 this->cube_pos[1] = basepos +
math::Vec3f(spacing, 0, 0);
78 this->cube_pos[2] = basepos +
math::Vec3f(spacing, 0, spacing);
79 this->cube_pos[3] = basepos +
math::Vec3f(0, 0, spacing);
80 this->cube_pos[4] = basepos +
math::Vec3f(0, spacing, 0);
81 this->cube_pos[5] = basepos +
math::Vec3f(spacing, spacing, 0);
82 this->cube_pos[6] = basepos +
math::Vec3f(spacing, spacing, spacing);
83 this->cube_pos[7] = basepos +
math::Vec3f(0, spacing, spacing);
96 std::size_t
const width =
static_cast<std::size_t
>(this->
vol->width());
97 std::size_t
const height =
static_cast<std::size_t
>(this->
vol->height());
98 std::size_t
const depth =
static_cast<std::size_t
>(this->
vol->depth());
101 if (this->iter == (width - 1) * (height - 1) * (depth - 1))
104 int const base_x = iter % (width - 1);
105 int const base_y = (iter / (width - 1)) % (height - 1);
106 int const base_z = iter / ((width - 1) * (height - 1));
107 int const base = base_z * width * height + base_y * width + base_x;
109 float spacing = 1.0f / (float)(width - 1);
112 this->
vid[1] = base + 1;
113 this->
vid[2] = base + 1 + width * height;
114 this->
vid[3] = base + width * height;
115 this->
vid[4] = base + width;
116 this->
vid[5] = base + 1 + width;
117 this->
vid[6] = base + 1 + width + width * height;
118 this->
vid[7] = base + width + width * height;
120 for (
int i = 0; i < 8; ++i)
121 this->
sdf[i] = this->
vol->get_data()[this->
vid[i]];
125 base_y * spacing - 0.5f, base_z * spacing - 0.5f);
126 this->
pos[0] = basepos;