You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
}
The text was updated successfully, but these errors were encountered:
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?
The text was updated successfully, but these errors were encountered: