How to properly load a MESH file in CGAL - cgal

I have been trying to load a .mesh file using the following lines of code but it seems not to load the mesh properly, only its nodes, as evident from writing the read input back to a .mesh file.
C3t3 c3t3;
std::ifstream in("input.mesh", std::ios_base::in|std::ios_base::binary);
CGAL::build_triangulation_from_file<C3t3::Triangulation, true>(in, c3t3.triangulation(), true);
std::ofstream medit_file("output.mesh");
c3t3.output_to_medit(medit_file);

Related

gdal_translate NetCDF to GeoTiff file conversion not working

I am new to geospatial analytics and using NetCDF and GeoTIFF files. I am trying to convert the NetCDF file into GeoTIFF file. I came across this reference: netcdf-to-geotiff-file-conversion. I have successfully installed and can run gdal_translate in my MacOS terminal. However, I get this message I am trying to understand what this means and what I am missing? This appears to be warning, however it didn't generate any output.
My code executed:
gdal_translate some_nc_file_name.nc output.tif
Error/Message:
Warning 1: No UNIDATA NC_GLOBAL:Conventions attribute
Input file contains subdatasets. Please, select one of them for reading.
Here is my data output I previewed in Python:
You appear to have multiple variables in the file, so need to select one. Example (following https://nsidc.org/support/how/how-convert-golive-netcdf-variables-geotiff).
gdal_translate NETCDF:"Input_FileName.nc":variable_name Output_FileName.tif
Based on the warning message, the netCDF file lacks certain important attributes, so some issues may exist with the coordinates etc. in the tif.

assimp issue exporting model textures

I'm trying to export via assimp command line tool two models: one from .fbx (2013) and one from .lwo both to .obj file format.
However I'm not able to extract the textures from the original files.
The command that I perform is:
assimp export INPUT_FILE.xxx OUTPUT_FILE.obj -cts, -gsn, -jiv, -icl, -lbw, -rrm, -slm, -tri, -guv, -sbpt, -fd, -fiv, -fi, -vds -om
The model are:
https://nasa3d.arc.nasa.gov/detail/cubesat-1RU
and
https://nasa3d.arc.nasa.gov/detail/acrimsat
previously converted to the .fbx 2013 file format via FbxConverterUI
At the moment we do not export the embedded textures as far as I know. We opened an issue to get this fixed.

Open txt file and draw histogram in root

I have a txt file which contains numbers. I want to draw a histogram according to this file in root. But I can't do this.
{
TFile *f = new TFile("myfile.root");
f.ls();
TH1F * h1 = (TH1F*)f.Get("h1");
h1->Draw();
}
Have a look at this tutorial from the ROOT website. As far as I know ROOT can't open a plain text file directly. The TFile("myfile.root") call can be used to open a ROOT file (i.e. a binary file created by ROOT containing persistified ROOT objects such as histograms), which as you point out causes errors if you try to open a plain text file using it. The approach shown in the tutorial page is to create a TH1, then use standard C++ I/O streams to read from your text fiule and fill the histogram in the normal way.

Importing obj and obj.mtl files in Maya

I have a mesh model in a .ply file, I have converted it to an obj and obj.mtl (material) file using an online converter (http://www.greentoken.de/onlineconv/). When I load the obj file into maya I see none of the texture being rendered. I've done some googling and this seems like a common problem, but am yet to find a solution.
Any help is appreciated.
Thanks
Check the texture file paths in your mtl file path. If they have path separators, make sure they are forward slashes not back slashes. For some reason if they are back slashes, the parent directory name will be inserted over the filename and a space when Maya parses them into the File node 'Image Name' field.
e.g. This filepath in the mtl:
map_Ka textures\vase_round.tga
will become this in the Maya File node:
textures nd.tga

Save a YAML Emitter content to a file with YAML-CPP

I just started playing around with yaml-cpp, I managed to build it properly and run some of the examples from the yaml-cpp wiki but I can't find a way to save my emitter to a file.
Is this not possible? I mean the PyYAML library has a 'dump' function for this. Is there no such functionality in yaml-cpp?
Is there some workaround to converting a yaml emitter to a stl stream and then dumping this to a yaml file?
Please let me know
Thanks,
Adam
The function Emitter::c_str() returns a NULL-terminated C-style string (which you do not have to release), which you can then write to a file. For example:
YAML::Emitter emitter;
emitter << "Hello world!";
std::ofstream fout("file.yaml");
fout << emitter.c_str();
There is also Emitter::size(), which returns the number of bytes in that string, in case you want to do something more advanced and don't want to walk the string to find its length.
If you want to just dump a Node to a stream, there's a shortcut:
YAML::Node node = ...;
std::ofstream fout("file.yaml");
fout << node;