QgsTessellator class

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 call data() to get final vertex data.

Optionally provides extrusion by adding triangles that serve as walls when extrusion height is non-zero.

Constructors, destructors, conversion operators

QgsTessellator(double originX, double originY, bool addNormals, bool invertNormals = false, bool addBackFaces = false)
Creates tessellator with a specified origin point of the world (in map coordinates)

Public functions

void addPolygon(const QgsPolygon& polygon, float extrusionHeight)
Tessellates a triangle and adds its vertex entries to the output data array.
auto asMultiPolygon() const -> std::unique_ptr<QgsMultiPolygon>
Returns the triangulation as a multipolygon geometry.
auto data() const -> QVector<float>
Returns array of triangle vertex data.
auto dataVerticesCount() const -> int
Returns the number of vertices stored in the output data array.
auto stride() const -> int
Returns size of one vertex entry in bytes.

Function documentation

QVector<float> QgsTessellator::data() const

Returns array of triangle vertex data.

Vertice coordinates are stored as (x, z, -y)