Package de.lmu.ifi.dbs.elki.visualization.svg

Examples of de.lmu.ifi.dbs.elki.visualization.svg.SVGPath


        }
        Polygon chres = hull.getHull();

        // Plot the convex hull:
        if(chres != null && chres.size() > 1) {
          SVGPath path = new SVGPath(chres);
          // Approximate area (using bounding box)
          double hullarea = SpatialUtil.volume(chres);
          final double relativeArea = (projarea - hullarea) / projarea;
          final double relativeSize = (double) ids.size() / rel.size();
          opacity = Math.sqrt(relativeSize * relativeArea);

          Element hulls = path.makeElement(svgp);
          addCSSClasses(svgp, cnum, opacity);
          SVGUtil.addCSSClass(hulls, CLUSTERHULL + cnum);
          layer.appendChild(hulls);
        }
      }
      else {
        ArrayList<Vector> ps = new ArrayList<Vector>(ids.size());
        for(DBID clpnum : ids) {
          double[] projP = proj.fastProjectDataToRenderSpace(rel.get(clpnum));
          ps.add(new Vector(projP));
        }
        List<Polygon> polys = (new AlphaShape(ps, alpha * Projection.SCALE)).compute();
        for(Polygon p : polys) {
          SVGPath path = new SVGPath(p);
          Element hulls = path.makeElement(svgp);
          addCSSClasses(svgp, cnum, 0.5);
          SVGUtil.addCSSClass(hulls, CLUSTERHULL + cnum);
          layer.appendChild(hulls);
        }
      }
View Full Code Here


  protected void drawSphere2D(int cnum, Vector cent, Vector[] pc) {
    for(int dim1 = 0; dim1 < pc.length - 1; dim1++) {
      for(int dim2 = dim1 + 1; dim2 < pc.length; dim2++) {
        for(int i = 1; i <= times; i++) {
          SVGPath path = new SVGPath();

          Vector direction1 = pc[dim1].times(KAPPA * i);
          Vector direction2 = pc[dim2].times(KAPPA * i);

          Vector p1 = cent.plusTimes(pc[dim1], i);
          Vector p2 = cent.plusTimes(pc[dim2], i);
          Vector p3 = cent.minusTimes(pc[dim1], i);
          Vector p4 = cent.minusTimes(pc[dim2], i);

          path.moveTo(p1);
          path.cubicTo(p1.plus(direction2), p2.plus(direction1), p2);
          path.cubicTo(p2.minus(direction1), p3.plus(direction2), p3);
          path.cubicTo(p3.minus(direction2), p4.minus(direction1), p4);
          path.cubicTo(p4.plus(direction1), p1.minus(direction2), p1);
          path.close();

          Element ellipse = path.makeElement(svgp);
          SVGUtil.addCSSClass(ellipse, EMBORDER + cnum);
          if(opacStyle == 1) {
            CSSClass cls = new CSSClass(null, "temp");
            double s = (i >= 1 && i <= sigma.length) ? sigma[i - 1] : 0.0;
            cls.setStatement(SVGConstants.CSS_FILL_OPACITY_PROPERTY, s);
View Full Code Here

          // ignore
        }
      }
      Polygon chres = hull.getHull();
      if(chres != null && chres.size() >= 3) {
        SVGPath path = new SVGPath(chres);

        Element selHull = path.makeElement(svgp);
        SVGUtil.addCSSClass(selHull, SELECTEDHULL);
        // TODO: use relative selection size for opacity?
        layer.appendChild(selHull);
      }
    }
View Full Code Here

    }
  }

  protected void drawHullLines(int cnum, Vector cent, Polygon chres) {
    for(int i = 1; i <= times; i++) {
      SVGPath path = new SVGPath();
      for(int p = 0; p < chres.size(); p++) {
        Vector cur = cent.plusTimes(chres.get(p), i);
        path.drawTo(cur);
      }
      path.close();
      Element ellipse = path.makeElement(svgp);
      SVGUtil.addCSSClass(ellipse, EMBORDER + cnum);
      if(opacStyle == 1) {
        CSSClass cls = new CSSClass(null, "temp");
        double s = (i >= 1 && i <= sigma.length) ? sigma[i - 1] : 0.0;
        cls.setStatement(SVGConstants.CSS_FILL_OPACITY_PROPERTY, s);
View Full Code Here

    return chres;
  }

  protected void drawHullArc(int cnum, Vector cent, Polygon chres) {
    for(int i = 1; i <= times; i++) {
      SVGPath path = new SVGPath();

      ArrayList<Vector> delta = new ArrayList<Vector>(chres.size());
      for(int p = 0; p < chres.size(); p++) {
        Vector prev = chres.get((p - 1 + chres.size()) % chres.size());
        Vector curr = chres.get(p);
        Vector next = chres.get((p + 1) % chres.size());
        Vector d1 = next.minus(curr).normalize();
        Vector d2 = curr.minus(prev).normalize();
        delta.add(d1.plus(d2));
        // delta.add(next.minus(prev));
      }

      for(int p = 0; p < chres.size(); p++) {
        Vector cur = cent.plus(chres.get(p));
        Vector nex = cent.plus(chres.get((p + 1) % chres.size()));
        Vector dcur = delta.get(p);
        Vector dnex = delta.get((p + 1) % chres.size());
        drawArc(path, cent, cur, nex, dcur, dnex, i);
      }
      path.close();

      Element ellipse = path.makeElement(svgp);

      SVGUtil.addCSSClass(ellipse, EMBORDER + cnum);
      if(opacStyle == 1) {
        CSSClass cls = new CSSClass(null, "temp");
        double s = (i >= 1 && i <= sigma.length) ? sigma[i - 1] : 0.0;
View Full Code Here

      double step = 1.0;
      if(resolution < dim) {
        step = (double) dim / (double) resolution;
      }

      SVGPath path = new SVGPath();
      for(double id = 0; id < dim; id += step) {
        int i = (int) Math.floor(id);
        path.drawTo(StyleLibrary.SCALE * ratio * (((double) i) / (dim - 1)), StyleLibrary.SCALE * (1.0 - s.getScaled(series.doubleValue(i + 1))));
      }
      Element p = path.makeElement(plot);
      return p;
    }
View Full Code Here

      double right = left;

      SVGPath[] paths = new SVGPath[cols];
      double[] lasty = new double[cols];
      for(int i = 0; i < cols; i++) {
        paths[i] = new SVGPath(xsize * left, ysize * 1);
        lasty[i] = 0;
      }

      // draw histogram lines
      for(Pair<Double, double[]> bin : histogram) {
View Full Code Here

TOP

Related Classes of de.lmu.ifi.dbs.elki.visualization.svg.SVGPath

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.