Clazz.declarePackage("J.jvxl.api");Clazz.declareInterface(J.jvxl.api,"VertexDataServer");Clazz.declarePackage("J.jvxl.api");Clazz.load(["J.jvxl.api.VertexDataServer"],"J.jvxl.api.MeshDataServer",null,function(){Clazz.declareInterface(J.jvxl.api,"MeshDataServer",J.jvxl.api.VertexDataServer)});Clazz.declarePackage("J.shapesurface");
Clazz.load(["J.jvxl.api.MeshDataServer","J.shape.MeshCollection","J.util.P3i","$.P4"],"J.shapesurface.Isosurface","java.lang.Boolean $.Float java.util.Hashtable J.io.JmolBinary J.jvxl.data.JvxlCoder $.JvxlData $.MeshData J.jvxl.readers.SurfaceGenerator J.shape.Mesh J.shapesurface.IsosurfaceMesh J.util.ArrayUtil $.AxisAngle4f $.BS $.C $.ColorUtil $.Escape $.JmolList $.Logger $.Matrix3f $.MeshSurface $.P3 $.Parser $.Quaternion $.SB $.TextFormat $.V3 J.viewer.JC $.Viewer".split(" "),function(){c$=Clazz.decorateAsClass(function(){this.actualID=
this.thisMesh=this.isomeshes=null;this.explicitContours=this.iHaveBitSets=!1;this.moNumber=this.atomIndex=0;this.moLinearCombination=null;this.meshColix=this.defaultColix=0;this.center=null;this.scale3d=0;this.isColorExplicit=this.isPhaseColored=!1;this.scriptAppendix="";this.jvxlData=this.sg=null;this.withinDistance2=0;this.isWithinNot=!1;this.cutoffRange=this.withinPoints=null;this.allowMesh=!0;this.script=null;this.iHaveModelIndex=!1;this.nLCAO=0;this.lcaoDir=null;this.privateKey=0;this.associateNormals=
!1;this.keyXy=this.ptXY=null;Clazz.instantialize(this,arguments)},J.shapesurface,"Isosurface",J.shape.MeshCollection,J.jvxl.api.MeshDataServer);Clazz.prepareFields(c$,function(){this.isomeshes=Array(4);this.lcaoDir=new J.util.P4;this.ptXY=new J.util.P3i});Clazz.overrideMethod(c$,"allocMesh",function(a,b){var c=this.meshCount++;this.meshes=this.isomeshes=J.util.ArrayUtil.ensureLength(this.isomeshes,2*this.meshCount);this.currentMesh=this.thisMesh=this.isomeshes[c]=null==b?new J.shapesurface.IsosurfaceMesh(a,
this.colix,c):b;this.currentMesh.index=c;this.sg.setJvxlData(this.jvxlData=this.thisMesh.jvxlData)},"~S,J.shape.Mesh");$_M(c$,"initShape",function(){Clazz.superCall(this,J.shapesurface.Isosurface,"initShape",[]);this.myType="isosurface";this.newSg()});$_M(c$,"newSg",function(){this.sg=new J.jvxl.readers.SurfaceGenerator(this.viewer,this,null,this.jvxlData=new J.jvxl.data.JvxlData);this.sg.getParams().showTiming=this.viewer.global.showTiming;this.sg.setVersion("Jmol "+J.viewer.Viewer.getJmolVersion())});
$_M(c$,"clearSg",function(){this.sg=null});Clazz.overrideMethod(c$,"setProperty",function(a,b,c){this.setPropI(a,b,c)},"~S,~O,J.util.BS");$_M(c$,"setPropI",function(a,b,c){if("delete"===a)this.setPropertySuper(a,b,c),this.explicitID||(this.nLCAO=this.nUnnamed=0),this.currentMesh=this.thisMesh=null;else if("remapInherited"===a)for(var d=this.meshCount;0<=--d;)null!=this.isomeshes[d]&&"#inherit;".equals(this.isomeshes[d].colorCommand)&&this.isomeshes[d].remapColors(this.viewer,null,NaN);else if("remapColor"===
a)null!=this.thisMesh&&this.thisMesh.remapColors(this.viewer,b,this.translucentLevel);else if("thisID"===a)null!=this.actualID&&(b=this.actualID),this.setPropertySuper("thisID",b,null);else if("atomcolor"===a)null!=this.thisMesh&&(null==this.thisMesh.vertexSource&&(d=!this.thisMesh.isColorSolid?0:this.thisMesh.colix,this.setProperty("init",null,null),this.setProperty("map",Boolean.FALSE,null),this.setProperty("property",Clazz.newFloatArray(this.viewer.getAtomCount(),0),null),0!=d&&(this.thisMesh.colorCommand=
"color isosurface "+J.util.C.getHexCode(d),this.setProperty("color",Integer.$valueOf(J.util.C.getArgb(d)),null))),this.thisMesh.colorAtoms(J.util.C.getColixO(b),c));else if("pointSize"===a)null!=this.thisMesh&&(this.thisMesh.volumeRenderPointSize=b.floatValue());else if("vertexcolor"===a)null!=this.thisMesh&&this.thisMesh.colorVertices(J.util.C.getColixO(b),c);else if("colorPhase"===a)null!=this.thisMesh&&(this.thisMesh.colorPhased=!0,this.thisMesh.colix=this.thisMesh.jvxlData.minColorIndex=J.util.C.getColix(b[0].intValue()),
this.thisMesh.jvxlData.maxColorIndex=J.util.C.getColix(b[1].intValue()),this.thisMesh.jvxlData.isBicolorMap=!0,this.thisMesh.jvxlData.colorDensity=!1,this.thisMesh.isColorSolid=!1,this.thisMesh.remapColors(this.viewer,null,this.translucentLevel));else if("color"===a){if(null!=this.thisMesh)this.thisMesh.isColorSolid=!0,this.thisMesh.polygonColixes=null,this.thisMesh.colorEncoder=null,this.thisMesh.vertexColorMap=null;else if(!J.util.TextFormat.isWild(this.previousMeshID))for(d=this.meshCount;0<=--d;)this.isomeshes[d].isColorSolid=
!0,this.isomeshes[d].polygonColixes=null,this.isomeshes[d].colorEncoder=null,this.isomeshes[d].vertexColorMap=null;this.setPropertySuper(a,b,c)}else if("nocontour"===a)null!=this.thisMesh&&this.thisMesh.deleteContours();else if("fixed"===a)this.isFixed=b.booleanValue(),this.setMeshI();else if("newObject"===a)null!=this.thisMesh&&this.thisMesh.clearType(this.thisMesh.meshType,!1);else if("moveIsosurface"===a)null!=this.thisMesh&&(this.thisMesh.updateCoordinates(b,null),this.thisMesh.altVertices=null);
else if("refreshTrajectories"===a)for(d=this.meshCount;0<=--d;)null!=this.meshes[d].connections&&this.meshes[d].modelIndex==b[0].intValue()&&this.meshes[d].updateCoordinates(b[2],b[1]);else if("modelIndex"===a)this.iHaveModelIndex||(this.modelIndex=b.intValue(),this.isFixed=0>this.modelIndex,this.sg.setModelIndex(Math.abs(this.modelIndex)));else if("lcaoCartoon"===a||"lonePair"===a||"radical"===a)this.explicitID||this.setPropertySuper("thisID",null,null),this.sg.setParameter("lcaoCartoonCenter",b[2])||
this.drawLcaoCartoon(b[0],b[1],b[3],"lonePair"===a?2:"radical"===a?1:0);else if(!("select"===a&&this.iHaveBitSets||"ignore"===a&&this.iHaveBitSets))if("meshcolor"===a)d=b.intValue(),this.meshColix=J.util.C.getColix(d),null!=this.thisMesh&&(this.thisMesh.meshColix=this.meshColix);else if("offset"===a)b=J.util.P3.newP(b),b.equals(J.viewer.JC.center)&&(b=null),null!=this.thisMesh&&(this.thisMesh.rotateTranslate(null,b,!0),this.thisMesh.altVertices=null);else if("rotate"===a)null!=this.thisMesh&&(this.thisMesh.rotateTranslate(J.util.Quaternion.newP4(b),
null,!0),this.thisMesh.altVertices=null);else if("bsDisplay"===a)this.bsDisplay=b;else if("displayWithin"===a)d=b,this.displayWithinDistance2=d[0].floatValue(),this.isDisplayWithinNot=0>this.displayWithinDistance2,this.displayWithinDistance2*=this.displayWithinDistance2,this.displayWithinPoints=d[3],0==this.displayWithinPoints.size()&&(this.displayWithinPoints=this.viewer.getAtomPointVector(d[2]));else if("finalize"===a)null!=this.thisMesh&&(null!=b&&!b.startsWith("; isosurface map")&&(this.thisMesh.setDiscreteColixes(this.sg.getParams().contoursDiscrete,
this.sg.getParams().contourColixes),this.setJvxlInfo()),this.setScriptInfo(b)),this.clearSg();else if("privateKey"===a)this.privateKey=b.doubleValue();else if("connections"===a)null!=this.currentMesh&&(this.connections=b,0<=this.connections[0]&&this.connections[0]<this.viewer.getAtomCount()?this.currentMesh.connections=this.connections:this.connections=this.currentMesh.connections=null);else if("cutoffRange"===a)this.cutoffRange=b;else{if("slab"===a){if(Clazz.instanceOf(b,Integer)){null!=this.thisMesh&&
(this.thisMesh.jvxlData.slabValue=b.intValue());return}if(null!=this.thisMesh){c=b;switch(c[0].intValue()){case 1073742018:d=c[1];b=this.getMesh(d[1]);if(null==b)return;d[1]=b}this.slabPolygons(c);return}}if("cap"===a&&null!=this.thisMesh&&0!=this.thisMesh.polygonCount)this.thisMesh.slabPolygons(b,!0),this.thisMesh.initialize(this.thisMesh.lighting,null,null);else{if("map"===a&&(null!=this.sg&&(this.sg.getParams().isMapped=!0),this.setProperty("squareData",Boolean.FALSE,null),null==this.thisMesh||
0==this.thisMesh.vertexCount))return;if("deleteVdw"===a){for(d=this.meshCount;0<=--d;)null!=this.isomeshes[d].bsVdw&&(null==c||c.intersects(this.isomeshes[d].bsVdw))&&this.deleteMeshI(d);this.currentMesh=this.thisMesh=null}else{if("mapColor"===a||"readFile"===a){if(null==b){b=this.viewer.getBufferedReaderOrErrorMessageFromName(this.sg.getFileName(),null,!0);if(Clazz.instanceOf(b,String)){J.util.Logger.error("Isosurface: could not open file "+this.sg.getFileName()+" -- "+b);return}if(!Clazz.instanceOf(b,
java.io.BufferedReader))try{b=J.io.JmolBinary.getBufferedReader(b,"ISO-8859-1")}catch(e){if(!Clazz.exceptionOf(e,java.io.IOException))throw e;}}}else"atomIndex"===a?this.atomIndex=b.intValue():"center"===a?this.center.setT(b):"colorRGB"===a?(d=b.intValue(),this.defaultColix=J.util.C.getColix(d)):"contour"===a?this.explicitContours=!0:"functionXY"===a?this.sg.isStateDataRead()&&this.setScriptInfo(null):"init"===a?this.newSg():"getSurfaceSets"===a?null!=this.thisMesh&&(this.thisMesh.jvxlData.thisSet=
b.intValue(),this.thisMesh.calculatedVolume=null,this.thisMesh.calculatedArea=null):"localName"===a?(b=this.viewer.getOutputStream(b,null),a="outputStream"):"molecularOrbital"===a?(Clazz.instanceOf(b,Integer)?(this.moNumber=b.intValue(),this.moLinearCombination=null):(this.moLinearCombination=b,this.moNumber=0),this.isColorExplicit||(this.isPhaseColored=!0)):"phase"===a?this.isPhaseColored=!0:"plane"!==a&&"pocket"!==a&&("scale3d"===a?(this.scale3d=b.floatValue(),null!=this.thisMesh&&(this.thisMesh.scale3d=
this.thisMesh.jvxlData.scale3d=this.scale3d,this.thisMesh.altVertices=null)):"title"===a?(Clazz.instanceOf(b,String)&&"-".equals(b)&&(b=null),this.setPropertySuper(a,b,c),b=this.title):"withinPoints"===a?(d=b,this.withinDistance2=d[0].floatValue(),this.isWithinNot=0>this.withinDistance2,this.withinDistance2*=this.withinDistance2,this.withinPoints=d[3],0==this.withinPoints.size()&&(this.withinPoints=this.viewer.getAtomPointVector(d[2]))):("nci"===a||"orbital"===a)&&null!=this.sg?this.sg.getParams().testFlags=
this.viewer.getTestFlag(2)?2:0:"solvent"===a&&(this.sg.getParams().testFlags=this.viewer.getTestFlag(1)?1:0));if(null!=this.sg&&this.sg.setProp(a,b,c)){if(this.sg.isValid())return;a="delete"}if("init"===a)this.explicitID=!1,this.scriptAppendix="",b=Clazz.instanceOf(b,String)?b:null,d=null==b?-1:b.indexOf("# ID="),this.actualID=0<=d?J.util.Parser.getQuotedStringAt(b,d):null,this.setPropertySuper("thisID","+PREVIOUS_MESH+",null),null!=b&&!(this.iHaveBitSets=this.getScriptBitSets(b,null))&&this.sg.setParameter("select",
c),this.initializeIsosurface(),this.sg.setModelIndex(this.isFixed?-1:this.modelIndex);else if("clear"===a)this.discardTempData(!0);else if("deleteModelAtoms"===a){c=b[2][0];a=b[2][1];for(var f=b[2][2],d=this.meshCount;0<=--d;)if(b=this.meshes[d],null!=b){if(null!=b.connections){var g=b.connections[0];g>=a+f?b.connections[0]=g-f:g>=a&&(b.connections=null)}b.connections=null;b.modelIndex==c?(this.meshCount--,b===this.currentMesh&&(this.currentMesh=this.thisMesh=null),this.meshes=this.isomeshes=J.util.ArrayUtil.deleteElements(this.meshes,
d,1)):b.modelIndex>c&&(b.modelIndex--,b.atomIndex>=a&&(b.atomIndex-=f))}}else this.setPropertySuper(a,b,c)}}}},"~S,~O,J.util.BS");$_M(c$,"slabPolygons",function(a){this.thisMesh.slabPolygons(a,!1);this.thisMesh.reinitializeLightingAndColor(this.viewer)},"~A");$_M(c$,"setPropertySuper",($fz=function(a,b,c){"thisID"===a&&null!=this.currentMesh&&this.currentMesh.thisID.equals(b)?this.checkExplicit(b):(this.currentMesh=this.thisMesh,this.setPropMC(a,b,c),this.thisMesh=this.currentMesh,this.jvxlData=null==
this.thisMesh?null:this.thisMesh.jvxlData,null!=this.sg&&this.sg.setJvxlData(this.jvxlData))},$fz.isPrivate=!0,$fz),"~S,~O,J.util.BS");Clazz.overrideMethod(c$,"getPropertyData",function(a,b){if("colorEncoder"===a){var c=this.getMesh(b[0]);return null==c||null==(b[1]=c.colorEncoder)?!1:!0}if("intersectPlane"===a){c=this.getMesh(b[0]);if(null==c)return!1;b[3]=Integer.$valueOf(c.modelIndex);c.getIntersection(0,b[1],null,b[2],null,null,null,!1,!1,135266319,!1);return!0}if("getBoundingBox"===a){c=b[0];
c=this.getMesh(c);if(null==c||null==c.vertices)return!1;b[2]=c.jvxlData.boundingBox;if(null!=c.mat4){var d=Array(2);d[0]=J.util.P3.newP(c.jvxlData.boundingBox[0]);d[1]=J.util.P3.newP(c.jvxlData.boundingBox[1]);var e=new J.util.V3;c.mat4.get(e);d[0].add(e);d[1].add(e);b[2]=d}return!0}if("unitCell"===a)return c=this.getMesh(b[0]),null!=c&&null!=(b[1]=c.getUnitCell());if("getCenter"===a&&-2147483648==b[1].intValue()){c=b[0];c=this.getMesh(c);if(null==c||null==c.vertices)return!1;d=J.util.P3.newP(c.jvxlData.boundingBox[0]);
d.add(c.jvxlData.boundingBox[1]);d.scale(0.5);null!=c.mat4&&(e=new J.util.V3,c.mat4.get(e),d.add(e));b[2]=d;return!0}return this.getPropDataMC(a,b)},"~S,~A");Clazz.overrideMethod(c$,"getProperty",function(a){return this.getPropI(a)},"~S,~N");$_M(c$,"getPropI",function(a){var b=this.getPropMC(a);if(null!=b)return b;if("dataRange"===a)return null==this.thisMesh||null!=this.jvxlData.jvxlPlane&&null==this.thisMesh.colorEncoder?null:[this.jvxlData.mappedDataMin,this.jvxlData.mappedDataMax,this.jvxlData.isColorReversed?
this.jvxlData.valueMappedToBlue:this.jvxlData.valueMappedToRed,this.jvxlData.isColorReversed?this.jvxlData.valueMappedToRed:this.jvxlData.valueMappedToBlue];if("moNumber"===a)return Integer.$valueOf(this.moNumber);if("moLinearCombination"===a)return this.moLinearCombination;if("nSets"===a)return Integer.$valueOf(null==this.thisMesh?0:this.thisMesh.nSets);if("area"===a)return null==this.thisMesh?Float.$valueOf(NaN):this.calculateVolumeOrArea(!0);if("volume"===a)return null==this.thisMesh?Float.$valueOf(NaN):
this.calculateVolumeOrArea(!1);if(null==this.thisMesh)return null;if("cutoff"===a)return Float.$valueOf(this.jvxlData.cutoff);if("minMaxInfo"===a)return[this.jvxlData.dataMin,this.jvxlData.dataMax];if("plane"===a)return this.jvxlData.jvxlPlane;if("contours"===a)return this.thisMesh.getContours();if("jvxlDataXml"===a||"jvxlMeshXml"===a)return b=null,this.jvxlData.slabInfo=null,"jvxlMeshXml"===a||this.jvxlData.vertexDataOnly||null!=this.thisMesh.bsSlabDisplay&&null==this.thisMesh.bsSlabGhost?(b=new J.jvxl.data.MeshData,
this.fillMeshData(b,1,null),b.polygonColorData=J.shapesurface.Isosurface.getPolygonColorData(b.polygonCount,b.polygonColixes,b.bsSlabDisplay)):null!=this.thisMesh.bsSlabGhost&&(this.jvxlData.slabInfo=this.thisMesh.slabOptions.toString()),a=new J.util.SB,this.getMeshCommand(a,this.thisMesh.index),this.thisMesh.setJvxlColorMap(!0),J.jvxl.data.JvxlCoder.jvxlGetFile(this.jvxlData,b,this.title,"",!0,1,a.toString(),null);if("jvxlFileInfo"===a)return this.thisMesh.setJvxlColorMap(!1),J.jvxl.data.JvxlCoder.jvxlGetInfo(this.jvxlData);
if("command"===a){var b=this.previousMeshID.toUpperCase(),c=J.util.TextFormat.isWild(b);a=new J.util.SB;for(var d=this.meshCount;0<=--d;){var e=this.meshes[d].thisID.toUpperCase();(e.equals(b)||c&&J.util.TextFormat.isMatch(e,b,!0,!0))&&this.getMeshCommand(a,d)}return a.toString()}return null},"~S");$_M(c$,"calculateVolumeOrArea",($fz=function(a){if(a){if(null!=this.thisMesh.calculatedArea)return this.thisMesh.calculatedArea}else if(null!=this.thisMesh.calculatedVolume)return this.thisMesh.calculatedVolume;
var b=new J.jvxl.data.MeshData;this.fillMeshData(b,1,null);b.nSets=this.thisMesh.nSets;b.vertexSets=this.thisMesh.vertexSets;if(!a&&this.thisMesh.jvxlData.colorDensity)return a=this.thisMesh.jvxlData.voxelVolume,a*=null==this.thisMesh.bsSlabDisplay?this.thisMesh.vertexCount:this.thisMesh.bsSlabDisplay.cardinality(),this.thisMesh.calculatedVolume=Float.$valueOf(a);b=b.calculateVolumeOrArea(this.thisMesh.jvxlData.thisSet,a,!1);a?this.thisMesh.calculatedArea=b:this.thisMesh.calculatedVolume=b;return b},
$fz.isPrivate=!0,$fz),"~B");c$.getPolygonColorData=$_M(c$,"getPolygonColorData",function(a,b,c){if(null==b)return null;for(var d=new J.util.SB,e=0,f=0,g=!1,h=0;h<a||!0==(g=!0);h++)if(g||null==c||c.get(h))if(g||b[h]!=f){0!=e&&d.append(" ").appendI(e).append(" ").appendI(0==f?0:J.util.C.getArgb(f));if(g)break;f=b[h];e=1}else e++;d.append("\n");return d.toString()},"~N,~A,J.util.BS");Clazz.overrideMethod(c$,"getShapeState",function(){this.clean();var a=new J.util.SB;a.append("\n");for(var b=0;b<this.meshCount;b++)this.getMeshCommand(a,
b);return a.toString()});$_M(c$,"getMeshCommand",($fz=function(a,b){var c=this.meshes[b];if(!(null==c||null==c.scriptCommand)){var d=c.scriptCommand;1<this.viewer.getModelCount()&&J.shape.Shape.appendCmd(a,"frame "+this.viewer.getModelNumberDotted(c.modelIndex));var d=J.util.TextFormat.simpleReplace(d,";; isosurface map"," map"),d=J.util.TextFormat.simpleReplace(d,"; isosurface map"," map"),d=d.$replace("\t"," "),d=J.util.TextFormat.simpleReplace(d,";#","; #"),e=d.indexOf("; #");0<=e&&(d=d.substring(0,
e));null!=c.connections&&(d+=" connect "+J.util.Escape.eAI(c.connections));d=J.util.TextFormat.trim(d,";");null!=c.linkedMesh&&(d+=" LINK");J.shape.Shape.appendCmd(a,d);e=this.myType+" ID "+J.util.Escape.eS(c.thisID);0<=c.jvxlData.thisSet&&J.shape.Shape.appendCmd(a,e+" set "+(c.jvxlData.thisSet+1));null!=c.mat4&&J.shape.Shape.appendCmd(a,e+" move "+J.util.Escape.matrixToScript(c.mat4));0!=c.scale3d&&J.shape.Shape.appendCmd(a,e+" scale3d "+c.scale3d);-2147483648!=c.jvxlData.slabValue&&J.shape.Shape.appendCmd(a,
e+" slab "+c.jvxlData.slabValue);null!=c.slabOptions&&J.shape.Shape.appendCmd(a,c.slabOptions.toString());if("#"!=d.charAt(0)&&(this.allowMesh&&J.shape.Shape.appendCmd(a,c.getState(this.myType)),!c.isColorSolid&&J.util.C.isColixTranslucent(c.colix)&&J.shape.Shape.appendCmd(a,"color "+this.myType+" "+J.shape.Shape.getTranslucentLabel(c.colix)),null!=c.colorCommand&&!c.colorCommand.equals("#inherit;")&&J.shape.Shape.appendCmd(a,c.colorCommand),d=c.isColorSolid&&null!=c.polygonColixes,c.isColorSolid&&
!d?J.shape.Shape.appendCmd(a,J.shape.Shape.getColorCommandUnk(this.myType,c.colix,this.translucentAllowed)):c.jvxlData.isBicolorMap&&c.colorPhased&&J.shape.Shape.appendCmd(a,"color isosurface phase "+J.shape.Shape.encodeColor(c.jvxlData.minColorIndex)+" "+J.shape.Shape.encodeColor(c.jvxlData.maxColorIndex)),null!=c.vertexColorMap))for(var f,c=c.vertexColorMap.entrySet().iterator();c.hasNext()&&((f=c.next())||1);)d=f.getValue(),d.isEmpty()||J.shape.Shape.appendCmd(a,"color "+this.myType+" "+J.util.Escape.eBS(d)+
" "+f.getKey())}},$fz.isPrivate=!0,$fz),"J.util.SB,~N");$_M(c$,"getScriptBitSets",($fz=function(a,b){this.script=a;var c;this.iHaveModelIndex=!1;this.modelIndex=-1;if(null!=a&&0<=(c=a.indexOf("MODEL({"))){var d=a.indexOf("})",c);0<d&&(c=J.util.Escape.uB(a.substring(c+3,d+1)),this.modelIndex=null==c?-1:c.nextSetBit(0),this.iHaveModelIndex=0<=this.modelIndex)}if(null==a)return!1;this.getCapSlabInfo(a);c=a.indexOf("# ({");if(0>c)return!1;d=a.indexOf("})",c);if(0>d)return!1;c=J.util.Escape.uB(a.substring(c+
2,d+2));null==b?this.sg.setParameter("select",c):b[0]=c;if(0>(c=a.indexOf("({",d)))return!0;d=a.indexOf("})",c);if(0>d)return!1;c=J.util.Escape.uB(a.substring(c+1,d+1));null==b?this.sg.setParameter("ignore",c):b[1]=c;if((c=a.indexOf("/({",d))==d+2){if(0>(d=a.indexOf("})",c)))return!1;c=J.util.Escape.uB(a.substring(c+3,d+1));null==b?this.viewer.setTrajectoryBs(c):b[2]=c}return!0},$fz.isPrivate=!0,$fz),"~S,~A");$_M(c$,"getCapSlabInfo",function(a){var b=a.indexOf("# SLAB=");0<=b&&this.sg.setParameter("slab",
J.util.MeshSurface.getCapSlabObject(J.util.Parser.getQuotedStringAt(a,b),!1));b=a.indexOf("# CAP=");0<=b&&this.sg.setParameter("slab",J.util.MeshSurface.getCapSlabObject(J.util.Parser.getQuotedStringAt(a,b),!0))},"~S");$_M(c$,"initializeIsosurface",($fz=function(){this.iHaveModelIndex||(this.modelIndex=this.viewer.getCurrentModelIndex());this.isFixed=0>this.modelIndex;0>this.modelIndex&&(this.modelIndex=0);this.title=null;this.explicitContours=!1;this.atomIndex=-1;this.colix=5;this.defaultColix=this.meshColix=
this.translucentLevel=0;this.isPhaseColored=this.isColorExplicit=!1;this.center=J.util.P3.new3(3.4028235E38,3.4028235E38,3.4028235E38);this.scale3d=0;this.connections=this.linkedMesh=this.bsDisplay=this.displayWithinPoints=this.cutoffRange=this.withinPoints=null;this.initState()},$fz.isPrivate=!0,$fz));$_M(c$,"initState",($fz=function(){this.associateNormals=!0;this.sg.initState()},$fz.isPrivate=!0,$fz));$_M(c$,"setMeshI",($fz=function(){this.thisMesh.visible=!0;this.thisMesh.modelIndex=0<=(this.thisMesh.atomIndex=
this.atomIndex)?this.viewer.getAtomModelIndex(this.atomIndex):this.isFixed?-1:0<=this.modelIndex?this.modelIndex:this.viewer.getCurrentModelIndex();this.thisMesh.scriptCommand=this.script;this.thisMesh.ptCenter.setT(this.center);this.thisMesh.scale3d=null==this.thisMesh.jvxlData.jvxlPlane?0:this.scale3d},$fz.isPrivate=!0,$fz));$_M(c$,"discardTempData",function(a){a&&(this.title=null,null!=this.thisMesh&&(this.thisMesh.surfaceSet=null))},"~B");$_M(c$,"getDefaultColix",($fz=function(){if(0!=this.defaultColix)return this.defaultColix;
if(!this.sg.isCubeData())return this.colix;var a=0<=this.sg.getCutoff()?-11525984:-6283184;return J.util.C.getColix(a)},$fz.isPrivate=!0,$fz));$_M(c$,"drawLcaoCartoon",($fz=function(a,b,c,d){var e=this.sg.setLcao(),f=c.x+c.y+c.z;this.defaultColix=J.util.C.getColix(this.sg.getColor(1));var g=J.util.C.getColix(this.sg.getColor(-1)),h=new J.util.V3,j=0<e.length&&"-"==e.charAt(0);j&&(e=e.substring(1));j=j?-1:1;h.cross(a,b);if(0!=f){var k=new J.util.AxisAngle4f;0!=c.x?k.setVA(b,f):0!=c.y?k.setVA(h,f):
k.setVA(a,f);c=new J.util.Matrix3f;c.setAA(k);c.transform(b);c.transform(h);c.transform(a)}null==this.thisMesh&&0==this.nLCAO&&(this.nLCAO=this.meshCount);c=null==this.thisMesh?(0<d?"lp":"lcao")+ ++this.nLCAO+"_"+e:this.thisMesh.thisID;null==this.thisMesh&&this.allocMesh(c,null);e.equals("px")?(this.thisMesh.thisID+="a",e=this.thisMesh,this.createLcaoLobe(b,j,d),0<d||(this.setProperty("thisID",c+"b",null),this.createLcaoLobe(b,-j,d),this.thisMesh.colix=g,this.linkedMesh=this.thisMesh.linkedMesh=e)):
e.equals("py")?(this.thisMesh.thisID+="a",e=this.thisMesh,this.createLcaoLobe(h,j,d),0<d||(this.setProperty("thisID",c+"b",null),this.createLcaoLobe(h,-j,d),this.thisMesh.colix=g,this.linkedMesh=this.thisMesh.linkedMesh=e)):e.equals("pz")?(this.thisMesh.thisID+="a",e=this.thisMesh,this.createLcaoLobe(a,j,d),0<d||(this.setProperty("thisID",c+"b",null),this.createLcaoLobe(a,-j,d),this.thisMesh.colix=g,this.linkedMesh=this.thisMesh.linkedMesh=e)):e.equals("pza")||0==e.indexOf("sp")||0==e.indexOf("d")||
0==e.indexOf("lp")?this.createLcaoLobe(a,j,d):e.equals("pzb")?this.createLcaoLobe(a,-j,d):e.equals("pxa")?this.createLcaoLobe(b,j,d):e.equals("pxb")?this.createLcaoLobe(b,-j,d):e.equals("pya")?this.createLcaoLobe(h,j,d):e.equals("pyb")?this.createLcaoLobe(h,-j,d):e.equals("spacefill")||e.equals("cpk")?this.createLcaoLobe(null,2*this.viewer.getAtomRadius(this.atomIndex),d):this.createLcaoLobe(null,1,d)},$fz.isPrivate=!0,$fz),"J.util.V3,J.util.V3,J.util.V3,~N");$_M(c$,"createLcaoLobe",($fz=function(a,
b,c){this.initState();J.util.Logger.debugging&&J.util.Logger.debug("creating isosurface ID "+this.thisMesh.thisID);null==a?this.setProperty("sphere",Float.$valueOf(b/2),null):(this.lcaoDir.x=a.x*b,this.lcaoDir.y=a.y*b,this.lcaoDir.z=a.z*b,this.lcaoDir.w=0.7,this.setProperty(2==c?"lp":1==c?"rad":"lobe",this.lcaoDir,null));this.thisMesh.colix=this.defaultColix;this.setScriptInfo(null)},$fz.isPrivate=!0,$fz),"J.util.V3,~N,~N");Clazz.overrideMethod(c$,"invalidateTriangles",function(){this.thisMesh.invalidatePolygons()});
Clazz.overrideMethod(c$,"setOutputStream",function(a,b){a.setOutputStream(b,this.viewer,this.privateKey)},"J.api.JmolDocument,java.io.OutputStream");Clazz.overrideMethod(c$,"fillMeshData",function(a,b,c){if(null==a){if(null==this.thisMesh&&this.allocMesh(null,null),this.thisMesh.isMerged||this.thisMesh.clearType(this.myType,this.sg.getIAddGridPoints()),this.thisMesh.connections=this.connections,this.thisMesh.colix=this.getDefaultColix(),this.thisMesh.meshColix=this.meshColix,this.isPhaseColored||
this.thisMesh.jvxlData.isBicolorMap)this.thisMesh.isColorSolid=!1}else if(null==c&&(c=this.thisMesh),null!=c)switch(b){case 1:a.mergeVertexCount0=c.mergeVertexCount0;a.vertices=c.vertices;a.vertexSource=c.vertexSource;a.vertexValues=c.vertexValues;a.vertexCount=c.vertexCount;a.vertexIncrement=c.vertexIncrement;a.polygonCount=c.polygonCount;a.polygonIndexes=c.polygonIndexes;a.polygonColixes=c.polygonColixes;a.bsSlabDisplay=c.bsSlabDisplay;a.bsSlabGhost=c.bsSlabGhost;a.slabColix=c.slabColix;a.slabMeshType=
c.slabMeshType;a.polygonCount0=c.polygonCount0;a.vertexCount0=c.vertexCount0;a.slabOptions=c.slabOptions;break;case 2:if(null==c.vertexColixes||c.vertexCount>c.vertexColixes.length)c.vertexColixes=Clazz.newShortArray(c.vertexCount,0);a.vertexColixes=c.vertexColixes;break;case 3:c.surfaceSet=a.surfaceSet;c.vertexSets=a.vertexSets;c.nSets=a.nSets;break;case 4:c.vertices=a.vertices,c.vertexValues=a.vertexValues,c.vertexCount=a.vertexCount,c.vertexIncrement=a.vertexIncrement,c.vertexSource=a.vertexSource,
c.polygonCount=a.polygonCount,c.polygonIndexes=a.polygonIndexes,c.polygonColixes=a.polygonColixes,c.bsSlabDisplay=a.bsSlabDisplay,c.bsSlabGhost=a.bsSlabGhost,c.slabColix=a.slabColix,c.slabMeshType=a.slabMeshType,c.polygonCount0=a.polygonCount0,c.vertexCount0=a.vertexCount0,c.mergeVertexCount0=a.mergeVertexCount0,c.slabOptions=a.slabOptions}},"J.jvxl.data.MeshData,~N,J.shapesurface.IsosurfaceMesh");Clazz.overrideMethod(c$,"notifySurfaceGenerationCompleted",function(){this.setMeshI();this.setBsVdw();
this.thisMesh.insideOut=this.sg.isInsideOut();this.thisMesh.vertexSource=this.sg.getVertexSource();this.thisMesh.spanningVectors=this.sg.getSpanningVectors();this.thisMesh.calculatedArea=null;this.thisMesh.calculatedVolume=null;var a=this.sg.getParams();this.thisMesh.isMerged||this.thisMesh.initialize(this.sg.isFullyLit()?1073741964:1073741958,null,this.sg.getPlane());a.allowVolumeRender||(this.thisMesh.jvxlData.allowVolumeRender=!1);this.thisMesh.setColorsFromJvxlData(this.sg.getParams().colorRgb);
null!=this.thisMesh.jvxlData.slabInfo&&this.viewer.runScript("isosurface "+this.thisMesh.jvxlData.slabInfo);0<this.sg.getParams().psi_monteCarloCount&&(this.thisMesh.diameter=-1)});Clazz.overrideMethod(c$,"notifySurfaceMappingCompleted",function(){this.thisMesh.isMerged||(this.thisMesh.initialize(this.sg.isFullyLit()?1073741964:1073741958,null,this.sg.getPlane()),this.thisMesh.setJvxlDataRendering());this.setBsVdw();this.thisMesh.isColorSolid=!1;this.thisMesh.colorDensity=this.jvxlData.colorDensity;
this.thisMesh.colorEncoder=this.sg.getColorEncoder();this.thisMesh.getContours();0!=this.thisMesh.jvxlData.nContours&&-1!=this.thisMesh.jvxlData.nContours&&(this.explicitContours=!0);this.explicitContours&&null!=this.thisMesh.jvxlData.jvxlPlane&&(this.thisMesh.havePlanarContours=!0);this.setPropertySuper("token",Integer.$valueOf(this.explicitContours?1073742046:1073741938),null);this.setPropertySuper("token",Integer.$valueOf(this.explicitContours?1073741898:1073742039),null);var a=this.sg.getSlabInfo();
null!=a&&(this.thisMesh.slabPolygonsList(a,!1),this.thisMesh.reinitializeLightingAndColor(this.viewer));this.thisMesh.setColorCommand()});$_M(c$,"setBsVdw",($fz=function(){var a=this.sg.geVdwBitSet();null!=a&&(null==this.thisMesh.bsVdw&&(this.thisMesh.bsVdw=new J.util.BS),this.thisMesh.bsVdw.or(a))},$fz.isPrivate=!0,$fz));Clazz.overrideMethod(c$,"calculateGeodesicSurface",function(a,b){return this.viewer.calculateSurface(a,b)},"J.util.BS,~N");Clazz.overrideMethod(c$,"getSurfacePointIndexAndFraction",
function(){return 0},"~N,~B,~N,~N,~N,J.util.P3i,~N,~N,~N,~N,J.util.P3,J.util.V3,~B,~A");Clazz.overrideMethod(c$,"addVertexCopy",function(a,b,c){return null!=this.cutoffRange&&(b<this.cutoffRange[0]||b>this.cutoffRange[1])?-1:null!=this.withinPoints&&!J.shape.Mesh.checkWithin(a,this.withinPoints,this.withinDistance2,this.isWithinNot)?-1:this.thisMesh.addVertexCopy(a,b,c,this.associateNormals)},"J.util.P3,~N,~N");Clazz.overrideMethod(c$,"addTriangleCheck",function(a,b,c,d,e,f,g){return 0>a||0>b||0>
c||f&&!J.jvxl.data.MeshData.checkCutoff(a,b,c,this.thisMesh.vertexValues)?-1:this.thisMesh.addTriangleCheck(a,b,c,d,e,g)},"~N,~N,~N,~N,~N,~B,~N");$_M(c$,"setScriptInfo",function(a){a=null==a?this.sg.getScript():a;var b=null==a?-1:a.indexOf("; isosurface map");if(0==b)null!=this.thisMesh.scriptCommand&&(b=this.thisMesh.scriptCommand.indexOf("; isosurface map"),0<=b&&(this.thisMesh.scriptCommand=this.thisMesh.scriptCommand.substring(0,b)),this.thisMesh.scriptCommand+=a);else if(this.thisMesh.title=
this.sg.getTitle(),this.thisMesh.dataType=this.sg.getParams().dataType,this.thisMesh.scale3d=this.sg.getParams().scale3d,null!=a&&" "==a.charAt(0)&&(a=this.myType+" ID "+J.util.Escape.eS(this.thisMesh.thisID)+a,b=a.indexOf("; isosurface map")),this.thisMesh.scriptCommand=0<b&&0<this.scriptAppendix.length?a.substring(0,b)+this.scriptAppendix+a.substring(b):a+this.scriptAppendix,!this.explicitID&&null!=a&&0<=(b=a.indexOf("# ID=")))this.thisMesh.thisID=J.util.Parser.getQuotedStringAt(a,b)},"~S");Clazz.overrideMethod(c$,
"addRequiredFile",function(a){a=' # /*file*/"'+a+'"';0>this.scriptAppendix.indexOf(a)&&(this.scriptAppendix+=a)},"~S");$_M(c$,"setJvxlInfo",($fz=function(){if(this.sg.getJvxlData()!==this.jvxlData||this.sg.getJvxlData()!==this.thisMesh.jvxlData)this.jvxlData=this.thisMesh.jvxlData=this.sg.getJvxlData()},$fz.isPrivate=!0,$fz));Clazz.overrideMethod(c$,"getShapeDetail",function(){for(var a=new J.util.JmolList,b=0;b<this.meshCount;b++){var c=new java.util.Hashtable,d=this.isomeshes[b];null==d||(null==
d.vertices||0==d.vertexCount&&0==d.polygonCount)||(this.addMeshInfo(d,c),a.addLast(c))}return a});$_M(c$,"addMeshInfo",function(a,b){b.put("ID",null==a.thisID?"<noid>":a.thisID);b.put("vertexCount",Integer.$valueOf(a.vertexCount));null!=a.calculatedVolume&&b.put("volume",a.calculatedVolume);null!=a.calculatedArea&&b.put("area",a.calculatedArea);3.4028235E38!=a.ptCenter.x&&b.put("center",a.ptCenter);null!=a.mat4&&b.put("mat4",a.mat4);0!=a.scale3d&&b.put("scale3d",Float.$valueOf(a.scale3d));b.put("xyzMin",
a.jvxlData.boundingBox[0]);b.put("xyzMax",a.jvxlData.boundingBox[1]);var c=J.jvxl.data.JvxlCoder.jvxlGetInfo(a.jvxlData);null!=c&&b.put("jvxlInfo",c.$replace("\n"," "));b.put("modelIndex",Integer.$valueOf(a.modelIndex));b.put("color",J.util.ColorUtil.colorPointFromInt2(J.util.C.getArgb(a.colix)));null!=a.colorEncoder&&b.put("colorKey",a.colorEncoder.getColorKey());null!=a.title&&b.put("title",a.title);(null!=a.jvxlData.contourValues||null!=a.jvxlData.contourValuesUsed)&&b.put("contours",a.getContourList(this.viewer))},
"J.shapesurface.IsosurfaceMesh,java.util.Map");Clazz.overrideMethod(c$,"getPlane",function(){return null},"~N");Clazz.overrideMethod(c$,"getValue",function(){return 0},"~N,~N,~N,~N");Clazz.overrideMethod(c$,"checkObjectHovered",function(a,b,c){if(null!=this.keyXy&&a>=this.keyXy[0]&&b>=this.keyXy[1]&&a<this.keyXy[2]&&b<this.keyXy[3])return this.hoverKey(a,b),!0;if(!this.viewer.getDrawHover())return!1;c=this.findValue(a,b,!1,c);if(null==c)return!1;this.gdata.isDisplayAntialiased()&&(a<<=1,b<<=1);this.viewer.hoverOnPt(a,
b,c,this.pickedMesh.thisID,this.pickedPt);return!0},"~N,~N,J.util.BS");$_M(c$,"hoverKey",($fz=function(a,b){try{var c,d=1-1*(b-this.keyXy[1])/(this.keyXy[3]-this.keyXy[1]);if(this.thisMesh.showContourLines){var e=this.thisMesh.getContours();if(null==e){if(null==this.thisMesh.jvxlData.contourValues)return;var f=Clazz.doubleToInt(Math.floor(d*this.thisMesh.jvxlData.contourValues.length));if(0>f||f>this.thisMesh.jvxlData.contourValues.length)return;c=""+this.thisMesh.jvxlData.contourValues[f]}else{f=
Clazz.doubleToInt(Math.floor(d*e.length));if(0>f||f>e.length)return;c=""+e[f].get(2).floatValue()}}else{var g=this.thisMesh.colorEncoder.quantize(d,!0),d=this.thisMesh.colorEncoder.quantize(d,!1);c=""+g+" - "+d}this.gdata.isAntialiased()&&(a<<=1,b<<=1);this.viewer.hoverOnPt(a,b,c,null,null)}catch(h){if(!Clazz.exceptionOf(h,Exception))throw h;}},$fz.isPrivate=!0,$fz),"~N,~N");Clazz.overrideMethod(c$,"checkObjectClicked",function(a,b,c,d,e){if(!e||!this.viewer.isBound(c,38))return null;c=100;this.gdata.isAntialiased()&&
(a<<=1,b<<=1,c<<=1);for(var f=e=-1,g=-2147483648,h=2147483647,j=0;j<this.meshCount;j++){var k=this.isomeshes[j];if(this.isPickable(k,d)&&(k=k.vertices,null!=k))for(var l=k.length;0<=--l;){var m=k[l];null!=m&&0<=this.coordinateInRange(a,b,m,c,this.ptXY)&&(this.ptXY.z<h&&(e=j,h=this.ptXY.z,f=l),this.ptXY.z>g&&(g=this.ptXY.z))}}if(0>e)return null;this.pickedMesh=this.isomeshes[e];this.setPropertySuper("thisID",this.pickedMesh.thisID,null);this.pickedVertex=f;a=new J.util.P3;a.setT(this.pickedMesh.vertices[this.pickedVertex]);
this.pickedModel=this.pickedMesh.modelIndex;this.setStatusPicked(-4,a);return this.getPickedPoint(a,this.pickedModel)},"~N,~N,~N,J.util.BS,~B");$_M(c$,"isPickable",($fz=function(a,b){return 0!=a.visibilityFlags&&(0>a.modelIndex||b.get(a.modelIndex))&&!J.util.C.isColixTranslucent(a.colix)},$fz.isPrivate=!0,$fz),"J.shapesurface.IsosurfaceMesh,J.util.BS");$_M(c$,"findValue",($fz=function(a,b,c,d){c=100;this.gdata.isAntialiased()&&(a<<=1,b<<=1,c<<=1);for(var e=-1,f=null,g=null,h=0;h<this.meshCount;h++)if(g=
this.isomeshes[h],this.isPickable(g,d)){var j=g.jvxlData.vContours,k=0>g.firstRealVertex?0:g.firstRealVertex,l=0;if(null!=j&&0<j.length){for(k=0;k<j.length;k++)for(var m=j[k],p=m.size()-1,n=6;n<p;n++){var q=m.get(n),r=this.coordinateInRange(a,b,q,c,this.ptXY);0<=r&&(c=r,f=m,l=k,this.pickedMesh=g,this.pickedPt=q)}if(null!=f)return f.get(2).toString()+(J.util.Logger.debugging?" "+l:"")}else if(null!=g.jvxlData.jvxlPlane&&null!=g.vertexValues){j=null==g.mat4&&0==g.scale3d?g.vertices:g.getOffsetVertices(g.jvxlData.jvxlPlane);
for(n=g.vertexCount;--n>=k;)q=j[n],r=this.coordinateInRange(a,b,q,c,this.ptXY),0<=r&&(c=r,e=n,this.pickedMesh=g,this.pickedPt=q);if(-1!=e)break}else if(null!=g.vertexValues){for(n=g.vertexCount;--n>=k;)q=g.vertices[n],r=this.coordinateInRange(a,b,q,c,this.ptXY),0<=r&&(c=r,e=n,this.pickedMesh=g,this.pickedPt=q);if(-1!=e)break}}return-1==e?null:(J.util.Logger.debugging?"$"+g.thisID+"["+(e+1)+"] "+g.vertices[e]+": ":g.thisID+": ")+g.vertexValues[e]},$fz.isPrivate=!0,$fz),"~N,~N,~B,J.util.BS");$_M(c$,
"getCmd",function(a){var b=(new J.util.SB).append("\n");this.getMeshCommand(b,a);return b.toString()},"~N");Clazz.defineStatics(c$,"MAX_OBJECT_CLICK_DISTANCE_SQUARED",100)});Clazz.declarePackage("J.jvxl.data");
Clazz.load(null,"J.jvxl.data.JvxlCoder","java.lang.Character $.Float J.io.XmlUtil J.jvxl.data.VolumeData J.util.BS $.BSUtil $.C $.Escape $.JmolList $.Logger $.P3 $.Parser $.SB $.TextFormat".split(" "),function(){c$=Clazz.declareType(J.jvxl.data,"JvxlCoder");c$.jvxlGetFile=$_M(c$,"jvxlGetFile",function(a,b,c){var d=a.getVoxelCounts();b.nPointsX=d[0];b.nPointsY=d[1];b.nPointsZ=d[2];b.jvxlVolumeDataXml=a.setVolumetricXml();return J.jvxl.data.JvxlCoder.jvxlGetFile(b,null,c,null,!0,1,null,null)},"J.jvxl.data.VolumeData,J.jvxl.data.JvxlData,~A");
c$.jvxlGetFile=$_M(c$,"jvxlGetFile",function(a,b,c,d,e,f,g,h){return J.jvxl.data.JvxlCoder.jvxlGetFileXml(a,b,c,d,e,f,g,h)},"J.jvxl.data.JvxlData,J.jvxl.data.MeshData,~A,~S,~B,~N,~S,~S");c$.jvxlGetFileXml=$_M(c$,"jvxlGetFileXml",($fz=function(a,b,c,d,e,f,g,h){var j=new J.util.SB;if("TRAILERONLY".equals(d))return J.io.XmlUtil.closeTag(j,"jvxlSurfaceSet"),J.io.XmlUtil.closeTag(j,"jvxl"),j.toString();var k=null!=b,l="HEADERONLY".equals(d);if(e){J.io.XmlUtil.openDocument(j);J.io.XmlUtil.openTagAttr(j,
"jvxl",["version","2.3","jmolVersion",a.version,"xmlns","http://jmol.org/jvxl_schema","xmlns:cml","http://www.xml-cml.org/schema"]);null!=a.jvxlFileTitle&&J.io.XmlUtil.appendCdata(j,"jvxlFileTitle",null,"\n"+a.jvxlFileTitle);null!=a.moleculeXml&&j.append(a.moleculeXml);var m=k?null:a.jvxlVolumeDataXml;null==m&&(m=(new J.jvxl.data.VolumeData).setVolumetricXml());j.append(m);J.io.XmlUtil.openTagAttr(j,"jvxlSurfaceSet",["count",""+(0<f?f:1)]);if(l)return j.toString()}f=k?"pmesh":null==a.jvxlPlane?"isosurface":
"plane";null!=a.jvxlColorData&&0<a.jvxlColorData.length&&(f="mapped "+f);J.io.XmlUtil.openTagAttr(j,"jvxlSurface",["type",f]);j.append(J.jvxl.data.JvxlCoder.jvxlGetInfoData(a,k));J.jvxl.data.JvxlCoder.jvxlAppendCommandState(j,h,g);if(null!=c||null!=d&&0<d.length){g=new J.util.SB;null!=d&&0<d.length&&g.append(d).append("\n");if(null!=c)for(d=0;d<c.length;d++)g.append(c[d]).appendC("\n");J.io.XmlUtil.appendCdata(j,"jvxlSurfaceTitle",null,g.toString())}g=new J.util.SB;J.io.XmlUtil.openTagAttr(g,"jvxlSurfaceData",
k||null==a.jvxlPlane?null:null==a.mapLattice?["plane",J.util.Escape.eP4(a.jvxlPlane)]:["plane",J.util.Escape.eP4(a.jvxlPlane),"maplattice",J.util.Escape.eP(a.mapLattice)]);if(k)J.jvxl.data.JvxlCoder.appendXmlVertexOnlyData(g,a,b,!0);else{if(null==a.jvxlPlane){if(null==a.jvxlEdgeData)return"";J.jvxl.data.JvxlCoder.appendXmlEdgeData(g,a)}J.jvxl.data.JvxlCoder.appendXmlColorData(g,a.jvxlColorData,!0,a.isJvxlPrecisionColor,a.valueMappedToRed,a.valueMappedToBlue)}J.jvxl.data.JvxlCoder.appendEncodedBitSetTag(g,
"jvxlInvalidatedVertexData",a.jvxlExcluded[1],-1,null);0<a.excludedVertexCount&&(J.jvxl.data.JvxlCoder.appendEncodedBitSetTag(g,"jvxlExcludedVertexData",a.jvxlExcluded[0],a.excludedVertexCount,null),J.jvxl.data.JvxlCoder.appendEncodedBitSetTag(g,"jvxlExcludedPlaneData",a.jvxlExcluded[2],-1,null));J.jvxl.data.JvxlCoder.appendEncodedBitSetTag(g,"jvxlExcludedTriangleData",a.jvxlExcluded[3],a.excludedTriangleCount,null);J.io.XmlUtil.closeTag(g,"jvxlSurfaceData");b=g.length();j.appendSB(g);null!=a.vContours&&
0<a.vContours.length&&J.jvxl.data.JvxlCoder.jvxlEncodeContourData(a.vContours,j);if(null!=a.vertexColorMap){J.io.XmlUtil.openTag(j,"jvxlVertexColorData");var p;for(c=a.vertexColorMap.entrySet().iterator();c.hasNext()&&((p=c.next())||1);)J.jvxl.data.JvxlCoder.appendEncodedBitSetTag(j,"jvxlColorMap",p.getValue(),-1,["color",p.getKey()]);a.vertexColorMap=null;J.io.XmlUtil.closeTag(j,"jvxlVertexColorData")}J.io.XmlUtil.closeTag(j,"jvxlSurface");e&&(J.io.XmlUtil.closeTag(j,"jvxlSurfaceSet"),J.io.XmlUtil.closeTag(j,
"jvxl"));return J.jvxl.data.JvxlCoder.jvxlSetCompressionRatio(j,a,b)},$fz.isPrivate=!0,$fz),"J.jvxl.data.JvxlData,J.jvxl.data.MeshData,~A,~S,~B,~N,~S,~S");c$.appendEncodedBitSetTag=$_M(c$,"appendEncodedBitSetTag",($fz=function(a,b,c,d,e){0>d&&(d=J.util.BSUtil.cardinalityOf(c));if(0!=d){var f=new J.util.SB;f.append("\n ");J.jvxl.data.JvxlCoder.jvxlEncodeBitSetBuffer(c,-1,f);J.io.XmlUtil.appendTagObj(a,b,[e,"bsEncoding","base90+35","count",""+d,"len",""+c.length()],J.jvxl.data.JvxlCoder.jvxlCompressString(f.toString(),
!0))}},$fz.isPrivate=!0,$fz),"J.util.SB,~S,J.util.BS,~N,~A");c$.jvxlSetCompressionRatio=$_M(c$,"jvxlSetCompressionRatio",($fz=function(a,b,c){a=a.toString();b=Clazz.floatToInt(0<b.nBytes?b.nBytes/c:13*b.nPointsX*b.nPointsY*b.nPointsZ/c);return J.util.TextFormat.simpleReplace(a,'"not calculated"',0<b?'"'+b+':1"':'"?"')},$fz.isPrivate=!0,$fz),"J.util.SB,J.jvxl.data.JvxlData,~N");c$.appendXmlEdgeData=$_M(c$,"appendXmlEdgeData",($fz=function(a,b){J.io.XmlUtil.appendTagObj(a,"jvxlEdgeData",["count",""+
(b.jvxlEdgeData.length-1),"encoding","base90f1","bsEncoding","base90+35c","isXLowToHigh",""+b.isXLowToHigh,"data",J.jvxl.data.JvxlCoder.jvxlCompressString(b.jvxlEdgeData,!0)],"\n"+J.jvxl.data.JvxlCoder.jvxlCompressString(b.jvxlSurfaceData,!0))},$fz.isPrivate=!0,$fz),"J.util.SB,J.jvxl.data.JvxlData");c$.jvxlAppendCommandState=$_M(c$,"jvxlAppendCommandState",($fz=function(a,b,c){null!=b&&J.io.XmlUtil.appendCdata(a,"jvxlIsosurfaceCommand",null,"\n"+(0>b.indexOf("#")?b:b.substring(0,b.indexOf("#")))+
"\n");null!=c&&(0<=c.indexOf("** XML ** ")?(c=J.util.TextFormat.splitChars(c,"** XML **")[1].trim(),J.io.XmlUtil.appendTag(a,"jvxlIsosurfaceState","\n"+c+"\n")):J.io.XmlUtil.appendCdata(a,"jvxlIsosurfaceState",null,"\n"+c))},$fz.isPrivate=!0,$fz),"J.util.SB,~S,~S");c$.appendXmlColorData=$_M(c$,"appendXmlColorData",($fz=function(a,b,c,d,e,f){var g;if(!(null==b||0>(g=b.length-1)))d&&(g/=2),J.io.XmlUtil.appendTagObj(a,"jvxlColorData",["count",""+g,"encoding",c?"base90f"+(d?"2":"1"):"none","min",""+e,
"max",""+f,"data",J.jvxl.data.JvxlCoder.jvxlCompressString(b,!0)],null)},$fz.isPrivate=!0,$fz),"J.util.SB,~S,~B,~B,~N,~N");c$.jvxlGetInfo=$_M(c$,"jvxlGetInfo",function(a){return J.jvxl.data.JvxlCoder.jvxlGetInfoData(a,a.vertexDataOnly)},"J.jvxl.data.JvxlData");c$.jvxlGetInfoData=$_M(c$,"jvxlGetInfoData",function(a,b){if(null==a.jvxlSurfaceData)return"";var c=new J.util.JmolList,d=a.nSurfaceInts,e=b?0:a.jvxlEdgeData.length-1,f=null==a.jvxlColorData?-1:a.jvxlColorData.length-1;if(!b){J.jvxl.data.JvxlCoder.addAttrib(c,
"\n  cutoff",""+a.cutoff);J.jvxl.data.JvxlCoder.addAttrib(c,"\n  isCutoffAbsolute",""+a.isCutoffAbsolute);J.jvxl.data.JvxlCoder.addAttrib(c,"\n  pointsPerAngstrom",""+a.pointsPerAngstrom);var g=a.jvxlSurfaceData.length+e+f+1;0<g&&J.jvxl.data.JvxlCoder.addAttrib(c,"\n  nBytesData",""+g);J.jvxl.data.JvxlCoder.addAttrib(c,"\n  isXLowToHigh",""+a.isXLowToHigh);null==a.jvxlPlane&&(J.jvxl.data.JvxlCoder.addAttrib(c,"\n  nSurfaceInts",""+d),J.jvxl.data.JvxlCoder.addAttrib(c,"\n  nBytesUncompressedEdgeData",
""+e));0<f&&J.jvxl.data.JvxlCoder.addAttrib(c,"\n  nBytesUncompressedColorData",""+f)}a.excludedVertexCount=J.util.BSUtil.cardinalityOf(a.jvxlExcluded[0]);a.excludedTriangleCount=J.util.BSUtil.cardinalityOf(a.jvxlExcluded[3]);0<a.excludedVertexCount&&J.jvxl.data.JvxlCoder.addAttrib(c,"\n  nExcludedVertexes",""+a.excludedVertexCount);0<a.excludedTriangleCount&&J.jvxl.data.JvxlCoder.addAttrib(c,"\n  nExcludedTriangles",""+a.excludedTriangleCount);g=J.util.BSUtil.cardinalityOf(a.jvxlExcluded[1]);0<g&&
J.jvxl.data.JvxlCoder.addAttrib(c,"\n  nInvalidatedVertexes",""+g);null!=a.slabInfo&&J.jvxl.data.JvxlCoder.addAttrib(c,"\n  slabInfo",a.slabInfo);a.isJvxlPrecisionColor&&J.jvxl.data.JvxlCoder.addAttrib(c,"\n  precisionColor","true");a.colorDensity?J.jvxl.data.JvxlCoder.addAttrib(c,"\n  colorDensity","true"):0!=a.diameter&&J.jvxl.data.JvxlCoder.addAttrib(c,"\n  diameter",""+a.diameter);a.allowVolumeRender||J.jvxl.data.JvxlCoder.addAttrib(c,"\n  allowVolumeRender","false");null==a.jvxlPlane||b?(a.isContoured?
(J.jvxl.data.JvxlCoder.addAttrib(c,"\n  contoured","true"),J.jvxl.data.JvxlCoder.addAttrib(c,"\n  colorMapped","true")):a.isBicolorMap?(J.jvxl.data.JvxlCoder.addAttrib(c,"\n  bicolorMap","true"),J.jvxl.data.JvxlCoder.addAttrib(c,"\n  colorNegative",J.util.C.getHexCode(a.minColorIndex)),J.jvxl.data.JvxlCoder.addAttrib(c,"\n  colorPositive",J.util.C.getHexCode(a.maxColorIndex))):0<f&&J.jvxl.data.JvxlCoder.addAttrib(c,"\n  colorMapped","true"),null!=a.vContours&&0<a.vContours.length&&J.jvxl.data.JvxlCoder.addAttrib(c,
"\n  nContourData",""+a.vContours.length)):(null!=a.mapLattice&&J.jvxl.data.JvxlCoder.addAttrib(c,"\n  mapLattice",""+a.mapLattice),0!=a.scale3d&&J.jvxl.data.JvxlCoder.addAttrib(c,"\n  scale3d",""+a.scale3d),0<f&&J.jvxl.data.JvxlCoder.addAttrib(c,"\n  colorMapped","true"),J.jvxl.data.JvxlCoder.addAttrib(c,"\n  plane",J.util.Escape.eP4(a.jvxlPlane)));null!=a.color&&0>a.color.indexOf("null")&&J.jvxl.data.JvxlCoder.addAttrib(c,"\n  color",a.color);J.jvxl.data.JvxlCoder.addAttrib(c,"\n  translucency",
""+a.translucency);null!=a.meshColor&&J.jvxl.data.JvxlCoder.addAttrib(c,"\n  meshColor",a.meshColor);null!=a.colorScheme&&J.jvxl.data.JvxlCoder.addAttrib(c,"\n  colorScheme",a.colorScheme);null!=a.rendering&&J.jvxl.data.JvxlCoder.addAttrib(c,"\n  rendering",a.rendering);0<=a.thisSet&&J.jvxl.data.JvxlCoder.addAttrib(c,"\n  set",""+(a.thisSet+1));-2147483648!=a.slabValue&&J.jvxl.data.JvxlCoder.addAttrib(c,"\n  slabValue",""+a.slabValue);a.isSlabbable&&J.jvxl.data.JvxlCoder.addAttrib(c,"\n  slabbable",
"true");0<a.nVertexColors&&J.jvxl.data.JvxlCoder.addAttrib(c,"\n  nVertexColors",""+a.nVertexColors);d=3.4028235E38==a.mappedDataMin?0:a.mappedDataMin;e=a.isColorReversed?a.valueMappedToRed:a.valueMappedToBlue;f=a.isColorReversed?a.valueMappedToBlue:a.valueMappedToRed;null!=a.jvxlColorData&&(0<a.jvxlColorData.length&&!a.isBicolorMap)&&(J.jvxl.data.JvxlCoder.addAttrib(c,"\n  dataMinimum",""+d),J.jvxl.data.JvxlCoder.addAttrib(c,"\n  dataMaximum",""+a.mappedDataMax),J.jvxl.data.JvxlCoder.addAttrib(c,
"\n  valueMappedToRed",""+f),J.jvxl.data.JvxlCoder.addAttrib(c,"\n  valueMappedToBlue",""+e));a.isContoured&&(null==a.contourValues||null==a.contourColixes?null==a.vContours&&J.jvxl.data.JvxlCoder.addAttrib(c,"\n  nContours",""+Math.abs(a.nContours)):(null!=a.jvxlPlane&&J.jvxl.data.JvxlCoder.addAttrib(c,"\n  contoured","true"),J.jvxl.data.JvxlCoder.addAttrib(c,"\n  nContours",""+a.contourValues.length),J.jvxl.data.JvxlCoder.addAttrib(c,"\n  contourValues",J.util.Escape.eAF(null==a.contourValuesUsed?
a.contourValues:a.contourValuesUsed)),J.jvxl.data.JvxlCoder.addAttrib(c,"\n  contourColors",a.contourColors)));a.insideOut&&J.jvxl.data.JvxlCoder.addAttrib(c,"\n  insideOut","true");a.vertexDataOnly?J.jvxl.data.JvxlCoder.addAttrib(c,"\n  note","vertex/face data only"):a.isXLowToHigh&&J.jvxl.data.JvxlCoder.addAttrib(c,"\n  note","progressive JVXL+ -- X values read from low(0) to high("+(a.nPointsX-1)+")");J.jvxl.data.JvxlCoder.addAttrib(c,"\n  xyzMin",J.util.Escape.eP(a.boundingBox[0]));J.jvxl.data.JvxlCoder.addAttrib(c,
"\n  xyzMax",J.util.Escape.eP(a.boundingBox[1]));J.jvxl.data.JvxlCoder.addAttrib(c,"\n  approximateCompressionRatio","not calculated");J.jvxl.data.JvxlCoder.addAttrib(c,"\n  jmolVersion",a.version);d=new J.util.SB;J.io.XmlUtil.openTagAttr(d,"jvxlSurfaceInfo",c.toArray(Array(c.size())));J.io.XmlUtil.closeTag(d,"jvxlSurfaceInfo");return d.toString()},"J.jvxl.data.JvxlData,~B");c$.addAttrib=$_M(c$,"addAttrib",($fz=function(a,b,c){a.addLast([b,c])},$fz.isPrivate=!0,$fz),"J.util.JmolList,~S,~S");c$.jvxlEncodeContourData=
$_M(c$,"jvxlEncodeContourData",($fz=function(a,b){J.io.XmlUtil.openTagAttr(b,"jvxlContourData",["count",""+a.length]);for(var c=0;c<a.length;c++)if(!(6>a[c].size())){var d=a[c].get(0).intValue(),e=new J.util.SB;e.append("\n");var f=a[c].get(1);J.jvxl.data.JvxlCoder.jvxlEncodeBitSetBuffer(f,d,e);J.io.XmlUtil.appendTagObj(b,"jvxlContour",["index",""+c,"value",""+a[c].get(2),"color",J.util.Escape.escapeColor(a[c].get(4)[0]),"count",""+f.length(),"encoding","base90iff1","bsEncoding","base90+35c","data",
J.jvxl.data.JvxlCoder.jvxlCompressString(a[c].get(5).toString(),!0)],J.jvxl.data.JvxlCoder.jvxlCompressString(e.toString(),!0))}J.io.XmlUtil.closeTag(b,"jvxlContourData")},$fz.isPrivate=!0,$fz),"~A,J.util.SB");c$.set3dContourVector=$_M(c$,"set3dContourVector",function(a,b,c){if(!(6>a.size()))for(var d=a.get(5),e=a.get(1),f=0,g=d.length(),h=0,j=" ",k=" ",l=e.nextSetBit(0);0<=l;l=e.nextSetBit(l+1)){for(var m=b[l];f<g&&!Character.isDigit(j=d.charAt(f++)););for(h=j.charCodeAt(0)-48;f<g&&Character.isWhitespace(j=
d.charAt(f++)););for(;f<g&&Character.isWhitespace(k=d.charAt(f++)););var p=J.jvxl.data.JvxlCoder.jvxlFractionFromCharacter(j.charCodeAt(0),35,90,0),n=J.jvxl.data.JvxlCoder.jvxlFractionFromCharacter(k.charCodeAt(0),35,90,0),q,r;0==(h&1)?(q=m[1],r=h=m[2],m=m[0]):(q=m[0],r=m[1],0!=(h&2)?(h=r,m=m[2]):(h=m[2],m=q));a.addLast(J.jvxl.data.JvxlCoder.getContourPoint(c,q,r,p));a.addLast(J.jvxl.data.JvxlCoder.getContourPoint(c,h,m,n))}},"J.util.JmolList,~A,~A");c$.getContourPoint=$_M(c$,"getContourPoint",($fz=
function(a,b,c,d){var e=new J.util.P3;e.setT(a[c]);e.sub(a[b]);e.scale(d);e.add(a[b]);return e},$fz.isPrivate=!0,$fz),"~A,~N,~N,~N");c$.appendContourTriangleIntersection=$_M(c$,"appendContourTriangleIntersection",function(a,b,c,d){d.appendI(a);d.appendC(J.jvxl.data.JvxlCoder.jvxlFractionAsCharacter(b));d.appendC(J.jvxl.data.JvxlCoder.jvxlFractionAsCharacter(c))},"~N,~N,~N,J.util.SB");c$.jvxlCreateColorData=$_M(c$,"jvxlCreateColorData",function(a,b){if(null==b)a.jvxlColorData="";else{var c=a.isJvxlPrecisionColor,
d=a.isTruncated,e=a.colorFractionBase,f=a.colorFractionRange,g=a.valueMappedToBlue,h=a.valueMappedToRed,j=0<a.saveVertexCount?a.saveVertexCount:a.vertexCount;j>b.length&&System.out.println("JVXLCODER ERROR");var k=a.mappedDataMin,l=a.mappedDataMax,m=new J.util.SB,p=new J.util.SB;b.length<j&&System.out.println("JVXLCOLOR OHOHO");for(var n=0;n<j;n++){var q=b[n];Float.isNaN(q)&&(q=k);d&&(q=0<q?0.999:-0.999);c?J.jvxl.data.JvxlCoder.jvxlAppendCharacter2(q,k,l,e,f,m,p):m.appendC(J.jvxl.data.JvxlCoder.jvxlValueAsCharacter(q,
h,g,e,f))}a.jvxlColorData=m.appendSB(p).appendC("\n").toString()}},"J.jvxl.data.JvxlData,~A");c$.appendXmlVertexOnlyData=$_M(c$,"appendXmlVertexOnlyData",($fz=function(a,b,c,d){var e=Clazz.newIntArray(c.vertexCount,0);J.jvxl.data.JvxlCoder.appendXmlTriangleData(a,c.polygonIndexes,c.polygonCount,c.bsSlabDisplay,e,d)&&J.jvxl.data.JvxlCoder.appendXmlVertexData(a,b,e,c.vertices,c.vertexValues,c.vertexCount,c.polygonColorData,c.polygonCount,c.bsSlabDisplay,b.vertexColors,0<b.jvxlColorData.length,d)},$fz.isPrivate=
!0,$fz),"J.util.SB,J.jvxl.data.JvxlData,J.jvxl.data.MeshData,~B");c$.appendXmlTriangleData=$_M(c$,"appendXmlTriangleData",($fz=function(a,b,c,d,e,f){for(var g=new J.util.SB,h=new J.util.SB,j=1,k=0,l=0,m=!1,p=0,n=null!=d,q=0;q<c;)if(null==b[q]||n&&!d.get(q))q++;else{var r=b[q][k],r=0<e[r]?e[r]:e[r]=++l,t=r-j,j=r;0==t?(g.appendC("!"),m=!1):32<t?(m&&g.appendC("+"),g.appendI(t),m=!0):-32>t?(g.appendI(t),m=!0):(g.appendC(String.fromCharCode(92+t)),m=!1);0==++k%3&&(h.appendI(b[q][3]),k=0,q++,p++)}if(0==
g.length())return!0;J.io.XmlUtil.appendTagObj(a,"jvxlTriangleData",["count",""+p,"encoding","jvxltdiff","data",J.jvxl.data.JvxlCoder.jvxlCompressString(g.toString(),f)],null);J.io.XmlUtil.appendTagObj(a,"jvxlTriangleEdgeData",["count",""+p,"encoding","jvxlsc","data",J.jvxl.data.JvxlCoder.jvxlCompressString(h.toString(),f)],null);return!0},$fz.isPrivate=!0,$fz),"J.util.SB,~A,~N,J.util.BS,~A,~B");c$.appendXmlVertexData=$_M(c$,"appendXmlVertexData",($fz=function(a,b,c,d,e,f,g,h,j,k,l,m){var p=b.colorFractionBase,
n=b.colorFractionRange,q=b.boundingBox[0],r=b.boundingBox[1],t=new J.util.SB,u=new J.util.SB,x=null,v=null!=j;if(0<h){v&&(h=j.cardinality());for(var v=!1,x=Clazz.newIntArray(f,0),s=0;s<f;s++)0<c[s]&&(x[c[s]-1]=s)}for(var w=0,s=0;s<f;s++)if(!v||j.get(s))w++,c=d[0==h?s:x[s]],J.jvxl.data.JvxlCoder.jvxlAppendCharacter2(c.x,q.x,r.x,p,n,t,u),J.jvxl.data.JvxlCoder.jvxlAppendCharacter2(c.y,q.y,r.y,p,n,t,u),J.jvxl.data.JvxlCoder.jvxlAppendCharacter2(c.z,q.z,r.z,p,n,t,u);t.appendSB(u);J.io.XmlUtil.appendTagObj(a,
"jvxlVertexData",["count",""+w,"min",J.util.Escape.eP(q),"max",J.util.Escape.eP(r),"encoding","base90xyz2","data",J.jvxl.data.JvxlCoder.jvxlCompressString(t.toString(),m)],null);null!=g&&J.io.XmlUtil.appendTagObj(a,"jvxlPolygonColorData",["encoding","jvxlnc","count",""+h],"\n"+g);if(l){t=new J.util.SB;u=new J.util.SB;if(null==k)for(s=0;s<f;s++){if(!v||j.get(s))J.jvxl.data.JvxlCoder.jvxlAppendCharacter2(e[0==h?s:x[s]],b.mappedDataMin,b.mappedDataMax,p,n,t,u)}else{t.appendI(w).append(" ");for(s=0;s<
f;s++)if(!v||j.get(s))t.appendI(k[0==h?s:x[s]]).append(" ")}J.jvxl.data.JvxlCoder.appendXmlColorData(a,t.appendSB(u).append("\n").toString(),null==k,!0,b.valueMappedToRed,b.valueMappedToBlue)}},$fz.isPrivate=!0,$fz),"J.util.SB,J.jvxl.data.JvxlData,~A,~A,~A,~N,~S,~N,J.util.BS,~A,~B,~B");c$.jvxlFractionAsCharacter=$_M(c$,"jvxlFractionAsCharacter",function(a){return J.jvxl.data.JvxlCoder.jvxlFractionAsCharacterRange(a,35,90)},"~N");c$.jvxlFractionAsCharacterRange=$_M(c$,"jvxlFractionAsCharacterRange",
function(a,b,c){0.9999<a?a=0.9999:Float.isNaN(a)&&(a=1.0001);a=Clazz.doubleToInt(Math.floor(a*c+b));return a<b?String.fromCharCode(b):92==a?"!":String.fromCharCode(a)},"~N,~N,~N");c$.jvxlAppendCharacter2=$_M(c$,"jvxlAppendCharacter2",($fz=function(a,b,c,d,e,f,g){a=b==c?a:(a-b)/(c-b);b=J.jvxl.data.JvxlCoder.jvxlFractionAsCharacterRange(a,d,e);f.appendC(b);a-=J.jvxl.data.JvxlCoder.jvxlFractionFromCharacter(b.charCodeAt(0),d,e,0);g.appendC(J.jvxl.data.JvxlCoder.jvxlFractionAsCharacterRange(a*e,d,e))},
$fz.isPrivate=!0,$fz),"~N,~N,~N,~N,~N,J.util.SB,J.util.SB");c$.jvxlFractionFromCharacter=$_M(c$,"jvxlFractionFromCharacter",function(a,b,c,d){if(a==b+c)return NaN;a<b&&(a=92);a=(a-b+d)/c;return 0>a?0:1<a?0.999999:a},"~N,~N,~N,~N");c$.jvxlFractionFromCharacter2=$_M(c$,"jvxlFractionFromCharacter2",function(a,b,c,d){a=J.jvxl.data.JvxlCoder.jvxlFractionFromCharacter(a,c,d,0);b=J.jvxl.data.JvxlCoder.jvxlFractionFromCharacter(b,c,d,0.5);return a+b/d},"~N,~N,~N,~N");c$.jvxlValueAsCharacter=$_M(c$,"jvxlValueAsCharacter",
function(a,b,c,d,e){return J.jvxl.data.JvxlCoder.jvxlFractionAsCharacterRange(b==c?a:(a-b)/(c-b),d,e)},"~N,~N,~N,~N,~N");c$.jvxlValueFromCharacter2=$_M(c$,"jvxlValueFromCharacter2",function(a,b,c,d,e,f){a=J.jvxl.data.JvxlCoder.jvxlFractionFromCharacter2(a,b,e,f);return d==c?a:c+a*(d-c)},"~N,~N,~N,~N,~N,~N");c$.jvxlEncodeBitSet0=$_M(c$,"jvxlEncodeBitSet0",function(a,b,c){var d=0,e=-1,f=0;0>b&&(b=a.length());for(var g=0,h=!1,j=b-1,k=0;k<b;++k)h==a.get(k)?d++:(d==e&&k!=j?f++:(0<f&&(c.appendC(" ").appendI(-f),
f=0,g++),c.appendC(" ").appendI(d),g++,e=d),d=1,h=!h);c.appendC(" ").appendI(d).appendC("\n");return g},"J.util.BS,~N,J.util.SB");c$.jvxlEncodeBitSet=$_M(c$,"jvxlEncodeBitSet",function(a){var b=new J.util.SB;J.jvxl.data.JvxlCoder.jvxlEncodeBitSetBuffer(a,-1,b);return b.toString()},"J.util.BS");c$.jvxlEncodeBitSetBuffer=$_M(c$,"jvxlEncodeBitSetBuffer",function(a,b,c){var d=0,e=0,f=!1;0>b&&(b=a.length());if(0==b)return 0;c.append("-");for(var g=0;g<b;++g)f==a.get(g)?d++:(J.jvxl.data.JvxlCoder.jvxlAppendEncodedNumber(c,
d,35,90),e++,d=1,f=!f);J.jvxl.data.JvxlCoder.jvxlAppendEncodedNumber(c,d,35,90);c.appendC("\n");return e},"J.util.BS,~N,J.util.SB");c$.jvxlAppendEncodedNumber=$_M(c$,"jvxlAppendEncodedNumber",function(a,b,c,d){var e=b<d;for(0==b?a.appendC(String.fromCharCode(c)):e||a.appendC(String.fromCharCode(c+d));0<b;){var f=Clazz.doubleToInt(b/d);b=c+b-f*d;92==b&&(b=33);a.appendC(String.fromCharCode(b));b=f}e||a.append(" ")},"J.util.SB,~N,~N,~N");c$.jvxlDecodeBitSetRange=$_M(c$,"jvxlDecodeBitSetRange",function(a,
b,c){for(var d=new J.util.BS,e=0,f=0,g=!1,h=Clazz.newIntArray(1,0);-2147483648!=(e=J.jvxl.data.JvxlCoder.jvxlParseEncodedInt(a,b,c,h));)g&&d.setBits(f,f+e),f+=e,g=!g;return d},"~S,~N,~N");c$.jvxlParseEncodedInt=$_M(c$,"jvxlParseEncodedInt",function(a,b,c,d){var e=!1,f=0,g=d[0],h=a.length;if(0>g)return-2147483648;for(;g<h&&Character.isWhitespace(a.charAt(g));)++g;if(g>=h)return-2147483648;var j=1,k=a.charCodeAt(g)==b+c;for(k&&g++;g<h&&!Character.isWhitespace(a.charAt(g));){e=a.charCodeAt(g);e<b&&(e=
92);f+=(e-b)*j;e=!0;++g;if(!k)break;j*=c}e||(f=-2147483648);d[0]=g;return f},"~S,~N,~N,~A");c$.jvxlDecodeBitSet=$_M(c$,"jvxlDecodeBitSet",function(a){if(a.startsWith("-"))return J.jvxl.data.JvxlCoder.jvxlDecodeBitSetRange(J.jvxl.data.JvxlCoder.jvxlDecompressString(a.substring(1)),35,90);for(var b=new J.util.BS,c=0,d=0,e=0,f=0,g=!1,h=Clazz.newIntArray(1,0);;){c=0>e++?c:J.util.Parser.parseIntNext(a,h);if(-2147483648==c)break;0>c?(e=c,c=d):(g&&b.setBits(f,f+c),f+=c,d=c,g=!g)}return b},"~S");c$.jvxlCompressString=
$_M(c$,"jvxlCompressString",function(a,b){if(0<=a.indexOf("~"))return a;for(var c=new J.util.SB,d="\x00",e=!1,f=!1,g=0,h=a.length,j=0;j<=h;j++){var k=j==h?"\x00":a.charAt(j);switch(k){case "\n":case "\r":continue;case "&":case "<":e=b;break;default:e=!1}if(k==d)++g,k="\x00";else if(0<g||f){if(4>g&&!f||" "==d||"\t"==d)for(;0<=--g;)c.appendC(d);else f?f=!1:c.appendC("~"),c.appendI(g),c.appendC(" ");g=0}"\x00"!=k&&(e?(f=!0,c.appendC("~"),d=k,k=String.fromCharCode(k.charCodeAt(0)-1)):d=k,c.appendC(k))}return c.toString()},
"~S,~B");c$.jvxlDecompressString=$_M(c$,"jvxlDecompressString",function(a){if(0>a.indexOf("~"))return a;for(var b=new J.util.SB,c="\x00",d=Clazz.newIntArray(1,0),e=0;e<a.length;e++){var f=a.charAt(e);if("~"==f)switch(d[0]=++e,f=a.charAt(e)){case ";":case "%":d[0]++,b.appendC(c=String.fromCharCode(f.charCodeAt(0)+1));case "1":case "2":case "3":case "4":case "5":case "6":case "7":case "8":case "9":e=J.util.Parser.parseIntNext(a,d);for(f=0;f<e;f++)b.appendC(c);e=d[0];continue;case "~":--e;break;default:J.util.Logger.error("Error uncompressing string "+
a.substring(0,e)+"?")}b.appendC(f);c=f}return b.toString()},"~S");c$.jvxlCreateHeaderWithoutTitleOrAtoms=$_M(c$,"jvxlCreateHeaderWithoutTitleOrAtoms",function(a,b){J.jvxl.data.JvxlCoder.jvxlCreateHeader(a,b)},"J.jvxl.data.VolumeData,J.util.SB");c$.jvxlCreateHeader=$_M(c$,"jvxlCreateHeader",function(a,b){a.setVolumetricXml();0==b.length()&&b.append("Line 1\nLine 2\n")},"J.jvxl.data.VolumeData,J.util.SB");Clazz.defineStatics(c$,"JVXL_VERSION1","2.0","JVXL_VERSION_XML","2.3","CONTOUR_NPOLYGONS",0,"CONTOUR_BITSET",
1,"CONTOUR_VALUE",2,"CONTOUR_COLIX",3,"CONTOUR_COLOR",4,"CONTOUR_FDATA",5,"CONTOUR_POINTS",6,"defaultEdgeFractionBase",35,"defaultEdgeFractionRange",90,"defaultColorFractionBase",35,"defaultColorFractionRange",90)});Clazz.declarePackage("J.api");Clazz.declareInterface(J.api,"VolumeDataInterface");Clazz.declarePackage("J.jvxl.data");
Clazz.load(["J.api.VolumeDataInterface","J.util.Matrix3f","$.P3","$.V3"],"J.jvxl.data.VolumeData","java.lang.Float java.util.Hashtable J.io.XmlUtil J.util.Escape $.Logger $.SB".split(" "),function(){c$=Clazz.decorateAsClass(function(){this.sr=null;this.doIterate=!0;this.voxelCounts=this.volumetricVectors=this.origin=this.volumetricOrigin=null;this.nPoints=0;this.volumetricVectorLengths=this.voxelMap=this.voxelData=null;this.yzCount=this.minToPlaneDistance=this.maxVectorLength=0;this.thePlane=this.inverseMatrix=
this.volumetricMatrix=this.unitVolumetricVectors=null;this.thePlaneNormalMag=0;this.mappingPlane=this.xmlData=this.ptXyzTemp=null;this.voxelVolume=this.maxGrid=this.minGrid=this.mappingPlaneNormalMag=0;this.spanningVectors=null;this.isSquared=this.isPeriodic=!1;this.ptTemp=this.edgeVector=null;Clazz.instantialize(this,arguments)},J.jvxl.data,"VolumeData",null,J.api.VolumeDataInterface);Clazz.prepareFields(c$,function(){this.volumetricOrigin=new J.util.P3;this.origin=Clazz.newFloatArray(3,0);this.volumetricVectors=
Array(3);this.voxelCounts=Clazz.newIntArray(3,0);this.volumetricVectorLengths=Clazz.newFloatArray(3,0);this.unitVolumetricVectors=Array(3);this.volumetricMatrix=new J.util.Matrix3f;this.inverseMatrix=new J.util.Matrix3f;this.ptXyzTemp=new J.util.P3;this.edgeVector=new J.util.V3;this.ptTemp=new J.util.P3});Clazz.overrideMethod(c$,"getVoxelData",function(){return this.voxelData});Clazz.overrideMethod(c$,"setVoxelDataAsArray",function(a){this.voxelData=a;null!=a&&(this.sr=null)},"~A");$_M(c$,"hasPlane",
function(){return null!=this.thePlane});Clazz.makeConstructor(c$,function(){this.volumetricVectors[0]=new J.util.V3;this.volumetricVectors[1]=new J.util.V3;this.volumetricVectors[2]=new J.util.V3;this.unitVolumetricVectors[0]=new J.util.V3;this.unitVolumetricVectors[1]=new J.util.V3;this.unitVolumetricVectors[2]=new J.util.V3});$_M(c$,"setMappingPlane",function(a){this.mappingPlane=a;null!=a&&(this.mappingPlaneNormalMag=Math.sqrt(a.x*a.x+a.y*a.y+a.z*a.z))},"J.util.P4");$_M(c$,"distanceToMappingPlane",
function(a){return(this.mappingPlane.x*a.x+this.mappingPlane.y*a.y+this.mappingPlane.z*a.z+this.mappingPlane.w)/this.mappingPlaneNormalMag},"J.util.P3");Clazz.overrideMethod(c$,"setVolumetricOrigin",function(a,b,c){this.volumetricOrigin.set(a,b,c)},"~N,~N,~N");Clazz.overrideMethod(c$,"getOriginFloat",function(){return this.origin});$_M(c$,"getSpanningVectors",function(){return this.spanningVectors});$_M(c$,"getYzCount",function(){this.minGrid=this.volumetricVectors[0].length();this.minGrid=Math.min(this.minGrid,
this.volumetricVectors[1].length());this.minGrid=Math.min(this.minGrid,this.volumetricVectors[2].length());this.maxGrid=this.volumetricVectors[0].length();this.maxGrid=Math.max(this.maxGrid,this.volumetricVectors[1].length());this.maxGrid=Math.max(this.maxGrid,this.volumetricVectors[2].length());this.nPoints=this.voxelCounts[0]*this.voxelCounts[1]*this.voxelCounts[2];return this.yzCount=this.voxelCounts[1]*this.voxelCounts[2]});Clazz.overrideMethod(c$,"getVolumetricVectorLengths",function(){return this.volumetricVectorLengths});
Clazz.overrideMethod(c$,"setVolumetricVector",function(a,b,c,d){this.volumetricVectors[a].x=b;this.volumetricVectors[a].y=c;this.volumetricVectors[a].z=d;this.setUnitVectors()},"~N,~N,~N,~N");Clazz.overrideMethod(c$,"getVoxelCounts",function(){return this.voxelCounts});Clazz.overrideMethod(c$,"setVoxelCounts",function(a,b,c){this.voxelCounts[0]=a;this.voxelCounts[1]=b;this.voxelCounts[2]=c;return a*b*c},"~N,~N,~N");$_M(c$,"getVoxelDataAt",function(a){var b=Clazz.doubleToInt(a/this.yzCount);a-=b*this.yzCount;
var c=Clazz.doubleToInt(a/this.voxelCounts[2]);return this.voxelData[b][c][a-c*this.voxelCounts[2]]},"~N");$_M(c$,"getPointIndex",function(a,b,c){return a*this.yzCount+b*this.voxelCounts[2]+c},"~N,~N,~N");$_M(c$,"getPoint",function(a,b){var c=Clazz.doubleToInt(a/this.yzCount);a-=c*this.yzCount;var d=Clazz.doubleToInt(a/this.voxelCounts[2]);this.voxelPtToXYZ(c,d,a-d*this.voxelCounts[2],b)},"~N,J.util.P3");$_M(c$,"setVoxelData",function(a,b){var c=Clazz.doubleToInt(a/this.yzCount);a-=c*this.yzCount;
var d=Clazz.doubleToInt(a/this.voxelCounts[2]);this.voxelData[c][d][a-d*this.voxelCounts[2]]=b},"~N,~N");$_M(c$,"setVoxelMap",function(){this.voxelMap=new java.util.Hashtable;this.getYzCount()});$_M(c$,"setMatrix",($fz=function(){for(var a=0;3>a;a++)this.volumetricMatrix.setColumnV(a,this.volumetricVectors[a]);try{this.inverseMatrix.invertM(this.volumetricMatrix)}catch(b){if(Clazz.exceptionOf(b,Exception))return J.util.Logger.error("VolumeData error setting matrix -- bad unit vectors? "),!1;throw b;
}return!0},$fz.isPrivate=!0,$fz));Clazz.overrideMethod(c$,"transform",function(a,b){this.volumetricMatrix.transform2(a,b)},"J.util.V3,J.util.V3");Clazz.overrideMethod(c$,"setPlaneParameters",function(a){this.thePlane=a;this.thePlaneNormalMag=Math.sqrt(a.x*a.x+a.y*a.y+a.z*a.z)},"J.util.P4");Clazz.overrideMethod(c$,"calcVoxelPlaneDistance",function(a,b,c){this.voxelPtToXYZ(a,b,c,this.ptXyzTemp);return this.distancePointToPlane(this.ptXyzTemp)},"~N,~N,~N");$_M(c$,"getToPlaneParameter",function(){return Math.sqrt(this.thePlane.x*
this.thePlane.x+this.thePlane.y*this.thePlane.y+this.thePlane.z*this.thePlane.z)*this.minToPlaneDistance});$_M(c$,"isNearPlane",function(a,b,c,d){this.voxelPtToXYZ(a,b,c,this.ptXyzTemp);return this.thePlane.x*this.ptXyzTemp.x+this.thePlane.y*this.ptXyzTemp.y+this.thePlane.z*this.ptXyzTemp.z+this.thePlane.w<d},"~N,~N,~N,~N");Clazz.overrideMethod(c$,"distancePointToPlane",function(a){return(this.thePlane.x*a.x+this.thePlane.y*a.y+this.thePlane.z*a.z+this.thePlane.w)/this.thePlaneNormalMag},"J.util.P3");
Clazz.overrideMethod(c$,"voxelPtToXYZ",function(a,b,c,d){d.scaleAdd2(a,this.volumetricVectors[0],this.volumetricOrigin);d.scaleAdd2(b,this.volumetricVectors[1],d);d.scaleAdd2(c,this.volumetricVectors[2],d)},"~N,~N,~N,J.util.P3");$_M(c$,"setUnitVectors",function(){this.maxVectorLength=0;this.voxelVolume=1;for(var a=0;3>a;a++){var b=this.volumetricVectorLengths[a]=this.volumetricVectors[a].length();if(0==b)return!1;b>this.maxVectorLength&&(this.maxVectorLength=b);this.voxelVolume*=b;this.unitVolumetricVectors[a].setT(this.volumetricVectors[a]);
this.unitVolumetricVectors[a].normalize()}this.minToPlaneDistance=2*this.maxVectorLength;this.origin[0]=this.volumetricOrigin.x;this.origin[1]=this.volumetricOrigin.y;this.origin[2]=this.volumetricOrigin.z;this.spanningVectors=Array(4);this.spanningVectors[0]=J.util.V3.newV(this.volumetricOrigin);for(a=0;3>a;a++)b=this.spanningVectors[a+1]=new J.util.V3,b.scaleAdd2(this.voxelCounts[a]-1,this.volumetricVectors[a],b);return this.setMatrix()});Clazz.overrideMethod(c$,"xyzToVoxelPt",function(a,b,c,d){this.ptXyzTemp.set(a,
b,c);this.ptXyzTemp.sub(this.volumetricOrigin);this.inverseMatrix.transform(this.ptXyzTemp);d.set(Math.round(this.ptXyzTemp.x),Math.round(this.ptXyzTemp.y),Math.round(this.ptXyzTemp.z))},"~N,~N,~N,J.util.P3i");Clazz.overrideMethod(c$,"lookupInterpolatedVoxelValue",function(a,b){if(null!=this.mappingPlane)return this.distanceToMappingPlane(a);if(null!=this.sr){var c=this.sr.getValueAtPoint(a,b);return this.isSquared?c*c:c}this.ptXyzTemp.sub2(a,this.volumetricOrigin);this.inverseMatrix.transform(this.ptXyzTemp);
var d,e=this.indexLower(this.ptXyzTemp.x,d=this.voxelCounts[0]-1),f=this.indexUpper(this.ptXyzTemp.x,e,d),g=this.indexLower(this.ptXyzTemp.y,d=this.voxelCounts[1]-1),h=this.indexUpper(this.ptXyzTemp.y,g,d),c=this.indexLower(this.ptXyzTemp.z,d=this.voxelCounts[2]-1),j=this.indexUpper(this.ptXyzTemp.z,c,d);d=J.jvxl.data.VolumeData.getFractional2DValue(this.mantissa(this.ptXyzTemp.x-e),this.mantissa(this.ptXyzTemp.y-g),this.getVoxelValue(e,g,c),this.getVoxelValue(f,g,c),this.getVoxelValue(e,h,c),this.getVoxelValue(f,
h,c));e=J.jvxl.data.VolumeData.getFractional2DValue(this.mantissa(this.ptXyzTemp.x-e),this.mantissa(this.ptXyzTemp.y-g),this.getVoxelValue(e,g,j),this.getVoxelValue(f,g,j),this.getVoxelValue(e,h,j),this.getVoxelValue(f,h,j));return d+this.mantissa(this.ptXyzTemp.z-c)*(e-d)},"J.util.P3,~B");$_M(c$,"mantissa",($fz=function(a){return this.isPeriodic?a-Math.floor(a):a},$fz.isPrivate=!0,$fz),"~N");$_M(c$,"getVoxelValue",function(a,b,c){if(null==this.voxelMap)return this.voxelData[a][b][c];a=this.voxelMap.get(Integer.$valueOf(this.getPointIndex(a,
b,c)));return null==a?NaN:a.floatValue()},"~N,~N,~N");c$.getFractional2DValue=$_M(c$,"getFractional2DValue",function(a,b,c,d,e,f){c+=a*(d-c);return c+b*(e+a*(f-e)-c)},"~N,~N,~N,~N,~N,~N");$_M(c$,"indexLower",($fz=function(a,b){if(this.isPeriodic&&0<b){for(;0>a;)a+=b;for(;a>=b;)a-=b;return Clazz.doubleToInt(Math.floor(a))}if(0>a)return 0;var c=Clazz.doubleToInt(Math.floor(a));return c>b?b:c},$fz.isPrivate=!0,$fz),"~N,~N");$_M(c$,"indexUpper",($fz=function(a,b,c){return!this.isPeriodic&&0>a||b==c?b:
b+1},$fz.isPrivate=!0,$fz),"~N,~N,~N");$_M(c$,"offsetCenter",function(a){var b=new J.util.P3;b.scaleAdd2((this.voxelCounts[0]-1)/2,this.volumetricVectors[0],b);b.scaleAdd2((this.voxelCounts[1]-1)/2,this.volumetricVectors[1],b);b.scaleAdd2((this.voxelCounts[2]-1)/2,this.volumetricVectors[2],b);this.volumetricOrigin.sub2(a,b)},"J.util.P3");Clazz.overrideMethod(c$,"setDataDistanceToPlane",function(a){this.setPlaneParameters(a);a=this.voxelCounts[0];var b=this.voxelCounts[1],c=this.voxelCounts[2];this.voxelData=
Clazz.newFloatArray(a,b,c,0);for(var d=0;d<a;d++)for(var e=0;e<b;e++)for(var f=0;f<c;f++)this.voxelData[d][e][f]=this.calcVoxelPlaneDistance(d,e,f)},"J.util.P4");Clazz.overrideMethod(c$,"filterData",function(a,b){var c=!Float.isNaN(b);if(null!=this.sr)this.isSquared=a;else{var d=this.voxelCounts[0],e=this.voxelCounts[1],f=this.voxelCounts[2];if(a)for(var g=0;g<d;g++)for(var h=0;h<e;h++)for(var j=0;j<f;j++)this.voxelData[g][h][j]*=this.voxelData[g][h][j];if(c)for(g=0;g<d;g++)for(h=0;h<e;h++)for(j=
0;j<f;j++)this.voxelData[g][h][j]=b-this.voxelData[g][h][j]}},"~B,~N");Clazz.overrideMethod(c$,"capData",function(a,b){if(null!=this.voxelData){var c=this.voxelCounts[0],d=this.voxelCounts[1],e=this.voxelCounts[2],f=J.util.V3.new3(a.x,a.y,a.z);f.normalize();for(var g=0;g<c;g++)for(var h=0;h<d;h++)for(var j=0;j<e;j++){var k=this.voxelData[g][h][j]-b;this.voxelPtToXYZ(g,h,j,this.ptXyzTemp);var l=(this.ptXyzTemp.x*f.x+this.ptXyzTemp.y*f.y+this.ptXyzTemp.z*f.z+a.w-b)/1;if(0<=l||l>k)this.voxelData[g][h][j]=
l}}},"J.util.P4,~N");$_M(c$,"setVolumetricXml",function(){var a=new J.util.SB;if(0==this.voxelCounts[0])J.io.XmlUtil.appendTag(a,"jvxlVolumeData",null);else{J.io.XmlUtil.openTagAttr(a,"jvxlVolumeData",["origin",J.util.Escape.eP(this.volumetricOrigin)]);for(var b=0;3>b;b++)J.io.XmlUtil.appendTag(a,"jvxlVolumeVector",["type",""+b,"count",""+this.voxelCounts[b],"vector",J.util.Escape.eP(this.volumetricVectors[b])]);J.io.XmlUtil.closeTag(a,"jvxlVolumeData")}return this.xmlData=a.toString()});$_M(c$,"setVoxelMapValue",
function(a,b,c,d){null!=this.voxelMap&&this.voxelMap.put(Integer.$valueOf(this.getPointIndex(a,b,c)),Float.$valueOf(d))},"~N,~N,~N,~N");$_M(c$,"calculateFractionalPoint",function(a,b,c,d,e,f){var g=e-d,h=(a-d)/g;this.edgeVector.sub2(c,b);f.scaleAdd2(h,this.edgeVector,b);if(null==this.sr||!this.doIterate||e==d||0.01>h||0.99<h||0.01>this.edgeVector.length())return a;b=0;this.ptTemp.setT(f);c=this.lookupInterpolatedVoxelValue(this.ptTemp,!1);for(e=NaN;10>++b;){var j=(c-d)/g;if(0>j||1<j)break;j=(a-c)/
g/2;h+=j;if(0>h||1<h)break;f.setT(this.ptTemp);e=c;if(0.005>Math.abs(j))break;this.ptTemp.scaleAdd2(j,this.edgeVector,f);c=this.lookupInterpolatedVoxelValue(this.ptTemp,!1)}return e},"~N,J.util.P3,J.util.P3,~N,~N,J.util.P3")});Clazz.declarePackage("J.jvxl.data");
Clazz.load(null,"J.jvxl.data.JvxlData",["java.lang.Float","J.jvxl.data.JvxlCoder","J.util.SB"],function(){c$=Clazz.decorateAsClass(function(){this.wasCubic=this.wasJvxl=!1;this.jvxlPlane=this.jvxlExcluded=this.jvxlVolumeDataXml=this.jvxlColorData=this.jvxlEdgeData=this.jvxlSurfaceData=this.jvxlFileMessage=this.jvxlFileTitle=null;this.isColorReversed=this.jvxlDataIsColorDensity=this.jvxlDataIs2dContour=this.jvxlDataIsColorMapped=this.isJvxlPrecisionColor=!1;this.thisSet=-1;this.edgeFractionBase=35;
this.edgeFractionRange=90;this.colorFractionBase=35;this.colorFractionRange=90;this.vertexDataOnly=this.isCutoffAbsolute=this.isTruncated=this.isBicolorMap=this.isContoured=this.isXLowToHigh=this.insideOut=this.dataXYReversed=!1;this.vertexCount=this.nSurfaceInts=this.nEdges=this.nContours=this.nBytes=this.nPointsZ=this.nPointsY=this.nPointsX=this.pointsPerAngstrom=this.cutoff=this.valueMappedToBlue=this.valueMappedToRed=this.mappedDataMax=this.mappedDataMin=0;this.contourValuesUsed=this.contourValues=
this.contourColors=this.contourColixes=this.vContours=null;this.scale3d=0;this.minColorIndex=-1;this.maxColorIndex=0;this.boundingBox=this.version=this.title=null;this.excludedVertexCount=this.excludedTriangleCount=0;this.colorDensity=!1;this.moleculeXml=null;this.saveVertexCount=this.dataMax=this.dataMin=0;this.vertexColorMap=null;this.nVertexColors=0;this.meshColor=this.color=this.vertexColors=null;this.translucency=0;this.rendering=this.colorScheme=null;this.slabValue=-2147483648;this.isSlabbable=
!1;this.diameter=0;this.slabInfo=null;this.allowVolumeRender=!1;this.voxelVolume=0;this.mapLattice=null;Clazz.instantialize(this,arguments)},J.jvxl.data,"JvxlData");Clazz.prepareFields(c$,function(){this.jvxlExcluded=Array(4)});Clazz.makeConstructor(c$,function(){});$_M(c$,"clear",function(){this.allowVolumeRender=!0;this.jvxlVolumeDataXml=this.jvxlColorData=this.jvxlEdgeData=this.jvxlSurfaceData="";this.colorScheme=this.color=null;this.colorDensity=!1;this.contourColors=this.contourColixes=this.contourValuesUsed=
this.contourValues=null;this.isSlabbable=!1;this.meshColor=this.mapLattice=null;this.nVertexColors=this.nPointsX=0;this.slabInfo=null;this.slabValue=-2147483648;this.thisSet=-1;this.rendering=null;this.translucency=0;this.vertexColors=this.vertexColorMap=this.vContours=null;this.voxelVolume=0});$_M(c$,"setSurfaceInfo",function(a,b,c,d){this.jvxlSurfaceData=d;0==this.jvxlSurfaceData.indexOf("--")&&(this.jvxlSurfaceData=this.jvxlSurfaceData.substring(2));this.jvxlPlane=a;this.mapLattice=b;this.nSurfaceInts=
c},"J.util.P4,J.util.P3,~N,~S");$_M(c$,"setSurfaceInfoFromBitSet",function(a,b){this.setSurfaceInfoFromBitSetPts(a,b,null)},"J.util.BS,J.util.P4");$_M(c$,"setSurfaceInfoFromBitSetPts",function(a,b,c){var d=new J.util.SB;a=null!=b?0:J.jvxl.data.JvxlCoder.jvxlEncodeBitSetBuffer(a,this.nPointsX*this.nPointsY*this.nPointsZ,d);this.setSurfaceInfo(b,c,a,d.toString())},"J.util.BS,J.util.P4,J.util.P3");$_M(c$,"jvxlUpdateInfo",function(a,b){this.title=a;this.nBytes=b},"~A,~N");c$.updateSurfaceData=$_M(c$,
"updateSurfaceData",function(a,b,c,d,e){if(0==a.length)return"";a=a.toCharArray();for(var f=0,g=0;f<c;f+=d,g++)Float.isNaN(b[f])&&(a[g]=e);return String.copyValueOf(a)},"~S,~A,~N,~N,~S")});Clazz.declarePackage("J.jvxl.data");
Clazz.load(["J.util.MeshSurface"],"J.jvxl.data.MeshData",["java.lang.Float","java.util.Arrays","J.util.ArrayUtil","$.BS","$.V3"],function(){c$=Clazz.decorateAsClass(function(){this.setsSuccessful=!1;this.vertexIncrement=1;this.polygonColorData=null;Clazz.isClassDefined("J.jvxl.data.MeshData.SSet")||J.jvxl.data.MeshData.$MeshData$SSet$();Clazz.isClassDefined("J.jvxl.data.MeshData.SortSet")||J.jvxl.data.MeshData.$MeshData$SortSet$();Clazz.instantialize(this,arguments)},J.jvxl.data,"MeshData",J.util.MeshSurface);
$_M(c$,"addVertexCopy",function(a,b,c){0>c&&(this.vertexIncrement=-c);return this.addVCVal(a,b)},"J.util.P3,~N,~N");$_M(c$,"getSurfaceSet",function(){return null==this.surfaceSet?this.getSurfaceSetForLevel(0):this.surfaceSet});$_M(c$,"getSurfaceSetForLevel",($fz=function(a){0==a&&(this.surfaceSet=Array(100),this.nSets=0);this.setsSuccessful=!0;for(var b=0;b<this.polygonCount;b++)if(null!=this.polygonIndexes[b]&&(null==this.bsSlabDisplay||this.bsSlabDisplay.get(b))){var c=this.polygonIndexes[b],d=
this.findSet(c[0]),e=this.findSet(c[1]),f=this.findSet(c[2]);0>d&&0>e&&0>f?this.createSet(c[0],c[1],c[2]):d==e&&e==f||(0<=d?(this.surfaceSet[d].set(c[1]),this.surfaceSet[d].set(c[2]),0<=e&&e!=d&&this.mergeSets(d,e),0<=f&&(f!=d&&f!=e)&&this.mergeSets(d,f)):0<=e?(this.surfaceSet[e].set(c[0]),this.surfaceSet[e].set(c[2]),0<=f&&f!=e&&this.mergeSets(e,f)):(this.surfaceSet[f].set(c[0]),this.surfaceSet[f].set(c[1])))}for(b=c=0;b<this.nSets;b++)null!=this.surfaceSet[b]&&c++;d=Array(this.surfaceSet.length);
for(b=c=0;b<this.nSets;b++)null!=this.surfaceSet[b]&&(d[c++]=this.surfaceSet[b]);this.nSets=c;this.surfaceSet=d;!this.setsSuccessful&&2>a&&this.getSurfaceSetForLevel(a+1);0==a&&(this.sortSurfaceSets(),this.setVertexSets(!1));return this.surfaceSet},$fz.isPrivate=!0,$fz),"~N");$_M(c$,"sortSurfaceSets",($fz=function(){for(var a=Array(this.nSets),b=0;b<this.nSets;b++)a[b]=Clazz.innerTypeInstance(J.jvxl.data.MeshData.SSet,this,null,this.surfaceSet[b]);java.util.Arrays.sort(a,Clazz.innerTypeInstance(J.jvxl.data.MeshData.SortSet,
this,null));for(b=0;b<this.nSets;b++)this.surfaceSet[b]=a[b].bs},$fz.isPrivate=!0,$fz));$_M(c$,"setVertexSets",function(a){if(null!=this.surfaceSet){for(var b=0,c=0;c<this.nSets;c++)null!=this.surfaceSet[c]&&0==this.surfaceSet[c].cardinality()&&(this.surfaceSet[c]=null),null==this.surfaceSet[c]&&b++;if(0<b){a=Array(this.nSets-b);for(var d=c=0;c<this.nSets;c++)null!=this.surfaceSet[c]&&(a[d++]=this.surfaceSet[c]);this.surfaceSet=a;this.nSets-=b}else if(a)return;this.vertexSets=Clazz.newIntArray(this.vertexCount,
0);for(c=0;c<this.nSets;c++)for(b=this.surfaceSet[c].nextSetBit(0);0<=b;b=this.surfaceSet[c].nextSetBit(b+1))this.vertexSets[b]=c}},"~B");$_M(c$,"findSet",($fz=function(a){for(var b=0;b<this.nSets;b++)if(null!=this.surfaceSet[b]&&this.surfaceSet[b].get(a))return b;return-1},$fz.isPrivate=!0,$fz),"~N");$_M(c$,"createSet",($fz=function(a,b,c){var d;for(d=0;d<this.nSets&&null!=this.surfaceSet[d];d++);d==this.surfaceSet.length&&(this.surfaceSet=J.util.ArrayUtil.ensureLength(this.surfaceSet,this.surfaceSet.length+
100));this.surfaceSet[d]=new J.util.BS;this.surfaceSet[d].set(a);this.surfaceSet[d].set(b);this.surfaceSet[d].set(c);d==this.nSets&&this.nSets++},$fz.isPrivate=!0,$fz),"~N,~N,~N");$_M(c$,"mergeSets",($fz=function(a,b){this.surfaceSet[a].or(this.surfaceSet[b]);this.surfaceSet[b]=null},$fz.isPrivate=!0,$fz),"~N,~N");$_M(c$,"invalidateSurfaceSet",function(a){for(var b=this.surfaceSet[a].nextSetBit(0);0<=b;b=this.surfaceSet[a].nextSetBit(b+1))this.vertexValues[b]=NaN;this.surfaceSet[a]=null},"~N");c$.checkCutoff=
$_M(c$,"checkCutoff",function(a,b,c,d){if(0>a||0>b||0>c)return!1;a=d[a];b=d[b];c=d[c];return 0<=a&&0<=b&&0<=c||0>=a&&0>=b&&0>=c},"~N,~N,~N,~A");$_M(c$,"calculateVolumeOrArea",function(a,b,c){c&&this.getSurfaceSet();for(var d=(c=0==this.nSets||0<=a)?1:this.nSets,e=Clazz.newDoubleArray(d,0),f=new J.util.V3,g=new J.util.V3,h=new J.util.V3,j=this.polygonCount;0<=--j;)if(this.setABC(j)){var k=0==this.nSets?0:this.vertexSets[this.iA];0<=a&&k!=a||(b?(f.sub2(this.vertices[this.iB],this.vertices[this.iA]),
g.sub2(this.vertices[this.iC],this.vertices[this.iA]),h.cross(f,g),e[c?0:k]+=h.length()):(f.setT(this.vertices[this.iB]),g.setT(this.vertices[this.iC]),h.cross(f,g),g.setT(this.vertices[this.iA]),e[c?0:k]+=g.dot(h)))}b=b?2:6;for(j=0;j<d;j++)e[j]/=b;return c&&-2147483648!=a?Float.$valueOf(e[0]):e},"~N,~B,~B");$_M(c$,"updateInvalidatedVertices",function(a){a.clearAll();for(var b=0,c=0;b<this.vertexCount;b+=this.vertexIncrement,c++)Float.isNaN(this.vertexValues[b])&&a.set(b)},"J.util.BS");$_M(c$,"invalidateVertices",
function(a){for(var b=a.nextSetBit(0);0<=b;b=a.nextSetBit(b+1))this.vertexValues[b]=NaN},"J.util.BS");c$.$MeshData$SSet$=function(){Clazz.pu$h();c$=Clazz.decorateAsClass(function(){Clazz.prepareCallback(this,arguments);this.bs=null;this.n=0;Clazz.instantialize(this,arguments)},J.jvxl.data.MeshData,"SSet");Clazz.makeConstructor(c$,function(a){this.bs=a;this.n=a.cardinality()},"J.util.BS");c$=Clazz.p0p()};c$.$MeshData$SortSet$=function(){Clazz.pu$h();c$=Clazz.decorateAsClass(function(){Clazz.prepareCallback(this,
arguments);Clazz.instantialize(this,arguments)},J.jvxl.data.MeshData,"SortSet",null,java.util.Comparator);Clazz.overrideMethod(c$,"compare",function(a,b){return a.n>b.n?-1:a.n<b.n?1:0},"J.jvxl.data.MeshData.SSet,J.jvxl.data.MeshData.SSet");c$=Clazz.p0p()};Clazz.defineStatics(c$,"MODE_GET_VERTICES",1,"MODE_GET_COLOR_INDEXES",2,"MODE_PUT_SETS",3,"MODE_PUT_VERTICES",4)});Clazz.declarePackage("J.jvxl.readers");
Clazz.load(["J.util.P3","$.V3"],"J.jvxl.readers.SurfaceGenerator","java.io.BufferedReader $.StringReader java.lang.Float J.io.JmolBinary J.jvxl.data.JvxlCoder $.JvxlData $.MeshData $.VolumeData J.jvxl.readers.Parameters $.SurfaceReader J.util.ArrayUtil $.BS $.Escape $.Logger $.Measure $.P4 $.Parser $.TextFormat".split(" "),function(){c$=Clazz.decorateAsClass(function(){this.version=this.marchingSquares=this.atomDataServer=this.meshDataServer=this.volumeData=this.params=this.meshData=this.jvxlData=
null;this.$isValid=!0;this.surfaceReader=this.os=this.fileType=null;this.colorPtr=0;this.bsVdw=this.ptRef=this.vNorm=this.vAB=this.vAC=this.readerData=null;Clazz.instantialize(this,arguments)},J.jvxl.readers,"SurfaceGenerator");Clazz.prepareFields(c$,function(){this.vAC=new J.util.V3;this.vAB=new J.util.V3;this.vNorm=new J.util.V3;this.ptRef=J.util.P3.new3(0,0,1E15)});$_M(c$,"isValid",function(){return this.$isValid});$_M(c$,"getFileType",function(){return this.fileType});$_M(c$,"setVersion",function(a){this.version=
a},"~S");Clazz.makeConstructor(c$,function(a,b,c,d){this.atomDataServer=a;this.meshDataServer=b;this.params=new J.jvxl.readers.Parameters;this.meshData=null==c?new J.jvxl.data.MeshData:c;this.jvxlData=null==d?new J.jvxl.data.JvxlData:d;this.volumeData=new J.jvxl.data.VolumeData;this.initializeIsosurface()},"J.atomdata.AtomDataServer,J.jvxl.api.MeshDataServer,J.jvxl.data.MeshData,J.jvxl.data.JvxlData");$_M(c$,"isStateDataRead",function(){return 2==this.params.state});$_M(c$,"getFileName",function(){return this.params.fileName});
$_M(c$,"getMeshDataServer",function(){return this.meshDataServer});$_M(c$,"getAtomDataServer",function(){return this.atomDataServer});$_M(c$,"getColorEncoder",function(){return this.params.colorEncoder});$_M(c$,"getVertexSource",function(){return this.params.vertexSource});$_M(c$,"setJvxlData",function(a){this.jvxlData=a;null!=a&&(a.version=this.version)},"J.jvxl.data.JvxlData");$_M(c$,"getJvxlData",function(){return this.jvxlData});$_M(c$,"getMeshData",function(){return this.meshData});$_M(c$,"setMarchingSquares",
function(a){this.marchingSquares=a},"J.jvxl.calc.MarchingSquares");$_M(c$,"getMarchingSquares",function(){return this.marchingSquares});$_M(c$,"getParams",function(){return this.params});$_M(c$,"getScript",function(){return this.params.script});$_M(c$,"getTitle",function(){return this.params.title});$_M(c$,"getBsSelected",function(){return this.params.bsSelected});$_M(c$,"getBsIgnore",function(){return this.params.bsIgnore});$_M(c$,"getVolumeData",function(){return this.volumeData});$_M(c$,"getPlane",
function(){return this.params.thePlane});$_M(c$,"getColor",function(a){switch(a){case -1:return this.params.colorNeg;case 1:return this.params.colorPos}return 0},"~N");$_M(c$,"setModelIndex",function(a){this.params.modelIndex=a},"~N");$_M(c$,"getIAddGridPoints",function(){return this.params.iAddGridPoints});$_M(c$,"getIsPositiveOnly",function(){return this.params.isPositiveOnly});$_M(c$,"isInsideOut",function(){return this.params.insideOut!=this.params.dataXYReversed});$_M(c$,"getCutoff",function(){return this.params.cutoff});
$_M(c$,"getMoData",function(){return this.params.moData});$_M(c$,"isCubeData",function(){return this.jvxlData.wasCubic});$_M(c$,"setParameter",function(a,b){return this.setProp(a,b,null)},"~S,~O");$_M(c$,"setProp",function(a,b){if("debug"===a){var c=b.booleanValue();this.params.logMessages=c;this.params.logCube=c;return!0}if("init"===a)return this.initializeIsosurface(),Clazz.instanceOf(b,J.jvxl.readers.Parameters)?this.params=b:(this.params.script=b,null!=this.params.script&&0<=this.params.script.indexOf(";#")&&
(this.params.script=J.util.TextFormat.simpleReplace(this.params.script,";#","; #"))),!1;if("map"===a)return this.params.resetForMapping(b.booleanValue()),null!=this.surfaceReader&&(this.surfaceReader.minMax=null),!0;if("finalize"===a)return this.initializeIsosurface(),!0;if("clear"===a)return null!=this.surfaceReader&&this.surfaceReader.discardTempData(!0),!1;if("fileIndex"===a)return this.params.fileIndex=b.intValue(),0>this.params.fileIndex&&(this.params.fileIndex=0),this.params.readAllData=!1,
!0;if("blockData"===a)return this.params.blockCubeData=b.booleanValue(),!0;if("withinPoints"===a)return this.params.boundingBox=b[1],!0;if("boundingBox"===a)return this.params.boundingBox=[J.util.P3.newP(b[0]),J.util.P3.newP(b[b.length-1])],!0;if("func"===a)return this.params.func=b,!0;if("intersection"===a)return this.params.intersection=b,!0;if("bsSolvent"===a)return this.params.bsSolvent=b,!0;if("select"===a)return this.params.bsSelected=b,!0;if("ignore"===a)return this.params.bsIgnore=b,!0;if("propertySmoothing"===
a)return this.params.propertySmoothing=b.booleanValue(),!0;if("propertyDistanceMax"===a)return this.params.propertyDistanceMax=b.floatValue(),!0;if("propertySmoothingPower"===a)return this.params.propertySmoothingPower=b.intValue(),!0;if("title"===a){if(null==b)this.params.title=null;else if(J.util.Escape.isAS(b)){this.params.title=b;for(var d=0;d<this.params.title.length;d++)0<this.params.title[d].length&&J.util.Logger.info(this.params.title[d])}return!0}if("sigma"===a)return this.params.cutoff=
this.params.sigma=b.floatValue(),this.params.isPositiveOnly=!1,this.params.cutoffAutomatic=!1,!0;if("cutoff"===a)return this.params.cutoff=b.floatValue(),this.params.isPositiveOnly=!1,this.params.cutoffAutomatic=!1,!0;if("parameters"===a)return this.params.parameters=J.util.ArrayUtil.ensureLengthA(b,2),0<this.params.parameters.length&&0!=this.params.parameters[0]&&(this.params.cutoff=this.params.parameters[0]),!0;if("cutoffPositive"===a)return this.params.cutoff=b.floatValue(),this.params.isPositiveOnly=
!0;if("cap"===a||"slab"===a)return null!=b&&this.params.addSlabInfo(b),!0;if("scale"===a)return this.params.scale=b.floatValue(),!0;if("scale3d"===a)return this.params.scale3d=b.floatValue(),!0;if("angstroms"===a)return this.params.isAngstroms=!0;if("resolution"===a)return c=b.floatValue(),this.params.resolution=0<c?c:3.4028235E38,!0;if("downsample"===a)return c=b.intValue(),this.params.downsampleFactor=0<=c?c:0,!0;if("anisotropy"===a)return 0==(this.params.dataType&32)&&this.params.setAnisotropy(b),
!0;if("eccentricity"===a)return this.params.setEccentricity(b),!0;if("addHydrogens"===a)return this.params.addHydrogens=b.booleanValue(),!0;if("squareData"===a)return this.params.isSquared=null==b?!1:b.booleanValue(),!0;if("squareLinear"===a)return this.params.isSquaredLinear=null==b?!1:b.booleanValue(),!0;if("gridPoints"===a)return this.params.iAddGridPoints=!0;if("atomIndex"===a)return this.params.atomIndex=b.intValue(),!0;if("insideOut"===a)return this.params.insideOut=!0;if("sign"===a)return this.params.isCutoffAbsolute=
!0,this.params.colorBySign=!0,this.colorPtr=0,!0;if("colorRGB"===a)return c=b.intValue(),this.params.colorRgb=this.params.colorPos=this.params.colorPosLCAO=c,0==this.colorPtr++?this.params.colorNeg=this.params.colorNegLCAO=c:this.params.colorRgb=2147483647,!0;if("monteCarloCount"===a)return this.params.psi_monteCarloCount=b.intValue(),!0;if("rangeAll"===a)return this.params.rangeAll=!0;if("rangeSelected"===a)return this.params.rangeSelected=!0;if("red"===a)return this.params.valueMappedToRed=b.floatValue(),
!0;if("blue"===a)return this.params.valueMappedToBlue=b.floatValue(),this.params.valueMappedToRed>this.params.valueMappedToBlue&&(c=this.params.valueMappedToRed,this.params.valueMappedToRed=this.params.valueMappedToBlue,this.params.valueMappedToBlue=c,this.params.isColorReversed=!this.params.isColorReversed),this.params.rangeDefined=!0,this.params.rangeAll=!1,!0;if("reverseColor"===a)return this.params.isColorReversed=!0;if("setColorScheme"===a)return this.getSurfaceSets(),this.params.colorBySets=
!0,this.mapSurface(),!0;if("center"===a)return this.params.center.setT(b),!0;if("volumeData"===a)return this.params.volumeData=b,!0;if("origin"===a)return this.params.origin=b,!0;if("step"===a)return this.params.steps=b,!0;if("point"===a)return this.params.points=b,!0;if("withinDistance"===a)return this.params.distance=b.floatValue(),!0;if("withinPoint"===a)return this.params.point=b,!0;if("progressive"===a)return this.params.isXLowToHigh=!0;if("phase"===a)return this.params.isCutoffAbsolute=!0,this.params.colorBySign=
!0,this.params.colorByPhase=!0,this.params.colorPhase=J.jvxl.readers.SurfaceReader.getColorPhaseIndex(b),0>this.params.colorPhase&&(J.util.Logger.warn(" invalid color phase: "+b),this.params.colorPhase=0),this.params.colorByPhase=0!=this.params.colorPhase,2<=this.params.state&&(this.params.dataType=this.params.surfaceType,this.params.state=3,this.params.isBicolorMap=!0,this.surfaceReader.applyColorScale()),!0;if("radius"===a)return J.util.Logger.info("solvent probe radius set to "+b),this.params.atomRadiusData=
b,!0;if("envelopeRadius"===a)return this.params.envelopeRadius=b.floatValue(),!0;if("cavityRadius"===a)return this.params.cavityRadius=b.floatValue(),!0;if("cavity"===a)return this.params.isCavity=!0;if("doFullMolecular"===a)return this.params.doFullMolecular=!0;if("pocket"===a)return this.params.pocket=b,this.params.fullyLit=this.params.pocket.booleanValue(),!0;if("minset"===a)return this.params.minSet=b.intValue(),!0;if("maxset"===a)return this.params.maxSet=b.intValue(),!0;if("plane"===a)return this.params.setPlane(b),
!0;if("contour"===a){this.params.isContoured=!0;if(J.util.Escape.isAF(b))this.params.contoursDiscrete=b,this.params.nContours=this.params.contoursDiscrete.length;else if(Clazz.instanceOf(b,J.util.P3)){var c=this.params.contourIncrements=b,d=c.x,e=c.y,f=c.z;0>=f&&(f=1);for(var c=0,g=d;g<=e+f/10;g+=f,c++);this.params.contoursDiscrete=Clazz.newFloatArray(c,0);g=d;for(d=0;d<c;d++,g+=f)this.params.contoursDiscrete[d]=g;this.params.nContours=c}else c=b.intValue(),0==c?this.params.nContours=9:0<c?this.params.nContours=
c:this.params.thisContour=-c;return!0}if("colorDiscrete"===a)return this.params.contourColixes=b,!0;if("colorDensity"===a)return this.params.colorDensity=!0;if("fullPlane"===a)return this.params.contourFromZero=!b.booleanValue(),!0;if("mapLattice"===a)return this.params.mapLattice=b,!0;if("property"===a)return this.params.dataType=1206,this.params.theProperty=b,this.mapSurface(),!0;if("sphere"===a)return this.params.setSphere(b.floatValue(),!1),this.readerData=Float.$valueOf(this.params.distance),
this.surfaceReader=this.newReader("IsoShapeReader"),this.generateSurface(),!0;if("geodesic"===a)return this.params.setSphere(b.floatValue(),!0),this.readerData=Float.$valueOf(this.params.distance),this.surfaceReader=this.newReader("IsoShapeReader"),this.generateSurface(),!0;if("ellipsoid"===a){if(Clazz.instanceOf(b,J.util.P4))this.params.setEllipsoid(b);else if(J.util.Escape.isAF(b))this.params.setEllipsoid(b);else return!0;this.readerData=Float.$valueOf(this.params.distance);this.surfaceReader=this.newReader("IsoShapeReader");
this.generateSurface();return!0}if("ellipsoid3"===a)return this.params.setEllipsoid(b),this.readerData=Float.$valueOf(this.params.distance),this.surfaceReader=this.newReader("IsoShapeReader"),this.generateSurface(),!0;if("lp"===a)return this.params.setLp(b),this.readerData=[3,2,0,15,0],this.surfaceReader=this.newReader("IsoShapeReader"),this.generateSurface(),!0;if("rad"===a)return this.params.setRadical(b),this.readerData=[3,2,0,15,0],this.surfaceReader=this.newReader("IsoShapeReader"),this.generateSurface(),
!0;if("lobe"===a)return this.params.setLobe(b),this.readerData=[3,2,0,15,0],this.surfaceReader=this.newReader("IsoShapeReader"),this.generateSurface(),!0;if("hydrogenOrbital"===a){if(!this.params.setAtomicOrbital(b))return this.$isValid=!1,!0;this.readerData=[this.params.psi_n,this.params.psi_l,this.params.psi_m,this.params.psi_Znuc,this.params.psi_monteCarloCount];this.surfaceReader=this.newReader("IsoShapeReader");this.processState();return!0}if("functionXY"===a)return this.params.setFunctionXY(b),
this.params.isContoured&&this.volumeData.setPlaneParameters(J.util.P4.new4(0,0,1,0)),0<=this.params.functionInfo.get(0).indexOf("_xyz")&&this.getFunctionZfromXY(),this.processState(),!0;if("functionXYZ"===a)return this.params.setFunctionXYZ(b),this.processState(),!0;if("lcaoType"===a)return this.params.setLcao(b,this.colorPtr),!0;if("lcaoCartoonCenter"===a){if(2!=++this.params.state)return!0;3.4028235E38==this.params.center.x&&this.params.center.setT(b);return!1}if("molecular"===a||"solvent"===a||
"sasurface"===a||"nomap"===a)return this.params.setSolvent(a,b.floatValue()),J.util.Logger.info(this.params.calculationType),this.processState(),!0;if("moData"===a)return this.params.moData=b,!0;if("mepCalcType"===a)return this.params.mep_calcType=b.intValue(),!0;if("mep"===a)return this.params.setMep(b,!1),this.processState(),!0;if("mlp"===a)return this.params.setMep(b,!0),this.processState(),!0;if("nci"===a)return c=b.booleanValue(),this.params.setNci(c),c&&this.processState(),!0;if("calculationType"===
a)return this.params.calculationType=b,!0;if("charges"===a)return this.params.theProperty=b,!0;if("randomSeed"===a)return this.params.randomSeed=b.intValue(),!0;if("molecularOrbital"===a)return c=0,d=null,Clazz.instanceOf(b,Integer)?c=b.intValue():d=b,this.params.setMO(c,d),J.util.Logger.info(this.params.calculationType),this.processState(),!0;if("fileType"===a)return this.fileType=b,!0;if("fileName"===a)return this.params.fileName=b,!0;if("outputStream"===a)return this.os=b,!0;if("readFile"===a){if(null==
(this.surfaceReader=this.setFileData(b)))return J.util.Logger.error("Could not set the surface data"),!0;this.surfaceReader.setOutputStream(this.os);this.generateSurface();return!0}if("getSurfaceSets"===a)return this.getSurfaceSets(),!0;if("mapColor"===a){if(null==(this.surfaceReader=this.setFileData(b)))return J.util.Logger.error("Could not set the mapping data"),!0;this.surfaceReader.setOutputStream(this.os);this.mapSurface();return!0}"periodic"===a&&(this.params.isPeriodic=!0);return!1},"~S,~O,J.util.BS");
$_M(c$,"newReader",($fz=function(a){a=J.jvxl.readers.SurfaceGenerator.getInterface(a);null!=a&&a.init(this);return a},$fz.isPrivate=!0,$fz),"~S");$_M(c$,"newReaderBr",($fz=function(a,b){var c=J.jvxl.readers.SurfaceGenerator.getInterface(a);null!=c&&c.init2(this,b);return c},$fz.isPrivate=!0,$fz),"~S,java.io.BufferedReader");c$.getInterface=$_M(c$,"getInterface",($fz=function(a){try{var b=Class.forName("J.jvxl.readers."+a);return null==b?null:b.newInstance()}catch(c){if(Clazz.exceptionOf(c,Exception))return J.util.Logger.error("Interface.java Error creating instance for "+
a+": \n"+c.toString()),null;throw c;}},$fz.isPrivate=!0,$fz),"~S");$_M(c$,"getSurfaceSets",($fz=function(){null==this.meshDataServer?this.meshData.getSurfaceSet():(this.meshDataServer.fillMeshData(this.meshData,1,null),this.meshData.getSurfaceSet(),this.meshDataServer.fillMeshData(this.meshData,3,null))},$fz.isPrivate=!0,$fz));$_M(c$,"processState",($fz=function(){1==this.params.state&&null!=this.params.thePlane&&this.params.state++;2<=this.params.state?this.mapSurface():this.generateSurface()},$fz.isPrivate=
!0,$fz));$_M(c$,"setReader",($fz=function(){this.readerData=null;if(null!=this.surfaceReader)return!this.surfaceReader.vertexDataOnly;switch(this.params.dataType){case 1205:this.surfaceReader=this.newReader("IsoPlaneReader");break;case 1206:this.surfaceReader=this.newReader("AtomPropertyMapper");break;case 1328:case 1329:this.readerData=1328==this.params.dataType?"Mep":"Mlp";this.surfaceReader=3==this.params.state?this.newReader("AtomPropertyMapper"):this.newReader("Iso"+this.readerData+"Reader");
break;case 1333:this.surfaceReader=this.newReader("IsoIntersectReader");break;case 1195:case 1203:case 1196:this.surfaceReader=this.newReader("IsoSolventReader");break;case 1844:case 1837:this.surfaceReader=this.newReader("IsoMOReader");break;case 8:this.surfaceReader=this.newReader("IsoFxyReader");break;case 9:this.surfaceReader=this.newReader("IsoFxyzReader")}J.util.Logger.info("Using surface reader "+this.surfaceReader);return!0},$fz.isPrivate=!0,$fz));$_M(c$,"generateSurface",($fz=function(){if(2==
++this.params.state){this.setReader();var a=null!=this.meshDataServer;this.params.colorBySign&&(this.params.isBicolorMap=!0);if(null==this.surfaceReader)J.util.Logger.error("surfaceReader is null for "+this.params.dataType);else if(this.surfaceReader.createIsosurface(!1)){null!=this.params.pocket&&a&&this.surfaceReader.selectPocket(!this.params.pocket.booleanValue());0<this.params.minSet&&this.surfaceReader.excludeMinimumSet();0<this.params.maxSet&&this.surfaceReader.excludeMaximumSet();null!=this.params.slabInfo&&
this.surfaceReader.slabIsosurface(this.params.slabInfo);a&&this.meshDataServer.notifySurfaceGenerationCompleted();0<=this.jvxlData.thisSet&&this.getSurfaceSets();this.jvxlData.jvxlDataIs2dContour&&(this.surfaceReader.colorIsosurface(),this.params.state=3);this.jvxlData.jvxlDataIsColorDensity&&(this.params.state=3);if(this.params.colorBySign||this.params.isBicolorMap)this.params.state=3,this.surfaceReader.applyColorScale();this.surfaceReader.jvxlUpdateInfo();this.setMarchingSquares(this.surfaceReader.marchingSquares);
this.surfaceReader.discardTempData(!1);this.params.mappedDataMin=3.4028235E38;this.surfaceReader.closeReader();if(3!=this.params.state&&(this.surfaceReader.hasColorData||this.params.colorDensity))this.params.state=3,this.colorIsosurface();this.surfaceReader=null}else J.util.Logger.error("Could not create isosurface"),this.params.cutoff=NaN,this.surfaceReader.closeReader()}},$fz.isPrivate=!0,$fz));$_M(c$,"mapSurface",($fz=function(){1==this.params.state&&null!=this.params.thePlane&&this.params.state++;
if(!(3>++this.params.state)&&this.setReader()){this.params.isPeriodic&&(this.volumeData.isPeriodic=!0);if(null!=this.params.thePlane){var a=this.params.isSquared;this.params.isSquared=!1;this.params.cutoff=0;this.volumeData.setMappingPlane(this.params.thePlane);this.surfaceReader.createIsosurface(!this.params.isPeriodic);this.volumeData.setMappingPlane(null);null!=this.meshDataServer&&this.meshDataServer.notifySurfaceGenerationCompleted();if(1205==this.params.dataType){this.surfaceReader.discardTempData(!0);
return}this.params.isSquared=a;this.params.mappedDataMin=3.4028235E38;this.surfaceReader.readVolumeData(!0);null!=this.params.mapLattice&&(this.volumeData.isPeriodic=!0)}else!this.params.colorBySets&&!this.params.colorDensity&&(this.surfaceReader.readAndSetVolumeParameters(!0),this.params.mappedDataMin=3.4028235E38,this.surfaceReader.readVolumeData(!0));this.colorIsosurface();this.surfaceReader.closeReader();this.surfaceReader=null}},$fz.isPrivate=!0,$fz));$_M(c$,"getSlabInfo",function(){return this.params.slabInfo});
$_M(c$,"colorIsosurface",function(){this.surfaceReader.colorIsosurface();this.surfaceReader.jvxlUpdateInfo();this.surfaceReader.updateTriangles();this.surfaceReader.discardTempData(!0);null!=this.meshDataServer&&this.meshDataServer.notifySurfaceMappingCompleted()});$_M(c$,"getProperty",function(a,b){return"jvxlFileData"===a?J.jvxl.data.JvxlCoder.jvxlGetFile(this.jvxlData,null,this.params.title,"",!0,b,null,null):"jvxlFileInfo"===a?J.jvxl.data.JvxlCoder.jvxlGetInfo(this.jvxlData):null},"~S,~N");$_M(c$,
"setFileData",($fz=function(a){var b=this.fileType;this.fileType=null;if(Clazz.instanceOf(a,J.jvxl.data.VolumeData))return this.volumeData=a,this.newReader("VolumeDataReader");if(Clazz.instanceOf(a,java.util.Map)){if(a.containsKey("__pymolSurfaceData__"))return this.readerData=a,this.newReaderBr("PyMOLMeshReader",null);this.volumeData=a.get("volumeData");return this.newReader("VolumeDataReader")}var c=null;Clazz.instanceOf(a,String)&&(c=a,a=new java.io.BufferedReader(new java.io.StringReader(a)));
var d=a;null==b&&(b=J.io.JmolBinary.determineSurfaceFileType(d));if(null!=b&&b.startsWith("UPPSALA")){var e=this.params.fileName,e=e.substring(0,e.indexOf("/",10)),e=e+J.util.Parser.getQuotedStringAt(b,b.indexOf("A HREF")+1);this.params.fileName=e;a=this.atomDataServer.getBufferedInputStream(e);if(null==a)return J.util.Logger.error("Isosurface: could not open file "+e),null;try{d=J.io.JmolBinary.getBufferedReader(a,null)}catch(f){if(!Clazz.exceptionOf(f,Exception))throw f;}b=J.io.JmolBinary.determineSurfaceFileType(d)}null==
b&&(b="UNKNOWN");J.util.Logger.info("data file type was determined to be "+b);if(b.equals("Jvxl+"))return this.newReaderBr("JvxlReader",d);this.readerData=[this.params.fileName,c];if(0<="MRC DELPHI DSN6".indexOf(b.toUpperCase())){try{d.close()}catch(g){if(!Clazz.exceptionOf(g,java.io.IOException))throw g;}d=null;b+="Binary"}return this.newReaderBr(b+"Reader",d)},$fz.isPrivate=!0,$fz),"~O");$_M(c$,"getReaderData",function(){var a=this.readerData;this.readerData=null;return a});$_M(c$,"initializeIsosurface",
function(){this.params.initialize();this.colorPtr=0;this.marchingSquares=this.surfaceReader=null;this.initState()});$_M(c$,"initState",function(){this.params.state=1;this.params.dataType=this.params.surfaceType=0});$_M(c$,"setLcao",function(){this.params.colorPos=this.params.colorPosLCAO;this.params.colorNeg=this.params.colorNegLCAO;return this.params.lcaoType});$_M(c$,"getFunctionZfromXY",($fz=function(){for(var a=this.params.functionInfo.get(1),b=Clazz.newIntArray(3,0),c=Clazz.newIntArray(3,0),
d=Array(3),e=0;3>e;e++){var f=this.params.functionInfo.get(e+2);b[e]=Math.abs(Clazz.floatToInt(f.x));d[e]=J.util.V3.new3(f.y,f.z,f.w)}for(var f=b[0],b=b[1],g=new J.util.P3,h=new J.util.P3,j=new J.util.P3,k=new J.util.P3,l=this.params.functionInfo.get(5),m=Clazz.newFloatArray(f,b,0),p,e=0;e<f;e++)for(var n=0;n<b;n++){g.scaleAdd2(e,d[0],a);g.scaleAdd2(n,d[1],g);var q=J.jvxl.readers.SurfaceGenerator.findNearestThreePoints(g.x,g.y,l,c);h.set((p=l[c[0]])[0],p[1],p[2]);1E-5>q?g.z=p[2]:(j.set((p=l[c[1]])[0],
p[1],p[2]),k.set((p=l[c[2]])[0],p[1],p[2]),g.z=this.distanceVerticalToPlane(g.x,g.y,h,j,k));m[e][n]=g.z}this.params.functionInfo.set(5,m)},$fz.isPrivate=!0,$fz));$_M(c$,"distanceVerticalToPlane",($fz=function(a,b,c,d,e){c=J.util.Measure.getDirectedNormalThroughPoints(c,d,e,this.ptRef,this.vNorm,this.vAB,this.vAC);return(this.vNorm.x*a+this.vNorm.y*b+c)/-this.vNorm.z},$fz.isPrivate=!0,$fz),"~N,~N,J.util.P3,J.util.P3,J.util.P3");c$.findNearestThreePoints=$_M(c$,"findNearestThreePoints",($fz=function(a,
b,c,d){var e,f,g,h,j,k,l;j=k=l=-1;f=g=h=3.4028235E38;for(var m=c.length;0<=--m;)e=(e=c[m][0]-a)*e+(e=c[m][1]-b)*e,e<f?(h=g,g=f,f=e,l=k,k=j,j=m):e<g?(h=g,g=e,l=k,k=m):e<h&&(h=e,l=m);d[0]=j;d[1]=k;d[2]=l;return f},$fz.isPrivate=!0,$fz),"~N,~N,~A,~A");$_M(c$,"addRequiredFile",function(a){null!=this.meshDataServer&&this.meshDataServer.addRequiredFile(a)},"~S");$_M(c$,"log",function(a){null==this.atomDataServer?System.out.println(a):this.atomDataServer.log(a)},"~S");$_M(c$,"setOutputStream",function(a,
b){null!=this.meshDataServer&&this.meshDataServer.setOutputStream(a,b)},"J.api.JmolDocument,java.io.OutputStream");$_M(c$,"isFullyLit",function(){return null!=this.params.thePlane||this.params.fullyLit});$_M(c$,"geVdwBitSet",function(){return this.bsVdw});$_M(c$,"fillAtomData",function(a,b){0!=(b&2)&&null!=a.bsSelected&&(null==this.bsVdw&&(this.bsVdw=new J.util.BS),this.bsVdw.or(a.bsSelected));this.atomDataServer.fillAtomData(a,b)},"J.atomdata.AtomData,~N");$_M(c$,"getSpanningVectors",function(){return this.surfaceReader.getSpanningVectors()})});
Clazz.declarePackage("J.jvxl.readers");
Clazz.load(null,"J.jvxl.readers.Parameters","java.lang.Float java.util.Hashtable J.util.AxisAngle4f $.Escape $.JmolList $.Logger $.Matrix3f $.P3 $.P4 $.V3".split(" "),function(){c$=Clazz.decorateAsClass(function(){this.testFlags=this.state=0;this.isSilent=this.logCube=this.logCompression=this.logMessages=!1;this.assocCutoff=0.3;this.surfaceType=this.dataType=0;this.calculationType="";this.atomRadiusData=null;this.addHydrogens=!1;this.solventExtendedAtomRadius=this.solventRadius=0;this.propertySmoothing=
!1;this.propertySmoothingPower=4;this.cavityRadius=this.envelopeRadius=0;this.isCavity=!1;this.pocket=null;this.minSet=0;this.slabInfo=null;this.slabPlaneOffset=NaN;this.theProperty=null;this.solvent_ptsPerAngstrom=4;this.solvent_gridMax=60;this.plane_ptsPerAngstrom=4;this.plane_gridMax=81;this.colorBySets=this.colorByPhase=this.colorBySign=!1;this.colorPhase=this.colorNegLCAO=this.colorPosLCAO=this.colorPos=this.colorNeg=this.colorRgb=0;this.iAddGridPoints=this.colorDensity=!1;this.atomIndex=0;this.isAngstroms=
!1;this.scale3d=this.scale=0;this.anisotropy=null;this.isAnisotropic=!1;this.eccentricityMatrixInverse=this.eccentricityMatrix=null;this.isEccentric=!1;this.eccentricityRatio=this.eccentricityScale=0;this.functionInfo=this.lcaoType=this.anisoB=this.aniosU=null;this.psi_n=2;this.psi_Znuc=this.psi_m=this.psi_l=1;this.psi_ptsPerAngstrom=5;this.psi_monteCarloCount=0;this.mep_gridMax=40;this.mep_ptsPerAngstrom=3;this.mep_marginAngstroms=1;this.mep_calcType=-1;this.qmOrbitalCount=this.qmOrbitalType=0;this.moData=
null;this.qm_gridMax=80;this.qm_ptsPerAngstrom=10;this.qm_marginAngstroms=1;this.qm_nAtoms=0;this.qm_moNumber=2147483647;this.point=this.center=this.qm_moLinearCombination=null;this.distance=0;this.allowVolumeRender=!1;this.title=this.func=this.bsSolvent=this.bsIgnore=this.bsSelected=this.script=null;this.readAllData=this.blockCubeData=!1;this.fileIndex=-1;this.fileName=null;this.modelIndex=-1;this.dataXYReversed=this.insideOut=this.isXLowToHigh=!1;this.sigma=this.cutoff=3.4028235E38;this.cutoffAutomatic=
!0;this.rangeDefined=this.rangeSelected=this.rangeAll=this.isPositiveOnly=this.isCutoffAbsolute=!1;this.mappedDataMax=this.mappedDataMin=this.valueMappedToBlue=this.valueMappedToRed=0;this.isSquaredLinear=this.isSquared=this.isBicolorMap=this.isColorReversed=!1;this.thePlane=null;this.isContoured=!1;this.thisContour=this.nContours=0;this.contourFromZero=!1;this.parameters=null;this.maxSet=this.downsampleFactor=this.resolution=0;this.bsExcluded=this.boundingBox=this.contourIncrements=this.contourColixes=
this.contoursDiscrete=null;this.contourType=0;this.colorSchemeTranslucent=!1;this.colorEncoder=null;this.usePropertyForColorRange=!0;this.doFullMolecular=this.isPeriodic=!1;this.propertyDistanceMax=2147483647;this.randomSeed=0;this.fullyLit=!1;this.mapLattice=this.contactPair=this.volumeData=this.points=this.steps=this.origin=this.intersection=this.vertexSource=null;this.showTiming=this.isMapped=!1;Clazz.instantialize(this,arguments)},J.jvxl.readers,"Parameters");Clazz.prepareFields(c$,function(){this.anisotropy=
Clazz.newFloatArray(3,0)});$_M(c$,"initialize",function(){this.addHydrogens=!1;this.allowVolumeRender=!0;this.atomRadiusData=null;this.atomIndex=-1;this.blockCubeData=!1;this.boundingBox=null;this.bsExcluded=Array(4);this.bsSolvent=this.bsSelected=this.bsIgnore=null;this.calculationType="";this.center=J.util.P3.new3(3.4028235E38,3.4028235E38,3.4028235E38);this.colorDensity=this.colorBySign=this.colorByPhase=this.colorBySets=!1;this.colorEncoder=null;this.colorNeg=-65536;this.colorNegLCAO=-8388480;
this.colorPos=-16776961;this.colorPosLCAO=-23296;this.colorRgb=-2147483648;this.colorSchemeTranslucent=!1;this.contourColixes=this.contoursDiscrete=this.contourIncrements=this.contactPair=null;this.contourFromZero=!0;this.cutoff=3.4028235E38;this.cutoffAutomatic=!0;this.dataXYReversed=!1;this.distance=3.4028235E38;this.doFullMolecular=!1;this.envelopeRadius=10;this.fileIndex=1;this.readAllData=!0;this.fileName="";this.fullyLit=!1;this.functionInfo=this.func=null;this.insideOut=this.iAddGridPoints=
!1;this.intersection=null;this.isSilent=this.isPeriodic=this.isMapped=this.isEccentric=this.isAnisotropic=this.isContoured=this.isSquaredLinear=this.isSquared=this.isColorReversed=this.isCavity=this.isBicolorMap=this.isCutoffAbsolute=this.isPositiveOnly=this.isAngstroms=!1;this.mapLattice=null;this.logCube=this.logCompression=!1;this.logMessages=J.util.Logger.debugging;this.mappedDataMin=3.4028235E38;this.mep_calcType=-1;this.minSet=0;this.modelIndex=-1;this.nContours=0;this.pocket=null;this.propertyDistanceMax=
2147483647;this.propertySmoothing=!1;this.propertySmoothingPower=4;this.rangeSelected=this.rangeAll=this.rangeDefined=!1;this.resolution=3.4028235E38;this.scale=NaN;this.scale3d=0;this.sigma=NaN;this.slabInfo=null;this.solventExtendedAtomRadius=0;this.state=1;this.testFlags=0;this.theProperty=this.thePlane=null;this.thisContour=-1;this.title=null;this.usePropertyForColorRange=!0;this.volumeData=this.vertexSource=null});$_M(c$,"setAnisotropy",function(a){this.anisotropy[0]=a.x;this.anisotropy[1]=a.y;
this.anisotropy[2]=a.z;this.isAnisotropic=!0;3.4028235E38==this.center.x&&this.center.set(0,0,0)},"J.util.P3");$_M(c$,"setEccentricity",function(a){var b=J.util.V3.new3(a.x,a.y,a.z),c=0<this.scale?this.scale:0>a.w?1:b.length();a=Math.abs(a.w);b.normalize();var d=J.util.V3.new3(0,0,1);b.add(d);b.normalize();Float.isNaN(b.x)&&b.set(1,0,0);this.eccentricityMatrix=new J.util.Matrix3f;this.eccentricityMatrix.setIdentity();this.eccentricityMatrix.setAA(J.util.AxisAngle4f.newVA(b,3.141592653589793));this.eccentricityMatrixInverse=
new J.util.Matrix3f;this.eccentricityMatrixInverse.invertM(this.eccentricityMatrix);this.isEccentric=this.isAnisotropic=!0;this.eccentricityScale=c;this.eccentricityRatio=a;1<a&&(this.eccentricityScale*=a);this.anisotropy[0]=a*c;this.anisotropy[1]=a*c;this.anisotropy[2]=c;3.4028235E38==this.center.x&&this.center.set(0,0,0)},"J.util.P4");$_M(c$,"setPlane",function(a){this.thePlane=a;0==this.thePlane.x&&(0==this.thePlane.y&&0==this.thePlane.z)&&(this.thePlane.z=1);this.isContoured=!0},"J.util.P4");
$_M(c$,"setSphere",function(a,b){this.dataType=b?74:65;this.distance=a;this.setEccentricity(J.util.P4.new4(0,0,1,1));this.cutoff=1.4E-45;this.isCutoffAbsolute=!1;this.isSilent=!this.logMessages;this.script=this.getScriptParams()+" SPHERE "+a+";"},"~N,~B");$_M(c$,"setEllipsoid",function(a){this.dataType=66;this.distance=1;this.setEccentricity(a);this.cutoff=1.4E-45;this.isCutoffAbsolute=!1;this.isSilent=!this.logMessages},"J.util.P4");$_M(c$,"setEllipsoid",function(a){this.anisoB=a;this.dataType=67;
this.distance=0.3*(Float.isNaN(this.scale)?1:this.scale);this.cutoff=1.4E-45;this.isCutoffAbsolute=!1;this.isSilent=!this.logMessages;3.4028235E38==this.center.x&&this.center.set(0,0,0);3.4028235E38==this.resolution&&(this.resolution=6)},"~A");$_M(c$,"setLobe",function(a){this.dataType=68;this.setEccentricity(a);3.4028235E38==this.cutoff&&(this.cutoff=0.14,this.isSquared&&(this.cutoff*=this.cutoff));this.isSilent=!this.logMessages;this.script=this.getScriptParams()+" LOBE {"+a.x+" "+a.y+" "+a.z+" "+
a.w+"};"},"J.util.P4");$_M(c$,"getScriptParams",($fz=function(){return" center "+J.util.Escape.eP(this.center)+(Float.isNaN(this.scale)?"":" scale "+this.scale)},$fz.isPrivate=!0,$fz));$_M(c$,"setLp",function(a){this.dataType=70;this.setEccentricity(a);3.4028235E38==this.cutoff&&(this.cutoff=0.14,this.isSquared&&(this.cutoff*=this.cutoff));this.isSilent=!this.logMessages;this.script=" center "+J.util.Escape.eP(this.center)+(Float.isNaN(this.scale)?"":" scale "+this.scale)+" LP {"+a.x+" "+a.y+" "+
a.z+" "+a.w+"};"},"J.util.P4");$_M(c$,"setRadical",function(a){this.dataType=71;this.setEccentricity(a);3.4028235E38==this.cutoff&&(this.cutoff=0.14,this.isSquared&&(this.cutoff*=this.cutoff));this.isSilent=!this.logMessages;this.script=" center "+J.util.Escape.eP(this.center)+(Float.isNaN(this.scale)?"":" scale "+this.scale)+" RAD {"+a.x+" "+a.y+" "+a.z+" "+a.w+"};"},"J.util.P4");$_M(c$,"setLcao",function(a,b){this.lcaoType=a;1==b&&(this.colorPosLCAO=this.colorNegLCAO);this.isSilent=!this.logMessages},
"~S,~N");$_M(c$,"setSolvent",function(a,b){this.isEccentric=this.isAnisotropic=!1;this.solventRadius=Math.abs(b);this.dataType=null!=this.intersection?1333:"nomap"===a?1205:"molecular"===a?1203:"sasurface"===a||0==this.solventRadius?1196:1195;if(2>this.state&&(this.cutoffAutomatic||!this.colorDensity)&&(null==this.intersection||3.4028235E38==this.cutoff))this.cutoff=0;switch(this.dataType){case 1333:this.calculationType="VDW intersection";break;case 1205:this.calculationType="unmapped plane";break;
case 1203:this.calculationType="molecular surface with radius "+this.solventRadius;break;case 1195:this.calculationType="solvent-excluded surface with radius "+this.solventRadius;break;case 1196:this.calculationType="solvent-accessible surface with radius "+this.solventRadius}switch(this.dataType){case 1205:this.solventExtendedAtomRadius=this.solventRadius;this.solventRadius=0;this.isContoured=!1;break;case 1203:this.solventExtendedAtomRadius=0;break;case 1195:this.solventExtendedAtomRadius=0;null==
this.bsIgnore&&(this.bsIgnore=this.bsSolvent);break;case 1196:this.solventExtendedAtomRadius=this.solventRadius,this.solventRadius=0,null==this.bsIgnore&&(this.bsIgnore=this.bsSolvent)}},"~S,~N");$_M(c$,"setFunctionXY",function(a){this.dataType=8;this.functionInfo=a;this.cutoff=1.4E-45;this.isEccentric=this.isAnisotropic=!1},"J.util.JmolList");$_M(c$,"setFunctionXYZ",function(a){this.dataType=9;this.functionInfo=a;3.4028235E38==this.cutoff&&(this.cutoff=1.4E-45);this.isEccentric=this.isAnisotropic=
!1},"J.util.JmolList");$_M(c$,"setAtomicOrbital",function(a){this.dataType=1294;this.setEccentricity(J.util.P4.new4(0,0,1,1));this.psi_n=Clazz.floatToInt(a[0]);this.psi_l=Clazz.floatToInt(a[1]);this.psi_m=Clazz.floatToInt(a[2]);this.psi_Znuc=a[3];this.psi_monteCarloCount=Clazz.floatToInt(a[4]);this.distance=a[5];if(0!=this.distance||null!=this.thePlane)this.allowVolumeRender=!1;this.randomSeed=Clazz.floatToInt(a[6]);this.psi_ptsPerAngstrom=10;if(3.4028235E38==this.cutoff||0.14==this.cutoff)this.cutoff=
0<this.psi_monteCarloCount?0:0.04,this.isSquared&&(this.cutoff*=this.cutoff);this.isCutoffAbsolute=!0;2>this.state&&(null==this.thePlane&&this.colorBySign)&&(this.isBicolorMap=!0);return 0<this.psi_Znuc&&Math.abs(this.psi_m)<=this.psi_l&&this.psi_l<this.psi_n},"~A");$_M(c$,"setMep",function(a,b){this.dataType=b?1329:1328;this.theProperty=a;this.isEccentric=this.isAnisotropic=this.usePropertyForColorRange=!1;3.4028235E38==this.cutoff&&(this.cutoff=0.1,this.isSquared&&(this.cutoff*=this.cutoff));this.isCutoffAbsolute=
0<this.cutoff&&!this.isPositiveOnly;this.contourFromZero=!1;2<=this.state||null!=this.thePlane?!this.rangeDefined&&!this.rangeAll&&(this.valueMappedToRed=-0.1,this.valueMappedToBlue=0.1,this.rangeDefined=!0):this.isBicolorMap=this.colorBySign=!0},"~A,~B");$_M(c$,"setNci",function(a){this.fullyLit=!0;this.qm_gridMax=200;a&&(this.dataType=1844);this.qm_marginAngstroms=2;this.qmOrbitalType=a?3:4;if(a&&(null==this.parameters||2>this.parameters.length))this.parameters=[this.cutoff,2];if(3.4028235E38==
this.cutoff||0==this.cutoff)this.cutoff=0.3;this.isSquared&&(this.cutoff*=this.cutoff);null==this.title&&(this.title=[]);this.moData=new java.util.Hashtable},"~B");$_M(c$,"setMO",function(a,b){this.qm_moLinearCombination=b;this.qm_moNumber=null==b?Math.abs(a):Clazz.floatToInt(b[1]);this.qmOrbitalType=this.moData.containsKey("haveVolumeData")?5:this.moData.containsKey("gaussians")?1:this.moData.containsKey("slaters")?2:0;var c=0>=a&&null==b;0==this.qmOrbitalType?(J.util.Logger.error("MO ERROR: No basis functions found in file for MO calculation. (GAUSSIAN 'gfprint' keyword may be missing?)"),
this.title=["no basis functions found in file"]):(this.qmOrbitalCount=this.moData.get("mos").size(),this.calculationType=this.moData.get("calculationType"),this.calculationType="Molecular orbital #"+this.qm_moNumber+"/"+this.qmOrbitalCount+" "+(null==this.calculationType?"":this.calculationType),!c&&null==this.title&&(this.title=Array(5),this.title[0]="%F",this.title[1]="Model %M  MO %I/%N %T",this.title[2]="?Energy = %E %U",this.title[3]="?Symmetry = %S",this.title[4]="?Occupancy = %O"));this.dataType=
1837;3.4028235E38==this.cutoff&&(this.cutoff=c?0.01:0.05);if(this.isSquared||this.isSquaredLinear)this.cutoff*=this.cutoff;this.isEccentric=this.isAnisotropic=!1;this.isCutoffAbsolute=0<this.cutoff&&!this.isPositiveOnly;2<=this.state||null!=this.thePlane||(this.colorBySign=!0,this.colorByPhase&&0==this.colorPhase&&(this.colorByPhase=!1),this.isBicolorMap=!0)},"~N,~A");$_M(c$,"setMapRanges",function(a,b){if(!this.colorDensity&&(this.colorByPhase||this.colorBySign||(null!=this.thePlane||this.isBicolorMap)&&
!this.isContoured))this.mappedDataMin=-1,this.mappedDataMax=1;if(3.4028235E38==this.mappedDataMin||this.mappedDataMin==this.mappedDataMax){var c=a.getMinMaxMappedValues(b);this.mappedDataMin=c[0];this.mappedDataMax=c[1]}0==this.mappedDataMin&&0==this.mappedDataMax&&(this.mappedDataMin=-1,this.mappedDataMax=1);this.rangeDefined||(this.valueMappedToRed=this.mappedDataMin,this.valueMappedToBlue=this.mappedDataMax)},"J.jvxl.readers.SurfaceReader,~B");$_M(c$,"resetForMapping",function(a){a||(this.state=
2);this.isMapped=!0;this.qmOrbitalType=0;this.parameters=null;this.colorDensity=!1;this.mappedDataMin=3.4028235E38;this.center=this.volumeData=this.steps=this.origin=this.points=this.func=this.intersection=null;this.isAnisotropic=!1},"~B");$_M(c$,"addSlabInfo",function(a){null==this.slabInfo&&(this.slabInfo=new J.util.JmolList);this.slabInfo.addLast(a)},"~A");Clazz.defineStatics(c$,"STATE_UNINITIALIZED",0,"STATE_INITIALIZED",1,"STATE_DATA_READ",2,"STATE_DATA_COLORED",3,"NO_ANISOTROPY",32,"IS_SILENT",
64,"IS_SOLVENTTYPE",128,"HAS_MAXGRID",256,"IS_POINTMAPPABLE",512,"IS_SLABBABLE",1024,"SURFACE_NONE",0,"SURFACE_SPHERE",65,"SURFACE_ELLIPSOID2",66,"SURFACE_ELLIPSOID3",67,"SURFACE_LOBE",68,"SURFACE_LCAOCARTOON",69,"SURFACE_LONEPAIR",70,"SURFACE_RADICAL",71,"SURFACE_FUNCTIONXY",8,"SURFACE_FUNCTIONXYZ",9,"SURFACE_GEODESIC",74,"SURFACE_SOLVENT",1195,"SURFACE_SASURFACE",1196,"SURFACE_MOLECULARORBITAL",1837,"SURFACE_ATOMICORBITAL",1294,"SURFACE_MEP",1328,"SURFACE_MLP",1329,"SURFACE_MOLECULAR",1203,"SURFACE_NCI",
1844,"SURFACE_INTERSECT",1333,"SURFACE_NOMAP",1205,"SURFACE_PROPERTY",1206,"ANGSTROMS_PER_BOHR",0.5291772,"defaultEdgeFractionBase",35,"defaultEdgeFractionRange",90,"defaultColorFractionBase",35,"defaultColorFractionRange",90,"defaultMappedDataMin",0,"defaultMappedDataMax",1,"defaultCutoff",0.02,"defaultOrbitalCutoff",0.04,"defaultLobeCutoff",0.14,"defaultOrbitalCutoffOld",0.14,"defaultQMOrbitalCutoff",0.05,"defaultQMElectronDensityCutoff",0.01,"defaultContourCount",11,"nContourMax",100,"defaultColorNegative",
4294901760,"defaultColorPositive",4278190335,"defaultColorNegativeLCAO",4286578816,"defaultColorPositiveLCAO",4294944E3,"defaultSolventRadius",1.2,"defaultMepCutoff",0.1,"defaultMepMin",-0.1,"defaultMepMax",0.1,"MEP_MAX_GRID",40,"QM_TYPE_UNKNOWN",0,"QM_TYPE_GAUSSIAN",1,"QM_TYPE_SLATER",2,"QM_TYPE_NCI_PRO",3,"QM_TYPE_NCI_SCF",4,"QM_TYPE_VOLUME_DATA",5,"MO_MAX_GRID",80)});Clazz.declarePackage("J.jvxl.readers");
Clazz.load(["J.jvxl.api.VertexDataServer","J.util.P3"],"J.jvxl.readers.SurfaceReader","java.lang.Float J.jvxl.calc.MarchingCubes $.MarchingSquares J.jvxl.data.JvxlCoder $.MeshData J.util.ArrayUtil $.BS $.BoxInfo $.C $.ColorEncoder $.Escape $.Logger".split(" "),function(){c$=Clazz.decorateAsClass(function(){this.edgeData=this.volumeData=this.jvxlData=this.meshData=this.params=this.meshDataServer=this.sg=null;this.isXLowToHigh=this.isProgressive=this.allowSigma=this.haveSurfaceAtoms=!1;this.assocCutoff=
0.3;this.hasColorData=this.vertexDataOnly=this.isQuiet=!1;this.dataMin=3.4028235E38;this.dataMax=-3.4028235E38;this.dataMean=0;this.anisotropy=this.center=this.xyzMax=this.xyzMin=null;this.isAnisotropic=!1;this.eccentricityMatrixInverse=this.eccentricityMatrix=null;this.isEccentric=!1;this.edgeCount=this.eccentricityRatio=this.eccentricityScale=0;this.voxelData=this.voxelCounts=this.volumetricVectors=this.volumetricOrigin=null;this.nPointsZ=this.nPointsY=this.nPointsX=this.nDataPoints=this.nBytes=
0;this.isJvxl=!1;this.colorFractionRange=this.colorFractionBase=this.edgeFractionRange=this.edgeFractionBase=0;this.fractionData=this.jvxlFileHeaderBuffer=null;this.jvxlColorDataRead=this.jvxlEdgeDataRead="";this.jvxlVoxelBitSet=null;this.jvxlDataIsColorDensity=this.jvxlDataIs2dContour=this.jvxlDataIsPrecisionColor=this.jvxlDataIsColorMapped=!1;this.jvxlNSurfaceInts=this.jvxlCutoff=0;this.cJvxlEdgeNaN="\x00";this.contourVertexCount=0;this.yzPlanes=this.marchingCubes=this.marchingSquares=null;this.yzCount=
0;this.minMax=this.ptTemp=this.qpc=null;this.haveSetAnisotropy=!1;Clazz.instantialize(this,arguments)},J.jvxl.readers,"SurfaceReader",null,J.jvxl.api.VertexDataServer);Clazz.prepareFields(c$,function(){this.ptTemp=new J.util.P3});Clazz.makeConstructor(c$,function(){});$_M(c$,"init2",function(){},"J.jvxl.readers.SurfaceGenerator,java.io.BufferedReader");$_M(c$,"init",function(a){this.sg=a;this.params=a.getParams();this.marchingSquares=a.getMarchingSquares();this.assocCutoff=this.params.assocCutoff;
this.isXLowToHigh=this.params.isXLowToHigh;this.center=this.params.center;this.anisotropy=this.params.anisotropy;this.isAnisotropic=this.params.isAnisotropic;this.eccentricityMatrix=this.params.eccentricityMatrix;this.eccentricityMatrixInverse=this.params.eccentricityMatrixInverse;this.isEccentric=this.params.isEccentric;this.eccentricityScale=this.params.eccentricityScale;this.eccentricityRatio=this.params.eccentricityRatio;this.meshData=a.getMeshData();this.jvxlData=a.getJvxlData();this.setVolumeDataV(a.getVolumeData());
this.meshDataServer=a.getMeshDataServer();this.cJvxlEdgeNaN=String.fromCharCode(125)},"J.jvxl.readers.SurfaceGenerator");$_M(c$,"setOutputStream",function(){},"java.io.OutputStream");$_M(c$,"newVoxelDataCube",function(){this.volumeData.setVoxelDataAsArray(this.voxelData=Clazz.newFloatArray(this.nPointsX,this.nPointsY,this.nPointsZ,0))});$_M(c$,"setVolumeDataV",function(a){this.nBytes=0;this.volumetricOrigin=a.volumetricOrigin;this.volumetricVectors=a.volumetricVectors;this.voxelCounts=a.voxelCounts;
this.voxelData=a.getVoxelData();this.volumeData=a},"J.jvxl.data.VolumeData");$_M(c$,"jvxlUpdateInfo",function(){this.jvxlData.jvxlUpdateInfo(this.params.title,this.nBytes)});$_M(c$,"readAndSetVolumeParameters",function(a){return!this.readVolumeParameters(a)?!1:this.vertexDataOnly?!0:this.volumeData.setUnitVectors()},"~B");$_M(c$,"createIsosurface",function(a){this.resetIsosurface();this.params.showTiming&&J.util.Logger.startTimer("isosurface creation");this.jvxlData.cutoff=NaN;if(!this.readAndSetVolumeParameters(a))return!1;
!a&&(!Float.isNaN(this.params.sigma)&&!this.allowSigma)&&(0<this.params.sigma&&J.util.Logger.error("Reader does not support SIGMA option -- using cutoff 1.6"),this.params.cutoff=1.6);0>this.params.sigma&&(this.params.sigma=-this.params.sigma);this.nPointsX=this.voxelCounts[0];this.nPointsY=this.voxelCounts[1];this.nPointsZ=this.voxelCounts[2];this.jvxlData.isSlabbable=0!=(this.params.dataType&1024);this.jvxlData.insideOut=this.params.insideOut;this.jvxlData.dataXYReversed=this.params.dataXYReversed;
this.jvxlData.isBicolorMap=this.params.isBicolorMap;this.jvxlData.nPointsX=this.nPointsX;this.jvxlData.nPointsY=this.nPointsY;this.jvxlData.nPointsZ=this.nPointsZ;this.jvxlData.jvxlVolumeDataXml=this.volumeData.xmlData;this.jvxlData.voxelVolume=this.volumeData.voxelVolume;if(a)this.volumeData.setMappingPlane(this.params.thePlane),null!=this.meshDataServer&&this.meshDataServer.fillMeshData(this.meshData,1,null),this.params.setMapRanges(this,!1),this.generateSurfaceData(),this.volumeData.setMappingPlane(null);
else{if(!this.readVolumeData(!1))return!1;this.generateSurfaceData()}if(null!=this.jvxlFileHeaderBuffer){a=this.jvxlFileHeaderBuffer.toString();var b=a.indexOf("\n",a.indexOf("\n",a.indexOf("\n")+1)+1)+1;this.jvxlData.jvxlFileTitle=a.substring(0,b)}null==this.params.contactPair&&this.setBBoxAll();this.params.isSilent||J.util.Logger.info("boundbox corners "+J.util.Escape.eP(this.xyzMin)+" "+J.util.Escape.eP(this.xyzMax));this.jvxlData.boundingBox=[this.xyzMin,this.xyzMax];this.jvxlData.dataMin=this.dataMin;
this.jvxlData.dataMax=this.dataMax;this.jvxlData.cutoff=this.isJvxl?this.jvxlCutoff:this.params.cutoff;this.jvxlData.isCutoffAbsolute=this.params.isCutoffAbsolute;this.jvxlData.pointsPerAngstrom=1/this.volumeData.volumetricVectorLengths[0];this.jvxlData.jvxlColorData="";this.jvxlData.jvxlPlane=this.params.thePlane;this.jvxlData.jvxlEdgeData=this.edgeData;this.jvxlData.isBicolorMap=this.params.isBicolorMap;this.jvxlData.isContoured=this.params.isContoured;this.jvxlData.colorDensity=this.params.colorDensity;
null!=this.jvxlData.vContours&&(this.params.nContours=this.jvxlData.vContours.length);this.jvxlData.nContours=this.params.contourFromZero?this.params.nContours:-1-this.params.nContours;this.jvxlData.nEdges=this.edgeCount;this.jvxlData.edgeFractionBase=this.edgeFractionBase;this.jvxlData.edgeFractionRange=this.edgeFractionRange;this.jvxlData.colorFractionBase=this.colorFractionBase;this.jvxlData.colorFractionRange=this.colorFractionRange;this.jvxlData.jvxlDataIs2dContour=this.jvxlDataIs2dContour;this.jvxlData.jvxlDataIsColorMapped=
this.jvxlDataIsColorMapped;this.jvxlData.jvxlDataIsColorDensity=this.jvxlDataIsColorDensity;this.jvxlData.isXLowToHigh=this.isXLowToHigh;this.jvxlData.vertexDataOnly=this.vertexDataOnly;this.jvxlData.saveVertexCount=0;if(this.jvxlDataIsColorMapped||0<this.jvxlData.nVertexColors)null!=this.meshDataServer&&(this.meshDataServer.fillMeshData(this.meshData,1,null),this.meshDataServer.fillMeshData(this.meshData,2,null)),this.jvxlData.jvxlColorData=this.readColorData(),this.updateSurfaceData(),null!=this.meshDataServer&&
this.meshDataServer.notifySurfaceMappingCompleted();this.params.showTiming&&J.util.Logger.checkTimer("isosurface creation",!1);return!0},"~B");$_M(c$,"resetIsosurface",function(){this.meshData=new J.jvxl.data.MeshData;this.xyzMin=this.xyzMax=null;this.jvxlData.isBicolorMap=this.params.isBicolorMap;null!=this.meshDataServer&&this.meshDataServer.fillMeshData(null,0,null);this.contourVertexCount=0;3.4028235E38==this.params.cutoff&&(this.params.cutoff=0.02);this.jvxlData.jvxlSurfaceData="";this.jvxlData.jvxlEdgeData=
"";this.jvxlData.jvxlColorData="";this.edgeCount=0;this.edgeFractionBase=35;this.edgeFractionRange=90;this.colorFractionBase=35;this.colorFractionRange=90;this.params.mappedDataMin=3.4028235E38});$_M(c$,"discardTempData",function(a){a&&(this.voxelData=null,this.sg.setMarchingSquares(this.marchingSquares=null),this.marchingCubes=null)},"~B");$_M(c$,"initializeVolumetricData",function(){this.nPointsX=this.voxelCounts[0];this.nPointsY=this.voxelCounts[1];this.nPointsZ=this.voxelCounts[2];this.setVolumeDataV(this.volumeData)});
$_M(c$,"gotoAndReadVoxelData",function(a){this.initializeVolumetricData();if(0<this.nPointsX&&0<this.nPointsY&&0<this.nPointsZ)try{this.gotoData(this.params.fileIndex-1,this.nPointsX*this.nPointsY*this.nPointsZ),this.readSurfaceData(a)}catch(b){if(Clazz.exceptionOf(b,Exception))return J.util.Logger.error(b.toString()),!1;throw b;}return!0},"~B");$_M(c$,"gotoData",function(){},"~N,~N");$_M(c$,"readColorData",function(){if(null==this.jvxlData.vertexColors)return"";var a=this.jvxlData.vertexCount,b=
this.meshData.vertexColixes,c=this.meshData.vertexValues;if(null==b||b.length<a)this.meshData.vertexColixes=b=Clazz.newShortArray(a,0);if(null==c||c.length<a)this.meshData.vertexValues=Clazz.newFloatArray(a,0);for(c=0;c<a;c++)b[c]=J.util.C.getColix(this.jvxlData.vertexColors[c]);return"-"});Clazz.overrideMethod(c$,"getPlane",function(a){return this.getPlane2(a)},"~N");$_M(c$,"getPlane2",function(a){0==this.yzCount&&this.initPlanes();null!=this.qpc&&this.qpc.getPlane(a,this.yzPlanes[a%2]);return this.yzPlanes[a%
2]},"~N");$_M(c$,"initPlanes",function(){this.yzCount=this.nPointsY*this.nPointsZ;this.isQuiet||J.util.Logger.info("reading data progressively -- yzCount = "+this.yzCount);this.yzPlanes=J.util.ArrayUtil.newFloat2(2);this.yzPlanes[0]=Clazz.newFloatArray(this.yzCount,0);this.yzPlanes[1]=Clazz.newFloatArray(this.yzCount,0)});Clazz.overrideMethod(c$,"getValue",function(a,b,c,d){return this.getValue2(a,b,c,d)},"~N,~N,~N,~N");$_M(c$,"getValue2",function(a,b,c,d){return null==this.yzPlanes?this.voxelData[a][b][c]:
this.yzPlanes[a%2][d]},"~N,~N,~N,~N");$_M(c$,"generateSurfaceData",($fz=function(){this.edgeData="";if(this.vertexDataOnly)try{this.readSurfaceData(!1)}catch(a){if(Clazz.exceptionOf(a,Exception))System.out.println(a.toString()),J.util.Logger.error("Exception in SurfaceReader::readSurfaceData: "+a.toString());else throw a;}else{this.contourVertexCount=0;var b=-1;this.marchingSquares=null;if(null!=this.params.thePlane||this.params.isContoured)this.marchingSquares=new J.jvxl.calc.MarchingSquares(this,
this.volumeData,this.params.thePlane,this.params.contoursDiscrete,this.params.nContours,this.params.thisContour,this.params.contourFromZero),b=this.marchingSquares.getContourType(),this.marchingSquares.setMinMax(this.params.valueMappedToRed,this.params.valueMappedToBlue);this.params.contourType=b;this.params.isXLowToHigh=this.isXLowToHigh;this.marchingCubes=new J.jvxl.calc.MarchingCubes(this,this.volumeData,this.params,this.jvxlVoxelBitSet);b=this.marchingCubes.getEdgeData();null==this.params.thePlane&&
(this.edgeData=b);this.jvxlData.setSurfaceInfoFromBitSetPts(this.marchingCubes.getBsVoxels(),this.params.thePlane,this.params.mapLattice);this.jvxlData.jvxlExcluded=this.params.bsExcluded;this.isJvxl&&(this.edgeData=this.jvxlEdgeDataRead);this.postProcessVertices()}},$fz.isPrivate=!0,$fz));$_M(c$,"postProcessVertices",function(){});Clazz.overrideMethod(c$,"getSurfacePointIndexAndFraction",function(a,b,c,d,e,f,g,h,j,k,l,m,p,n){b=this.getSurfacePointAndFraction(a,b,j,k,l,m,c,d,e,g,h,n,this.ptTemp);
if(null!=this.marchingSquares&&this.params.isContoured)return this.marchingSquares.addContourVertex(this.ptTemp,a);a=0<this.assocCutoff?n[0]<this.assocCutoff?g:n[0]>1-this.assocCutoff?h:-1:-1;0<=a&&(a=this.marchingCubes.getLinearOffset(c,d,e,a));a=this.addVertexCopy(this.ptTemp,b,a);0<=a&&this.params.iAddGridPoints&&(this.marchingCubes.calcVertexPoint(c,d,e,h,this.ptTemp),this.addVertexCopy(j<k?l:this.ptTemp,Math.min(j,k),-3),this.addVertexCopy(j<k?this.ptTemp:l,Math.max(j,k),-3));return a},"~N,~B,~N,~N,~N,J.util.P3i,~N,~N,~N,~N,J.util.P3,J.util.V3,~B,~A");
$_M(c$,"getSurfacePointAndFraction",function(a,b,c,d,e,f,g,h,j,k,l,m,p){return this.getSPF(a,b,c,d,e,f,g,h,j,k,l,m,p)},"~N,~B,~N,~N,J.util.P3,J.util.V3,~N,~N,~N,~N,~N,~A,J.util.P3");$_M(c$,"getSPF",function(a,b,c,d,e,f,g,h,j,k,l,m,p){d-=c;g=(a-c)/d;if(b&&(0>g||1<g))g=(-a-c)/d;if(0>g||1<g)g=NaN;m[0]=g;p.scaleAdd2(g,f,e);return c+g*d},"~N,~B,~N,~N,J.util.P3,J.util.V3,~N,~N,~N,~N,~N,~A,J.util.P3");$_M(c$,"addVertexCopy",function(a,b,c){return this.addVC(a,b,c)},"J.util.P3,~N,~N");$_M(c$,"addVC",function(a,
b,c){return Float.isNaN(b)&&-3!=c?-1:null==this.meshDataServer?this.meshData.addVertexCopy(a,b,c):this.meshDataServer.addVertexCopy(a,b,c)},"J.util.P3,~N,~N");$_M(c$,"addTriangleCheck",function(a,b,c,d,e,f,g){if(null!=this.marchingSquares&&this.params.isContoured){if(0==g)return this.marchingSquares.addTriangle(a,b,c,d,e);g=0}return null!=this.meshDataServer?this.meshDataServer.addTriangleCheck(a,b,c,d,e,f,g):f&&!J.jvxl.data.MeshData.checkCutoff(a,b,c,this.meshData.vertexValues)?-1:this.meshData.addTriangleCheck(a,
b,c,d,e,g)},"~N,~N,~N,~N,~N,~B,~N");$_M(c$,"colorIsosurface",function(){this.params.isSquared&&null!=this.volumeData&&this.volumeData.filterData(!0,NaN);null!=this.meshDataServer&&this.meshDataServer.fillMeshData(this.meshData,1,null);this.jvxlData.saveVertexCount=0;this.params.isContoured&&null!=this.marchingSquares&&(this.initializeMapping(),this.params.setMapRanges(this,!1),this.marchingSquares.setMinMax(this.params.valueMappedToRed,this.params.valueMappedToBlue),this.jvxlData.saveVertexCount=
this.marchingSquares.contourVertexCount,this.contourVertexCount=this.marchingSquares.generateContourData(this.jvxlDataIs2dContour,this.params.isSquared?1E-8:1E-4),this.jvxlData.contourValuesUsed=this.marchingSquares.getContourValues(),this.minMax=this.marchingSquares.getMinMax(),null!=this.meshDataServer&&this.meshDataServer.notifySurfaceGenerationCompleted(),this.finalizeMapping());this.applyColorScale();this.jvxlData.nContours=this.params.contourFromZero?this.params.nContours:-1-this.params.nContours;
this.jvxlData.jvxlFileMessage="mapped: min = "+this.params.valueMappedToRed+"; max = "+this.params.valueMappedToBlue});$_M(c$,"applyColorScale",function(){this.colorFractionBase=this.jvxlData.colorFractionBase=35;this.colorFractionRange=this.jvxlData.colorFractionRange=90;0==this.params.colorPhase&&(this.params.colorPhase=1);null==this.meshDataServer?this.meshData.vertexColixes=Clazz.newShortArray(this.meshData.vertexCount,0):(this.meshDataServer.fillMeshData(this.meshData,1,null),null==this.params.contactPair&&
this.meshDataServer.fillMeshData(this.meshData,2,null));var a=this.params.colorDensity||this.params.isBicolorMap||this.params.colorBySign||!this.params.colorByPhase;null!=this.params.contactPair&&(a=!1);this.jvxlData.isJvxlPrecisionColor=!0;this.jvxlData.vertexCount=0<this.contourVertexCount?this.contourVertexCount:this.meshData.vertexCount;this.jvxlData.minColorIndex=-1;this.jvxlData.maxColorIndex=0;this.jvxlData.contourValues=this.params.contoursDiscrete;this.jvxlData.isColorReversed=this.params.isColorReversed;
if(!this.params.colorDensity&&(this.params.isBicolorMap&&!this.params.isContoured||this.params.colorBySign))this.jvxlData.minColorIndex=J.util.C.getColixTranslucent3(J.util.C.getColix(this.params.isColorReversed?this.params.colorPos:this.params.colorNeg),0!=this.jvxlData.translucency,this.jvxlData.translucency),this.jvxlData.maxColorIndex=J.util.C.getColixTranslucent3(J.util.C.getColix(this.params.isColorReversed?this.params.colorNeg:this.params.colorPos),0!=this.jvxlData.translucency,this.jvxlData.translucency);
this.jvxlData.isTruncated=0<=this.jvxlData.minColorIndex&&!this.params.isContoured;if(!this.jvxlDataIs2dContour&&!this.hasColorData&&!this.vertexDataOnly&&!(this.params.colorDensity||this.params.isBicolorMap&&!this.params.isContoured)){this.haveSurfaceAtoms&&null==this.meshData.vertexSource&&(this.meshData.vertexSource=Clazz.newIntArray(this.meshData.vertexCount,0));var b=3.4028235E38,c=-3.4028235E38,d;this.initializeMapping();for(var e=this.meshData.vertexCount;--e>=this.meshData.mergeVertexCount0;){if(this.params.colorBySets)d=
this.meshData.vertexSets[e];else if(this.params.colorByPhase)d=this.getPhase(this.meshData.vertices[e]);else{var f=this.haveSurfaceAtoms;d=this.volumeData.lookupInterpolatedVoxelValue(this.meshData.vertices[e],f);f&&(this.meshData.vertexSource[e]=this.getSurfaceAtomIndex())}d<b&&(b=d);d>c&&3.4028235E38!=d&&(c=d);this.meshData.vertexValues[e]=d}this.params.rangeSelected&&null==this.minMax&&(this.minMax=[b,c]);this.finalizeMapping()}this.params.setMapRanges(this,!0);this.jvxlData.mappedDataMin=this.params.mappedDataMin;
this.jvxlData.mappedDataMax=this.params.mappedDataMax;this.jvxlData.valueMappedToRed=this.params.valueMappedToRed;this.jvxlData.valueMappedToBlue=this.params.valueMappedToBlue;null==this.params.contactPair&&null==this.jvxlData.vertexColors&&this.colorData();J.jvxl.data.JvxlCoder.jvxlCreateColorData(this.jvxlData,a?this.meshData.vertexValues:null);this.haveSurfaceAtoms&&null!=this.meshDataServer&&this.meshDataServer.fillMeshData(this.meshData,4,null);null!=this.meshDataServer&&this.params.colorBySets&&
this.meshDataServer.fillMeshData(this.meshData,3,null)});$_M(c$,"colorData",($fz=function(){var a=this.meshData.vertexValues,b=this.meshData.vertexColixes;this.meshData.polygonColixes=null;var c=this.jvxlData.valueMappedToBlue,d=this.jvxlData.valueMappedToRed,e=this.jvxlData.minColorIndex,f=this.jvxlData.maxColorIndex;null==this.params.colorEncoder&&(this.params.colorEncoder=new J.util.ColorEncoder(null));this.params.colorEncoder.setRange(this.params.valueMappedToRed,this.params.valueMappedToBlue,
this.params.isColorReversed);for(var g=this.meshData.vertexCount;0<=--g;){var h=a[g];0<=e?0>=h?b[g]=e:0<h&&(b[g]=f):(h<=d&&(h=d),h>=c&&(h=c),b[g]=this.params.colorEncoder.getColorIndex(h))}if((0<this.params.nContours||null!=this.jvxlData.contourValues)&&null==this.jvxlData.contourColixes){a=null==this.jvxlData.contourValues?this.params.nContours:this.jvxlData.contourValues.length;b=this.jvxlData.contourColixes=Clazz.newShortArray(a,0);e=this.jvxlData.contourValues;null==e&&(e=this.jvxlData.contourValuesUsed);
null==this.jvxlData.contourValuesUsed&&(this.jvxlData.contourValuesUsed=null==e?Clazz.newFloatArray(a,0):e);c=(c-d)/(a+1);this.params.colorEncoder.setRange(this.params.valueMappedToRed,this.params.valueMappedToBlue,this.params.isColorReversed);for(g=0;g<a;g++)f=null==e?d+(g+1)*c:e[g],this.jvxlData.contourValuesUsed[g]=f,b[g]=J.util.C.getColixTranslucent(this.params.colorEncoder.getArgb(f));this.jvxlData.contourColors=J.util.C.getHexCodes(b)}},$fz.isPrivate=!0,$fz));c$.getColorPhaseIndex=$_M(c$,"getColorPhaseIndex",
function(a){for(var b=-1,c=0;c<J.jvxl.readers.SurfaceReader.colorPhases.length;c++)if(a.equalsIgnoreCase(J.jvxl.readers.SurfaceReader.colorPhases[c])){b=c;break}return b},"~S");$_M(c$,"getPhase",($fz=function(a){switch(this.params.colorPhase){case 0:case -1:case 1:return 0<a.x?1:-1;case 2:return 0<a.y?1:-1;case 3:return 0<a.z?1:-1;case 4:return 0<a.x*a.y?1:-1;case 5:return 0<a.y*a.z?1:-1;case 6:return 0<a.x*a.z?1:-1;case 7:return 0<a.x*a.x-a.y*a.y?1:-1;case 8:return 0<2*a.z*a.z-a.x*a.x-a.y*a.y?1:
-1}return 1},$fz.isPrivate=!0,$fz),"J.util.P3");$_M(c$,"getMinMaxMappedValues",function(a){if(null!=this.minMax&&3.4028235E38!=this.minMax[0])return this.minMax;if(this.params.colorBySets)return this.minMax=[0,Math.max(this.meshData.nSets-1,0)];var b=3.4028235E38,c=-3.4028235E38;if(this.params.usePropertyForColorRange&&null!=this.params.theProperty){for(a=0;a<this.params.theProperty.length;a++)if(!this.params.rangeSelected||this.params.bsSelected.get(a)){var d=this.params.theProperty[a];Float.isNaN(d)||
(d<b&&(b=d),d>c&&(c=d))}return this.minMax=[b,c]}var d=0<this.contourVertexCount?this.contourVertexCount:this.meshData.vertexCount,e=this.meshData.vertices,f=a||this.jvxlDataIs2dContour||this.vertexDataOnly||this.params.colorDensity;for(a=this.meshData.mergeVertexCount0;a<d;a++){var g;g=f?this.meshData.vertexValues[a]:this.volumeData.lookupInterpolatedVoxelValue(e[a],!1);g<b&&(b=g);g>c&&3.4028235E38!=g&&(c=g)}return this.minMax=[b,c]},"~B");$_M(c$,"updateTriangles",function(){null==this.meshDataServer?
this.meshData.invalidatePolygons():this.meshDataServer.invalidateTriangles()});$_M(c$,"updateSurfaceData",function(){this.meshData.setVertexSets(!0);this.updateTriangles();null==this.params.bsExcluded[1]&&(this.params.bsExcluded[1]=new J.util.BS);this.meshData.updateInvalidatedVertices(this.params.bsExcluded[1])});$_M(c$,"selectPocket",function(){},"~B");$_M(c$,"excludeMinimumSet",function(){null!=this.meshDataServer&&this.meshDataServer.fillMeshData(this.meshData,1,null);this.meshData.getSurfaceSet();
for(var a,b=this.meshData.nSets;0<=--b;)null!=(a=this.meshData.surfaceSet[b])&&a.cardinality()<this.params.minSet&&this.meshData.invalidateSurfaceSet(b);this.updateSurfaceData();null!=this.meshDataServer&&this.meshDataServer.fillMeshData(this.meshData,3,null)});$_M(c$,"excludeMaximumSet",function(){null!=this.meshDataServer&&this.meshDataServer.fillMeshData(this.meshData,1,null);this.meshData.getSurfaceSet();for(var a,b=this.meshData.nSets;0<=--b;)null!=(a=this.meshData.surfaceSet[b])&&a.cardinality()>
this.params.maxSet&&this.meshData.invalidateSurfaceSet(b);this.updateSurfaceData();null!=this.meshDataServer&&this.meshDataServer.fillMeshData(this.meshData,3,null)});$_M(c$,"slabIsosurface",function(a){null!=this.meshDataServer&&this.meshDataServer.fillMeshData(this.meshData,1,null);this.meshData.slabPolygonsList(a,!0);null!=this.meshDataServer&&this.meshDataServer.fillMeshData(this.meshData,4,null)},"J.util.JmolList");$_M(c$,"setVertexAnisotropy",function(a){a.x*=this.anisotropy[0];a.y*=this.anisotropy[1];
a.z*=this.anisotropy[2];a.add(this.center)},"J.util.P3");$_M(c$,"setVectorAnisotropy",function(a){this.haveSetAnisotropy=!0;a.x*=this.anisotropy[0];a.y*=this.anisotropy[1];a.z*=this.anisotropy[2]},"J.util.V3");$_M(c$,"setVolumetricAnisotropy",function(){this.haveSetAnisotropy||(this.setVolumetricOriginAnisotropy(),this.setVectorAnisotropy(this.volumetricVectors[0]),this.setVectorAnisotropy(this.volumetricVectors[1]),this.setVectorAnisotropy(this.volumetricVectors[2]))});$_M(c$,"setVolumetricOriginAnisotropy",
function(){this.volumetricOrigin.setT(this.center)});$_M(c$,"setBBoxAll",($fz=function(){null!=this.meshDataServer&&this.meshDataServer.fillMeshData(this.meshData,1,null);this.xyzMin=null;for(var a=0;a<this.meshData.vertexCount;a++){var b=this.meshData.vertices[a];Float.isNaN(b.x)||this.setBBox(b,0)}},$fz.isPrivate=!0,$fz));$_M(c$,"setBBox",function(a,b){null==this.xyzMin&&(this.xyzMin=J.util.P3.new3(3.4028235E38,3.4028235E38,3.4028235E38),this.xyzMax=J.util.P3.new3(-3.4028235E38,-3.4028235E38,-3.4028235E38));
J.util.BoxInfo.addPoint(a,this.xyzMin,this.xyzMax,b)},"J.util.P3,~N");$_M(c$,"getValueAtPoint",function(){return 0},"J.util.P3,~B");$_M(c$,"initializeMapping",function(){});$_M(c$,"finalizeMapping",function(){});$_M(c$,"getSurfaceAtomIndex",function(){return-1});$_M(c$,"getSpanningVectors",function(){return null==this.volumeData?null:this.volumeData.getSpanningVectors()});Clazz.defineStatics(c$,"ANGSTROMS_PER_BOHR",0.5291772,"defaultMappedDataMin",0,"defaultMappedDataMax",1,"defaultCutoff",0.02,"colorPhases",
"_orb x y z xy yz xz x2-y2 z2".split(" "))});Clazz.declarePackage("J.jvxl.calc");
Clazz.load(["J.util.TriangleData","$.BS","$.P3","$.SB","$.V3"],"J.jvxl.calc.MarchingCubes",["java.lang.Float","J.jvxl.data.JvxlCoder"],function(){c$=Clazz.decorateAsClass(function(){this.volumeData=this.surfaceReader=null;this.contourType=0;this.isContoured=!1;this.cutoff=0;this.isXLowToHigh=this.isSquared=this.isCutoffAbsolute=!1;this.yzCount=this.nZ=this.nY=this.cubeCountZ=this.cubeCountY=this.cubeCountX=0;this.colorDensity=!1;this.integrateSquared=!0;this.edgeData=this.bsExcludedPlanes=this.bsExcludedTriangles=
this.bsExcludedVertices=this.bsVoxels=null;this.excludePartialCubes=!0;this.mode=0;this.vertexValues=null;this.edgeCount=0;this.mappingPlane=this.yzPlanes=this.isoPointIndexPlanes=this.edgePointIndexes=this.edgeVectors=this.voxelVertexVectors=null;this.$isInside=this.allInside=!1;this.voxelData=this.offset=null;this.nTriangles=0;this.linearOffsets=this.fReturn=this.edgeVertexPlanes=this.edgeVertexPointers=this.pointA=this.pt0=this.bsValues=null;Clazz.instantialize(this,arguments)},J.jvxl.calc,"MarchingCubes",
J.util.TriangleData);Clazz.prepareFields(c$,function(){this.edgeData=new J.util.SB;this.vertexValues=Clazz.newFloatArray(8,0);this.voxelVertexVectors=Array(8);this.edgeVectors=Array(12);for(var a=12;0<=--a;)this.edgeVectors[a]=new J.util.V3;this.edgePointIndexes=Clazz.newIntArray(12,0);this.bsValues=new J.util.BS;this.pt0=new J.util.P3;this.pointA=new J.util.P3;this.fReturn=Clazz.newFloatArray(1,0);this.linearOffsets=Clazz.newIntArray(8,0)});$_M(c$,"getBsVoxels",function(){return this.bsVoxels});
Clazz.makeConstructor(c$,function(){Clazz.superConstructor(this,J.jvxl.calc.MarchingCubes,[])});Clazz.makeConstructor(c$,function(a,b,c,d){Clazz.superConstructor(this,J.jvxl.calc.MarchingCubes,[]);this.excludePartialCubes=!0;this.surfaceReader=a;this.bsVoxels=d;a=c.bsExcluded;this.bsExcludedVertices=null==a[0]?a[0]=new J.util.BS:a[0];this.bsExcludedPlanes=null==a[2]?a[2]=new J.util.BS:a[2];this.bsExcludedTriangles=null==a[3]?a[3]=new J.util.BS:a[3];this.mode=null!=b.getVoxelData()||null!=b.mappingPlane?
1:null!=d?2:3;this.setParameters(b,c)},"J.jvxl.api.VertexDataServer,J.jvxl.data.VolumeData,J.jvxl.readers.Parameters,J.util.BS");$_M(c$,"setParameters",function(a,b){this.volumeData=a;this.colorDensity=b.colorDensity;this.isContoured=null==b.thePlane&&b.isContoured&&!this.colorDensity;this.cutoff=b.cutoff;this.isCutoffAbsolute=b.isCutoffAbsolute;this.contourType=b.contourType;this.isSquared=b.isSquared;this.isXLowToHigh=b.isXLowToHigh;this.cubeCountX=a.voxelCounts[0]-1;this.cubeCountY=a.voxelCounts[1]-
1;this.cubeCountZ=a.voxelCounts[2]-1;a.getYzCount();null!=b.mapLattice&&(this.cubeCountX*=Math.abs(b.mapLattice.x),this.cubeCountY*=Math.abs(b.mapLattice.y),this.cubeCountZ*=Math.abs(b.mapLattice.z));this.nY=this.cubeCountY+1;this.nZ=this.cubeCountZ+1;this.yzCount=this.nY*this.nZ;null==this.bsVoxels&&(this.bsVoxels=new J.util.BS);this.edgeVertexPointers=this.isXLowToHigh?J.jvxl.calc.MarchingCubes.edgeVertexPointersLowToHigh:J.jvxl.calc.MarchingCubes.edgeVertexPointersHighToLow;this.edgeVertexPlanes=
this.isXLowToHigh?J.jvxl.calc.MarchingCubes.edgeVertexPlanesLowToHigh:J.jvxl.calc.MarchingCubes.edgeVertexPlanesHighToLow;this.isoPointIndexPlanes=Clazz.newIntArray(2,this.yzCount,3,0);this.yzPlanes=3==this.mode?Clazz.newFloatArray(2,this.yzCount,0):null;this.setLinearOffsets();this.calcVoxelVertexVectors()},"J.jvxl.data.VolumeData,J.jvxl.readers.Parameters");$_M(c$,"calcVoxelVertexVectors",function(){for(var a=8;0<=--a;)this.volumeData.transform(J.jvxl.calc.MarchingCubes.cubeVertexVectors[a],this.voxelVertexVectors[a]=
new J.util.V3);for(a=12;0<=--a;)this.edgeVectors[a].sub2(this.voxelVertexVectors[J.util.TriangleData.edgeVertexes[a+a+1]],this.voxelVertexVectors[J.util.TriangleData.edgeVertexes[a+a]])});$_M(c$,"resetIndexPlane",function(a){for(var b=0;b<this.yzCount;b++)for(var c=0;3>c;c++)a[b][c]=-2147483648;return a},"~A");$_M(c$,"getEdgeData",function(){if(0>this.cubeCountX||0>this.cubeCountY||0>this.cubeCountZ)return"";this.mappingPlane=this.volumeData.mappingPlane;var a=0,b=0,c=0;this.edgeCount=0;var d,e,f,
g,h,j;this.isXLowToHigh?(d=0,this.colorDensity?(e=this.cubeCountX+1,j=this.yzCount-1):(e=this.cubeCountX,j=this.yzCount-1-this.nZ-1),f=1,g=this.yzCount):(this.colorDensity?(d=this.cubeCountX,j=(this.cubeCountX+1)*this.yzCount-1):(d=this.cubeCountX-1,j=this.cubeCountX*this.yzCount-1-this.nZ-1),f=e=-1,g=-this.yzCount);h=j;this.resetIndexPlane(this.isoPointIndexPlanes[1]);this.voxelData=null;var k=this.cubeCountY+(this.colorDensity?1:0),l=this.cubeCountZ+(this.colorDensity?1:0);switch(this.mode){case 3:this.getPlane(d,
!1);break;case 1:this.voxelData=this.volumeData.getVoxelData()}this.allInside=this.colorDensity&&(0==this.cutoff||2==this.mode&&0==this.bsVoxels.cardinality());for(var m=this.colorDensity&&0==this.cutoff,p=0;d!=e;d+=f,j+=g,h=j)if(3==this.mode&&d+f<=e&&this.getPlane(d+f,!0),!this.bsExcludedPlanes.get(d)||!this.bsExcludedPlanes.get(d+f))if(this.colorDensity)for(var n=k;0<=--n;)for(var q=l;0<=--q;h--)p=this.getValue(d,n,q,h,0),(m||this.$isInside)&&this.addVertex(d,n,q,h,p);else{n=this.isoPointIndexPlanes[0];
this.isoPointIndexPlanes[0]=this.isoPointIndexPlanes[1];this.isoPointIndexPlanes[1]=this.resetIndexPlane(n);for(var r=!0,n=k;0<=--n;h--)for(q=l;0<=--q;h--){for(var t=0,u=8;0<=--u;)p=this.getValue(d,n,q,h,u),this.$isInside&&(t|=J.util.TriangleData.Pwr2[u]);r&&!Float.isNaN(p)&&(r=!1);0==t?++b:255==t?++a:(++c,this.processOneCubical(t,d,n,q,h)&&(!this.isContoured&&!this.colorDensity)&&this.processTriangles(t))}r&&this.bsExcludedPlanes.set(d)}return this.edgeData.toString()});$_M(c$,"getValue",($fz=function(a,
b,c,d,e){this.offset=J.util.TriangleData.cubeVertexOffsets[e];d+=this.linearOffsets[e];switch(this.mode){case 3:a=this.vertexValues[e]=this.getValueArray(a+this.offset.x,b+this.offset.y,c+this.offset.z,d,this.yzPlanes[J.jvxl.calc.MarchingCubes.yzPlanePts[e]]);this.$isInside=this.allInside||this.bsVoxels.get(d);break;case 2:this.$isInside=this.allInside||this.bsVoxels.get(d);a=this.vertexValues[e]=this.bsExcludedVertices.get(d)?NaN:this.$isInside?1:0;break;default:case 1:null==this.mappingPlane?a=
this.vertexValues[e]=this.voxelData[a+this.offset.x][b+this.offset.y][c+this.offset.z]:(this.volumeData.voxelPtToXYZ(a+this.offset.x,b+this.offset.y,c+this.offset.z,this.pt0),a=this.vertexValues[e]=this.volumeData.distanceToMappingPlane(this.pt0)),this.isSquared&&(this.vertexValues[e]*=this.vertexValues[e]),(this.$isInside=this.allInside?!0:J.jvxl.calc.MarchingCubes.isInside(this.vertexValues[e],this.cutoff,this.isCutoffAbsolute))&&this.bsVoxels.set(d)}return a},$fz.isPrivate=!0,$fz),"~N,~N,~N,~N,~N");
$_M(c$,"getPlane",($fz=function(a,b){if(!(0>a||a>this.cubeCountX))if(this.surfaceReader.getPlane(a),b){var c=this.yzPlanes[0];this.yzPlanes[0]=this.yzPlanes[1];this.yzPlanes[1]=c}},$fz.isPrivate=!0,$fz),"~N,~B");$_M(c$,"processTriangles",function(a){a=J.util.TriangleData.triangleTable2[a];for(var b=a.length;0<=(b-=4);)this.addTriangle(a[b],a[b+1],a[b+2],a[b+3])},"~N");$_M(c$,"addVertex",function(a,b,c,d,e){this.volumeData.voxelPtToXYZ(a,b,c,this.pt0);0>this.surfaceReader.addVertexCopy(this.pt0,e,
-4)&&this.bsExcludedVertices.set(d)},"~N,~N,~N,~N,~N");$_M(c$,"addTriangle",function(a,b,c,d){!this.bsExcludedTriangles.get(this.nTriangles)&&0>this.surfaceReader.addTriangleCheck(this.edgePointIndexes[a],this.edgePointIndexes[b],this.edgePointIndexes[c],d,0,this.isCutoffAbsolute,0)&&this.bsExcludedTriangles.set(this.nTriangles);this.nTriangles++},"~N,~N,~N,~N");$_M(c$,"getValueArray",function(a,b,c,d,e){var f=d%this.yzCount;this.bsValues.set(d);a=this.surfaceReader.getValue(a,b,c,f);this.isSquared&&
(a*=a);e[f]=a;J.jvxl.calc.MarchingCubes.isInside(a,this.cutoff,this.isCutoffAbsolute)&&this.bsVoxels.set(d);return a},"~N,~N,~N,~N,~A");c$.isInside=$_M(c$,"isInside",function(a,b,c){return 0<b&&(c?Math.abs(a):a)>=b||0>=b&&a<=b},"~N,~N,~B");$_M(c$,"processOneCubical",function(a,b,c,d,e){a=J.jvxl.calc.MarchingCubes.insideMaskTable[a];for(var f=!1,g=12;0<=--g;)if(0!=(a&J.util.TriangleData.Pwr2[g])){var h=this.edgeVertexPlanes[g],j=(e+this.linearOffsets[this.edgeVertexPointers[g]])%this.yzCount,k=J.jvxl.calc.MarchingCubes.edgeTypeTable[g],
l=this.edgePointIndexes[g]=this.isoPointIndexPlanes[h][j][k];if(-2147483648!=l)-1==l&&(f=this.excludePartialCubes);else{var l=J.util.TriangleData.edgeVertexes[g<<1],m=J.util.TriangleData.edgeVertexes[(g<<1)+1],p=this.vertexValues[l],n=this.vertexValues[m];this.calcVertexPoint(b,c,d,l,this.pointA);this.edgeCount++;h=this.edgePointIndexes[g]=this.isoPointIndexPlanes[h][j][k]=this.surfaceReader.getSurfacePointIndexAndFraction(this.cutoff,this.isCutoffAbsolute,b,c,d,J.util.TriangleData.cubeVertexOffsets[l],
l,m,p,n,this.pointA,this.edgeVectors[g],k==this.contourType,this.fReturn);this.addEdgeData(0>h?NaN:this.fReturn[0]);if(Float.isNaN(this.fReturn[0])||0>h)f=this.excludePartialCubes}}return!f},"~N,~N,~N,~N,~N");$_M(c$,"addEdgeData",function(a){a=J.jvxl.data.JvxlCoder.jvxlFractionAsCharacter(a);this.edgeData.appendC(a)},"~N");$_M(c$,"calcVertexPoint",function(a,b,c,d,e){this.volumeData.voxelPtToXYZ(a,b,c,this.pt0);e.add2(this.pt0,this.voxelVertexVectors[d])},"~N,~N,~N,~N,J.util.P3");$_M(c$,"setLinearOffsets",
function(){this.linearOffsets[0]=0;this.linearOffsets[1]=this.yzCount;this.linearOffsets[2]=this.yzCount+1;this.linearOffsets[3]=1;this.linearOffsets[4]=this.nZ;this.linearOffsets[5]=this.yzCount+this.nZ;this.linearOffsets[6]=this.yzCount+this.nZ+1;this.linearOffsets[7]=this.nZ+1});$_M(c$,"getLinearOffset",function(a,b,c,d){return a*this.yzCount+b*this.nZ+c+this.linearOffsets[d]},"~N,~N,~N,~N");Clazz.defineStatics(c$,"MODE_CUBE",1,"MODE_JVXL",2,"MODE_PLANES",3);Clazz.defineStatics(c$,"yzPlanePts",
[0,1,1,0,0,1,1,0],"edgeVertexPointersLowToHigh",[1,1,2,0,5,5,6,4,0,1,2,3],"edgeVertexPointersHighToLow",[0,1,3,0,4,5,7,4,0,1,2,3],"edgeVertexPlanesLowToHigh",[1,1,1,0,1,1,1,0,0,1,1,0],"edgeVertexPlanesHighToLow",[1,0,1,1,1,0,1,1,1,0,0,1]);c$.cubeVertexVectors=c$.prototype.cubeVertexVectors=[J.util.V3.new3(0,0,0),J.util.V3.new3(1,0,0),J.util.V3.new3(1,0,1),J.util.V3.new3(0,0,1),J.util.V3.new3(0,1,0),J.util.V3.new3(1,1,0),J.util.V3.new3(1,1,1),J.util.V3.new3(0,1,1)];Clazz.defineStatics(c$,"edgeTypeTable",
[0,2,0,2,0,2,0,2,1,1,1,1],"insideMaskTable",[0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,
1881,1107,1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,
1958,170,419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0])});Clazz.declarePackage("J.jvxl.calc");
Clazz.load(["J.util.P3","java.util.Hashtable"],"J.jvxl.calc.MarchingSquares",["java.lang.Float","J.util.ArrayUtil","$.Logger"],function(){c$=Clazz.decorateAsClass(function(){this.volumeData=this.surfaceReader=null;this.valueMax=this.valueMin=this.thisContour=this.contourType=this.nContourSegments=0;this.pointB=this.pointA=null;this.contourFromZero=!0;this.contoursDiscrete=null;this.contourVertexCount=0;this.contourVertexes=null;this.contourPlaneMaximumValue=this.contourPlaneMinimumValue=0;this.ptTemp=
this.contourValuesUsed=null;this.triangleCount=0;this.htPts=this.triangles=null;Clazz.isClassDefined("J.jvxl.calc.MarchingSquares.Triangle")||J.jvxl.calc.MarchingSquares.$MarchingSquares$Triangle$();Clazz.instantialize(this,arguments)},J.jvxl.calc,"MarchingSquares");Clazz.prepareFields(c$,function(){this.pointA=new J.util.P3;this.pointB=new J.util.P3;this.contourVertexes=Array(1E3);this.ptTemp=new J.util.P3;this.triangles=Array(1E3);this.htPts=new java.util.Hashtable});Clazz.makeConstructor(c$,function(a,
b,c,d,e,f,g){this.surfaceReader=a;this.volumeData=b;this.thisContour=f;this.contoursDiscrete=d;this.contourFromZero=g;null==d?(this.nContourSegments=(0==e?9:e)+0,100<this.nContourSegments&&(this.nContourSegments=100)):(this.nContourSegments=e=d.length,this.contourFromZero=!1)},"J.jvxl.api.VertexDataServer,J.jvxl.data.VolumeData,J.util.P4,~A,~N,~N,~B");$_M(c$,"getContourType",function(){return this.contourType});$_M(c$,"setMinMax",function(a,b){this.valueMin=a;this.valueMax=b},"~N,~N");$_M(c$,"addContourVertex",
function(a,b){this.contourVertexCount==this.contourVertexes.length&&(this.contourVertexes=J.util.ArrayUtil.doubleLength(this.contourVertexes));var c=this.surfaceReader.addVertexCopy(a,b,-2);this.contourVertexes[this.contourVertexCount++]=new J.jvxl.calc.MarchingSquares.ContourVertex(a);return c},"J.util.P3,~N");$_M(c$,"setContourData",function(a,b){this.contourVertexes[a].setValue(b)},"~N,~N");$_M(c$,"getContourValues",function(){return this.contourValuesUsed});$_M(c$,"calcContourPoint",function(a,
b,c,d){return this.volumeData.calculateFractionalPoint(a,this.pointA,this.pointB,b,c,d)},"~N,~N,~N,J.util.P3");$_M(c$,"addTriangle",function(a,b,c,d,e){this.triangleCount==this.triangles.length&&(this.triangles=J.util.ArrayUtil.doubleLength(this.triangles));this.triangles[this.triangleCount++]=Clazz.innerTypeInstance(J.jvxl.calc.MarchingSquares.Triangle,this,null,a,b,c,d,e);return 0},"~N,~N,~N,~N,~N");$_M(c$,"generateContourData",function(a,b){J.util.Logger.info("generateContours: "+this.nContourSegments+
" segments");this.getVertexValues(a);this.createContours(this.valueMin,this.valueMax,b);this.addAllTriangles();return this.contourVertexCount},"~B,~N");$_M(c$,"getVertexValues",($fz=function(a){this.contourPlaneMinimumValue=3.4028235E38;this.contourPlaneMaximumValue=-3.4028235E38;for(var b=0;b<this.contourVertexCount;b++){var c=this.contourVertexes[b],d;a?d=c.value:(d=this.volumeData.lookupInterpolatedVoxelValue(c,!1),c.setValue(d));d<this.contourPlaneMinimumValue&&(this.contourPlaneMinimumValue=
d);d>this.contourPlaneMaximumValue&&(this.contourPlaneMaximumValue=d)}},$fz.isPrivate=!0,$fz),"~B");$_M(c$,"createContours",($fz=function(a,b,c){b-=a;this.contourValuesUsed=Clazz.newFloatArray(this.nContourSegments,0);for(var d=this.triangleCount;0<=--d;)this.triangles[d].check=0;for(var e=-3.4028235E38,d=0;d<this.nContourSegments;d++){e=null!=this.contoursDiscrete?this.contoursDiscrete[d]:this.contourFromZero?a+1*d/this.nContourSegments*b:0==d?-3.4028235E38:d==this.nContourSegments-1?3.4028235E38:
a+1*(d-1)/(this.nContourSegments-1)*b;null==this.contoursDiscrete&&Math.abs(e)<c&&(e=0>e?-c:c);this.contourValuesUsed[d]=e;J.util.Logger.info("#contour "+(d+1)+" "+e);var f=0;this.htPts.clear();for(var g=this.triangleCount;0<=--g;)this.triangles[g].isValid?this.triangles[g].checkContour(d,e):f++}this.valueMin=this.contourValuesUsed[0];this.valueMax=0==this.contourValuesUsed.length?this.valueMin:this.contourValuesUsed[this.contourValuesUsed.length-1];return!0},$fz.isPrivate=!0,$fz),"~N,~N,~N");$_M(c$,
"getMinMax",function(){return[this.valueMin,this.valueMax]});$_M(c$,"addAllTriangles",($fz=function(){for(var a=0;a<this.triangleCount;a++)if(this.triangles[a].isValid){var b=this.triangles[a];this.surfaceReader.addTriangleCheck(b.pts[0],b.pts[1],b.pts[2],b.check,b.contourIndex,!1,-1)}},$fz.isPrivate=!0,$fz));c$.$MarchingSquares$Triangle$=function(){Clazz.pu$h();c$=Clazz.decorateAsClass(function(){Clazz.prepareCallback(this,arguments);this.pts=null;this.check=0;this.isValid=!0;this.contourIndex=0;
Clazz.instantialize(this,arguments)},J.jvxl.calc.MarchingSquares,"Triangle");Clazz.makeConstructor(c$,function(a,b,c,d,e){this.pts=[a,b,c];this.check=d;this.contourIndex=e},"~N,~N,~N,~N,~N");$_M(c$,"intercept",($fz=function(a,b){var c=this.pts[a],d=this.pts[(a+1)%3];if(2147483647==c||2147483647==d)return-1;var e=c<d?c+"_"+d:d+"_"+c;if(this.b$["J.jvxl.calc.MarchingSquares"].htPts.containsKey(e))return this.b$["J.jvxl.calc.MarchingSquares"].htPts.get(e).intValue();var f=this.b$["J.jvxl.calc.MarchingSquares"].contourVertexes[c].value,
g=this.b$["J.jvxl.calc.MarchingSquares"].contourVertexes[d].value,h=-1;if(f!=g){var j=(b-f)/(g-f);if(0<=j&&1>=j&&(this.b$["J.jvxl.calc.MarchingSquares"].pointA.setT(this.b$["J.jvxl.calc.MarchingSquares"].contourVertexes[c]),this.b$["J.jvxl.calc.MarchingSquares"].pointB.setT(this.b$["J.jvxl.calc.MarchingSquares"].contourVertexes[d]),b=this.b$["J.jvxl.calc.MarchingSquares"].calcContourPoint(b,f,g,this.b$["J.jvxl.calc.MarchingSquares"].ptTemp),!Float.isNaN(b))){h=this.b$["J.jvxl.calc.MarchingSquares"].addContourVertex(this.b$["J.jvxl.calc.MarchingSquares"].ptTemp,
b);if(0>h)return-1;this.b$["J.jvxl.calc.MarchingSquares"].contourVertexes[h].setValue(b)}}this.b$["J.jvxl.calc.MarchingSquares"].htPts.put(e,Integer.$valueOf(h));return h},$fz.isPrivate=!0,$fz),"~N,~N");$_M(c$,"checkContour",function(a,b){var c=this.intercept(0,b),d=this.intercept(1,b),e=this.intercept(2,b),f=0;0<=c&&(f+=1);0<=d&&(f+=2);0<=e&&(f+=4);switch(f){case 3:this.b$["J.jvxl.calc.MarchingSquares"].addTriangle(this.pts[0],c,d,2|this.check&1,a);this.b$["J.jvxl.calc.MarchingSquares"].addTriangle(c,
this.pts[1],d,4|this.check&3,a);this.b$["J.jvxl.calc.MarchingSquares"].addTriangle(this.pts[0],d,this.pts[2],this.check&6,a);break;case 5:this.b$["J.jvxl.calc.MarchingSquares"].addTriangle(this.pts[0],c,e,2|this.check&5,a);this.b$["J.jvxl.calc.MarchingSquares"].addTriangle(c,this.pts[1],e,4|this.check&1,a);this.b$["J.jvxl.calc.MarchingSquares"].addTriangle(e,this.pts[1],this.pts[2],this.check&6,a);break;case 6:this.b$["J.jvxl.calc.MarchingSquares"].addTriangle(this.pts[0],this.pts[1],e,this.check&
5,a);this.b$["J.jvxl.calc.MarchingSquares"].addTriangle(e,this.pts[1],d,4|this.check&2,a);this.b$["J.jvxl.calc.MarchingSquares"].addTriangle(e,d,this.pts[2],1|this.check&6,a);break;default:return}this.isValid=!1},"~N,~N");c$=Clazz.p0p()};Clazz.pu$h();c$=Clazz.decorateAsClass(function(){this.value=0;Clazz.instantialize(this,arguments)},J.jvxl.calc.MarchingSquares,"ContourVertex",J.util.P3);Clazz.makeConstructor(c$,function(a){Clazz.superConstructor(this,J.jvxl.calc.MarchingSquares.ContourVertex,[]);
this.setT(a)},"J.util.P3");$_M(c$,"setValue",function(a){this.value=a},"~N");c$=Clazz.p0p();Clazz.defineStatics(c$,"CONTOUR_POINT",-1,"VERTEX_POINT",-2,"EDGE_POINT",-3,"nContourMax",100,"defaultContourCount",9)});Clazz.declarePackage("J.shapesurface");
Clazz.load(["J.shape.Mesh","J.jvxl.data.JvxlData"],"J.shapesurface.IsosurfaceMesh","java.lang.Character $.Float java.util.Hashtable J.api.Interface J.jvxl.data.JvxlCoder J.script.T J.util.ArrayUtil $.BS $.BSUtil $.BoxInfo $.C $.ColorEncoder $.ColorUtil $.Escape $.JmolList $.Logger $.Matrix4f $.Measure $.P3 $.P4 $.Parser $.SB $.V3 J.viewer.Viewer".split(" "),function(){c$=Clazz.decorateAsClass(function(){this.jvxlData=null;this.vertexIncrement=1;this.firstRealVertex=-1;this.dataType=0;this.hasGridPoints=
!1;this.assocGridPointNormals=this.assocGridPointMap=this.info=this.calculatedVolume=this.calculatedArea=null;this.mergeAssociatedNormalCount=0;this.colorEncoder=this.contourColixes=this.contourValues=this.centers=null;this.volumeRenderPointSize=0.15;this.bsVdw=null;this.colorPhased=!1;Clazz.instantialize(this,arguments)},J.shapesurface,"IsosurfaceMesh",J.shape.Mesh);Clazz.prepareFields(c$,function(){this.jvxlData=new J.jvxl.data.JvxlData});Clazz.makeConstructor(c$,function(a,b,c){Clazz.superConstructor(this,
J.shapesurface.IsosurfaceMesh,[]);this.mesh1(a,b,c);this.checkByteCount=2;this.jvxlData.version=J.viewer.Viewer.getJmolVersion()},"~S,~N,~N");$_M(c$,"clearType",function(a,b){this.clear(a);this.jvxlData.clear();this.colorEncoder=this.centers=this.calculatedArea=this.calculatedVolume=this.bsVdw=this.assocGridPointNormals=this.assocGridPointMap=null;this.colorPhased=!1;this.firstRealVertex=-1;this.hasGridPoints=b;this.isColorSolid=!0;this.nSets=this.mergeAssociatedNormalCount=0;this.polygonColixes=
null;this.showPoints=b;this.vertexColorMap=this.vertexColixes=this.surfaceSet=null;this.vertexIncrement=1;this.vertexValues=this.vertexSets=null;this.volumeRenderPointSize=0.15},"~S,~B");$_M(c$,"allocVertexColixes",function(){if(null==this.vertexColixes){this.vertexColixes=Clazz.newShortArray(this.vertexCount,0);for(var a=this.vertexCount;0<=--a;)this.vertexColixes[a]=this.colix}this.isColorSolid=!1});$_M(c$,"addVertexCopy",function(a,b,c,d){a=this.addVCVal(a,b);switch(c){case -1:0>this.firstRealVertex&&
(this.firstRealVertex=a);break;case -2:this.hasGridPoints=!0;break;case -3:this.vertexIncrement=3;break;default:0>this.firstRealVertex&&(this.firstRealVertex=a),d&&(null==this.assocGridPointMap&&(this.assocGridPointMap=new java.util.Hashtable),this.assocGridPointMap.put(Integer.$valueOf(a),Integer.$valueOf(c+this.mergeAssociatedNormalCount)))}return a},"J.util.P3,~N,~N,~B");Clazz.overrideMethod(c$,"setTranslucent",function(a,b){this.colix=J.util.C.getColixTranslucent3(this.colix,a,b);if(null!=this.vertexColixes)for(var c=
this.vertexCount;0<=--c;)this.vertexColixes[c]=J.util.C.getColixTranslucent3(this.vertexColixes[c],a,b)},"~B,~N");$_M(c$,"setMerged",function(a){this.mergePolygonCount0=(this.isMerged=a)?this.polygonCount:0;this.mergeVertexCount0=a?this.vertexCount:0;a&&(this.mergeAssociatedNormalCount+=this.jvxlData.nPointsX*this.jvxlData.nPointsY*this.jvxlData.nPointsZ,this.assocGridPointNormals=null)},"~B");Clazz.overrideMethod(c$,"sumVertexNormals",function(a,b){this.sumVertexNormals2(a,b);if(null!=this.assocGridPointMap&&
0<b.length&&!this.isMerged){null==this.assocGridPointNormals&&(this.assocGridPointNormals=new java.util.Hashtable);for(var c,d=this.assocGridPointMap.entrySet().iterator();d.hasNext()&&((c=d.next())||1);){var e=c.getValue();this.assocGridPointNormals.containsKey(e)||this.assocGridPointNormals.put(e,J.util.V3.new3(0,0,0));this.assocGridPointNormals.get(e).add(b[c.getKey().intValue()])}for(d=this.assocGridPointMap.entrySet().iterator();d.hasNext()&&((c=d.next())||1);)b[c.getKey().intValue()]=this.assocGridPointNormals.get(c.getValue())}},
"~A,~A");$_M(c$,"getCenters",function(){if(null!=this.centers)return this.centers;this.centers=Array(this.polygonCount);for(var a=0;a<this.polygonCount;a++){var b=this.polygonIndexes[a];if(null!=b){var c=this.centers[a]=new J.util.P3;c.add(this.vertices[b[0]]);c.add(this.vertices[b[1]]);c.add(this.vertices[b[2]]);c.scale(0.33333334)}}return this.centers});$_M(c$,"getFacePlane",function(a,b){var c=new J.util.P4;J.util.Measure.getPlaneThroughPoints(this.vertices[this.polygonIndexes[a][0]],this.vertices[this.polygonIndexes[a][1]],
this.vertices[this.polygonIndexes[a][2]],b,this.vAB,this.vAC,c);return c},"~N,J.util.V3");$_M(c$,"getContours",function(){var a=this.jvxlData.nContours;if(0==a||null==this.polygonIndexes||(this.havePlanarContours=null!=this.jvxlData.jvxlPlane))return null;0>a&&(a=-1-a);var b=this.jvxlData.vContours;if(null!=b){for(var c=0;c<a&&!(6<b[c].size());c++)J.jvxl.data.JvxlCoder.set3dContourVector(b[c],this.polygonIndexes,this.vertices);return this.jvxlData.vContours}b=Array(a);for(c=0;c<a;c++)b[c]=new J.util.JmolList;
if(null==this.jvxlData.contourValuesUsed){for(var d=(this.jvxlData.valueMappedToBlue-this.jvxlData.valueMappedToRed)/(a+1),c=0;c<a;c++){var e=this.jvxlData.valueMappedToRed+(c+1)*d;this.get3dContour(b[c],e,this.jvxlData.contourColixes[c])}J.util.Logger.info(a+" contour lines; separation = "+d)}else for(c=0;c<a;c++)e=this.jvxlData.contourValuesUsed[c],this.get3dContour(b[c],e,this.jvxlData.contourColixes[c]);this.jvxlData.contourColixes=Clazz.newShortArray(a,0);this.jvxlData.contourValues=Clazz.newFloatArray(a,
0);for(c=0;c<a;c++)this.jvxlData.contourValues[c]=b[c].get(2).floatValue(),this.jvxlData.contourColixes[c]=b[c].get(3)[0];return this.jvxlData.vContours=b});$_M(c$,"get3dContour",($fz=function(a,b,c){var d=J.util.BSUtil.newBitSet(this.polygonCount),e=new J.util.SB,f=J.util.C.getArgb(c);J.shapesurface.IsosurfaceMesh.setContourVector(a,this.polygonCount,d,b,c,f,e);for(c=0;c<this.polygonCount;c++)this.setABC(c)&&J.shapesurface.IsosurfaceMesh.addContourPoints(a,d,c,e,this.vertices,this.vertexValues,this.iA,
this.iB,this.iC,b)},$fz.isPrivate=!0,$fz),"J.util.JmolList,~N,~N");c$.setContourVector=$_M(c$,"setContourVector",function(a,b,c,d,e,f,g){a.add(0,Integer.$valueOf(b));a.add(1,c);a.add(2,Float.$valueOf(d));a.add(3,[e]);a.add(4,[f]);a.add(5,g)},"J.util.JmolList,~N,J.util.BS,~N,~N,~N,J.util.SB");c$.addContourPoints=$_M(c$,"addContourPoints",function(a,b,c,d,e,f,g,h,j,k){var l=null,m=null,p=0,n=J.shapesurface.IsosurfaceMesh.checkPt(f,g,h,k);Float.isNaN(n)||(l=J.shapesurface.IsosurfaceMesh.getContourPoint(e,
g,h,n),p|=1);var q=1==n?NaN:J.shapesurface.IsosurfaceMesh.checkPt(f,h,j,k);Float.isNaN(q)||(m=J.shapesurface.IsosurfaceMesh.getContourPoint(e,h,j,q),0==p&&(l=m,n=q),p|=2);switch(p){case 0:return;case 1:if(0==n)return;case 2:q=1==q?NaN:J.shapesurface.IsosurfaceMesh.checkPt(f,j,g,k),Float.isNaN(q)||(m=J.shapesurface.IsosurfaceMesh.getContourPoint(e,j,g,q),p|=4)}switch(p){case 3:case 5:case 6:break;default:return}b.set(c);J.jvxl.data.JvxlCoder.appendContourTriangleIntersection(p,n,q,d);a.addLast(l);
a.addLast(m)},"J.util.JmolList,J.util.BS,~N,J.util.SB,~A,~A,~N,~N,~N,~N");c$.checkPt=$_M(c$,"checkPt",($fz=function(a,b,c,d){var e,f;return d==(e=a[b])?0:d==(f=a[c])?1:e<d==d<f?(d-e)/(f-e):NaN},$fz.isPrivate=!0,$fz),"~A,~N,~N,~N");c$.getContourPoint=$_M(c$,"getContourPoint",($fz=function(a,b,c,d){var e=new J.util.P3;e.setT(a[c]);e.sub(a[b]);e.scale(d);e.add(a[b]);return e},$fz.isPrivate=!0,$fz),"~A,~N,~N,~N");$_M(c$,"setDiscreteColixes",function(a,b){null!=a&&(this.jvxlData.contourValues=a);if(null==
a||0==a.length)a=this.jvxlData.contourValues=this.jvxlData.contourValuesUsed;null==b&&null!=this.jvxlData.contourColixes?b=this.jvxlData.contourColixes:(this.jvxlData.contourColixes=b,this.jvxlData.contourColors=J.util.C.getHexCodes(b));if(!(null==this.vertices||null==this.vertexValues||null==a)){var c=a.length,d=a[c-1];this.colorCommand=null;var e=null!=b&&0<b.length;this.isColorSolid=e&&null!=this.jvxlData.jvxlPlane;if(null!=this.jvxlData.vContours){if(e)for(var f=0;f<this.jvxlData.vContours.length;f++)c=
b[f%b.length],this.jvxlData.vContours[f].get(3)[0]=c,this.jvxlData.vContours[f].get(4)[0]=J.util.C.getArgb(c)}else{this.polygonColixes=Clazz.newShortArray(this.polygonCount,0);for(f=0;f<this.polygonCount;f++){var g=this.polygonIndexes[f];if(null!=g){this.polygonColixes[f]=0;for(var g=(this.vertexValues[g[0]]+this.vertexValues[g[1]]+this.vertexValues[g[2]])/3,h=c;0<=--h;)if(g>=a[h]&&g<d){this.polygonColixes[f]=e?b[h%b.length]:0;break}}}}}},"~A,~A");$_M(c$,"getContourList",function(){var a=new java.util.Hashtable;
a.put("values",null==this.jvxlData.contourValuesUsed?this.jvxlData.contourValues:this.jvxlData.contourValuesUsed);var b=new J.util.JmolList;if(null!=this.jvxlData.contourColixes){for(var c=0;c<this.jvxlData.contourColixes.length;c++)b.addLast(J.util.ColorUtil.colorPointFromInt2(J.util.C.getArgb(this.jvxlData.contourColixes[c])));a.put("colors",b)}return a},"J.viewer.Viewer");$_M(c$,"deleteContours",function(){this.jvxlData.contourValuesUsed=null;this.jvxlData.contourValues=null;this.jvxlData.contourColixes=
null;this.jvxlData.vContours=null});$_M(c$,"colorAtoms",function(a,b){this.colorVertices2(a,b,!0)},"~N,J.util.BS");$_M(c$,"colorVertices",function(a,b){this.colorVertices2(a,b,!1)},"~N,J.util.BS");$_M(c$,"colorVertices2",($fz=function(a,b,c){if(null!=this.vertexSource){a=J.util.C.copyColixTranslucency(this.colix,a);var d=c?new J.util.BS:b;if(null==this.vertexColixes||null==this.vertexColorMap&&this.isColorSolid){this.vertexColixes=Clazz.newShortArray(this.vertexCount,0);for(var e=0;e<this.vertexCount;e++)this.vertexColixes[e]=
this.colix}this.isColorSolid=!1;if(c)for(e=0;e<this.vertexCount;e++)b.get(this.vertexSource[e])&&(this.vertexColixes[e]=a,d.set(e));else for(e=0;e<this.vertexCount;e++)d.get(e)&&(this.vertexColixes[e]=a);c&&(a=J.util.C.getHexCode(a),null==this.vertexColorMap&&(this.vertexColorMap=new java.util.Hashtable),J.shapesurface.IsosurfaceMesh.addColorToMap(this.vertexColorMap,a,b))}},$fz.isPrivate=!0,$fz),"~N,J.util.BS,~B");c$.addColorToMap=$_M(c$,"addColorToMap",($fz=function(a,b,c){for(var d=null,e,f=a.entrySet().iterator();f.hasNext()&&
((e=f.next())||1);)e.getKey()===b?(d=e.getValue(),d.or(c)):e.getValue().andNot(c);null==d&&a.put(b,c)},$fz.isPrivate=!0,$fz),"java.util.Map,~S,J.util.BS");$_M(c$,"setJvxlColorMap",function(a){this.jvxlData.diameter=this.diameter;this.jvxlData.color=J.util.C.getHexCode(this.colix);this.jvxlData.meshColor=0==this.meshColix?null:J.util.C.getHexCode(this.meshColix);this.jvxlData.translucency=J.util.C.getColixTranslucencyFractional(this.colix);this.jvxlData.rendering=this.getRendering().substring(1);this.jvxlData.colorScheme=
null==this.colorEncoder?null:this.colorEncoder.getColorScheme();null==this.jvxlData.vertexColors&&(this.jvxlData.nVertexColors=null==this.vertexColorMap?0:this.vertexColorMap.size());if(!(null==this.vertexColorMap||null==this.vertexSource||!a)){null==this.jvxlData.vertexColorMap&&(this.jvxlData.vertexColorMap=new java.util.Hashtable);var b;for(a=this.vertexColorMap.entrySet().iterator();a.hasNext()&&((b=a.next())||1);){var c=b.getValue();if(!c.isEmpty()){for(var d=b.getKey(),e=new J.util.BS,f=0;f<
this.vertexCount;f++)c.get(this.vertexSource[f])&&e.set(f);J.shapesurface.IsosurfaceMesh.addColorToMap(this.jvxlData.vertexColorMap,d,e)}}this.jvxlData.nVertexColors=this.jvxlData.vertexColorMap.size();0==this.jvxlData.vertexColorMap.size()&&(this.jvxlData.vertexColorMap=null)}},"~B");$_M(c$,"setColorCommand",function(){null!=this.colorEncoder&&(this.colorCommand=this.colorEncoder.getColorScheme(),this.colorCommand.equals("inherit")?this.colorCommand="#inherit;":null!=this.colorCommand&&(this.colorCommand=
"color $"+(Character.isLetter(this.thisID.charAt(0))&&0>this.thisID.indexOf(" ")?this.thisID:'"'+this.thisID+'"')+' "'+this.colorCommand+'" range '+(this.jvxlData.isColorReversed?this.jvxlData.valueMappedToBlue+" "+this.jvxlData.valueMappedToRed:this.jvxlData.valueMappedToRed+" "+this.jvxlData.valueMappedToBlue)))});$_M(c$,"setColorsFromJvxlData",function(a){this.diameter=this.jvxlData.diameter;-1!=a&&(-2147483648!=a?this.colix=J.util.C.getColix(a):null!=this.jvxlData.color&&(this.colix=J.util.C.getColixS(this.jvxlData.color)));
0==this.colix&&(this.colix=5);this.colix=J.util.C.getColixTranslucent3(this.colix,0!=this.jvxlData.translucency,this.jvxlData.translucency);null!=this.jvxlData.meshColor&&(this.meshColix=J.util.C.getColixS(this.jvxlData.meshColor));this.setJvxlDataRendering();this.isColorSolid=!this.jvxlData.isBicolorMap&&null==this.jvxlData.vertexColors;if(null!=this.colorEncoder){if(null!=this.jvxlData.colorScheme){a=this.jvxlData.colorScheme;var b=a.startsWith("translucent ");b&&(a=a.substring(12));this.colorEncoder.setColorScheme(a,
b);this.remapColors(null,null,NaN)}if(null!=this.jvxlData.vertexColorMap){var c;for(a=this.jvxlData.vertexColorMap.entrySet().iterator();a.hasNext()&&((c=a.next())||1);)for(var b=c.getValue(),d=J.util.C.copyColixTranslucency(this.colix,J.util.C.getColixS(c.getKey())),e=b.nextSetBit(0);0<=e;e=b.nextSetBit(e+1))this.vertexColixes[e]=d}}},"~N");$_M(c$,"setJvxlDataRendering",function(){if(null!=this.jvxlData.rendering)for(var a=J.util.Parser.getTokens(this.jvxlData.rendering),b=0;b<a.length;b++)this.setTokenProperty(J.script.T.getTokFromName(a[b]),
!0)});$_M(c$,"remapColors",function(a,b,c){null==b&&(b=this.colorEncoder);null==b&&(b=this.colorEncoder=new J.util.ColorEncoder(null));this.colorEncoder=b;this.setColorCommand();Float.isNaN(c)?c=J.util.C.getColixTranslucencyLevel(this.colix):this.colix=J.util.C.getColixTranslucent3(this.colix,!0,c);var d=b.lo,e=b.hi,f=null!=this.vertexSource&&14==b.currentPalette;this.polygonColixes=this.vertexColorMap=null;this.jvxlData.vertexCount=this.vertexCount;if(!(null==this.vertexValues||0==this.jvxlData.vertexCount)){if(null==
this.vertexColixes||this.vertexColixes.length!=this.vertexCount)this.vertexColixes=Clazz.newShortArray(this.vertexCount,0);if(f){this.jvxlData.vertexDataOnly=!0;this.jvxlData.vertexColors=Clazz.newIntArray(this.vertexCount,0);this.jvxlData.nVertexColors=this.vertexCount;b=a.getModelSet().atoms;for(d=this.mergeVertexCount0;d<this.vertexCount;d++)c=this.vertexSource[d],c<b.length&&(this.jvxlData.vertexColors[d]=a.getColorArgbOrGray(this.vertexColixes[d]=J.util.C.copyColixTranslucency(this.colix,b[c].getColix())))}else if(this.jvxlData.isBicolorMap)for(d=
this.mergeVertexCount0;d<this.vertexCount;d++)this.vertexColixes[d]=J.util.C.copyColixTranslucency(this.colix,0>this.vertexValues[d]?this.jvxlData.minColorIndex:this.jvxlData.maxColorIndex);else{this.jvxlData.isColorReversed=b.isReversed;3.4028235E38!=e&&(this.jvxlData.valueMappedToRed=d,this.jvxlData.valueMappedToBlue=e);b.setRange(this.jvxlData.valueMappedToRed,this.jvxlData.valueMappedToBlue,this.jvxlData.isColorReversed);a=J.util.C.isColixTranslucent(this.colix);b.isTranslucent&&(a||(this.colix=
J.util.C.getColixTranslucent3(this.colix,!0,0.5)),a=!1);for(d=this.vertexCount;--d>=this.mergeVertexCount0;)this.vertexColixes[d]=b.getColorIndex(this.vertexValues[d]);this.setTranslucent(a,c);this.colorEncoder=b;a=this.getContours();if(null!=a)for(d=a.length;0<=--d;)c=a[d].get(2).floatValue(),e=a[d].get(3),e[0]=b.getColorIndex(c),a[d].get(4)[0]=J.util.C.getArgb(e[0]);if(null!=this.contourValues){this.contourColixes=Clazz.newShortArray(this.contourValues.length,0);for(d=0;d<this.contourValues.length;d++)this.contourColixes[d]=
b.getColorIndex(this.contourValues[d]);this.setDiscreteColixes(null,null)}this.jvxlData.isJvxlPrecisionColor=!0;J.jvxl.data.JvxlCoder.jvxlCreateColorData(this.jvxlData,this.vertexValues);this.setColorCommand();this.isColorSolid=!1}}},"J.viewer.Viewer,J.util.ColorEncoder,~N");$_M(c$,"reinitializeLightingAndColor",function(a){this.initialize(this.lighting,null,null);if(null!=this.colorEncoder||this.jvxlData.isBicolorMap)this.vertexColixes=null,this.remapColors(a,null,NaN)},"J.viewer.Viewer");Clazz.overrideMethod(c$,
"getBoundingBox",function(){return this.jvxlData.boundingBox});$_M(c$,"resetBoundingBox",($fz=function(){var a=new J.util.BoxInfo;if(0==this.polygonCount)for(var b=this.vertexCount;0<=--b;)a.addBoundBoxPoint(this.vertices[b]);else for(var c=new J.util.BS,b=this.polygonCount;0<=--b;)this.setABC(b)&&(c.get(this.iA)||(a.addBoundBoxPoint(this.vertices[this.iA]),c.set(this.iA)),c.get(this.iB)||(a.addBoundBoxPoint(this.vertices[this.iB]),c.set(this.iB)),c.get(this.iC)||(a.addBoundBoxPoint(this.vertices[this.iC]),
c.set(this.iC)));this.jvxlData.boundingBox=a.getBoundBoxPoints(!1)},$fz.isPrivate=!0,$fz));$_M(c$,"merge",function(a){var b=this.vertexCount+(null==a?0:a.vertexCount);null==this.polygonIndexes&&(this.polygonIndexes=Clazz.newIntArray(0,0,0));null!=a&&null==a.polygonIndexes&&(a.polygonIndexes=Clazz.newIntArray(0,0,0));var c=(null==this.bsSlabDisplay||0==this.polygonCount?this.polygonCount:this.bsSlabDisplay.cardinality())+(null==a||0==a.polygonCount?0:null==a.bsSlabDisplay?a.polygonCount:a.bsSlabDisplay.cardinality());
null==this.vertices&&(this.vertices=[]);this.vertices=J.util.ArrayUtil.ensureLength(this.vertices,b);this.vertexValues=J.util.ArrayUtil.ensureLengthA(this.vertexValues,b);var d=null!=this.vertexSource&&(null==a||null!=a.vertexSource);this.vertexSource=J.util.ArrayUtil.ensureLengthI(this.vertexSource,b);var e=J.util.ArrayUtil.newInt2(c),f=J.shapesurface.IsosurfaceMesh.mergePolygons(this,0,0,e);if(null!=a){J.shapesurface.IsosurfaceMesh.mergePolygons(a,f,this.vertexCount,e);for(f=0;f<a.vertexCount;f++,
this.vertexCount++)this.vertices[this.vertexCount]=a.vertices[f],this.vertexValues[this.vertexCount]=a.vertexValues[f],d&&(this.vertexSource[this.vertexCount]=a.vertexSource[f])}this.polygonCount=this.polygonCount0=c;this.vertexCount=this.vertexCount0=b;0<c&&this.resetSlab();this.polygonIndexes=e},"J.jvxl.data.MeshData");c$.mergePolygons=$_M(c$,"mergePolygons",($fz=function(a,b,c,d){for(var e,f=0;f<a.polygonCount;f++)if(!(null==(e=a.polygonIndexes[f])||null!=a.bsSlabDisplay&&!a.bsSlabDisplay.get(f)))if(d[b++]=
a.polygonIndexes[f],0<c)for(var g=0;3>g;g++)e[g]+=c;return b},$fz.isPrivate=!0,$fz),"J.util.MeshSurface,~N,~N,~A");Clazz.overrideMethod(c$,"getUnitCell",function(){return null==this.spanningVectors?null:J.api.Interface.getOptionInterface("symmetry.Symmetry").getUnitCell(this.spanningVectors)});Clazz.overrideMethod(c$,"slabBrillouin",function(a){var b=null==a?this.spanningVectors:a;if(null!=b){a=Array(27);a[0]=J.util.P3.newP(b[0]);for(var c=0,d=-1;1>=d;d++)for(var e=-1;1>=e;e++)for(var f=-1;1>=f;f++)if(0!=
d||0!=e||0!=f)a[++c]=J.util.P3.newP(a[0]),a[c].scaleAdd2(d,b[1],a[c]),a[c].scaleAdd2(e,b[2],a[c]),a[c].scaleAdd2(f,b[3],a[c]);System.out.println("draw line1 {0 0 0} color red"+J.util.Escape.eP(this.spanningVectors[1]));System.out.println("draw line2 {0 0 0} color green"+J.util.Escape.eP(this.spanningVectors[2]));System.out.println("draw line3 {0 0 0} color blue"+J.util.Escape.eP(this.spanningVectors[3]));var b=new J.util.P3,c=new J.util.P4,g=new J.util.V3,h=new J.util.V3,j=new J.util.BS,k=new java.util.Hashtable;
this.bsSlabGhost=new J.util.BS;for(d=1;27>d;d++){g.setT(a[d]);J.util.Measure.getBisectingPlane(a[0],g,b,h,c);this.getIntersection(1,c,null,null,null,null,null,!1,!1,135266319,!0);j.clearAll();k.clear();for(e=this.bsSlabGhost.nextSetBit(0);0<=e;e=this.bsSlabGhost.nextSetBit(e+1))if(this.setABC(e)){for(var l=J.util.ArrayUtil.arrayCopyRangeI(this.polygonIndexes[e],0,-1),f=0;3>f;f++){var m=l[f];l[f]=this.addIntersectionVertex(this.vertices[m],this.vertexValues[m],null==this.vertexSource?0:this.vertexSource[m],
null==this.vertexSets?0:this.vertexSets[m],k,0,m);m!=l[f]&&j.get(m)&&j.set(l[f])}this.addPolygonC(l,0,this.bsSlabDisplay);for(f=0;3>f;f++)j.get(l[f])||(j.set(l[f]),this.vertices[l[f]].sub(g))}0<=this.bsSlabGhost.nextSetBit(0)&&(this.bsSlabGhost.clearAll(),d=0)}this.bsSlabGhost=null;this.resetBoundingBox()}},"~A");Clazz.overrideMethod(c$,"getMinDistance2ForVertexGrouping",function(){return null!=this.jvxlData.boundingBox&&null!=this.jvxlData.boundingBox[0]&&5>this.jvxlData.boundingBox[1].distanceSquared(this.jvxlData.boundingBox[0])?
1E-10:1E-8});Clazz.overrideMethod(c$,"getVisibleVertexBitSet",function(){var a=this.getVisibleVBS();if(0<=this.jvxlData.thisSet)for(var b=0;b<this.vertexCount;b++)this.vertexSets[b]!=this.jvxlData.thisSet&&a.clear(b);return a});$_M(c$,"updateCoordinates",function(a,b){var c=null==b;if(!c)for(var d=0;d<this.connections.length;d++)if(0<=this.connections[d]&&b.get(this.connections[d])){c=!0;break}c&&(null==this.mat4&&(this.mat4=new J.util.Matrix4f,this.mat4.setIdentity()),this.mat4.mul2(a,this.mat4),
this.recalcAltVertices=!0)},"J.util.Matrix4f,J.util.BS")});Clazz.declarePackage("J.jvxl.readers");
Clazz.load(["J.jvxl.readers.SurfaceReader"],"J.jvxl.readers.VolumeDataReader",["J.jvxl.data.JvxlCoder","J.util.ArrayUtil","$.Logger","$.SB"],function(){c$=Clazz.decorateAsClass(function(){this.dataType=0;this.allowMapData=this.precalculateVoxelData=!1;this.point=null;this.maxGrid=this.ptsPerAngstrom=0;this.atomDataServer=null;this.useOriginStepsPoints=!1;Clazz.instantialize(this,arguments)},J.jvxl.readers,"VolumeDataReader",J.jvxl.readers.SurfaceReader);Clazz.makeConstructor(c$,function(){Clazz.superConstructor(this,
J.jvxl.readers.VolumeDataReader,[])});$_M(c$,"init",function(a){Clazz.superCall(this,J.jvxl.readers.VolumeDataReader,"init",[a]);this.useOriginStepsPoints=null!=this.params.origin&&null!=this.params.points&&null!=this.params.steps;this.dataType=this.params.dataType;this.allowMapData=this.precalculateVoxelData=!0},"J.jvxl.readers.SurfaceGenerator");$_M(c$,"setup",function(){this.jvxlFileHeaderBuffer=(new J.util.SB).append("volume data read from file\n\n");J.jvxl.data.JvxlCoder.jvxlCreateHeaderWithoutTitleOrAtoms(this.volumeData,
this.jvxlFileHeaderBuffer)},"~B");Clazz.overrideMethod(c$,"readVolumeParameters",function(a){this.setup(a);this.initializeVolumetricData();return!0},"~B");Clazz.overrideMethod(c$,"readVolumeData",function(a){try{this.readSurfaceData(a)}catch(b){if(Clazz.exceptionOf(b,Exception))return System.out.println(b.toString()),!1;throw b;}return!0},"~B");$_M(c$,"readVoxelDataIndividually",function(a){if(!a||this.allowMapData)if(!a||null!=this.volumeData.sr)this.volumeData.setVoxelDataAsArray(this.voxelData=
null);else{this.newVoxelDataCube();for(a=0;a<this.nPointsX;++a){var b=J.util.ArrayUtil.newFloat2(this.nPointsY);this.voxelData[a]=b;for(var c=0,d=0;d<this.nPointsY;++d)for(var e=b[d]=Clazz.newFloatArray(this.nPointsZ,0),f=0;f<this.nPointsZ;++f,++c)e[f]=this.getValue(a,d,f,c)}}},"~B");$_M(c$,"setVolumeData",function(){});$_M(c$,"setVolumeDataParams",function(){if(null!=this.params.volumeData)return this.setVolumeDataV(this.params.volumeData),!0;if(!this.useOriginStepsPoints)return!1;this.volumetricOrigin.setT(this.params.origin);
this.volumetricVectors[0].set(this.params.steps.x,0,0);this.volumetricVectors[1].set(0,this.params.steps.y,0);this.volumetricVectors[2].set(0,0,this.params.steps.z);this.voxelCounts[0]=Clazz.floatToInt(this.params.points.x);this.voxelCounts[1]=Clazz.floatToInt(this.params.points.y);this.voxelCounts[2]=Clazz.floatToInt(this.params.points.z);if(1>this.voxelCounts[0]||1>this.voxelCounts[1]||1>this.voxelCounts[2])return!1;this.showGridInfo();return!0});$_M(c$,"showGridInfo",function(){J.util.Logger.info("grid origin  = "+
this.params.origin);J.util.Logger.info("grid steps   = "+this.params.steps);J.util.Logger.info("grid points  = "+this.params.points);this.ptTemp.x=this.params.steps.x*this.params.points.x;this.ptTemp.y=this.params.steps.y*this.params.points.y;this.ptTemp.z=this.params.steps.z*this.params.points.z;J.util.Logger.info("grid lengths = "+this.ptTemp);this.ptTemp.add(this.params.origin);J.util.Logger.info("grid max xyz = "+this.ptTemp)});$_M(c$,"setVoxelRange",function(a,b,c,d,e,f){b>=c&&(b=-10,c=10);var g=
c-b,h=this.params.resolution;3.4028235E38!=h&&(d=h);c=Clazz.doubleToInt(Math.floor(g*d))+1;c>e&&(0<(this.dataType&256)?3.4028235E38==h?(this.isQuiet||J.util.Logger.info("Maximum number of voxels for index="+a+" exceeded ("+c+") -- set to "+e),c=e):this.isQuiet||J.util.Logger.info("Warning -- high number of grid points: "+c):3.4028235E38==h&&(c=e));d=(c-1)/g;d<f&&(c=Clazz.doubleToInt(Math.floor(f*g+1)),d=(c-1)/g);e=this.volumeData.volumetricVectorLengths[a]=1/d;this.voxelCounts[a]=c;this.isQuiet||
J.util.Logger.info("isosurface resolution for axis "+(a+1)+" set to "+d+" points/Angstrom; "+this.voxelCounts[a]+" voxels");switch(a){case 0:this.volumetricVectors[0].set(e,0,0);this.volumetricOrigin.x=b;break;case 1:this.volumetricVectors[1].set(0,e,0);this.volumetricOrigin.y=b;break;case 2:this.volumetricVectors[2].set(0,0,e),this.volumetricOrigin.z=b,this.isEccentric&&this.eccentricityMatrix.transform(this.volumetricOrigin),null!=this.center&&3.4028235E38!=this.center.x&&this.volumetricOrigin.add(this.center)}this.isEccentric&&
this.eccentricityMatrix.transform(this.volumetricVectors[a]);return this.voxelCounts[a]},"~N,~N,~N,~N,~N,~N");Clazz.overrideMethod(c$,"readSurfaceData",function(a){this.readSurfaceDataVDR(a)},"~B");$_M(c$,"readSurfaceDataVDR",function(a){this.isProgressive&&!a?(this.nDataPoints=this.volumeData.setVoxelCounts(this.nPointsX,this.nPointsY,this.nPointsZ),this.voxelData=null):this.precalculateVoxelData?this.generateCube():this.readVoxelDataIndividually(a)},"~B");$_M(c$,"generateCube",function(){J.util.Logger.info("data type: user volumeData");
J.util.Logger.info("voxel grid origin:"+this.volumetricOrigin);for(var a=0;3>a;++a)J.util.Logger.info("voxel grid vector:"+this.volumetricVectors[a]);J.util.Logger.info("Read "+this.nPointsX+" x "+this.nPointsY+" x "+this.nPointsZ+" data points")});Clazz.overrideMethod(c$,"closeReader",function(){})});Clazz.declarePackage("J.jvxl.readers");
Clazz.load(["J.jvxl.readers.VolumeDataReader","J.atomdata.AtomData","J.util.BS","$.P3","$.P3i"],"J.jvxl.readers.AtomDataReader","java.lang.Float java.util.Date J.atomdata.RadiusData J.constant.EnumVdw J.jvxl.data.JvxlCoder J.util.ArrayUtil $.BSUtil $.Logger $.SB $.TextFormat $.V3".split(" "),function(){c$=Clazz.decorateAsClass(function(){this.maxDistance=0;this.fileDotModel=this.fileName=this.contactPair=null;this.modelIndex=0;this.myIndex=this.atomIndex=this.atomNo=this.atomProp=this.atomRadius=
this.atomXyz=this.atomData=null;this.firstNearbyAtom=this.nearbyAtomCount=this.myAtomCount=this.atomCount=0;this.bsNearby=this.bsMyIgnored=this.bsMySelected=null;this.doUseIterator=this.havePlane=this.doAddHydrogens=!1;this.theProperty=0;this.haveOneProperty=!1;this.minPtsPerAng=0;this.thisAtomSet=this.thisPlane=null;this.margin=this.thisX=0;this.ptXyzTemp=this.pt1=this.pt0=this.ptZ0=this.ptY0=this.voxelSource=this.noFaceSpheres=this.validSpheres=this.bsSurfaceVoxels=null;Clazz.instantialize(this,
arguments)},J.jvxl.readers,"AtomDataReader",J.jvxl.readers.VolumeDataReader);Clazz.prepareFields(c$,function(){this.atomData=new J.atomdata.AtomData;this.bsMySelected=new J.util.BS;this.bsMyIgnored=new J.util.BS;this.ptY0=new J.util.P3;this.ptZ0=new J.util.P3;this.pt0=new J.util.P3i;this.pt1=new J.util.P3i;this.ptXyzTemp=new J.util.P3});Clazz.makeConstructor(c$,function(){Clazz.superConstructor(this,J.jvxl.readers.AtomDataReader,[])});$_M(c$,"init",function(a){Clazz.superCall(this,J.jvxl.readers.AtomDataReader,
"init",[a]);this.precalculateVoxelData=!0;this.atomDataServer=a.getAtomDataServer()},"J.jvxl.readers.SurfaceGenerator");Clazz.overrideMethod(c$,"setup",function(){this.setup2()},"~B");$_M(c$,"setup2",function(){this.contactPair=this.params.contactPair;this.doAddHydrogens=null!=this.sg.getAtomDataServer()&&this.params.addHydrogens;this.modelIndex=this.params.modelIndex;null!=this.params.bsIgnore&&(this.bsMyIgnored=this.params.bsIgnore);if(null!=this.params.volumeData){this.setVolumeDataV(this.params.volumeData);
this.setBBox(this.volumeData.volumetricOrigin,0);this.ptXyzTemp.setT(this.volumeData.volumetricOrigin);for(var a=0;3>a;a++)this.ptXyzTemp.scaleAdd2(this.volumeData.voxelCounts[a]-1,this.volumeData.volumetricVectors[a],this.ptXyzTemp);this.setBBox(this.ptXyzTemp,0)}(this.havePlane=null!=this.params.thePlane)&&this.volumeData.setPlaneParameters(this.params.thePlane)});$_M(c$,"markPlaneVoxels",function(a,b){for(var c=0,d=this.thisX*this.yzCount,e=d+this.yzCount;d<e;d++,c++)this.volumeData.getPoint(d,
this.ptXyzTemp),this.thisPlane[c]=this.ptXyzTemp.distance(a)-b},"J.util.P3,~N");$_M(c$,"setVolumeForPlane",function(){this.useOriginStepsPoints?(this.xyzMin=J.util.P3.newP(this.params.origin),this.xyzMax=J.util.P3.newP(this.params.origin),this.xyzMax.x+=(this.params.points.x-1)*this.params.steps.x,this.xyzMax.y+=(this.params.points.y-1)*this.params.steps.y,this.xyzMax.z+=(this.params.points.z-1)*this.params.steps.z):null==this.params.boundingBox?(this.getAtoms(this.params.bsSelected,!1,!0,!1,!1,!1,
!1,this.params.mep_marginAngstroms),null==this.xyzMin&&(this.xyzMin=J.util.P3.new3(-10,-10,-10),this.xyzMax=J.util.P3.new3(10,10,10))):(this.xyzMin=J.util.P3.newP(this.params.boundingBox[0]),this.xyzMax=J.util.P3.newP(this.params.boundingBox[1]));this.setRanges(this.params.plane_ptsPerAngstrom,this.params.plane_gridMax,0)});$_M(c$,"getAtoms",function(a,b,c,d,e,f,g,h){f&&(c=!0);c&&(null==this.params.atomRadiusData&&(this.params.atomRadiusData=new J.atomdata.RadiusData(null,1,J.atomdata.RadiusData.EnumType.FACTOR,
J.constant.EnumVdw.AUTO)),this.atomData.radiusData=this.params.atomRadiusData,this.atomData.radiusData.valueExtended=this.params.solventExtendedAtomRadius,b&&(this.atomData.radiusData.vdwType=J.constant.EnumVdw.NOJMOL));this.atomData.modelIndex=this.modelIndex;this.atomData.bsSelected=a;this.atomData.bsIgnored=this.bsMyIgnored;this.sg.fillAtomData(this.atomData,1|(e?16:0)|(d?4:0)|(c?2:0));this.doUseIterator&&(this.atomData.bsSelected=null);this.atomCount=this.atomData.atomCount;this.modelIndex=this.atomData.firstModelIndex;
e=0;g=!1;for(d=0;d<this.atomCount;d++){if((null==a||a.get(d))&&!this.bsMyIgnored.get(d)){if(this.havePlane&&Math.abs(this.volumeData.distancePointToPlane(this.atomData.atomXyz[d]))>2*(this.atomData.atomRadius[d]=this.getWorkingRadius(d,h)))continue;this.bsMySelected.set(d);e++;g=!this.havePlane}if(c&&(f||g))this.atomData.atomRadius[d]=this.getWorkingRadius(d,h)}e=c&&b?this.getWorkingRadius(-1,h):0;this.myAtomCount=J.util.BSUtil.cardinalityOf(this.bsMySelected);h=J.util.BSUtil.copy(this.bsMySelected);
g=0;this.atomProp=null;this.theProperty=3.4028235E38;this.haveOneProperty=!1;a=this.params.theProperty;if(0<this.myAtomCount){var j=null;if(b){this.atomData.bsSelected=h;this.atomDataServer.fillAtomData(this.atomData,8);j=Array(g=this.atomData.hydrogenAtomCount);for(d=0;d<this.atomData.hAtoms.length;d++)if(null!=this.atomData.hAtoms[d])for(b=this.atomData.hAtoms[d].length;0<=--b;)j[--g]=this.atomData.hAtoms[d][b];g=j.length;J.util.Logger.info(g+" attached hydrogens added")}b=g+this.myAtomCount;c&&
(this.atomRadius=Clazz.newFloatArray(b,0));this.atomXyz=Array(b);null!=this.params.theProperty&&(this.atomProp=Clazz.newFloatArray(b,0));this.atomNo=Clazz.newIntArray(b,0);this.atomIndex=Clazz.newIntArray(b,0);this.myIndex=Clazz.newIntArray(this.atomCount,0);for(d=0;d<g;d++)c&&(this.atomRadius[d]=e),this.atomXyz[d]=j[d],this.atomNo[d]=-1,null!=this.atomProp&&this.addAtomProp(d,NaN);this.myAtomCount=g;for(d=h.nextSetBit(0);0<=d;d=h.nextSetBit(d+1))null!=this.atomProp&&this.addAtomProp(this.myAtomCount,
null!=a&&d<a.length?a[d]:NaN),this.atomXyz[this.myAtomCount]=this.atomData.atomXyz[d],this.atomNo[this.myAtomCount]=this.atomData.atomicNumber[d],this.atomIndex[this.myAtomCount]=d,this.myIndex[d]=this.myAtomCount,c&&(this.atomRadius[this.myAtomCount]=this.atomData.atomRadius[d]),this.myAtomCount++}this.firstNearbyAtom=this.myAtomCount;J.util.Logger.info(this.myAtomCount+" atoms will be used in the surface calculation");0==this.myAtomCount&&(this.setBBox(J.util.P3.new3(10,10,10),0),this.setBBox(J.util.P3.new3(-10,
-10,-10),0));for(d=0;d<this.myAtomCount;d++)this.setBBox(this.atomXyz[d],c?this.atomRadius[d]+0.5:0);Float.isNaN(this.params.scale)||(c=J.util.V3.newV(this.xyzMax),c.sub(this.xyzMin),c.scale(0.5),this.xyzMin.add(c),c.scale(this.params.scale),this.xyzMax.setT(this.xyzMin),this.xyzMax.add(c),this.xyzMin.sub(c));if(f&&0!=this.myAtomCount){f=new J.util.P3;this.bsNearby=new J.util.BS;for(d=0;d<this.atomCount;d++)!h.get(d)&&!this.bsMyIgnored.get(d)&&(c=this.atomData.atomRadius[d],null!=this.params.thePlane&&
Math.abs(this.volumeData.distancePointToPlane(this.atomData.atomXyz[d]))>2*c||(null!=this.params.theProperty&&(c+=this.maxDistance),f=this.atomData.atomXyz[d],f.x+c>this.xyzMin.x&&(f.x-c<this.xyzMax.x&&f.y+c>this.xyzMin.y&&f.y-c<this.xyzMax.y&&f.z+c>this.xyzMin.z&&f.z-c<this.xyzMax.z)&&(this.bsNearby.set(d),this.nearbyAtomCount++)));f=this.myAtomCount;if(0!=this.nearbyAtomCount){f+=this.nearbyAtomCount;this.atomRadius=J.util.ArrayUtil.arrayCopyF(this.atomRadius,f);this.atomXyz=J.util.ArrayUtil.arrayCopyObject(this.atomXyz,
f);null!=this.atomIndex&&(this.atomIndex=J.util.ArrayUtil.arrayCopyI(this.atomIndex,f));null!=a&&(this.atomProp=J.util.ArrayUtil.arrayCopyF(this.atomProp,f));for(d=this.bsNearby.nextSetBit(0);0<=d;d=this.bsNearby.nextSetBit(d+1))null!=a&&this.addAtomProp(this.myAtomCount,a[d]),this.myIndex[d]=this.myAtomCount,this.atomIndex[this.myAtomCount]=d,this.atomXyz[this.myAtomCount]=this.atomData.atomXyz[d],this.atomRadius[this.myAtomCount++]=this.atomData.atomRadius[d]}this.haveOneProperty=!Float.isNaN(this.theProperty);
System.out.println("AtomDataR theProperty="+this.theProperty)}},"J.util.BS,~B,~B,~B,~B,~B,~B,~N");$_M(c$,"addAtomProp",($fz=function(a,b){this.atomProp[a]=b;!Float.isNaN(this.theProperty)&&b!=this.theProperty&&(this.theProperty=3.4028235E38==this.theProperty?b:NaN)},$fz.isPrivate=!0,$fz),"~N,~N");$_M(c$,"getWorkingRadius",($fz=function(a,b){var c=0>a?this.atomData.hAtomRadius:this.atomData.atomRadius[a];return Float.isNaN(b)?Math.max(c,0.1):c+b},$fz.isPrivate=!0,$fz),"~N,~N");$_M(c$,"setHeader",function(a,
b){this.jvxlFileHeaderBuffer=new J.util.SB;null!=this.atomData.programInfo&&this.jvxlFileHeaderBuffer.append("#created by ").append(this.atomData.programInfo).append(" on ").append(""+new java.util.Date).append("\n");this.jvxlFileHeaderBuffer.append(a).append("\n").append(b).append("\n")},"~S,~S");$_M(c$,"setRanges",function(a,b,c){null!=this.xyzMin&&(this.ptsPerAngstrom=a,this.maxGrid=b,this.minPtsPerAng=c,this.setVolumeData(),J.jvxl.data.JvxlCoder.jvxlCreateHeader(this.volumeData,this.jvxlFileHeaderBuffer))},
"~N,~N,~N");Clazz.overrideMethod(c$,"setVolumeData",function(){this.setVolumeDataParams()||(this.setVoxelRange(0,this.xyzMin.x,this.xyzMax.x,this.ptsPerAngstrom,this.maxGrid,this.minPtsPerAng),this.setVoxelRange(1,this.xyzMin.y,this.xyzMax.y,this.ptsPerAngstrom,this.maxGrid,this.minPtsPerAng),this.setVoxelRange(2,this.xyzMin.z,this.xyzMax.z,this.ptsPerAngstrom,this.maxGrid,this.minPtsPerAng))});$_M(c$,"fixTitleLine",function(a){if(null==this.params.title)return!1;var b=this.params.title[a];0<b.indexOf("%F")&&
(b=this.params.title[a]=J.util.TextFormat.formatStringS(b,"F",this.atomData.fileName));0<b.indexOf("%M")&&(this.params.title[a]=J.util.TextFormat.formatStringS(b,"M",this.atomData.modelName));return!0},"~N");$_M(c$,"setVertexSource",function(){null!=this.meshDataServer&&this.meshDataServer.fillMeshData(this.meshData,1,null);if(null!=this.params.vertexSource){this.params.vertexSource=J.util.ArrayUtil.arrayCopyI(this.params.vertexSource,this.meshData.vertexCount);for(var a=0;a<this.meshData.vertexCount;a++)this.params.vertexSource[a]=
Math.abs(this.params.vertexSource[a])-1}});$_M(c$,"resetPlane",function(a){for(var b=0;b<this.yzCount;b++)this.thisPlane[b]=a},"~N");$_M(c$,"resetVoxelData",function(a){for(var b=0;b<this.nPointsX;++b)for(var c=0;c<this.nPointsY;++c)for(var d=0;d<this.nPointsZ;++d)this.voxelData[b][c][d]=a},"~N");$_M(c$,"getVoxel",($fz=function(a,b,c,d){return this.isProgressive?this.thisPlane[d%this.yzCount]:this.voxelData[a][b][c]},$fz.isPrivate=!0,$fz),"~N,~N,~N,~N");$_M(c$,"unsetVoxelData",function(){this.unsetVoxelData2()});
$_M(c$,"unsetVoxelData2",function(){if(this.isProgressive)for(var a=0;a<this.yzCount;a++)3.4028235E38==this.thisPlane[a]&&(this.thisPlane[a]=NaN);else for(a=0;a<this.nPointsX;++a)for(var b=0;b<this.nPointsY;++b)for(var c=0;c<this.nPointsZ;++c)3.4028235E38==this.voxelData[a][b][c]&&(this.voxelData[a][b][c]=NaN)});$_M(c$,"setGridLimitsForAtom",function(a,b,c,d){b+=this.margin;this.volumeData.xyzToVoxelPt(a.x,a.y,a.z,c);a=Clazz.doubleToInt(Math.floor(b/this.volumeData.volumetricVectorLengths[0]));var e=
Clazz.doubleToInt(Math.floor(b/this.volumeData.volumetricVectorLengths[1]));b=Clazz.doubleToInt(Math.floor(b/this.volumeData.volumetricVectorLengths[2]));d.set(c.x+a,c.y+e,c.z+b);c.set(c.x-a,c.y-e,c.z-b);c.x=Math.max(c.x-1,0);c.y=Math.max(c.y-1,0);c.z=Math.max(c.z-1,0);d.x=Math.min(d.x+1,this.nPointsX);d.y=Math.min(d.y+1,this.nPointsY);d.z=Math.min(d.z+1,this.nPointsZ)},"J.util.P3,~N,J.util.P3i,J.util.P3i");$_M(c$,"getAtomMinMax",function(a,b){for(var c=0;c<this.nPointsX;c++)b[c]=new J.util.BS;for(var d=
this.myAtomCount;0<=--d;)if(null==a||a.get(d)){this.setGridLimitsForAtom(this.atomXyz[d],this.atomRadius[d],this.pt0,this.pt1);for(c=this.pt0.x;c<this.pt1.x;c++)b[c].set(d)}},"J.util.BS,~A");$_M(c$,"markSphereVoxels",function(a,b){for(var c=3.4028235E38!=b&&null!=this.point,d=this.thisAtomSet.nextSetBit(0);0<=d;d=this.thisAtomSet.nextSetBit(d+1))if(this.havePlane||null==this.validSpheres||this.validSpheres.get(d)){var e=null!=this.noFaceSpheres&&this.noFaceSpheres.get(d),f=d>=this.firstNearbyAtom,
g=this.atomXyz[d],h=this.atomRadius[d];if(!(c&&g.distance(this.point)>b+h+0.5)){var j=h+a;this.setGridLimitsForAtom(g,j,this.pt0,this.pt1);this.isProgressive&&(this.pt0.x=this.thisX,this.pt1.x=this.thisX+1);this.volumeData.voxelPtToXYZ(this.pt0.x,this.pt0.y,this.pt0.z,this.ptXyzTemp);for(var k=this.pt0.x;k<this.pt1.x;k++,this.ptXyzTemp.scaleAdd2(1,this.volumetricVectors[0],this.ptY0)){this.ptY0.setT(this.ptXyzTemp);for(var l=this.pt0.y;l<this.pt1.y;l++,this.ptXyzTemp.scaleAdd2(1,this.volumetricVectors[1],
this.ptZ0)){this.ptZ0.setT(this.ptXyzTemp);for(var m=this.pt0.z;m<this.pt1.z;m++,this.ptXyzTemp.add(this.volumetricVectors[2])){var p=this.ptXyzTemp.distance(g)-h,n=this.volumeData.getPointIndex(k,l,m);if((0==a||p<=j)&&p<this.getVoxel(k,l,m,n)){if(f||c&&this.ptXyzTemp.distance(this.point)>b)p=NaN;this.setVoxel(k,l,m,n,p);Float.isNaN(p)||(null!=this.voxelSource&&(this.voxelSource[n]=d+1),0>p&&e&&this.bsSurfaceVoxels.set(n))}}}}}}},"~N,~N");$_M(c$,"setVoxel",function(a,b,c,d,e){this.isProgressive?this.thisPlane[d%
this.yzCount]=e:this.voxelData[a][b][c]=e},"~N,~N,~N,~N,~N")});Clazz.declarePackage("J.jvxl.readers");
Clazz.load(["J.jvxl.readers.AtomDataReader","J.util.P3","$.P4","$.V3"],"J.jvxl.readers.IsoSolventReader","java.lang.Float java.util.Hashtable J.jvxl.data.MeshData J.util.BS $.BSUtil $.JmolList $.Logger $.Measure $.MeshSurface $.P3i".split(" "),function(){c$=Clazz.decorateAsClass(function(){this.envelopeRadius=this.cavityRadius=0;this.dots=null;this.isPocket=this.isCavity=this.doCalculateTroughs=!1;this.solventRadius=0;this.vTemp3=this.vTemp2=this.ptS2=this.ptS1=this.ptTemp2=this.plane=this.vTemp=
this.vFaces=this.aEdges=this.vEdges=this.htEdges=this.bsLocale=this.bsSurfaceDone=this.bsSurfacePoints=this.iter=null;this.dPX=0;this.p=null;this.maxRadius=0;this.bsAtomMinMax=null;this.isSurfacePoint=!1;this.iAtomSurface=0;Clazz.isClassDefined("J.jvxl.readers.IsoSolventReader.Edge")||J.jvxl.readers.IsoSolventReader.$IsoSolventReader$Edge$();Clazz.isClassDefined("J.jvxl.readers.IsoSolventReader.Face")||J.jvxl.readers.IsoSolventReader.$IsoSolventReader$Face$();Clazz.instantialize(this,arguments)},
J.jvxl.readers,"IsoSolventReader",J.jvxl.readers.AtomDataReader);Clazz.prepareFields(c$,function(){this.vTemp=new J.util.V3;this.plane=new J.util.P4;this.ptTemp2=new J.util.P3;this.ptS1=new J.util.P3;this.ptS2=new J.util.P3;this.vTemp2=new J.util.V3;this.vTemp3=new J.util.V3;this.p=new J.util.P3});Clazz.makeConstructor(c$,function(){Clazz.superConstructor(this,J.jvxl.readers.IsoSolventReader,[])});Clazz.overrideMethod(c$,"readVolumeParameters",function(a){this.setup(a);this.initializeVolumetricData();
this.isProgressive&&(this.volumeData.setUnitVectors(),this.volumeData.getYzCount(),this.bsAtomMinMax=Array(this.nPointsX),this.getAtomMinMax(null,this.bsAtomMinMax),this.voxelSource=Clazz.newIntArray(this.volumeData.nPoints,0));return!0},"~B");Clazz.overrideMethod(c$,"setup",function(a){this.setup2();if(null==this.contactPair){this.cavityRadius=this.params.cavityRadius;this.envelopeRadius=this.params.envelopeRadius;this.solventRadius=this.params.solventRadius;this.point=this.params.point;this.isCavity=
this.params.isCavity&&null!=this.meshDataServer;this.isPocket=null!=this.params.pocket&&null!=this.meshDataServer;this.doUseIterator=this.doCalculateTroughs=!a&&null!=this.atomDataServer&&!this.isCavity&&0<this.solventRadius&&(1195==this.dataType||1203==this.dataType);this.getAtoms(this.params.bsSelected,this.doAddHydrogens,!0,!1,!1,!0,!1,NaN);if(this.isCavity||this.isPocket)this.dots=this.meshDataServer.calculateGeodesicSurface(this.bsMySelected,this.envelopeRadius);this.setHeader("solvent/molecular surface",
this.params.calculationType);if(this.havePlane||!a)this.setRanges(this.params.solvent_ptsPerAngstrom,this.params.solvent_gridMax,0),this.volumeData.getYzCount(),this.margin=2*this.volumeData.maxGrid;null!=this.bsNearby&&this.bsMySelected.or(this.bsNearby)}else a||this.setVolumeData();this.doCalculateTroughs||(a?(this.precalculateVoxelData=!1,this.volumeData.sr=this):this.isCavity||(this.isProgressive=this.isXLowToHigh=!0));null==this.thisAtomSet&&(this.thisAtomSet=J.util.BSUtil.setAll(this.myAtomCount))},
"~B");Clazz.overrideMethod(c$,"generateCube",function(){if(!(this.isCavity&&null!=this.params.theProperty)){this.getMaxRadius();this.isCavity&&1205!=this.dataType&&1206!=this.dataType?(this.params.vertexSource=null,this.newVoxelDataCube(),this.resetVoxelData(3.4028235E38),this.markSphereVoxels(this.cavityRadius,this.params.distance),this.generateSolventCavity(),this.resetVoxelData(3.4028235E38),this.markSphereVoxels(0,NaN)):(this.voxelSource=Clazz.newIntArray(this.volumeData.nPoints,0),this.generateSolventCube());
this.unsetVoxelData();var a=this.params.slabInfo;if(null!=a)for(var b=0;b<a.size();b++)a.get(b)[2].booleanValue()&&Clazz.instanceOf(a.get(b)[0],J.util.P4)&&(this.volumeData.capData(a.get(b)[0],this.params.cutoff),a.remove(b--))}});Clazz.overrideMethod(c$,"getSurfacePointAndFraction",function(a,b,c,d,e,f,g,h,j,k,l,m,p){k=this.marchingCubes.getLinearOffset(g,h,j,k);l=this.marchingCubes.getLinearOffset(g,h,j,l);this.isSurfacePoint=null!=this.bsSurfaceVoxels&&(this.bsSurfaceVoxels.get(k)||this.bsSurfaceVoxels.get(l));
if(J.jvxl.readers.IsoSolventReader.testLinear||null==this.voxelSource||0==this.voxelSource[k]||this.voxelSource[k]!=this.voxelSource[l])return this.getSPF(a,b,c,d,e,f,g,h,j,k,l,m,p);a=Math.abs(c<d?this.voxelSource[k]:this.voxelSource[l]);this.iAtomSurface=this.atomIndex[a-1];m=m[0]=J.util.MeshSurface.getSphericalInterpolationFraction(0>this.voxelSource[k]?this.solventRadius:this.atomRadius[this.voxelSource[k]-1],c,d,f.length());p.scaleAdd2(m,f,e);return c+m*(d-c)},"~N,~B,~N,~N,J.util.P3,J.util.V3,~N,~N,~N,~N,~N,~A,J.util.P3");
Clazz.overrideMethod(c$,"addVertexCopy",function(a,b,c){a=this.addVC(a,b,c);if(0>a)return a;this.isSurfacePoint&&this.bsSurfacePoints.set(a);null!=this.params.vertexSource&&(this.params.vertexSource[a]=this.iAtomSurface);return a},"J.util.P3,~N,~N");Clazz.overrideMethod(c$,"selectPocket",function(a){null!=this.meshDataServer&&this.meshDataServer.fillMeshData(this.meshData,1,null);for(var b=this.meshData.vertices,c=this.meshData.vertexCount,d=this.meshData.vertexValues,e=this.dots.length,f=0;f<c;f++)for(var g=
0;g<e;g++)this.dots[g].distance(b[f])<this.envelopeRadius&&(d[f]=NaN);this.meshData.getSurfaceSet();b=this.meshData.nSets;c=J.util.BSUtil.newBitSet(b);for(f=0;f<b;f++)if(null!=(d=this.meshData.surfaceSet[f]))for(g=d.nextSetBit(0);0<=g;g=d.nextSetBit(g+1))if(Float.isNaN(this.meshData.vertexValues[g])){c.set(f);break}for(f=0;f<b;f++)null!=this.meshData.surfaceSet[f]&&c.get(f)==a&&this.meshData.invalidateSurfaceSet(f);this.updateSurfaceData();a||(this.meshData.surfaceSet=null);null!=this.meshDataServer&&
(this.meshDataServer.fillMeshData(this.meshData,3,null),this.meshData=new J.jvxl.data.MeshData)},"~B");Clazz.overrideMethod(c$,"postProcessVertices",function(){this.setVertexSource();if(this.doCalculateTroughs&&null!=this.bsSurfacePoints){var a=new J.util.BS,b=this.meshData.getSurfaceSet(),c=null,d=this.isPocket?null:this.meshData.calculateVolumeOrArea(-1,!1,!1),e=4.71238898038469*Math.pow(this.solventRadius,3),f=0,g=!1;if(null!=d&&!this.isCavity)for(var h=0;h<this.meshData.nSets;h++){var j=d[h];
Math.abs(j)>f&&(f=Math.abs(j),g=0>j)}f=g?-1:1;for(h=0;h<this.meshData.nSets;h++)if(g=b[h],g.intersects(this.bsSurfacePoints)&&(null==d||d[h]*f>e)&&null!=this.params.vertexSource){j=new J.util.BS;null==c&&(c=Array(b.length));for(var k=g.nextSetBit(0);0<=k;k=g.nextSetBit(k+1)){var l=this.params.vertexSource[k];if(!(0>l)){if(a.get(l)){this.meshData.invalidateSurfaceSet(h);break}j.set(l)}}a.or(j)}else this.meshData.invalidateSurfaceSet(h);this.updateSurfaceData();null!=this.meshDataServer&&(this.meshDataServer.fillMeshData(this.meshData,
3,null),this.meshData=new J.jvxl.data.MeshData)}null!=this.params.thePlane&&null==this.params.slabInfo&&this.params.addSlabInfo(J.util.MeshSurface.getSlabWithinRange(-100,0))});$_M(c$,"generateSolventCavity",($fz=function(){for(var a=J.util.BSUtil.newBitSet(this.nPointsX*this.nPointsY*this.nPointsZ),b=0,c=this.dots.length,d=0,e,f=this.envelopeRadius,g=0;g<this.nPointsX;++g)for(var h=0;h<this.nPointsY;++h){var j=0;a:for(;j<this.nPointsZ;++j,++b)if(3.4028235E38>(e=this.voxelData[g][h][j])&&e>=this.cavityRadius){this.volumeData.voxelPtToXYZ(g,
h,j,this.ptXyzTemp);for(var k=0;k<c;k++)if(this.dots[k].distance(this.ptXyzTemp)<f)continue a;a.set(b);d++}}J.util.Logger.info("cavities include "+d+" voxel points");this.atomRadius=Clazz.newFloatArray(d,0);this.atomXyz=Array(d);for(c=b=g=0;g<this.nPointsX;++g)for(h=0;h<this.nPointsY;++h)for(j=0;j<this.nPointsZ;++j)a.get(b++)&&(this.volumeData.voxelPtToXYZ(g,h,j,this.atomXyz[c]=new J.util.P3),this.atomRadius[c++]=this.voxelData[g][h][j]);this.myAtomCount=this.firstNearbyAtom=d;this.thisAtomSet=J.util.BSUtil.setAll(this.myAtomCount)},
$fz.isPrivate=!0,$fz));$_M(c$,"generateSolventCube",($fz=function(){1205!=this.dataType&&(this.params.vertexSource=Clazz.newIntArray(this.volumeData.nPoints,0),this.bsSurfaceDone=new J.util.BS,this.bsSurfaceVoxels=new J.util.BS,this.bsSurfacePoints=new J.util.BS,this.doCalculateTroughs?(this.iter=this.atomDataServer.getSelectedAtomIterator(this.bsMySelected,!0,!1,!1),this.vEdges=new J.util.JmolList,this.bsLocale=Array(this.myAtomCount),this.htEdges=new java.util.Hashtable,this.getEdges(),J.util.Logger.info(this.vEdges.size()+
" edges"),this.vFaces=new J.util.JmolList,this.getFaces(),J.util.Logger.info(this.vFaces.size()+" faces"),this.htEdges=this.bsLocale=this.vEdges=null,this.iter.release(),this.iter=null,this.newVoxelDataCube(),this.resetVoxelData(3.4028235E38),this.markFaceVoxels(!0),this.markToroidVoxels(),this.aEdges=null,this.markFaceVoxels(!1),this.vFaces=null):(this.newVoxelDataCube(),this.resetVoxelData(3.4028235E38)),this.markSphereVoxels(0,this.doCalculateTroughs?3.4028235E38:this.params.distance),this.validSpheres=
this.noFaceSpheres=null)},$fz.isPrivate=!0,$fz));$_M(c$,"getEdges",($fz=function(){for(var a=0;a<this.myAtomCount;a++)this.bsLocale[a]=new J.util.BS;for(var b=this.solventRadius+this.maxRadius,a=0;a<this.myAtomCount;a++){var c=this.atomXyz[a],d=this.atomRadius[a]+this.solventRadius;for(this.atomDataServer.setIteratorForAtom(this.iter,this.atomIndex[a],d+b);this.iter.hasNext();){var e=this.iter.next(),e=this.myIndex[e];if(!(a>=this.firstNearbyAtom&&e>=this.firstNearbyAtom)){var f=this.atomRadius[e]+
this.solventRadius;c.distance(this.atomXyz[e])>=d+f||(f=Clazz.innerTypeInstance(J.jvxl.readers.IsoSolventReader.Edge,this,null,a,e),this.vEdges.addLast(f),this.bsLocale[a].set(e),this.bsLocale[e].set(a),this.htEdges.put(f.toString(),f))}}}},$fz.isPrivate=!0,$fz));$_M(c$,"findEdge",function(a,b){return this.htEdges.get(a<b?a+"_"+b:b+"_"+a)},"~N,~N");$_M(c$,"getFaces",($fz=function(){var a=new J.util.BS;this.validSpheres=new J.util.BS;this.noFaceSpheres=J.util.BSUtil.setAll(this.myAtomCount);for(var b=
this.vEdges.size();0<=--b;){var c=this.vEdges.get(b),d=c.ia,e=c.ib;a.clearAll();a.or(this.bsLocale[d]);a.and(this.bsLocale[e]);for(var f=a.nextSetBit(e+1);0<=f;f=a.nextSetBit(f+1))if(this.getSolventPoints(d,e,f)){var g,h=!1;if(this.validateFace(g=Clazz.innerTypeInstance(J.jvxl.readers.IsoSolventReader.Face,this,null,d,e,f,c,this.ptS1)))this.vFaces.addLast(g),h=!0;if(this.validateFace(g=Clazz.innerTypeInstance(J.jvxl.readers.IsoSolventReader.Face,this,null,d,e,f,c,this.ptS2)))this.vFaces.addLast(g),
h=!0;h&&(this.noFaceSpheres.clear(d),this.noFaceSpheres.clear(e),this.noFaceSpheres.clear(f))}}a=new J.util.BS;for(b=this.vEdges.size();0<=--b;)0<=this.vEdges.get(b).getType()&&a.set(b);this.aEdges=Array(a.cardinality());b=a.nextSetBit(0);for(c=0;0<=b;b=a.nextSetBit(b+1))this.aEdges[c++]=this.vEdges.get(b)},$fz.isPrivate=!0,$fz));$_M(c$,"getSolventPoints",($fz=function(a,b,c){a=this.getPointP(a,b);b=this.atomXyz[c];var d=this.atomRadius[c]+this.solventRadius;c=J.util.Measure.distanceToPlane(this.plane,
b);if(Math.abs(c)>=0.9*d)return!1;d=Math.sqrt(d*d-c*c);this.ptTemp.scaleAdd2(-c,this.vTemp,b);b=this.p.distance(this.ptTemp);b=(a*a+b*b-d*d)/(2*a*b);if(0.99<=Math.abs(b))return!1;c=this.vTemp2;c.setT(this.ptTemp);c.sub(this.p);c.normalize();this.dPX=a*b;this.ptTemp.scaleAdd2(this.dPX,c,this.p);c.cross(this.vTemp,c);c.normalize();c.scale(Math.sqrt(1-b*b)*a);this.ptS1.setT(this.ptTemp);this.ptS1.add(c);this.ptS2.setT(this.ptTemp);this.ptS2.sub(c);return!0},$fz.isPrivate=!0,$fz),"~N,~N,~N");$_M(c$,"validateFace",
($fz=function(a){this.atomDataServer.setIteratorForPoint(this.iter,this.modelIndex,a.pS,this.solventRadius+this.maxRadius);for(a.isValid=!0;this.iter.hasNext();){var b=this.iter.next(),c=this.myIndex[b];if(!(c==a.ia||c==a.ib||c==a.ic)&&this.atomData.atomXyz[b].distance(a.pS)<this.atomData.atomRadius[b]+this.solventRadius){a.isValid=!1;break}}a.setEdges();if(!a.isValid)return!1;for(b=0;3>b;b++)this.validSpheres.set(a.edges[b].ia),this.validSpheres.set(a.edges[b].ib);a.edges=null;return!0},$fz.isPrivate=
!0,$fz),"J.jvxl.readers.IsoSolventReader.Face");$_M(c$,"markFaceVoxels",($fz=function(a){for(var b=new J.util.BS,c=this.vFaces.size();0<=--c;){var d=this.vFaces.get(c);if(d.isValid){this.setGridLimitsForAtom(d.pS,this.solventRadius,this.pt0,this.pt1);this.volumeData.voxelPtToXYZ(this.pt0.x,this.pt0.y,this.pt0.z,this.ptXyzTemp);for(var e=this.atomXyz[d.ia],f=this.atomXyz[d.ib],g=this.atomXyz[d.ic],h=d.pS,j=this.pt0.x;j<this.pt1.x;j++,this.ptXyzTemp.scaleAdd2(1,this.volumetricVectors[0],this.ptY0)){this.ptY0.setT(this.ptXyzTemp);
for(var k=this.pt0.y;k<this.pt1.y;k++,this.ptXyzTemp.scaleAdd2(1,this.volumetricVectors[1],this.ptZ0)){this.ptZ0.setT(this.ptXyzTemp);for(var l=this.pt0.z;l<this.pt1.z;l++,this.ptXyzTemp.add(this.volumetricVectors[2])){var m=this.solventRadius-this.ptXyzTemp.distance(h),p=this.voxelData[j][k][l],n=this.volumeData.getPointIndex(j,k,l);a&&0<m&&this.bsSurfaceDone.set(n);if(J.util.Measure.isInTetrahedron(this.ptXyzTemp,e,f,g,h,this.plane,this.vTemp,this.vTemp2,this.vTemp3,!1)&&(!a?!this.bsSurfaceDone.get(n)&&
0>m&&m>1.8*-this.volumeData.maxGrid&&m>p==b.get(n):0<m&&(0>p||3.4028235E38==p||m>p==b.get(n))))b.set(n),this.setVoxel(j,k,l,n,m),null!=this.voxelSource&&(this.voxelSource[n]=-1-d.ia),0<m&&this.bsSurfaceVoxels.set(n)}}}}}},$fz.isPrivate=!0,$fz),"~B");$_M(c$,"markToroidVoxels",($fz=function(){for(var a=new J.util.P3i,b=new J.util.P3i,c=new J.util.P3i,d=new J.util.P3i,e=0;e<this.aEdges.length;e++){var f=this.aEdges[e],g=f.ia,h=f.ib,f=this.atomXyz[g],j=this.atomXyz[h],k=this.atomRadius[g]+this.solventRadius,
l=this.atomRadius[h]+this.solventRadius,m=j.distance(f);this.setGridLimitsForAtom(f,this.atomRadius[g]+this.solventRadius,a,c);this.setGridLimitsForAtom(j,this.atomRadius[h]+this.solventRadius,b,d);J.jvxl.readers.IsoSolventReader.mergeLimits(a,b,this.pt0,null);J.jvxl.readers.IsoSolventReader.mergeLimits(c,d,null,this.pt1);this.volumeData.voxelPtToXYZ(this.pt0.x,this.pt0.y,this.pt0.z,this.ptXyzTemp);for(h=this.pt0.x;h<this.pt1.x;h++,this.ptXyzTemp.scaleAdd2(1,this.volumetricVectors[0],this.ptY0)){this.ptY0.setT(this.ptXyzTemp);
for(var p=this.pt0.y;p<this.pt1.y;p++,this.ptXyzTemp.scaleAdd2(1,this.volumetricVectors[1],this.ptZ0)){this.ptZ0.setT(this.ptXyzTemp);for(var n=this.pt0.z;n<this.pt1.z;n++,this.ptXyzTemp.add(this.volumetricVectors[2])){var q=this.checkSpecialVoxel(f,k,j,l,m,this.ptXyzTemp);if(!Float.isNaN(q)&&(q=this.solventRadius-q,q<this.voxelData[h][p][n])){var r=this.volumeData.getPointIndex(h,p,n);this.setVoxel(h,p,n,r,q);null!=this.voxelSource&&(this.voxelSource[r]=-1-g)}}}}}this.validSpheres.or(this.noFaceSpheres)},
$fz.isPrivate=!0,$fz));Clazz.overrideMethod(c$,"unsetVoxelData",function(){if(this.havePlane)if(this.isProgressive)for(var a=0;a<this.yzCount;a++)0.001>this.thisPlane[a]||(this.thisPlane[a]=0.001);else for(a=0;a<this.nPointsX;++a)for(var b=0;b<this.nPointsY;++b)for(var c=0;c<this.nPointsZ;++c)0.001>this.voxelData[a][b][c]||(this.voxelData[a][b][c]=0.001);else this.unsetVoxelData2()});$_M(c$,"getMaxRadius",function(){for(var a=this.maxRadius=0;a<this.myAtomCount;a++){var b=this.atomRadius[a];b>this.maxRadius&&
(this.maxRadius=b)}});c$.mergeLimits=$_M(c$,"mergeLimits",($fz=function(a,b,c,d){null!=c&&(c.x=Math.min(a.x,b.x),c.y=Math.min(a.y,b.y),c.z=Math.min(a.z,b.z));null!=d&&(d.x=Math.max(a.x,b.x),d.y=Math.max(a.y,b.y),d.z=Math.max(a.z,b.z))},$fz.isPrivate=!0,$fz),"J.util.P3i,J.util.P3i,J.util.P3i,J.util.P3i");$_M(c$,"checkSpecialVoxel",($fz=function(a,b,c,d,e,f){var g=a.distance(f),h=c.distance(f),j=b/g;if(1<j){this.p.set(a.x+(f.x-a.x)*j,a.y+(f.y-a.y)*j,a.z+(f.z-a.z)*j);if(c.distance(this.p)>=d)return NaN;
a=this.solventDistance(b,d,e,g,h);return J.jvxl.readers.IsoSolventReader.voxelIsInTrough(a,b*b,d,e,g)?a:NaN}if(1<(j=d/h)){this.p.set(c.x+(f.x-c.x)*j,c.y+(f.y-c.y)*j,c.z+(f.z-c.z)*j);if(a.distance(this.p)>=b)return NaN;a=this.solventDistance(d,b,e,h,g);return J.jvxl.readers.IsoSolventReader.voxelIsInTrough(a,d*d,b,e,h)?a:NaN}return NaN},$fz.isPrivate=!0,$fz),"J.util.P3,~N,J.util.P3,~N,~N,J.util.P3");c$.voxelIsInTrough=$_M(c$,"voxelIsInTrough",($fz=function(a,b,c,d,e){return(b+c*c-d*d)/c<(b+a*a-e*e)/
a},$fz.isPrivate=!0,$fz),"~N,~N,~N,~N,~N");$_M(c$,"solventDistance",($fz=function(a,b,c,d,e){var f=d*d,g=a*a,h=c*c;e=Math.acos((f+h-e*e)/(2*d*c));b=Math.acos((h+g-b*b)/(2*c*a));return Math.sqrt(g+f-2*a*d*Math.cos(b-e))},$fz.isPrivate=!0,$fz),"~N,~N,~N,~N,~N");$_M(c$,"getPointP",function(a,b){var c=this.atomXyz[a],d=this.atomRadius[a]+this.solventRadius,e=this.atomRadius[b]+this.solventRadius;this.vTemp.setT(this.atomXyz[b]);this.vTemp.sub(c);var f=this.vTemp.length();this.vTemp.normalize();e=(f*f+
d*d-e*e)/(2*f*d);f=Math.acos(e);this.p.scaleAdd2(e*d,this.vTemp,c);J.util.Measure.getPlaneThroughPoint(this.p,this.vTemp,this.plane);return Math.sin(f)*d},"~N,~N");Clazz.overrideMethod(c$,"getValueAtPoint",function(a){if(null!=this.contactPair)return a.distance(this.contactPair.myAtoms[1])-this.contactPair.radii[1];for(var b=3.4028235E38,c=0;c<this.firstNearbyAtom;c++){var d=a.distance(this.atomXyz[c])-this.atomRadius[c]-this.solventRadius;d<b&&(b=d)}return 3.4028235E38==b?NaN:b},"J.util.P3,~B");
Clazz.overrideMethod(c$,"getPlane",function(a){0==this.yzCount&&this.initPlanes();this.thisX=a;this.thisPlane=this.yzPlanes[a%2];null==this.contactPair?(this.resetPlane(3.4028235E38),this.thisAtomSet=this.bsAtomMinMax[a],this.markSphereVoxels(0,this.params.distance),this.unsetVoxelData()):this.markPlaneVoxels(this.contactPair.myAtoms[0],this.contactPair.radii[0]);return this.thisPlane},"~N");c$.$IsoSolventReader$Edge$=function(){Clazz.pu$h();c$=Clazz.decorateAsClass(function(){Clazz.prepareCallback(this,
arguments);this.nInvalid=this.nFaces=this.ib=this.ia=0;this.aFaces=null;Clazz.instantialize(this,arguments)},J.jvxl.readers.IsoSolventReader,"Edge");Clazz.makeConstructor(c$,function(a,b){this.ia=Math.min(a,b);this.ib=Math.max(a,b)},"~N,~N");$_M(c$,"addFace",function(a){null==a?this.nInvalid++:(null==this.aFaces&&(this.aFaces=new J.util.JmolList),this.aFaces.addLast(a),this.nFaces++)},"J.jvxl.readers.IsoSolventReader.Face");$_M(c$,"getType",function(){return 0<this.nFaces?this.nFaces:0<this.nInvalid?
-this.nInvalid:0});Clazz.overrideMethod(c$,"toString",function(){return this.ia+"_"+this.ib});c$=Clazz.p0p()};c$.$IsoSolventReader$Face$=function(){Clazz.pu$h();c$=Clazz.decorateAsClass(function(){Clazz.prepareCallback(this,arguments);this.ic=this.ib=this.ia=0;this.isValid=!1;this.edges=this.pS=null;Clazz.instantialize(this,arguments)},J.jvxl.readers.IsoSolventReader,"Face");Clazz.prepareFields(c$,function(){this.edges=Array(3)});Clazz.makeConstructor(c$,function(a,b,c,d,e){this.ia=a;this.ib=b;this.ic=
c;this.pS=J.util.P3.newP(e);this.edges[0]=d},"~N,~N,~N,J.jvxl.readers.IsoSolventReader.Edge,J.util.P3");$_M(c$,"setEdges",function(){null==this.edges[1]&&(this.edges[1]=this.b$["J.jvxl.readers.IsoSolventReader"].findEdge(this.ib,this.ic),this.edges[2]=this.b$["J.jvxl.readers.IsoSolventReader"].findEdge(this.ic,this.ia));for(var a=this.isValid?this:null,b=0;3>b;b++)this.edges[b].addFace(a)});c$=Clazz.p0p()};Clazz.defineStatics(c$,"testLinear",!1)});Clazz.declarePackage("J.rendersurface");
Clazz.load(["J.render.MeshRenderer","J.util.P3","$.P3i"],"J.rendersurface.IsosurfaceRenderer",["java.lang.Boolean","$.Float","J.util.C","$.Normix","$.V3"],function(){c$=Clazz.decorateAsClass(function(){this.isBicolorMap=this.iHideBackground=!1;this.nError=this.backgroundColix=0;this.isosurface=this.imesh=this.vertexValues=null;this.showNumbers=this.iShowNormals=this.isNavigationMode=!1;this.$showKey=null;this.hasColorRange=!1;this.meshScale=-1;this.ptTempi=this.ptTemp=null;Clazz.instantialize(this,
arguments)},J.rendersurface,"IsosurfaceRenderer",J.render.MeshRenderer);Clazz.prepareFields(c$,function(){this.ptTemp=new J.util.P3;this.ptTempi=new J.util.P3i});Clazz.overrideMethod(c$,"render",function(){return this.renderIso()});$_M(c$,"renderIso",function(){this.needTranslucent=!1;this.iShowNormals=this.viewer.getTestFlag(4);this.showNumbers=this.viewer.getTestFlag(3);this.isosurface=this.shape;this.exportPass=this.isExport?2:0;this.isNavigationMode=this.viewer.getBoolean(603979886);var a=2147483647,
b=this.g3d.getSlab();this.$showKey=this.viewer.getBoolean(603979870)?Boolean.TRUE:null;this.isNavigationMode&&(a=Clazz.floatToInt(this.viewer.getNavigationOffset().z));this.isosurface.keyXy=null;this.meshScale=-1;for(var c=this.isosurface.meshCount;0<=--c;)if(this.imesh=this.isosurface.meshes[c],null==this.imesh.connections||this.viewer.getModelSet().atoms[this.imesh.connections[0]].isVisible(0))this.hasColorRange=!1,this.renderMeshSlab(a,b)&&(this.isExport||this.renderInfo(),this.isExport&&this.haveBsSlabGhost&&
(this.exportPass=1,this.renderMeshSlab(a,b),this.exportPass=2));return this.needTranslucent});$_M(c$,"renderInfo",function(){this.hasColorRange&&(null!=this.imesh.colorEncoder&&Boolean.TRUE===this.$showKey)&&this.showKey()});$_M(c$,"showKey",($fz=function(){this.$showKey=Boolean.FALSE;var a=null,b=null,c=null,d=0,e=0;if(this.imesh.showContourLines)if(c=this.imesh.getContours(),null==c){b=this.imesh.jvxlData.contourColixes;if(null==b)return;d=b.length}else d=c.length,e=1;else a=this.imesh.colorEncoder.getColorSchemeArray(this.imesh.colorEncoder.currentPalette),
d=a.length,e=2;if(!(2>d)){var f=this.g3d.isAntialiased()?2:1,g=this.viewer.getScreenHeight()*f,h=Clazz.doubleToInt(Clazz.doubleToInt(g/2)/(d-1)),g=3*Clazz.doubleToInt(g/4)-h,j=10*f,k=20*f;this.isosurface.keyXy=[Clazz.doubleToInt(j/f),0,Clazz.doubleToInt((j+k)/f),Clazz.doubleToInt((g+h)/f),Clazz.doubleToInt(h/f)];for(var l=0;l<d;l++,g-=h){switch(e){case 0:if(!this.g3d.setColix(b[l]))return;break;case 1:if(!this.g3d.setColix(c[l].get(3)[0]))return;break;case 2:this.g3d.setColor(a[l])}this.g3d.fillRect(j,
g,5,-2147483648,k,h)}this.isosurface.keyXy[1]=Clazz.doubleToInt((g+h)/f)}},$fz.isPrivate=!0,$fz));$_M(c$,"renderMeshSlab",($fz=function(a,b){this.volumeRender=this.imesh.jvxlData.colorDensity&&this.imesh.jvxlData.allowVolumeRender;if(!this.isNavigationMode){var c=this.imesh.jvxlData.slabValue;if(-2147483648!=c&&this.imesh.jvxlData.isSlabbable){var d=this.imesh.jvxlData.boundingBox;this.pt2f.setT(d[0]);this.pt2f.add(d[1]);this.pt2f.scale(0.5);this.viewer.transformPt3f(this.pt2f,this.pt2f);d=this.viewer.scaleToScreen(Clazz.floatToInt(this.pt2f.z),
Math.round(500*d[0].distance(d[1])));a=Math.round(this.pt2f.z+d*(1-c/50))}}this.g3d.setTranslucentCoverOnly(this.imesh.frontOnly);this.thePlane=this.imesh.jvxlData.jvxlPlane;this.vertexValues=this.imesh.vertexValues;2147483647!=a&&this.imesh.jvxlData.isSlabbable?(this.g3d.setSlab(a),c=this.renderMesh(this.imesh),this.g3d.setSlab(b)):c=this.renderMesh(this.imesh);this.g3d.setTranslucentCoverOnly(!1);return c},$fz.isPrivate=!0,$fz),"~N,~N");Clazz.overrideMethod(c$,"render2",function(a){if(this.volumeRender)this.renderPoints();
else{switch(this.imesh.dataType){case 70:this.renderLonePair(!1);return;case 71:this.renderLonePair(!0);return}this.isBicolorMap=this.imesh.jvxlData.isBicolorMap;this.render2b(a);this.g3d.setColix(4)&&this.imesh.showContourLines&&this.renderContourLines()}},"~B");$_M(c$,"renderLonePair",($fz=function(a){this.pt2f.setT(this.vertices[1]);this.viewer.transformPt3f(this.pt2f,this.pt2f);var b=Clazz.floatToInt(this.viewer.scaleToScreen(Clazz.floatToInt(this.pt2f.z),100));1>b&&(b=1);if(!a){var c=new J.util.V3;
a=new J.util.V3;this.pt1f.setT(this.vertices[0]);this.viewer.transformPt3f(this.pt1f,this.pt1f);c.sub2(this.pt2f,this.pt1f);a.set(c.x,c.y,c.z+1);a.cross(a,c);a.normalize();c=this.viewer.scaleToScreen(Clazz.floatToInt(this.pt1f.z),100);a.scale(c);this.pt1f.setT(this.pt2f);this.pt1f.add(a);this.pt2f.sub(a);this.screens[0].set(Math.round(this.pt1f.x),Math.round(this.pt1f.y),Math.round(this.pt1f.z));this.g3d.fillSphereI(b,this.screens[0])}this.screens[1].set(Math.round(this.pt2f.x),Math.round(this.pt2f.y),
Math.round(this.pt2f.z));this.g3d.fillSphereI(b,this.screens[1])},$fz.isPrivate=!0,$fz),"~B");$_M(c$,"renderContourLines",($fz=function(){var a=this.imesh.getContours();if(null==a)null!=this.imesh.jvxlData.contourValues&&(this.hasColorRange=!0);else{this.hasColorRange=0==this.imesh.meshColix;for(var b=a.length;0<=--b;){var c=a[b];if(!(6>c.size())){this.colix=0==this.imesh.meshColix?c.get(3)[0]:this.imesh.meshColix;if(!this.g3d.setColix(this.colix))break;for(var d=c.size()-1,e=6;e<d;e++){var f=c.get(e),
g=c.get(++e);this.viewer.transformPtScr(f,this.pt1i);this.viewer.transformPtScr(g,this.pt2i);if(Float.isNaN(f.x)||Float.isNaN(g.x))break;this.pt1i.z-=2;this.pt2i.z-=2;this.g3d.drawLineAB(this.pt1i,this.pt2i)}}}}},$fz.isPrivate=!0,$fz));Clazz.overrideMethod(c$,"renderPoints",function(){try{this.volumeRender&&this.g3d.volumeRender(!0);var a=(this.volumeRender||0==this.imesh.polygonCount)&&this.haveBsSlabDisplay,b=this.imesh.vertexIncrement,c;0>=this.imesh.diameter?(c=this.viewer.getInt(553648144),this.frontOnly=
!1):c=Clazz.doubleToInt(this.viewer.getScreenDim()/(this.volumeRender?50:100));var d=Math.round(1E3*this.imesh.volumeRenderPointSize);1>c&&(c=1);var e=this.showNumbers?Clazz.doubleToInt(this.viewer.getScreenWidth()/2):0,f=this.showNumbers?Clazz.doubleToInt(this.viewer.getScreenHeight()/2):0;this.showNumbers&&this.g3d.setFontFid(this.g3d.getFontFidFS("Monospaced",24));for(var g=!this.imesh.hasGridPoints||0>this.imesh.firstRealVertex?0:this.imesh.firstRealVertex;g<this.vertexCount;g+=b)if(!(null!=this.vertexValues&&
Float.isNaN(this.vertexValues[g])||this.frontOnly&&0>this.transformedVectors[this.normixes[g]].z||0<=this.imesh.jvxlData.thisSet&&this.imesh.vertexSets[g]!=this.imesh.jvxlData.thisSet||!this.imesh.isColorSolid&&null!=this.imesh.vertexColixes&&!this.setColix(this.imesh.vertexColixes[g])||this.haveBsDisplay&&!this.imesh.bsDisplay.get(g)||a&&!this.bsSlab.get(g))){this.hasColorRange=!0;if(this.showNumbers&&10<this.screens[g].z&&150>Math.abs(this.screens[g].x-e)&&150>Math.abs(this.screens[g].y-f)){var h=
g+(this.imesh.isColorSolid?"":" "+this.imesh.vertexValues[g]);this.g3d.setColix(4);this.g3d.drawStringNoSlab(h,null,this.screens[g].x,this.screens[g].y,this.screens[g].z-30,0)}this.volumeRender?(c=Clazz.floatToInt(this.viewer.scaleToScreen(this.screens[g].z,d)),this.g3d.volumeRender4(c,this.screens[g].x,this.screens[g].y,this.screens[g].z)):this.g3d.fillSphereI(c,this.screens[g])}if(3==b){this.g3d.setColix(this.isTranslucent?J.util.C.getColixTranslucent3(12,!0,0.5):12);for(g=1;g<this.vertexCount;g+=
3)this.g3d.fillCylinder(3,Clazz.doubleToInt(c/4),this.screens[g],this.screens[g+1]);this.g3d.setColix(this.isTranslucent?J.util.C.getColixTranslucent3(21,!0,0.5):21);for(g=1;g<this.vertexCount;g+=3)this.g3d.fillSphereI(c,this.screens[g]);this.g3d.setColix(this.isTranslucent?J.util.C.getColixTranslucent3(7,!0,0.5):7);for(g=2;g<this.vertexCount;g+=3)this.g3d.fillSphereI(c,this.screens[g])}}catch(j){}this.volumeRender&&this.g3d.volumeRender(!1)});Clazz.overrideMethod(c$,"renderTriangles",function(a,
b,c){var d=this.imesh.polygonIndexes;this.colix=this.haveBsSlabGhost?this.imesh.slabColix:!a&&0!=this.imesh.meshColix?this.imesh.meshColix:this.imesh.colix;var e=!a&&0!=this.imesh.meshColix?null:this.imesh.vertexColixes;this.g3d.setColix(this.colix);var f=-2147483648;c&&(this.frontOnly&&a&&(this.frontOnly=!1),this.bsPolygons.clearAll());1==this.exportType&&(this.frontOnly=!1);var g=this.haveBsSlabGhost&&!this.isBicolorMap||null==e||this.imesh.isColorSolid,h=this.haveBsSlabGhost&&!this.isBicolorMap||
null==e||!a&&0!=this.imesh.meshColix,j=this.colix;null!=this.imesh.jvxlData.jvxlPlane&&(!g&&!a&&this.imesh.fillTriangles)&&(g=!0,j=4);var k=g&&null!=this.imesh.polygonColixes;k&&(!a&&this.imesh.fillTriangles)&&(k=!1);var l=this.imesh.jvxlData.contourColixes;this.hasColorRange=!g&&!this.isBicolorMap;for(var m=this.imesh.polygonCount;0<=--m;){var p=d[m];if(!(null==p||this.haveBsSlabDisplay&&!this.bsSlab.get(m))){var n=p[0],q=p[1],r=p[2];if(!(0<=this.imesh.jvxlData.thisSet&&null!=this.imesh.vertexSets&&
this.imesh.vertexSets[n]!=this.imesh.jvxlData.thisSet)&&(!this.haveBsDisplay||this.imesh.bsDisplay.get(n)&&this.imesh.bsDisplay.get(q)&&this.imesh.bsDisplay.get(r))){var t=this.normixes[n],u=this.normixes[q],x=this.normixes[r],v=this.checkNormals(t,u,x);if(!(a&&0==v)){var s,w,y;if(g){if(k&&m<this.imesh.polygonColixes.length){s=this.imesh.polygonColixes[m];if(0==s)continue;j=s}s=w=y=j}else if(s=e[n],w=e[q],y=e[r],this.isBicolorMap){if(s!=w||w!=y)continue;this.haveBsSlabGhost&&(s=w=y=J.util.C.copyColixTranslucency(this.imesh.slabColix,
s))}-2147483648==f&&(0>=this.imesh.diameter?(f=0>this.meshScale?this.meshScale=this.viewer.getInt(553648151):this.meshScale,this.g3d.isAntialiased()&&(f*=2)):f=Clazz.doubleToInt(this.viewer.getScreenDim()/100),1>f&&(f=1));if(a)c?this.bsPolygons.set(m):(q==r?(this.setColix(s),n==q?this.g3d.fillSphereI(f,this.screens[n]):this.g3d.fillCylinder(3,f,this.screens[n],this.screens[q])):b?this.g3d.fillTriangle(this.screens[n],s,t,this.screens[q],w,u,this.screens[r],y,x,0.1):this.g3d.fillTriangle3CN(this.screens[n],
s,t,this.screens[q],w,u,this.screens[r],y,x),this.iShowNormals&&this.renderNormals());else if(v&=p[3],b&&(v=7),0!=v){this.pt1i.setT(this.screens[n]);this.pt2i.setT(this.screens[q]);this.pt3i.setT(this.screens[r]);this.pt1i.z-=2;this.pt2i.z-=2;this.pt3i.z-=2;if(!h)if(k)this.g3d.setColix(this.mesh.fillTriangles?4:l[p[4]%l.length]);else{this.drawTriangle(this.pt1i,s,this.pt2i,w,this.pt3i,y,v,f);continue}this.drawTriangle(this.pt1i,j,this.pt2i,j,this.pt3i,j,v,f)}}}}}c&&this.exportSurface(g?j:0)},"~B,~B,~B");
$_M(c$,"renderNormals",($fz=function(){if(this.g3d.setColix(8)){this.g3d.setFontFid(this.g3d.getFontFidFS("Monospaced",24));for(var a=J.util.Normix.getVertexVectors(),b=this.vertexCount;0<=--b;)if(!(null!=this.vertexValues&&Float.isNaN(this.vertexValues[b]))&&!(100<b)){this.ptTemp.setT(this.vertices[b]);var c=this.mesh.normixes[b];0<=c&&(this.ptTemp.add(a[c]),this.ptTemp.add(a[c]),this.ptTemp.add(a[c]),this.viewer.transformPtScr(this.ptTemp,this.ptTempi),this.g3d.drawLineAB(this.screens[b],this.ptTempi))}}},
$fz.isPrivate=!0,$fz))});
