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 {
pourVoir: [],
xx: 5600,
xy: 5500,
x: 300,
y: 150,
x: width/2,
y: height/2,
maxDrift: 0,
configKonva: {
width: width, //4*width,
width: 2*width, //4*width,
height: 3*height //3*height
}
......@@ -161,8 +161,11 @@ export default {
},
MYcalculateCoordinates: function(eList) {
console.log("width/height: ",width,height)
this.maxDrift = this.$getMaxDrift(eList);
console.log("MAX: ",this.maxDrift)
let theta = 0;
let alfa = 0;
......@@ -202,25 +205,29 @@ export default {
if (e.type === 'bend') {
if (_.get(e,'parameters.B$angle.value')) {
// 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);
ycoor = driftGap*Math.cos(theta);
//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});
this.pourVoir.push({eType: e.type, x: this.x, y: this.y, theta: theta, delta: driftGap})
})
// "bidouille" pour le tracé du dernier element
// and add the last value of eList
this.x += driftGap*Math.cos(theta);
this.y += driftGap*Math.sin(theta);
if (eType === 'bend') {
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})
return array;
......@@ -314,7 +321,7 @@ export default {
return this.$convertMeterToPixel(element.parameters.length.value);
} else if (_.has(element,'parameters.A$length.value') && _.has(element,'parameters.B$angle.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);
}
//else if (_.has(element, 'parameters.length.radius') && _.has(element, 'parameters.length.angle')) {
......@@ -340,7 +347,7 @@ export default {
const {x, y} = this.pourVoir[index];
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 = {
points: [x, y, nextX, nextY],
......@@ -370,13 +377,13 @@ export default {
// inutile const {x: nextX, y: nextY} = this.pourVoir[index + 1];
let theta = this.pourVoir[index].theta;
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;
if (_.has(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
......@@ -467,7 +474,7 @@ export default {
const {x: xcoor, y: ycoor, delta: rho} = this.pourVoir[index];
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 = {
x: xcoor - rho*Math.sin(theta),
......@@ -487,8 +494,8 @@ export default {
const {x: xcoor, y: ycoor, delta: rho} = this.pourVoir[index];
let theta = this.pourVoir[index].theta;
let alfa = e.parameters.B$angle.value
//console.log("V-RAF[", index, "]:",xcoor,ycoor,theta,rho,alfa)
let alfa = Math.abs(e.parameters.B$angle.value)
console.log("V-RAF[", index, "]:",xcoor,ycoor,theta,rho,alfa)
const config = {
......@@ -511,6 +518,8 @@ export default {
// pour debbug je trace un cercle jaune qui positionne le point image de la rotation
const {x: xcoor, y: ycoor} = this.pourVoir[index+1];
console.log("V-OUT[", index, "]:",xcoor,ycoor)
const config = {
x: xcoor,
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