update csg tests
This commit is contained in:
parent
29e110ea73
commit
989cfbb7da
1 changed files with 25 additions and 9 deletions
|
|
@ -142,6 +142,8 @@ Module.onRuntimeInitialized = () => {
|
||||||
const ball_torture = false;
|
const ball_torture = false;
|
||||||
|
|
||||||
if (tests) {
|
if (tests) {
|
||||||
|
console.log('running Manifold tests');
|
||||||
|
|
||||||
let c = Module.cube([1,1,1], true);
|
let c = Module.cube([1,1,1], true);
|
||||||
console.log({
|
console.log({
|
||||||
c,
|
c,
|
||||||
|
|
@ -151,6 +153,8 @@ Module.onRuntimeInitialized = () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (mesh_perf) {
|
if (mesh_perf) {
|
||||||
|
console.log('running Manifold getMesh() benchmark');
|
||||||
|
|
||||||
let l = 1000;
|
let l = 1000;
|
||||||
let s = Module.sphere(10, 100);
|
let s = Module.sphere(10, 100);
|
||||||
let sm = s.getMesh();
|
let sm = s.getMesh();
|
||||||
|
|
@ -175,14 +179,19 @@ Module.onRuntimeInitialized = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ball_torture) {
|
if (ball_torture) {
|
||||||
|
console.log('running Manifold ball torture test');
|
||||||
|
|
||||||
console.time('ball test');
|
console.time('ball test');
|
||||||
let ball = Module.sphere(25, 128);
|
let iter = 1; // increases final complexity (cpu + mem)
|
||||||
|
let maxBatch = 10; // increases memory pressure
|
||||||
|
let sphereDetail = 64; // higher # speeds up progression of complexity
|
||||||
|
let ball = Module.sphere(24, sphereDetail);
|
||||||
let box = Module.cube([500, 500, 100], true);
|
let box = Module.cube([500, 500, 100], true);
|
||||||
let deg2rad = Math.PI / 180;
|
let deg2rad = Math.PI / 180;
|
||||||
let z = 50;
|
let z = 50;
|
||||||
let rad = 250;
|
let rad = 250;
|
||||||
let iter = 4;
|
|
||||||
let last = Date.now();
|
let last = Date.now();
|
||||||
|
let batch = 0;
|
||||||
for (let i=0; i<360*iter; i++) {
|
for (let i=0; i<360*iter; i++) {
|
||||||
let x = Math.cos(deg2rad * i) * rad;
|
let x = Math.cos(deg2rad * i) * rad;
|
||||||
let y = Math.sin(deg2rad * i) * rad;
|
let y = Math.sin(deg2rad * i) * rad;
|
||||||
|
|
@ -191,13 +200,20 @@ Module.onRuntimeInitialized = () => {
|
||||||
ball2.delete();
|
ball2.delete();
|
||||||
box.delete();
|
box.delete();
|
||||||
box = box2;
|
box = box2;
|
||||||
// box.getMesh();
|
if (batch++ > maxBatch) {
|
||||||
// let { vertex } = box.getMesh({ normal: () => undefined });
|
batch = 0;
|
||||||
let vertex = [];
|
let nv = box.numVert();
|
||||||
let now = Date.now();
|
let now = Date.now();
|
||||||
console.log((i/(iter*360)).toFixed(2), vertex.length, now - last); last = now;
|
console.log(
|
||||||
rad -= 0.05;
|
(i / (iter * 360)).toFixed(2), // % complete
|
||||||
z -= 0.1;
|
nv, // num vertices in target block
|
||||||
|
now - last, // elapsed time for maxBatch boolean ops
|
||||||
|
((now - last) / maxBatch).toFixed(4) // time per boolean op
|
||||||
|
);
|
||||||
|
last = now;
|
||||||
|
}
|
||||||
|
rad -= 0.04;
|
||||||
|
z -= 0.08;
|
||||||
}
|
}
|
||||||
console.log(box.getMesh());
|
console.log(box.getMesh());
|
||||||
ball.delete();
|
ball.delete();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue