Class: QgsTessellator¶
- class qgis.core.QgsTessellator¶
Bases:
sip.wrapper
Class that takes care of tessellation of polygons into triangles.
It is expected that client code will create the tessellator object, then repeatedly call
addPolygon()
method that will generate triangles, and finally calldata()
to get final vertex data.Optionally provides extrusion by adding triangles that serve as walls when extrusion height is non-zero.
New in version 3.4.
QgsTessellator(originX: float, originY: float, addNormals: bool, invertNormals: bool = False, addBackFaces: bool = False, noZ: bool = False, addTextureCoords: bool = False, facade: int = 3, textureRotation: float = 0) Creates tessellator with a specified origin point of the world (in map coordinates)
QgsTessellator(bounds:
QgsRectangle
, addNormals: bool, invertNormals: bool = False, addBackFaces: bool = False, noZ: bool = False, addTextureCoords: bool = False, facade: int = 3, textureRotation: float = 0) Creates tessellator with a specifiedbounds
of input geometry coordinates. This constructor allows the tessellator to map input coordinates to a desirable range for numerical stability during calculations.If
noZ
isTrue
, then a 2-dimensional tessellation only will be performed and all z coordinates will be ignored.New in version 3.10.
QgsTessellator(
QgsTessellator
)Methods
Tessellates a triangle and adds its vertex entries to the output data array
Returns array of triangle vertex data
Returns the number of vertices stored in the output data array
Returns size of one vertex entry in bytes
Returns maximal Z value of the data (in world coordinates)
Returns minimal Z value of the data (in world coordinates)
- addPolygon(self, polygon: QgsPolygon, extrusionHeight: float)¶
Tessellates a triangle and adds its vertex entries to the output data array
- Parameters:
polygon (QgsPolygon) –
extrusionHeight (float) –
- data(self) List[float] ¶
Returns array of triangle vertex data
Vertice coordinates are stored as (x, z, -y)
- Return type:
List[float]
- dataVerticesCount(self) int ¶
Returns the number of vertices stored in the output data array
- Return type:
int
- stride(self) int ¶
Returns size of one vertex entry in bytes
- Return type:
int
- zMaximum(self) float ¶
Returns maximal Z value of the data (in world coordinates)
New in version 3.12.
- Return type:
float
- zMinimum(self) float ¶
Returns minimal Z value of the data (in world coordinates)
New in version 3.12.
- Return type:
float