Distance-to-feature field sampled as a max-area function.
More...
#include <meshkit/sizefield.hpp>
|
| double | minimumSizeInBox (const Box2 &) const |
| | Conservative lower bound on the target edge length over a box.
|
| |
| double | minimumTerrainSizeInBox (const Box2 &) const |
| | Includes finer directional source bounds without changing nominal sizing.
|
| |
| bool | build (const Box2 &bbox, const Vector< ConstraintSegment > &segs, const Vector< Vector< Point2 > > &rings, const Vector< SteinerPoint > &pts, const SizeFieldOptions &opt) |
| | Replace this field with sampled feature-distance, terrain and region size bounds.
|
| |
| double | targetAreaAt (double x, double y) const |
| | Read the sampled equilateral-triangle area cap at a mesh coordinate.
|
| |
| double | sizeAt (double x, double y) const |
| | Bilinearly read the combined gradation-relaxed target edge length.
|
| |
| bool | isValid () const |
| | Check whether stored grid dimensions are positive.
|
| |
| bool | hasSizeBound () const |
| | Check whether the valid field reports a positive size at its first grid-center coordinate.
|
| |
| double | pitch () const |
| | Read the background grid spacing retained by the latest layout attempt.
|
| |
| int | cols () const |
| | Read the number of grid columns.
|
| |
| int | rows () const |
| | Read the number of grid rows.
|
| |
| double | distanceAt (double x, double y) const |
| | Bilinearly read the approximate chamfer distance-to-feature grid.
|
| |
Distance-to-feature field sampled as a max-area function.
Build once per generation, then install hook.targetAreaAt = [&f](double x, double y){ return f.targetAreaAt(x,y); }. The field must outlive the mesh generation call that samples it.
◆ build()
Replace this field with sampled feature-distance, terrain and region size bounds.
- Parameters
-
| [in] | bbox | Borrowed finite valid positive-width/height rectangle in mesh planar units, unchanged. |
| [in] | segs | Borrowed feature paths, every consecutive segment seeds; finite coordinates and all grid/segment-step integer conversions must be representable, including features outside bbox. |
| [in] | rings | Borrowed additional paths, consecutive segments seed; repeat the first point to close a ring, because no implicit closing segment is added. Empty/one-point paths contribute nothing. |
| [in] | pts | Borrowed Steiner points; only nonzero-marker points seed, unchanged. |
| [in] | opt | Borrowed sizing policy: positive finite nearSize/gradation, maxGridCells>=9; lengths in mesh units and areaFloor in squared units. Positive finite maxSize is an upper source bound; nonpositive/nonfinite maxSize is disabled. Terrain callback executes synchronously per grid center, returns a positive finite size or no bound, must not mutate/reenter this object; exceptions propagate. |
- Returns
- False with cleared arrays/zero dimensions for invalid grid layout/budget. Also false, after the dimensions are set (so isValid() stays true), when a terrainRegions entry has a non-positive or non-finite size: trust the return value, not isValid(). True after size construction, including valid unbounded seedless fields. Grid allocation may reach twice maxGridCells under the layout's border allowance, and no cancellation/error-text channel is provided. Old field is discarded at entry; allocation/callback exceptions can leave partial state that must be rebuilt. Copies numeric grids, retains no feature/policy/callback references; no geometry/engine mutation. Read-only queries may run concurrently only after successful build and without mutation.
Build the field. Returns false for a degenerate bbox or nonsensical options (see the return value for when isValid() still holds). Without seeds each cell starts at maxSize or unbounded; terrain and region terms can supply local sizes. No size sources is a valid unbounded field.
segs constraint segments (conduits, aux lines) — every edge seeds. rings additional ring paths to seed (valid hole rings). pts Steiner points; only tagged ones (marker != 0) seed.
◆ cols()
| int meshkit::plan::SizeField::cols |
( |
| ) |
const |
|
inlinenodiscard |
Read the number of grid columns.
- Returns
- Positive count after successful build, zero initially or after checked layout refusal. No allocation, geometry lookup or state mutation.
◆ distanceAt()
| double meshkit::plan::SizeField::distanceAt |
( |
double | x, |
|
|
double | y ) const |
|
nodiscard |
Bilinearly read the approximate chamfer distance-to-feature grid.
- Parameters
-
| [in] | x | Finite mesh-coordinate x; normalized floor and +1 neighbor must fit int. |
| [in] | y | Finite mesh-coordinate y with the same precondition; outside queries clamp to grid edges. |
- Returns
- Distance in planar mesh units, zero for invalid field and unseeded sentinel corner values. Thus zero can mean no seed information as well as coincidence. Sampled chamfer approximation is not an exact Euclidean distance or conservative refinement bound. No allocation/callback/state mutation.
Distance to the nearest seed at (x, y), bilinear over cell centres. Exposed for tests and diagnostics.
◆ hasSizeBound()
| bool meshkit::plan::SizeField::hasSizeBound |
( |
| ) |
const |
|
inlinenodiscard |
Check whether the valid field reports a positive size at its first grid-center coordinate.
- Returns
- isValid() and sizeAt(m_x0,m_y0)>0. Under a successful connected-grid build, a finite source propagates throughout; this is not a geometry-wide exact constraint/coverage certificate. No allocation, callback or mutation; requires stable completed field data.
◆ isValid()
| bool meshkit::plan::SizeField::isValid |
( |
| ) |
const |
|
inlinenodiscard |
Check whether stored grid dimensions are positive.
- Returns
- True for positive rows/columns, including a successfully built unbounded field; false initially or after checked build refusal. Does not verify arrays after an exception, source freshness or size bounds. Constant read-only query; require a completed successful build before sampling.
◆ minimumSizeInBox()
| double meshkit::plan::SizeField::minimumSizeInBox |
( |
const Box2 & | box | ) |
const |
Conservative lower bound on the target edge length over a box.
The box argument is in mesh XY units and is clamped to the grid. The minimum covers every grid node that supports interpolation inside it (from the min pyramid when footprintBounds was set, otherwise by scanning), raised to the area floor's size, then capped by every SizeFieldOptions::regions entry whose ring bounding box intersects the box (Box2::intersects()). Terrain-only regions are excluded; see minimumTerrainSizeInBox().
- Returns
- Length in mesh XY units; 0 for an invalid field, a nonfinite box, or no bound. Read-only; safe for concurrent calls on a completed field.
◆ minimumTerrainSizeInBox()
| double meshkit::plan::SizeField::minimumTerrainSizeInBox |
( |
const Box2 & | box | ) |
const |
Includes finer directional source bounds without changing nominal sizing.
◆ pitch()
| double meshkit::plan::SizeField::pitch |
( |
| ) |
const |
|
inlinenodiscard |
Read the background grid spacing retained by the latest layout attempt.
- Returns
- Pitch in mesh planar units, initially zero; after failed build it may retain a prior/partial layout value. Check successful build/isValid() before interpreting it. Constant read-only query.
◆ rows()
| int meshkit::plan::SizeField::rows |
( |
| ) |
const |
|
inlinenodiscard |
Read the number of grid rows.
- Returns
- Positive count after successful build, zero initially or after checked layout refusal. No allocation, geometry lookup or state mutation.
◆ sizeAt()
| double meshkit::plan::SizeField::sizeAt |
( |
double | x, |
|
|
double | y ) const |
|
nodiscard |
Bilinearly read the combined gradation-relaxed target edge length.
- Parameters
-
| [in] | x | Finite mesh-coordinate x, normalized floor index must fit int with +1 headroom. |
| [in] | y | Finite mesh-coordinate y under the same index constraint; outside-grid samples clamp. |
- Returns
- Mesh-unit target length, zero for invalid/missing grid or any unbounded interpolation-corner sentinel. Terrain/region/source minima and area floor affect stored values; floor can exceed maxSize. Uses float stored grid values and sampled octile grading, not an exact Euclidean or final-cell guarantee. No allocation, callback invocation or mutation; concurrent stable-field reads are safe.
Target edge length h(x, y) in map units: min over the feature-distance term, the terrain term and region overrides, clamped to [size of areaFloor, maxSize] and gradation-limited so that h(p) <= h(q) + gradation·|p − q| on the grid metric. Bilinear over cell centres. 0 on an invalid field.
◆ targetAreaAt()
| double meshkit::plan::SizeField::targetAreaAt |
( |
double | x, |
|
|
double | y ) const |
|
nodiscard |
Read the sampled equilateral-triangle area cap at a mesh coordinate.
- Parameters
-
| [in] | x | Finite query x in the build's planar units; normalized floor and neighboring integer indices must fit int with +1 headroom. Outside-grid positions clamp to boundary samples. |
| [in] | y | Finite y coordinate under the same representable-query precondition. |
- Returns
- sqrt(3)/4*h*h in squared mesh units raised to nonnegative areaFloor; zero for invalid or unbounded field. A minimum floor alone imposes no maximum on a field with no size source. No exact final-mesh refinement guarantee, coordinate conversion, allocation or state mutation.
Maximum permitted triangle area at (x, y) — the RefineHook contract. Returns 0 on an unbounded field; a minimum target does not impose a maximum area when no size source exists.
The documentation for this class was generated from the following files: