@@ -4,10 +4,38 @@ const should = require("should");
4
4
const nodeocc = require ( ".." ) ;
5
5
const occ = nodeocc . occ ;
6
6
const doDebug = false ;
7
+
7
8
function debugLog ( ) {
8
9
arguments ;
9
10
/* implement me*/
10
11
}
12
+
13
+ describe ( "TBugLinux- testing mesh on a simple cone shape with radius2 = 0 returns 2 Faces (latteral+bottom)" , function ( ) {
14
+ // cf. https://github.com/antonymarion/node-occ-csg-editor-display/runs/1517044830?check_suite_focus=true
15
+ let shape , mesh ;
16
+ before ( function ( ) {
17
+ shape = occ . makeCone ( [ 0 , 0 , 0 ] , 2 , [ 0 , 0 , 2 ] , 0 ) ;
18
+ mesh = shape . createMesh ( 0.1 ) ;
19
+ } ) ;
20
+ it ( "solid should have 2 faces" , function ( ) {
21
+ const myFaces = shape . getFaces ( ) ;
22
+ console . log ( "shape" , shape ) ;
23
+ console . log ( "cone Faces" , myFaces ) ;
24
+ myFaces . length . should . eql ( 2 ) ;
25
+
26
+ // meshing should work on Linux ! (was not working w/ Linux pre compiled occ.node)
27
+ shape
28
+ . hasMesh . should . be . eql ( true ) ;
29
+ shape . faces [ "lateral" ]
30
+ . hasMesh
31
+ . should . be . eql ( true ) ;
32
+ shape . faces [ "bottom" ]
33
+ . hasMesh
34
+ . should . be . eql ( true ) ;
35
+
36
+ } ) ;
37
+ } ) ;
38
+
11
39
describe ( "T1- testing mesh on a simple box shape" , function ( ) {
12
40
13
41
let shape , mesh ;
@@ -30,8 +58,7 @@ describe("T1- testing mesh on a simple box shape", function () {
30
58
mesh . vertices [ 4 ] . should . eql ( 0.0 ) ;
31
59
mesh . vertices [ 5 ] . should . eql ( 100.0 ) ;
32
60
33
- if ( false ) {
34
- mesh . vertices [ 6 ] . should . eql ( 0.0 ) ;
61
+ mesh . vertices [ 6 ] . should . eql ( 0.0 ) ;
35
62
mesh . vertices [ 7 ] . should . eql ( 40.0 ) ;
36
63
mesh . vertices [ 8 ] . should . eql ( 100.0 ) ;
37
64
@@ -42,7 +69,6 @@ describe("T1- testing mesh on a simple box shape", function () {
42
69
mesh . vertices [ 12 ] . should . eql ( 10.0 ) ;
43
70
mesh . vertices [ 13 ] . should . eql ( 0.0 ) ;
44
71
mesh . vertices [ 14 ] . should . eql ( 0.0 ) ;
45
- }
46
72
47
73
} ) ;
48
74
it ( "Mesh#triangle - mesh should provide triangles indexes" , function ( ) {
@@ -81,12 +107,10 @@ describe("T1- testing mesh on a simple box shape", function () {
81
107
it ( "Mesh#getFaceTriangles - mesh should provide a mechanism to extract triangles indexes of a given shape face" , function ( ) {
82
108
// --------------------------------------- face accessor
83
109
let arr = mesh . getFaceTriangles ( shape . getFaces ( ) [ 0 ] ) ;
84
- arr . length . should . eql ( 6 ) ;
85
- //arr.should.eql(new Uint8Array([3, 1, 2, 0, 1, 3]));
110
+ arr . should . eql ( new Uint8Array ( [ 3 , 1 , 2 , 0 , 1 , 3 ] ) ) ;
86
111
87
112
arr = mesh . getFaceTriangles ( shape . getFaces ( ) [ 1 ] ) ;
88
- arr . length . should . eql ( 6 ) ;
89
- //arr.should.eql(new Uint8Array([5, 7, 6, 5, 4, 7]));
113
+ arr . should . eql ( new Uint8Array ( [ 5 , 7 , 6 , 5 , 4 , 7 ] ) ) ;
90
114
// etc...
91
115
} ) ;
92
116
it ( "Mesh#edgeRanges - mesh should provide a mechanism to easily identify edges" , function ( ) {
@@ -228,6 +252,7 @@ describe("testing performance of meshing algorithms with various parameters", fu
228
252
function makeUnitBox ( ) {
229
253
return occ . makeBox ( [ 0 , 0 , 0 ] , [ 100 , 100 , 100 ] ) ;
230
254
}
255
+
231
256
function makeSphere ( ) {
232
257
return occ . makeSphere ( [ 0 , 0 , 0 ] , 100 ) ;
233
258
}
@@ -242,13 +267,15 @@ describe("testing performance of meshing algorithms with various parameters", fu
242
267
beforeEach ( function ( ) {
243
268
shape2 = makeShape ( ) ;
244
269
} ) ;
270
+
245
271
function test_with ( tol , angle ) {
246
272
it ( makeShape . name + " testing with parameter : deflection : " + tol + " angle :" + angle , function ( ) {
247
273
const mesh1 = shape2 . createMesh ( tol , angle ) ;
248
274
debugLog ( " vertices = " , mesh1 . vertices . length ) ;
249
275
debugLog ( " triangles = " , mesh1 . triangles . length ) ;
250
276
} ) ;
251
277
}
278
+
252
279
test_with ( 0.01 , 0.5 ) ;
253
280
test_with ( 0.01 , 5 ) ;
254
281
test_with ( 0.01 , 10 ) ;
0 commit comments