Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
more const in qgscircle
  • Loading branch information
lbartoletti authored and nyalldawson committed Sep 24, 2021
1 parent fdfad2b commit 9e363a4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions python/core/auto_generated/geometry/qgscircle.sip.in
Expand Up @@ -95,7 +95,7 @@ The azimuth is the angle between ``center`` and ``pt1``.
const QgsPoint &pt1_tg2, const QgsPoint &pt2_tg2,
const QgsPoint &pt1_tg3, const QgsPoint &pt2_tg3,
double epsilon = 1E-8,
QgsPoint pos = QgsPoint() ) /HoldGIL/;
const QgsPoint pos = QgsPoint() ) /HoldGIL/;
%Docstring
Constructs a circle by 3 tangents on the circle (aka inscribed circle of a triangle).
Z and m values are dropped for the center point.
Expand Down Expand Up @@ -131,7 +131,7 @@ Example
const QgsPoint &pt1_tg2, const QgsPoint &pt2_tg2,
const QgsPoint &pt1_tg3, const QgsPoint &pt2_tg3,
double epsilon = 1E-8,
QgsPoint pos = QgsPoint() ) /HoldGIL/;
const QgsPoint &pos = QgsPoint() ) /HoldGIL/;
%Docstring
Returns an array of circle constructed by 3 tangents on the circle (aka inscribed circle of a triangle).

Expand Down
7 changes: 4 additions & 3 deletions src/core/geometry/qgscircle.cpp
Expand Up @@ -21,6 +21,7 @@
#include "qgstriangle.h"

#include <memory>
#include <utility>

QgsCircle::QgsCircle() :
QgsEllipse( QgsPoint(), 0.0, 0.0, 0.0 )
Expand Down Expand Up @@ -188,7 +189,7 @@ QgsCircle QgsCircle::fromCenterPoint( const QgsPoint &center, const QgsPoint &pt
return QgsCircle( centerPt, centerPt.distance( pt1 ), azimuth );
}

static QVector<QgsCircle> from2ParallelsLine( const QgsPoint &pt1_par1, const QgsPoint &pt2_par1, const QgsPoint &pt1_par2, const QgsPoint &pt2_par2, const QgsPoint &pt1_line1, const QgsPoint &pt2_line1, QgsPoint pos, double epsilon )
static QVector<QgsCircle> from2ParallelsLine( const QgsPoint &pt1_par1, const QgsPoint &pt2_par1, const QgsPoint &pt1_par2, const QgsPoint &pt2_par2, const QgsPoint &pt1_line1, const QgsPoint &pt2_line1, const QgsPoint &pos, double epsilon )
{
const double radius = QgsGeometryUtils::perpendicularSegment( pt1_par2, pt1_par1, pt2_par1 ).length() / 2.0;

Expand Down Expand Up @@ -274,7 +275,7 @@ static QVector<QgsCircle> from2ParallelsLine( const QgsPoint &pt1_par1, const Qg
return circles;
}

QVector<QgsCircle> QgsCircle::from3TangentsMulti( const QgsPoint &pt1_tg1, const QgsPoint &pt2_tg1, const QgsPoint &pt1_tg2, const QgsPoint &pt2_tg2, const QgsPoint &pt1_tg3, const QgsPoint &pt2_tg3, double epsilon, QgsPoint pos )
QVector<QgsCircle> QgsCircle::from3TangentsMulti( const QgsPoint &pt1_tg1, const QgsPoint &pt2_tg1, const QgsPoint &pt1_tg2, const QgsPoint &pt2_tg2, const QgsPoint &pt1_tg3, const QgsPoint &pt2_tg3, double epsilon, const QgsPoint &pos )
{
QgsPoint p1, p2, p3;
bool isIntersect_tg1tg2 = false;
Expand Down Expand Up @@ -316,7 +317,7 @@ QVector<QgsCircle> QgsCircle::from3TangentsMulti( const QgsPoint &pt1_tg1, const

QgsCircle QgsCircle::from3Tangents( const QgsPoint &pt1_tg1, const QgsPoint &pt2_tg1, const QgsPoint &pt1_tg2, const QgsPoint &pt2_tg2, const QgsPoint &pt1_tg3, const QgsPoint &pt2_tg3, double epsilon, QgsPoint pos )
{
const QVector<QgsCircle> circles = from3TangentsMulti( pt1_tg1, pt2_tg1, pt1_tg2, pt2_tg2, pt1_tg3, pt2_tg3, epsilon, pos );
const QVector<QgsCircle> circles = from3TangentsMulti( pt1_tg1, pt2_tg1, pt1_tg2, pt2_tg2, pt1_tg3, pt2_tg3, epsilon, std::move( pos ) );
if ( circles.length() != 1 )
return QgsCircle();
return circles.at( 0 );
Expand Down
4 changes: 2 additions & 2 deletions src/core/geometry/qgscircle.h
Expand Up @@ -132,7 +132,7 @@ class CORE_EXPORT QgsCircle : public QgsEllipse
const QgsPoint &pt1_tg2, const QgsPoint &pt2_tg2,
const QgsPoint &pt1_tg3, const QgsPoint &pt2_tg3,
double epsilon = 1E-8,
QgsPoint pos = QgsPoint() ) SIP_HOLDGIL;
const QgsPoint pos = QgsPoint() ) SIP_HOLDGIL;

/**
* Returns an array of circle constructed by 3 tangents on the circle (aka inscribed circle of a triangle).
Expand Down Expand Up @@ -178,7 +178,7 @@ class CORE_EXPORT QgsCircle : public QgsEllipse
const QgsPoint &pt1_tg2, const QgsPoint &pt2_tg2,
const QgsPoint &pt1_tg3, const QgsPoint &pt2_tg3,
double epsilon = 1E-8,
QgsPoint pos = QgsPoint() ) SIP_HOLDGIL;
const QgsPoint &pos = QgsPoint() ) SIP_HOLDGIL;

/**
* Constructs a circle by an extent (aka bounding box / QgsRectangle).
Expand Down

0 comments on commit 9e363a4

Please sign in to comment.