Skip to content

Commit 76dfe8c

Browse files
antonymarionerossignon
authored andcommitted
Update test_meshSolid.js
1 parent d58a549 commit 76dfe8c

File tree

1 file changed

+34
-7
lines changed

1 file changed

+34
-7
lines changed

test/test_meshSolid.js

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,38 @@ const should = require("should");
44
const nodeocc = require("..");
55
const occ = nodeocc.occ;
66
const doDebug = false;
7+
78
function debugLog() {
89
arguments;
910
/* implement me*/
1011
}
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+
1139
describe("T1- testing mesh on a simple box shape", function () {
1240

1341
let shape, mesh;
@@ -30,8 +58,7 @@ describe("T1- testing mesh on a simple box shape", function () {
3058
mesh.vertices[4].should.eql(0.0);
3159
mesh.vertices[5].should.eql(100.0);
3260

33-
if (false) {
34-
mesh.vertices[6].should.eql(0.0);
61+
mesh.vertices[6].should.eql(0.0);
3562
mesh.vertices[7].should.eql(40.0);
3663
mesh.vertices[8].should.eql(100.0);
3764

@@ -42,7 +69,6 @@ describe("T1- testing mesh on a simple box shape", function () {
4269
mesh.vertices[12].should.eql(10.0);
4370
mesh.vertices[13].should.eql(0.0);
4471
mesh.vertices[14].should.eql(0.0);
45-
}
4672

4773
});
4874
it("Mesh#triangle - mesh should provide triangles indexes", function () {
@@ -81,12 +107,10 @@ describe("T1- testing mesh on a simple box shape", function () {
81107
it("Mesh#getFaceTriangles - mesh should provide a mechanism to extract triangles indexes of a given shape face", function () {
82108
// --------------------------------------- face accessor
83109
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]));
86111

87112
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]));
90114
// etc...
91115
});
92116
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
228252
function makeUnitBox() {
229253
return occ.makeBox([0, 0, 0], [100, 100, 100]);
230254
}
255+
231256
function makeSphere() {
232257
return occ.makeSphere([0, 0, 0], 100);
233258
}
@@ -242,13 +267,15 @@ describe("testing performance of meshing algorithms with various parameters", fu
242267
beforeEach(function () {
243268
shape2 = makeShape();
244269
});
270+
245271
function test_with(tol, angle) {
246272
it(makeShape.name + " testing with parameter : deflection : " + tol + " angle :" + angle, function () {
247273
const mesh1 = shape2.createMesh(tol, angle);
248274
debugLog(" vertices = ", mesh1.vertices.length);
249275
debugLog(" triangles = ", mesh1.triangles.length);
250276
});
251277
}
278+
252279
test_with(0.01, 0.5);
253280
test_with(0.01, 5);
254281
test_with(0.01, 10);

0 commit comments

Comments
 (0)