Opened 11 years ago
Last modified 11 years ago
#633 closed defect
Mismatch segment sides in OffsetCurveBuilder — at Version 4
Reported by: | mloskot | Owned by: | strk |
---|---|---|---|
Priority: | major | Milestone: | 3.4.0 |
Component: | Core | Version: | main |
Severity: | Significant | Keywords: | history |
Cc: |
Description (last modified by )
This ticket follows bug fix committed in r3817.
There are several more places that need to be reviewed in OffsetCurveBuilder.cpp file, Position::LEFT in
- line 221 in OffsetCurveBuilder::computeLineBufferCurve
- line 275 in OffsetCurveBuilder::computeSingleSidedBufferCurve
should likely read Position::RIGHT.
As shown in the test case, the problem is that for the given LINESTRING:
LINESTRING (665.7317504882812500 133.0762634277343700, 1774.4752197265625000 19.9391822814941410, 756.2413940429687500 466.8306579589843700, 626.1337890625000000 1898.0147705078125000, 433.8007202148437500 404.6052856445312500)
right-side curve has 0 vertices:
BufferParameters params; params.setJoinStyle(BufferParameters::JOIN_MITRE); params.setMitreLimit(5.57F); // somewhere between 5.5 and 5.6 params.setSingleSided(true); BufferBuilder builder(params); builder.bufferLineSingleSided(input, distance, true); // 5-vertex output builder.bufferLineSingleSided(input, distance, false); // 0-vertex output
However, attempt to fix those causes unit tests failures for the buffer operation.
Change History (5)
comment:1 by , 11 years ago
comment:2 by , 11 years ago
Please revert the change if you don't have time to carefully fix all occurrences. In its current incarnation the file only generate the curve on the left, so normal buffer should be broken. I'm surprised it works at all... (not tested)
comment:3 by , 11 years ago
I see that some significant comments are missing from the GEOS code in comparison to JTS code, for example in computeOffsetCurve method:
if (isRightSide) { //---------- compute points for right side of line ... // since we are traversing line in opposite order, offset position is still LEFT else { //--------- compute points for left side of line
by , 11 years ago
Attachment: | BufferBuilderTest.cpp added |
---|
Test used to reproduce the problem reported.
comment:4 by , 11 years ago
Description: | modified (diff) |
---|
I guess the user classes of OffsetCurveBuilder (BufferBuilder, most likely) is in agreement about the swap, so that if you swap flags in OffsetCurveBuilder you should also swap them outside.
Order of API importance is (most important to least important): C-API, BufferOp, BufferBuilder, OffsetCurveBuilder. I don't care if OffsetCurveBuilder changes semantic of LEFT:RIGHT (if previous was wrong) as long as BufferOp doesn't show any difference outside.