1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514
|
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/geometry/qgstriangle.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
class QgsTriangle : QgsPolygon
{
%Docstring(signature="appended")
Triangle geometry type.
%End
%TypeHeaderCode
#include "qgstriangle.h"
%End
public:
QgsTriangle() /HoldGIL/;
%Docstring
Constructor for an empty triangle geometry.
%End
QgsTriangle( const QgsPoint &p1, const QgsPoint &p2, const QgsPoint &p3 ) /HoldGIL/;
%Docstring
Construct a QgsTriangle from three :py:class:`QgsPoint`.
:param p1: first point
:param p2: second point
:param p3: third point
%End
explicit QgsTriangle( const QgsPointXY &p1, const QgsPointXY &p2, const QgsPointXY &p3 ) /HoldGIL/;
%Docstring
Construct a QgsTriangle from three :py:class:`QgsPointXY`.
:param p1: first point
:param p2: second point
:param p3: third point
%End
explicit QgsTriangle( QPointF p1, QPointF p2, QPointF p3 ) /HoldGIL/;
%Docstring
Construct a QgsTriangle from three QPointF.
:param p1: first point
:param p2: second point
:param p3: third point
%End
virtual bool operator==( const QgsAbstractGeometry &other ) const /HoldGIL/;
virtual bool operator!=( const QgsAbstractGeometry &other ) const /HoldGIL/;
virtual QString geometryType() const /HoldGIL/;
virtual QgsTriangle *clone() const /Factory/;
virtual void clear();
virtual bool fromWkb( QgsConstWkbPtr &wkbPtr );
virtual bool fromWkt( const QString &wkt );
virtual QDomElement asGml3( QDomDocument &doc, int precision = 17, const QString &ns = "gml", QgsAbstractGeometry::AxisOrder axisOrder = QgsAbstractGeometry::AxisOrder::XY ) const;
virtual QgsPolygon *surfaceToPolygon() const /Factory/;
virtual QgsCurvePolygon *toCurveType() const /Factory/;
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
virtual bool insertVertex( QgsVertexId position, const QgsPoint &vertex );
%Docstring
Inherited method not used. You cannot delete or insert a vertex
directly. Returns always ``False``.
%End
virtual bool moveVertex( QgsVertexId vId, const QgsPoint &newPos );
virtual void setExteriorRing( QgsCurve *ring /Transfer/ );
virtual QgsCurve *boundary() const /Factory/;
QgsPoint vertexAt( int atVertex ) const /HoldGIL/;
%Docstring
Returns coordinates of a vertex.
:param atVertex: index of the vertex
:return: Coordinates of the vertex or empty :py:class:`QgsPoint` on
error (``atVertex`` < 0 or > 3).
%End
QVector<double> lengths() const /HoldGIL/;
%Docstring
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.
Example
-------------------------------------
.. code-block:: python
tri = QgsTriangle( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 5, 5 ) )
tri.lengths()
# [5.0, 5.0, 7.0710678118654755]
QgsTriangle().lengths()
# []
%End
QVector<double> angles() const /HoldGIL/;
%Docstring
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.
Example
-------------------------------------
.. 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()
# []
%End
bool isDegenerate() const /HoldGIL/;
%Docstring
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``.
Example
-------------------------------------
.. 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
%End
bool isIsocele( double lengthTolerance = 0.0001 ) const /HoldGIL/;
%Docstring
Is the triangle isocele (two sides with the same length)?
:param lengthTolerance: The tolerance to use
:return: ``True`` or ``False``. Always ``False`` for empty triangle.
Example
-------------------------------------
.. 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
%End
bool isEquilateral( double lengthTolerance = 0.0001 ) const /HoldGIL/;
%Docstring
Is the triangle equilateral (three sides with the same length)?
:param lengthTolerance: The tolerance to use
:return: ``True`` or ``False``. Always ``False`` for empty triangle.
Example
-------------------------------------
.. 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
%End
bool isRight( double angleTolerance = 0.0001 ) const /HoldGIL/;
%Docstring
Is the triangle right-angled?
:param angleTolerance: The tolerance to use
:return: ``True`` or ``False``. Always ``False`` for empty triangle.
Example
-------------------------------------
.. 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
%End
bool isScalene( double lengthTolerance = 0.0001 ) const /HoldGIL/;
%Docstring
Is the triangle scalene (all sides have different lengths)?
:param lengthTolerance: The tolerance to use
:return: ``True`` or ``False``. Always ``False`` for empty triangle.
Example
-------------------------------------
.. 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
%End
QVector<QgsLineString> altitudes() const /HoldGIL/;
%Docstring
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).
:return: Three altitudes from this triangle. An empty list is returned
for empty triangle.
Example
-------------------------------------
.. 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()
# []
%End
QVector<QgsLineString> medians() const /HoldGIL/;
%Docstring
A median is a segment (defined by a :py:class:`QgsLineString`) from a
vertex to the midpoint of the opposite side.
:return: Three medians from this triangle. An empty list is returned for
empty triangle.
Example
-------------------------------------
.. 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()
# []
%End
QVector<QgsLineString> bisectors( double lengthTolerance = 0.0001 ) const /HoldGIL/;
%Docstring
The segment (defined by a :py:class:`QgsLineString`) returned bisect the
angle of a vertex to the opposite side.
:param lengthTolerance: The tolerance to use.
:return: Three angle bisector from this triangle. An empty list is
returned for empty triangle.
Example
-------------------------------------
.. 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()
# []
%End
QgsTriangle medial() const /HoldGIL/;
%Docstring
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.
Example
-------------------------------------
.. 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 ( )'
%End
QgsPoint orthocenter( double lengthTolerance = 0.0001 ) const /HoldGIL/;
%Docstring
An orthocenter is the point of intersection of the altitudes of a
triangle.
:param lengthTolerance: The tolerance to use
:return: The orthocenter of the triangle. An empty point is returned for
empty triangle.
Example
-------------------------------------
.. 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)'
%End
QgsPoint circumscribedCenter() const /HoldGIL/;
%Docstring
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.
Example
-------------------------------------
.. 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)'
%End
double circumscribedRadius() const /HoldGIL/;
%Docstring
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.
Example
-------------------------------------
.. code-block:: python
tri = QgsTriangle( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 5, 5 ) )
tri.circumscribedRadius()
# 3.5355339059327378
QgsTriangle().circumscribedRadius()
# 0.0
%End
QgsCircle circumscribedCircle() const /HoldGIL/;
%Docstring
Circumscribed circle of the triangle.
:return: The circumbscribed of the triangle with a
:py:class:`QgsCircle`. An empty circle is returned for empty
triangle.
Example
-------------------------------------
.. 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()
%End
QgsPoint inscribedCenter() const /HoldGIL/;
%Docstring
Center of the inscribed circle of the triangle. Z dimension is supported
and is retrieved from the first 3D point amongst vertices.
:return: The center of the inscribed circle of the triangle. An empty
point is returned for empty triangle.
Example
-------------------------------------
.. 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)'
%End
double inscribedRadius() const /HoldGIL/;
%Docstring
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.
Example
-------------------------------------
.. code-block:: python
tri = QgsTriangle( QgsPoint( 0, 0 ), QgsPoint( 0, 5 ), QgsPoint( 5, 5 ) )
tri.inscribedRadius()
# 1.4644660940672622
QgsTriangle().inscribedRadius()
# 0.0
%End
QgsCircle inscribedCircle() const /HoldGIL/;
%Docstring
Inscribed circle of the triangle.
:return: The inscribed of the triangle with a :py:class:`QgsCircle`. An
empty circle is returned for empty triangle.
Example
-------------------------------------
.. 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()
%End
virtual QgsTriangle *createEmptyWithSameType() const /Factory/;
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/geometry/qgstriangle.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
|