I'm imagining that this issue is not uncommon. Wondering what sort of settings I need to be using to rid myself of these ugly triangles. Low mitre limit doesn't help, and I think I've tried all possible combos of endCapStyle and joinStyle. Any ideas?
private fun offsetPolyline(originalPolyline: ArrayList<Point3D>, offsetDistance: Double, closed: Boolean): ArrayList<Point3D> {
val geometryFactory = GeometryFactory()
// Step 1: Convert the ArrayList of Point3D into a Coordinate array for JTS
val coordinates = originalPolyline.map { Coordinate(it.x, it.y) }.toTypedArray()
// Step 2: Use JTS OffsetCurveBuilder to offset the Coordinate array
val bufferParameters = BufferParameters(18)
bufferParameters.joinStyle = JOIN_MITRE
bufferParameters.endCapStyle = CAP_FLAT
bufferParameters.mitreLimit = 1.0
val curveBuilder = OffsetCurveBuilder(geometryFactory.precisionModel, bufferParameters)
val offsetCoordinates = curveBuilder.getOffsetCurve(coordinates, offsetDistance)
// Step 3: Convert the resulting Coordinate array back to ArrayList<Point3D>
val offsetPolyline = ArrayList<Point3D>()
for (coordinate in offsetCoordinates) {
offsetPolyline.add(Point3D(coordinate.x, coordinate.y, 0.0, 0.0))
}
return offsetPolyline
}
I'm imagining that this issue is not uncommon. Wondering what sort of settings I need to be using to rid myself of these ugly triangles. Low mitre limit doesn't help, and I think I've tried all possible combos of endCapStyle and joinStyle. Any ideas?![image](https://github.com/locationtech/jts/assets/144922796/d1e4018b-d9d5-4818-8488-3f807107e7d9)