Returns a Jmol script that draws an invisible polyhedron around a structure.
Use showPolyhedron() and hidePolyhedron() to toggle visibility.
@return Jmol script
764552
@Override
	public String drawPolyhedron() {
		StringBuilder s = new StringBuilder();

		// for now, return empty script until this has been implemented properly
//		if (s.length() == 0)
//			return s.toString();

//		Point3d[] vertices = getRepeatUnitCenters();
		List<Point3d> vertices = helixAxisAligner.getSubunits().getOriginalCenters();
		vertices = extendUnitCenters(vertices);

		int index = 0;
		Color4f c = new Color4f(Color.MAGENTA);
//		double width = getMaxExtension()*0.015;
		double width = getMaxExtension()*0.007;

//		List<List<Integer>> layerLines = helixAxisAligner.getHelixLayers().getByLargestContactsNotLowestAngle().getLayerLines();
//		layerLines.addAll(helixAxisAligner.getHelixLayers().getByLowestAngle().getLayerLines());
		List<List<Integer>> layerLines = helixAxisAligner.getHelixLayers().getByLargestContacts().getLayerLines();


		for (List<Integer> line : layerLines) {
			s.append("draw polyhedron");
			s.append(name);
			s.append(index++);
			s.append(" line");
			for (int i: line) {
				s.append(getJmolPoint(vertices.get(i)));
			}
			s.append("width ");
			s.append(fDot2(width));
			s.append(" color");
			s.append(getJmolColor(c));
			s.append(" off;");
		}

		List<Point3d> interiorVertices = interiorCenters(vertices);

		for (int i = 0; i < vertices.size(); i++) {
			s.append("draw polyhedron");
			s.append(name);
			s.append(index++);
			s.append(" line");
			s.append(getJmolPoint(vertices.get(i)));
			s.append(getJmolPoint(interiorVertices.get(i)));
			s.append("width ");
			s.append(fDot2(width));
			s.append(" color");
			s.append(getJmolColor(c));
			s.append(" off;");
		}

//		Matrix4d transformation = helixAxisTransformation.getHelixLayers().getByLowestAngle().getTransformation();
//
//		Point3d[] vertices2 = SuperPosition.clonePoint3dArray(vertices);
//		for (Point3d p: vertices2) {
//			transformation.transform(p);
//		}
//
//		// extend grid by one turn in +z direction
//		for (int[] lineLoop: getLayerLines()) {
//			s.append("draw line");
//			s.append(name);
//			s.append(index++);
//			s.append(" line");
//			int count = 0;
//			for (int i: lineLoop) {
//				for (Point3d v: vertices) {
//					if (v.distance(vertices2[i]) > 0.1) {
//						count++;
//						break;
//					}
//				}
//				if (count > 0) {
//					s.append(getJmolPoint(vertices2[i]));
//				} else {
//					s.append(" ");
//				}
//			}
//			s.append("width ");
//		    s.append(fDot2(width));
//			s.append(" color");
//			s.append(getJmolColor(c));
//			s.append(" off;");
//		}
//
//
//		// extend grid by one turn into -z direction
//		Point3d[] vertices3 = SuperPosition.clonePoint3dArray(vertices);
//		Matrix4d m = new Matrix4d();
//		m.set(transformation);
//		m.invert();
//		for (Point3d p: vertices3) {
//			m.transform(p);
//		}
//
//		for (int[] lineLoop: getLayerLines()) {
//			s.append("draw line");
//			s.append(name);
//			s.append(index++);
//			s.append(" line");
//			int count = 0;
//			for (int i: lineLoop) {
//				for (Point3d v: vertices) {
//					if (v.distance(vertices3[i]) > 0.1) {
//						count++;
//					}
//				}
//				if (count > 0) {
//					s.append(getJmolPoint(vertices3[i]));
//				} else {
//					s.append(" ");
//				}
//			}
//			s.append("width ");
//		    s.append(fDot2(width));
//			s.append(" color");
//			s.append(getJmolColor(c));
//			s.append(" off;");
//		}

		return s.toString();
	}
