Loading...
Searching...
No Matches
quadblocks.h
Go to the documentation of this file.
1
16
17#ifndef OPENSWMMVIS_MESH_QUADBLOCKS_H
18#define OPENSWMMVIS_MESH_QUADBLOCKS_H
19
20#include "mesh/meshquadregion.h"
21
22#include <QPointF>
23#include <QPolygonF>
24#include <QRectF>
25#include <QVector>
26#include <functional>
27
28namespace mesh
29{
30
31struct MeshResult;
32
35 QPointF origin;
36 double pitch = 0.0;
41 int cols = 0, rows = 0;
42 QVector<float> h;
43
51 [[nodiscard]] bool isValid() const
52 {
53 return pitch > 0.0 && cols > 0 && rows > 0 && h.size() == qsizetype(cols) * rows;
54 }
55};
56
59 double minSpacing = 0.0;
60 double bandRatio = 1.3;
64 int maxBlocks = 50000;
65};
66
92 const QVector<QVector<QPointF>> &blockers);
93// Bounded pre-triangulation candidate grid from the immutable size field.
94// No triangle pilot pass is needed. Candidates still require geometric and
95// metric/terrain validation by the joint planner. Zero/unbounded targets are
96// unusable. Cancellation/invalid layouts return an invalid grid.
97QuadBlockGrid quadBlockGridFromField(const QRectF &,double pitch,
98 const std::function<double(const QRectF &)> &maximumSize,
99 const QVector<QVector<QPointF>> &blockers,
100 const std::function<bool()> &cancelled = {},qint64 maximumCells = 1000000);
101
124QVector<QuadRegion> placeQuadBlocks(const QuadBlockGrid &grid, const QuadBlockOptions &options);
125
126} // namespace mesh
127
128#endif // OPENSWMMVIS_MESH_QUADBLOCKS_H
PSLG quad regions (workplans/QUAD_MESHING_REDESIGN_PLAN_2026-09-06.md §3, §4.1): closed polygons insi...
The Qt-facing MeshKit API (meshkit::core_qt, meshkit::model_qt, meshkit::io_qt): mesh value types and...
QuadBlockGrid quadBlockGridFromMesh(const MeshResult &mesh, double pitch, const QVector< QVector< QPointF > > &blockers)
Estimate local equilateral side lengths from triangles and mask existing quads/features.
Definition quadblocks.cpp:6
QVector< QuadRegion > placeQuadBlocks(const QuadBlockGrid &grid, const QuadBlockOptions &options)
Greedily select axis-aligned mapped quad regions from approximately uniform usable grid bands.
Definition quadblocks.cpp:26
QuadBlockGrid quadBlockGridFromField(const QRectF &, double pitch, const std::function< double(const QRectF &)> &maximumSize, const QVector< QVector< QPointF > > &blockers, const std::function< bool()> &cancelled={}, qint64 maximumCells=1000000)
Build a block grid from a size field over a rectangle, before any triangulation (Qt adapter over mesh...
Definition quadblocks.cpp:25
Result of MeshGenerator::generate.
Definition meshresult.h:203
Local cell size on a regular grid; NaN marks unusable cells.
Definition quadblocks.h:34
bool isValid() const
Check the basic grid dimensions, positive pitch and exact h-vector extent.
Definition quadblocks.h:51
int cols
Cells along +x; cell (c, r) is h[r * cols + c].
Definition quadblocks.h:41
QPointF origin
Lower-left corner of cell (0, 0).
Definition quadblocks.h:35
int rows
Cells along +y.
Definition quadblocks.h:41
QVector< float > h
Row-major, cols x rows.
Definition quadblocks.h:42
double pitch
Square cell side in planar mesh units; must be > 0 to be valid.
Definition quadblocks.h:36
Policy for placeQuadBlocks().
Definition quadblocks.h:58
int maxBlocks
Cap on regions returned; <= 0 returns none.
Definition quadblocks.h:64
double minSpacing
Blocks finer than this are not worth a patch.
Definition quadblocks.h:59
int minQuadsPerSide
Fewest quads of the block spacing per rectangle side (each side also spans >= 3 grid cells before it ...
Definition quadblocks.h:63
double bandRatio
Size bands are powers of this.
Definition quadblocks.h:60