Examples of LineSegment


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 com.vividsolutions.jts.geom.LineSegment

                // walk along the linestring until we get to a point where we
                // have two coordinates that straddle the midpoint
                double len = 0d;
                for (int i = 1; i < coords.length; i++) {
                    LineSegment line = new LineSegment(coords[i - 1], coords[i]);
                    len += line.getLength();

                    if (Math.abs(len - mid) < tol) {
                        // close enough
                        return line.getCoordinate(1);
                    }

                    if (len > mid) {
                        // we have gone past midpoint
                        return line.pointAlong(1 - ((len - mid) / line
                                .getLength()));
                    }
                }

                // should never get there
View Full Code Here

Examples of com.vividsolutions.jts.geom.LineSegment

            // walk along the linestring until we get to a point where we
            // have two coordinates that straddle the midpoint
            double len = 0d;
            for (int i = 1; i < coords.length; i++) {
                LineSegment line = new LineSegment(coords[i - 1], coords[i]);
                len += line.getLength();

                if (Math.abs(len - mid) < tol) {
                    // close enough
                    return line.getCoordinate(1);
                }

                if (len > mid) {
                    // we have gone past midpoint
                    return line.pointAlong(1 - ((len - mid) / line
                                .getLength()));
                }
            }

            // should never get there
View Full Code Here

Examples of com.vividsolutions.jts.geom.LineSegment

       }
    
     private void updatePts(Coordinate p, Coordinate seg0, Coordinate seg1)
     {
       minPts[0] = p;
       LineSegment seg = new LineSegment(seg0, seg1);
       minPts[1] = new Coordinate(seg.closestPoint(p));      
     }
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 com.vividsolutions.jts.geom.LineSegment

    } catch (TransformException e) {
      throw new RuntimeException(e.getMessage());
    }
    Coordinate p0 = new Coordinate(dst[0], dst[1]);
    Coordinate p1 = new Coordinate(dst[2], dst[3]);
    LineSegment lineSegment = new LineSegment(p0, p1);
    return lineSegment;
  }
View Full Code Here

Examples of com.vividsolutions.jts.geom.LineSegment

       }
    
     private void updatePts(Coordinate p, Coordinate seg0, Coordinate seg1)
     {
       minPts[0] = p;
       LineSegment seg = new LineSegment(seg0, seg1);
       minPts[1] = new Coordinate(seg.closestPoint(p));      
     }
View Full Code Here

Examples of com.vividsolutions.jts.geom.LineSegment

        double dist = CGAlgorithms3D.distanceSegmentSegment(coord0[i],
            coord0[i + 1], coord1[j], coord1[j + 1]);
        if (dist < minDistance) {
          minDistance = dist;
          // TODO: compute closest pts in 3D
          LineSegment seg0 = new LineSegment(coord0[i], coord0[i + 1]);
          LineSegment seg1 = new LineSegment(coord1[j], coord1[j + 1]);
          Coordinate[] closestPt = seg0.closestPoints(seg1);
          updateDistance(dist,
              new GeometryLocation(line0, i, closestPt[0]),
              new GeometryLocation(line1, j, closestPt[1]),
              flip
View Full Code Here

Examples of com.vividsolutions.jts.geom.LineSegment

    // brute force approach!
    for (int i = 0; i < lineCoord.length - 1; i++) {
      double dist = CGAlgorithms3D.distancePointSegment(coord, lineCoord[i],
          lineCoord[i + 1]);
      if (dist < minDistance) {
        LineSegment seg = new LineSegment(lineCoord[i], lineCoord[i + 1]);
        Coordinate segClosestPoint = seg.closestPoint(coord);
        updateDistance(dist,
            new GeometryLocation(line, i, segClosestPoint),
            new GeometryLocation(point, 0, coord),
            flip);
      }
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.