|
core 1.5.0
Shared MPI block decomposition, asynchronous ghost-layer exchange, SDF geometry, load balancing (header-only C++20)
|
Owns a scene under construction and hands out a non-owning SceneView over it. More...
#include <scene_builder.hpp>
Public Member Functions | |
| int | addLeaf (int kind, std::initializer_list< Real > params, Transform< Real > tr={}) |
Analytic leaf. params follows the per-kind layout documented on ShapeKind. | |
| int | addNode (const ShapeNode< Real > &n) |
| Analytic leaf from a prebuilt node (the runtime-parameter sibling of addLeaf, for callers whose parameters arrive as data – the Python binding). | |
| int | addGrid (const std::vector< float > &samples, int nx, int ny, int nz, Vec3< Real > origin, Vec3< Real > spacing, GridExtension ext, Transform< Real > tr={}) |
Sampled field: copies samples into the shared pool, registers a descriptor, returns the node index. | |
| int | addUnion (int a, int b, Transform< Real > tr={}) |
| int | addIntersection (int a, int b, Transform< Real > tr={}) |
| int | addDifference (int a, int b, Transform< Real > tr={}) |
| a MINUS b. | |
| int | addInstance (int shapeRoot, Transform< Real > tr={}, Vec3< Real > linVel={0, 0, 0}, Vec3< Real > angVel={0, 0, 0}, Vec3< Real > center={std::numeric_limits< Real >::quiet_NaN(), std::numeric_limits< Real >::quiet_NaN(), std::numeric_limits< Real >::quiet_NaN()}, int materialId=-1) |
| Place a tree in the world. | |
| SceneView< Real > | view () const |
| Non-owning view over this builder's arrays. Invalidated by any further add*. | |
| const std::vector< ShapeNode< Real > > & | nodes () const |
| const std::vector< GridDesc< Real > > & | grids () const |
| const std::vector< float > & | samples () const |
| const std::vector< Instance< Real > > & | instances () const |
| int | addReframed (int root, const Transform< Real > &W) |
Deep-copy the subtree rooted at root and pre-compose transform W onto the COPIED root, so the new tree evaluates as eval_new(p) = eval_old(toLocal(W, p)). | |
| Instance< Real > & | instanceRef (int i) |
| Mutable access to one placed instance – how a MOVING scene advances: a driver updates the transform (and linVel/angVel/center) in place and re-derives the geometry, instead of re-encoding and re-decoding the whole scene every step. | |
| void | encode (std::vector< int > &nodeInts, std::vector< Real > &nodeReals, std::vector< int > &instInts, std::vector< Real > &instReals) const |
Static Public Member Functions | |
| static Transform< Real > | composeTransform (const Transform< Real > &A, const Transform< Real > &B) |
| Compose two transforms so that toLocal(C, p) == toLocal(B, toLocal(A, p)) – i.e. | |
| static SceneBuilder | decode (const std::vector< int > &nodeInts, const std::vector< Real > &nodeReals, const std::vector< int > &instInts, const std::vector< Real > &instReals, const std::vector< GridDesc< Real > > &grids, const std::vector< float > &pool) |
| Rebuild from the flat encoding (grids and the sample pool are carried across verbatim). | |
Owns a scene under construction and hands out a non-owning SceneView over it.
Every add* returns the new NODE INDEX, so composing a tree reads bottom-up: const int shaft = b.addLeaf(kHollowCylinder, {0.3, 3.0, 0.3}); const int blade = b.addLeaf(kBox, {0.9, 0.1, 0.25}, {{1.0, 0.5, 0.0}}); const int stirrer = b.addUnion(shaft, blade); b.addInstance(stirrer, {}, /*angVel=*/{0, 10.0, 0}); // spinning about y
Definition at line 146 of file scene_builder.hpp.
|
inline |
Analytic leaf. params follows the per-kind layout documented on ShapeKind.
Definition at line 149 of file scene_builder.hpp.
Analytic leaf from a prebuilt node (the runtime-parameter sibling of addLeaf, for callers whose parameters arrive as data – the Python binding).
CSG kinds refused; use addUnion etc.
Definition at line 166 of file scene_builder.hpp.
References peclet::core::geom::kCsgBase, peclet::core::geom::kGrid, and peclet::core::geom::ShapeNode< Real >::kind.
|
inline |
Sampled field: copies samples into the shared pool, registers a descriptor, returns the node index.
The caller never computes a pool offset.
Definition at line 177 of file scene_builder.hpp.
|
inline |
Definition at line 203 of file scene_builder.hpp.
|
inline |
Definition at line 204 of file scene_builder.hpp.
|
inline |
a MINUS b.
Definition at line 208 of file scene_builder.hpp.
|
inline |
Place a tree in the world.
Returns the instance index. center: the centre of rotation for angVel. NaN (the default) = follows the body — consumers rotate about the translation and re-anchor it when the body moves; any finite point = PINNED there in world coordinates, the origin included.
Definition at line 214 of file scene_builder.hpp.
|
inline |
Non-owning view over this builder's arrays. Invalidated by any further add*.
Definition at line 234 of file scene_builder.hpp.
References peclet::core::geom::SceneView< Real >::gridCount, peclet::core::geom::SceneView< Real >::grids, peclet::core::geom::SceneView< Real >::instanceCount, peclet::core::geom::SceneView< Real >::instances, peclet::core::geom::SceneView< Real >::nodeCount, peclet::core::geom::SceneView< Real >::nodes, peclet::core::geom::SceneView< Real >::sampleCount, and peclet::core::geom::SceneView< Real >::samples.
Referenced by peclet::core::geom::SceneQueryDevice< Real, MemSpace >::build().
|
inline |
Definition at line 247 of file scene_builder.hpp.
Referenced by peclet::core::geom::DeviceScene< Real, MemSpace >::from().
|
inline |
Definition at line 248 of file scene_builder.hpp.
Referenced by peclet::core::geom::SceneBuilder< Real >::decode(), and peclet::core::geom::DeviceScene< Real, MemSpace >::from().
|
inline |
Definition at line 249 of file scene_builder.hpp.
Referenced by peclet::core::geom::DeviceScene< Real, MemSpace >::from().
|
inline |
Definition at line 250 of file scene_builder.hpp.
Referenced by peclet::core::geom::DeviceScene< Real, MemSpace >::from().
|
inlinestatic |
Compose two transforms so that toLocal(C, p) == toLocal(B, toLocal(A, p)) – i.e.
C applies A first, then B. Worked out from toLocal(T, p) = invR_T (p - t_T) / s_T: C.R = R_A R_B, C.s = s_A s_B, C.t = t_A + R_A s_A t_B.
Definition at line 255 of file scene_builder.hpp.
References peclet::core::mulQuat(), peclet::core::rotate(), peclet::core::geom::Transform< Real >::rotation, peclet::core::geom::Transform< Real >::scale, and peclet::core::geom::Transform< Real >::translation.
Referenced by peclet::core::geom::SceneBuilder< Real >::addReframed().
|
inline |
Deep-copy the subtree rooted at root and pre-compose transform W onto the COPIED root, so the new tree evaluates as eval_new(p) = eval_old(toLocal(W, p)).
THE reframing move: with W = (t = R^T(-com), R = R_principal^T, s = 1) from bodyProperties, the copied tree's canonical frame IS the principal body frame – COM at the origin, axes principal – exactly, with no resampling and the original subtree untouched (other users keep it as-is).
Definition at line 272 of file scene_builder.hpp.
References peclet::core::geom::SceneBuilder< Real >::composeTransform(), and peclet::core::geom::kCsgBase.
|
inline |
Mutable access to one placed instance – how a MOVING scene advances: a driver updates the transform (and linVel/angVel/center) in place and re-derives the geometry, instead of re-encoding and re-decoding the whole scene every step.
Nodes stay immutable: only the placement moves.
Definition at line 315 of file scene_builder.hpp.
|
inlinestatic |
Rebuild from the flat encoding (grids and the sample pool are carried across verbatim).
Definition at line 337 of file scene_builder.hpp.
References peclet::core::geom::SceneBuilder< Real >::grids(), peclet::core::geom::kInstanceIntStride, peclet::core::geom::kInstanceRealStride, peclet::core::geom::kInstanceRealStrideLegacy, peclet::core::geom::kNodeIntStride, and peclet::core::geom::kNodeRealStride.
Referenced by peclet::core::geom::DeviceScene< Real, MemSpace >::fromFlat().