Commit 489063fa authored by TOUZE Francois's avatar TOUZE Francois
Browse files

fix bug in v-arc shape

parent 403aea7e
...@@ -107,12 +107,12 @@ export default { ...@@ -107,12 +107,12 @@ export default {
pourVoir: [], pourVoir: [],
xx: 5600, xx: 5600,
xy: 5500, xy: 5500,
x: 300, x: width/2,
y: 150, y: height/2,
maxDrift: 0, maxDrift: 0,
configKonva: { configKonva: {
width: width, //4*width, width: 2*width, //4*width,
height: 3*height //3*height height: 3*height //3*height
} }
...@@ -161,8 +161,11 @@ export default { ...@@ -161,8 +161,11 @@ export default {
}, },
MYcalculateCoordinates: function(eList) { MYcalculateCoordinates: function(eList) {
console.log("width/height: ",width,height)
this.maxDrift = this.$getMaxDrift(eList); this.maxDrift = this.$getMaxDrift(eList);
console.log("MAX: ",this.maxDrift)
let theta = 0; let theta = 0;
let alfa = 0; let alfa = 0;
...@@ -202,25 +205,29 @@ export default { ...@@ -202,25 +205,29 @@ export default {
if (e.type === 'bend') { if (e.type === 'bend') {
if (_.get(e,'parameters.B$angle.value')) { if (_.get(e,'parameters.B$angle.value')) {
// alfa est l'angle de la rotation et xcoor,ycoor le centre // alfa est l'angle de la rotation et xcoor,ycoor le centre
alfa = e.parameters.B$angle.value alfa = Math.abs(e.parameters.B$angle.value)
xcoor = driftGap*Math.sin(theta); xcoor = driftGap*Math.sin(theta);
ycoor = driftGap*Math.cos(theta); ycoor = driftGap*Math.cos(theta);
//theta = (theta+e.parameters.B$angle.value) % (2*Math.PI); //theta = (theta+e.parameters.B$angle.value) % (2*Math.PI);
} }
} }
//console.log("XY[",index,"] => x:",this.x,",y:",this.y,", theta:", theta,", alfa:",alfa) console.log("XY[",index,"] => x:",this.x,",y:",this.y,", theta:", theta,", alfa:",alfa)
array.push({x: this.x, y: this.y, theta: theta, ...e}); array.push({x: this.x, y: this.y, theta: theta, ...e});
this.pourVoir.push({eType: e.type, x: this.x, y: this.y, theta: theta, delta: driftGap}) this.pourVoir.push({eType: e.type, x: this.x, y: this.y, theta: theta, delta: driftGap})
}) })
// "bidouille" pour le tracé du dernier element // "bidouille" pour le tracé du dernier element
// and add the last value of eList // and add the last value of eList
this.x += driftGap*Math.cos(theta); if (eType === 'bend') {
this.y += driftGap*Math.sin(theta); this.x += xcoor*Math.cos(alfa)+ycoor*Math.sin(alfa)-xcoor;
this.y += xcoor*Math.sin(alfa)-ycoor*Math.cos(alfa)+ycoor;
} else {
this.x += driftGap*Math.cos(theta);
this.y += driftGap*Math.sin(theta);
}
this.pourVoir.push({eType: eType, x: this.x, y: this.y, theta: theta, delta: driftGap}) this.pourVoir.push({eType: eType, x: this.x, y: this.y, theta: theta, delta: driftGap})
return array; return array;
...@@ -314,7 +321,7 @@ export default { ...@@ -314,7 +321,7 @@ export default {
return this.$convertMeterToPixel(element.parameters.length.value); return this.$convertMeterToPixel(element.parameters.length.value);
} else if (_.has(element,'parameters.A$length.value') && _.has(element,'parameters.B$angle.value')) { } else if (_.has(element,'parameters.A$length.value') && _.has(element,'parameters.B$angle.value')) {
let long = element.parameters.A$length.value; let long = element.parameters.A$length.value;
let alfa = element.parameters.B$angle.value; let alfa = Math.abs(element.parameters.B$angle.value);
return this.$convertMeterToPixel(long/alfa); return this.$convertMeterToPixel(long/alfa);
} }
//else if (_.has(element, 'parameters.length.radius') && _.has(element, 'parameters.length.angle')) { //else if (_.has(element, 'parameters.length.radius') && _.has(element, 'parameters.length.angle')) {
...@@ -340,7 +347,7 @@ export default { ...@@ -340,7 +347,7 @@ export default {
const {x, y} = this.pourVoir[index]; const {x, y} = this.pourVoir[index];
const {x: nextX, y: nextY} = this.pourVoir[index + 1]; const {x: nextX, y: nextY} = this.pourVoir[index + 1];
//console.log("V-LINE[", index, "]:", x,y,nextX,nextY) console.log("V-LINE[", index, "]:", x,y,nextX,nextY)
const config = { const config = {
points: [x, y, nextX, nextY], points: [x, y, nextX, nextY],
...@@ -370,13 +377,13 @@ export default { ...@@ -370,13 +377,13 @@ export default {
// inutile const {x: nextX, y: nextY} = this.pourVoir[index + 1]; // inutile const {x: nextX, y: nextY} = this.pourVoir[index + 1];
let theta = this.pourVoir[index].theta; let theta = this.pourVoir[index].theta;
let angleDeg = 180*theta/Math.PI let angleDeg = 180*theta/Math.PI
//console.log("V-RECT[", index, "]:",xcoor,ycoor,theta) console.log("V-RECT[", index, "]:",xcoor,ycoor,theta)
let WIDTH = RECT_WIDTH; let WIDTH = RECT_WIDTH;
if (_.has(e,'parameters.length.value')) { if (_.has(e,'parameters.length.value')) {
WIDTH = this.$convertMeterToPixel(e.parameters.length.value); WIDTH = this.$convertMeterToPixel(e.parameters.length.value);
} }
//console.log("WIDTH[", index, "] => ", WIDTH) console.log("WIDTH[", index, "] => ", WIDTH)
let HEIGHT = RECT_HEIGHT/2 let HEIGHT = RECT_HEIGHT/2
...@@ -467,7 +474,7 @@ export default { ...@@ -467,7 +474,7 @@ export default {
const {x: xcoor, y: ycoor, delta: rho} = this.pourVoir[index]; const {x: xcoor, y: ycoor, delta: rho} = this.pourVoir[index];
let theta = this.pourVoir[index].theta; let theta = this.pourVoir[index].theta;
//console.log("V-OMEGA[", index, "]:",xcoor,ycoor,theta,rho) console.log("V-OMEGA[", index, "]:",xcoor,ycoor,theta,rho)
const config = { const config = {
x: xcoor - rho*Math.sin(theta), x: xcoor - rho*Math.sin(theta),
...@@ -487,8 +494,8 @@ export default { ...@@ -487,8 +494,8 @@ export default {
const {x: xcoor, y: ycoor, delta: rho} = this.pourVoir[index]; const {x: xcoor, y: ycoor, delta: rho} = this.pourVoir[index];
let theta = this.pourVoir[index].theta; let theta = this.pourVoir[index].theta;
let alfa = e.parameters.B$angle.value let alfa = Math.abs(e.parameters.B$angle.value)
//console.log("V-RAF[", index, "]:",xcoor,ycoor,theta,rho,alfa) console.log("V-RAF[", index, "]:",xcoor,ycoor,theta,rho,alfa)
const config = { const config = {
...@@ -511,6 +518,8 @@ export default { ...@@ -511,6 +518,8 @@ export default {
// pour debbug je trace un cercle jaune qui positionne le point image de la rotation // pour debbug je trace un cercle jaune qui positionne le point image de la rotation
const {x: xcoor, y: ycoor} = this.pourVoir[index+1]; const {x: xcoor, y: ycoor} = this.pourVoir[index+1];
console.log("V-OUT[", index, "]:",xcoor,ycoor)
const config = { const config = {
x: xcoor, x: xcoor,
y: ycoor, y: ycoor,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment