18 #ifndef QGSREGULARPOLYGON_H 19 #define QGSREGULARPOLYGON_H 23 #include "qgis_core.h" 105 double radius()
const {
return mRadius; }
118 double apothem()
const {
return mRadius * std::cos( M_PI / mNumberSides ); }
131 void setCenter(
const QgsPoint ¢er );
138 void setRadius(
double radius );
145 void setFirstVertex(
const QgsPoint &firstVertex );
152 void setNumberSides(
unsigned int numberSides );
179 QVector<QgsTriangle> triangulate()
const;
195 QString toString(
int pointPrecision = 17,
int radiusPrecision = 17,
int anglePrecision = 2 )
const;
200 double interiorAngle()
const;
205 double centralAngle()
const;
217 double perimeter()
const;
223 double length()
const;
228 unsigned int mNumberSides = 0;
229 double mRadius = 0.0;
234 double apothemToRadius(
double apothem,
unsigned int numberSides )
const;
239 double interiorAngle(
unsigned int nbSides )
const;
244 double centralAngle(
unsigned int nbSides )
const;
248 #endif // QGSREGULARPOLYGON_H double radius() const
Returns the radius.
unsigned int numberSides() const
Returns the number of sides of the regular polygon.
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
QgsPoint center() const
Returns the center point of the regular polygon.
bool operator!=(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
Regular Polygon geometry type.
CORE_EXPORT std::unique_ptr< QgsPolygon > toPolygon(const QgsMeshFace &face, const QVector< QgsMeshVertex > &vertices)
Returns face as polygon geometry, caller is responsible for delete.
ConstructionOption
A regular polygon can be constructed inscribed in a circle or circumscribed about a circle...
Point geometry type, with support for z-dimension and m-values.
QVector< QgsPoint > QgsPointSequence
Line string geometry type, with support for z-dimension and m-values.
double apothem() const
Returns the apothem of the regular polygon.
QgsPoint firstVertex() const
Returns the first vertex (corner) of the regular polygon.