Skip to content
Snippets Groups Projects
Commit 6238257d authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

[j.1] follow-up to !2700 (roughness visualization) ()

Merging branch 'j.1'  into 'main'.

See merge request !2702
parents 5bdfe13a e5ea4181
No related branches found
No related tags found
1 merge request!2702follow-up to !2700 (roughness visualization)
Pipeline #153871 passed
......@@ -127,18 +127,18 @@ std::unique_ptr<Img3D::Layer> createLayer(const LayerItem& layerItem, const doub
// visual mesh will later be scaled, so we divide roughness by thickness factor in advance
std::unique_ptr<double2d_t> top;
if (topRoughMap)
top.reset(::scaledArray(*topRoughMap, 1. / thickness).release());
top = ::scaledArray(*topRoughMap, 1. / thickness);
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());
top = ::scaledArray(*new_top, 1. / thickness);
}
std::unique_ptr<double2d_t> bottom;
if (bottomRoughMap)
bottom.reset(::scaledArray(*bottomRoughMap, 1. / thickness).release());
bottom = ::scaledArray(*bottomRoughMap, 1. / thickness);
std::unique_ptr<Img3D::Layer> result = std::make_unique<Img3D::Layer>(
Img3D::F3Range(Img3D::F3fromR3({-s2, -s2, ztop}), Img3D::F3fromR3({s2, s2, zbottom})),
......
......@@ -204,10 +204,9 @@ void RoughnessMap::createMap()
double2d_t h_map = mapFromHeights();
double2d_t s_map = mapFromSpectrum();
int iter = 0;
while (true) {
for (int i = 0;; ++i) {
// number of iterations is limited even if no convergence
ASSERT(iter < 100);
ASSERT(i < 100);
double2d_t h_map_old = h_map;
s_map = applySpectrumToHeights(h_map, s_map);
h_map = applyHeightsToSpectrum(h_map, s_map);
......@@ -215,7 +214,6 @@ void RoughnessMap::createMap()
// adjust tolerance for proper speed/accuracy
if (::converged(h_map_old, h_map, 1e-4))
break;
iter++;
}
// 's_map' has "perfect" original spectrum and tolerable height statistics.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment