-
Notifications
You must be signed in to change notification settings - Fork 486
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
Fix size of light visual #2947
Fix size of light visual #2947
Conversation
Signed-off-by: Martin Pecka <peckama2@fel.cvut.cz>
I also noticed the visual doesn't follow the direction specified in |
What's interesting is that if I add the light via GUI, until I click to finalize its placement, its size is correct. As soon as it gets attached to the world, the field of view doubles. |
Signed-off-by: Martin Pecka <peckama2@fel.cvut.cz>
Signed-off-by: Martin Pecka <peckama2@fel.cvut.cz>
Signed-off-by: Martin Pecka <peckama2@fel.cvut.cz>
Now it seems that the temporary light used when adding light interactively in GUI has wrong angle: #2981. |
Light visual is displayed wrong - it shows a cone corresponding to a light with double the angle than it should represent.
Example light:
It seems the math is just wrong in https://github.com/osrf/gazebo/blob/db40ad5e02f21e68e9924d725a49b3e107fecb45/gazebo/rendering/Light.cc#L314-L327
If we denote
inner_angle
by α, then the computation done in code to determine the corners of the pyramid is:Looking from a side, the situation is drawn here:
It follows from the top half-triangle that
tan(α) = (r*tan(α))/r = (angles[i]/r)
and thusα = atan(angles[i]/r)
... But asangles[i]
is just a multiple oftan(α)
, it is apparent that the angle at the apex of the upper half-triangle isinner_angle
. Then sum it up with the lower half-triangle, and you get angle at the apex of the light visual2*inner_angle
.If I add a light with halved
inner_angle
, the borders of the visual match the circle of the light exactly:This PR just applies the halving of the angle to fix the visuals.