Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OBJ export - only reference line & roadmarks #75

Open
ngrlt opened this issue Jun 7, 2023 · 2 comments
Open

OBJ export - only reference line & roadmarks #75

ngrlt opened this issue Jun 7, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@ngrlt
Copy link

ngrlt commented Jun 7, 2023

Hi,

Many thanks for your great work and this great tool !

Is there a way to export only reference lines and roadmarks as .OBJ, without the underlying roads mesh ? It is possible to hide the roads mesh in the View but it would be very interesting to do so during export as well.

Many thanks in advance for your time and effort,

Best regards,

Henry

@pageldev pageldev added the enhancement New feature or request label Jun 11, 2023
@pageldev
Copy link
Owner

pageldev commented Jun 11, 2023

Hi Henry, appreciate it!

You should be able to generate a mesh containing only the roadmarks using this library:

odr::OpenDriveMap odr_map("test.xodr");
const double eps = 0.1;

odr::Mesh3D roadmarks_mesh;
for (odr::Road road : odr_map.get_roads())
{
    for (odr::LaneSection lanesection : road.get_lanesections())
    {
        const double s_start = lanesection.s0;
        const double s_end = road.get_lanesection_end(lanesection);
        for (odr::Lane lane : lanesection.get_lanes())
        {
            auto roadmarks = lane.get_roadmarks(s_start, s_end);
            for (const auto& roadmark : roadmarks)
            {
                auto roadmark_mesh = road.get_roadmark_mesh(lane, roadmark, eps);
                roadmarks_mesh.add_mesh(roadmark_mesh);
            }
        }
    }
}

std::ofstream out_file;
out_file.open("out.obj");
out_file << roadmarks_mesh.get_obj() << std::endl;
out_file.close();

@ngrlt
Copy link
Author

ngrlt commented Jun 11, 2023

Thanks for pointing me to this library, I'll try it out !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants