Commit 9dd3f6ef authored by GoshaZotov's avatar GoshaZotov

delete unused test code

parent d74d0b26
......@@ -12315,519 +12315,6 @@ CSortFaces.prototype =
}
};
//TEST primitive parallalepiped
function TEST3D2()
{
this.chartProp = null;
this.cChartDrawer = null;
this.cChartSpace = null;
this.summBarVal = [];
this.paths = {};
}
TEST3D2.prototype =
{
constructor: TEST3D,
reCalculate : function(chartsDrawer)
{
this.chartProp = chartsDrawer.calcProp;
this.cChartDrawer = chartsDrawer;
this.cChartSpace = chartsDrawer.cChartSpace;
this.paths = {};
this._recalculate();
},
draw : function(chartsDrawer)
{
this.chartProp = chartsDrawer.calcProp;
this.cChartDrawer = chartsDrawer;
this.cChartSpace = chartsDrawer.cChartSpace;
this._Draw();
},
_Draw: function(cubePoints)
{
var seria = this.chartProp.series[0];
var brush = seria.brush;
var pen = seria.pen;
var numCache = seria.val.numRef ? seria.val.numRef.numCache : seria.val.numLit;
if(numCache.pts[0] && numCache.pts[0].pen)
pen = numCache.pts[0].pen;
if(numCache.pts[0] && numCache.pts[0].brush)
brush = null;
/*pen = this.cChartSpace.chart.plotArea.catAx.compiledMajorGridLines;
else*/
pen = this.cChartSpace.chart.plotArea.valAx.compiledMajorGridLines;
for(var i = 0; i < this.paths.length; i++)
{
for(var j = 0; j < this.paths[i].length; j++)
{
for(var n = 0; n < this.paths[i][j].length; n++)
{
this.cChartDrawer.drawPath(this.paths[i][j][n], pen, brush);
}
}
}
},
_recalculate: function (/*isSkip*/)
{
var view3DProp = this.cChartSpace.chart.view3D;
var angleOx = view3DProp && view3DProp.rotX ? (- view3DProp.rotX / 360) * (Math.PI * 2) : 0;
var angleOy = view3DProp && view3DProp.rotY ? (- view3DProp.rotY / 360) * (Math.PI * 2) : 0;
var angleOz = 0;
var widthGraph = this.chartProp.widthCanvas - this.chartProp.chartGutter._left - this.chartProp.chartGutter._right;
//widthGraph = widthGraph - widthGraph * Math.sin(-angleOy);
//параметр r и глубина по OZ
var rPerspective = this.chartProp.rPerspective;
var perspectiveDepth = this.chartProp.depthPerspective;
var top = this.chartProp.chartGutter._top;
var bottom = this.chartProp.chartGutter._bottom;
var widthCanvas = this.chartProp.widthCanvas;
var heightCanvas = this.chartProp.heightCanvas;
var heightChart = heightCanvas - top - bottom;
//this.chartProp.chartGutter._left = this.chartProp.chartGutter._right = (widthCanvas - heightChart) / 2;
var left = this.chartProp.chartGutter._left;
var right = this.chartProp.chartGutter._right;
var widthChart = widthCanvas - left - right;
var depthChart = this.chartProp.depthPerspective;
//calculate 8 point of 3d parallelepiped
//Left area
var point1 = new Point3D(left, heightChart + top, 0, this.cChartDrawer);
var point2 = new Point3D(left, heightChart + top, depthChart, this.cChartDrawer);
var point3 = new Point3D(left, top, depthChart, this.cChartDrawer);
var point4 = new Point3D(left, top, 0, this.cChartDrawer);
//right area
var point5 = new Point3D(left + widthChart, heightChart + top, 0, this.cChartDrawer);
var point6 = new Point3D(left + widthChart, heightChart + top, depthChart, this.cChartDrawer);
var point7 = new Point3D(left + widthChart, top, depthChart, this.cChartDrawer);
var point8 = new Point3D(left + widthChart, top, 0, this.cChartDrawer);
// ToDo а нужна ли global3DPersperctive в ChartsDrawer ?
var perspective = this.cChartSpace.chart.view3D && this.cChartSpace.chart.view3D.perspective ? this.cChartSpace.chart.view3D.perspective : AscFormat.global3DPersperctive;
var alpha = perspective / 2;
var halfHeight = heightChart / 2;
var PI_OVER_360 = Math.PI / 180;
var halfAlpha = (alpha / 2) * PI_OVER_360;
var rPerspective = halfHeight / Math.tan(halfAlpha);
var diffToObserverZ = rPerspective;
var pointProj = [];
pointProj[0] = point1.convertAndTurnPoint(angleOx, angleOy, angleOz, diffToObserverZ, true);
pointProj[1] = point2.convertAndTurnPoint(angleOx, angleOy, angleOz, diffToObserverZ, true);
pointProj[2] = point3.convertAndTurnPoint(angleOx, angleOy, angleOz, diffToObserverZ, true);
pointProj[3] = point4.convertAndTurnPoint(angleOx, angleOy, angleOz, diffToObserverZ, true);
//right area
pointProj[4] = point5.convertAndTurnPoint(angleOx, angleOy, angleOz, diffToObserverZ, true);
pointProj[5] = point6.convertAndTurnPoint(angleOx, angleOy, angleOz, diffToObserverZ, true);
pointProj[6] = point7.convertAndTurnPoint(angleOx, angleOy, angleOz, diffToObserverZ, true);
pointProj[7] = point8.convertAndTurnPoint(angleOx, angleOy, angleOz, diffToObserverZ, true);
var pointProjRotate = [];
pointProjRotate[0] = point1.convertAndTurnPoint(angleOx, angleOy, angleOz, diffToObserverZ);
pointProjRotate[1] = point2.convertAndTurnPoint(angleOx, angleOy, angleOz, diffToObserverZ);
pointProjRotate[2] = point3.convertAndTurnPoint(angleOx, angleOy, angleOz, diffToObserverZ);
pointProjRotate[3] = point4.convertAndTurnPoint(angleOx, angleOy, angleOz, diffToObserverZ);
//right area
pointProjRotate[4] = point5.convertAndTurnPoint(angleOx, angleOy, angleOz, diffToObserverZ);
pointProjRotate[5] = point6.convertAndTurnPoint(angleOx, angleOy, angleOz, diffToObserverZ);
pointProjRotate[6] = point7.convertAndTurnPoint(angleOx, angleOy, angleOz, diffToObserverZ);
pointProjRotate[7] = point8.convertAndTurnPoint(angleOx, angleOy, angleOz, diffToObserverZ);
var rotatePoint = [];
rotatePoint[0] = point1.rotate(angleOx, angleOy, angleOz);
rotatePoint[1] = point2.rotate(angleOx, angleOy, angleOz, diffToObserverZ, true);
rotatePoint[2] = point3.rotate(angleOx, angleOy, angleOz, diffToObserverZ, true);
rotatePoint[3] = point4.rotate(angleOx, angleOy, angleOz, diffToObserverZ, true);
//right area
rotatePoint[4] = point5.rotate(angleOx, angleOy, angleOz, diffToObserverZ, true);
rotatePoint[5] = point6.rotate(angleOx, angleOy, angleOz, diffToObserverZ, true);
rotatePoint[6] = point7.rotate(angleOx, angleOy, angleOz, diffToObserverZ, true);
rotatePoint[7] = point8.rotate(angleOx, angleOy, angleOz, diffToObserverZ, true);
//correct projection
if(false)
{
pointProjRotate[0].x = pointProjRotate[0].x < pointProj[0].x ? pointProj[0].x : pointProjRotate[0].x;
pointProjRotate[0].y = pointProjRotate[0].y > pointProj[0].y ? pointProj[0].y : pointProjRotate[0].y;
pointProjRotate[1].x = pointProjRotate[1].x < pointProj[1].x ? pointProj[1].x : pointProjRotate[1].x;
pointProjRotate[1].y = pointProjRotate[1].y > pointProj[1].y ? pointProj[1].y : pointProjRotate[1].y;
pointProjRotate[2].x = pointProjRotate[2].x < pointProj[2].x ? pointProj[2].x : pointProjRotate[2].x;
pointProjRotate[2].y = pointProjRotate[2].y < pointProj[2].y ? pointProj[2].y : pointProjRotate[2].y;
pointProjRotate[3].x = pointProjRotate[3].x < pointProj[3].x ? pointProj[3].x : pointProjRotate[3].x;
pointProjRotate[3].y = pointProjRotate[3].y < pointProj[3].y ? pointProj[3].y : pointProjRotate[3].y;
pointProjRotate[4].x = pointProjRotate[4].x > pointProj[4].x ? pointProj[4].x : pointProjRotate[4].x;
pointProjRotate[4].y = pointProjRotate[4].y > pointProj[4].y ? pointProj[4].y : pointProjRotate[4].y;
pointProjRotate[5].x = pointProjRotate[5].x > pointProj[5].x ? pointProj[5].x : pointProjRotate[5].x;
pointProjRotate[5].y = pointProjRotate[5].y > pointProj[5].y ? pointProj[5].y : pointProjRotate[5].y;
pointProjRotate[6].x = pointProjRotate[6].x > pointProj[6].x ? pointProj[6].x : pointProjRotate[6].x;
pointProjRotate[6].y = pointProjRotate[6].y < pointProj[6].y ? pointProj[6].y : pointProjRotate[6].y;
pointProjRotate[7].x = pointProjRotate[7].x > pointProj[7].x ? pointProj[7].x : pointProjRotate[7].x;
pointProjRotate[7].y = pointProjRotate[7].y < pointProj[7].y ? pointProj[7].y : pointProjRotate[7].y;
}
//correct points
if(true)
{
rotatePoint[0].x = rotatePoint[0].x < point1.x ? rotatePoint[0].x : point1.x;
rotatePoint[0].y = rotatePoint[0].y > point1.y ? rotatePoint[0].y : point1.y;
rotatePoint[0].z = (rotatePoint[0].z >= 0 && rotatePoint[0].z <= depthChart) ? rotatePoint[0].z : point1.z;
rotatePoint[1].x = rotatePoint[1].x < point2.x ? rotatePoint[1].x : point2.x;
rotatePoint[1].y = rotatePoint[1].y > point2.y ? rotatePoint[1].y : point2.y;
rotatePoint[1].z = rotatePoint[1].z >= 0 && rotatePoint[1].z <= depthChart ? rotatePoint[1].z : point2.z;
rotatePoint[2].x = rotatePoint[2].x < point3.x ? point3.x : rotatePoint[2].x;
rotatePoint[2].y = rotatePoint[2].y < point3.y ? point3.y : rotatePoint[2].y;
rotatePoint[2].z = rotatePoint[2].z >= 0 && rotatePoint[2].z <= depthChart ? rotatePoint[2].z : point3.z;
rotatePoint[3].x = rotatePoint[3].x < point4.x ? point4.x : rotatePoint[3].x;
rotatePoint[3].y = rotatePoint[3].y < point4.y ? point4.y : rotatePoint[3].y;
rotatePoint[3].z = rotatePoint[3].z >= 0 && rotatePoint[3].z <= depthChart ? rotatePoint[3].z : point4.z;
rotatePoint[4].x = rotatePoint[4].x > point5.x ? point5.x : rotatePoint[4].x;
rotatePoint[4].y = rotatePoint[4].y > point5.y ? point5.y : rotatePoint[4].y;
rotatePoint[4].z = rotatePoint[4].z >= 0 && rotatePoint[4].z <= depthChart ? rotatePoint[4].z : point5.z;
rotatePoint[5].x = rotatePoint[5].x > point6.x ? point6.x : rotatePoint[5].x;
rotatePoint[5].y = rotatePoint[5].y > point6.y ? point6.y : rotatePoint[5].y;
rotatePoint[5].z = rotatePoint[5].z >= 0 && rotatePoint[5].z <= depthChart ? rotatePoint[5].z : point6.z;
rotatePoint[6].x = rotatePoint[6].x > point7.x ? point7.x : rotatePoint[6].x;
rotatePoint[6].y = rotatePoint[6].y < point7.y ? point7.y : rotatePoint[6].y;
rotatePoint[6].z = rotatePoint[6].z >= 0 && rotatePoint[6].z <= depthChart ? rotatePoint[6].z : point7.z;
rotatePoint[7].x = rotatePoint[7].x > point8.x ? point8.x : rotatePoint[7].x;
rotatePoint[7].y = rotatePoint[7].y < point8.y ? point8.y : rotatePoint[7].y;
rotatePoint[7].z = rotatePoint[7].z >= 0 && rotatePoint[7].z <= depthChart ? rotatePoint[7].z : point8.z;
var pointProj1 = [];
pointProj1[0] = rotatePoint[0].convertAndTurnPoint(angleOx, angleOy, angleOz, diffToObserverZ, true);
pointProj1[1] = rotatePoint[1].convertAndTurnPoint(angleOx, angleOy, angleOz, diffToObserverZ, true);
pointProj1[2] = rotatePoint[2].convertAndTurnPoint(angleOx, angleOy, angleOz, diffToObserverZ, true);
pointProj1[3] = rotatePoint[3].convertAndTurnPoint(angleOx, angleOy, angleOz, diffToObserverZ, true);
//right area
pointProj1[4] = rotatePoint[4].convertAndTurnPoint(angleOx, angleOy, angleOz, diffToObserverZ, true);
pointProj1[5] = rotatePoint[5].convertAndTurnPoint(angleOx, angleOy, angleOz, diffToObserverZ, true);
pointProj1[6] = rotatePoint[6].convertAndTurnPoint(angleOx, angleOy, angleOz, diffToObserverZ, true);
pointProj1[7] = rotatePoint[7].convertAndTurnPoint(angleOx, angleOy, angleOz, diffToObserverZ, true);
}
var aspectRatioX = [];
var aspectRatioY = [];
var aspectRatioZ = [];
var point1Test = [];
for(var i = 0; i < pointProj.length; i++)
{
aspectRatioX[i] = pointProj[i].x - pointProjRotate[i].x;
aspectRatioY[i] = pointProjRotate[i].y - pointProj[i].y;
aspectRatioZ[i] = pointProjRotate[i].z - pointProj[i].z;
var newX = aspectRatioX[i] < 0 ? pointProjRotate[i].x - aspectRatioX[i] : pointProjRotate[i].x;
var newY = pointProjRotate[i].y;
var newZ = pointProjRotate[i].z;
point1Test[i] = new Point3D(newX, newY, newZ, this.cChartDrawer);
}
this.paths = [];
this.paths[0] = [];
//this.paths[0][0] = this._calculateRect(pointProj1[0], pointProj1[1], pointProj1[2], pointProj1[3], pointProj1[4], pointProj1[5], pointProj1[6], pointProj1[7]);
//this.paths[0][0] = this._calculateRect(pointProj[0], pointProj[1], pointProj[2], pointProj[3], pointProj[4], pointProj[5], pointProj[6], pointProj[7]);
this.paths[0][0] = this._calculateRect(pointProjRotate[0], pointProjRotate[1], pointProjRotate[2], pointProjRotate[3], pointProjRotate[4], pointProjRotate[5], pointProjRotate[6], pointProjRotate[7]);
//this.paths[0][0] = this._calculateRect(point1Test[0], point1Test[1], point1Test[2], point1Test[3], point1Test[4], point1Test[5], point1Test[6], point1Test[7]);
},
_calculateRect : function(point1, point2, point3, point4, point5, point6, point7, point8)
{
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;
var pxToMm = this.chartProp.pxToMM;
var paths = [];
//unfront
path = new Path();
path.pathH = pathH;
path.pathW = pathW;
path.moveTo(point2.x / pxToMm * pathW, point2.y / pxToMm * pathH);
path.lnTo(point6.x / pxToMm * pathW, point6.y / pxToMm * pathH);
path.lnTo(point7.x / pxToMm * pathW, point7.y / pxToMm * pathH);
path.lnTo(point3.x / pxToMm * pathW, point3.y / pxToMm * pathH);
path.lnTo(point2.x / pxToMm * pathW, point2.y / pxToMm * pathH);
path.recalculate(gdLst);
paths[0] = path;
//down
path.moveTo(point1.x / pxToMm * pathW, point1.y / pxToMm * pathH);
path.lnTo(point2.x / pxToMm * pathW, point2.y / pxToMm * pathH);
path.lnTo(point3.x / pxToMm * pathW, point3.y / pxToMm * pathH);
path.lnTo(point4.x / pxToMm * pathW, point4.y / pxToMm * pathH);
path.lnTo(point1.x / pxToMm * pathW, point1.y / pxToMm * pathH);
path.recalculate(gdLst);
paths[1] = path;
//left
path = new Path();
path.pathH = pathH;
path.pathW = pathW;
path.moveTo(point1.x / pxToMm * pathW, point1.y / pxToMm * pathH);
path.lnTo(point5.x / pxToMm * pathW, point5.y / pxToMm * pathH);
path.lnTo(point6.x / pxToMm * pathW, point6.y / pxToMm * pathH);
path.lnTo(point2.x / pxToMm * pathW, point2.y / pxToMm * pathH);
path.lnTo(point1.x / pxToMm * pathW, point1.y / pxToMm * pathH);
path.recalculate(gdLst);
paths[2] = path;
//right
path = new Path();
path.pathH = pathH;
path.pathW = pathW;
path.moveTo(point4.x / pxToMm * pathW, point4.y / pxToMm * pathH);
path.lnTo(point8.x / pxToMm * pathW, point8.y / pxToMm * pathH);
path.lnTo(point7.x / pxToMm * pathW, point7.y / pxToMm * pathH);
path.lnTo(point3.x / pxToMm * pathW, point3.y / pxToMm * pathH);
path.lnTo(point4.x / pxToMm * pathW, point4.y / pxToMm * pathH);
path.recalculate(gdLst);
paths[3] = path;
//up
path = new Path();
path.pathH = pathH;
path.pathW = pathW;
path.moveTo(point5.x / pxToMm * pathW, point5.y / pxToMm * pathH);
path.lnTo(point6.x / pxToMm * pathW, point6.y / pxToMm * pathH);
path.lnTo(point7.x / pxToMm * pathW, point7.y / pxToMm * pathH);
path.lnTo(point8.x / pxToMm * pathW, point8.y / pxToMm * pathH);
path.lnTo(point5.x / pxToMm * pathW, point5.y / pxToMm * pathH);
path.recalculate(gdLst);
paths[4] = path;
//front
path = new Path();
path.pathH = pathH;
path.pathW = pathW;
path.moveTo(point1.x / pxToMm * pathW, point1.y / pxToMm * pathH);
path.lnTo(point5.x / pxToMm * pathW, point5.y / pxToMm * pathH);
path.lnTo(point8.x / pxToMm * pathW, point8.y / pxToMm * pathH);
path.lnTo(point4.x / pxToMm * pathW, point4.y / pxToMm * pathH);
path.lnTo(point1.x / pxToMm * pathW, point1.y / pxToMm * pathH);
path.recalculate(gdLst);
paths[5] = path;
return paths;
}
};
//TEST primitive parallalepiped
function TEST3D()
{
this.points = []; //array storing all existing 3D points
this.faces = []; //array storing 4 point groups which make up a face
this.fov = 170; //field of view - best not to touch this
//rotation speed about x,y,z axis - changing this will make the cube rotate in
//different directions at different speeds
this.rx = 0;
this.ry = 30;
this.rz = 0;
}
TEST3D.prototype =
{
constructor: TEST3D,
reCalculate : function(chartsDrawer)
{
this.chartProp = chartsDrawer.calcProp;
this.cChartDrawer = chartsDrawer;
this.cChartSpace = chartsDrawer.cChartSpace;
this.paths = [];
this._recalculate();
},
draw : function(chartsDrawer)
{
this.chartProp = chartsDrawer.calcProp;
this.cChartDrawer = chartsDrawer;
this.cChartSpace = chartsDrawer.cChartSpace;
this._Draw();
},
_Draw: function(cubePoints)
{
var seria = this.chartProp.series[0];
var brush = seria.brush;
var pen = seria.pen;
var numCache = seria.val.numRef ? seria.val.numRef.numCache : seria.val.numLit;
if(numCache.pts[0] && numCache.pts[0].pen)
pen = numCache.pts[0].pen;
if(numCache.pts[0] && numCache.pts[0].brush)
brush = null;
/*pen = this.cChartSpace.chart.plotArea.catAx.compiledMajorGridLines;
else*/
pen = this.cChartSpace.chart.plotArea.valAx.compiledMajorGridLines;
for(var i = 0; i < this.paths.length; i++)
{
this.cChartDrawer.drawPath(this.paths[i], pen, brush);
}
},
_recalculate: function (/*isSkip*/)
{
var view3DProp = this.cChartSpace.chart.view3D;
var angleOx = view3DProp && view3DProp.rotX ? (- view3DProp.rotX / 360) * (Math.PI * 2) : 0;
var angleOy = view3DProp && view3DProp.rotY ? (- view3DProp.rotY / 360) * (Math.PI * 2) : 0;
var angleOz = 0;
//параметр r и глубина по OZ
var rPerspective = this.cChartDrawer.processor3D.rPerspective;
var perspectiveDepth = this.cChartDrawer.processor3D.depthPerspective;
var top = this.chartProp.chartGutter._top;
var bottom = this.chartProp.chartGutter._bottom;
var widthCanvas = this.chartProp.widthCanvas;
var heightCanvas = this.chartProp.heightCanvas;
var heightChart = heightCanvas - top - bottom;
var left = this.chartProp.chartGutter._left;
var right = this.chartProp.chartGutter._right;
var widthChart = heightChart;
var pathH = this.chartProp.pathH;
var pathW = this.chartProp.pathW;
var gdLst = [];
gdLst["w"] = 1;
gdLst["h"] = 1;
var pxToMm = this.chartProp.pxToMM;
var points = [];
var faces = [];
points.push(new Point3D(0, 0, perspectiveDepth,this.cChartDrawer));
points.push(new Point3D(0, heightChart, perspectiveDepth,this.cChartDrawer));
points.push(new Point3D(widthChart, heightChart, perspectiveDepth,this.cChartDrawer));
points.push(new Point3D(widthChart, 0, perspectiveDepth,this.cChartDrawer));
points.push(new Point3D(widthChart, 0, 0,this.cChartDrawer));
points.push(new Point3D(widthChart, heightChart, 0,this.cChartDrawer));
points.push(new Point3D(0, heightChart, 0,this.cChartDrawer));
points.push(new Point3D(0, 0, 0,this.cChartDrawer));
faces.push([0,1,2,3]);
faces.push([2,5,4,3]);
faces.push([1,6,7,0]);
faces.push([6,5,4,7]);
faces.push([7,4,3,0]);
faces.push([1,6,2,5]);
for(var i = 0; i < points.length; i++)
{
//diff
points[i].offset(- widthChart / 2, -heightChart / 2, -perspectiveDepth / 2);
//rotate
points[i] = points[i].rotY(-angleOy, points[i]);
points[i] = points[i].rotX(-angleOx, points[i]);
}
var fov = 1 / rPerspective; //field of view - best not to touch this
for(var i = 0; i < faces.length - 1; i++){
for(var k = 0; k < 3; k++){
var path = new Path();
path.pathH = pathH;
path.pathW = pathW;
var diff = 0;
var x = points[faces[i][k]].x + diff;
var y = points[faces[i][k]].y;
var z = points[faces[i][k]].z + this.cChartDrawer.processor3D.cameraDiffZ;
var x1 = points[faces[i][k]].projectX(x, z, 0, fov, widthCanvas / 2);
var y1 = points[faces[i][k]].projectY(y, z, 0, fov, heightCanvas / 2);
var x = points[faces[i][k + 1]].x + diff;
var y = points[faces[i][k + 1]].y;
var z = points[faces[i][k + 1]].z + this.cChartDrawer.processor3D.cameraDiffZ;
var x2 = points[faces[i][k]].projectX(x, z, 0, fov, widthCanvas / 2);
var y2 = points[faces[i][k]].projectY(y, z, 0, fov, heightCanvas / 2);
path.moveTo(x1 / pxToMm * pathW, y1 / pxToMm * pathH);
path.lnTo(x2 / pxToMm * pathW, y2 / pxToMm * pathH);
path.recalculate(gdLst);
this.paths.push(path);
}
}
}
};
//----------------------------------------------------------export----------------------------------------------------
window['AscFormat'] = window['AscFormat'] || {};
window['AscFormat'].CChartsDrawer = CChartsDrawer;
......
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