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

Examples of de.lmu.ifi.dbs.elki.math.linearalgebra.Vector


    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) {
View Full Code Here


  protected void drawHullLines(int cnum, Vector cent, Polygon chres) {
    if(chres.size() > 1) {
      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);
View Full Code Here

  }

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

    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);
View Full Code Here

  }

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

    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));
View Full Code Here

    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);
View Full Code Here

   * @param nex Next point
   * @param scale Scaling factor
   */
  private void drawArc(SVGPath path, Vector cent, Vector pre, Vector nex, Vector oPrev, Vector oNext, double scale) {
    // Delta vectors
    final Vector rPrev = pre.minus(cent);
    final Vector rNext = nex.minus(cent);
    final Vector rPrNe = pre.minus(nex);
    // Scaled fix points
    final Vector sPrev = cent.plusTimes(rPrev, scale);
    final Vector sNext = cent.plusTimes(rNext, scale);
    // Orthogonal vectors to the relative vectors
    // final Vector oPrev = new Vector(rPrev.get(1), -rPrev.get(0));
    // final Vector oNext = new Vector(-rNext.get(1), rNext.get(0));

    // Compute the intersection of rPrev+tp*oPrev and rNext+tn*oNext
    // rPrNe == rPrev - rNext
    final double zp = rPrNe.get(0) * oNext.get(1) - rPrNe.get(1) * oNext.get(0);
    final double zn = rPrNe.get(0) * oPrev.get(1) - rPrNe.get(1) * oPrev.get(0);
    final double n = oPrev.get(1) * oNext.get(0) - oPrev.get(0) * oNext.get(1);
    if(n == 0) {
      LoggingUtil.warning("Parallel?!?");
      path.drawTo(sNext.get(0), sNext.get(1));
      return;
    }
    final double tp = Math.abs(zp / n);
    final double tn = Math.abs(zn / n);
    // LoggingUtil.warning("tp: "+tp+" tn: "+tn);

    // Guide points
    final Vector gPrev = sPrev.plusTimes(oPrev, KAPPA * scale * tp);
    final Vector gNext = sNext.minusTimes(oNext, KAPPA * scale * tn);

    if(!path.isStarted()) {
      path.moveTo(sPrev);
    }
    // path.drawTo(sPrev);
View Full Code Here

          // Reverse anti-clockwise polygons.
          boolean reverse = (p.testClockwise() >= 0);
          Iterator<Vector> it = reverse ? p.descendingIterator() : p.iterator();
          while(it.hasNext()) {
            Vector v = it.next();
            out.writeCharacters(FormatUtil.format(v.getArrayRef(), ","));
            if(compat && (v.getDimensionality() == 2)) {
              out.writeCharacters(",500");
            }
            out.writeCharacters(" ");
          }
          out.writeEndElement(); // close coordinates
View Full Code Here

      System.arraycopy(s, 0, r, 1, dnum);
    }
    if(dnum + 1 < s.length) {
      System.arraycopy(s, dnum + 1, r, dnum + 1, s.length - (dnum + 1));
    }
    return new Vector(r);
  }
View Full Code Here

    }
    r[dnum] = s[0];
    if(dnum + 1 < s.length) {
      System.arraycopy(s, dnum + 1, r, dnum + 1, s.length - (dnum + 1));
    }
    return new Vector(r);
  }
View Full Code Here

    try {
      SVGSimpleLinearAxis.drawAxis(svgp, layer, yscale, 0, ysize, 0, 0, SVGSimpleLinearAxis.LabelStyle.LEFTHAND, context.getStyleLibrary());

      // draw axes that are non-trivial
      final int dimensionality = DatabaseUtil.dimensionality(relation);
      double orig = proj.fastProjectScaledToRender(new Vector(dimensionality));
      for(int d = 0; d < dimensionality; d++) {
        Vector v = new Vector(dimensionality);
        v.set(d, 1);
        // projected endpoint of axis
        double ax = proj.fastProjectScaledToRender(v);
        if(ax != orig) {
          final double left = (orig / Projection.SCALE + 0.5) * xsize;
          final double right = (ax / Projection.SCALE + 0.5) * xsize;
 
View Full Code Here

TOP

Related Classes of de.lmu.ifi.dbs.elki.math.linearalgebra.Vector

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.