/*
	Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
	Available via Academic Free License >= 2.1 OR the modified BSD license.
	see: http://dojotoolkit.org/license for details
*/


window[esri._dojoScopeName||"dojo"]._xdResourceLoaded(function(_1,_2,_3){return {depends:[["provide","dojox.gfx3d.scheduler"],["provide","dojox.gfx3d.drawer"],["require","dojox.gfx3d.vector"]],defineResource:function(_4,_5,_6){if(!_4._hasResource["dojox.gfx3d.scheduler"]){_4._hasResource["dojox.gfx3d.scheduler"]=true;_4.provide("dojox.gfx3d.scheduler");_4.provide("dojox.gfx3d.drawer");_4.require("dojox.gfx3d.vector");_4.mixin(_6.gfx3d.scheduler,{zOrder:function(_7,_8){_8=_8?_8:_6.gfx3d.scheduler.order;_7.sort(function(a,b){return _8(b)-_8(a);});return _7;},bsp:function(_9,_a){_a=_a?_a:_6.gfx3d.scheduler.outline;var p=new _6.gfx3d.scheduler.BinarySearchTree(_9[0],_a);_4.forEach(_9.slice(1),function(_b){p.add(_b,_a);});return p.iterate(_a);},order:function(it){return it.getZOrder();},outline:function(it){return it.getOutline();}});_4.declare("dojox.gfx3d.scheduler.BinarySearchTree",null,{constructor:function(_c,_d){this.plus=null;this.minus=null;this.object=_c;var o=_d(_c);this.orient=o[0];this.normal=_6.gfx3d.vector.normalize(o);},add:function(_e,_f){var _10=0.5,o=_f(_e),v=_6.gfx3d.vector,n=this.normal,a=this.orient,BST=_6.gfx3d.scheduler.BinarySearchTree;if(_4.every(o,function(_11){return Math.floor(_10+v.dotProduct(n,v.substract(_11,a)))<=0;})){if(this.minus){this.minus.add(_e,_f);}else{this.minus=new BST(_e,_f);}}else{if(_4.every(o,function(_12){return Math.floor(_10+v.dotProduct(n,v.substract(_12,a)))>=0;})){if(this.plus){this.plus.add(_e,_f);}else{this.plus=new BST(_e,_f);}}else{throw "The case: polygon cross siblings' plate is not implemneted yet";}}},iterate:function(_13){var _14=0.5;var v=_6.gfx3d.vector;var _15=[];var _16=null;var _17={x:0,y:0,z:-10000};if(Math.floor(_14+v.dotProduct(this.normal,v.substract(_17,this.orient)))<=0){_16=[this.plus,this.minus];}else{_16=[this.minus,this.plus];}if(_16[0]){_15=_15.concat(_16[0].iterate());}_15.push(this.object);if(_16[1]){_15=_15.concat(_16[1].iterate());}return _15;}});_4.mixin(_6.gfx3d.drawer,{conservative:function(_18,_19,_1a){_4.forEach(this.objects,function(_1b){_1b.destroy();});_4.forEach(_19,function(_1c){_1c.draw(_1a.lighting);});},chart:function(_1d,_1e,_1f){_4.forEach(this.todos,function(_20){_20.draw(_1f.lighting);});}});}}};});