岔心 绘图代码调整

This commit is contained in:
joylink_cuiweidong 2021-01-13 17:53:51 +08:00
parent 752b4e9a26
commit 7ac59f6006

View File

@ -57,16 +57,17 @@ export default class ELines extends Group {
const triangleB = new JTriangle(startPointB, endPointB);
let lineDirect = 1;
if (triangleA.getRotation() > 0) { lineDirect = -1; } else { lineDirect = 1; }
const new1Point1 = {x:startPointA.x - lineDirect * offset * triangleA.getSinRate(), y:startPointA.y - offset * triangleA.getCosRate()};
const new1Point2 = {x:startPointA.x + lineDirect * offset * triangleA.getSinRate(), y:startPointA.y + offset * triangleA.getCosRate()};
const new2Point1 = {x:endPointA.x - lineDirect * offset * triangleA.getSinRate(), y:endPointA.y - offset * triangleA.getCosRate()};
const new2Point2 = {x:endPointA.x + lineDirect * offset * triangleA.getSinRate(), y:endPointA.y + offset * triangleA.getCosRate()};
// - offset * triangleA.getCosRate()
const new1Point1 = {x:startPointA.x - lineDirect * offset / triangleA.getSinRate(), y:startPointA.y };
const new1Point2 = {x:startPointA.x + lineDirect * offset / triangleA.getSinRate(), y:startPointA.y};
const new2Point1 = {x:endPointA.x - lineDirect * offset / triangleA.getSinRate(), y:endPointA.y };
const new2Point2 = {x:endPointA.x + lineDirect * offset / triangleA.getSinRate(), y:endPointA.y};
if (triangleB.getRotation() > 0) { lineDirect = -1; } else { lineDirect = 1; }
const new3Point1 = {x:startPointB.x + lineDirect * offset * triangleB.getSinRate(), y:startPointB.y + offset * triangleB.getCosRate()};
const new3Point2 = {x:startPointB.x - lineDirect * offset * triangleB.getSinRate(), y:startPointB.y - offset * triangleB.getCosRate()};
const new4Point1 = {x:endPointB.x + lineDirect * offset * triangleB.getSinRate(), y:endPointB.y + offset * triangleB.getCosRate()};
const new4Point2 = {x:endPointB.x - lineDirect * offset * triangleB.getSinRate(), y:endPointB.y - offset * triangleB.getCosRate()};
const new3Point1 = {x:startPointB.x + lineDirect * offset / triangleB.getSinRate(), y:startPointB.y};
const new3Point2 = {x:startPointB.x - lineDirect * offset / triangleB.getSinRate(), y:startPointB.y};
const new4Point1 = {x:endPointB.x + lineDirect * offset / triangleB.getSinRate(), y:endPointB.y};
const new4Point2 = {x:endPointB.x - lineDirect * offset / triangleB.getSinRate(), y:endPointB.y};
// getCosRate
// getSinRate
const point1 = segmentsIntr(new1Point1, new2Point1, new3Point2, new4Point2);