question: public static Geometry bufferBySegments ( Geometry g , double distance ) { Geometry segs = LineHandlingFunctions . extractSegments ( g ) ; double posDist = Math . abs ( distance ) ; Geometry segBuf = bufferByComponents ( segs , posDist ) ; if ( distance < 0.0 ) return g . difference ( segBuf ) ; return g . union ( segBuf ) ; }
target:  Buffer polygons by buffering the individual boundary segments and either unioning or differencing them.