in src/engine/tools23d/mprrenderer.js [342:479]
updateControlLines() {
this.clearControlLines();
const SHIFT_MUL = 7;
const horShift = SHIFT_MUL * this.m_vertLineWidth; // this is correct, not a typo or mis-anything
const vertShift = SHIFT_MUL * this.m_horLineWidth;
// lines on Z
const xCenterOnZ =
this.m_projectionRect[PROJECTION_Z].xMin +
this.m_sliceRatio[PROJECTION_X] * (this.m_projectionRect[PROJECTION_Z].xMax - this.m_projectionRect[PROJECTION_Z].xMin);
const yCenterOnZ =
this.m_projectionRect[PROJECTION_Z].yMin +
this.m_sliceRatio[PROJECTION_Y] * (this.m_projectionRect[PROJECTION_Z].yMax - this.m_projectionRect[PROJECTION_Z].yMin);
// blue X projection line on Z projection
this.m_linesXOnZ = [
new Line2D(
this.m_scene,
this.m_vertLineWidth,
xCenterOnZ,
this.m_projectionRect[PROJECTION_Z].yMax,
xCenterOnZ,
yCenterOnZ + vertShift,
this.m_materialLineBlue
),
new Line2D(
this.m_scene,
this.m_vertLineWidth,
xCenterOnZ,
yCenterOnZ - vertShift,
xCenterOnZ,
this.m_projectionRect[PROJECTION_Z].yMin,
this.m_materialLineBlue
),
];
// green Y projection line on Z projection
this.m_linesYOnZ = [
new Line2D(
this.m_scene,
this.m_horLineWidth,
this.m_projectionRect[PROJECTION_Z].xMin,
yCenterOnZ,
xCenterOnZ - horShift,
yCenterOnZ,
this.m_materialLineGreen
),
new Line2D(
this.m_scene,
this.m_horLineWidth,
xCenterOnZ + horShift,
yCenterOnZ,
this.m_projectionRect[PROJECTION_Z].xMax,
yCenterOnZ,
this.m_materialLineGreen
),
];
this.m_controlPoint[PROJECTION_Z].x = xCenterOnZ;
this.m_controlPoint[PROJECTION_Z].y = yCenterOnZ;
// lines on Y
const xCenterOnY =
this.m_projectionRect[PROJECTION_Y].xMin +
this.m_sliceRatio[PROJECTION_X] * (this.m_projectionRect[PROJECTION_Y].xMax - this.m_projectionRect[PROJECTION_Y].xMin);
const yCenterOnY =
this.m_projectionRect[PROJECTION_Y].yMin +
this.m_sliceRatio[PROJECTION_Z] * (this.m_projectionRect[PROJECTION_Y].yMax - this.m_projectionRect[PROJECTION_Y].yMin);
// blue X projection line on Y projection
this.m_linesXOnY = [
new Line2D(
this.m_scene,
this.m_vertLineWidth,
xCenterOnY,
this.m_projectionRect[PROJECTION_Y].yMax,
xCenterOnY,
yCenterOnY + vertShift,
this.m_materialLineBlue
),
new Line2D(
this.m_scene,
this.m_vertLineWidth,
xCenterOnY,
yCenterOnY - vertShift,
xCenterOnY,
this.m_projectionRect[PROJECTION_Y].yMin,
this.m_materialLineBlue
),
];
this.m_controlLineXOnY = new Line2D(
this.m_scene,
this.m_vertLineWidth,
xCenterOnY,
yCenterOnY + this.m_yControlShift,
xCenterOnY,
yCenterOnY - this.m_yControlShift,
this.m_materialLineBlue
);
this.m_controlPoint[PROJECTION_Y].x = xCenterOnY;
this.m_controlPoint[PROJECTION_Y].y = yCenterOnY;
// lines on X
const xCenterOnX =
this.m_projectionRect[PROJECTION_X].xMin +
this.m_sliceRatio[PROJECTION_Y] * (this.m_projectionRect[PROJECTION_X].xMax - this.m_projectionRect[PROJECTION_X].xMin);
const yCenterOnX =
this.m_projectionRect[PROJECTION_X].yMin +
this.m_sliceRatio[PROJECTION_Z] * (this.m_projectionRect[PROJECTION_X].yMax - this.m_projectionRect[PROJECTION_X].yMin);
// green Y projection line on X projection
this.m_linesYOnX = [
new Line2D(
this.m_scene,
this.m_vertLineWidth,
xCenterOnX,
this.m_projectionRect[PROJECTION_X].yMax,
xCenterOnX,
yCenterOnX + vertShift,
this.m_materialLineGreen
),
new Line2D(
this.m_scene,
this.m_vertLineWidth,
xCenterOnX,
yCenterOnX - vertShift,
xCenterOnX,
this.m_projectionRect[PROJECTION_X].yMin,
this.m_materialLineGreen
),
];
this.m_controlLineYOnX = new Line2D(
this.m_scene,
this.m_vertLineWidth,
xCenterOnX,
yCenterOnX - this.m_yControlShift,
xCenterOnX,
yCenterOnX + this.m_yControlShift,
this.m_materialLineGreen
);
this.m_controlPoint[PROJECTION_X].x = xCenterOnX;
this.m_controlPoint[PROJECTION_X].y = yCenterOnX;
}