Rotation version based on map transform
There are multiple versions of rotation right now so some comparisons and discussions might be necessary before merging and combine the optimal part in each.
In this version, the rotation:
-
is implemented as a map transform operator, and thus can be flexibly combined with other operations
-
includes a polygon xzbbox, which will still be needed when doing other transforms like clipping. It seems there are no extra elements outside the region in another version, yet I got them out there and the generation of those needs to be deactivated when I tested in the past, so better understand what this is done now.
-
calculates the new elevation data by calling the existing ground method
-
includes a new interface for elevation data and ground based on Array2 which is a data structure more RAM/CPU efficient than Vec<Vec<...>>, maybe useful as a reference for future optimizations in other modules
-
includes a laplacian smooth on the rotated elevation data to deal with jagged edges due to coordinate resolution
-
includes settings: rotation center, angle, and smooth iterations for users
-
is based on json config only, and the config file is still fixed in path and cannot be specified at runtime
-
does not have GUI portal and other helper tools like degree calculator
-
truncates the floating point in more places for elevation, given the consideration of modularity, so introduces some numerical errors and diffusivities, but still acceptable compared to the resolution of mc coordinates and original elevation data.
-
is done on nodes, ways elements, relation is stay untouched, so I'd better make it clear the data structure and usages of relations.
Some important questions were bolded.
As one of the possible directions, the GUI might integrate the map transform module to provide a job workflow, which should not be too difficult since the current interface is already in json just like how vsode config do things, together with tools in other codes, this might give a pretty smooth user experience.
Some results:
Fig.1 Without any rotations
Fig.2 Rotation 45deg and rotate -45deg back, smooth iterations = 0 per rotation
Fig.3 Rotation 45deg and rotate -45deg back, smooth iterations = 3 per rotation
Fig.4 Rotation 45deg and rotate -45deg back, smooth iterations = 5 per rotation
Fig.5 Rotation 30deg, smooth iterations = 0 per rotation
Fig.6 Rotation 30deg, smooth iterations = 5 per rotation
retrigger-benchmark
⏱️ Benchmark run finished in 38m 48s 🧠 Peak memory usage: 6122 MB (↗ 4% more)
📈 Compared against baseline: 135s
🧮 Delta: 2193s
🔢 Commit: 29c4dc6
🚨 This PR drastically worsens generation time.
You can retrigger the benchmark by commenting retrigger-benchmark.
OK this is quite weird. 2 benchmarks, one with 2 translations + 2 rotations using 5 smooth steps, 6% more peak memory; one without any extra works in this module, 4% more peak memory and same time. Tests still finish within a few seconds locally.
Don't worry about the benchmark bot, I've already seen that happening one time before. Another retrigger fixes it. I'll investigate that soon! Btw I'll get to your PR asap! :)
Yes it sounds good, next step will be to link it to GUI and let's find out what's the best way to integrate them. Preliminary thoughts will be in the way how vscode config is designed, adding a general display GUI for json config file. But note that my computer ran into some hardware problems and might take some days before I can start coding.
Thanks a lot for your contribution, highly appreciated. Since I got multiple PRs regarding the rotation feature, I gathered the best things from all of them and merged it in https://github.com/louis-e/arnis/pull/876 :)