org.jaitools.jts
Class LineSmoother

java.lang.Object
  extended by org.jaitools.jts.AbstractSmoother
      extended by org.jaitools.jts.LineSmoother

public class LineSmoother
extends AbstractSmoother

Line smoothing by interpolation with cubic Bazier curves. This code adapts an algorithm which was devised by Maxim Shemanarev for polygons and described by him at: http://www.antigrain.com/research/bezier_interpolation/index.html.

To use the same algorithm for LineStrings we add a dummy vertex to either end, calculate control points for just the real vertices.

Since:
1.1
Version:
$Id$
Author:
Michael Bedward

Nested Class Summary
 
Nested classes/interfaces inherited from class org.jaitools.jts.AbstractSmoother
AbstractSmoother.InterpPoint
 
Field Summary
 
Fields inherited from class org.jaitools.jts.AbstractSmoother
control, DEFAULT_CONTROL, geomFactory, lookup
 
Constructor Summary
LineSmoother()
          Default constructor.
LineSmoother(com.vividsolutions.jts.geom.GeometryFactory geomFactory)
          Constructor.
 
Method Summary
 com.vividsolutions.jts.geom.LineString smooth(com.vividsolutions.jts.geom.LineString ls, double alpha)
          Creates a new LineString which is a smoothed version of the input LineString.
 
Methods inherited from class org.jaitools.jts.AbstractSmoother
cubicBezier, getInterpPoints, setControl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LineSmoother

public LineSmoother()
Default constructor.


LineSmoother

public LineSmoother(com.vividsolutions.jts.geom.GeometryFactory geomFactory)
Constructor.

Parameters:
geomFactory - an instance of GeometryFactory to use when creating smoothed Geometry objects
Throws:
IllegalArgumentException - if geomFactory is null
Method Detail

smooth

public com.vividsolutions.jts.geom.LineString smooth(com.vividsolutions.jts.geom.LineString ls,
                                                     double alpha)
Creates a new LineString which is a smoothed version of the input LineString.

Parameters:
ls - the input LineString
alpha - a value between 0 and 1 (inclusive) specifying the tightness of fit of the smoothed boundary (0 is loose)
Returns:
the smoothed LineString


Copyright © 2009-2013. All Rights Reserved.