org.geotools.geometry.iso.coordinate
Class LineSegmentImpl

java.lang.Object
  extended by org.geotools.geometry.iso.coordinate.CurveSegmentImpl
      extended by org.geotools.geometry.iso.coordinate.LineStringImpl
          extended by org.geotools.geometry.iso.coordinate.LineSegmentImpl
All Implemented Interfaces:
java.io.Serializable, org.opengis.geometry.coordinate.GenericCurve, org.opengis.geometry.coordinate.LineSegment, org.opengis.geometry.coordinate.LineString, org.opengis.geometry.primitive.CurveSegment

public class LineSegmentImpl
extends LineStringImpl
implements org.opengis.geometry.coordinate.LineSegment

Thus its interpolation attribute shall be "linear". The default GenericCurve::parameterization = c(s) is: (L : Distance) = endParam – startParam c(s) = ControlPoint[1]+((s-startParam)/L)*(ControlPoint[2]-ControlPoint[1]) Any other point in the controlPoint array must fall on this line. The control points of a LineSegment shall all lie on the straight line between its start point and end point. Between these two points, other positions may be interpolated linearly. NOTE The linear interpolation, given using a constructive parameter t, 0 ? t ? 1.0, where c(o) = c.startPoint() and c(1)=c.endPoint(), is: c(t) = c(0)(1-t) + c(1)t

Author:
Jackson Roehrig & Sanjay Jena
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.geotools.geometry.iso.coordinate.CurveSegmentImpl
endParam, interpolation, startParam
 
Constructor Summary
LineSegmentImpl(org.opengis.referencing.crs.CoordinateReferenceSystem crs, double[] from, double[] to, double startParam)
          This functionality taken from CoordinateFactory where I am not quite clear as to the purpose (Jody).
LineSegmentImpl(org.opengis.geometry.DirectPosition one, org.opengis.geometry.DirectPosition two, double startParam)
           
LineSegmentImpl(LineSegmentImpl other)
          A LineSegment consists of two distinct DirectPositions (the startPoint and endPoint) joined by a straight line.
LineSegmentImpl(PointArrayImpl pointArray, double startPar)
          The constructor of a LineSegment takes two positions and creates the appropriate line segment joining them.
 
Method Summary
 org.opengis.geometry.DirectPosition forParamInSegment(double dist)
           
 double[] getTangentInSegment(double distance)
          The operation "tangent" shall return the tangent vector along this GenericCurve at the passed parameter value.
 boolean isSimple()
           
static DirectPositionImpl linearInterpolate(org.opengis.geometry.DirectPosition p0, org.opengis.geometry.DirectPosition p1, double par)
          Executes a linear Interpolation between two positions and returns the DirectPosition at the distance 'par' on this straight line This method is NON-ROBUST, e.g.
 
Methods inherited from class org.geotools.geometry.iso.coordinate.LineStringImpl
asLineSegments, asLineString, equals, forConstructiveParam, forParam, getControlPoints, getEndPoint, getEndPosition, getEnvelope, getNumDerivativesAtEnd, getNumDerivativesAtStart, getNumDerivativesInterior, getParamForPoint, getSamplePoints, getStartPoint, getStartPosition, getTangent, hashCode, merge, reverse, split, toString
 
Methods inherited from class org.geotools.geometry.iso.coordinate.CurveSegmentImpl
getBoundary, getCurve, getEndConstructiveParam, getEndParam, getInterpolation, getStartConstructiveParam, getStartParam, length, length, length, setCurve, setEndParam, setInterpolation, setStartParam
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.opengis.geometry.coordinate.LineString
asLineSegments, getControlPoints
 
Methods inherited from interface org.opengis.geometry.primitive.CurveSegment
getBoundary, getCurve, getInterpolation, getNumDerivativesAtEnd, getNumDerivativesAtStart, getNumDerivativesInterior, getSamplePoints, reverse
 
Methods inherited from interface org.opengis.geometry.coordinate.GenericCurve
asLineString, forConstructiveParam, forParam, getEndConstructiveParam, getEndParam, getEndPoint, getParamForPoint, getStartConstructiveParam, getStartParam, getStartPoint, getTangent, length, length
 

Constructor Detail

LineSegmentImpl

public LineSegmentImpl(PointArrayImpl pointArray,
                       double startPar)
The constructor of a LineSegment takes two positions and creates the appropriate line segment joining them. Constructors are class scoped. LineSegment::LineSegment(point[2] : Position) : LineSegment

Parameters:
pointArray -
startPar -

LineSegmentImpl

public LineSegmentImpl(LineSegmentImpl other)
A LineSegment consists of two distinct DirectPositions (the startPoint and endPoint) joined by a straight line. Thus its interpolation attribute is "linear". The default GenericCurve::parameterization = c(s) is: (L : Distance) = endParam - startParam c(s) = ControlPoint[1]+((s-startParam)L)(ControlPoint[2]-ControlPoint[1]) Any other point in the controlPoint array must fall on this line. The control points of a LineSegment lie all on the straight line between its start point and end point. Between these two points, other positions may be interpolated linearly. NOTE The linear interpolation, given using a constructive parameter t, 0<=t<=1.0, where c(o) = c.startPoint() and c(1)=c. endPoint(), is: c(t) = c(0)(1-t) + c(1)t The constructor of a LineSegment takes two positions and creates the appropriate line segment joining them. Constructors are class scoped. LineSegment::LineSegment(point[2] : Position) : LineSegment

Parameters:
other -

LineSegmentImpl

public LineSegmentImpl(org.opengis.referencing.crs.CoordinateReferenceSystem crs,
                       double[] from,
                       double[] to,
                       double startParam)
This functionality taken from CoordinateFactory where I am not quite clear as to the purpose (Jody).

Parameters:
crs -
to -
from -
startParam -

LineSegmentImpl

public LineSegmentImpl(org.opengis.geometry.DirectPosition one,
                       org.opengis.geometry.DirectPosition two,
                       double startParam)
Method Detail

isSimple

public boolean isSimple()

forParamInSegment

public org.opengis.geometry.DirectPosition forParamInSegment(double dist)

linearInterpolate

public static DirectPositionImpl linearInterpolate(org.opengis.geometry.DirectPosition p0,
                                                   org.opengis.geometry.DirectPosition p1,
                                                   double par)
Executes a linear Interpolation between two positions and returns the DirectPosition at the distance 'par' on this straight line This method is NON-ROBUST, e.g. it might suffer by errors caused by the Floating-point arithmetic

Parameters:
p0 - - start position of linear interpolation
p1 - - end position of linear interpolation
par - - distance on the straight line, for which to search DirectPosition (from p0 to p1)
Returns:
Position on the straight line at parameter 'par'

getTangentInSegment

public double[] getTangentInSegment(double distance)
The operation "tangent" shall return the tangent vector along this GenericCurve at the passed parameter value. This vector approximates the derivative of the parameterization of the curve. The tangent shall be a unit vector (have length 1.0), which is consistent with the parameterization by arc length. This function will build the tangent vector at the position defined by the distance. The vector will have his origin at the specified position, and his vectorPosition in direction of the curve If the position, which is defined by the distance, lays on a control point, this control point will be the originPosition of the Vector

Parameters:
distance - a double value
Returns:
a Vector value


Copyright © 1996-2010 Geotools. All Rights Reserved.