Examples of LineSegment


Examples of com.vividsolutions.jts.geom.LineSegment

      Coordinate seg0, Coordinate seg1)
  {
    if (candidateValue < minClearance) {
      minClearance = candidateValue;
      minClearancePts[0] = new Coordinate(p);
      LineSegment seg = new LineSegment(seg0, seg1);
      minClearancePts[1] = new Coordinate(seg.closestPoint(p));
    }
  }
View Full Code Here

Examples of com.vividsolutions.jts.geom.LineSegment

     * @param seg the encroached segment
     * @param encroachPt the encroaching point
     * @return the point at which to split the encroached segment
     */
    public Coordinate findSplitPoint(Segment seg, Coordinate encroachPt) {
        LineSegment lineSeg = seg.getLineSegment();
        double segLen = lineSeg.getLength();
        double midPtLen = segLen / 2;
        SplitSegment splitSeg = new SplitSegment(lineSeg);

        Coordinate projPt = projectedSplitPoint(seg, encroachPt);
        /**
 
View Full Code Here

Examples of com.vividsolutions.jts.geom.LineSegment

     * @param seg
     * @param encroachPt
     * @return a split point on the segment
     */
    public static Coordinate projectedSplitPoint(Segment seg, Coordinate encroachPt) {
        LineSegment lineSeg = seg.getLineSegment();
        Coordinate projPt = lineSeg.project(encroachPt);
        return projPt;
    }
View Full Code Here

Examples of com.vividsolutions.jts.geom.LineSegment

  /**
   * Add an end cap around point p1, terminating a line segment coming from p0
   */
  public void addLineEndCap(Coordinate p0, Coordinate p1)
  {
    LineSegment seg = new LineSegment(p0, p1);

    LineSegment offsetL = new LineSegment();
    computeOffsetSegment(seg, Position.LEFT, distance, offsetL);
    LineSegment offsetR = new LineSegment();
    computeOffsetSegment(seg, Position.RIGHT, distance, offsetR);

    double dx = p1.x - p0.x;
    double dy = p1.y - p0.y;
    double angle = Math.atan2(dy, dx);
View Full Code Here

Examples of com.vividsolutions.jts.geom.LineSegment

    double bevelMidX = basePt.x + mitreDist * Math.cos(mitreMidAng);
    double bevelMidY = basePt.y + mitreDist * Math.sin(mitreMidAng);
    Coordinate bevelMidPt = new Coordinate(bevelMidX, bevelMidY);
   
    // compute the mitre midline segment from the corner point to the bevel segment midpoint
    LineSegment mitreMidLine = new LineSegment(basePt, bevelMidPt);
   
    // finally the bevel segment endpoints are computed as offsets from
    // the mitre midline
    Coordinate bevelEndLeft = mitreMidLine.pointAlongOffset(1.0, bevelHalfLen);
    Coordinate bevelEndRight = mitreMidLine.pointAlongOffset(1.0, -bevelHalfLen);
   
    if (side == Position.LEFT) {
      segList.addPt(bevelEndLeft);
      segList.addPt(bevelEndRight);
    }
View Full Code Here

Examples of dwlab.shapes.line_segments.LineSegment

   */
  public static void drawPath( LinkedList<Sprite> path, Visualizer visualizer, Color drawingColor ) {
    if( path == null ) return;
    Sprite oldPivot = null;
    for( Sprite pivot: path ) {
      if( oldPivot != null ) ( new LineSegment( pivot, oldPivot ) ).drawUsingVisualizer( visualizer, drawingColor );
      oldPivot = pivot;
    }
  }
View Full Code Here

Examples of dwlab.shapes.line_segments.LineSegment

    for( Sprite pivot1 : graph.contents.keySet() ) {
      for( Sprite pivot2 : graph.contents.keySet() ) {
        if( pivot1 != pivot2 && pivot1.distanceTo( pivot2 ) <= maxDistance ) {
          if( graph.findLineSegment( pivot1, pivot2 ) == null ) {
            boolean passed = true;
            LineSegment newLineSegment = new LineSegment( pivot1, pivot2 );
            for( LinkedList<LineSegment> list : graph.contents.values() ) {
              for( LineSegment lineSegment : list ) {
                if( lineSegment.collidesWithLineSegment( newLineSegment, false ) ) {
                  passed = false;
                  break;
View Full Code Here

Examples of dwlab.shapes.line_segments.LineSegment

    };

    int allPivots[][] = { { -4, -2, -2, -2 }, { -4, -2, -4, 0 }, { -4, 0, -4, 2 }, { -4, 0, -3, 0 }, { 1, -2, -1, -2 }, { -1, -2, -1, 0 }, { -1, 0, 1, 0 },
        { 1, 0, 1, 2 }, { 1, 2, -1, 2 }, { 4, -2, 2, -2 }, { 2, -2, 2, 0 }, { 2, 0, 2, 2 }, { 2, 0, 3, 0 } };
    for( int[] pivots : allPivots ) {
      LineSegment lineSegment = new LineSegment( new Sprite( pivots[ 0 ], pivots[ 1 ] ), new Sprite( pivots[ 2 ], pivots[ 3 ] ) );
      lineSegment.visualizer = visualizer;
      lineSegments.addLast( lineSegment );
    }
  }
View Full Code Here

Examples of gnu.java.awt.java2d.LineSegment

                pathOpen = false;
              }
            break;

          case PathIterator.SEG_LINETO:
            p = (new LineSegment(x, y, coords[0], coords[1])).
              getDisplacedSegments(width/2.0);
            if( !pathOpen )
              {
                start = p[0];
                end = p[1];
                pathOpen = true;
              }
            else
              addSegments(p);

            x = coords[0];
            y = coords[1];
            break;

          case PathIterator.SEG_QUADTO:
            p = (new QuadSegment(x, y, coords[0], coords[1], coords[2],
                                 coords[3])).getDisplacedSegments(width/2.0);
            if( !pathOpen )
              {
                start = p[0];
                end = p[1];
                pathOpen = true;
              }
            else
              addSegments(p);

            x = coords[2];
            y = coords[3];
            break;

          case PathIterator.SEG_CUBICTO:
            p = new CubicSegment(x, y, coords[0], coords[1],
                                 coords[2], coords[3],
                                 coords[4], coords[5]).getDisplacedSegments(width/2.0);
            if( !pathOpen )
              {
                start = p[0];
                end = p[1];
                pathOpen = true;
              }
            else
              addSegments(p);

            x = coords[4];
            y = coords[5];
            break;

          case PathIterator.SEG_CLOSE:
            if (x == x0 && y == y0)
              {
                joinSegments(new Segment[] { start.first, end.first });
              }
            else
              {
                p = (new LineSegment(x, y, x0, y0)).getDisplacedSegments(width / 2.0);
                addSegments(p);
              }
            convertPath(output, start);
            convertPath(output, end);
            start = end = null;
View Full Code Here

Examples of org.geomajas.gwt.client.spatial.LineSegment

    Coordinate snappingPoint = null;
    double currThreshold = threshold;

    for (Coordinate[] coordinateArray : coordinates) {
      for (int j = 1; j < coordinateArray.length; j++) {
        LineSegment line = new LineSegment(coordinateArray[j], coordinateArray[j - 1]);
        double distance = line.distance(original);
        if (distance < currThreshold && distance < ruleDistance) {
          currThreshold = distance;
          minimumDistance = distance;
          snappingPoint = line.nearest(original);
        }
      }
    }

    return snappingPoint;
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.