updateNearestLocationsLineLine method

void updateNearestLocationsLineLine(
  1. int i,
  2. Coordinate p0,
  3. Coordinate p1,
  4. FacetSequence facetSeq,
  5. int j,
  6. Coordinate q0,
  7. Coordinate q1,
  8. List<GeometryLocation?>? locs,
)

Implementation

void updateNearestLocationsLineLine(
    int i,
    Coordinate p0,
    Coordinate p1,
    FacetSequence facetSeq,
    int j,
    Coordinate q0,
    Coordinate q1,
    List<GeometryLocation?>? locs) {
  LineSegment seg0 = LineSegment.fromCoordinates(p0, p1);
  LineSegment seg1 = new LineSegment.fromCoordinates(q0, q1);
  List<Coordinate> closestPt = seg0.closestPoints(seg1);
  if(locs != null) {
    locs[0] =
        GeometryLocation(geom!, i, Coordinate.fromCoordinate(closestPt[0]));
    locs[1] = GeometryLocation(
        facetSeq.geom!, j, new Coordinate.fromCoordinate(closestPt[1]));
  }
}