pageldev / libOpenDRIVE

Small, lightweight C++ library for handling OpenDRIVE files
Apache License 2.0
368 stars 134 forks source link

get .obj file from the code #63

Closed Jmingyu0822 closed 1 year ago

Jmingyu0822 commented 1 year ago
  1. I want to get .obj file from the code How Could i get it..?!

  2. In web site (https://odrviewer.io/), if i push 'export .obj' button, the screen become black like under picture. How could i use the function? please explain the function, thank you. image image

pageldev commented 1 year ago

Thanks for noticing! It should be fixed now.

pageldev commented 1 year ago

I re-added the functionality of getting a road network mesh in commit https://github.com/grepthat/libOpenDRIVE/commit/74a5d0760ff933830750d931325eaeb7a6b9e371 This was accidentally removed when deprecating the viewer. You can now get an .obj like this via code:

odr::OpenDriveMap odr_map("test.xodr");
odr::RoadNetworkMesh road_network_mesh = odr_map.get_road_network_mesh(0.1 /*eps*/);
std::ofstream out_file("out.obj");
out_file << road_network_mesh.get_mesh().get_obj() << std::endl;
out_file.close();
Jmingyu0822 commented 1 year ago

Thank you for your help @grepthat But, I couldn't get some more information such as middle line, junction, etc.. in obj picture(3D Viewer).

image

Could i get more information from the code?

pageldev commented 1 year ago

Do you mean the junction areas are missing in the generated .obj file?

Best provide an example .xodr

Jmingyu0822 commented 1 year ago

Thank you for your reply @grepthat

I mean that I can get road outline in the generated .obj file, but I can't get the others such as center line.

"Best provide an example .xodr", In this sentence, you mean my opendrive file is something wrong??