Package toxi.geom

Examples of toxi.geom.Vec2D.distanceTo()


  }

  public SketchShape getOverShape(float x, float y) {
    Vec2D closePoint = getClosestPointAlongPath(x, y);
    if (closePoint != null
        && closePoint.distanceTo(new Vec2D(x, y)) < SETTINGS_SKETCH.SELECT_EDGE_DIST) {
      this.lastMouseOverVec = closePoint;
      this.lastMouseOverPercent = getClosestPercent(x, y);
      return this;
    }
    return null;
View Full Code Here


              nextP.getControlPoint1().x, nextP.x, t);
          float y = functions.bezierPoint(curP.y,
              curP.getControlPoint2().y,
              nextP.getControlPoint1().y, nextP.y, t);

          length += lastMeasuredPoint.distanceTo(new Vec2D(x, y));
          lastMeasuredPoint = new Vec2D(x, y);

          if (length >= destLen)
            return new SketchPoint(x, y);
View Full Code Here

    Vec2D outlineP = this.getPath().getClosestPointAlongPath(x, y);

    if (mPos == null || centreP == null || outlineP == null)
      return null;

    if (centreP.distanceTo(mPos) < outlineP.distanceTo(mPos))
      return centreP;
    else
      return outlineP;

  }
View Full Code Here

    Vec2D foundVec = null;
    float dist = 0;

    for (int i = 0; i < getCentrePath().size(); i++) {
      Vec2D vec = (Vec2D) getCentrePath().get(i);
      if (vec.distanceTo(selectedNode) < dist || foundVec == null) {
        dist = vec.distanceTo(selectedNode);
        foundVec = vec;
      }
    }
View Full Code Here

    float dist = 0;

    for (int i = 0; i < getCentrePath().size(); i++) {
      Vec2D vec = (Vec2D) getCentrePath().get(i);
      if (vec.distanceTo(selectedNode) < dist || foundVec == null) {
        dist = vec.distanceTo(selectedNode);
        foundVec = vec;
      }
    }

    return foundVec;
View Full Code Here

    int index = -1;
    float dist = 0;

    for (int i = 0; i < getCentrePath().size(); i++) {
      Vec2D vec = (Vec2D) getCentrePath().get(i);
      if (vec.distanceTo(selectedNode) < dist || index == -1) {
        dist = vec.distanceTo(selectedNode);
        index = i;
      }
    }
View Full Code Here

    float dist = 0;

    for (int i = 0; i < getCentrePath().size(); i++) {
      Vec2D vec = (Vec2D) getCentrePath().get(i);
      if (vec.distanceTo(selectedNode) < dist || index == -1) {
        dist = vec.distanceTo(selectedNode);
        index = i;
      }
    }

    return index;
View Full Code Here

    if (closePoint != null)
      distToClosePoint = closePoint.distanceTo(new Vec2D(x, y));

    if (closePointCentre != null)
      distToClosePointCentre = closePointCentre
          .distanceTo(new Vec2D(x, y));

    if (closePoint != null && (distToClosePoint <= distToClosePointCentre)
        && distToClosePoint < SETTINGS_SKETCH.SELECT_EDGE_DIST) {
      this.path.lastMouseOverVec = closePoint;
View Full Code Here

      if (curSketch instanceof SketchPath
          || curSketch instanceof SketchSpline) {
        Vec2D pointOnPath = curSketch.getClosestPointAlongPath(x, y);

        if ((pointOnPath != null && closestPoint == null)
            || (pointOnPath != null && pointOnPath
                .distanceTo(new Vec2D(x, y)) < closestPoint
                .distanceTo(new Vec2D(x, y)))) {
          closestPoint = new SketchPoint(pointOnPath.copy());
          closestShape = curSketch;
View Full Code Here

      Vec2D closestPointTemp = curSketch.getClosestPointAlongPath(mouseX,
          mouseY);

      if (returnShape == null
          || closestPointTemp.distanceTo(mPos) < closestDist) {
        closestDist = closestPointTemp.distanceTo(mPos);
        returnShape = curSketch;
      }

    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.