Package de.lmu.ifi.dbs.elki.math

Examples of de.lmu.ifi.dbs.elki.math.ConvexHull2D


  protected void redraw() {
    addCSSClasses(svgp);
    DBIDSelection selContext = context.getSelection();
    if(selContext != null) {
      DBIDs selection = selContext.getSelectedIds();
      ConvexHull2D hull = new ConvexHull2D();
      for(DBID i : selection) {
        try {
          hull.add(new Vector(proj.fastProjectDataToRenderSpace(rel.get(i))));
        }
        catch(ObjectNotFoundException e) {
          // 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);
View Full Code Here


    for(int cnum = 0; cnum < clustering.getAllClusters().size(); cnum++) {
      Cluster<?> clus = ci.next();

      final DBIDs ids = clus.getIDs();
      ConvexHull2D hull = new ConvexHull2D();

      for(DBID clpnum : ids) {
        double[] projP = proj.fastProjectDataToRenderSpace(rel.get(clpnum).getColumnVector());
        hull.add(new Vector(projP));
      }
      Polygon chres = hull.getHull();

      // Plot the convex hull:
      if(chres != null) {
        SVGPath path = new SVGPath(chres);
        // Approximate area (using bounding box)
View Full Code Here

      layer.appendChild(ellipse);
    }
  }

  protected Polygon makeHull(Vector[] pc) {
    ConvexHull2D hull = new ConvexHull2D();

    Vector diag = new Vector(0, 0);
    for(int j = 0; j < pc.length; j++) {
      hull.add(pc[j]);
      hull.add(pc[j].times(-1));
      for(int k = j + 1; k < pc.length; k++) {
        Vector q = pc[k];
        Vector ppq = pc[j].plus(q).timesEquals(MathUtil.SQRTHALF);
        Vector pmq = pc[j].minus(q).timesEquals(MathUtil.SQRTHALF);
        hull.add(ppq);
        hull.add(ppq.times(-1));
        hull.add(pmq);
        hull.add(pmq.times(-1));
      }
      diag.plusEquals(pc[j]);
    }
    diag.timesEquals(1.0 / Math.sqrt(pc.length));
    hull.add(diag);
    hull.add(diag.times(-1));

    Polygon chres = hull.getHull();
    return chres;
  }
View Full Code Here

    Polygon chres = hull.getHull();
    return chres;
  }

  protected Polygon makeHullComplex(Vector[] pc) {
    ConvexHull2D hull = new ConvexHull2D();

    Vector diag = new Vector(0, 0);
    for(int j = 0; j < pc.length; j++) {
      hull.add(pc[j]);
      hull.add(pc[j].times(-1));
      for(int k = j + 1; k < pc.length; k++) {
        Vector q = pc[k];
        Vector ppq = pc[j].plus(q).timesEquals(MathUtil.SQRTHALF);
        Vector pmq = pc[j].minus(q).timesEquals(MathUtil.SQRTHALF);
        hull.add(ppq);
        hull.add(ppq.times(-1));
        hull.add(pmq);
        hull.add(pmq.times(-1));
        for(int l = k + 1; l < pc.length; l++) {
          Vector r = pc[k];
          Vector ppqpr = ppq.plus(r).timesEquals(Math.sqrt(1 / 3.));
          Vector pmqpr = pmq.plus(r).timesEquals(Math.sqrt(1 / 3.));
          Vector ppqmr = ppq.minus(r).timesEquals(Math.sqrt(1 / 3.));
          Vector pmqmr = pmq.minus(r).timesEquals(Math.sqrt(1 / 3.));
          hull.add(ppqpr);
          hull.add(ppqpr.times(-1));
          hull.add(pmqpr);
          hull.add(pmqpr.times(-1));
          hull.add(ppqmr);
          hull.add(ppqmr.times(-1));
          hull.add(pmqmr);
          hull.add(pmqmr.times(-1));
        }
      }
      diag.plusEquals(pc[j]);
    }
    diag.timesEquals(1.0 / Math.sqrt(pc.length));
    hull.add(diag);
    hull.add(diag.times(-1));
    Polygon chres = hull.getHull();
    return chres;
  }
View Full Code Here

TOP

Related Classes of de.lmu.ifi.dbs.elki.math.ConvexHull2D

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.