how to calculate the distance between label objects so that labels don't overlap each other

21 views
Skip to first unread message

Horst JENS

unread,
Oct 14, 2024, 6:02:25 AM10/14/24
to VPython-users
problem summary: 
I want to find out the position and distance of vpython label objects, but not in world coordinates but instead in screen coordinates (like the pixel_pos parameter) so that i can make sure labels do not appear too close to each other.

full working example code:

world description (see example code link above):
I have a world with several vertical yellow cylinders. each cylinder has a base at position z=0 and an axis in the direction of vp.vec(0,0,1 of various length.

Each cylinder has an "location" label at the base (white text) and a "value" label at the top (green text). While the world coordinate of each base and top of each cylinder are known, i need to calculate where the labels appear on the screen (in screen pixel coordinates) so to make shure that the labels do not appear too close to each other or overlap.

The user should be able to zoom and pan the camera (userspin = False). The camera axis 






Bruce Sherwood

unread,
Oct 14, 2024, 1:57:19 PM10/14/24
to VPython-users
Sorry, but I still don't understand what the issue is, nor in what way  "pixel" locations are relevant.

The only other thing I can say is that perhaps you should use 3D text objects rather than label objects:


The 3D text object provides detailed information about the size of the text on the screen.

Bruce
Reply all
Reply to author
Forward
0 new messages