2017-04-27 07:55:22 +02:00
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/geometry/qgstriangle.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
2017-10-29 12:49:09 +01:00
class QgsTriangle : QgsPolygon
2017-03-21 09:50:47 +01:00
{
2017-04-27 07:55:22 +02:00
%Docstring
Triangle geometry type.
2017-12-15 10:36:55 -04:00
2017-04-27 07:55:22 +02:00
.. versionadded:: 3.0
2017-03-21 09:50:47 +01:00
%End
2017-04-27 07:55:22 +02:00
%TypeHeaderCode
#include "qgstriangle.h"
%End
2017-03-21 09:50:47 +01:00
public:
QgsTriangle();
2017-04-27 07:55:22 +02:00
2017-06-01 12:18:43 +02:00
QgsTriangle( const QgsPoint &p1, const QgsPoint &p2, const QgsPoint &p3 );
2017-04-27 07:55:22 +02:00
%Docstring
2017-12-19 11:43:52 -04:00
Construct a QgsTriangle from three :py:class:`QgsPointV2`.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param p1: first point
:param p2: second point
:param p3: third point
2017-04-27 07:55:22 +02:00
%End
2017-06-01 12:18:43 +02:00
explicit QgsTriangle( const QgsPointXY &p1, const QgsPointXY &p2, const QgsPointXY &p3 );
2017-04-27 07:55:22 +02:00
%Docstring
2017-12-19 11:43:52 -04:00
Construct a QgsTriangle from three :py:class:`QgsPoint`.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param p1: first point
:param p2: second point
:param p3: third point
2017-04-27 07:55:22 +02:00
%End
2017-03-21 09:50:47 +01:00
explicit QgsTriangle( const QPointF p1, const QPointF p2, const QPointF p3 );
2017-04-27 07:55:22 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Construct a QgsTriangle from three QPointF.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param p1: first point
:param p2: second point
:param p3: third point
2017-04-27 07:55:22 +02:00
%End
2017-03-21 09:50:47 +01:00
2017-05-10 14:23:28 +02:00
bool operator==( const QgsTriangle &other ) const;
bool operator!=( const QgsTriangle &other ) const;
2017-03-21 09:50:47 +01:00
virtual QString geometryType() const;
2017-10-27 14:29:31 +10:00
2017-04-27 07:55:22 +02:00
virtual QgsTriangle *clone() const /Factory/;
2017-09-19 13:53:56 +10:00
2017-04-27 07:55:22 +02:00
virtual void clear();
virtual bool fromWkb( QgsConstWkbPtr &wkbPtr );
2017-09-19 13:53:56 +10:00
2017-04-27 07:55:22 +02:00
virtual bool fromWkt( const QString &wkt );
2018-04-02 13:53:29 +10:00
virtual QDomElement asGml3( QDomDocument &doc, int precision = 17, const QString &ns = "gml", QgsAbstractGeometry::AxisOrder axisOrder = QgsAbstractGeometry::AxisOrder::XY ) const;
2017-10-26 09:13:08 +10:00
2017-04-27 07:55:22 +02:00
2017-10-29 12:08:07 +01:00
virtual QgsPolygon *surfaceToPolygon() const /Factory/;
2017-04-27 07:55:22 +02:00
2017-09-18 13:33:25 +10:00
virtual QgsCurvePolygon *toCurveType() const /Factory/;
2017-04-27 07:55:22 +02:00
virtual void addInteriorRing( QgsCurve *ring /Transfer/ );
%Docstring
Inherited method not used. You cannot add an interior ring into a triangle.
%End
virtual bool deleteVertex( QgsVertexId position );
%Docstring
Inherited method not used. You cannot delete or insert a vertex directly. Returns always false.
%End
2017-06-01 12:18:43 +02:00
virtual bool insertVertex( QgsVertexId position, const QgsPoint &vertex );
2017-04-27 07:55:22 +02:00
%Docstring
Inherited method not used. You cannot delete or insert a vertex directly. Returns always false.
%End
2017-06-01 12:18:43 +02:00
virtual bool moveVertex( QgsVertexId vId, const QgsPoint &newPos );
2017-04-27 07:55:22 +02:00
2017-03-21 09:50:47 +01:00
2017-04-27 07:55:22 +02:00
virtual void setExteriorRing( QgsCurve *ring /Transfer/ );
2017-09-19 13:53:56 +10:00
2017-09-18 14:56:20 +10:00
virtual QgsCurve *boundary() const /Factory/;
2017-04-27 07:55:22 +02:00
2017-06-01 12:18:43 +02:00
QgsPoint vertexAt( int atVertex ) const;
2017-04-27 07:55:22 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns coordinates of a vertex.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param atVertex: index of the vertex
:return: Coordinates of the vertex or QgsPoint(0,0) on error (``atVertex`` < 0 or > 3).
2017-04-27 07:55:22 +02:00
%End
2017-03-21 09:50:47 +01:00
QVector<double> lengths() const;
2017-04-27 07:55:22 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns the three lengths of the triangle.
:return: Lengths of triangle ABC where [AB] is at 0, [BC] is at 1, [CA] is at 2.
An empty list is returned for empty triangle.
2018-05-24 21:21:14 +10:00
* Example:
2017-12-19 16:36:51 -04:00
.. code-block:: python
tri = QgsTriangle( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 5, 5 ) )
tri.lengths()
# [5.0, 5.0, 7.0710678118654755]
QgsTriangle().lengths()
# []
2017-04-27 07:55:22 +02:00
%End
2017-03-21 09:50:47 +01:00
QVector<double> angles() const;
2017-04-27 07:55:22 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns the three angles of the triangle.
:return: Angles in radians of triangle ABC where angle BAC is at 0, angle ABC is at 1, angle BCA is at 2.
An empty list is returned for empty triangle.
2018-05-24 21:21:14 +10:00
* Example:
2017-12-19 16:36:51 -04:00
.. code-block:: python
tri = QgsTriangle( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 5, 5 ) )
[math.degrees(i) for i in tri.angles()]
# [45.0, 90.0, 45.0]
QgsTriangle().angles()
# []
2017-04-27 07:55:22 +02:00
%End
2017-03-21 09:50:47 +01:00
2017-10-26 13:30:32 +02:00
bool isDegenerate();
%Docstring
2017-12-15 10:36:55 -04:00
Convenient method checking if the geometry is degenerate (have duplicate or colinear point(s)).
:return: True if the triangle is degenerate or empty, otherwise false.
2018-05-24 21:21:14 +10:00
Example:
2017-12-19 16:36:51 -04:00
.. code-block:: python
tri = QgsTriangle()
tri.isDegenerate()
# True
tri = QgsTriangle( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 5, 5 ) )
tri.isDegenerate()
# False
tri = QgsTriangle( QgsPoint( 0, 0 ), QgsPoint( 5, 5 ), QgsPoint( 10, 10 ) )
tri.isDegenerate()
# True
tri = QgsTriangle( QgsPoint( 0, 0 ), QgsPoint( 0, 0 ), QgsPoint( 5, 5 ) )
tri.isDegenerate()
# True
2017-10-26 13:30:32 +02:00
%End
2017-03-21 09:50:47 +01:00
bool isIsocele( double lengthTolerance = 0.0001 ) const;
2017-04-27 07:55:22 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Is the triangle isocele (two sides with the same length)?
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param lengthTolerance: The tolerance to use
:return: True or False. Always false for empty triangle.
2018-05-24 21:21:14 +10:00
* Example:
2017-12-19 16:36:51 -04:00
.. code-block:: python
tri = QgsTriangle( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 5, 5 ) )
tri.lengths()
# [5.0, 5.0, 7.0710678118654755]
tri.isIsocele()
# True
# length of [AB] == length of [BC]
QgsTriangle().isIsocele()
# False
2017-04-27 07:55:22 +02:00
%End
2017-03-21 09:50:47 +01:00
bool isEquilateral( double lengthTolerance = 0.0001 ) const;
2017-04-27 07:55:22 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Is the triangle equilateral (three sides with the same length)?
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param lengthTolerance: The tolerance to use
:return: True or False. Always false for empty triangle.
2018-05-24 21:21:14 +10:00
* Example:
2017-12-19 16:36:51 -04:00
.. code-block:: python
tri = QgsTriangle( QgsPoint( 10, 10 ), QgsPoint( 16, 10 ), QgsPoint( 13, 15.1962 ) )
tri.lengths()
# [6.0, 6.0000412031918575, 6.0000412031918575]
tri.isEquilateral()
# True
# All lengths are close to 6.0
QgsTriangle().isEquilateral()
# False
2017-04-27 07:55:22 +02:00
%End
2017-03-21 09:50:47 +01:00
bool isRight( double angleTolerance = 0.0001 ) const;
2017-04-27 07:55:22 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Is the triangle right-angled?
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param angleTolerance: The tolerance to use
:return: True or False. Always false for empty triangle.
2018-05-24 21:21:14 +10:00
* Example:
2017-12-19 16:36:51 -04:00
.. code-block:: python
tri = QgsTriangle( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 5, 5 ) )
[math.degrees(i) for i in tri.angles()]
# [45.0, 90.0, 45.0]
tri.isRight()
# True
# angle of ABC == 90
QgsTriangle().isRight()
# False
2017-04-27 07:55:22 +02:00
%End
2017-03-21 09:50:47 +01:00
bool isScalene( double lengthTolerance = 0.0001 ) const;
2017-04-27 07:55:22 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Is the triangle scalene (all sides have differen lengths)?
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param lengthTolerance: The tolerance to use
:return: True or False. Always false for empty triangle.
2018-05-24 21:21:14 +10:00
* Example:
2017-12-19 16:36:51 -04:00
.. code-block:: python
tri = QgsTriangle( QgsPoint( 7.2825, 4.2368 ), QgsPoint( 13.0058, 3.3218 ), QgsPoint( 9.2145, 6.5242 ) )
tri.lengths()
# [5.795980321740233, 4.962793714229921, 2.994131386562721]
tri.isScalene()
# True
# All lengths are different
QgsTriangle().isScalene()
# False
2017-04-27 07:55:22 +02:00
%End
2017-03-21 09:50:47 +01:00
2017-07-19 09:19:37 +02:00
QVector<QgsLineString> altitudes() const;
2017-04-27 07:55:22 +02:00
%Docstring
2017-12-19 11:43:52 -04:00
An altitude is a segment (defined by a :py:class:`QgsLineString`) from a vertex to the opposite side (or, if necessary, to the extension of the opposite side).
2017-12-15 10:36:55 -04:00
:return: Three altitudes from this triangle.
An empty list is returned for empty triangle.
2018-05-24 21:21:14 +10:00
* Example:
2017-12-19 16:36:51 -04:00
.. code-block:: python
tri = QgsTriangle( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 5, 5 ) )
[alt.asWkt() for alt in tri.altitudes()]
# ['LineString (0 0, 0 5)', 'LineString (0 5, 2.5 2.5)', 'LineString (5 5, 0 5)']
QgsTriangle().altitudes()
# []
2017-04-27 07:55:22 +02:00
%End
2017-07-19 09:19:37 +02:00
QVector<QgsLineString> medians() const;
2017-04-27 07:55:22 +02:00
%Docstring
2017-12-19 11:43:52 -04:00
A median is a segment (defined by a :py:class:`QgsLineString`) from a vertex to the midpoint of the opposite side.
2017-12-15 10:36:55 -04:00
:return: Three medians from this triangle.
An empty list is returned for empty triangle.
2018-05-24 21:21:14 +10:00
* Example:
2017-12-19 16:36:51 -04:00
.. code-block:: python
tri = QgsTriangle( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 5, 5 ) )
[med.asWkt() for med in tri.medians()]
# ['LineString (0 0, 2.5 5)', 'LineString (0 5, 2.5 2.5)', 'LineString (5 5, 0 2.5)']
QgsTriangle().medians()
# []
2017-04-27 07:55:22 +02:00
%End
2017-03-21 09:50:47 +01:00
QVector<QgsLineString> bisectors( double lengthTolerance = 0.0001 ) const;
2017-04-27 07:55:22 +02:00
%Docstring
2017-12-19 11:43:52 -04:00
The segment (defined by a :py:class:`QgsLineString`) returned bisect the angle of a vertex to the opposite side.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param lengthTolerance: The tolerance to use.
:return: Three angle bisector from this triangle.
An empty list is returned for empty triangle.
2018-05-24 21:21:14 +10:00
* Example:
2017-12-19 16:36:51 -04:00
.. code-block:: python
tri = QgsTriangle( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 5, 5 ) )
[bis.asWkt() for bis in tri.bisectors()]
# ['LineString (0 0, 2.07106781186547462 5)', 'LineString (0 5, 2.5 2.5)', 'LineString (5 5, 0 2.92893218813452538)']
QgsTriangle().bisectors()
# []
2017-04-27 07:55:22 +02:00
%End
2017-03-21 09:50:47 +01:00
2017-07-19 09:19:37 +02:00
QgsTriangle medial() const;
2017-04-27 07:55:22 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Medial (or midpoint) triangle of a triangle ABC is the triangle with vertices at the midpoints of the triangle's sides.
:return: The medial from this triangle.
An empty triangle is returned for empty triangle.
2018-05-24 21:21:14 +10:00
* Example:
2017-12-19 16:36:51 -04:00
.. code-block:: python
tri = QgsTriangle( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 5, 5 ) )
tri.medial().asWkt()
# 'Triangle ((0 2.5, 2.5 5, 2.5 2.5, 0 2.5))'
QgsTriangle().medial().asWkt()
# 'Triangle ( )'
2017-04-27 07:55:22 +02:00
%End
2017-06-01 12:18:43 +02:00
QgsPoint orthocenter( double lengthTolerance = 0.0001 ) const;
2017-04-27 07:55:22 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
An orthocenter is the point of intersection of the altitudes of a triangle.
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param lengthTolerance: The tolerance to use
:return: The orthocenter of the triangle.
An empty point is returned for empty triangle.
2018-05-24 21:21:14 +10:00
* Example:
2017-12-19 16:36:51 -04:00
.. code-block:: python
tri = QgsTriangle( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 5, 5 ) )
tri.orthocenter().asWkt()
# 'Point (0 5)'
QgsTriangle().orthocenter().asWkt()
# 'Point (0 0)'
2017-04-27 07:55:22 +02:00
%End
2017-04-12 14:38:07 +02:00
2017-07-19 09:19:37 +02:00
QgsPoint circumscribedCenter() const;
2017-04-27 07:55:22 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Center of the circumscribed circle of the triangle.
:return: The center of the circumscribed circle of the triangle.
An empty point is returned for empty triangle.
2018-05-24 21:21:14 +10:00
* Example:
2017-12-19 16:36:51 -04:00
.. code-block:: python
tri = QgsTriangle( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 5, 5 ) )
tri.circumscribedCenter().asWkt()
# 'Point (2.5 2.5)'
QgsTriangle().circumscribedCenter().asWkt()
# 'Point (0 0)'
2017-04-27 07:55:22 +02:00
%End
2017-07-19 09:19:37 +02:00
double circumscribedRadius() const;
2017-04-27 07:55:22 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Radius of the circumscribed circle of the triangle.
:return: The radius of the circumscribed circle of the triangle.
0.0 is returned for empty triangle.
2018-05-24 21:21:14 +10:00
* Example:
2017-12-19 16:36:51 -04:00
.. code-block:: python
tri = QgsTriangle( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 5, 5 ) )
tri.circumscribedRadius()
# 3.5355339059327378
QgsTriangle().circumscribedRadius()
# 0.0
2017-04-27 07:55:22 +02:00
%End
2017-07-19 09:19:37 +02:00
QgsCircle circumscribedCircle() const;
2017-04-27 07:55:22 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Circumscribed circle of the triangle.
2017-12-19 11:43:52 -04:00
:return: The circumbscribed of the triangle with a :py:class:`QgsCircle`.
2017-12-15 10:36:55 -04:00
An empty circle is returned for empty triangle.
2018-05-24 21:21:14 +10:00
Example:
2017-12-19 16:36:51 -04:00
.. code-block:: python
tri = QgsTriangle( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 5, 5 ) )
tri.circumscribedCircle()
# QgsCircle(Point (2.5 2.5), 3.5355339059327378, 0)
QgsTriangle().circumscribedCircle()
# QgsCircle()
2017-04-27 07:55:22 +02:00
%End
2017-04-12 14:38:07 +02:00
2017-07-19 09:19:37 +02:00
QgsPoint inscribedCenter() const;
2017-04-27 07:55:22 +02:00
%Docstring
2018-01-15 08:31:12 +00:00
Center of the inscribed circle of the triangle. Z dimension is
2018-01-15 13:41:35 +00:00
supported and is retrieved from the first 3D point amongst vertices.
2017-12-15 10:36:55 -04:00
:return: The center of the inscribed circle of the triangle.
An empty point is returned for empty triangle.
2018-05-24 21:21:14 +10:00
* Example:
2017-12-19 16:36:51 -04:00
.. code-block:: python
tri = QgsTriangle( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 5, 5 ) )
tri.inscribedCenter().asWkt()
# 'Point (1.46446609406726225 3.53553390593273775)'
QgsTriangle().inscribedCenter().asWkt()
# 'Point (0 0)'
2017-04-27 07:55:22 +02:00
%End
2017-07-19 09:19:37 +02:00
double inscribedRadius() const;
2017-04-27 07:55:22 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Radius of the inscribed circle of the triangle.
:return: The radius of the inscribed circle of the triangle.
0.0 is returned for empty triangle.
2018-05-24 21:21:14 +10:00
* Example:
2017-12-19 16:36:51 -04:00
.. code-block:: python
tri = QgsTriangle( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 5, 5 ) )
tri.inscribedRadius()
# 1.4644660940672622
QgsTriangle().inscribedRadius()
# 0.0
2017-04-27 07:55:22 +02:00
%End
2017-07-19 09:19:37 +02:00
QgsCircle inscribedCircle() const;
2017-04-27 07:55:22 +02:00
%Docstring
2017-12-15 10:36:55 -04:00
Inscribed circle of the triangle.
2017-12-19 11:43:52 -04:00
:return: The inscribed of the triangle with a :py:class:`QgsCircle`.
2017-12-15 10:36:55 -04:00
An empty circle is returned for empty triangle.
2018-05-24 21:21:14 +10:00
Example:
2017-12-19 16:36:51 -04:00
.. code-block:: python
tri = QgsTriangle( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 5, 5 ) )
tri.inscribedCircle()
# QgsCircle(Point (1.46446609406726225 3.53553390593273775), 1.4644660940672622, 0)
QgsTriangle().inscribedCircle()
# QgsCircle()
2017-04-27 07:55:22 +02:00
%End
2017-10-26 13:30:32 +02:00
2017-10-27 14:29:31 +10:00
virtual QgsTriangle *createEmptyWithSameType() const /Factory/;
2018-02-09 15:57:19 +10:00
2017-03-21 09:50:47 +01:00
};
2017-04-27 07:55:22 +02:00
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/geometry/qgstriangle.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/