235166
public static Shape generatePolygon(int sides, int outsideRadius, int insideRadius) {
        if (sides < 3) {
            return new Ellipse2D.Float(0, 0, 10, 10);
        }

        AffineTransform trans = new AffineTransform();
        Polygon poly = new Polygon();
        for (int i = 0; i < sides; i++) {
            trans.rotate(Math.PI * 2 / sides / 2);
            Point2D out = trans.transform(new Point2D.Float(0, outsideRadius), null);
            poly.addPoint((int) out.getX(), (int) out.getY());
            trans.rotate(Math.PI * 2 / sides / 2);
            if (insideRadius > 0) {
                Point2D in = trans.transform(new Point2D.Float(0, insideRadius), null);
                poly.addPoint((int) in.getX(), (int) in.getY());
            }
        }

        return poly;
    }
303081
public function generateAndIncludeFormzConfigurationJavaScript()
    {
        $formzConfigurationJavaScriptAssetHandler = $this->getFormzConfigurationJavaScriptAssetHandler();
        $fileName = $formzConfigurationJavaScriptAssetHandler->getJavaScriptFileName();

        $this->assetHandlerConnectorManager->createFileInTemporaryDirectory(
            $fileName,
            function () use ($formzConfigurationJavaScriptAssetHandler) {
                return $formzConfigurationJavaScriptAssetHandler->getJavaScriptCode();
            }
        );

        $this->includeJsFile(StringService::get()->getResourceRelativePath($fileName));

        return $this;
    }
569792
public Rectangle getAbsoluteContainingBlock()
    {
        if (cbox instanceof Viewport) //initial containing block
        {
            Rectangle ab = cbox.getAbsoluteBounds(); //normally positioned at 0,0; other value for nested viewports (e.g. objects)
            Rectangle visible = ((Viewport) cbox).getVisibleRect();
            return new Rectangle(ab.x, ab.y, visible.width, visible.height);
        }
        else //static or relative position
            return cbox.getAbsoluteContentBounds();
    }
619724
private static Visibility getEffectiveVisibilityForNonOverriddenProperty(
      Node getprop,
      ObjectType objectType,
      @Nullable Visibility fileOverviewVisibility,
      @Nullable CodingConvention codingConvention) {
    String propertyName = getprop.getLastChild().getString();
    if (codingConvention != null && codingConvention.isPrivate(propertyName)) {
      return Visibility.PRIVATE;
    }
    Visibility raw = Visibility.INHERITED;
    if (objectType != null) {
      raw = objectType.getOwnPropertyJSDocInfo(propertyName).getVisibility();
    }
    JSType type = getprop.getJSType();
    boolean createdFromGoogProvide = (type != null && type.isLiteralObject());
    // Ignore @fileoverview visibility when computing the effective visibility
    // for properties created by goog.provide.
    //
    // ProcessClosurePrimitives rewrites goog.provide()s as object literal
    // declarations, but the exact form depends on the ordering of the
    // input files. If goog.provide('a.b.c') occurs in the inputs before
    // goog.provide('a'), it is rewritten like
    //
    // var a={};a.b={}a.b.c={};
    //
    // If the file containing goog.provide('a.b.c') also declares
    // a @fileoverview visibility, it must not apply to b, as this would make
    // every a.b.* namespace effectively package-private.
    return (raw != Visibility.INHERITED
        || fileOverviewVisibility == null
        || createdFromGoogProvide)
        ? raw
        : fileOverviewVisibility;
  }
114717
public function getObjectBuilder()
    {
        if (!isset($this->objectBuilder)) {
            $this->objectBuilder = $this->getGeneratorConfig()->getConfiguredBuilder($this->getTable(), 'object');
        }

        return $this->objectBuilder;
    }
1241177
function DisplayObject()
{
    EventEmitter.call(this);

    /**
     * The coordinate of the object relative to the local coordinates of the parent.
     *
     * @member {Point}
     */
    this.position = new math.Point();

    /**
     * The scale factor of the object.
     *
     * @member {Point}
     */
    this.scale = new math.Point(1, 1);

    /**
     * The pivot point of the displayObject that it rotates around
     *
     * @member {Point}
     */
    this.pivot = new math.Point(0, 0);

    /**
     * The rotation of the object in radians.
     *
     * @member {number}
     */
    this.rotation = 0;

    /**
     * The opacity of the object.
     *
     * @member {number}
     */
    this.alpha = 1;

    /**
     * The visibility of the object. If false the object will not be drawn, and
     * the updateTransform function will not be called.
     *
     * @member {boolean}
     */
    this.visible = true;

    /**
     * Can this object be rendered, if false the object will not be drawn but the updateTransform
     * methods will still be called.
     *
     * @member {boolean}
     */
    this.renderable = true;

    /**
     * The display object container that contains this display object.
     *
     * @member {Container}
     * @readOnly
     */
    this.parent = null;

    /**
     * The multiplied alpha of the displayObject
     *
     * @member {number}
     * @readOnly
     */
    this.worldAlpha = 1;

    /**
     * Current transform of the object based on world (parent) factors
     *
     * @member {Matrix}
     * @readOnly
     */
    this.worldTransform = new math.Matrix();

    /**
     * The area the filter is applied to. This is used as more of an optimisation
     * rather than figuring out the dimensions of the displayObject each frame you can set this rectangle
     *
     * @member {Rectangle}
     */
    this.filterArea = null;

    /**
     * cached sin rotation
     *
     * @member {number}
     * @private
     */
    this._sr = 0;

    /**
     * cached cos rotation
     *
     * @member {number}
     * @private
     */
    this._cr = 1;

    /**
     * The original, cached bounds of the object
     *
     * @member {Rectangle}
     * @private
     */
    this._bounds = new math.Rectangle(0, 0, 1, 1);

    /**
     * The most up-to-date bounds of the object
     *
     * @member {Rectangle}
     * @private
     */
    this._currentBounds = null;

    /**
     * The original, cached mask of the object
     *
     * @member {Rectangle}
     * @private
     */
    this._mask = null;

    //TODO rename to _isMask
   // this.isMask = false;

    /**
     * Cached internal flag.
     *
     * @member {boolean}
     * @private
     */
    this._cacheAsBitmap = false;
    this._cachedObject = null;
}
422458
protected function renderIndestructibleReview()
    {
        if ($this->encoding && $this->encoding->status == 'complete') {
            return $this->renderPlayerOrStatus();
        }

        return $this->renderPlayerOrStatus().parent::renderIndestructibleReview();
    }
438101
private Color4f getPolyhedronColor() {
		Color4f[] colors = getSymmetryColors(5);
		Color4f strongestColor = colors[4];
		Color4f complement = new Color4f(Color.WHITE);
		complement.sub(strongestColor);
		return complement;
	}
1228644
@Override
    public final Scene draw()
    {
        final NFastArrayList<Layer> layers = getChildNodes();

        if (null != layers)
        {
            final int size = layers.size();

            for (int i = 0; i < size; i++)
            {
                final Layer layer = layers.get(i);

                if (null != layer)
                {
                    layer.draw();
                }
            }
        }
        return this;
    }
459979
function()
	{
		var b = document.body;
		var d = document.documentElement;
		
		try
		{
			return new mxRectangle(0, 0, b.clientWidth || d.clientWidth, Math.max(b.clientHeight || 0, d.clientHeight));
		}
		catch (e)
		{
			return new mxRectangle();
		}
	}
284508
public function build(): GetScriptSourceRequest
	{
		$instance = new GetScriptSourceRequest();
		if ($this->scriptId === null) {
			throw new BuilderException('Property [scriptId] is required.');
		}
		$instance->scriptId = $this->scriptId;
		return $instance;
	}
