addMitreJoin method
Adds a mitre join connecting the two reflex offset segments. The mitre will be beveled if it exceeds the mitre ratio limit.
@param offset0 the first offset segment @param offset1 the second offset segment @param distance the offset distance
Implementation
void addMitreJoin(
Coordinate p, LineSegment offset0, LineSegment offset1, double distance) {
/**
* This computation is unstable if the offset segments are nearly collinear.
* However, this situation should have been eliminated earlier by the check
* for whether the offset segment endpoints are almost coincident
*/
Coordinate? intPt = Intersection.intersection(
offset0.p0, offset0.p1, offset1.p0, offset1.p1);
if (intPt != null) {
double mitreRatio =
distance <= 0.0 ? 1.0 : intPt.distance(p) / distance.abs();
if (mitreRatio <= bufParams.getMitreLimit()) {
segList.addPt(intPt);
return;
}
}
// at this point either intersection failed or mitre limit was exceeded
addLimitedMitreJoin(offset0, offset1, distance, bufParams.getMitreLimit());
// addBevelJoin(offset0, offset1);
}