dojox.gfx3d.Cylinder.draw
dojo.require("dojox.gfx3d.object");
defined in dojox/gfx3d/object.js
Usage
function () (view source)
var c = this.cache, v = dojox.gfx3d.vector, m = dojox.gfx.matrix, centers = [c.center, c.top], normal = v.substract(c.top, c.center); if(v.dotProduct(normal, this.renderer.lighting.incident) > 0){ centers = [c.top, c.center]; normal = v.substract(c.center, c.top); } var color = this.renderer.lighting[this.fillStyle.type](normal, this.fillStyle.finish, this.fillStyle.color), d = Math.sqrt( Math.pow(c.center.x - c.top.x, 2) + Math.pow(c.center.y - c.top.y, 2) ); if(this.shape){ this.shape.clear(); }else{ this.shape = this.renderer.createGroup(); } this.shape.createPath("") .moveTo(0, -c.rx) .lineTo(d, -c.rx) .lineTo(d, c.rx) .lineTo(0, c.rx) .arcTo(c.ry, c.rx, 0, true, true, 0, -c.rx) .setFill(c.gradient).setStroke(this.strokeStyle) .setTransform([m.translate(centers[0]), m.rotate(Math.atan2(centers[1].y - centers[0].y, centers[1].x - centers[0].x))]); if(c.rx > 0 && c.ry > 0){ this.shape.createEllipse({cx: centers[1].x, cy: centers[1].y, rx: c.rx, ry: c.ry}) .setFill(color).setStroke(this.strokeStyle) .applyTransform(m.rotateAt(c.theta, centers[1])); }