/** * Compute the width information for a ring of {@link Coordinate}s. * Leaves the width information in the instance variables. * * @param pts * @return */ void MinimumDiameter::computeConvexRingMinDiameter(const CoordinateSequence* pts) { minWidth=DoubleInfinity; int currMaxIndex=1; LineSegment* seg=new LineSegment(); // compute the max distance for all segments in the ring, and pick the minimum for (int i = 0; i < pts->getSize()-1; i++) { seg->p0=pts->getAt(i); seg->p1=pts->getAt(i + 1); currMaxIndex=findMaxPerpDistance(pts, seg, currMaxIndex); } delete seg; }
/** * Compute the width information for a ring of {@link Coordinate}s. * Leaves the width information in the instance variables. * * @param pts * @return */ void MinimumDiameter::computeConvexRingMinDiameter(const CoordinateSequence* pts) { minWidth=DoubleMax; unsigned int currMaxIndex=1; LineSegment seg; // compute the max distance for all segments in the ring, and pick the minimum const std::size_t npts=pts->getSize(); for (std::size_t i=1; i<npts; ++i) { seg.p0=pts->getAt(i-1); seg.p1=pts->getAt(i); currMaxIndex=findMaxPerpDistance(pts, &seg, currMaxIndex); } }