[postgis-tickets] [PostGIS] #4336: ST_LineToCurve generates wrong Arcs for Epsilon 1E-1 (+ potential fix)

PostGIS trac at osgeo.org
Fri Mar 1 00:57:04 PST 2019


#4336: ST_LineToCurve generates wrong Arcs for Epsilon  1E-1 (+ potential fix)
-------------------------+---------------------------
  Reporter:  tvijlbrief  |      Owner:  pramsey
      Type:  defect      |     Status:  new
  Priority:  medium      |  Milestone:  PostGIS 2.5.2
 Component:  postgis     |    Version:  2.4.x
Resolution:              |   Keywords:
-------------------------+---------------------------

Comment (by tvijlbrief):

 I think this is a better alternative for the original angle test (use
 epsilon):

                 int a2_side = lw_segment_side(t1, t3, t2);
                 int b_side  = lw_segment_side(t1, t3, tb);
 #if 0 // old code
                 double angle1 = lw_arc_angle(t1, t2, t3);
                 double angle2 = lw_arc_angle(t2, t3, tb);

                 /* Is the angle similar to the previous one ? */
                 diff = fabs(angle1 - angle2);
                 LWDEBUGF(4, " angle1: %g, angle2: %g, diff:%g", angle1,
 angle2, diff);
                 if ( diff > angle1 / 4 || diff > angle2 / 4)
 #else // use Epsilon distance
                 double distance3 = distance2d_pt_pt(t3, tb);
                 diff = fabs(distance3 - distance2);
                 if ( diff > 2 * EPSILON_SQLMM )
 #endif
                 {
                         return LW_FALSE;
                 }

-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/4336#comment:1>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-tickets mailing list