1329150
function visuallyHidden(focusable) {
  const focusableStyles = {
    clip: "auto",
    clipPath: "none",
    height: "auto",
    margin: 0,
    overflow: "visible",
    position: "static",
    whiteSpace: "inherit",
    width: "auto",
  };

  return Object.assign({}, {
    border: 0,
    clipPath: "inset(50%)",
    display: "inline-block",
    height: "1px",
    margin: "-1px",
    overflow: "hidden",
    padding: 0,
    whiteSpace: "nowrap",
    width: "1px",
  }, focusable === "focusable" ? {
    ":active": focusableStyles,
    ":focus": focusableStyles,
  } : {});
}
1071368
function () {
    var dressing = new THREE.Object3D();
    this.dressing.setAttribute('visible', this.data.dressing != 'none');
    if (this.data.dressing == 'none') {
      return;
    }
    var geometry = new THREE.Geometry(); // mother geometry that will hold all instances

    // get array of geometries
    var geoset;
    switch (this.data.dressing){
      case 'cubes': {
        geoset = [new THREE.BoxGeometry(1, 1, 1)];
        geoset[0].applyMatrix(new THREE.Matrix4().makeTranslation(0, 0.5, 0));
        break;
      }
      case 'pyramids': {
        geoset = [new THREE.ConeGeometry(1, 1, 4, 1, true)];
        geoset[0].applyMatrix(new THREE.Matrix4().makeTranslation(0, 0.5, 0));
        break;
      }
      case 'cylinders': {
        geoset = [new THREE.CylinderGeometry(0.5, 0.5, 1, 8, 1, true)];
        geoset[0].applyMatrix(new THREE.Matrix4().makeTranslation(0, 0.5, 0));
        break;
      }
      default: {
        geoset = this.getAssetGeometry(this.assets[this.data.dressing]);
        if (!geoset) return;
        break;
      }
    }

    for (var i = 0, r = 88343; i < this.data.dressingAmount; i++, r++) {

      var geo = geoset[Math.floor(this.random(33 + i) * geoset.length)];
/*
      // change vertex colors
      var color = new THREE.Color(0xFFFFFF).multiplyScalar(1 - this.random(66 + i) * 0.3);

      for (var f = 0, fl = geo.faces.length; f < fl; f++) {
        var face = geo.faces[f];
        for (var v = 0; v < 3; v++) {
          p = geo.vertices[face[faceindex[v]]]; // get vertex position
          var floorao =  p.y / 4 + 0.75;
          face.vertexColors[v] = new THREE.Color(color.r * floorao, color.g * floorao, color.b * floorao);
        }
      }
*/
      // set random position, rotation and scale
      var ds = this.data.dressingScale;
      var dv = new THREE.Vector3(this.data.dressingVariance.x, this.data.dressingVariance.y, this.data.dressingVariance.z);
      var distance;
      var onPlayArea = this.random(r) < this.data.dressingOnPlayArea;
      if (onPlayArea) {
        distance = this.random(r + 1) * 15;
      }
      else {
        distance = 10 + Math.max(dv.x, dv.z) + 10 * this.random(r + 1) + this.random(r + 2) * this.STAGE_SIZE / 3;
      }

      var direction = this.random(r + 3) * Math.PI * 2;
      var matrix = new THREE.Matrix4();
      var scale = this.random(r + 4);
      var uniformScale = this.data.dressingUniformScale;

      matrix.compose(
        // position
        new THREE.Vector3(
          Math.cos(direction) * distance,
          0,
          Math.sin(direction) * distance
          ),
        // rotation
        new THREE.Quaternion().setFromAxisAngle(
          new THREE.Vector3(0, 1, 0),
          (this.random(r + 5) - 0.5) * dv.length() * Math.PI * 2
          ),
        // scale
        new THREE.Vector3(
           ds + (uniformScale ? scale : this.random(r + 6)) * dv.x,
           ds + (uniformScale ? scale : this.random(r + 7)) * dv.y,
           ds + (uniformScale ? scale : this.random(r + 8)) * dv.z
          )
        );

      // merge with mother geometry
      geometry.merge(geo, matrix);
    }

    // convert geometry to buffergeometry
    var bufgeo = new THREE.BufferGeometry();
    bufgeo.fromGeometry(geometry);

    // setup material
    var material = new THREE.MeshLambertMaterial({
      color: new THREE.Color(this.data.dressingColor),
      vertexColors: THREE.VertexColors
    });

    if (this.data.flatShading) {
      bufgeo.computeVertexNormals();
    }

    // create mesh
    var mesh = new THREE.Mesh(bufgeo, material);
    dressing.add(mesh);
    // add to scene
    this.dressing.setObject3D('mesh', dressing);
  }
