载入中...
搜索中...
未找到
PlacementSystem.cpp
浏览该文件的文档.
2
6#include "building/Ghost.h"
8#include "common/Diagnostic.h"
10
11#include <algorithm>
12#include <cmath>
13#include <limits>
14#include <unordered_set>
15
16namespace eve::building {
17
18using namespace placement_detail;
19
21 static PlacementSystem instance;
22 return instance;
23}
24
25std::unordered_map<std::string, PlacementSystem::ValidateFn> &PlacementSystem::validateRules() {
26 return inst().validateRules_;
27}
28
29std::unordered_map<std::string, PlacementSystem::SnapFn> &PlacementSystem::snapRules() {
30 return inst().snapRules_;
31}
32
33std::unordered_map<std::string, PlacementSystem::ChangeHook> &PlacementSystem::changeHooks() {
34 return inst().changeHooks_;
35}
36
37std::unordered_map<std::string, PlacementSystem::SurfaceFn> &PlacementSystem::surfaces() {
38 return inst().surfaces_;
39}
40
41std::unordered_map<std::string, PlacementSystem::SurfaceProviderFn> &
42PlacementSystem::surfaceProviders() {
43 return inst().surfaceProviders_;
44}
45
46std::vector<BuildingChangeEvent> &PlacementSystem::eventQueue() {
47 return inst().eventQueue_;
48}
49
50bool &PlacementSystem::builtinsReady() {
51 return inst().builtinsReady_;
52}
53
55 if (name.empty() || !fn) return;
56 validateRules()[name] = std::move(fn);
57}
58
60 validateRules().erase(name);
61}
62
63bool PlacementSystem::hasValidateRule(const std::string &name) {
65 return validateRules().count(name) > 0;
66}
67
69 if (name.empty() || !fn) return;
70 snapRules()[name] = std::move(fn);
71}
72
73void PlacementSystem::unregisterSnapRule(const std::string &name) { snapRules().erase(name); }
74
75bool PlacementSystem::hasSnapRule(const std::string &name) {
77 return snapRules().count(name) > 0;
78}
79
81 if (name.empty() || !fn) return;
82 changeHooks()[name] = std::move(fn);
83}
84
85void PlacementSystem::unregisterChangeHook(const std::string &name) { changeHooks().erase(name); }
86
87bool PlacementSystem::hasChangeHook(const std::string &name) {
88 return changeHooks().count(name) > 0;
89}
90
92 if (name.empty() || !fn) return;
93 surfaces()[name] = fn;
95 name, [name, fn = std::move(fn)](const PlacementWorld &world, float x, float y) {
97 if (!fn(world, x, y, &hit)) {
99 eve::DiagnosticCode::NotFound, "placement surface did not produce a hit",
100 name, {}, "building.surface"));
101 }
102 return eve::Result<PlacementHit>::success(std::move(hit));
103 });
104}
105
107 if (name.empty() || !fn) return;
108 surfaceProviders()[name] = std::move(fn);
109}
110
112 const std::string &name, std::shared_ptr<const HeightfieldSurface> surface) {
113 if (name.empty() || !surface) {
116 "heightfield registration requires a name and an owning surface", name, {},
117 "building.heightfield-surface"));
118 }
120 name, [surface = std::move(surface)](const PlacementWorld &world, float x, float y) {
121 return surface->sample(world, x, y);
122 });
124}
125
127 const std::string &name, std::shared_ptr<const StaticMeshSurface> surface) {
128 if (name.empty() || !surface) {
131 "static mesh registration requires a name and an owning surface", name, {},
132 "building.static-mesh-surface"));
133 }
135 name, [surface = std::move(surface)](const PlacementWorld &world, float x, float y) {
136 return surface->sample(world, x, y);
137 });
139}
140
141void PlacementSystem::unregisterSurface(const std::string &name) {
142 surfaces().erase(name);
143 surfaceProviders().erase(name);
144}
145
146bool PlacementSystem::hasSurface(const std::string &name) {
148 return surfaceProviders().count(name) > 0;
149}
150
151bool PlacementSystem::surfaceHit(const PlacementWorld &world, const std::string &name, float x,
152 float y, PlacementHit *hit) {
153 if (!hit) return false;
154 auto result = sampleSurface(world, name, x, y);
155 if (!result.ok()) return false;
156 *hit = std::move(result).takeValue();
157 return true;
158}
159
161PlacementSystem::sampleSurface(const PlacementWorld &world, const std::string &name, float x,
162 float y) {
164 const std::string resolvedName = name.empty() ? "plane" : name;
165 auto it = surfaceProviders().find(resolvedName);
166 if (it == surfaceProviders().end() || !it->second) {
168 eve::DiagnosticCode::NotFound, "placement surface provider is not registered",
169 resolvedName, {}, "building.surface"));
170 }
171 auto result = it->second(world, x, y);
172 if (!result.ok()) return eve::Result<PlacementHit>::failure(result.status());
173 PlacementHit hit = std::move(result).takeValue();
174 if (normalizeSurfaceFrame(hit) != SurfaceFrameStatus::Normalized) {
177 "placement surface returned a non-finite position or zero normal", resolvedName,
178 {}, "building.surface"));
179 }
180 if (hit.surfaceId.empty()) hit.surfaceId = resolvedName;
181 return eve::Result<PlacementHit>::success(std::move(hit));
182}
183
185PlacementSystem::sampleSurfacePatch(const PlacementWorld &world, const std::string &buildingId,
186 const std::string &surfaceName, float x, float y,
187 float rotationDegrees) {
188 const BuildingDefinition *def = BuildingRegistry::find(buildingId);
189 if (!def) {
191 eve::DiagnosticCode::NotFound, "building definition is not registered", buildingId,
192 {}, "building.surface-patch"));
193 }
194
195 const SnapResult snapped = snap(world, buildingId, x, y);
196 auto anchorResult = sampleSurface(world, surfaceName, snapped.worldX, snapped.worldY);
197 if (!anchorResult.ok()) return eve::Result<SurfacePatch>::failure(anchorResult.status());
198
199 SurfacePatch patch;
200 patch.anchor = std::move(anchorResult).takeValue();
201 float originX = 0.f;
202 float originY = 0.f;
203 world.cellToWorldPlane(snapped.cellX, snapped.cellY, originX, originY);
204
205 float minHeight = std::numeric_limits<float>::max();
206 float maxHeight = std::numeric_limits<float>::lowest();
207 const auto slopeDegrees = [&](const PlacementHit &hit) {
208 const float upDot = world.getGrid().plane == grid::GridPlane::XZ ? hit.normalY
209 : hit.normalZ;
210 return std::acos(std::clamp(upDot, -1.f, 1.f)) * 180.f / 3.14159265358979323846f;
211 };
212 patch.maxSlopeDegrees = 0.f;
213 bool failed = false;
214 eve::Status failureStatus;
215 const auto appendSample = [&](float sampleX, float sampleY, int cellX, int cellY,
216 bool anchor) {
217 if (failed) return false;
219 if (anchor) {
220 hit = patch.anchor;
221 } else {
222 auto sample = sampleSurface(world, surfaceName, sampleX, sampleY);
223 if (!sample.ok()) {
224 failed = true;
225 failureStatus = sample.status();
226 return false;
227 }
228 hit = std::move(sample).takeValue();
229 }
230 if (hit.surfaceId != patch.anchor.surfaceId ||
231 hit.surfaceRevision != patch.anchor.surfaceRevision) {
232 failed = true;
235 "footprint crosses a surface identity or revision boundary", hit.surfaceId,
236 {}, "building.surface-patch"));
237 return false;
238 }
239 const float height =
240 world.getGrid().plane == grid::GridPlane::XZ ? hit.worldY : hit.worldZ;
241 minHeight = std::min(minHeight, height);
242 maxHeight = std::max(maxHeight, height);
243 patch.maxSlopeDegrees = std::max(patch.maxSlopeDegrees, slopeDegrees(hit));
244 patch.samples.push_back({cellX, cellY, std::move(hit)});
245 return true;
246 };
247 if (def->placementKind == "free" &&
248 (!def->freeFootprintVertices.empty() ||
249 (def->freeFootprintWidthCells > 0.f && def->freeFootprintHeightCells > 0.f))) {
250 appendSample(snapped.worldX, snapped.worldY, snapped.cellX, snapped.cellY, true);
251 const FreeFootprint footprint = definitionFreeFootprint(
252 *def, world, snapped.worldX, snapped.worldY,
254 for (const auto &point : worldVertices(footprint)) {
255 int cellX = 0;
256 int cellY = 0;
257 grid::worldToCell(world.getGrid(), point.x, point.y, cellX, cellY,
258 world.getWidth(), world.getHeight());
259 if (!appendSample(point.x, point.y, cellX, cellY, false)) break;
260 }
261 } else {
263 *def, snapped.cellX, snapped.cellY,
264 normalizeRotation(buildingId, rotationDegrees), [&](int cellX, int cellY) {
265 float cellWorldX = 0.f;
266 float cellWorldY = 0.f;
267 world.cellToWorldPlane(cellX, cellY, cellWorldX, cellWorldY);
268 return appendSample(snapped.worldX + cellWorldX - originX,
269 snapped.worldY + cellWorldY - originY, cellX, cellY,
270 cellX == snapped.cellX && cellY == snapped.cellY);
271 });
272 }
273 if (failed) return eve::Result<SurfacePatch>::failure(std::move(failureStatus));
274 if (patch.samples.empty()) {
276 eve::DiagnosticCode::InvalidArgument, "building footprint has no occupied cells",
277 buildingId, {}, "building.surface-patch"));
278 }
279 patch.heightDelta = maxHeight - minHeight;
280 return eve::Result<SurfacePatch>::success(std::move(patch));
281}
282
283std::vector<std::string> PlacementSystem::surfaceNames() {
285 std::vector<std::string> names;
286 names.reserve(surfaceProviders().size());
287 for (const auto &kv : surfaceProviders()) names.push_back(kv.first);
288 return names;
289}
290
291void PlacementSystem::setPlaneSurfaceHeight(float h) { planeSurfaceHeight() = h; }
292
293float PlacementSystem::getPlaneSurfaceHeight() { return planeSurfaceHeight(); }
294
295float &PlacementSystem::planeSurfaceHeight() {
296 return inst().planeSurfaceHeight_;
297}
298
300 if (builtinsReady()) return;
301 builtinsReady() = true;
302
303 registerSnapRule("grid", [](const PlacementWorld &world, float worldX, float worldY) {
305 int cx = 0, cy = 0;
306 grid::worldToCell(world.getGrid(), worldX, worldY, cx, cy, world.getWidth(),
307 world.getHeight());
308 r.cellX = cx;
309 r.cellY = cy;
310 world.cellToWorldPlane(cx, cy, r.worldX, r.worldY);
311 return r;
312 });
313
314 registerSnapRule("cell", [](const PlacementWorld &world, float worldX, float worldY) {
316 r.cellX = int(std::floor(worldX + 0.5f));
317 r.cellY = int(std::floor(worldY + 0.5f));
318 r.worldX = float(r.cellX);
319 r.worldY = float(r.cellY);
320 (void)world;
321 return r;
322 });
323
324 registerSnapRule("free", [](const PlacementWorld &world, float worldX, float worldY) {
326 r.worldX = worldX;
327 r.worldY = worldY;
328 r.cellX = world.worldToCellX(worldX);
329 r.cellY = world.worldToCellY(worldY);
330 return r;
331 });
332
333 // default: bounds + occupancy + terrain + adjacency
334 registerValidateRule("default", [](const PlacementWorld &world, const PlacementQuery &q,
335 std::string *reason) {
336 const BuildingDefinition *def = BuildingRegistry::find(q.buildingId);
337 if (!def) {
338 if (reason) *reason = "unknown_building";
339 return false;
340 }
341 if (!checkBoundsAndOccupancy(world, *def, q, true, reason)) return false;
342 if (!checkTerrain(world, *def, q, reason)) return false;
343 if (!checkAdjacency(world, *def, q, reason)) return false;
344 if (!checkSurfacePatch(*def, q, reason)) return false;
345 if (!checkStructuralSupport(world, *def, q, reason)) return false;
346 return true;
347 });
348
349 registerValidateRule("boundsOnly", [](const PlacementWorld &world, const PlacementQuery &q,
350 std::string *reason) {
351 const BuildingDefinition *def = BuildingRegistry::find(q.buildingId);
352 if (!def) {
353 if (reason) *reason = "unknown_building";
354 return false;
355 }
356 return checkBoundsAndOccupancy(world, *def, q, false, reason);
357 });
358
359 registerValidateRule("overlapOk", [](const PlacementWorld &world, const PlacementQuery &q,
360 std::string *reason) {
361 const BuildingDefinition *def = BuildingRegistry::find(q.buildingId);
362 if (!def) {
363 if (reason) *reason = "unknown_building";
364 return false;
365 }
366 if (!checkBoundsAndOccupancy(world, *def, q, false, reason)) return false;
367 if (!checkTerrain(world, *def, q, reason)) return false;
368 if (!checkAdjacency(world, *def, q, reason)) return false;
369 if (!checkSurfacePatch(*def, q, reason)) return false;
370 if (!checkStructuralSupport(world, *def, q, reason)) return false;
371 return true;
372 });
373
374 registerSurfaceProvider("plane", [](const PlacementWorld &world, float x, float y) {
376 const float h = planeSurfaceHeight();
377 if (world.getGrid().plane == grid::GridPlane::XZ) {
378 hit.worldX = x;
379 hit.worldY = h;
380 hit.worldZ = y;
381 } else {
382 hit.worldX = x;
383 hit.worldY = y;
384 hit.worldZ = h;
385 hit.normalX = 0.f;
386 hit.normalY = 0.f;
387 hit.normalZ = 1.f;
388 }
389 hit.surfaceId = "plane";
390 return eve::Result<PlacementHit>::success(std::move(hit));
391 });
392}
393
394int PlacementSystem::nextInstanceId(PlacementWorld &world) { return ++world.instanceCounter_; }
395
396void PlacementSystem::pushEvent(BuildingChangeEvent ev) { emit(std::move(ev)); }
397
398void PlacementSystem::pollEvents(std::vector<BuildingChangeEvent> &out) {
399 out = eventQueue();
400 eventQueue().clear();
401}
402
403void PlacementSystem::clearEvents() { eventQueue().clear(); }
404
405const std::vector<BuildingChangeEvent> &PlacementSystem::events() { return eventQueue(); }
406
407void PlacementSystem::emit(BuildingChangeEvent ev) {
408 eventQueue().push_back(ev);
409 const auto hooks = changeHooks();
410 for (const auto &kv : hooks) {
411 if (kv.second) kv.second(ev);
412 }
413}
414
415SnapResult PlacementSystem::snapWithMode(const PlacementWorld &world, const std::string &mode,
416 float worldX, float worldY) {
418 auto &rules = snapRules();
419 auto it = rules.find(mode.empty() ? "grid" : mode);
420 if (it == rules.end() || !it->second) {
421 it = rules.find("grid");
422 }
423 if (it != rules.end() && it->second) return it->second(world, worldX, worldY);
425 r.cellX = world.worldToCellX(worldX);
426 r.cellY = world.worldToCellY(worldY);
427 r.worldX = world.cellToWorldX(r.cellX);
428 r.worldY = world.cellToWorldY(r.cellY);
429 return r;
430}
431
432SnapResult PlacementSystem::snap(const PlacementWorld &world, const std::string &buildingId,
433 float worldX, float worldY) {
435 std::string mode = world.getSnapMode();
436 if (const BuildingDefinition *def = BuildingRegistry::find(buildingId)) {
437 if (!def->snapMode.empty()) mode = def->snapMode;
438 }
439 return snapWithMode(world, mode, worldX, worldY);
440}
441
442SnapResult PlacementSystem::snap3D(const PlacementWorld &world, const std::string &buildingId,
443 float worldX, float worldY, float worldZ) {
444 float px = worldX;
445 float py = worldY;
446 float elev = worldZ;
447 if (world.getGrid().plane == grid::GridPlane::XZ) {
448 // 世界坐标 (x, y=高度, z):网格平面第二轴取 z,垂直高度取 y。
449 py = worldZ;
450 elev = worldY;
451 }
452 SnapResult s = snap(world, buildingId, px, py);
453 s.elevation = elev;
454 return s;
455}
456
457float PlacementSystem::normalizeRotation(const std::string &buildingId, float rotationDeg) {
458 const BuildingDefinition *def = BuildingRegistry::find(buildingId);
459 const std::string mode = def ? def->rotationMode : "cardinal";
460 if (mode == "none") return 0.f;
461 if (mode == "free") return wrapDeg(rotationDeg);
462 if (mode == "hex") {
463 const float d = wrapDeg(rotationDeg);
464 const int steps = int(std::lround(d / 60.f)) % 6;
465 return float((steps < 0 ? steps + 6 : steps) * 60);
466 }
467 // cardinal(默认)
468 return float(cardinalQuarter(rotationDeg) * 90);
469}
470
471void PlacementSystem::effectiveFootprint(const BuildingDefinition &def, float rotationDeg, int *outW,
472 int *outH) {
473 int w = def.footprintW;
474 int h = def.footprintH;
475 if (def.rotationMode == "hex") {
476 const int steps = int(std::lround(wrapDeg(rotationDeg) / 60.f)) % 6;
478 w, h);
479 } else if (def.rotationMode == "cardinal" || def.rotationMode.empty()) {
480 const int q = cardinalQuarter(rotationDeg);
481 if (q == 1 || q == 3) std::swap(w, h);
482 }
483 if (outW) *outW = w;
484 if (outH) *outH = h;
485}
486
488 int originCellY, float rotationDeg,
489 const std::function<bool(int cx, int cy)> &fn) {
490 if (!fn) return false;
491 const bool hex = def.rotationMode == "hex";
492 const int steps =
493 hex ? int(std::lround(wrapDeg(rotationDeg) / 60.f)) % 6 : cardinalQuarter(rotationDeg);
494 bool ok = true;
496 [&](int lx, int ly) {
497 if (!fn(originCellX + lx, originCellY + ly)) ok = false;
498 });
499 return ok;
500}
501
502
503} // namespace eve::building
double y
double x
float w
Definition AnimClip.cpp:738
const std::string & s
float rotationDegrees
float cx
Definition CardTypes.cpp:36
float cy
Definition CardTypes.cpp:37
Stable, structured diagnostics shared by engine modules.
std::string name
Definition ECS.cpp:154
Pure cell/world projection helpers for GridConfig.
std::array< double, 10 > q
double r
int h
std::vector< Colorf > px
std::uint32_t height
Poco::JSON::Object::Ptr result
bool hit
float d
int steps
ScriptStructure out
size_t end
float size
Definition TreeMesh.cpp:158
glm::vec3 point
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={})
Construct an error diagnostic with the standard error severity.
Move-only operation result carrying either a value or Status.
Definition Result.h:176
static Result success(T value)
Construct a successful result owning value.
Definition Result.h:185
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:196
Structured status and zero or more diagnostics for an operation.
Definition Status.h:70
static Status success(StatusCode code=StatusCode::Ok)
Construct a successful status with an explicit non-error outcome.
Definition Status.cpp:19
static Status failure(StatusCode code, Diagnostic diagnostic)
Construct a failed status with one diagnostic.
Definition Status.cpp:28
static const BuildingDefinition * find(const std::string &id)
Finds .
Definition Building.cpp:557
EVENGINE_API_WORLD public API.
std::function< bool(const PlacementWorld &world, const PlacementQuery &q, std::string *reason)> ValidateFn
static SnapResult snap(const PlacementWorld &world, const std::string &buildingId, float worldX, float worldY)
static void effectiveFootprint(const BuildingDefinition &def, float rotationDeg, int *outW, int *outH)
旋转后的占地宽高(cardinal 90/270 交换)。
std::function< bool(const PlacementWorld &world, float x, float y, PlacementHit *hit)> SurfaceFn
static std::vector< std::string > surfaceNames()
static void registerSurfaceProvider(const std::string &name, SurfaceProviderFn fn)
Register or replace a structured surface provider.
static void registerSurface(const std::string &name, SurfaceFn fn)
static SnapResult snap3D(const PlacementWorld &world, const std::string &buildingId, float worldX, float worldY, float worldZ)
static eve::Result< void > registerHeightfieldSurface(const std::string &name, std::shared_ptr< const HeightfieldSurface > surface)
Register an immutable built-in heightfield and retain it until unregistration.
static PlacementSystem & inst()
Process singleton holding all PlacementSystem state.
static const std::vector< BuildingChangeEvent > & events()
static bool surfaceHit(const PlacementWorld &world, const std::string &name, float x, float y, PlacementHit *hit)
std::function< SnapResult(const PlacementWorld &world, float worldX, float worldY)> SnapFn
static void unregisterChangeHook(const std::string &name)
static void setPlaneSurfaceHeight(float h)
std::function< eve::Result< PlacementHit >(const PlacementWorld &world, float x, float y)> SurfaceProviderFn
Canonical surface provider contract.
static void ensureBuiltins()
确保内置规则已注册(模块首次使用时自动调用)。
static bool hasSurface(const std::string &name)
std::function< void(const BuildingChangeEvent &ev)> ChangeHook
static void pushEvent(BuildingChangeEvent ev)
static bool foreachFootprintCell(const BuildingDefinition &def, int originCellX, int originCellY, float rotationDeg, const std::function< bool(int cx, int cy)> &fn)
枚举占地格子(旋转后局部 → 世界格子)。返回 false 若定义未知。
static eve::Result< PlacementHit > sampleSurface(const PlacementWorld &world, const std::string &name, float x, float y)
Sample a named placement surface.
static float normalizeRotation(const std::string &buildingId, float rotationDeg)
规范化旋转角(cardinal → 0/90/180/270;none → 0)。
static eve::Result< SurfacePatch > sampleSurfacePatch(const PlacementWorld &world, const std::string &buildingId, const std::string &surfaceName, float x, float y, float rotationDegrees=0.f)
Sample the occupied cells of a rotated footprint relative to an exact anchor hit.
static bool hasSnapRule(const std::string &name)
static void unregisterSurface(const std::string &name)
static bool hasChangeHook(const std::string &name)
static void registerSnapRule(const std::string &name, SnapFn fn)
static bool hasValidateRule(const std::string &name)
static eve::Result< void > registerStaticMeshSurface(const std::string &name, std::shared_ptr< const StaticMeshSurface > surface)
Register an immutable BVH-accelerated triangle mesh and retain its snapshot.
static void pollEvents(std::vector< BuildingChangeEvent > &out)
static void unregisterValidateRule(const std::string &name)
static void unregisterSnapRule(const std::string &name)
static void registerChangeHook(const std::string &name, ChangeHook fn)
static SnapResult snapWithMode(const PlacementWorld &world, const std::string &mode, float worldX, float worldY)
static void registerValidateRule(const std::string &name, ValidateFn fn)
格子型建筑放置世界(脚本可直接操作)。
SurfaceFrameStatus normalizeSurfaceFrame(PlacementSystem::PlacementHit &hit)
FreeFootprint definitionFreeFootprint(const BuildingDefinition &definition, const PlacementWorld &world, float x, float y, float rotationDeg)
std::vector< FreeFootprint::Point > worldVertices(const FreeFootprint &footprint)
Transform footprint vertices. @cost Copies vertex count per overlap query.
int cardinalQuarter(float rotationDeg)
建筑放置模块入口:定义 / 放置世界 / 鬼影 / 变更事件的脚本绑定点。 设计文档:docs/dev/建筑放置系统设计.md
Definition Building.cpp:10
void worldToCell(const GridConfig &cfg, float px, float py, int &cx, int &cy, int mapW, int mapH)
Maps planar coordinates to the nearest cell. Staggered/hex layouts use a bounded nearest-neighbor sea...
void rotatedFootprintSize(int w, int h, const std::vector< uint8_t > &mask, int steps, bool hexMode, int &outW, int &outH)
Axis-aligned size of a footprint after rotation.
void foreachRotatedFootprint(int w, int h, const std::vector< uint8_t > &mask, int steps, bool hexMode, const std::function< void(int lx, int ly)> &fn)
Enumerates local cells of a rotated footprint.
SettlementPipeline::Stage fn
一次成功放置变更的事件(供脚本 poll / C++ hook)。
建筑模板(进程级注册表中的定义)。
std::string placementKind
Placement domain: cell (default), edge, corner, or free.
std::vector< float > freeFootprintVertices
Optional convex local polygon as x/y pairs in grid-cell units, centered on the free anchor.
float freeFootprintHeightCells
Optional oriented-box height in grid-cell units; positive width and height select OBB collision.
std::string rotationMode
none | cardinal | free。
std::vector< uint8_t > footprintMask
可选占地掩码,长度 footprintW*footprintH;空表示实心矩形。行主序、原点在最小 x/y。
float freeFootprintWidthCells
Optional oriented-box width in grid-cell units; positive width and height select OBB collision.
校验上下文:传给可插拔规则。
One sampled point and orthonormal frame on a placement surface.
Surface samples and continuity metrics for one rotated building footprint.
std::vector< SurfacePatchSample > samples