Commit 738e7eaa authored by GoshaZotov's avatar GoshaZotov

draw verges without rotation(3d hbar)

parent dea06aa1
......@@ -333,7 +333,7 @@ Processor3D.prototype.calculateZPositionCatAxis = function()
//***functions for complete transformation point***
Processor3D.prototype.convertAndTurnPoint = function(x, y, z, isNotProject)
Processor3D.prototype.convertAndTurnPoint = function(x, y, z, isNScale, isNRotate, isNProject)
{
var res = null;
......@@ -343,7 +343,7 @@ Processor3D.prototype.convertAndTurnPoint = function(x, y, z, isNotProject)
}
else
{
res = this.convertAndTurnPointPerspective(x, y, z, isNotProject);
res = this.convertAndTurnPointPerspective(x, y, z, isNScale, isNRotate, isNProject);
}
return res;
......@@ -408,49 +408,68 @@ Processor3D.prototype.convertAndTurnPointRAngAx = function(x, y, z)
return {x: projectionPoint.x, y: projectionPoint.y, z: z};
};
Processor3D.prototype.convertAndTurnPointPerspective = function(x, y, z, isNotProject)
Processor3D.prototype.convertAndTurnPointPerspective = function(x, y, z, isNScale, isNRotate, isNProject)
{
//aspectRatio
x = x / this.aspectRatioX;
y = y / this.aspectRatioY;
x = x / this.scaleX;
y = y / this.scaleY;
z = z / this.scaleZ;
var point3D = new Point3D(x, y, z, this);
//diff
var centerZDiff = this.depthPerspective / 2;
if(!isNScale)
{
this.scale(point3D);
}
point3D.offset((-this.widthCanvas / 2) / this.aspectRatioX, (-this.heightCanvas / 2) / this.aspectRatioY /** aspectRatio*/, 0);
if(!isNRotate)
{
this.rotate1(point3D);
}
if(!isNProject)
{
this.project1(point3D);
}
return {x: point3D.x, y: point3D.y, z: point3D.z};
};
Processor3D.prototype.scale = function(point3D)
{
//aspectRatio
point3D.x = point3D.x / this.aspectRatioX;
point3D.y = point3D.y / this.aspectRatioY;
point3D.x = point3D.x / this.scaleX;
point3D.y = point3D.y / this.scaleY;
point3D.z = point3D.z / this.scaleZ;
},
Processor3D.prototype.rotate1 = function(point3D)
{
//diff
point3D.offset((-this.widthCanvas / 2) / this.aspectRatioX, (-this.heightCanvas / 2) / this.aspectRatioY, 0);
//rotate
var matrixRotateAllAxis;
if(!this.view3D.rAngAx)
matrixRotateAllAxis = this._getMatrixRotateAllAxis();
else
matrixRotateAllAxis = this._shearXY();
var matrixRotateAllAxis = this._getMatrixRotateAllAxis();
point3D.multiplyPointOnMatrix1(matrixRotateAllAxis);
point3D.offset((this.widthCanvas / 2) / this.aspectRatioX, (this.heightCanvas / 2) / this.aspectRatioY, 0);
};
Processor3D.prototype.project1 = function(point3D)
{
//diff
point3D.offset((-this.widthCanvas / 2) / this.aspectRatioX, (-this.heightCanvas / 2) / this.aspectRatioY /** aspectRatio*/, 0);
// diff camera for charts write into rect
point3D.offset(this.cameraDiffX, this.cameraDiffY, this.cameraDiffZ);
//project
var projectionPoint = point3D;
if(!this.view3D.rAngAx && !isNotProject)
{
var projectiveMatrix = this._getPerspectiveProjectionMatrix(1 / (this.rPerspective));
projectionPoint = point3D.project(projectiveMatrix);
}
var projectiveMatrix = this._getPerspectiveProjectionMatrix(1 / (this.rPerspective));
point3D.project(projectiveMatrix);
//undiff
var specialReverseDiffX = this.widthCanvas / 2 + (this.left - this.right) / 2;
var specialReverseDiffY = this.heightCanvas / 2 + (this.top - this.bottom) / 2;
projectionPoint.offset(specialReverseDiffX, specialReverseDiffY, centerZDiff);
return {x: projectionPoint.x, y: projectionPoint.y, z: projectionPoint.z};
point3D.offset(specialReverseDiffX, specialReverseDiffY, 0);
};
//functions for step transformation point
......
......@@ -2224,9 +2224,9 @@ CChartsDrawer.prototype =
this.processor3D.correctPointsPosition(chartSpace);
},
_convertAndTurnPoint: function(x, y, z, isNProject)
_convertAndTurnPoint: function(x, y, z, isNScale, isNRotate, isNProject)
{
return this.processor3D.convertAndTurnPoint(x, y, z, isNProject);
return this.processor3D.convertAndTurnPoint(x, y, z, isNScale, isNRotate, isNProject);
},
//position of catAx labels(left or right) - returns false(left of axis)/true(right of axis) or null(standard position)
......@@ -2709,7 +2709,7 @@ CChartsDrawer.prototype =
{
res = true;
}
else if(isPerspective && (isBar || isLine))
else if(isPerspective && (isBar || isLine|| isHBar))
{
res = true;
}
......@@ -6046,6 +6046,41 @@ drawHBarChart.prototype =
DiffGapDepth = perspectiveDepth * (gapDepth / 2) / 100;
}
//уравнение плоскости
var getPlainEquation = function(point1, point2, point3, point4)
{
var x1 = point1.x, y1 = point1.y, z1 = point1.z;
var x2 = point2.x, y2 = point2.y, z2 = point2.z;
var x3 = point3.x, y3 = point3.y, z3 = point3.z;
var x21 = x2 - x1;
var y21 = y2 - y1;
var z21 = z2 - z1;
var x31 = x3 - x1;
var y31 = y3 - y1;
var z31 = z3 - z1;
//(x - x1)*(y21 * z31 - x21 * y31) - (y - y1)*(x21 * z31 - z21 * x31) + (z - z1)(x21 * y31 - y21 * x31)
var tempA = y21 * z31 - z21 * y31;
var tempB = x21 * z31 - z21 * x31;
var tempC = x21 * y31 - y21 * x31;
//(x - x1)*(tempA) - (y - y1)*(tempB) + (z - z1)(tempC)
//x * tempA - x1 * tempA - y * tempB + y1 * tempB + z * tempC - z1 * tempC
var a = tempA;
var b = tempB;
var c = tempC;
var d = y1 * tempB - x1 * tempA - z1 * tempC;
return {a: a, b: b, c: c, d: d};
};
for (var i = 0; i < this.chartProp.series.length; i++)
{
numCache = this.chartProp.series[i].val.numRef ? this.chartProp.series[i].val.numRef.numCache : this.chartProp.series[i].val.numLit;
......@@ -6143,7 +6178,6 @@ drawHBarChart.prototype =
x7 = newStartX + width, y7 = newStartY + individualBarHeight, z7 = perspectiveDepth + DiffGapDepth;
x8 = newStartX + width, y8 = newStartY + individualBarHeight, z8 = DiffGapDepth;
//поворот относительно осей
point1 = this.cChartDrawer._convertAndTurnPoint(x1, y1, z1);
point2 = this.cChartDrawer._convertAndTurnPoint(x2, y2, z2);
......@@ -6155,137 +6189,20 @@ drawHBarChart.prototype =
point8 = this.cChartDrawer._convertAndTurnPoint(x8, y8, z8);
//не проецируем на плоскость
var point11 = this.cChartDrawer._convertAndTurnPoint(x1, y1, z1, true);
var point22 = this.cChartDrawer._convertAndTurnPoint(x2, y2, z2, true);
var point33 = this.cChartDrawer._convertAndTurnPoint(x3, y3, z3, true);
var point44 = this.cChartDrawer._convertAndTurnPoint(x4, y4, z4, true);
var point55 = this.cChartDrawer._convertAndTurnPoint(x5, y5, z5, true);
var point66 = this.cChartDrawer._convertAndTurnPoint(x6, y6, z6, true);
var point77 = this.cChartDrawer._convertAndTurnPoint(x7, y7, z7, true);
var point88 = this.cChartDrawer._convertAndTurnPoint(x8, y8, z8, true);
var point11 = this.cChartDrawer._convertAndTurnPoint(x1, y1, z1, null, null, true);
var point22 = this.cChartDrawer._convertAndTurnPoint(x2, y2, z2, null, null, true);
var point33 = this.cChartDrawer._convertAndTurnPoint(x3, y3, z3, null, null, true);
var point44 = this.cChartDrawer._convertAndTurnPoint(x4, y4, z4, null, null, true);
var point55 = this.cChartDrawer._convertAndTurnPoint(x5, y5, z5, null, null, true);
var point66 = this.cChartDrawer._convertAndTurnPoint(x6, y6, z6, null, null, true);
var point77 = this.cChartDrawer._convertAndTurnPoint(x7, y7, z7, null, null, true);
var point88 = this.cChartDrawer._convertAndTurnPoint(x8, y8, z8, null, null, true);
paths = this.cChartDrawer.calculateRect3D(point1, point2, point3, point4, point5, point6, point7, point8, val);
//расскомментируем, чтобы включить старую схему отрисовки(+ переименовать функции _DrawBars3D -> _DrawBars3D2)
//this.sortZIndexPaths.push({seria: i, point: idx, paths: paths, x: point1.x, y: point1.y, zIndex: point1.z});
//width = this.chartProp.widthCanvas - this.chartProp.chartGutter._left - this.chartProp.chartGutter._right;
//TODO delete after unused code
var calculateDistance = function(point1, point2)
{
var res = Math.sqrt(Math.pow(point2.x - point1.x , 2) + Math.pow(point2.y - point1.y , 2) + Math.pow(point2.z - point1.z , 2));
return res;
};
var getMinPoint = function(point1, point2, point3, point4)
{
var arrPoints = [point1, point2, point3, point4];
var minPoint = null;
for(var i = 0; i < arrPoints.length; i++)
{
if(null === minPoint)
{
minPoint = arrPoints[i];
}
else
{
if(arrPoints[i].z > minPoint.z)
{
minPoint = arrPoints[i];
}
}
}
return minPoint;
};
var getMidPoint = function(point1, point2, point3, point4)
{
var res = (point1.z + point2.z + point3.z ) / 3;
return res;
};
var widthScreen = this.chartProp.widthCanvas - this.chartProp.chartGutter._right;
var centralViewPoint = {x: widthScreen / 2, y: heightGraph + this.chartProp.chartGutter._bottom, z: 0};
//уравнение плоскости
var getPlainEquation2 = function(point1, point2, point3, point4)
{
var x0 = point1.x, y0 = point1.y, z0 = point1.z;
var x1 = point2.x, y1 = point2.y, z1 = point2.z;
var x2 = point3.x, y1 = point3.y, z1 = point3.z;
var tempA = ((y1 - y0) * (z2 - z0) - (y2 - y0) * (z1 - z0));
var tempB = ((x1 - x0) * (z2 - z0) - (x2 - x0) * (z1 - z0));
var tempC = ((x1 - x0) * (y2 - y0) - (x2 - x0) * (y1 - y0));
/*(x - x0) * tempA - (y - y0) * tempB + (z - z0) * tempC = 0;
x * tempA - x0 * tempA - y * tempB + y0 * tempB + z * tempC - z0 * tempC = 0;
x * tempA - y * tempB + z * tempC + (y0 * tempB - x0 * tempA - z0 * tempC)*/
var a = tempA;
var b = tempB;
var c = tempC;
var d = y0 * tempB - x0 * tempA - z0 * tempC;
var test1 = a * point1.x + b * point1.y + c * point1.z + d;
var test2 = a * point2.x + b * point2.y + c * point2.z + d
var test3 = a * point3.x + b * point3.y + c * point3.z + d
var test4 = a * point4.x + b * point4.y + c * point4.z + d
if(!(test1 === 0 && test2 === 0 && test3 === 0 && test4 === 0))
{
console.log("asd");
}
return {a: a, b: b, c: c, d: d};
};
//уравнение плоскости
var getPlainEquation = function(point1, point2, point3, point4)
{
var x1 = point1.x, y1 = point1.y, z1 = point1.z;
var x2 = point2.x, y2 = point2.y, z2 = point2.z;
var x3 = point3.x, y3 = point3.y, z3 = point3.z;
var x21 = x2 - x1;
var y21 = y2 - y1;
var z21 = z2 - z1;
var x31 = x3 - x1;
var y31 = y3 - y1;
var z31 = z3 - z1;
/*
(x - x1)*(y21 * z31 - x21 * y31) - (y - y1)*(x21 * z31 - z21 * x31) + (z - z1)(x21 * y31 - y21 * x31)
*/
var tempA = y21 * z31 - z21 * y31;
var tempB = x21 * z31 - z21 * x31;
var tempC = x21 * y31 - y21 * x31;
/*(x - x1)*(tempA) - (y - y1)*(tempB) + (z - z1)(tempC)
x * tempA - x1 * tempA - y * tempB + y1 * tempB + z * tempC - z1 * tempC*/
var a = tempA;
var b = tempB;
var c = tempC;
var d = y1 * tempB - x1 * tempA - z1 * tempC;
return {a: a, b: b, c: c, d: d};
};
var centralViewPoint = {x: widthScreen / 2, y: heightGraph + this.chartProp.chartGutter._bottom, z: 0};
......@@ -6298,58 +6215,23 @@ drawHBarChart.prototype =
var plainEquations = [plainEquation1, plainEquation2, plainEquation3, plainEquation4, plainEquation5, plainEquation6];
var tempWidth = width /*< 0 ? -50 : 50*/;
var controlPoint1 = this.cChartDrawer._convertAndTurnPoint(x5 + tempWidth / 2, y5 - individualBarHeight / 2, z5);
var controlPoint2 = this.cChartDrawer._convertAndTurnPoint(x5 + tempWidth / 2, y5, z5 + perspectiveDepth / 2);
var controlPoint3 = this.cChartDrawer._convertAndTurnPoint(x5, y5 - individualBarHeight / 2, z5 + perspectiveDepth / 2);
var controlPoint4 = this.cChartDrawer._convertAndTurnPoint(x8, y8 - individualBarHeight / 2, z8 + perspectiveDepth / 2);
var controlPoint5 = this.cChartDrawer._convertAndTurnPoint(x1 + tempWidth / 2 , y1, z1 + perspectiveDepth / 2);
var controlPoint6 = this.cChartDrawer._convertAndTurnPoint(x6 + tempWidth / 2 , y6 - individualBarHeight / 2, z6);
var distance0 = calculateDistance(centralViewPoint, controlPoint1);
var distance1 = calculateDistance(centralViewPoint, controlPoint2);
var distance2 = calculateDistance(centralViewPoint, controlPoint3);
var distance3 = calculateDistance(centralViewPoint, controlPoint4);
var distance4 = calculateDistance(centralViewPoint, controlPoint5);
var distance5 = calculateDistance(centralViewPoint, controlPoint6);
var midPoint0 = getMidPoint(point1, point4, point8, point5);
var midPoint1 = getMidPoint(point1, point2, point3, point4);
var midPoint2 = getMidPoint(point1, point2, point6, point5);
var midPoint3 = getMidPoint(point4, point8, point7, point3);
var midPoint4 = getMidPoint(point5, point6, point7, point8);
var midPoint5 = getMidPoint(point6, point2, point3, point7);
var midPaths = [midPoint0, midPoint1, midPoint2, midPoint3, midPoint4, midPoint5];
var testPoint0 = getMinPoint(point1, point4, point8, point5);
var testPoint1 = getMinPoint(point1, point2, point3, point4);
var testPoint2 = getMinPoint(point1, point2, point6, point5);
var testPoint3 = getMinPoint(point4, point8, point7, point3);
var testPoint4 = getMinPoint(point5, point6, point7, point8);
var testPoint5 = getMinPoint(point6, point2, point3, point7);
var testPaths = [testPoint0, testPoint1, testPoint2, testPoint3, testPoint4, testPoint5];
var arrPoints = [[point1, point4, point8, point5], [point1, point2, point3, point4], [point1, point2, point6, point5], [point4, point8, point7, point3], [point5, point6, point7, point8], [point6, point2, point3, point7]];
var arrPoints2 = [[point11, point44, point88, point55], [point11, point22, point33, point44], [point11, point22, point66, point55], [point44, point88, point77, point33], [point55, point66, point77, point88], [point66, point22, point33, point77]];
var sortPaths = [controlPoint1, controlPoint2, controlPoint3, controlPoint4, controlPoint5, controlPoint6];
var distancePaths = [distance0, distance1, distance2, distance3, distance4, distance5];
for(var k = 0; k < paths.length; k++)
{
if(!(k == 0 || k == 4))
{
continue;
}
if(null === paths[k])
continue;
var zIndex = midPaths[k];
this.sortZIndexPaths.push({seria: i, point: idx, verge: k, paths: paths[k], x: sortPaths[k].x, y: sortPaths[k].y, zIndex: zIndex, points: arrPoints2[k], points2: arrPoints[k], plainEquation: plainEquations[k]});
this.sortZIndexPaths.push({seria: i, point: idx, verge: k, paths: paths[k], points: arrPoints2[k], points2: arrPoints[k], plainEquation: plainEquations[k]});
}
}
else
......@@ -6383,8 +6265,9 @@ drawHBarChart.prototype =
{
var heightGraph = this.chartProp.heightCanvas - this.chartProp.chartGutter._top - this.chartProp.chartGutter._bottom;
var widthScreen = this.chartProp.widthCanvas - this.chartProp.chartGutter._right;
var centralViewPoint = {x: widthScreen / 2 - this.cChartDrawer.processor3D.cameraDiffX, y: heightGraph / 2 + this.chartProp.chartGutter._bottom, z: -this.cChartDrawer.processor3D.cameraDiffZ};
var centralViewPoint = {x: this.chartProp.widthCanvas / 2, y: this.chartProp.heightCanvas / 2, z: this.cChartDrawer.processor3D.cameraDiffZ - 500};
var firstVerges = [];
var lastVerges = [];
......@@ -6577,9 +6460,9 @@ drawHBarChart.prototype =
{
//длины сторон
var a = Math.sqrt(Math.pow(point3.x - point0.x, 2) + Math.pow(point3.y - point0.y, 2));
var b = Math.sqrt(Math.pow(point1.x - point0.x, 2) + Math.pow(point1.x - point0.x, 2));
var c = Math.sqrt(Math.pow(point2.x - point1.x, 2) + Math.pow(point2.x - point1.x, 2));
var d = Math.sqrt(Math.pow(point3.x - point2.x, 2) + Math.pow(point3.x - point2.x, 2));
var b = Math.sqrt(Math.pow(point1.x - point0.x, 2) + Math.pow(point1.y - point0.y, 2));
var c = Math.sqrt(Math.pow(point2.x - point1.x, 2) + Math.pow(point2.y - point1.y, 2));
var d = Math.sqrt(Math.pow(point3.x - point2.x, 2) + Math.pow(point3.y - point2.y, 2));
//длины диагоналей
var e = Math.sqrt(Math.pow(point3.x - point1.x, 2) + Math.pow(point3.y - point1.y, 2));
......@@ -6598,8 +6481,8 @@ drawHBarChart.prototype =
{
//длины сторон
var a = Math.sqrt(Math.pow(point1.x - point0.x, 2) + Math.pow(point1.y - point0.y, 2));
var b = Math.sqrt(Math.pow(point2.x - point1.x, 2) + Math.pow(point2.x - point1.x, 2));
var c = Math.sqrt(Math.pow(point2.x - point0.x, 2) + Math.pow(point2.x - point0.x, 2));
var b = Math.sqrt(Math.pow(point2.x - point1.x, 2) + Math.pow(point2.y - point1.y, 2));
var c = Math.sqrt(Math.pow(point2.x - point0.x, 2) + Math.pow(point2.y - point0.y, 2));
//полупериметр
var p = (a + b + c ) / 2;
......@@ -6610,75 +6493,83 @@ drawHBarChart.prototype =
};
var t = this;
var isNotIntersectionVergesAndLine = function(lineEqucation, pointFromVerge)
var isNotIntersectionVergesAndLine = function(lineEqucation, pointFromVerge, i, j)
{
var res = true;
for(var k = 0; k < t.sortZIndexPaths.length; k++)
{
var plainEqucation = t.sortZIndexPaths[k].plainEquation;
/*if(k !== 0)
continue;*/
var plainEqucation = t.sortZIndexPaths[k].plainEquation;
var nIntersectionPlainAndLine = isIntersectionPlainAndLine(plainEqucation ,lineEqucation);
var intersectionPoint = t.cChartDrawer._convertAndTurnPoint(nIntersectionPlainAndLine.x, nIntersectionPlainAndLine.y, nIntersectionPlainAndLine.z, true, true);
//console.log("x: " + intersectionPoint.x + " ;y: " + intersectionPoint.y);
if(null !== nIntersectionPlainAndLine && nIntersectionPlainAndLine.z < pointFromVerge.z)
{
var minMaxpoints = getMinMaxPoints(t.sortZIndexPaths[k].points2);
var minX = minMaxpoints.minX, maxX = minMaxpoints.maxX, minY = minMaxpoints.minY, maxY = minMaxpoints.maxY, minZ = minMaxpoints.minZ, maxZ = minMaxpoints.maxZ;
var point0 = t.sortZIndexPaths[k].points2[0];
var point1 = t.sortZIndexPaths[k].points2[1];
var point2 = t.sortZIndexPaths[k].points2[2];
var point3 = t.sortZIndexPaths[k].points2[3];
//уравнения прямых, отсекающих плоскость
/*var line1 = getEquationLineOnPlane(t.sortZIndexPaths[k].points[0], t.sortZIndexPaths[k].points[1]);//left
var line2 = getEquationLineOnPlane(t.sortZIndexPaths[k].points[1], t.sortZIndexPaths[k].points[2]);//bottom
var line3 = getEquationLineOnPlane(t.sortZIndexPaths[k].points[2], t.sortZIndexPaths[k].points[3]);//right
var line4 = getEquationLineOnPlane(t.sortZIndexPaths[k].points[3], t.sortZIndexPaths[k].points[0]);//top*/
var convertnIntersectionPlainAndLine = t.cChartDrawer._convertAndTurnPoint(nIntersectionPlainAndLine.x, nIntersectionPlainAndLine.y, nIntersectionPlainAndLine.z, true);
var x = convertnIntersectionPlainAndLine.x;
var y = convertnIntersectionPlainAndLine.y;
var areaQuadrilateral = getAreaQuadrilateral(point0, point1, point2, point3);
var areaTriangle1 = getAreaTriangle(point0, intersectionPoint, point1);
var areaTriangle2 = getAreaTriangle(point1, intersectionPoint, point2);
var areaTriangle3 = getAreaTriangle(point2, intersectionPoint, point3);
var areaTriangle4 = getAreaTriangle(point3, intersectionPoint, point0);
if(x > minX && x < maxX && y > minY && y < maxY /*&& z > minZ && z < maxZ*/)
if(parseInt(areaQuadrilateral) === parseInt(areaTriangle1 + areaTriangle2 + areaTriangle3 + areaTriangle4))
{
console.log("x: " + x + " ;y: " + y);
console.log("x: " + intersectionPoint.x + " ;y: " + intersectionPoint.y);
res = false;
break;
/*if(y < line2.a * x + line2.b && y > line4.a * x + line4.b && x > (y - line1.b) / line1.a && x < (y - line3.b) / line3.a)
{
console.log("x: " + x + " ;y: " + y);
res = false;
break;
}*/
}
/*if(nIntersectionPlainAndLine.x > minX && nIntersectionPlainAndLine.x < maxX && nIntersectionPlainAndLine.y > minY && nIntersectionPlainAndLine.y < maxY && nIntersectionPlainAndLine.z > minZ && nIntersectionPlainAndLine.z < maxZ)
{
res = false;
break;
}*/
}
}
return res;
};
var isIntersectionVergePointsLinesWithAnotherVerges = function(plainVerge, centralViewPoint)
var lineArray = [];
var isIntersectionVergePointsLinesWithAnotherVerges = function(plainVerge, centralViewPoint, i)
{
var res = true;
for(var j = 0; j < plainVerge.points.length; j++)
{
/*if(j !== 1)
{
continue;
}*/
var pointFromVerge = plainVerge.points[j];
//centralViewPoint.y = pointFromVerge.y;
centralViewPoint.x = pointFromVerge.x;
//centralViewPoint.x = pointFromVerge.x;
var lineEqucation = getLineEquation(pointFromVerge, centralViewPoint);
/*var testPoint = new Point3D(pointFromVerge.x, pointFromVerge.y, pointFromVerge.z, this);
var projectiveMatrix = t.cChartDrawer.processor3D._getPerspectiveProjectionMatrix(1 / (t.cChartDrawer.processor3D.rPerspective));
var testPoint = testPoint.project(projectiveMatrix);*/
var point1 = t.cChartDrawer._convertAndTurnPoint(pointFromVerge.x, pointFromVerge.y, pointFromVerge.z, true, true, null);
var point2 = centralViewPoint/*t.cChartDrawer._convertAndTurnPoint(centralViewPoint.x, centralViewPoint.y, centralViewPoint.z)*/;
var paths = t._calculateLine(point1.x, point1.y, point2.x, point2.y);
//lineArray.push({paths: paths});
//пересечение грани и прямой
var isFirstVerge = isNotIntersectionVergesAndLine(lineEqucation, pointFromVerge);
var isFirstVerge = isNotIntersectionVergesAndLine(lineEqucation, pointFromVerge, i, j);
if(false === isFirstVerge)
{
......@@ -6695,9 +6586,14 @@ drawHBarChart.prototype =
//перебираем все грани
for(var i = 0; i < this.sortZIndexPaths.length; i++)
{
var plainVerge = this.sortZIndexPaths[i];
var isFirstVerge = isIntersectionVergePointsLinesWithAnotherVerges(plainVerge, centralViewPoint);
/*if(i === 3)
{
var isFirstVerge = isIntersectionVergePointsLinesWithAnotherVerges(plainVerge, centralViewPoint, i);
}*/
var isFirstVerge = isIntersectionVergePointsLinesWithAnotherVerges(plainVerge, centralViewPoint, i);
//push into array
if(isFirstVerge)
{
......@@ -6708,21 +6604,37 @@ drawHBarChart.prototype =
lastVerges.push(this.sortZIndexPaths[i]);
}
}
this.sortZIndexPaths = lastVerges.concat(firstVerges);
this.sortZIndexPaths = this.sortZIndexPaths.concat(lineArray);
},
_calculateLine : function(x, y, x1, y1)
{
var pxToMm = this.chartProp.pxToMM;
var path = new Path();
var pathH = this.chartProp.pathH;
var pathW = this.chartProp.pathW;
var gdLst = [];
path.pathH = pathH;
path.pathW = pathW;
gdLst["w"] = 1;
gdLst["h"] = 1;
path.moveTo(x / pxToMm * pathW, y / pxToMm * pathH);
path.lnTo(x1 / pxToMm * pathW, y1 / pxToMm * pathH);
path.recalculate(gdLst);
/*this.sortZIndexPaths.sort(function sortArr(a, b)
{
if(b.zIndex == a.zIndex)
return a.x - b.x;
else
return b.zIndex - a.zIndex;
});*/
return path;
},
_getOptionsForDrawing: function(ser, point, onlyLessNull)
......@@ -7156,7 +7068,21 @@ drawHBarChart.prototype =
for(var i = 0; i < this.sortZIndexPaths.length; i++)
{
drawVerges(this.sortZIndexPaths[i].seria, this.sortZIndexPaths[i].point, this.sortZIndexPaths[i].paths, null, this.sortZIndexPaths[i].verge);
if(this.sortZIndexPaths[i].seria !== undefined)
{
drawVerges(this.sortZIndexPaths[i].seria, this.sortZIndexPaths[i].point, this.sortZIndexPaths[i].paths, null, this.sortZIndexPaths[i].verge);
}
else
{
//if(options !== null)
//{
var pen = t.cChartSpace.chart.plotArea.valAx.compiledMajorGridLines;
var brush = null;
this.cChartDrawer.drawPath(this.sortZIndexPaths[i].paths, pen, brush);
//}
}
}
},
......@@ -10861,10 +10787,10 @@ catAxisChart.prototype =
var z = this.cChartDrawer.processor3D.calculateZPositionCatAxis();
var convertResult = this.cChartDrawer._convertAndTurnPoint(x * this.chartProp.pxToMM, y * this.chartProp.pxToMM, z, angleOx, angleOy, angleOz);
var convertResult = this.cChartDrawer._convertAndTurnPoint(x * this.chartProp.pxToMM, y * this.chartProp.pxToMM, z);
x = convertResult.x / this.chartProp.pxToMM;
y = convertResult.y / this.chartProp.pxToMM;
convertResult = this.cChartDrawer._convertAndTurnPoint(x1 * this.chartProp.pxToMM, y1 * this.chartProp.pxToMM, z, angleOx, angleOy, angleOz);
convertResult = this.cChartDrawer._convertAndTurnPoint(x1 * this.chartProp.pxToMM, y1 * this.chartProp.pxToMM, z);
x1 = convertResult.x / this.chartProp.pxToMM;
y1 = convertResult.y / this.chartProp.pxToMM;
}
......@@ -11247,13 +11173,13 @@ serAxisChart.prototype =
var x = this.chartProp.widthCanvas - this.chartProp.chartGutter._right;
var y = nullPositionOx;
var convertResult = this.cChartDrawer._convertAndTurnPoint(x, y, 0, angleOx, angleOy, angleOz);
var convertResult = this.cChartDrawer._convertAndTurnPoint(x, y, 0);
x = convertResult.x / this.chartProp.pxToMM;
y = convertResult.y / this.chartProp.pxToMM;
var x1 = this.chartProp.widthCanvas - this.chartProp.chartGutter._right;
var y1 = nullPositionOx;
convertResult = this.cChartDrawer._convertAndTurnPoint(x1, y1, perspectiveDepth, angleOx, angleOy, angleOz);
convertResult = this.cChartDrawer._convertAndTurnPoint(x1, y1, perspectiveDepth);
x1 = convertResult.x / this.chartProp.pxToMM;
y1 = convertResult.y / this.chartProp.pxToMM;
......
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