Have you tested with fairly wiggly lines? The OffsetCurveLineBuilder does not produce a single smooth line - where there are concave angles it introduces "closing arcs", which are probably not what you want.


Jeff Adams wrote:
Thanks for help on the point.

Is generating the offset line is more complicated than what the OffsetCurveBuilder is already doing? It seems like if you copy the source for OffsetCurveBuilder and modified it like so:

public LineString getLineCurve(LineString input, double distance, bool doLeftSide)
  {
    Coordinate[] inputPts = input.GetCoordinates();
    // a zero or negative width buffer of a line/point is empty
    if (distance <= 0.0) return lineList;

    init(distance);
    computeLineBufferCurve(inputPts, doLeftSide);
    Coordinate[] lineCoord = getCoordinates();
    return new LineString(lineCoord)
  }

private void computeLineBufferCurve(Coordinate[] inputPts, bool doLeftSide)
  {
    int n = inputPts.length - 1;
if (doLeftSide) {
        // compute points for left side of line
        initSideSegments(inputPts[0], inputPts[1], Position.LEFT);
        for (int i = 2; i <= n; i++) {
          addNextSegment(inputPts[i], true);
        }
    } else {
        // compute points for right side of line
        initSideSegments(inputPts[n], inputPts[n - 1], Position.LEFT);
        for (int i = n - 2; i >= 0; i--) {
          addNextSegment(inputPts[i], true);
        }
    }
    addLastSegment();
closePts();
  }

Isn't that awfully close to what I want to do?


On Thu, Aug 7, 2008 at 1:53 PM, Martin Davis <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote:

    Constructing an offset point from a line is straightforward.   Use
    LengthIndexedLine.extractPoint(index, offset) - for your example,
    this would look like:  extractPoint(0.25, 10)

    Currently there's no way to compute an offset linestring.  This
    would be a nice feature to have, alright.  There's some complexity
    involved in implementing it for the general case, which is one
    reason I haven't tackled this yet.

    Jeff Adams wrote:

        My apologies if this has already been discussed, but I
        couldn't find a way to search the archive.

        I need to construct, at a minimum, a single point offset to
        one side (right or left) of an input line, given a % distance
        along the line (I.E. 25% from the start point, 10 feet offset
        to the left).

        It would also work for my purposes to construct an entire
        matching line offset to the right or left, which might be a
        more generically useful thing to do.

        Is there a way to do this using JTS (well, technically I'm
        using NTS)?  The closest thing I could find was the
        OffsetCurveBuilder, but that produces points offset around all
        sides.  I can hack up the source code to just do what I want,
        but it seems like this is something that might/should be
        possible using the normal interfaces?

        Thanks,
        Jeff
        ------------------------------------------------------------------------

        _______________________________________________
        jts-devel mailing list
        [email protected]
        <mailto:[email protected]>
        http://lists.refractions.net/mailman/listinfo/jts-devel

-- Martin Davis
    Senior Technical Architect
    Refractions Research, Inc.
    (250) 383-3022

    _______________________________________________
    jts-devel mailing list
    [email protected]
    <mailto:[email protected]>
    http://lists.refractions.net/mailman/listinfo/jts-devel


------------------------------------------------------------------------

_______________________________________________
jts-devel mailing list
[email protected]
http://lists.refractions.net/mailman/listinfo/jts-devel

--
Martin Davis
Senior Technical Architect
Refractions Research, Inc.
(250) 383-3022

_______________________________________________
jts-devel mailing list
[email protected]
http://lists.refractions.net/mailman/listinfo/jts-devel

Reply via email to