Skip to content
Permalink
Browse files
Replace transferFirstZValueToPoint by transferFirstZOrMValueToPoint
  • Loading branch information
lbartoletti authored and nyalldawson committed Jun 9, 2021
1 parent 250cb97 commit a13e2137222471e4667711e0453cd93b9352609f
Showing with 9 additions and 9 deletions.
  1. +4 −4 src/core/geometry/qgscircle.cpp
  2. +4 −4 src/core/geometry/qgsellipse.cpp
  3. +1 −1 src/core/geometry/qgstriangle.cpp
@@ -40,7 +40,7 @@ QgsCircle QgsCircle::from2Points( const QgsPoint &pt1, const QgsPoint &pt2 )
double azimuth = QgsGeometryUtils::lineAngle( pt1.x(), pt1.y(), pt2.x(), pt2.y() ) * 180.0 / M_PI;
double radius = pt1.distance( pt2 ) / 2.0;

QgsGeometryUtils::transferFirstZValueToPoint( QgsPointSequence() << pt1 << pt2, center );
QgsGeometryUtils::transferFirstZOrMValueToPoint( QgsPointSequence() << pt1 << pt2, center );

return QgsCircle( center, radius, azimuth );
}
@@ -141,7 +141,7 @@ QgsCircle QgsCircle::from3Points( const QgsPoint &pt1, const QgsPoint &pt2, cons
double bSlope = yDelta_b / xDelta_b;

// set z coordinate for center
QgsGeometryUtils::transferFirstZValueToPoint( QgsPointSequence() << p1 << p2 << p3, center );
QgsGeometryUtils::transferFirstZOrMValueToPoint( QgsPointSequence() << p1 << p2 << p3, center );

if ( ( std::fabs( xDelta_a ) <= epsilon ) && ( std::fabs( yDelta_b ) <= epsilon ) )
{
@@ -183,7 +183,7 @@ QgsCircle QgsCircle::fromCenterPoint( const QgsPoint &center, const QgsPoint &pt
double azimuth = QgsGeometryUtils::lineAngle( center.x(), center.y(), pt1.x(), pt1.y() ) * 180.0 / M_PI;

QgsPoint centerPt( center );
QgsGeometryUtils::transferFirstZValueToPoint( QgsPointSequence() << center << pt1, centerPt );
QgsGeometryUtils::transferFirstZOrMValueToPoint( QgsPointSequence() << center << pt1, centerPt );

return QgsCircle( centerPt, centerPt.distance( pt1 ), azimuth );
}
@@ -388,7 +388,7 @@ QgsCircle QgsCircle::fromExtent( const QgsPoint &pt1, const QgsPoint &pt2 )
}

QgsPoint center = QgsGeometryUtils::midpoint( pt1, pt2 );
QgsGeometryUtils::transferFirstZValueToPoint( QgsPointSequence() << pt1 << pt2, center );
QgsGeometryUtils::transferFirstZOrMValueToPoint( QgsPointSequence() << pt1 << pt2, center );

return QgsCircle( center, delta_x / 2.0, 0 );
}
@@ -57,7 +57,7 @@ QgsEllipse QgsEllipse::fromFoci( const QgsPoint &pt1, const QgsPoint &pt2, const
double axis_a = dist / 2.0;
double axis_b = std::sqrt( std::pow( axis_a, 2.0 ) - std::pow( dist_p1p2 / 2.0, 2.0 ) );

QgsGeometryUtils::transferFirstZValueToPoint( QgsPointSequence() << pt1 << pt2 << pt3, center );
QgsGeometryUtils::transferFirstZOrMValueToPoint( QgsPointSequence() << pt1 << pt2 << pt3, center );

return QgsEllipse( center, axis_a, axis_b, azimuth );
}
@@ -69,7 +69,7 @@ QgsEllipse QgsEllipse::fromExtent( const QgsPoint &pt1, const QgsPoint &pt2 )
double axis_b = std::fabs( pt2.y() - pt1.y() ) / 2.0;
double azimuth = 90.0;

QgsGeometryUtils::transferFirstZValueToPoint( QgsPointSequence() << pt1 << pt2, center );
QgsGeometryUtils::transferFirstZOrMValueToPoint( QgsPointSequence() << pt1 << pt2, center );

return QgsEllipse( center, axis_a, axis_b, azimuth );
}
@@ -81,7 +81,7 @@ QgsEllipse QgsEllipse::fromCenterPoint( const QgsPoint &center, const QgsPoint &
double azimuth = 90.0;

QgsPoint centerPt( center );
QgsGeometryUtils::transferFirstZValueToPoint( QgsPointSequence() << center << pt1, centerPt );
QgsGeometryUtils::transferFirstZOrMValueToPoint( QgsPointSequence() << center << pt1, centerPt );

return QgsEllipse( centerPt, axis_a, axis_b, azimuth );
}
@@ -96,7 +96,7 @@ QgsEllipse QgsEllipse::fromCenter2Points( const QgsPoint &center, const QgsPoint
double axis_b = center.distance( pp );

QgsPoint centerPt( center );
QgsGeometryUtils::transferFirstZValueToPoint( QgsPointSequence() << center << pt1 << pt2, centerPt );
QgsGeometryUtils::transferFirstZOrMValueToPoint( QgsPointSequence() << center << pt1 << pt2, centerPt );

return QgsEllipse( centerPt, axis_a, axis_b, azimuth );
}
@@ -588,7 +588,7 @@ QgsPoint QgsTriangle::inscribedCenter() const

QgsPointSequence points;
points << vertexAt( 0 ) << vertexAt( 1 ) << vertexAt( 2 );
QgsGeometryUtils::transferFirstZValueToPoint( points, center );
QgsGeometryUtils::transferFirstZOrMValueToPoint( points, center );

return center;
}

0 comments on commit a13e213

Please sign in to comment.