~ubuntu-branches/ubuntu/utopic/qgis/utopic

« back to all changes in this revision

Viewing changes to src/core/spatialindex/geometry/LineSegment.cc

  • Committer: Package Import Robot
  • Author(s): Francesco Paolo Lovergine
  • Date: 2012-04-24 15:12:20 UTC
  • mfrom: (3.1.9 sid)
  • Revision ID: package-import@ubuntu.com-20120424151220-r88g00af5fpn5fc3
Tags: 1.7.4+1.7.5~20120320-1
The "Sometimes they come back" release.

* Branching from Qgis tree and adapting to current Debian Policy and
  standards. The target tree is currently set to release-1.7.
  (closes: #661491, #606304, #615683, #616182, #600308)
* Policy bumped to 3.9.3.
* Moving to debhelper compatibility level 9.
* Source format is now 3.0 with quilt support.
* Merged with 2bf42287 upstream git snapshot.
* Migrated to dh_python2 instead of python-central.
  (closes: #617048)
* Snapshot in qgis.org release-1.7: c936d031
* Added an automagic creation of a lintian override for sqlite embedding.
  This is required for uploading currently.
* Added missing ${misc:Depends} to make lintian happy.
* Copyright notes updated and debian/copyright moved to format 1.0.
* More licenses notices now reported in debian/copyright. Thanks ftpmasters.

Show diffs side-by-side

added added

removed removed

Lines of Context:
177
177
  for ( unsigned long cDim = 0; cDim < m_dimension; cDim++ )
178
178
  {
179
179
    coords[cDim] =
180
 
      ( std::abs( m_pStartPoint[cDim] - m_pEndPoint[cDim] ) / 2.0 ) +
181
 
      std::min( m_pStartPoint[cDim], m_pEndPoint[cDim] );
 
180
      ( qAbs( m_pStartPoint[cDim] - m_pEndPoint[cDim] ) / 2.0 ) +
 
181
      qMin( m_pStartPoint[cDim], m_pEndPoint[cDim] );
182
182
  }
183
183
 
184
184
  out = Point( coords, m_dimension );
198
198
 
199
199
  for ( unsigned long cDim = 0; cDim < m_dimension; cDim++ )
200
200
  {
201
 
    low[cDim] = std::min( m_pStartPoint[cDim], m_pEndPoint[cDim] );
202
 
    high[cDim] = std::max( m_pStartPoint[cDim], m_pEndPoint[cDim] );
 
201
    low[cDim] = qMin( m_pStartPoint[cDim], m_pEndPoint[cDim] );
 
202
    high[cDim] = qMax( m_pStartPoint[cDim], m_pEndPoint[cDim] );
203
203
  }
204
204
 
205
205
  out = Region( low, high, m_dimension );
247
247
    );
248
248
 
249
249
  if ( m_pEndPoint[0] >= m_pStartPoint[0] - std::numeric_limits<double>::epsilon() &&
250
 
       m_pEndPoint[0] <= m_pStartPoint[0] + std::numeric_limits<double>::epsilon() ) return std::abs( p.m_pCoords[0] - m_pStartPoint[0] );
 
250
       m_pEndPoint[0] <= m_pStartPoint[0] + std::numeric_limits<double>::epsilon() ) return qAbs( p.m_pCoords[0] - m_pStartPoint[0] );
251
251
 
252
252
  if ( m_pEndPoint[1] >= m_pStartPoint[1] - std::numeric_limits<double>::epsilon() &&
253
 
       m_pEndPoint[1] <= m_pStartPoint[1] + std::numeric_limits<double>::epsilon() ) return std::abs( p.m_pCoords[1] - m_pStartPoint[1] );
 
253
       m_pEndPoint[1] <= m_pStartPoint[1] + std::numeric_limits<double>::epsilon() ) return qAbs( p.m_pCoords[1] - m_pStartPoint[1] );
254
254
 
255
255
  double x1 = m_pStartPoint[0];
256
256
  double x2 = m_pEndPoint[0];
259
259
  double y2 = m_pEndPoint[1];
260
260
  double y0 = p.m_pCoords[1];
261
261
 
262
 
  return std::abs(( x2 - x1 ) *( y1 - y0 ) - ( x1 - x0 ) *( y2 - y1 ) ) / ( std::sqrt(( x2 - x1 ) *( x2 - x1 ) + ( y2 - y1 ) *( y2 - y1 ) ) );
 
262
  return qAbs(( x2 - x1 ) *( y1 - y0 ) - ( x1 - x0 ) *( y2 - y1 ) ) / ( std::sqrt(( x2 - x1 ) *( x2 - x1 ) + ( y2 - y1 ) *( y2 - y1 ) ) );
263
263
}
264
264
 
265
265
// assuming moving from start to end, positive distance is from right hand side.
325
325
  coords[1] = r.m_pLow[1];
326
326
  double d4 = getRelativeMinimumDistance( Point( coords, 2 ) );
327
327
 
328
 
  return std::max( d1, std::max( d2, std::max( d3, d4 ) ) );
 
328
  return qMax( d1, qMax( d2, qMax( d3, d4 ) ) );
329
329
}
330
330
 
331
331
double Tools::Geometry::LineSegment::getAngleOfPerpendicularRay()