threepipe
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

addEdge.test.ts 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. // /*
  2. // * Author: Axel Antoine
  3. // * mail: ax.antoine@gmail.com
  4. // * website: http://axantoine.com
  5. // * Created on Wed Nov 09 2022
  6. // *
  7. // * Loki, Inria project-team with Université de Lille
  8. // * within the Joint Research Unit UMR 9189
  9. // * CNRS - Centrale Lille - Université de Lille, CRIStAL
  10. // * https://loki.lille.inria.fr
  11. // *
  12. // * Licence: Licence.md
  13. // */
  14. //
  15. // import { Vector3 } from "three";
  16. // import { Halfedge } from "../core/Halfedge";
  17. // import { HalfedgeDS } from "../core/HalfedgeDS";
  18. //
  19. // const position = new Vector3();
  20. // const struct = new HalfedgeDS();
  21. //
  22. // /*
  23. // * v2
  24. // * | \
  25. // * | \
  26. // * | \
  27. // * v0 ----- v1
  28. // */
  29. //
  30. // const v0 = struct.addVertex(position.set(0,0,0));
  31. // const v1 = struct.addVertex(position.set(2,0,0));
  32. // const v2 = struct.addVertex(position.set(0,2,0));
  33. //
  34. // let v0v1: Halfedge, v1v2: Halfedge, v2v0: Halfedge;
  35. // let v1v0: Halfedge, v2v1: Halfedge, v0v2: Halfedge;
  36. //
  37. // test("Link isolated vertices", () => {
  38. // v0v1 = struct.addEdge(v0, v1);
  39. // v1v0 = v0v1.twin;
  40. // expect(v0v1.next).toBeHalfedge(v1v0);
  41. // expect(v0v1.prev).toBeHalfedge(v1v0);
  42. // expect(v1v0.next).toBeHalfedge(v0v1);
  43. // expect(v1v0.prev).toBeHalfedge(v0v1);
  44. // expect(v0.halfedge).toBeHalfedge(v0v1);
  45. // expect(v1.halfedge).toBeHalfedge(v1v0);
  46. // });
  47. //
  48. // test("Link to another edge", () => {
  49. // v1v2 = struct.addEdge(v1, v2);
  50. // v2v1 = v1v2.twin;
  51. // expect(v1v2.next).toBeHalfedge(v2v1);
  52. // expect(v1v2.prev).toBeHalfedge(v0v1);
  53. // expect(v0v1.next).toBeHalfedge(v1v2);
  54. // expect(v2v1.next).toBeHalfedge(v1v0);
  55. // expect(v2v1.prev).toBeHalfedge(v1v2);
  56. // expect(v1v0.prev).toBeHalfedge(v2v1);
  57. // });
  58. //
  59. // test("Closing a loop", () => {
  60. // v2v0 = struct.addEdge(v2, v0);
  61. // v0v2 = v2v0.twin;
  62. // expect(v2v0.next).toBeHalfedge(v0v1);
  63. // expect(v2v0.prev).toBeHalfedge(v1v2);
  64. // expect(v0v1.prev).toBeHalfedge(v2v0);
  65. // expect(v1v2.next).toBeHalfedge(v2v0);
  66. //
  67. // expect(v0v2.next).toBeHalfedge(v2v1);
  68. // expect(v0v2.prev).toBeHalfedge(v1v0);
  69. // expect(v1v0.next).toBeHalfedge(v0v2);
  70. // expect(v2v1.prev).toBeHalfedge(v0v2);
  71. // });
  72. //
  73. //
  74. // /**
  75. // * v2 v3
  76. // * | \ | \
  77. // * | \ | \
  78. // * | \ | \
  79. // * v0 ---- v1 ---- v4
  80. // */
  81. //
  82. // const v3 = struct.addVertex(position.set(2,2,0));
  83. // const v4 = struct.addVertex(position.set(4,2,0));
  84. //
  85. // let v3v1: Halfedge, v1v4: Halfedge, v4v3: Halfedge;
  86. // let v1v3: Halfedge, v4v1: Halfedge, v3v4: Halfedge;
  87. //
  88. // test("Connect to face", () => {
  89. // struct.addFace([v0v1, v1v2, v2v0]);
  90. //
  91. // v3v1 = struct.addEdge(v3, v1);
  92. // v1v3 = v3v1.twin;
  93. //
  94. // expect(v3v1.next).toBeHalfedge(v1v0);
  95. // expect(v3v1.prev).toBeHalfedge(v1v3);
  96. // expect(v1v3.next).toBeHalfedge(v3v1);
  97. // expect(v1v3.prev).toBeHalfedge(v2v1);
  98. //
  99. // v1v4 = struct.addEdge(v1, v4);
  100. // v4v1 = v1v4.twin;
  101. //
  102. // expect(v1v4.next).toBeHalfedge(v4v1);
  103. // expect(v4v1.prev).toBeHalfedge(v1v4);
  104. // expect(v4v1.next).toBeOneOfHalfedges([v1v0, v1v3]);
  105. // expect(v1v4.prev).toBeOneOfHalfedges([v2v1, v3v1]);
  106. //
  107. // v4v3 = struct.addEdge(v4, v3);
  108. // v3v4 = v4v3.twin;
  109. // expect(v4v3.next).toBeHalfedge(v3v1);
  110. // expect(v4v3.prev).toBeHalfedge(v1v4);
  111. // expect(v3v4.next).toBeHalfedge(v4v1);
  112. // expect(v3v4.prev).toBeHalfedge(v1v3);
  113. //
  114. // struct.addFace([v1v4, v4v3, v3v1]);
  115. //
  116. // expect(v1v4.prev).toBeHalfedge(v3v1);
  117. // expect(v3v1.next).toBeHalfedge(v1v4);
  118. //
  119. // });