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

Adding a triangle in Sumo gui #16138

Closed
muhammadfaizan91 opened this issue Feb 7, 2025 · 2 comments
Closed

Adding a triangle in Sumo gui #16138

muhammadfaizan91 opened this issue Feb 7, 2025 · 2 comments

Comments

@muhammadfaizan91
Copy link

muhammadfaizan91 commented Feb 7, 2025

I am working on Filed of View based on pedestrian position, head rotation angle, and distance from getting out of the conflict area. I want to add a triangle that has the corners at these 3 points (Point 1, point 2 and point 3).

            for ped in pedlist:
                ped_pos = traci.person.getPosition(ped)
                dist_to_conflict = L3Y - 1 - ped_pos[0]  # Corrected calculation of distance
                FOV_distance = 90 - (dist_to_conflict / math.tan(math.radians(rotation_angle)))
                **point1 = (ped_pos[1], ped_pos[0])  
                point2 = (L3Y - 1, ped_pos[0])  
                point3 = (FOV_distance, dist_to_conflict)  

please guide me on how can we add this triangle in sumo which is shown in the GUI. is it possible? Thanks

@m-kro
Copy link
Contributor

m-kro commented Feb 7, 2025

You can add polygons using traci.polygon.add (ref). So put your points in a list to use it as the polygon shape.

@muhammadfaizan91
Copy link
Author

Thank you so much. Its working perfectly.

@m-kro m-kro closed this as completed Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants