Loading...
Searching...
No Matches
blocks.hpp
Go to the documentation of this file.
1#include "meshkit/regions.hpp"
18
19#ifndef MESHKIT_NATIVE_QUADBLOCKS_HPP
20#define MESHKIT_NATIVE_QUADBLOCKS_HPP
21
22#include <functional>
23
24namespace meshkit::plan
25{
26
27struct MeshResult;
28
32 double pitch = 0.0;
34 int cols = 0, rows = 0;
38
46 [[nodiscard]] bool isValid() const
47 {
48 return pitch > 0.0 && cols > 0 && rows > 0 && h.size() == std::ptrdiff_t(cols) * rows;
49 }
50};
51
54 double minSpacing = 0.0;
55 double bandRatio = 1.3;
59 int maxBlocks = 50000;
60};
61
87 const Vector<Vector<Point2>> &blockers);
88// Bounded pre-triangulation candidate grid from the immutable size field.
89// No triangle pilot pass is needed. Candidates still require geometric and
90// metric/terrain validation by the joint planner. Zero/unbounded targets are
91// unusable. Cancellation/invalid layouts return an invalid grid.
112QuadBlockGrid quadBlockGridFromField(const Box2 &, double pitch,
113 const std::function<double(const Box2 &)> &maximumSize,
114 const Vector<Vector<Point2>> &blockers,
115 const std::function<bool()> &cancelled = {},
116 std::int64_t maximumCells = 1000000);
117
140Vector<QuadRegion> placeQuadBlocks(const QuadBlockGrid &grid, const QuadBlockOptions &options);
141
142} // namespace meshkit::plan
143
144#endif // MESHKIT_NATIVE_QUADBLOCKS_HPP
Axis-aligned rectangle in the XY plane, stored as an origin corner and a signed size.
Definition geometry.hpp:167
Point or displacement vector in the horizontal (XY) plane.
Definition geometry.hpp:21
std::vector<T> with the QVector-style member names the CDT kernel and plan model use.
Definition storage.hpp:31
The Qt-facing MeshKit API (meshkit::core_qt, meshkit::model_qt, meshkit::io_qt): mesh value types and...
Planning algorithms on standard containers: quad patch planning and placement, size fields,...
Vector< QuadRegion > placeQuadBlocks(const QuadBlockGrid &grid, const QuadBlockOptions &options)
Greedily select axis-aligned mapped quad regions from approximately uniform usable grid bands.
Definition blocks.cpp:208
QuadBlockGrid quadBlockGridFromMesh(const MeshResult &mesh, double pitch, const Vector< Vector< Point2 > > &blockers)
Estimate local equilateral side lengths from triangles and mask existing quads/features.
Definition blocks.cpp:34
QuadBlockGrid quadBlockGridFromField(const Box2 &, double pitch, const std::function< double(const Box2 &)> &maximumSize, const Vector< Vector< Point2 > > &blockers, const std::function< bool()> &cancelled={}, std::int64_t maximumCells=1000000)
Sample a footprint size callback onto a candidate block grid and mask blockers.
Definition blocks.cpp:142
PSLG quad regions (workplans/QUAD_MESHING_REDESIGN_PLAN_2026-09-06.md §3, §4.1): closed polygons insi...
Mesh as read by the native audits: vertices, cells, marked edges and a status.
Definition planmodel.hpp:279
Local cell size on a regular grid; NaN marks unusable cells.
Definition blocks.hpp:30
bool isValid() const
Check the basic grid dimensions, positive pitch and exact h-vector extent.
Definition blocks.hpp:46
int rows
Row count; cell (c, r) covers origin.y() + [r, r + 1] * pitch along Y.
Definition blocks.hpp:34
Point2 origin
Lower-left corner of cell (0, 0).
Definition blocks.hpp:31
int cols
Column count; cell (c, r) covers origin.x() + [c, c + 1] * pitch along X.
Definition blocks.hpp:34
Vector< float > h
Row-major, cols x rows.
Definition blocks.hpp:37
double pitch
Square cell side in planar (XY) units; 0 = no grid.
Definition blocks.hpp:32
Policy for placeQuadBlocks().
Definition blocks.hpp:53
int minQuadsPerSide
Fewest quads of the band spacing along each block side; a candidate rectangle must also span at least...
Definition blocks.hpp:58
double minSpacing
Blocks finer than this are not worth a patch.
Definition blocks.hpp:54
double bandRatio
Size bands are powers of this.
Definition blocks.hpp:55
int maxBlocks
Most regions returned; <= 0 returns none.
Definition blocks.hpp:59