HOG2
VoxelTriangleExtraction.cpp
Go to the documentation of this file.
1 //
2 // VoxelTriangleExtraction.cpp
3 // hog2 glut
4 //
5 // Created by Nathan Sturtevant on 6/19/17.
6 // Copyright © 2017 University of Denver. All rights reserved.
7 //
8 
9 #include "SharedQueue.h"
11 #include <thread>
12 
13 namespace VoxelUtils {
14  struct Point3D {
15  int x, y, z;
16  };
17  enum plane {
24  };
25 
26  struct work {
29  };
30 
31  bool operator==(const triangle &a, const triangle &b)
32  {
33  return (a.normal[0] == b.normal[0] &&
34  a.normal[1] == b.normal[1] &&
35  a.normal[2] == b.normal[2] &&
36  a.v1[0] == b.v1[0] &&
37  a.v1[1] == b.v1[1] &&
38  a.v1[2] == b.v1[2] &&
39  a.v2[0] == b.v2[0] &&
40  a.v2[1] == b.v2[1] &&
41  a.v2[2] == b.v2[2] &&
42  a.v3[0] == b.v3[0] &&
43  a.v3[1] == b.v3[1] &&
44  a.v3[2] == b.v3[2]);
45  }
46  bool operator==(const vn &a, const vn &b)
47  {
48  return (a.normal[0] == b.normal[0] &&
49  a.normal[1] == b.normal[1] &&
50  a.normal[2] == b.normal[2] &&
51  a.v[0] == b.v[0] &&
52  a.v[1] == b.v[1] &&
53  a.v[2] == b.v[2]);
54  }
55 
56 
57  void ThreadedWorker(VoxelGrid *s, std::vector<triangle> &data,
58  SharedQueue<work> &queue, std::mutex &lock);
59 
60  void PXHelper(VoxelGrid *s, int x, int y, int ymax, int z, int zmax, std::vector<triangle> &data);
61  void AddPXFace(VoxelGrid *s, int x, std::vector<triangle> &data);
62  void NXHelper(VoxelGrid *s, int x, int y, int ymax, int z, int zmax, std::vector<triangle> &data);
63  void AddNXFace(VoxelGrid *s, int x, std::vector<triangle> &data);
64  void PYHelper(VoxelGrid *s, int x, int xmax, int y, int z, int zmax, std::vector<triangle> &data);
65  void AddPYFace(VoxelGrid *s, int y, std::vector<triangle> &data);
66  void NYHelper(VoxelGrid *s, int x, int xmax, int y, int z, int zmax, std::vector<triangle> &data);
67  void AddNYFace(VoxelGrid *s, int y, std::vector<triangle> &data);
68  void PZHelper(VoxelGrid *s, int x, int xmax, int y, int ymax, int z, std::vector<triangle> &data);
69  void AddPZFace(VoxelGrid *s, int z, std::vector<triangle> &data);
70  void NZHelper(VoxelGrid *s, int x, int xmax, int y, int ymax, int z, std::vector<triangle> &data);
71  void AddNZFace(VoxelGrid *s, int z, std::vector<triangle> &data);
72 
73  void GetTriangles(VoxelGrid *s, std::vector<triangle> &data)
74  {
75  std::mutex lock;
76  SharedQueue<work> queue;
77  std::vector<std::thread> threads;
78  int numThreads = std::thread::hardware_concurrency();
79 
80  for (int x = 0; x < numThreads; x++)
81  {
82  threads.push_back(std::thread(ThreadedWorker, s, std::ref(data), std::ref(queue), std::ref(lock)));
83  }
84 
85  int x, y, z;
86  s->GetLimits(x, y, z);
87  for (int a = 0; a < x; a++)
88  {
89  queue.WaitAdd({xPositive, a});
90  queue.WaitAdd({xNegative, a});
91  }
92  for (int b = 0; b < y; b++)
93  {
94  queue.WaitAdd({yPositive, b});
95  queue.WaitAdd({yNegative, b});
96  }
97  for (int c = 0; c < z; c++)
98  {
99  queue.WaitAdd({zPositive, c});
100  queue.WaitAdd({zNegative, c});
101  }
102 
103  for (int x = 0; x < numThreads; x++)
104  queue.WaitAdd({xPositive, -1});
105  for (int x = 0; x < numThreads; x++)
106  {
107  threads[x].join();
108  }
109  }
110 
112  {
113  triangle t1;
114  t1.normal[0] = normal.x;
115  t1.normal[1] = normal.y;
116  t1.normal[2] = normal.z;
117  t1.v1[0] = v1.x;
118  t1.v1[1] = v1.y;
119  t1.v1[2] = v1.z;
120  t1.v2[0] = v2.x;
121  t1.v2[1] = v2.y;
122  t1.v2[2] = v2.z;
123  t1.v3[0] = v3.x;
124  t1.v3[1] = v3.y;
125  t1.v3[2] = v3.z;
126  return t1;
127  }
128 
129  void ThreadedWorker(VoxelGrid *s, std::vector<triangle> &data,
130  SharedQueue<work> &queue, std::mutex &lock)
131  {
132  work w;
133  std::vector<triangle> localData;
134  while (true)
135  {
136  queue.WaitRemove(w);
137  if (w.coordinate == -1)
138  break;
139 
140  switch (w.p)
141  {
142  case xPositive: AddPXFace(s, w.coordinate, localData); break;
143  case xNegative: AddNXFace(s, w.coordinate, localData); break;
144  case yPositive: AddPYFace(s, w.coordinate, localData); break;
145  case yNegative: AddNYFace(s, w.coordinate, localData); break;
146  case zPositive: AddPZFace(s, w.coordinate, localData); break;
147  case zNegative: AddNZFace(s, w.coordinate, localData); break;
148  default: break; //printf("Failure: unknown case\n"); break;
149  }
150  }
151  if (localData.size() > 0)
152  {
153  lock.lock();
154  data.insert(data.end(), localData.begin(), localData.end());
155  lock.unlock();
156  }
157  }
158 
159  int XMaxSquare(VoxelGrid *s, int x, int y, int ymax, int z, int zmax, int xOffset)
160  {
161  if (y >= ymax || z >= zmax)
162  return 0;
163  bool valid = false;
164  if (s->IsBlocked(x, y, z) && !s->IsBlocked(x+xOffset, y, z))
165  valid = true;
166  int count = 1;
167  while (true)
168  {
169  if (y+count >= ymax || z+count >= zmax)
170  break;
171  int tmp = 0;
172  for (int t = 0; t <= count; t++)
173  tmp += (s->IsBlocked(x, y+t, z+count) && !s->IsBlocked(x+xOffset, y+t, z+count))?1:0;
174  for (int t = 0; t <= count; t++)
175  tmp += (s->IsBlocked(x, y+count, z+t) && !s->IsBlocked(x+xOffset, y+count, z+t))?1:0;
176  if ((valid && tmp == (count+1)*2) || (!valid && tmp == 0))
177  {
178  count++;
179  continue;
180  }
181  break;
182  }
183  if (!valid)
184  return -count;
185  return count;
186  }
187 
188  std::pair<int, int> XMaxRect(VoxelGrid *s, int x, int y, int ymax, int z, int zmax, int xOffset)
189  {
190  int minLen = XMaxSquare(s, x, y, ymax, z, zmax, xOffset);
191  if (minLen <= 0)
192  return {minLen, minLen};
193  // Try extending one or more directions of the square.
194  // printf("Got face size %d. Extending\n", minLen);
195  int yCount = 1;
196  while (true)
197  {
198  if (y+minLen+yCount >= ymax)
199  {
200  yCount--;
201  break;
202  }
203  int tmp = 0;
204  for (int t = 0; t < minLen; t++)
205  tmp += (s->IsBlocked(x, y+minLen+yCount, z+t) && !s->IsBlocked(x+xOffset, y+minLen+yCount, z+t))?1:0;
206  if (tmp == minLen)
207  {
208  yCount++;
209  continue;
210  }
211  yCount--;
212  break;
213  }
214  // printf("Y-extension: %d\n", yCount);
215  int zCount = 1;
216  while (true)
217  {
218  if (z+minLen+zCount >= zmax)
219  {
220  zCount--;
221  break;
222  }
223  int tmp = 0;
224  for (int t = 0; t < minLen; t++)
225  tmp += (s->IsBlocked(x, y+t, z+minLen+zCount) && !s->IsBlocked(x+xOffset, y+t, z+minLen+zCount))?1:0;
226  if (tmp == minLen)
227  {
228  zCount++;
229  continue;
230  }
231  zCount--;
232  break;
233  }
234  // printf("Z-extension: %d\n", zCount);
235  // if (zCount > 0 || yCount > 0)
236  // printf("Made bigger by %d\n", std::max(yCount, zCount));
237  if (zCount > yCount)
238  return {minLen, minLen+zCount};
239  return {minLen+yCount, minLen};
240  }
241 
242 
243  void PXHelper(VoxelGrid *s, int x, int y, int ymax, int z, int zmax, std::vector<triangle> &data)
244  {
245  //int count = XMaxSquare(s, x, y, ymax, z, zmax, 1);
246  auto v = XMaxRect(s, x, y, ymax, z, zmax, 1);
247  int ySize = v.first;
248  int zSize = v.second;
249  if (ySize > 0) // fill at size s
250  {
251  data.push_back(MakeTriangle({1, 0, 0}, {x+1, y, z}, {x+1, y+ySize, z}, {x+1, y+ySize, z+zSize}));
252  data.push_back(MakeTriangle({1, 0, 0}, {x+1, y, z}, {x+1, y+ySize, z+zSize}, {x+1, y, z+zSize}));
253  }
254  else if (ySize < 0) { // nothing to export in size s
255  ySize = -ySize;
256  zSize = -zSize;
257  }
258  else if (ySize == 0){
259  // ran out of space
260  return;
261  }
262  PXHelper(s, x, y+ySize, ymax, z, z+zSize, data);
263  PXHelper(s, x, y, y+ySize, z+zSize, zmax, data);
264  PXHelper(s, x, y+ySize, ymax, z+zSize, zmax, data);
265  }
266 
267  void AddPXFace(VoxelGrid *s, int x, std::vector<triangle> &data)
268  {
269  int t, y, z;
270  s->GetLimits(t, y, z);
271  PXHelper(s, x, 0, y, 0, z, data);
272  }
273 
274 
275  void NXHelper(VoxelGrid *s, int x, int y, int ymax, int z, int zmax, std::vector<triangle> &data)
276  {
277  //int count = XMaxSquare(s, x, y, ymax, z, zmax, -1);
278  auto v = XMaxRect(s, x, y, ymax, z, zmax, -1);
279  int ySize = v.first;
280  int zSize = v.second;
281  if (ySize > 0) // fill at size s
282  {
283  data.push_back(MakeTriangle({-1, 0, 0}, {x, y, z}, {x, y+ySize, z+zSize}, {x, y+ySize, z}));
284  data.push_back(MakeTriangle({-1, 0, 0}, {x, y, z}, {x, y, z+zSize}, {x, y+ySize, z+zSize}));
285  }
286  else if (ySize < 0) { // nothing to export in size s
287  ySize = -ySize;
288  zSize = -zSize;
289  }
290  else if (ySize == 0){
291  // ran out of space
292  return;
293  }
294  NXHelper(s, x, y+ySize, ymax, z, z+zSize, data);
295  NXHelper(s, x, y, y+ySize, z+zSize, zmax, data);
296  NXHelper(s, x, y+ySize, ymax, z+zSize, zmax, data);
297  }
298 
299  void AddNXFace(VoxelGrid *s, int x, std::vector<triangle> &data)
300  {
301  int t, y, z;
302  s->GetLimits(t, y, z);
303  NXHelper(s, x, 0, y, 0, z, data);
304  }
305 
306  int YMaxSquare(VoxelGrid *s, int x, int xmax, int y, int z, int zmax, int yOffset)
307  {
308  if (x >= xmax || z >= zmax)
309  return 0;
310  bool valid = false;
311  if (s->IsBlocked(x, y, z) && !s->IsBlocked(x, y+yOffset, z))
312  valid = true;
313  int count = 1;
314  while (true)
315  {
316  if (x+count >= xmax || z+count >= zmax)
317  break;
318  int tmp = 0;
319  for (int t = 0; t <= count; t++)
320  tmp += (s->IsBlocked(x+t, y, z+count) && !s->IsBlocked(x+t, y+yOffset, z+count))?1:0;
321  for (int t = 0; t <= count; t++)
322  tmp += (s->IsBlocked(x+count, y, z+t) && !s->IsBlocked(x+count, y+yOffset, z+t))?1:0;
323  if ((valid && tmp == (count+1)*2) || (!valid && tmp == 0))
324  {
325  count++;
326  continue;
327  }
328  break;
329  }
330  if (!valid)
331  return -count;
332  return count;
333  }
334 
335  std::pair<int, int> YMaxRect(VoxelGrid *s, int x, int xmax, int y, int z, int zmax, int yOffset)
336  {
337  int minLen = YMaxSquare(s, x, xmax, y, z, zmax, yOffset);
338  if (minLen <= 0)
339  return {minLen, minLen};
340  // Try extending one or more directions of the square.
341  // printf("Got face size %d. Extending\n", minLen);
342  int xCount = 1;
343  while (true)
344  {
345  if (x+minLen+xCount >= xmax)
346  {
347  xCount--;
348  break;
349  }
350  int tmp = 0;
351  for (int t = 0; t < minLen; t++)
352  tmp += (s->IsBlocked(x+minLen+xCount, y, z+t) && !s->IsBlocked(x+minLen+xCount, y+yOffset, z+t))?1:0;
353  if (tmp == minLen)
354  {
355  xCount++;
356  continue;
357  }
358  xCount--;
359  break;
360  }
361  // printf("X-extension: %d\n", xCount);
362  int zCount = 1;
363  while (true)
364  {
365  if (z+minLen+zCount >= zmax)
366  {
367  zCount--;
368  break;
369  }
370  int tmp = 0;
371  for (int t = 0; t < minLen; t++)
372  tmp += (s->IsBlocked(x+t, y, z+minLen+zCount) && !s->IsBlocked(x+t, y+yOffset, z+minLen+zCount))?1:0;
373  if (tmp == minLen)
374  {
375  zCount++;
376  continue;
377  }
378  zCount--;
379  break;
380  }
381  // printf("Z-extension: %d\n", zCount);
382  // if (zCount > 0 || xCount > 0)
383  // printf("Made bigger by %d\n", std::max(xCount, zCount));
384  if (zCount > xCount)
385  return {minLen, minLen+zCount};
386  return {minLen+xCount, minLen};
387  }
388 
389  void PYHelper(VoxelGrid *s, int x, int xmax, int y, int z, int zmax, std::vector<triangle> &data)
390  {
391  auto v = YMaxRect(s, x, xmax, y, z, zmax, 1);
392  int xSize = v.first;
393  int zSize = v.second;
394 
395  if (xSize > 0) // fill at size s
396  {
397  data.push_back(MakeTriangle({0, 1, 0}, {x, y+1, z}, {x+xSize, y+1, z+zSize}, {x+xSize, y+1, z}));
398  data.push_back(MakeTriangle({0, 1, 0}, {x, y+1, z}, {x, y+1, z+zSize}, {x+xSize, y+1, z+zSize}));
399  }
400  else if (xSize < 0) { // nothing to export in size s
401  xSize = -xSize;
402  zSize = -zSize;
403  }
404  else if (xSize == 0){
405  // ran out of space
406  return;
407  }
408  PYHelper(s, x+xSize, xmax, y, z, z+zSize, data);
409  PYHelper(s, x, x+xSize, y, z+zSize, zmax, data);
410  PYHelper(s, x+xSize, xmax, y, z+zSize, zmax, data);
411  }
412 
413  void AddPYFace(VoxelGrid *s, int y, std::vector<triangle> &data)
414  {
415  int x, t, z;
416  s->GetLimits(x, t, z);
417  PYHelper(s, 0, x, y, 0, z, data);
418  }
419 
420  void NYHelper(VoxelGrid *s, int x, int xmax, int y, int z, int zmax, std::vector<triangle> &data)
421  {
422  auto v = YMaxRect(s, x, xmax, y, z, zmax, -1);
423  int xSize = v.first;
424  int zSize = v.second;
425 
426  if (xSize > 0) // fill at size s
427  {
428  data.push_back(MakeTriangle({0, -1, 0}, {x, y, z}, {x+xSize, y, z}, {x+xSize, y, z+zSize}));
429  data.push_back(MakeTriangle({0, -1, 0}, {x, y, z}, {x+xSize, y, z+zSize}, {x, y, z+zSize}));
430  }
431  else if (xSize < 0) { // nothing to export in size s
432  xSize = -xSize;
433  zSize = -zSize;
434  }
435  else if (xSize == 0){
436  // ran out of space
437  return;
438  }
439  NYHelper(s, x+xSize, xmax, y, z, z+zSize, data);
440  NYHelper(s, x, x+xSize, y, z+zSize, zmax, data);
441  NYHelper(s, x+xSize, xmax, y, z+zSize, zmax, data);
442  }
443 
444  void AddNYFace(VoxelGrid *s, int y, std::vector<triangle> &data)
445  {
446  int x, t, z;
447  s->GetLimits(x, t, z);
448  NYHelper(s, 0, x, y, 0, z, data);
449  }
450 
451  int ZMaxSquare(VoxelGrid *s, int x, int xmax, int y, int ymax, int z, int zOffset)
452  {
453  if (x >= xmax || y >= ymax)
454  return 0;
455  bool valid = false;
456  if (s->IsBlocked(x, y, z) && !s->IsBlocked(x, y, z+zOffset))
457  valid = true;
458  int count = 1;
459  while (true)
460  {
461  if (x+count >= xmax || y+count >= ymax)
462  break;
463  int tmp = 0;
464  for (int t = 0; t <= count; t++)
465  tmp += (s->IsBlocked(x+t, y+count, z) && !s->IsBlocked(x+t, y+count, z+zOffset))?1:0;
466  for (int t = 0; t <= count; t++)
467  tmp += (s->IsBlocked(x+count, y+t, z) && !s->IsBlocked(x+count, y+t, z+zOffset))?1:0;
468  if ((valid && tmp == (count+1)*2) || (!valid && tmp == 0))
469  {
470  count++;
471  continue;
472  }
473  break;
474  }
475  if (!valid)
476  return -count;
477  return count;
478  }
479 
480  std::pair<int, int> ZMaxRect(VoxelGrid *s, int x, int xmax, int y, int ymax, int z, int zOffset)
481  {
482  int minLen = ZMaxSquare(s, x, xmax, y, ymax, z, zOffset);
483  if (minLen <= 0)
484  return {minLen, minLen};
485  // Try extending one or more directions of the square.
486  // printf("Got face size %d. Extending\n", minLen);
487  int xCount = 1;
488  while (true)
489  {
490  if (x+minLen+xCount >= xmax)
491  {
492  xCount--;
493  break;
494  }
495  int tmp = 0;
496  for (int t = 0; t < minLen; t++)
497  tmp += (s->IsBlocked(x+minLen+xCount, y+t, z) && !s->IsBlocked(x+minLen+xCount, y+t, z+zOffset))?1:0;
498  if (tmp == minLen)
499  {
500  xCount++;
501  continue;
502  }
503  xCount--;
504  break;
505  }
506  // printf("X-extension: %d\n", xCount);
507  int yCount = 1;
508  while (true)
509  {
510  if (y+minLen+yCount >= ymax)
511  {
512  yCount--;
513  break;
514  }
515  int tmp = 0;
516  for (int t = 0; t < minLen; t++)
517  tmp += (s->IsBlocked(x+t, y+minLen+yCount, z) && !s->IsBlocked(x+t, y+minLen+yCount, z+zOffset))?1:0;
518  if (tmp == minLen)
519  {
520  yCount++;
521  continue;
522  }
523  yCount--;
524  break;
525  }
526  // printf("Y-extension: %d\n", yCount);
527  // if (yCount > 0 || xCount > 0)
528  // printf("Made bigger by %d\n", std::max(xCount, yCount));
529  if (yCount > xCount)
530  return {minLen, minLen+yCount};
531  return {minLen+xCount, minLen};
532  }
533 
534  void PZHelper(VoxelGrid *s, int x, int xmax, int y, int ymax, int z, std::vector<triangle> &data)
535  {
536  auto v = ZMaxRect(s, x, xmax, y, ymax, z, 1);
537  int xSize = v.first;
538  int ySize = v.second;
539 
540  if (xSize > 0) // fill at size s
541  {
542  data.push_back(MakeTriangle({0, 0, 1}, {x, y, z+1}, {x+xSize, y, z+1}, {x+xSize, y+ySize, z+1}));
543  data.push_back(MakeTriangle({0, 0, 1}, {x, y, z+1}, {x+xSize, y+ySize, z+1}, {x, y+ySize, z+1}));
544  }
545  else if (xSize < 0) { // nothing to export in size s
546  xSize = -xSize;
547  ySize = -ySize;
548  }
549  else if (xSize == 0){
550  // ran out of space
551  return;
552  }
553  PZHelper(s, x+xSize, xmax, y, y+ySize, z, data);
554  PZHelper(s, x, x+xSize, y+ySize, ymax, z, data);
555  PZHelper(s, x+xSize, xmax, y+ySize, ymax, z, data);
556  }
557 
558  void AddPZFace(VoxelGrid *s, int z, std::vector<triangle> &data)
559  {
560  int x, y, t;
561  s->GetLimits(x, y, t);
562  PZHelper(s, 0, x, 0, y, z, data);
563  }
564 
565  void NZHelper(VoxelGrid *s, int x, int xmax, int y, int ymax, int z, std::vector<triangle> &data)
566  {
567  auto v = ZMaxRect(s, x, xmax, y, ymax, z, -1);
568 
569  int xSize = v.first;
570  int ySize = v.second;
571 
572  if (xSize > 0) // fill at size s
573  {
574  data.push_back(MakeTriangle({0, 0, -1}, {x, y, z}, {x+xSize, y+ySize, z}, {x+xSize, y, z}));
575  data.push_back(MakeTriangle({0, 0, -1}, {x, y, z}, {x, y+ySize, z}, {x+xSize, y+ySize, z}));
576  }
577  else if (xSize < 0) { // nothing to export in size s
578  xSize = -xSize;
579  ySize = -ySize;
580  }
581  else if (xSize == 0){
582  // ran out of space
583  return;
584  }
585  NZHelper(s, x+xSize, xmax, y, y+ySize, z, data);
586  NZHelper(s, x, x+xSize, y+ySize, ymax, z, data);
587  NZHelper(s, x+xSize, xmax, y+ySize, ymax, z, data);
588  }
589 
590  void AddNZFace(VoxelGrid *s, int z, std::vector<triangle> &data)
591  {
592  int x, y, t;
593  s->GetLimits(x, y, t);
594  NZHelper(s, 0, x, 0, y, z, data);
595  }
596 
597 
598 }
VoxelUtils::zNegative
@ zNegative
Definition: VoxelTriangleExtraction.cpp:23
VoxelUtils::work
Definition: VoxelTriangleExtraction.cpp:26
VoxelUtils::triangle::v2
uint16_t v2[3]
Definition: VoxelTriangleExtraction.h:26
VoxelUtils::triangle
Definition: VoxelTriangleExtraction.h:23
VoxelUtils::yPositive
@ yPositive
Definition: VoxelTriangleExtraction.cpp:20
VoxelUtils::ThreadedWorker
void ThreadedWorker(VoxelGrid *s, std::vector< triangle > &data, SharedQueue< work > &queue, std::mutex &lock)
Definition: VoxelTriangleExtraction.cpp:129
VoxelUtils::MakeTriangle
triangle MakeTriangle(Point3D normal, Point3D v1, Point3D v2, Point3D v3)
Definition: VoxelTriangleExtraction.cpp:111
VoxelUtils::vn::v
uint16_t v[3]
Definition: VoxelTriangleExtraction.h:20
SharedQueue::WaitRemove
void WaitRemove(T &item)
Definition: SharedQueue.h:115
SharedQueue::WaitAdd
void WaitAdd(const T &value)
Definition: SharedQueue.h:103
VoxelUtils::AddNXFace
void AddNXFace(VoxelGrid *s, int x, std::vector< triangle > &data)
Definition: VoxelTriangleExtraction.cpp:299
VoxelUtils::work::p
plane p
Definition: VoxelTriangleExtraction.cpp:27
VoxelUtils::AddNZFace
void AddNZFace(VoxelGrid *s, int z, std::vector< triangle > &data)
Definition: VoxelTriangleExtraction.cpp:590
VoxelUtils
Definition: VoxelTriangleExtraction.cpp:13
VoxelUtils::work::coordinate
int coordinate
Definition: VoxelTriangleExtraction.cpp:28
VoxelUtils::YMaxSquare
int YMaxSquare(VoxelGrid *s, int x, int xmax, int y, int z, int zmax, int yOffset)
Definition: VoxelTriangleExtraction.cpp:306
VoxelUtils::Point3D::y
int y
Definition: VoxelTriangleExtraction.cpp:15
VoxelUtils::vn::normal
uint16_t normal[3]
Definition: VoxelTriangleExtraction.h:19
VoxelUtils::yNegative
@ yNegative
Definition: VoxelTriangleExtraction.cpp:21
VoxelUtils::YMaxRect
std::pair< int, int > YMaxRect(VoxelGrid *s, int x, int xmax, int y, int z, int zmax, int yOffset)
Definition: VoxelTriangleExtraction.cpp:335
VoxelUtils::PZHelper
void PZHelper(VoxelGrid *s, int x, int xmax, int y, int ymax, int z, std::vector< triangle > &data)
Definition: VoxelTriangleExtraction.cpp:534
VoxelUtils::NZHelper
void NZHelper(VoxelGrid *s, int x, int xmax, int y, int ymax, int z, std::vector< triangle > &data)
Definition: VoxelTriangleExtraction.cpp:565
VoxelUtils::AddPYFace
void AddPYFace(VoxelGrid *s, int y, std::vector< triangle > &data)
Definition: VoxelTriangleExtraction.cpp:413
VoxelUtils::triangle::v3
uint16_t v3[3]
Definition: VoxelTriangleExtraction.h:27
VoxelGrid
Definition: VoxelGrid.h:41
VoxelUtils::AddPXFace
void AddPXFace(VoxelGrid *s, int x, std::vector< triangle > &data)
Definition: VoxelTriangleExtraction.cpp:267
VoxelUtils::NYHelper
void NYHelper(VoxelGrid *s, int x, int xmax, int y, int z, int zmax, std::vector< triangle > &data)
Definition: VoxelTriangleExtraction.cpp:420
VoxelUtils::plane
plane
Definition: VoxelTriangleExtraction.cpp:17
VoxelUtils::triangle::v1
uint16_t v1[3]
Definition: VoxelTriangleExtraction.h:25
VoxelUtils::ZMaxRect
std::pair< int, int > ZMaxRect(VoxelGrid *s, int x, int xmax, int y, int ymax, int z, int zOffset)
Definition: VoxelTriangleExtraction.cpp:480
VoxelUtils::vn
Definition: VoxelTriangleExtraction.h:18
VoxelUtils::PXHelper
void PXHelper(VoxelGrid *s, int x, int y, int ymax, int z, int zmax, std::vector< triangle > &data)
Definition: VoxelTriangleExtraction.cpp:243
VoxelUtils::xPositive
@ xPositive
Definition: VoxelTriangleExtraction.cpp:18
VoxelUtils::zPositive
@ zPositive
Definition: VoxelTriangleExtraction.cpp:22
VoxelUtils::Point3D::x
int x
Definition: VoxelTriangleExtraction.cpp:15
VoxelUtils::AddPZFace
void AddPZFace(VoxelGrid *s, int z, std::vector< triangle > &data)
Definition: VoxelTriangleExtraction.cpp:558
VoxelUtils::XMaxRect
std::pair< int, int > XMaxRect(VoxelGrid *s, int x, int y, int ymax, int z, int zmax, int xOffset)
Definition: VoxelTriangleExtraction.cpp:188
VoxelGrid::GetLimits
void GetLimits(int &x, int &y, int &z) const
Definition: VoxelGrid.h:73
VoxelGrid::IsBlocked
bool IsBlocked(const voxelGridState &s) const
Definition: VoxelGrid.cpp:169
VoxelUtils::Point3D
Definition: VoxelTriangleExtraction.cpp:14
VoxelUtils::triangle::normal
uint16_t normal[3]
Definition: VoxelTriangleExtraction.h:24
VoxelUtils::PYHelper
void PYHelper(VoxelGrid *s, int x, int xmax, int y, int z, int zmax, std::vector< triangle > &data)
Definition: VoxelTriangleExtraction.cpp:389
VoxelTriangleExtraction.h
SharedQueue.h
VoxelUtils::AddNYFace
void AddNYFace(VoxelGrid *s, int y, std::vector< triangle > &data)
Definition: VoxelTriangleExtraction.cpp:444
VoxelUtils::GetTriangles
void GetTriangles(VoxelGrid *s, std::vector< triangle > &data)
Definition: VoxelTriangleExtraction.cpp:73
VoxelUtils::operator==
bool operator==(const triangle &a, const triangle &b)
Definition: VoxelTriangleExtraction.cpp:31
VoxelUtils::ZMaxSquare
int ZMaxSquare(VoxelGrid *s, int x, int xmax, int y, int ymax, int z, int zOffset)
Definition: VoxelTriangleExtraction.cpp:451
VoxelUtils::xNegative
@ xNegative
Definition: VoxelTriangleExtraction.cpp:19
VoxelUtils::NXHelper
void NXHelper(VoxelGrid *s, int x, int y, int ymax, int z, int zmax, std::vector< triangle > &data)
Definition: VoxelTriangleExtraction.cpp:275
SharedQueue
Definition: SharedQueue.h:24
VoxelUtils::XMaxSquare
int XMaxSquare(VoxelGrid *s, int x, int y, int ymax, int z, int zmax, int xOffset)
Definition: VoxelTriangleExtraction.cpp:159
VoxelUtils::Point3D::z
int z
Definition: VoxelTriangleExtraction.cpp:15