1 (
function(a){
if(typeof define===
"function"&&define.amd){define([
"d3",
"JSRootPainter",
"threejs_all"],a)}
else{
if(typeof JSROOT==
"undefined"){
throw new Error(
"JSROOT is not defined",
"JSRoot3DPainter.js")}
if(typeof d3!=
"object"){
throw new Error(
"This extension requires d3.v3.js",
"JSRoot3DPainter.js")}
if(typeof JSROOT.Painter!=
"object"){
throw new Error(
"JSROOT.Painter is not defined",
"JSRoot3DPainter.js")}
if(typeof THREE==
"undefined"){
throw new Error(
"THREE is not defined",
"JSRoot3DPainter.js")}a(d3,JSROOT)}}(
function(b,a){a.Painter.TestWebGL=
function(){
if(a.gStyle.NoWebGL){
return false}
if(
"_Detect_WebGL" in
this){
return this._Detect_WebGL}
try{var c=document.createElement(
"canvas");this._Detect_WebGL=!!(window.WebGLRenderingContext&&(c.getContext(
"webgl")||c.getContext(
"experimental-webgl")))}
catch(d){
return false}
return this._Detect_WebGL};a.Painter.add3DInteraction=
function(){var m=
this;var f,d,e=0,i=
false;var l=null;var q={tt:null,cont:null,pos:
function(t){
if(this.tt===null){
return}var s=a.browser.isIE?(
event.clientY+document.documentElement.scrollTop):t.pageY;var r=a.browser.isIE?(event.clientX+document.documentElement.scrollLeft):t.pageX;this.tt.style.top=(s+15)+
"px";this.tt.style.left=(r+3)+
"px"},show:
function(s){
if(a.gStyle.Tooltip<=0){
return}
if(this.tt===null){this.tt=document.createElement(
"div");this.tt.setAttribute(
"class",
"jsroot");var u=document.createElement(
"div");u.setAttribute(
"class",
"tt3d_border");this.cont=document.createElement(
"div");this.cont.setAttribute(
"class",
"tt3d_cont");var r=document.createElement(
"div");r.setAttribute(
"class",
"tt3d_border");this.tt.appendChild(u);this.tt.appendChild(this.cont);this.tt.appendChild(r);document.body.appendChild(this.tt);this.tt.style.opacity=1;this.tt.style.filter=
"alpha(opacity=1)";this.tt.style.position=
"absolute";this.tt.style.display=
"block"}this.cont.innerHTML=s;this.tt.style.width=
"auto";
if(a.browser.isIE){this.tt.style.width=this.tt.offsetWidth}},hide:
function(){
if(this.tt!==null){document.body.removeChild(this.tt)}this.tt=null}};var k=
new THREE.Raycaster();var h=m.first_render_tm<2000;
function p(r){
if(a.gStyle.Tooltip<=0){
return q.hide()}k.setFromCamera(r,m.camera);var u=k.intersectObjects(m.scene.children,
true);
if(u.length>0){var t=null;
for(var s=0;s<u.length;++s){
if((
"name" in u[s].
object)&&(u[s].
object.name.length>0)){t=u[s].object;
break}}
if((t!==null)&&(l!==t)){
if(l&&h&&(
"emissive" in l.material)){l.material.emissive.setHex(l.currentHex)}l=t;
if(h&&(
"emissive" in l.material)){l.currentHex=l.material.emissive.getHex();l.material.emissive.setHex(6250335);m.Render3D(0)}q.show(l.name,200)}}
else{
if(l&&h&&(
"emissive" in l.material)){l.material.emissive.setHex(l.currentHex);m.Render3D(0)}l=null;q.hide()}}
function o(r){
if(
"changedTouches" in r){
return r.changedTouches}
if(
"touches" in r){
return r.touches}
return[r]}
function c(s){q.hide();s.preventDefault();var r=o(s);
if(r.length==2){e=Math.sqrt(Math.pow(r[0].pageX-r[1].pageX,2)+Math.pow(r[0].pageY-r[1].pageY,2))}
else{f=r[0].pageX;d=r[0].pageY}i=
true}m.renderer.domElement.addEventListener(
"touchstart",c);m.renderer.domElement.addEventListener(
"mousedown",c);
function j(v){var u=o(v);
if(i){
if(u.length==2){var z=Math.sqrt(Math.pow(u[0].pageX-u[1].pageX,2)+Math.pow(u[0].pageY-u[1].pageY,2));var A=(z-e)/(z+e);e=z;
if(A===1){
return}m.camera.position.x+=A*m.size3d*10;m.camera.position.y+=A*m.size3d*10;m.camera.position.z-=A*m.size3d*10}
else{var t=u[0].pageX-f;var s=u[0].pageY-d;var r=m.camera.position.length();var w=r>m.size3d?0.001*r/m.size3d:0.01;m.toplevel.rotation.z+=t*w;m.toplevel.rotation.x+=s*w;m.toplevel.rotation.y-=s*w;f=u[0].pageX;d=u[0].pageY}m.Render3D(0)}
else{
if(u.length==1){var y=(
"offsetX" in u[0])?u[0].offsetX:u[0].layerX;var x=(
"offsetY" in u[0])?u[0].offsetY:u[0].layerY;mouse={x:(y/m.renderer.domElement.width)*2-1,y:-(x/m.renderer.domElement.height)*2+1};p(mouse);q.pos(u[0])}
else{q.hide()}}v.stopPropagation();v.preventDefault()}m.renderer.domElement.addEventListener(
"touchmove",j);m.renderer.domElement.addEventListener(
"mousemove",j);
function g(r){i=
false;q.hide();e=0}m.renderer.domElement.addEventListener(
"touchend",g);m.renderer.domElement.addEventListener(
"touchcancel",g);m.renderer.domElement.addEventListener(
"mouseup",g);
function n(r){r.preventDefault();r.stopPropagation();var s=0;
if(r.wheelDelta){s=r.wheelDelta/400}
else{
if(r.detail){s=-r.detail/30}}m.camera.position.x-=s*m.size3d;m.camera.position.y-=s*m.size3d;m.camera.position.z+=s*m.size3d;m.Render3D(0)}m.renderer.domElement.addEventListener(
"mousewheel",n,
false);m.renderer.domElement.addEventListener(
"MozMousePixelScroll",n,
false);m.renderer.domElement.addEventListener(
"mouseleave",
function(){q.hide()});m.renderer.domElement.addEventListener(
"contextmenu",
function(r){r.preventDefault();q.hide();m.ShowContextMenu(
"hist",r)})};a.Painter.HPainter_Create3DScene=
function(c){
if((c!==null)&&(c<0)){this.clear_3d_canvas();
delete this.size3d;
delete this.scene;
delete this.toplevel;
delete this.camera;
delete this.renderer;
if(
"render_tmout" in
this){clearTimeout(this.render_tmout);
delete this.render_tmout}
return}
if(
"toplevel" in
this){var g=
new THREE.Object3D();g.rotation.x=this.toplevel.rotation.x;g.rotation.y=this.toplevel.rotation.y;this.scene.remove(this.toplevel);this.scene.add(g);this.toplevel=g;
return}var e=this.size_for_3d();this.size3d=100;this.scene=
new THREE.Scene();this.toplevel=
new THREE.Object3D();this.scene.add(this.toplevel);this.scene_width=e.width;this.scene_height=e.height;this.camera=
new THREE.PerspectiveCamera(45,this.scene_width/this.scene_height,1,40*this.size3d);var d=
new THREE.PointLight(13619151);this.camera.add(d);d.position.set(this.size3d/10,this.size3d/10,this.size3d/10);this.camera.position.set(-3*this.size3d,-3*this.size3d,3*this.size3d);this.camera.up=
new THREE.Vector3(0,0,1);this.camera.lookAt(
new THREE.Vector3(0,0,
this.size3d));this.scene.add(this.camera);var f=a.Painter.TestWebGL();this.renderer=f?
new THREE.WebGLRenderer({antialias:
true,alpha:
true}):
new THREE.CanvasRenderer({antialias:
true,alpha:
true});this.renderer.setSize(this.scene_width,this.scene_height);this.add_3d_canvas(e,this.renderer.domElement);
this[
"DrawXYZ"]=a.Painter.HPainter_DrawXYZ;
this[
"Render3D"]=a.Painter.Render3D;
this[
"Resize3D"]=a.Painter.Resize3D;this.first_render_tm=0};a.Painter.HPainter_DrawXYZ=
function(){var A=-this.size3d,j=this.size3d,z=-this.size3d,g=this.size3d,x=0,e=2*this.size3d,J=Math.round(this.size3d*0.07),r=(this.size3d!==0),o=this.xmin,M=this.xmax,G=this.ymin,l=this.ymax,f=this.zmin,B=this.zmax,t=this.histo;
if(this.size3d===0){A=this.xmin;j=this.xmax;z=this.ymin;g=this.ymax;x=this.zmin;e=this.zmax;J=(e-x)*0.05}
if((
"zoom_xmin" in
this)&&(
"zoom_xmax" in
this)&&(this.zoom_xmin!==this.zoom_xmax)){o=this.zoom_xmin;M=this.zoom_xmax}
if((
"zoom_ymin" in
this)&&(
"zoom_ymax" in
this)&&(this.zoom_ymin!==this.zoom_ymax)){G=this.zoom_ymin;l=this.zoom_ymax}
if((
"zoom_zmin" in
this)&&(
"zoom_zmax" in
this)&&(this.zoom_zmin!==this.zoom_zmax)){f=this.zoom_zmin;B=this.zoom_zmax}
if(this.options.Logx){
if(M<=0){M=1}
if((o<=0)&&(this.nbinsx>0)){
for(var P=0;P<this.nbinsx;++P){o=Math.max(o,this.GetBinX(P));
if(o>0){
break}}}
if(o<=0){o=0.0001*M}this.tx=b.scale.log();this.x_kind=
"log"}
else{this.tx=b.scale.linear();this.x_kind=
"lin"}this.tx.domain([o,M]).range([A,j]);this.x_handle=
new a.TAxisPainter(t?t.fXaxis:null);this.x_handle.SetAxisConfig(
"xaxis",this.x_kind,this.tx,this.xmin,this.xmax,o,M);this.x_handle.CreateFormatFuncs();
if(this.options.Logy){
if(l<=0){l=1}
if((G<=0)&&(this.nbinsy>0)){
for(var P=0;P<this.nbinsy;++P){G=Math.max(G,this.GetBinY(P));
if(G>0){
break}}}
if(G<=0){G=0.0001*l}this.ty=b.scale.log();this.y_kind=
"log"}
else{this.ty=b.scale.linear();this.y_kind=
"lin"}this.ty.domain([G,l]).range([z,g]);this.y_handle=
new a.TAxisPainter(t?t.fYaxis:null);this.y_handle.SetAxisConfig(
"yaxis",this.y_kind,this.ty,this.ymin,this.ymax,G,l);this.y_handle.CreateFormatFuncs();
if(this.options.Logz){
if(B<=0){B=1}
if(f<=0){f=0.0001*B}this.tz=b.scale.log();this.z_kind=
"log"}
else{this.tz=b.scale.linear();this.z_kind=
"lin"}this.tz.domain([f,B]).range([x,e]);this.z_handle=
new a.TAxisPainter(t?t.fZaxis:null);this.z_handle.SetAxisConfig(
"zaxis",this.z_kind,this.tz,this.zmin,this.zmax,f,B);this.z_handle.CreateFormatFuncs();var s=
new THREE.MeshBasicMaterial({color:0});var q=
new THREE.LineBasicMaterial({color:0});var K=J*0.5,C,d;var I=this.x_handle.CreateTicks();var u=
new THREE.Geometry();u.vertices.push(
new THREE.Vector3(0,0,0));u.vertices.push(
new THREE.Vector3(0,-1,-1));
while(I.next()){var F=I.grpos;var O=(I.kind===1);var y=this.x_handle.format(I.tick,
true,
true);
if(I.last_major()){y=
"x"}
else{
if(y===null){O=
false;y=
""}}var w=(O?K:K*0.6)*Math.sin(Math.PI/4);
if(O){var v=
new THREE.TextGeometry(y,{size:J,height:0,curveSegments:10});v.computeBoundingBox();var k=0.5*(v.boundingBox.max.x-v.boundingBox.min.x);
if(r){C=
new THREE.Mesh(v,s);C.position.set(F+k,g+w+J,x-w-J);C.rotation.x=Math.PI*3/4;C.rotation.y=Math.PI;C.name=
"X axis";this.toplevel.add(C)}C=
new THREE.Mesh(v,s);C.position.set(F-k,z-w-J,x-w-J);C.rotation.x=Math.PI/4;C.name=
"X axis";this.toplevel.add(C)}
if(r){d=
new THREE.Line(u,q);d.position.set(F,g,x);d.scale.set(1,w,w);d.rotation.z=Math.PI;d.name=
"X axis: "+this.x_handle.format(I.tick);this.toplevel.add(d)}d=
new THREE.Line(u,q);d.position.set(F,z,x);d.scale.set(1,w,w);d.name=
"X axis: "+this.x_handle.format(I.tick);this.toplevel.add(d)}var n=this.y_handle.CreateTicks();u=
new THREE.Geometry();u.vertices.push(
new THREE.Vector3(0,0,0));u.vertices.push(
new THREE.Vector3(-1,0,-1));
while(n.next()){var E=n.grpos;var O=(n.kind===1);var y=this.y_handle.format(n.tick,
true,
true);
if(n.last_major()){y=
"y"}
else{
if(y===null){O=
false;y=
""}}var w=(O?K:K*0.6)*Math.sin(Math.PI/4);
if(O){var v=
new THREE.TextGeometry(y,{size:J,height:0,curveSegments:10});v.computeBoundingBox();var k=0.5*(v.boundingBox.max.x-v.boundingBox.min.x);
if(r){C=
new THREE.Mesh(v,s);C.position.set(j+w+J,E+k,x-w-J);C.rotation.y=Math.PI/4;C.rotation.z=Math.PI/2;C.name=
"Y axis";this.toplevel.add(C)}C=
new THREE.Mesh(v,s);C.position.set(A-w-J,E+k,x-w-J);C.rotation.y=-Math.PI/4;C.rotation.z=-Math.PI/2;C.name=
"Y axis";this.toplevel.add(C)}
if(r){d=
new THREE.Line(u,q);d.position.set(j,E,x);d.scale.set(w,1,w);d.rotation.z=Math.PI;d.name=
"Y axis "+this.y_handle.format(n.tick);this.toplevel.add(d)}d=
new THREE.Line(u,q);d.position.set(A,E,x);d.scale.set(w,1,w);d.name=
"Y axis "+this.y_handle.format(n.tick);this.toplevel.add(d)}var L=this.z_handle.CreateTicks();u=
new THREE.Geometry();u.vertices.push(
new THREE.Vector3(0,0,0));u.vertices.push(
new THREE.Vector3(-1,1,0));
while(L.next()){var D=L.grpos;var O=L.kind==1;var y=this.z_handle.format(L.tick,
true,
true);
if(y===null){O=
false;y=
""}var w=(O?K:K*0.6)*Math.sin(Math.PI/4);
if(O){var v=
new THREE.TextGeometry(y,{size:J,height:0,curveSegments:10});v.computeBoundingBox();var N=0.8*(v.boundingBox.max.x-v.boundingBox.min.x)+0.7*J;var H=D-0.4*J;
if(r){C=
new THREE.Mesh(v,s);C.position.set(j+N,g+N,H);C.rotation.x=0.5*Math.PI;C.rotation.y=-0.75*Math.PI;C.name=
"Z axis";this.toplevel.add(C);C=
new THREE.Mesh(v,s);C.position.set(j+N,z-N,H);C.rotation.x=0.5*Math.PI;C.rotation.y=0.75*Math.PI;C.name=
"Z axis";this.toplevel.add(C);C=
new THREE.Mesh(v,s);C.position.set(A-N,z-N,H);C.rotation.x=0.5*Math.PI;C.rotation.y=0.25*Math.PI;C.name=
"Z axis";this.toplevel.add(C)}C=
new THREE.Mesh(v,s);C.position.set(A-N,g+N,H);C.rotation.x=0.5*Math.PI;C.rotation.y=-0.25*Math.PI;C.name=
"Z axis";this.toplevel.add(C)}
if(r){d=
new THREE.Line(u,q);d.position.set(j,g,D);d.scale.set(w,w,1);d.rotation.z=-Math.PI/2;d.name=
"Z axis "+this.z_handle.format(L.tick);this.toplevel.add(d);d=
new THREE.Line(u,q);d.position.set(j,z,D);d.scale.set(w,w,1);d.rotation.z=Math.PI;d.name=
"Z axis "+this.z_handle.format(L.tick);this.toplevel.add(d);d=
new THREE.Line(u,q);d.position.set(A,z,D);d.scale.set(w,w,1);d.rotation.z=Math.PI/2;d.name=
"Z axis "+this.z_handle.format(L.tick);this.toplevel.add(d)}d=
new THREE.Line(u,q);d.position.set(A,g,D);d.scale.set(w,w,1);d.name=
"Z axis "+this.z_handle.format(L.tick);this.toplevel.add(d)}
if(this.size3d===0){
return}var c=
new THREE.MeshBasicMaterial({color:0,wireframe:
true,wireframeLinewidth:0.5,side:THREE.DoubleSide});var h=
new THREE.Mesh(
new THREE.BoxGeometry(
this.size3d*2,
this.size3d*2,
this.size3d*2),c);var p=
new THREE.BoxHelper(h);p.material.color.set(0);var m=
new THREE.Object3D();m.add(p);m.position.z=this.size3d;this.toplevel.add(m)};a.Painter.TH2Painter_Draw3DBins=
function(){var o=b.rgb(a.Painter.root_colors[
this.GetObject().fFillColor]);var d=this.CreateDrawBins(100,100);var h=
new THREE.Color(14540253);h.setRGB(o.r/255,o.g/255,o.b/255);var n=
new THREE.MeshLambertMaterial({color:h.getHex()});var q=
new THREE.BoxGeometry(1,1,1);var m=this.tz.domain()[0],s=this.tz.domain()[1];var l=this.tz(m);
for(var k=0;k<d.length;++k){var g=d[k];
if(g.z<=m){
continue}var e=this.tx(g.x1),c=this.tx(g.x2),r=this.ty(g.y1),p=this.ty(g.y2),j=(g.z>s)?this.tz(s):this.tz(g.z);
if((e<-1.001*this.size3d)||(c>1.001*this.size3d)||(r<-1.001*this.size3d)||(p>1.001*this.size3d)){
continue}var t=
new THREE.Mesh(q,n.clone());t.position.set((e+c)/2,(r+p)/2,(l+j)/2);t.scale.set(c-e,p-r,j-l);
if(
"tip" in g){t.name=g.tip}this.toplevel.add(t);var f=
new THREE.BoxHelper(t);f.material.color.set(0);f.material.linewidth=1;this.toplevel.add(f)}
delete d;d=null};a.Painter.Render3D=
function(e){
if(e===undefined){e=5}
if(e<=0){
if(
"render_tmout" in
this){clearTimeout(this.render_tmout)}
if(this.renderer===undefined){
return}var d=
new Date();this.renderer.render(this.scene,this.camera);var c=
new Date();
delete this.render_tmout;
if(this.first_render_tm===0){this.first_render_tm=c.getTime()-d.getTime();console.log(
"First render tm = "+this.first_render_tm);
this[
"Add3DInteraction"]=a.Painter.add3DInteraction;this.Add3DInteraction()}
return}
if(
"render_tmout" in
this){
return}this.render_tmout=setTimeout(this.Render3D.bind(
this,0),e)};a.Painter.Resize3D=
function(){var c=this.size_for_3d(this.svg_pad().property(
"can3d"));this.apply_3d_size(c);
if((this.scene_width===c.width)&&(
this.scene_height===c.height)){
return}
if((c.width<10)||(c.height<10)){
return}this.scene_width=c.width;this.scene_height=c.height;this.camera.aspect=this.scene_width/this.scene_height;this.camera.updateProjectionMatrix();this.renderer.setSize(this.scene_width,this.scene_height);this.Render3D()};a.Painter.TH2Painter_Draw3D=
function(c){this.Create3DScene();this.zmin=this.options.Logz?this.gmin0bin*0.3:this.gminbin;this.zmax=this.gmaxbin*1.05;this.DrawXYZ();this.Draw3DBins();this.DrawTitle();this.Render3D();a.CallBack(c)};a.TH3Painter=
function(c){a.THistPainter.call(
this,c);
this[
"Create3DScene"]=a.Painter.HPainter_Create3DScene};a.TH3Painter.prototype=Object.create(a.THistPainter.prototype);a.TH3Painter.prototype.ScanContent=
function(){var d=this.GetObject();this.nbinsx=d.fXaxis.fNbins;this.nbinsy=d.fYaxis.fNbins;this.nbinsz=d.fZaxis.fNbins;this.xmin=d.fXaxis.fXmin;this.xmax=d.fXaxis.fXmax;this.ymin=d.fYaxis.fXmin;this.ymax=d.fYaxis.fXmax;this.zmin=d.fZaxis.fXmin;this.zmax=d.fZaxis.fXmax;this.gminbin=this.gmaxbin=d.getBinContent(1,1,1);var f,e,c;
for(f=0;f<this.nbinsx;++f){
for(e=0;e<this.nbinsy;++e){
for(c=0;c<this.nbinsz;++c){var g=d.getBinContent(f+1,e+1,c+1);
if(g<this.gminbin){this.gminbin=g}
else{
if(g>this.gmaxbin){this.gmaxbin=g}}}}}this.draw_content=this.gmaxbin>0;this.CreateAxisFuncs(
true,
true)};a.TH3Painter.prototype.CountStat=
function(){var q=this.GetObject(),i=0,p=0,w=0,f=0,m=0,u=0,e=0,v=this.GetSelectIndex(
"x",
"left"),t=this.GetSelectIndex(
"x",
"right"),d=this.GetSelectIndex(
"y",
"left"),c=this.GetSelectIndex(
"y",
"right"),o=this.GetSelectIndex(
"z",
"left"),l=this.GetSelectIndex(
"z",
"right"),A={entries:0,integral:0,meanx:0,meany:0,meanz:0,rmsx:0,rmsy:0,rmsz:0};
for(var s=0;s<this.nbinsx+2;++s){var k=this.GetBinX(s-0.5);var h=(s<v)?0:(s>t?2:1);
for(var z=0;z<this.nbinsy+2;++z){var r=this.GetBinY(z-0.5);var x=(z<d)?0:(z>c?2:1);
for(var j=0;j<this.nbinsz+2;++j){var y=this.GetBinZ(j-0.5);var n=(j<o)?0:(j>l?2:1);var g=q.getBinContent(s,z,j);A.entries+=g;
if((h==1)&&(x==1)&&(n==1)){i+=g;p+=k*g;w+=r*g;f+=y*g;m+=k*k*g;u+=r*r*g;e+=y*y*g}}}}
if(q.fTsumw>0){i=q.fTsumw;p=q.fTsumwx;m=q.fTsumwx2;w=q.fTsumwy;u=q.fTsumwy2;f=q.fTsumwz;e=q.fTsumwz2}
if(i>0){A.meanx=p/i;A.meany=w/i;A.meanz=f/i;A.rmsx=Math.sqrt(m/i-A.meanx*A.meanx);A.rmsy=Math.sqrt(u/i-A.meany*A.meany);A.rmsz=Math.sqrt(e/i-A.meanz*A.meanz)}A.integral=i;
if(q.fEntries>1){A.entries=q.fEntries}
return A};a.TH3Painter.prototype.FillStatistic=
function(g,i,p){
if(this.GetObject()===null){
return false}var h=g.GetObject(),f=this.CountStat(),k=i%10,n=Math.floor(i/10)%10,j=Math.floor(i/100)%10,m=Math.floor(i/1000)%10,c=Math.floor(i/10000)%10,d=Math.floor(i/100000)%10,e=Math.floor(i/1000000)%10;
if(k>0){h.AddText(this.GetObject().fName)}
if(n>0){h.AddText(
"Entries = "+g.Format(f.entries,
"entries"))}
if(j>0){h.AddText(
"Mean x = "+g.Format(f.meanx));h.AddText(
"Mean y = "+g.Format(f.meany));h.AddText(
"Mean z = "+g.Format(f.meanz))}
if(m>0){h.AddText(
"Std Dev x = "+g.Format(f.rmsx));h.AddText(
"Std Dev y = "+g.Format(f.rmsy));h.AddText(
"Std Dev z = "+g.Format(f.rmsz))}
if(e>0){h.AddText(
"Integral = "+g.Format(f.integral,
"entries"))}var l=h.fLines.arr.length,o=l*a.gStyle.StatFontSize;
if(o<=0||3==(a.gStyle.StatFont%10)){o=0.25*l*a.gStyle.StatH;h.fY1NDC=0.93-o;h.fY2NDC=0.93}
return true};a.TH3Painter.prototype.Draw3DBins=
function(){
if(!this.draw_content){
return}var g=b.rgb(a.Painter.root_colors[
this.GetObject().fFillColor]);var F=
new THREE.Color(14540253);F.setRGB(g.r/255,g.g/255,g.b/255);var r=null,x=null;
if(this.options.Box==11){r=
new THREE.MeshPhongMaterial({color:F.getHex(),specular:5197647});x=
new THREE.SphereGeometry(0.5);x.applyMatrix(
new THREE.Matrix4().makeRotationX(Math.PI/2))}
else{r=
new THREE.MeshLambertMaterial({color:F.getHex()});x=
new THREE.BoxGeometry(1,1,1)}var u=this.GetObject(),z=this.GetSelectIndex(
"x",
"left",0),y=this.GetSelectIndex(
"x",
"right",0),e=this.GetSelectIndex(
"y",
"left",0),c=this.GetSelectIndex(
"y",
"right",0),q=this.GetSelectIndex(
"z",
"left",0),p=this.GetSelectIndex(
"z",
"right",0),G=this.GetTipName(
"<br/>");var o=(this.tx(this.GetBinX(y+0.5))-this.tx(this.GetBinX(z+0.5)))/(y-z),m=(this.ty(this.GetBinY(c+0.5))-this.ty(this.GetBinY(e+0.5)))/(c-e),h=(this.tz(this.GetBinZ(p+0.5))-this.tz(this.GetBinZ(q+0.5)))/(p-q);
for(var C=z;C<y;++C){var v=this.GetBinX(C+0.5),n=this.tx(v);
for(var B=e;B<c;++B){var t=this.GetBinY(B+0.5),l=this.ty(t);
for(var A=q;A<p;++A){var D=u.getBinContent(C+1,B+1,A+1);
if(D<=this.gminbin){
continue}var E=(this.options.Color>0)?1:D/this.gmaxbin;
if(E<0.00001){
continue}var s=this.GetBinZ(A+0.5),f=this.tz(s);var w=
new THREE.Mesh(x,r.clone());w.position.set(n,l,f);w.scale.set(o*E,m*E,h*E);
if(a.gStyle.Tooltip>0){w.name=G+
"x="+a.FFormat(v,
"6.4g")+
" bin="+(C+1)+
"<br/>y="+a.FFormat(t,
"6.4g")+
" bin="+(B+1)+
"<br/>z="+a.FFormat(s,
"6.4g")+
" bin="+(A+1)+
"<br/>entries="+a.FFormat(D,
"7.0g")}this.toplevel.add(w);
if(this.options.Box!==11){var d=
new THREE.BoxHelper(w);d.material.color.set(0);d.material.linewidth=1;this.toplevel.add(d)}}}}};a.TH3Painter.prototype.Redraw=
function(c){
if(c){this.Resize3D()}
else{this.Create3DScene();this.DrawXYZ();this.Draw3DBins();this.Render3D()}};a.TH3Painter.prototype.CheckResize=
function(c){var d=this.pad_painter();var e=
true;
if(d){e=d.CheckCanvasResize(c,a.browser.isFirefox?
false:
true)}
if(e){this.Resize3D(c)}};a.TH3Painter.prototype.FillToolbar=
function(){var c=this.pad_painter(
true);
if(c===null){
return}c.AddButton(a.ToolbarIcons.undo,
"Unzoom all axes",
"UnzoomAllAxis");
if(this.draw_content){c.AddButton(a.ToolbarIcons.statbox,
"Toggle stat box",
"ToggleStatBox")}};a.TH3Painter.prototype.FillHistContextMenu=
function(c){
if(!this.draw_content){
return}c.addDrawMenu(
"Draw with",[
"box",
"box1"],
function(d){this.options=this.DecodeOptions(d);this.Redraw()})};a.Painter.drawHistogram3D=
function(f,c,e){a.extend(
this,
new a.TH3Painter(c));this.SetDivId(f,4);this.options=this.DecodeOptions(e);this.CheckPadOptions();this.ScanContent();this.Redraw();this.DrawTitle();
if(a.gStyle.AutoStat&&
this.create_canvas){var d=this.CreateStat();
if(d){a.draw(this.divid,d,
"")}}this.FillToolbar();
return this.DrawingReady()};a.Painter.drawPolyMarker3D=
function(l,c,d){this.SetDivId(l);var i=this.main_painter();
if((i==null)||!(
"renderer" in i)){
return this.DrawingReady()}var g=c.fP.length;var f=3;
if((a.gStyle.OptimizeDraw>0)&&(g>1000*3)){f=Math.floor(g/1000/3)*3;
if(f<=6){f=6}}var k=b.rgb(a.Painter.root_colors[c.fMarkerColor]);var h=
new THREE.Color(14540253);h.setRGB(k.r/255,k.g/255,k.b/255);var j=
new THREE.MeshPhongMaterial({color:h.getHex(),specular:5197647});var m=
new THREE.BoxGeometry(1,1,1);
for(var e=0;e<g;e+=f){var o=
new THREE.Mesh(m,j.clone());o.position.set(i.tx(c.fP[e]),i.ty(c.fP[e+1]),i.tz(c.fP[e+2]));o.name=(c.fName!==
"TPolyMarker3D")?(c.fName+
": "):(
"bin "+e/3+
": ");o.name+=i.x_handle.format(c.fP[e])+
","+i.y_handle.format(c.fP[e+1])+
","+i.z_handle.format(c.fP[e+2]);i.toplevel.add(o)}i.Render3D();
return this.DrawingReady()};
return a.Painter}));