Home Reference Source

src/isosurface/dual-contouring/tables.js

  1. /**
  2. * An edge mask.
  3. *
  4. * @type {Uint8Array}
  5. */
  6.  
  7. export const edgeMask = new Uint8Array([5, 3, 6]);
  8.  
  9. /**
  10. * A face map.
  11. *
  12. * @type {Uint8Array[]}
  13. */
  14.  
  15. export const faceMap = [
  16.  
  17. new Uint8Array([4, 8, 5, 9]),
  18. new Uint8Array([6, 10, 7, 11]),
  19. new Uint8Array([0, 8, 1, 10]),
  20. new Uint8Array([2, 9, 3, 11]),
  21. new Uint8Array([0, 4, 2, 6]),
  22. new Uint8Array([1, 5, 3, 7])
  23.  
  24. ];
  25.  
  26. /**
  27. * A face mask for cell processing.
  28. *
  29. * @type {Uint8Array[]}
  30. */
  31.  
  32. export const cellProcFaceMask = [
  33.  
  34. new Uint8Array([0, 4, 0]),
  35. new Uint8Array([1, 5, 0]),
  36. new Uint8Array([2, 6, 0]),
  37. new Uint8Array([3, 7, 0]),
  38. new Uint8Array([0, 2, 1]),
  39. new Uint8Array([4, 6, 1]),
  40. new Uint8Array([1, 3, 1]),
  41. new Uint8Array([5, 7, 1]),
  42. new Uint8Array([0, 1, 2]),
  43. new Uint8Array([2, 3, 2]),
  44. new Uint8Array([4, 5, 2]),
  45. new Uint8Array([6, 7, 2])
  46.  
  47. ];
  48.  
  49. /**
  50. * An edge mask for cell processing.
  51. *
  52. * @type {Uint8Array[]}
  53. */
  54.  
  55. export const cellProcEdgeMask = [
  56.  
  57. new Uint8Array([0, 1, 2, 3, 0]),
  58. new Uint8Array([4, 5, 6, 7, 0]),
  59. new Uint8Array([0, 4, 1, 5, 1]),
  60. new Uint8Array([2, 6, 3, 7, 1]),
  61. new Uint8Array([0, 2, 4, 6, 2]),
  62. new Uint8Array([1, 3, 5, 7, 2])
  63.  
  64. ];
  65.  
  66. /**
  67. * A face mask for face processing.
  68. *
  69. * @type {Array<Uint8Array[]>}
  70. */
  71.  
  72. export const faceProcFaceMask = [
  73.  
  74. [
  75. new Uint8Array([4, 0, 0]),
  76. new Uint8Array([5, 1, 0]),
  77. new Uint8Array([6, 2, 0]),
  78. new Uint8Array([7, 3, 0])
  79. ],
  80.  
  81. [
  82. new Uint8Array([2, 0, 1]),
  83. new Uint8Array([6, 4, 1]),
  84. new Uint8Array([3, 1, 1]),
  85. new Uint8Array([7, 5, 1])
  86. ],
  87.  
  88. [
  89. new Uint8Array([1, 0, 2]),
  90. new Uint8Array([3, 2, 2]),
  91. new Uint8Array([5, 4, 2]),
  92. new Uint8Array([7, 6, 2])
  93. ]
  94.  
  95. ];
  96.  
  97. /**
  98. * An edge mask for face processing.
  99. *
  100. * @type {Array<Uint8Array[]>}
  101. */
  102.  
  103. export const faceProcEdgeMask = [
  104.  
  105. [
  106. new Uint8Array([1, 4, 0, 5, 1, 1]),
  107. new Uint8Array([1, 6, 2, 7, 3, 1]),
  108. new Uint8Array([0, 4, 6, 0, 2, 2]),
  109. new Uint8Array([0, 5, 7, 1, 3, 2])
  110. ],
  111.  
  112. [
  113. new Uint8Array([0, 2, 3, 0, 1, 0]),
  114. new Uint8Array([0, 6, 7, 4, 5, 0]),
  115. new Uint8Array([1, 2, 0, 6, 4, 2]),
  116. new Uint8Array([1, 3, 1, 7, 5, 2])
  117. ],
  118.  
  119. [
  120. new Uint8Array([1, 1, 0, 3, 2, 0]),
  121. new Uint8Array([1, 5, 4, 7, 6, 0]),
  122. new Uint8Array([0, 1, 5, 0, 4, 1]),
  123. new Uint8Array([0, 3, 7, 2, 6, 1])
  124. ]
  125.  
  126. ];
  127.  
  128. /**
  129. * An edge mask for edge processing.
  130. *
  131. * @type {Array<Uint8Array[]>}
  132. */
  133.  
  134. export const edgeProcEdgeMask = [
  135.  
  136. [
  137. new Uint8Array([3, 2, 1, 0, 0]),
  138. new Uint8Array([7, 6, 5, 4, 0])
  139. ],
  140.  
  141. [
  142. new Uint8Array([5, 1, 4, 0, 1]),
  143. new Uint8Array([7, 3, 6, 2, 1])
  144. ],
  145.  
  146. [
  147. new Uint8Array([6, 4, 2, 0, 2]),
  148. new Uint8Array([7, 5, 3, 1, 2])
  149. ]
  150.  
  151. ];
  152.  
  153. /**
  154. * An edge mask.
  155. *
  156. * @type {Uint8Array[]}
  157. */
  158.  
  159. export const procEdgeMask = [
  160.  
  161. new Uint8Array([3, 2, 1, 0]),
  162. new Uint8Array([7, 5, 6, 4]),
  163. new Uint8Array([11, 10, 9, 8])
  164.  
  165. ];