diff --git a/www/grid.js b/www/grid.js index 0762b6d..b104950 100644 --- a/www/grid.js +++ b/www/grid.js @@ -127,8 +127,23 @@ function addObstacle(fX, fZ, tX, tZ) { const v = {fX : fX, fZ : fZ, tX : tX, tZ : tZ, line : vline }; obstacles.push(v); renderer.render( scene, camera ); + var val = ""; + for (const obstacle of obstacles) { + val += outVal(obstacle.fX) + outVal(obstacle.fZ) + + outVal(obstacle.tX) + outVal(obstacle.tZ); + } + console.log("boarders " + borders.length + " obstacles " + obstacles.length); + console.log("val " + val); + let res = ocamlLib.nointersection(val); + console.log("intersection?"); + console.log(res); + if (res == "false") { + console.log("cancelling"); + addObstacle(fX, fZ, tX, tZ); + return; + } cleanCells(); - getCells(); + getCells(); } diff --git a/www/jSmoothTrajectories.ml b/www/jSmoothTrajectories.ml index b00a2e8..614d6f3 100644 --- a/www/jSmoothTrajectories.ml +++ b/www/jSmoothTrajectories.ml @@ -147,7 +147,7 @@ let call_cells s = let _ = Js.export "ocamlLib" (object%js - method no_intersection s = + method nointersection s = Js.string (call_no_intersections (Js.to_string s)) method straight s = Js.string (call_straight (Js.to_string s)) method smooth s = Js.string (call_smooth (Js.to_string s))