From 382d1c4ddd3662ca6834f1e1636afe0b1f25bc17 Mon Sep 17 00:00:00 2001 From: Bachir Soussi Chiadmi Date: Thu, 3 May 2018 00:04:16 +0200 Subject: [PATCH] corpus map centerd node colliding again --- .../edlp_corpus/assets/dist/scripts/corpus.min.js | 5 +++-- .../figli/edlp_corpus/assets/scripts/corpus.js | 13 ++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/sites/all/modules/figli/edlp_corpus/assets/dist/scripts/corpus.min.js b/sites/all/modules/figli/edlp_corpus/assets/dist/scripts/corpus.min.js index 1e303d633..87361abb3 100644 --- a/sites/all/modules/figli/edlp_corpus/assets/dist/scripts/corpus.min.js +++ b/sites/all/modules/figli/edlp_corpus/assets/dist/scripts/corpus.min.js @@ -18,8 +18,9 @@ Node.prototype.checkOriPDist=function(){if(this.p.distanceTo(this.ori_p)<50){thi Node.prototype.move=function(){_ctx.drawImage(this.canvas,this.x-this.w_2,this.y-this.w_2);};Node.prototype.redraw=function(){_ctx.beginPath();_ctx.fillStyle='rgb(255,255,255)';_ctx.fillRect(this.x-this.r,this.y-this.r,this.d,this.d);_ctx.globalAlpha=this.faded?0.15:1;if(this.opened){_ctx.fillStyle=_ecolors[this.e_color];_ctx.fillRect(this.x-this.r,this.y-this.r,this.d,this.d);} _ctx.strokeStyle=_ecolors[this.e_color];_ctx.strokeRect(this.x-this.r,this.y-this.r,this.d,this.d);_ctx.closePath();};Node.initialized=true;} this.init();};function checkParticulesCollisions(){if(check_parts_colid_tickw)continue;dy=na.p.position.y-nb.p.position.y;if(Math.abs(dy)>h)continue +check_parts_colid_tick=1;var na,nb,ma,mb,w,h,dx,dy,makeup,newVelX1,newVelY1,newVelX2,newVelY2,Smamb;for(var n=0,l=_nodes.length;n300){if(Math.random()>0.3)continue;}} +w=h=(na.r+nb.r);w=h+=4;dx=na.p.position.x-nb.p.position.x;if(Math.abs(dx)>w)continue;dy=na.p.position.y-nb.p.position.y;if(Math.abs(dy)>h)continue mb=nb.p.mass;Smamb=ma+mb;if(Math.abs(dx)0){na.p.position.y+=makeup;nb.p.position.y-=makeup;}else{na.p.position.y-=makeup;nb.p.position.y+=makeup;} newVelY1=(ma-mb)/Smamb*na.p.velocity.y+2*mb/Smamb*nb.p.velocity.y;newVelY2=(mb-ma)/Smamb*nb.p.velocity.y+2*ma/Smamb*na.p.velocity.y;na.p.velocity.y=newVelY1;nb.p.velocity.y=newVelY2;}else{makeup=(w-Math.abs(dx))/2;if(dx>0){na.p.position.x+=makeup;nb.p.position.x-=makeup;}else{na.p.position.x-=makeup;nb.p.position.x+=makeup;} newVelX1=(ma-mb)/Smamb*na.p.velocity.x+2*mb/Smamb*nb.p.velocity.x;newVelX2=(mb-ma)/Smamb*nb.p.velocity.x+2*ma/Smamb*na.p.velocity.x;na.p.velocity.x=newVelX1;nb.p.velocity.x=newVelX2;} diff --git a/sites/all/modules/figli/edlp_corpus/assets/scripts/corpus.js b/sites/all/modules/figli/edlp_corpus/assets/scripts/corpus.js index bbc990237..bcf263d17 100644 --- a/sites/all/modules/figli/edlp_corpus/assets/scripts/corpus.js +++ b/sites/all/modules/figli/edlp_corpus/assets/scripts/corpus.js @@ -624,7 +624,7 @@ // avoid colliding for scrambling nodes // avoid colliding for aside nodes // avoid colliding for centered nodes - if(na.scrambling || na.aside || na.center) continue; + if(na.scrambling || na.aside ) continue; //|| na.center ma = na.p.mass; @@ -636,13 +636,12 @@ if(nb.aside) continue; - // avoid impact between two centered particulses that comes to the center - // if(na.center && nb.center){ - // if(Math.min(na.p.distanceTo(_attracter), nb.p.distanceTo(_attracter)) > 300){ - // if( Math.random()>0.3 ) continue; - // } - // } + if(na.center && nb.center){ + if(Math.min(na.p.distanceTo(_attracter), nb.p.distanceTo(_attracter)) > 300){ + if( Math.random()>0.3 ) continue; + } + } w = h = (na.r+nb.r); // if(!na.aside && !nb.aside){