716158
public static String getMultiBlockJmolString(MultipleAlignment multAln,
			List<Atom[]> transformedAtoms, ColorBrewer colorPalette,
			boolean colorByBlocks) {

		StringWriter jmol = new StringWriter();
		jmol.append(DEFAULT_SCRIPT);
		jmol.append("select *; color lightgrey; backbone 0.1; ");

		int blockNum = multAln.getBlocks().size();
		Color[] colors = colorPalette.getColorPalette(blockNum);

		// For every structure color all the blocks with the printBlock method
		for (int str = 0; str < transformedAtoms.size(); str++) {
			jmol.append("select */" + (str + 1) + "; color lightgrey; model "
					+ (str + 1) + "; ");

			int index = 0;
			for (BlockSet bs : multAln.getBlockSets()) {
				for (Block b : bs.getBlocks()) {

					List<List<Integer>> alignRes = b.getAlignRes();
					printJmolScript4Block(transformedAtoms.get(str), alignRes,
							colors[index], jmol, str, index, blockNum);
					index++;
				}
			}
		}

		jmol.append("model 0;  ");
		jmol.append(LIGAND_DISPLAY_SCRIPT);

		return jmol.toString();
	}
914506
public PolyhedralSurface toPolyhedralSurface(
            List<com.google.android.gms.maps.model.Polygon> polygonList,
            boolean hasZ, boolean hasM) {

        PolyhedralSurface polyhedralSurface = new PolyhedralSurface(hasZ, hasM);

        for (com.google.android.gms.maps.model.Polygon mapPolygon : polygonList) {
            Polygon polygon = toPolygon(mapPolygon);
            polyhedralSurface.addPolygon(polygon);
        }

        return polyhedralSurface;
    }
1148140
protected function makeComponentBlueprint()
    {
        $blueprint = new Blueprint(self::COMPONENT_CLASS, [

            new CustomInstruction(function (Scaffold $s) {
                if ($s->input instanceof Closure) {
                    $s->class = 'Nayjest\Grids\Components\RenderFunc';
                    $s->constructor_arguments = [$s->input];
                    $s->input = [];
                } elseif (is_string($s->input)) {
                    $s->class = 'Nayjest\Grids\Components\RenderFunc';
                    $out = $s->input;
                    $s->constructor_arguments = [function () use ($out) {
                        return $out;
                    }];
                    $s->input = [];
                }
            }, Instruction::PHASE_PRE_INST),
            new CustomMapping('type', function ($type, Scaffold $s) {
                if (strpos($type, '\\') !== false) {
                    $s->class = $type;
                } else {
                    $s->class = 'Nayjest\Grids\Components\\' . str_replace(
                            ' ',
                            '',
                            ucwords(str_replace(array('-', '_'), ' ', $type))
                        );
                }
            }, null, Instruction::PHASE_PRE_INST)
        ]);
        $blueprint->add(new BuildChildren('components', $blueprint));

        $blueprint->add(new Rename('component', 'add_component'));
        $blueprint->add(new Build('add_component', $blueprint));
        $blueprint->add(new CallMethodWith('add_component','addComponent'));

        return $blueprint;
    }