Skip to content
Snippets Groups Projects

Visualize rough interfaces in Img3D

Merged Mikhail Svechnikov requested to merge m.i57 into main
All threads resolved!
Files
4
@@ -105,7 +105,7 @@ std::unique_ptr<const double2d_t> layerRoughnessMap(const LayerItem& layerItem,
if (const auto* br = dynamic_cast<const BasicRoughnessItem*>(layerItem.certainRoughness())) {
auto roughness = LayerRoughness(br->sigma().dVal(), br->hurst().dVal(),
br->lateralCorrelationLength().dVal());
int n = 256;
int n = sceneGeometry.numRoughnessPointsAlongAxis;
double L = 2 * sceneGeometry.layerSize;
auto rmap = RoughnessMap(n, n, L, L, &roughness, seed); // seed < 0 ==> random every time
result.reset(new double2d_t(rmap.generateMap()));
@@ -128,6 +128,14 @@ std::unique_ptr<Img3D::Layer> createLayer(const LayerItem& layerItem, const doub
std::unique_ptr<double2d_t> top;
if (topRoughMap)
top.reset(::scaledArray(*topRoughMap, 1. / thickness).release());
else {
// TODO rework
// try to generate it roughness map if is not provided (individual layer visualization)
int seed = 1; // TODO accept seed from SampleItem/LayerItem
auto new_top = ::layerRoughnessMap(layerItem, sceneGeometry, seed);
if (new_top.get())
top.reset(::scaledArray(*new_top, 1. / thickness).release());
}
std::unique_ptr<double2d_t> bottom;
if (bottomRoughMap)
bottom.reset(::scaledArray(*bottomRoughMap, 1. / thickness).release());
@@ -163,11 +171,8 @@ void RealspaceBuilder::populate(Model* model, Item3D* item, const SceneGeometry&
if (const auto* p = dynamic_cast<SampleItem*>(item))
populateSample(model, *p, sceneGeometry, numParticles);
else if (const auto* p = dynamic_cast<LayerItem*>(item)) {
int seed = 1; // TODO accept seed from SampleItem/LayerItem
auto topRoughMap = ::layerRoughnessMap(*p, sceneGeometry, seed);
populateLayer(model, *p, sceneGeometry, numParticles, topRoughMap.get());
}
else if (const auto* p = dynamic_cast<LayerItem*>(item))
populateLayer(model, *p, sceneGeometry, numParticles);
else if (const auto* p = dynamic_cast<ParticleLayoutItem*>(item))
populateLayout(model, *p, sceneGeometry, numParticles);
Loading