Bug report #16722

Wrong result for curveToLine with max angle 70 on a semicircle

Added by Sandro Santilli over 7 years ago. Updated about 7 years ago.

Status:Closed
Priority:Normal
Assignee:Sandro Santilli
Category:Geometry
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:Yes Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:24621

Description

This code snippet shows how a MaxAngle:70-degrees linearization of a curve gives a wrong result:

  wkt = QStringLiteral( "CIRCULARSTRING(0 0,100 100,200 0)" );                  
  circularString.reset( dynamic_cast<QgsCircularString *>( QgsGeometryFactory::geomFromWkt( wkt ) ) );
  QVERIFY( circularString.get() );                                              
  lineString.reset( circularString->curveToLine( 70 * M_PI / 180.0 ) );         
  QVERIFY( lineString.get() );                                                  
  //lineString->asWkt();                                                        
std::cout << "XXX --- " << lineString->asWkt().toStdString() << std::endl;

You can see the resulting line here:

Expected resulting line (obtained via PostGIS ongoing work https://gitlab.com/postgis/postgis/merge_requests/3) is this:


Related issues

Related to QGIS Application - Bug report #16717: curveToLine introduces duplicated points Closed 2017-06-17

Associated revisions

Revision 48c95399
Added by Sandro Santilli about 7 years ago

Refactor curveToLine to emit equidistant segments and fix some issues

Fixes #16717
Fixes #16722

Include tests

History

#1 Updated by Sandro Santilli over 7 years ago

#2 Updated by Sandro Santilli over 7 years ago

  • Assignee set to Sandro Santilli
  • Status changed from Open to In Progress

#4 Updated by Sandro Santilli over 7 years ago

  • Pull Request or Patch supplied changed from No to Yes

The PR now also contains a fix for this bug

#5 Updated by Sandro Santilli about 7 years ago

  • % Done changed from 0 to 100
  • Status changed from In Progress to Closed

Also available in: Atom PDF