313 QVector<QgsPoint> northQuadrant() const
SIP_FACTORY;
322 bool contains( const
QgsPoint &point,
double epsilon = 1E-8 ) const;
326 QString toString(
int pointPrecision = 17,
int radiusPrecision = 17,
int azimuthPrecision = 2 ) const override;
374 static
int calculateSegments(
double radius,
double parameter,
int minSegments,
Qgis::SegmentCalculationMethod method );
378 SIP_PYOBJECT __repr__();
381 = QStringLiteral(
"<QgsCircle: %1>" ).arg( sipCpp->toString() );
382 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
414 static int calculateSegmentsStandard(
double radius,
double tolerance,
int minSegments )
416 if ( tolerance >= radius )
422 const double halfAngle = std::acos( 1.0 - tolerance / radius );
423 const int segments = std::ceil( M_PI / halfAngle );
425 return std::max( segments, minSegments );
461 static int calculateSegmentsAdaptive(
double radius,
double tolerance,
int minSegments )
464 const double adaptiveTolerance = tolerance * std::sqrt( radius ) / std::log10( radius + 1.0 );
466 if ( adaptiveTolerance >= radius )
471 const double halfAngle = std::acos( 1.0 - adaptiveTolerance / radius );
472 const int segments = std::ceil( M_PI / halfAngle );
474 return std::max( segments, minSegments );
518 static int calculateSegmentsByAreaError(
double radius,
double baseTolerance,
int minSegments )
522 const double decimalTolerance = baseTolerance / 100.0;
525 const double tolerance = std::max( decimalTolerance, 1.0e-8 );
528 const double requiredSegments = M_PI * std::sqrt( 2.0 / ( 3.0 * tolerance ) );
530 return std::max(
static_cast<int>( std::ceil( requiredSegments ) ), minSegments );
553 static int calculateSegmentsByConstant(
double radius,
double constant,
int minSegments )
555 return std::max( minSegments,
static_cast<int>( std::ceil( constant * radius ) ) );
Provides global constants and enumerations for use throughout the application.
Abstract base class for all geometries.
static QgsCircle from2Points(const QgsPoint &pt1, const QgsPoint &pt2)
Constructs a circle by 2 points on the circle.
int intersections(const QgsCircle &other, QgsPoint &intersection1, QgsPoint &intersection2, bool useZ=false) const
Calculates the intersections points between this circle and an other circle.
double radius() const
Returns the radius of the circle.
int innerTangents(const QgsCircle &other, QgsPointXY &line1P1, QgsPointXY &line1P2, QgsPointXY &line2P1, QgsPointXY &line2P2) const
Calculates the inner tangent points between this circle and an other circle.
int outerTangents(const QgsCircle &other, QgsPointXY &line1P1, QgsPointXY &line1P2, QgsPointXY &line2P1, QgsPointXY &line2P2) const
Calculates the outer tangent points between this circle and an other circle.
void setRadius(double radius)
Sets the radius of the circle.
static 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=1E-8, const QgsPoint &pos=QgsPoint())
Constructs a circle by 3 tangents on the circle (aka inscribed circle of a triangle).
static QVector< 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=1E-8, const QgsPoint &pos=QgsPoint())
Returns an array of circle constructed by 3 tangents on the circle (aka inscribed circle of a triangl...
static QgsCircle fromCenterDiameter(const QgsPoint ¢er, double diameter, double azimuth=0)
Constructs a circle by a center point and a diameter.
bool tangentToPoint(const QgsPointXY &p, QgsPointXY &pt1, QgsPointXY &pt2) const
Calculates the tangent points between this circle and the point p.
static QgsCircle from3Points(const QgsPoint &pt1, const QgsPoint &pt2, const QgsPoint &pt3, double epsilon=1E-8)
Constructs a circle by 3 points on the circle.
static QgsCircle minimalCircleFrom3Points(const QgsPoint &pt1, const QgsPoint &pt2, const QgsPoint &pt3, double epsilon=1E-8)
Constructs the smallest circle from 3 points.
Circular string geometry type.
QgsPoint center() const
Returns the center point.
double semiMajorAxis() const
Returns the semi-major axis.
static QgsEllipse fromCenterPoint(const QgsPoint &ptc, const QgsPoint &pt1)
Constructs an ellipse by a center point and a another point.
double azimuth() const
Returns the azimuth.
QgsEllipse()=default
Constructor for QgsEllipse.
virtual double perimeter() const
The circumference of the ellipse using first approximation of Ramanujan.
virtual void setSemiMinorAxis(double semiMinorAxis)
Sets the semi-minor axis.
static QgsEllipse fromExtent(const QgsPoint &pt1, const QgsPoint &pt2)
Constructs an ellipse by an extent (aka bounding box / QgsRectangle).
virtual double area() const
The area of the ellipse.
double semiMinorAxis() const
Returns the semi-minor axis.
virtual void setSemiMajorAxis(double semiMajorAxis)
Sets the semi-major axis.
Point geometry type, with support for z-dimension and m-values.
A rectangle specified with double values.