MarchingCubes4.cs 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using UnityEngine;
  5. using Unity.Jobs;
  6. using Unity.Collections;
  7. using UnityEngine.Assertions;
  8. using Sirenix.OdinInspector;
  9. using KairoEngine.Core;
  10. using KairoEngine.Chunks;
  11. namespace KairoEngine.TerrainEngine
  12. {
  13. [System.Serializable]
  14. public class MarchingCubes4
  15. {
  16. public float terrainSurface = 0.5f;
  17. public bool smoothTerrain;
  18. public bool flatShaded;
  19. public Material material;
  20. public GameObject parent;
  21. private MeshFilter meshFilter;
  22. private MeshCollider meshCollider;
  23. private GameObject prefab;
  24. private int width = 32;
  25. private int length = 32;
  26. private int height = 8;
  27. private Vector3 voxelSize = new Vector3(1f, 1f, 1f);
  28. private float[,,] terrainMap;
  29. private uint[,,] terrainCodes;
  30. private List<Vector3> vertices = new List<Vector3>();
  31. private List<int> triangles = new List<int>();
  32. private ChunkSystem<BlockBase> chunkSystem;
  33. private List<JobHandle> jobHandles = new List<JobHandle>();
  34. private List<MarchingCubesJob4> jobs = new List<MarchingCubesJob4>();
  35. private ChunkTerrainGenerator chunkTerrainGenerator;
  36. public void OnDestroy()
  37. {
  38. // Make sure we run our jobs to completion before exiting.
  39. for (int i = 0; i < jobHandles.Count; i++)
  40. {
  41. jobHandles[i].Complete();
  42. }
  43. }
  44. public void UpdateFinishedJobs()
  45. {
  46. //jobHandle.Complete();
  47. //Debug.Log("Updating finished jobs - " + jobHandles.Count);
  48. for (int i = 0; i < jobHandles.Count; i++)
  49. {
  50. if(!jobHandles[i].IsCompleted) continue;
  51. jobHandles[i].Complete();
  52. //Debug.Log($"Job {i} is completed");
  53. if(prefab == null) prefab = new GameObject();
  54. GameObject target = GameObject.Instantiate(prefab, jobs[i].initialPosition, parent.transform.rotation, parent.transform);
  55. // Create vertices and triangle arrays
  56. int verticeCount = jobs[i].arrayIndexes[0];
  57. int trianglesCount = jobs[i].arrayIndexes[1];
  58. //Debug.Log($"Completed job has {jobs[i].vertices.Count()}/{verticeCount} vertices and {jobs[i].triangles.Count()}/{trianglesCount} triangles");
  59. Vector3[] vertices = jobs[i].vertices.Take(verticeCount).ToArray();
  60. int[] triangles = jobs[i].triangles.Take(trianglesCount).ToArray();
  61. Color[] vertexColors = jobs[i].vertexColors.Take(verticeCount).ToArray();
  62. BuildMesh(target, vertices, triangles, vertexColors);
  63. //chunkTerrainGenerator.terrainMeshes[jobs[i].initialPosition] = target;
  64. chunkTerrainGenerator.AddGeneratedTerrainMesh(jobs[i].initialPosition, target);
  65. // Remove this
  66. jobs[i].blocks.Dispose();
  67. jobs[i].codes.Dispose();
  68. jobs[i].vertices.Dispose();
  69. jobs[i].triangles.Dispose();
  70. jobs[i].vertexColors.Dispose();
  71. jobs[i].arrayIndexes.Dispose();
  72. jobs[i].triangleTable.Dispose();
  73. jobs.RemoveAt(i);
  74. jobHandles.RemoveAt(i);
  75. i -= 1;
  76. }
  77. }
  78. public bool IsGeneratorDone() => jobHandles.Count == 0 ? true : false;
  79. public int GetJobCount() => jobHandles.Count;
  80. public void Generate(ChunkSystem<BlockBase> chunkSystem, ChunkTerrainGenerator chunkTerrainGenerator, Vector3 initialPosition = new Vector3())
  81. {
  82. //Debug.Log("Generating chunk " + initialPosition);
  83. this.chunkSystem = chunkSystem;
  84. width = chunkSystem.chunkSize.x;
  85. length = chunkSystem.chunkSize.z;
  86. height = chunkSystem.chunkSize.y;
  87. voxelSize = chunkSystem.voxelSize;
  88. this.chunkTerrainGenerator = chunkTerrainGenerator;
  89. //transform.tag = "Terrain";
  90. terrainMap = new float[width + 1, height + 1, length + 1];
  91. terrainCodes = new uint[width + 1, height + 1, length + 1];
  92. PopulateTerrainMap(chunkSystem, initialPosition);
  93. ScheduleJob(initialPosition);
  94. //CreateMeshData();
  95. }
  96. void PopulateTerrainMap (ChunkSystem<BlockBase> chunkSystem, Vector3 initialPosition = new Vector3())
  97. {
  98. // The data points for terrain are stored at the corners of our "cubes", so the terrainMap needs to be 1 larger
  99. // than the width/height of our mesh.
  100. for (int x = 0; x < width + 1; x++) {
  101. for (int z = 0; z < length + 1; z++) {
  102. for (int y = 0; y < height + 1; y++) {
  103. Vector3 pos = initialPosition + new Vector3(x * voxelSize.x, y * voxelSize.y, z * voxelSize.z);
  104. BlockBase block = chunkSystem.GetBlock(pos);
  105. // Set the value of this point in the terrainMap.
  106. terrainMap[x, y, z] = (float)pos.y - ((float)block.value/1000);
  107. terrainCodes[x, y, z] = block.code;
  108. }
  109. }
  110. }
  111. }
  112. void BuildMesh (GameObject target, Vector3[] vertices, int[] triangles, Color[] vertexColors)
  113. {
  114. //Debug.Log($"Building mesh with {vertices.Length} vertices and {triangles.Length} triangles");
  115. MeshRenderer meshRederer = target.GetComponent<MeshRenderer>();
  116. if(meshRederer == null) meshRederer = target.AddComponent<MeshRenderer>();
  117. meshRederer.sharedMaterial = material;
  118. MeshFilter meshFilter = target.GetComponent<MeshFilter>();
  119. if(meshFilter == null) meshFilter = target.AddComponent<MeshFilter>();
  120. MeshCollider meshCollider = target.GetComponent<MeshCollider>();
  121. if(meshCollider == null) meshCollider = target.AddComponent<MeshCollider>();
  122. Mesh mesh = new Mesh();
  123. mesh.vertices = vertices;
  124. mesh.triangles = triangles;
  125. mesh.colors = vertexColors;
  126. mesh.RecalculateNormals();
  127. meshFilter.mesh = mesh;
  128. meshCollider.sharedMesh = mesh;
  129. }
  130. private void ScheduleJob(Vector3 initialPosition)
  131. {
  132. JobHandle jobHandle = new JobHandle();
  133. var marchingCubesJob = new MarchingCubesJob4
  134. {
  135. chunkSize = this.chunkSystem.chunkSize,
  136. voxelSize = this.voxelSize,
  137. terrainSurface = terrainSurface,
  138. smoothTerrain = smoothTerrain,
  139. flatShaded = flatShaded,
  140. blocks = new NativeArray<float>(terrainMap.Length, Allocator.TempJob),
  141. codes = new NativeArray<uint>(terrainMap.Length, Allocator.TempJob),
  142. vertices = new NativeArray<Vector3>(15000, Allocator.TempJob),
  143. triangles = new NativeArray<int>(25000, Allocator.TempJob),
  144. vertexColors = new NativeArray<Color>(15000, Allocator.TempJob),
  145. arrayIndexes = new NativeArray<int>(2, Allocator.TempJob),
  146. triangleTable = new NativeArray<int>(4096, Allocator.TempJob),
  147. initialPosition = initialPosition
  148. };
  149. int blockIndex = 0;
  150. for (int x = 0; x < width + 1; x++) {
  151. for (int y = 0; y < height + 1; y++) {
  152. for (int z = 0; z < length + 1; z++) {
  153. marchingCubesJob.blocks[blockIndex] = terrainMap[x, y, z];
  154. marchingCubesJob.codes[blockIndex] = terrainCodes[x, y, z];
  155. blockIndex += 1;
  156. }
  157. }
  158. }
  159. jobHandle = marchingCubesJob.Schedule(jobHandle);
  160. jobHandles.Add(jobHandle);
  161. jobs.Add(marchingCubesJob);
  162. }
  163. }
  164. [ExecuteInEditMode]
  165. struct MarchingCubesJob4 : IJob
  166. {
  167. public Vector3Int chunkSize;
  168. public Vector3 voxelSize;
  169. public float terrainSurface;
  170. public bool smoothTerrain;
  171. public bool flatShaded;
  172. public NativeArray<float> blocks;
  173. public NativeArray<uint> codes;
  174. public NativeArray<Vector3> vertices;
  175. public NativeArray<int> triangles;
  176. public NativeArray<Color> vertexColors;
  177. public Vector3 initialPosition;
  178. public NativeArray<int> arrayIndexes;
  179. public NativeArray<int> triangleTable;
  180. private int verticesArrayIndex;
  181. private int trianglesArrayIndex;
  182. public void Execute()
  183. {
  184. verticesArrayIndex = 0;
  185. trianglesArrayIndex = 0;
  186. //Debug.Log("Executing job");
  187. CreateTriangleTable();
  188. // Loop through each "cube" in our terrain.
  189. for (int x = 0; x < chunkSize.x; x++) {
  190. for (int y = 0; y < chunkSize.y; y++) {
  191. for (int z = 0; z < chunkSize.z; z++) {
  192. // Pass the value into our MarchCube function.
  193. MarchCube(new Vector3Int(x, y, z));
  194. }
  195. }
  196. }
  197. arrayIndexes[0] = verticesArrayIndex;
  198. arrayIndexes[1] = trianglesArrayIndex;
  199. }
  200. void MarchCube (Vector3Int position) {
  201. // Sample terrain values at each corner of the cube.
  202. float[] cube = new float[8];
  203. for (int i = 0; i < 8; i++) {
  204. cube[i] = SampleTerrain(position + CornerTable(i));
  205. }
  206. //Vector3 realPosition = new Vector3(position.x * voxelSize.x, position.y * voxelSize.y, position.z * voxelSize.z);
  207. // Get the configuration index of this cube.
  208. int configIndex = GetCubeConfiguration(cube);
  209. // If the configuration of this cube is 0 or 255 (completely inside the terrain or completely outside of it) we don't need to do anything.
  210. if (configIndex == 0 || configIndex == 255) return;
  211. // Loop through the triangles. There are never more than 5 triangles to a cube and only three vertices to a triangle.
  212. int edgeIndex = 0;
  213. for(int i = 0; i < 5; i++)
  214. {
  215. for(int p = 0; p < 3; p++)
  216. {
  217. // Get the current indice. We increment triangleIndex through each loop.
  218. int indice = GetFromTriangleTable(configIndex, edgeIndex);
  219. // If the current edgeIndex is -1, there are no more indices and we can exit the function.
  220. if (indice == -1) return;
  221. // Get the vertices for the start and end of this edge.
  222. Vector3 vert1 = position + CornerTable(EdgeIndexes()[indice, 0]);
  223. Vector3 vert2 = position + CornerTable(EdgeIndexes()[indice, 1]);
  224. //vert1 = new Vector3(vert1.x * voxelSize.x, vert1.y * voxelSize.y, vert1.z * voxelSize.z);
  225. //vert2 = new Vector3(vert2.x * voxelSize.x, vert2.y * voxelSize.y, vert2.z * voxelSize.z);
  226. Vector3 vertPosition;
  227. if (smoothTerrain) {
  228. // Get the terrain values at either end of our current edge from the cube array created above.
  229. float vert1Sample = cube[EdgeIndexes()[indice, 0]];
  230. float vert2Sample = cube[EdgeIndexes()[indice, 1]];
  231. // Calculate the difference between the terrain values.
  232. float difference = vert2Sample - vert1Sample;
  233. // If the difference is 0, then the terrain passes through the middle.
  234. if (difference == 0) difference = terrainSurface;
  235. else difference = (terrainSurface - vert1Sample) / difference;
  236. // Calculate the point along the edge that passes through.
  237. vertPosition = vert1 + ((vert2 - vert1) * difference);
  238. }
  239. else
  240. {
  241. // Get the midpoint of this edge.
  242. vertPosition = (vert1 + vert2) / 2f;
  243. }
  244. vertPosition = new Vector3(vertPosition.x * voxelSize.x, vertPosition.y * voxelSize.y, vertPosition.z * voxelSize.z);
  245. // Add to our vertices and triangles list and incremement the edgeIndex.
  246. if (flatShaded)
  247. {
  248. vertices[verticesArrayIndex] = vertPosition;
  249. triangles[trianglesArrayIndex] = verticesArrayIndex;
  250. vertexColors[verticesArrayIndex] = SampleTerrainColor(position);
  251. verticesArrayIndex += 1;
  252. trianglesArrayIndex += 1;
  253. }
  254. else
  255. {
  256. triangles[trianglesArrayIndex] = VertForIndice(vertPosition, position);
  257. trianglesArrayIndex += 1;
  258. }
  259. edgeIndex++;
  260. }
  261. }
  262. }
  263. float SampleTerrain (Vector3Int point)
  264. {
  265. // https://stackoverflow.com/questions/3613429/algorithm-to-convert-a-multi-dimensional-array-to-a-one-dimensional-array
  266. int index = (((chunkSize.y + 1) * (chunkSize.z + 1)) * point.x) + ((chunkSize.z + 1) * point.y) + point.z;
  267. return blocks[index];
  268. }
  269. Color SampleTerrainColor (Vector3Int point)
  270. {
  271. int index = (((chunkSize.y + 1) * (chunkSize.z + 1)) * point.x) + ((chunkSize.z + 1) * point.y) + point.z;
  272. uint code = codes[index];
  273. switch (code)
  274. {
  275. default:
  276. case 0:
  277. return Color.white;
  278. case 1:
  279. return Color.red;
  280. case 2:
  281. return Color.green;
  282. case 3:
  283. return Color.blue;
  284. case 4:
  285. return Color.black;
  286. case 5:
  287. return Color.yellow;
  288. case 6:
  289. return new Color(1f, 0, 1f); // Purple
  290. case 7:
  291. return new Color(0f, 1f, 1f); // Purple
  292. }
  293. }
  294. int GetCubeConfiguration (float[] cube)
  295. {
  296. // Starting with a configuration of zero, loop through each point in the cube and check if it is below the terrain surface.
  297. int configurationIndex = 0;
  298. for (int i = 0; i < 8; i++) {
  299. // If it is, use bit-magic to the set the corresponding bit to 1. So if only the 3rd point in the cube was below
  300. // the surface, the bit would look like 00100000, which represents the integer value 32.
  301. if (cube[i] > terrainSurface)
  302. configurationIndex |= 1 << i;
  303. }
  304. return configurationIndex;
  305. }
  306. int VertForIndice (Vector3 vert, Vector3Int point)
  307. {
  308. // Loop through all the vertices currently in the vertices list.
  309. for (int i = 0; i < verticesArrayIndex; i++)
  310. {
  311. // If we find a vert that matches ours, then simply return this index.
  312. if (vertices[i] == vert) return i;
  313. }
  314. // If we didn't find a match, add this vert to the list and return last index.
  315. vertices[verticesArrayIndex] = vert;
  316. vertexColors[verticesArrayIndex] = SampleTerrainColor(point);
  317. verticesArrayIndex += 1;
  318. return verticesArrayIndex - 1;
  319. }
  320. // Vector3Int[] CornerTable;
  321. // int[,] EdgeIndexes;
  322. // private int[,] TriangleTable;
  323. private Vector3Int CornerTable(int index)
  324. {
  325. Vector3Int[] CornerTable = new Vector3Int[8] {
  326. new Vector3Int(0, 0, 0),
  327. new Vector3Int(1, 0, 0),
  328. new Vector3Int(1, 1, 0),
  329. new Vector3Int(0, 1, 0),
  330. new Vector3Int(0, 0, 1),
  331. new Vector3Int(1, 0, 1),
  332. new Vector3Int(1, 1, 1),
  333. new Vector3Int(0, 1, 1)
  334. };
  335. return CornerTable[index];
  336. }
  337. private int[,] EdgeIndexes()
  338. {
  339. int[,] EdgeIndexes = new int[12, 2] {
  340. {0, 1}, {1, 2}, {3, 2}, {0, 3}, {4, 5}, {5, 6}, {7, 6}, {4, 7}, {0, 4}, {1, 5}, {2, 6}, {3, 7}
  341. };
  342. return EdgeIndexes;
  343. }
  344. private void CreateTriangleTable()
  345. {
  346. int[,] table = TriangleTable();
  347. int index = 0;
  348. for (int x = 0; x < table.GetLength(0); x++)
  349. {
  350. for (int y = 0; y < table.GetLength(1); y++)
  351. {
  352. triangleTable[index] = table[x, y];
  353. index += 1;
  354. }
  355. }
  356. }
  357. private int GetFromTriangleTable(int x, int y)
  358. {
  359. return triangleTable[x * 16 + y];
  360. }
  361. private int[,] TriangleTable()
  362. {
  363. int[,] TriangleTable = new int[,]
  364. {
  365. {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
  366. {0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
  367. {0, 1, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
  368. {1, 8, 3, 9, 8, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
  369. {1, 2, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
  370. {0, 8, 3, 1, 2, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
  371. {9, 2, 10, 0, 2, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
  372. {2, 8, 3, 2, 10, 8, 10, 9, 8, -1, -1, -1, -1, -1, -1, -1},
  373. {3, 11, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
  374. {0, 11, 2, 8, 11, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
  375. {1, 9, 0, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
  376. {1, 11, 2, 1, 9, 11, 9, 8, 11, -1, -1, -1, -1, -1, -1, -1},
  377. {3, 10, 1, 11, 10, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
  378. {0, 10, 1, 0, 8, 10, 8, 11, 10, -1, -1, -1, -1, -1, -1, -1},
  379. {3, 9, 0, 3, 11, 9, 11, 10, 9, -1, -1, -1, -1, -1, -1, -1},
  380. {9, 8, 10, 10, 8, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
  381. {4, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
  382. {4, 3, 0, 7, 3, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
  383. {0, 1, 9, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
  384. {4, 1, 9, 4, 7, 1, 7, 3, 1, -1, -1, -1, -1, -1, -1, -1},
  385. {1, 2, 10, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
  386. {3, 4, 7, 3, 0, 4, 1, 2, 10, -1, -1, -1, -1, -1, -1, -1},
  387. {9, 2, 10, 9, 0, 2, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1},
  388. {2, 10, 9, 2, 9, 7, 2, 7, 3, 7, 9, 4, -1, -1, -1, -1},
  389. {8, 4, 7, 3, 11, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
  390. {11, 4, 7, 11, 2, 4, 2, 0, 4, -1, -1, -1, -1, -1, -1, -1},
  391. {9, 0, 1, 8, 4, 7, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1},
  392. {4, 7, 11, 9, 4, 11, 9, 11, 2, 9, 2, 1, -1, -1, -1, -1},
  393. {3, 10, 1, 3, 11, 10, 7, 8, 4, -1, -1, -1, -1, -1, -1, -1},
  394. {1, 11, 10, 1, 4, 11, 1, 0, 4, 7, 11, 4, -1, -1, -1, -1},
  395. {4, 7, 8, 9, 0, 11, 9, 11, 10, 11, 0, 3, -1, -1, -1, -1},
  396. {4, 7, 11, 4, 11, 9, 9, 11, 10, -1, -1, -1, -1, -1, -1, -1},
  397. {9, 5, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
  398. {9, 5, 4, 0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
  399. {0, 5, 4, 1, 5, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
  400. {8, 5, 4, 8, 3, 5, 3, 1, 5, -1, -1, -1, -1, -1, -1, -1},
  401. {1, 2, 10, 9, 5, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
  402. {3, 0, 8, 1, 2, 10, 4, 9, 5, -1, -1, -1, -1, -1, -1, -1},
  403. {5, 2, 10, 5, 4, 2, 4, 0, 2, -1, -1, -1, -1, -1, -1, -1},
  404. {2, 10, 5, 3, 2, 5, 3, 5, 4, 3, 4, 8, -1, -1, -1, -1},
  405. {9, 5, 4, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
  406. {0, 11, 2, 0, 8, 11, 4, 9, 5, -1, -1, -1, -1, -1, -1, -1},
  407. {0, 5, 4, 0, 1, 5, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1},
  408. {2, 1, 5, 2, 5, 8, 2, 8, 11, 4, 8, 5, -1, -1, -1, -1},
  409. {10, 3, 11, 10, 1, 3, 9, 5, 4, -1, -1, -1, -1, -1, -1, -1},
  410. {4, 9, 5, 0, 8, 1, 8, 10, 1, 8, 11, 10, -1, -1, -1, -1},
  411. {5, 4, 0, 5, 0, 11, 5, 11, 10, 11, 0, 3, -1, -1, -1, -1},
  412. {5, 4, 8, 5, 8, 10, 10, 8, 11, -1, -1, -1, -1, -1, -1, -1},
  413. {9, 7, 8, 5, 7, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
  414. {9, 3, 0, 9, 5, 3, 5, 7, 3, -1, -1, -1, -1, -1, -1, -1},
  415. {0, 7, 8, 0, 1, 7, 1, 5, 7, -1, -1, -1, -1, -1, -1, -1},
  416. {1, 5, 3, 3, 5, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
  417. {9, 7, 8, 9, 5, 7, 10, 1, 2, -1, -1, -1, -1, -1, -1, -1},
  418. {10, 1, 2, 9, 5, 0, 5, 3, 0, 5, 7, 3, -1, -1, -1, -1},
  419. {8, 0, 2, 8, 2, 5, 8, 5, 7, 10, 5, 2, -1, -1, -1, -1},
  420. {2, 10, 5, 2, 5, 3, 3, 5, 7, -1, -1, -1, -1, -1, -1, -1},
  421. {7, 9, 5, 7, 8, 9, 3, 11, 2, -1, -1, -1, -1, -1, -1, -1},
  422. {9, 5, 7, 9, 7, 2, 9, 2, 0, 2, 7, 11, -1, -1, -1, -1},
  423. {2, 3, 11, 0, 1, 8, 1, 7, 8, 1, 5, 7, -1, -1, -1, -1},
  424. {11, 2, 1, 11, 1, 7, 7, 1, 5, -1, -1, -1, -1, -1, -1, -1},
  425. {9, 5, 8, 8, 5, 7, 10, 1, 3, 10, 3, 11, -1, -1, -1, -1},
  426. {5, 7, 0, 5, 0, 9, 7, 11, 0, 1, 0, 10, 11, 10, 0, -1},
  427. {11, 10, 0, 11, 0, 3, 10, 5, 0, 8, 0, 7, 5, 7, 0, -1},
  428. {11, 10, 5, 7, 11, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
  429. {10, 6, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
  430. {0, 8, 3, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
  431. {9, 0, 1, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
  432. {1, 8, 3, 1, 9, 8, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1},
  433. {1, 6, 5, 2, 6, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
  434. {1, 6, 5, 1, 2, 6, 3, 0, 8, -1, -1, -1, -1, -1, -1, -1},
  435. {9, 6, 5, 9, 0, 6, 0, 2, 6, -1, -1, -1, -1, -1, -1, -1},
  436. {5, 9, 8, 5, 8, 2, 5, 2, 6, 3, 2, 8, -1, -1, -1, -1},
  437. {2, 3, 11, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
  438. {11, 0, 8, 11, 2, 0, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1},
  439. {0, 1, 9, 2, 3, 11, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1},
  440. {5, 10, 6, 1, 9, 2, 9, 11, 2, 9, 8, 11, -1, -1, -1, -1},
  441. {6, 3, 11, 6, 5, 3, 5, 1, 3, -1, -1, -1, -1, -1, -1, -1},
  442. {0, 8, 11, 0, 11, 5, 0, 5, 1, 5, 11, 6, -1, -1, -1, -1},
  443. {3, 11, 6, 0, 3, 6, 0, 6, 5, 0, 5, 9, -1, -1, -1, -1},
  444. {6, 5, 9, 6, 9, 11, 11, 9, 8, -1, -1, -1, -1, -1, -1, -1},
  445. {5, 10, 6, 4, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
  446. {4, 3, 0, 4, 7, 3, 6, 5, 10, -1, -1, -1, -1, -1, -1, -1},
  447. {1, 9, 0, 5, 10, 6, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1},
  448. {10, 6, 5, 1, 9, 7, 1, 7, 3, 7, 9, 4, -1, -1, -1, -1},
  449. {6, 1, 2, 6, 5, 1, 4, 7, 8, -1, -1, -1, -1, -1, -1, -1},
  450. {1, 2, 5, 5, 2, 6, 3, 0, 4, 3, 4, 7, -1, -1, -1, -1},
  451. {8, 4, 7, 9, 0, 5, 0, 6, 5, 0, 2, 6, -1, -1, -1, -1},
  452. {7, 3, 9, 7, 9, 4, 3, 2, 9, 5, 9, 6, 2, 6, 9, -1},
  453. {3, 11, 2, 7, 8, 4, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1},
  454. {5, 10, 6, 4, 7, 2, 4, 2, 0, 2, 7, 11, -1, -1, -1, -1},
  455. {0, 1, 9, 4, 7, 8, 2, 3, 11, 5, 10, 6, -1, -1, -1, -1},
  456. {9, 2, 1, 9, 11, 2, 9, 4, 11, 7, 11, 4, 5, 10, 6, -1},
  457. {8, 4, 7, 3, 11, 5, 3, 5, 1, 5, 11, 6, -1, -1, -1, -1},
  458. {5, 1, 11, 5, 11, 6, 1, 0, 11, 7, 11, 4, 0, 4, 11, -1},
  459. {0, 5, 9, 0, 6, 5, 0, 3, 6, 11, 6, 3, 8, 4, 7, -1},
  460. {6, 5, 9, 6, 9, 11, 4, 7, 9, 7, 11, 9, -1, -1, -1, -1},
  461. {10, 4, 9, 6, 4, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
  462. {4, 10, 6, 4, 9, 10, 0, 8, 3, -1, -1, -1, -1, -1, -1, -1},
  463. {10, 0, 1, 10, 6, 0, 6, 4, 0, -1, -1, -1, -1, -1, -1, -1},
  464. {8, 3, 1, 8, 1, 6, 8, 6, 4, 6, 1, 10, -1, -1, -1, -1},
  465. {1, 4, 9, 1, 2, 4, 2, 6, 4, -1, -1, -1, -1, -1, -1, -1},
  466. {3, 0, 8, 1, 2, 9, 2, 4, 9, 2, 6, 4, -1, -1, -1, -1},
  467. {0, 2, 4, 4, 2, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
  468. {8, 3, 2, 8, 2, 4, 4, 2, 6, -1, -1, -1, -1, -1, -1, -1},
  469. {10, 4, 9, 10, 6, 4, 11, 2, 3, -1, -1, -1, -1, -1, -1, -1},
  470. {0, 8, 2, 2, 8, 11, 4, 9, 10, 4, 10, 6, -1, -1, -1, -1},
  471. {3, 11, 2, 0, 1, 6, 0, 6, 4, 6, 1, 10, -1, -1, -1, -1},
  472. {6, 4, 1, 6, 1, 10, 4, 8, 1, 2, 1, 11, 8, 11, 1, -1},
  473. {9, 6, 4, 9, 3, 6, 9, 1, 3, 11, 6, 3, -1, -1, -1, -1},
  474. {8, 11, 1, 8, 1, 0, 11, 6, 1, 9, 1, 4, 6, 4, 1, -1},
  475. {3, 11, 6, 3, 6, 0, 0, 6, 4, -1, -1, -1, -1, -1, -1, -1},
  476. {6, 4, 8, 11, 6, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
  477. {7, 10, 6, 7, 8, 10, 8, 9, 10, -1, -1, -1, -1, -1, -1, -1},
  478. {0, 7, 3, 0, 10, 7, 0, 9, 10, 6, 7, 10, -1, -1, -1, -1},
  479. {10, 6, 7, 1, 10, 7, 1, 7, 8, 1, 8, 0, -1, -1, -1, -1},
  480. {10, 6, 7, 10, 7, 1, 1, 7, 3, -1, -1, -1, -1, -1, -1, -1},
  481. {1, 2, 6, 1, 6, 8, 1, 8, 9, 8, 6, 7, -1, -1, -1, -1},
  482. {2, 6, 9, 2, 9, 1, 6, 7, 9, 0, 9, 3, 7, 3, 9, -1},
  483. {7, 8, 0, 7, 0, 6, 6, 0, 2, -1, -1, -1, -1, -1, -1, -1},
  484. {7, 3, 2, 6, 7, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
  485. {2, 3, 11, 10, 6, 8, 10, 8, 9, 8, 6, 7, -1, -1, -1, -1},
  486. {2, 0, 7, 2, 7, 11, 0, 9, 7, 6, 7, 10, 9, 10, 7, -1},
  487. {1, 8, 0, 1, 7, 8, 1, 10, 7, 6, 7, 10, 2, 3, 11, -1},
  488. {11, 2, 1, 11, 1, 7, 10, 6, 1, 6, 7, 1, -1, -1, -1, -1},
  489. {8, 9, 6, 8, 6, 7, 9, 1, 6, 11, 6, 3, 1, 3, 6, -1},
  490. {0, 9, 1, 11, 6, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
  491. {7, 8, 0, 7, 0, 6, 3, 11, 0, 11, 6, 0, -1, -1, -1, -1},
  492. {7, 11, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
  493. {7, 6, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
  494. {3, 0, 8, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
  495. {0, 1, 9, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
  496. {8, 1, 9, 8, 3, 1, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1},
  497. {10, 1, 2, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
  498. {1, 2, 10, 3, 0, 8, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1},
  499. {2, 9, 0, 2, 10, 9, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1},
  500. {6, 11, 7, 2, 10, 3, 10, 8, 3, 10, 9, 8, -1, -1, -1, -1},
  501. {7, 2, 3, 6, 2, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
  502. {7, 0, 8, 7, 6, 0, 6, 2, 0, -1, -1, -1, -1, -1, -1, -1},
  503. {2, 7, 6, 2, 3, 7, 0, 1, 9, -1, -1, -1, -1, -1, -1, -1},
  504. {1, 6, 2, 1, 8, 6, 1, 9, 8, 8, 7, 6, -1, -1, -1, -1},
  505. {10, 7, 6, 10, 1, 7, 1, 3, 7, -1, -1, -1, -1, -1, -1, -1},
  506. {10, 7, 6, 1, 7, 10, 1, 8, 7, 1, 0, 8, -1, -1, -1, -1},
  507. {0, 3, 7, 0, 7, 10, 0, 10, 9, 6, 10, 7, -1, -1, -1, -1},
  508. {7, 6, 10, 7, 10, 8, 8, 10, 9, -1, -1, -1, -1, -1, -1, -1},
  509. {6, 8, 4, 11, 8, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
  510. {3, 6, 11, 3, 0, 6, 0, 4, 6, -1, -1, -1, -1, -1, -1, -1},
  511. {8, 6, 11, 8, 4, 6, 9, 0, 1, -1, -1, -1, -1, -1, -1, -1},
  512. {9, 4, 6, 9, 6, 3, 9, 3, 1, 11, 3, 6, -1, -1, -1, -1},
  513. {6, 8, 4, 6, 11, 8, 2, 10, 1, -1, -1, -1, -1, -1, -1, -1},
  514. {1, 2, 10, 3, 0, 11, 0, 6, 11, 0, 4, 6, -1, -1, -1, -1},
  515. {4, 11, 8, 4, 6, 11, 0, 2, 9, 2, 10, 9, -1, -1, -1, -1},
  516. {10, 9, 3, 10, 3, 2, 9, 4, 3, 11, 3, 6, 4, 6, 3, -1},
  517. {8, 2, 3, 8, 4, 2, 4, 6, 2, -1, -1, -1, -1, -1, -1, -1},
  518. {0, 4, 2, 4, 6, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
  519. {1, 9, 0, 2, 3, 4, 2, 4, 6, 4, 3, 8, -1, -1, -1, -1},
  520. {1, 9, 4, 1, 4, 2, 2, 4, 6, -1, -1, -1, -1, -1, -1, -1},
  521. {8, 1, 3, 8, 6, 1, 8, 4, 6, 6, 10, 1, -1, -1, -1, -1},
  522. {10, 1, 0, 10, 0, 6, 6, 0, 4, -1, -1, -1, -1, -1, -1, -1},
  523. {4, 6, 3, 4, 3, 8, 6, 10, 3, 0, 3, 9, 10, 9, 3, -1},
  524. {10, 9, 4, 6, 10, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
  525. {4, 9, 5, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
  526. {0, 8, 3, 4, 9, 5, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1},
  527. {5, 0, 1, 5, 4, 0, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1},
  528. {11, 7, 6, 8, 3, 4, 3, 5, 4, 3, 1, 5, -1, -1, -1, -1},
  529. {9, 5, 4, 10, 1, 2, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1},
  530. {6, 11, 7, 1, 2, 10, 0, 8, 3, 4, 9, 5, -1, -1, -1, -1},
  531. {7, 6, 11, 5, 4, 10, 4, 2, 10, 4, 0, 2, -1, -1, -1, -1},
  532. {3, 4, 8, 3, 5, 4, 3, 2, 5, 10, 5, 2, 11, 7, 6, -1},
  533. {7, 2, 3, 7, 6, 2, 5, 4, 9, -1, -1, -1, -1, -1, -1, -1},
  534. {9, 5, 4, 0, 8, 6, 0, 6, 2, 6, 8, 7, -1, -1, -1, -1},
  535. {3, 6, 2, 3, 7, 6, 1, 5, 0, 5, 4, 0, -1, -1, -1, -1},
  536. {6, 2, 8, 6, 8, 7, 2, 1, 8, 4, 8, 5, 1, 5, 8, -1},
  537. {9, 5, 4, 10, 1, 6, 1, 7, 6, 1, 3, 7, -1, -1, -1, -1},
  538. {1, 6, 10, 1, 7, 6, 1, 0, 7, 8, 7, 0, 9, 5, 4, -1},
  539. {4, 0, 10, 4, 10, 5, 0, 3, 10, 6, 10, 7, 3, 7, 10, -1},
  540. {7, 6, 10, 7, 10, 8, 5, 4, 10, 4, 8, 10, -1, -1, -1, -1},
  541. {6, 9, 5, 6, 11, 9, 11, 8, 9, -1, -1, -1, -1, -1, -1, -1},
  542. {3, 6, 11, 0, 6, 3, 0, 5, 6, 0, 9, 5, -1, -1, -1, -1},
  543. {0, 11, 8, 0, 5, 11, 0, 1, 5, 5, 6, 11, -1, -1, -1, -1},
  544. {6, 11, 3, 6, 3, 5, 5, 3, 1, -1, -1, -1, -1, -1, -1, -1},
  545. {1, 2, 10, 9, 5, 11, 9, 11, 8, 11, 5, 6, -1, -1, -1, -1},
  546. {0, 11, 3, 0, 6, 11, 0, 9, 6, 5, 6, 9, 1, 2, 10, -1},
  547. {11, 8, 5, 11, 5, 6, 8, 0, 5, 10, 5, 2, 0, 2, 5, -1},
  548. {6, 11, 3, 6, 3, 5, 2, 10, 3, 10, 5, 3, -1, -1, -1, -1},
  549. {5, 8, 9, 5, 2, 8, 5, 6, 2, 3, 8, 2, -1, -1, -1, -1},
  550. {9, 5, 6, 9, 6, 0, 0, 6, 2, -1, -1, -1, -1, -1, -1, -1},
  551. {1, 5, 8, 1, 8, 0, 5, 6, 8, 3, 8, 2, 6, 2, 8, -1},
  552. {1, 5, 6, 2, 1, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
  553. {1, 3, 6, 1, 6, 10, 3, 8, 6, 5, 6, 9, 8, 9, 6, -1},
  554. {10, 1, 0, 10, 0, 6, 9, 5, 0, 5, 6, 0, -1, -1, -1, -1},
  555. {0, 3, 8, 5, 6, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
  556. {10, 5, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
  557. {11, 5, 10, 7, 5, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
  558. {11, 5, 10, 11, 7, 5, 8, 3, 0, -1, -1, -1, -1, -1, -1, -1},
  559. {5, 11, 7, 5, 10, 11, 1, 9, 0, -1, -1, -1, -1, -1, -1, -1},
  560. {10, 7, 5, 10, 11, 7, 9, 8, 1, 8, 3, 1, -1, -1, -1, -1},
  561. {11, 1, 2, 11, 7, 1, 7, 5, 1, -1, -1, -1, -1, -1, -1, -1},
  562. {0, 8, 3, 1, 2, 7, 1, 7, 5, 7, 2, 11, -1, -1, -1, -1},
  563. {9, 7, 5, 9, 2, 7, 9, 0, 2, 2, 11, 7, -1, -1, -1, -1},
  564. {7, 5, 2, 7, 2, 11, 5, 9, 2, 3, 2, 8, 9, 8, 2, -1},
  565. {2, 5, 10, 2, 3, 5, 3, 7, 5, -1, -1, -1, -1, -1, -1, -1},
  566. {8, 2, 0, 8, 5, 2, 8, 7, 5, 10, 2, 5, -1, -1, -1, -1},
  567. {9, 0, 1, 5, 10, 3, 5, 3, 7, 3, 10, 2, -1, -1, -1, -1},
  568. {9, 8, 2, 9, 2, 1, 8, 7, 2, 10, 2, 5, 7, 5, 2, -1},
  569. {1, 3, 5, 3, 7, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
  570. {0, 8, 7, 0, 7, 1, 1, 7, 5, -1, -1, -1, -1, -1, -1, -1},
  571. {9, 0, 3, 9, 3, 5, 5, 3, 7, -1, -1, -1, -1, -1, -1, -1},
  572. {9, 8, 7, 5, 9, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
  573. {5, 8, 4, 5, 10, 8, 10, 11, 8, -1, -1, -1, -1, -1, -1, -1},
  574. {5, 0, 4, 5, 11, 0, 5, 10, 11, 11, 3, 0, -1, -1, -1, -1},
  575. {0, 1, 9, 8, 4, 10, 8, 10, 11, 10, 4, 5, -1, -1, -1, -1},
  576. {10, 11, 4, 10, 4, 5, 11, 3, 4, 9, 4, 1, 3, 1, 4, -1},
  577. {2, 5, 1, 2, 8, 5, 2, 11, 8, 4, 5, 8, -1, -1, -1, -1},
  578. {0, 4, 11, 0, 11, 3, 4, 5, 11, 2, 11, 1, 5, 1, 11, -1},
  579. {0, 2, 5, 0, 5, 9, 2, 11, 5, 4, 5, 8, 11, 8, 5, -1},
  580. {9, 4, 5, 2, 11, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
  581. {2, 5, 10, 3, 5, 2, 3, 4, 5, 3, 8, 4, -1, -1, -1, -1},
  582. {5, 10, 2, 5, 2, 4, 4, 2, 0, -1, -1, -1, -1, -1, -1, -1},
  583. {3, 10, 2, 3, 5, 10, 3, 8, 5, 4, 5, 8, 0, 1, 9, -1},
  584. {5, 10, 2, 5, 2, 4, 1, 9, 2, 9, 4, 2, -1, -1, -1, -1},
  585. {8, 4, 5, 8, 5, 3, 3, 5, 1, -1, -1, -1, -1, -1, -1, -1},
  586. {0, 4, 5, 1, 0, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
  587. {8, 4, 5, 8, 5, 3, 9, 0, 5, 0, 3, 5, -1, -1, -1, -1},
  588. {9, 4, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
  589. {4, 11, 7, 4, 9, 11, 9, 10, 11, -1, -1, -1, -1, -1, -1, -1},
  590. {0, 8, 3, 4, 9, 7, 9, 11, 7, 9, 10, 11, -1, -1, -1, -1},
  591. {1, 10, 11, 1, 11, 4, 1, 4, 0, 7, 4, 11, -1, -1, -1, -1},
  592. {3, 1, 4, 3, 4, 8, 1, 10, 4, 7, 4, 11, 10, 11, 4, -1},
  593. {4, 11, 7, 9, 11, 4, 9, 2, 11, 9, 1, 2, -1, -1, -1, -1},
  594. {9, 7, 4, 9, 11, 7, 9, 1, 11, 2, 11, 1, 0, 8, 3, -1},
  595. {11, 7, 4, 11, 4, 2, 2, 4, 0, -1, -1, -1, -1, -1, -1, -1},
  596. {11, 7, 4, 11, 4, 2, 8, 3, 4, 3, 2, 4, -1, -1, -1, -1},
  597. {2, 9, 10, 2, 7, 9, 2, 3, 7, 7, 4, 9, -1, -1, -1, -1},
  598. {9, 10, 7, 9, 7, 4, 10, 2, 7, 8, 7, 0, 2, 0, 7, -1},
  599. {3, 7, 10, 3, 10, 2, 7, 4, 10, 1, 10, 0, 4, 0, 10, -1},
  600. {1, 10, 2, 8, 7, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
  601. {4, 9, 1, 4, 1, 7, 7, 1, 3, -1, -1, -1, -1, -1, -1, -1},
  602. {4, 9, 1, 4, 1, 7, 0, 8, 1, 8, 7, 1, -1, -1, -1, -1},
  603. {4, 0, 3, 7, 4, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
  604. {4, 8, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
  605. {9, 10, 8, 10, 11, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
  606. {3, 0, 9, 3, 9, 11, 11, 9, 10, -1, -1, -1, -1, -1, -1, -1},
  607. {0, 1, 10, 0, 10, 8, 8, 10, 11, -1, -1, -1, -1, -1, -1, -1},
  608. {3, 1, 10, 11, 3, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
  609. {1, 2, 11, 1, 11, 9, 9, 11, 8, -1, -1, -1, -1, -1, -1, -1},
  610. {3, 0, 9, 3, 9, 11, 1, 2, 9, 2, 11, 9, -1, -1, -1, -1},
  611. {0, 2, 11, 8, 0, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
  612. {3, 2, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
  613. {2, 3, 8, 2, 8, 10, 10, 8, 9, -1, -1, -1, -1, -1, -1, -1},
  614. {9, 10, 2, 0, 9, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
  615. {2, 3, 8, 2, 8, 10, 0, 1, 8, 1, 10, 8, -1, -1, -1, -1},
  616. {1, 10, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
  617. {1, 3, 8, 9, 1, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
  618. {0, 9, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
  619. {0, 3, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
  620. {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}
  621. };
  622. return TriangleTable;
  623. }
  624. }
  625. }