Hello everyone,
What tool can I use to convert a GeoTiff DEM file into an STL object?
I tried this tool:
https://github.com/FilLTP89/dem2stlBut the generated STL file seems unreadable by Basilisk.
Or maybe I'm making a mistake?
Is there another way to integrate a terrain file into a 3D Navier Stokes simulation?
Thanks
Cédric
#include "grid/octree.h"
#include "distance.h"
#include "fractions.h"
#include "view.h"
int LEVEL = 9;
void fraction_from_stl (scalar f, FILE * fp, double eps, int maxlevel) {
coord * p = input_stl (fp);
coord min, max;
bounding_box (p, &min, &max);
// set the origin point
origin ((max.x + min.x)/2. - L0/2,
(max.y + min.y)/2. - L0/2,
min.z);
double sizex = -HUGE;
foreach_dimension()
if (max.x - min.x > sizex)
sizex = max.x - min.x;
// set domain size
size (sizex);
scalar d[];
distance (d, p);
while (adapt_wavelet ({d}, (double[]){eps*sizex}, maxlevel, 5).nf);
vertex scalar phi[];
foreach_vertex()
phi[] = (d[] + d[-1] + d[0,-1] + d[-1,-1] +
d[0,0,-1] + d[-1,0,-1] + d[0,-1,-1] + d[-1,-1,-1])/8.;
boundary ({phi});
fractions (phi, f);
}
scalar f[];
int main () {
init_grid (64);
f.refine = f.prolongation = fraction_refine;
FILE * fp = fopen ("../aude_dem.stl", "r");
fraction_from_stl (f, fp, 4e-4, LEVEL);
fclose (fp);
view (theta = pi/2, tx = 0.35);
draw_vof("f");
box();
save ("f.png");
}