|
@ -1230,6 +1230,19 @@ Graph3d.prototype._line = function(ctx, from, to, strokeStyle) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Draw a line between 2d points 'from' and 'to'. |
|
|
|
|
|
* |
|
|
|
|
|
* If stroke style specified, set that as well. |
|
|
|
|
|
*/ |
|
|
|
|
|
Graph3d.prototype._line3d = function(ctx, from, to, strokeStyle) { |
|
|
|
|
|
var from2d = this._convert3Dto2D(from); |
|
|
|
|
|
var to2d = this._convert3Dto2D(to); |
|
|
|
|
|
|
|
|
|
|
|
this._line(ctx, from2d, to2d, strokeStyle); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* Redraw the axis |
|
|
* Redraw the axis |
|
|
*/ |
|
|
*/ |
|
@ -1262,18 +1275,18 @@ Graph3d.prototype._redrawAxis = function() { |
|
|
var x = step.getCurrent(); |
|
|
var x = step.getCurrent(); |
|
|
|
|
|
|
|
|
if (this.showGrid) { |
|
|
if (this.showGrid) { |
|
|
from = this._convert3Dto2D(new Point3d(x, this.yMin, this.zMin)); |
|
|
|
|
|
to = this._convert3Dto2D(new Point3d(x, this.yMax, this.zMin)); |
|
|
|
|
|
this._line(ctx, from, to, this.gridColor); |
|
|
|
|
|
|
|
|
from = new Point3d(x, this.yMin, this.zMin); |
|
|
|
|
|
to = new Point3d(x, this.yMax, this.zMin); |
|
|
|
|
|
this._line3d(ctx, from, to, this.gridColor); |
|
|
} |
|
|
} |
|
|
else { |
|
|
else { |
|
|
from = this._convert3Dto2D(new Point3d(x, this.yMin, this.zMin)); |
|
|
|
|
|
to = this._convert3Dto2D(new Point3d(x, this.yMin+gridLenX, this.zMin)); |
|
|
|
|
|
this._line(ctx, from, to, this.axisColor); |
|
|
|
|
|
|
|
|
from = new Point3d(x, this.yMin, this.zMin); |
|
|
|
|
|
to = new Point3d(x, this.yMin+gridLenX, this.zMin); |
|
|
|
|
|
this._line3d(ctx, from, to, this.axisColor); |
|
|
|
|
|
|
|
|
from = this._convert3Dto2D(new Point3d(x, this.yMax, this.zMin)); |
|
|
|
|
|
to = this._convert3Dto2D(new Point3d(x, this.yMax-gridLenX, this.zMin)); |
|
|
|
|
|
this._line(ctx, from, to, this.axisColor); |
|
|
|
|
|
|
|
|
from = new Point3d(x, this.yMax, this.zMin); |
|
|
|
|
|
to = new Point3d(x, this.yMax-gridLenX, this.zMin); |
|
|
|
|
|
this._line3d(ctx, from, to, this.axisColor); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
yText = (Math.cos(armAngle) > 0) ? this.yMin : this.yMax; |
|
|
yText = (Math.cos(armAngle) > 0) ? this.yMin : this.yMax; |
|
@ -1307,18 +1320,18 @@ Graph3d.prototype._redrawAxis = function() { |
|
|
} |
|
|
} |
|
|
while (!step.end()) { |
|
|
while (!step.end()) { |
|
|
if (this.showGrid) { |
|
|
if (this.showGrid) { |
|
|
from = this._convert3Dto2D(new Point3d(this.xMin, step.getCurrent(), this.zMin)); |
|
|
|
|
|
to = this._convert3Dto2D(new Point3d(this.xMax, step.getCurrent(), this.zMin)); |
|
|
|
|
|
this._line(ctx, from, to, this.gridColor); |
|
|
|
|
|
|
|
|
from = new Point3d(this.xMin, step.getCurrent(), this.zMin); |
|
|
|
|
|
to = new Point3d(this.xMax, step.getCurrent(), this.zMin); |
|
|
|
|
|
this._line3d(ctx, from, to, this.gridColor); |
|
|
} |
|
|
} |
|
|
else { |
|
|
else { |
|
|
from = this._convert3Dto2D(new Point3d(this.xMin, step.getCurrent(), this.zMin)); |
|
|
|
|
|
to = this._convert3Dto2D(new Point3d(this.xMin+gridLenY, step.getCurrent(), this.zMin)); |
|
|
|
|
|
this._line(ctx, from, to, this.axisColor); |
|
|
|
|
|
|
|
|
from = new Point3d(this.xMin, step.getCurrent(), this.zMin); |
|
|
|
|
|
to = new Point3d(this.xMin+gridLenY, step.getCurrent(), this.zMin); |
|
|
|
|
|
this._line3d(ctx, from, to, this.axisColor); |
|
|
|
|
|
|
|
|
from = this._convert3Dto2D(new Point3d(this.xMax, step.getCurrent(), this.zMin)); |
|
|
|
|
|
to = this._convert3Dto2D(new Point3d(this.xMax-gridLenY, step.getCurrent(), this.zMin)); |
|
|
|
|
|
this._line(ctx, from, to, this.axisColor); |
|
|
|
|
|
|
|
|
from = new Point3d(this.xMax, step.getCurrent(), this.zMin); |
|
|
|
|
|
to = new Point3d(this.xMax-gridLenY, step.getCurrent(), this.zMin); |
|
|
|
|
|
this._line3d(ctx, from, to, this.axisColor); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
xText = (Math.sin(armAngle ) > 0) ? this.xMin : this.xMax; |
|
|
xText = (Math.sin(armAngle ) > 0) ? this.xMin : this.xMax; |
|
@ -1366,31 +1379,31 @@ Graph3d.prototype._redrawAxis = function() { |
|
|
step.next(); |
|
|
step.next(); |
|
|
} |
|
|
} |
|
|
ctx.lineWidth = 1; |
|
|
ctx.lineWidth = 1; |
|
|
from = this._convert3Dto2D(new Point3d(xText, yText, this.zMin)); |
|
|
|
|
|
to = this._convert3Dto2D(new Point3d(xText, yText, this.zMax)); |
|
|
|
|
|
this._line(ctx, from, to, this.axisColor); |
|
|
|
|
|
|
|
|
from = new Point3d(xText, yText, this.zMin); |
|
|
|
|
|
to = new Point3d(xText, yText, this.zMax); |
|
|
|
|
|
this._line3d(ctx, from, to, this.axisColor); |
|
|
|
|
|
|
|
|
// draw x-axis
|
|
|
// draw x-axis
|
|
|
ctx.lineWidth = 1; |
|
|
ctx.lineWidth = 1; |
|
|
// line at yMin
|
|
|
// line at yMin
|
|
|
xMin2d = this._convert3Dto2D(new Point3d(this.xMin, this.yMin, this.zMin)); |
|
|
|
|
|
xMax2d = this._convert3Dto2D(new Point3d(this.xMax, this.yMin, this.zMin)); |
|
|
|
|
|
this._line(ctx, xMin2d, xMax2d, this.axisColor); |
|
|
|
|
|
|
|
|
xMin2d = new Point3d(this.xMin, this.yMin, this.zMin); |
|
|
|
|
|
xMax2d = new Point3d(this.xMax, this.yMin, this.zMin); |
|
|
|
|
|
this._line3d(ctx, xMin2d, xMax2d, this.axisColor); |
|
|
// line at ymax
|
|
|
// line at ymax
|
|
|
xMin2d = this._convert3Dto2D(new Point3d(this.xMin, this.yMax, this.zMin)); |
|
|
|
|
|
xMax2d = this._convert3Dto2D(new Point3d(this.xMax, this.yMax, this.zMin)); |
|
|
|
|
|
this._line(ctx, xMin2d, xMax2d, this.axisColor); |
|
|
|
|
|
|
|
|
xMin2d = new Point3d(this.xMin, this.yMax, this.zMin); |
|
|
|
|
|
xMax2d = new Point3d(this.xMax, this.yMax, this.zMin); |
|
|
|
|
|
this._line3d(ctx, xMin2d, xMax2d, this.axisColor); |
|
|
|
|
|
|
|
|
// draw y-axis
|
|
|
// draw y-axis
|
|
|
ctx.lineWidth = 1; |
|
|
ctx.lineWidth = 1; |
|
|
// line at xMin
|
|
|
// line at xMin
|
|
|
from = this._convert3Dto2D(new Point3d(this.xMin, this.yMin, this.zMin)); |
|
|
|
|
|
to = this._convert3Dto2D(new Point3d(this.xMin, this.yMax, this.zMin)); |
|
|
|
|
|
this._line(ctx, from, to, this.axisColor); |
|
|
|
|
|
|
|
|
from = new Point3d(this.xMin, this.yMin, this.zMin); |
|
|
|
|
|
to = new Point3d(this.xMin, this.yMax, this.zMin); |
|
|
|
|
|
this._line3d(ctx, from, to, this.axisColor); |
|
|
// line at xMax
|
|
|
// line at xMax
|
|
|
from = this._convert3Dto2D(new Point3d(this.xMax, this.yMin, this.zMin)); |
|
|
|
|
|
to = this._convert3Dto2D(new Point3d(this.xMax, this.yMax, this.zMin)); |
|
|
|
|
|
this._line(ctx, from, to, this.axisColor); |
|
|
|
|
|
|
|
|
from = new Point3d(this.xMax, this.yMin, this.zMin); |
|
|
|
|
|
to = new Point3d(this.xMax, this.yMax, this.zMin); |
|
|
|
|
|
this._line3d(ctx, from, to, this.axisColor); |
|
|
|
|
|
|
|
|
// draw x-label
|
|
|
// draw x-label
|
|
|
var xLabel = this.xLabel; |
|
|
var xLabel = this.xLabel; |
|
|