private static LineString getCounterClockWise ( final LineString lineString ) { final Coordinate c0 = lineString . getCoordinateN ( 0 ) ; final Coordinate c1 = lineString . getCoordinateN ( 1 ) ; final Coordinate c2 = lineString . getCoordinateN ( 2 ) ; lineString . apply ( new UpdateZCoordinateSequenceFilter ( 0 , 3 ) ) ; if ( CGAlgorithms . computeOrientation ( c0 , c1 , c2 ) == CGAlgorithms . COUNTERCLOCKWISE ) { return lineString ; } else { return ( LineString ) lineString . reverse ( ) ; } }
Reverse the LineString to be oriented counter - clockwise .