LineSegmentIntersector cannot be applied to a single point in a point cloud #1032
-
My requirement is this: I can select a point on the point cloud, display the index, world coordinates, and node path of the point. Then use these points to calculate distances or other things. But I found that using LineSegmentIntersector cannot achieve such functionality on point clouds. It seems that it can only be used on 3D models. When I zoom in on the point cloud until the sphere occupies more pixels, ensuring that I can select a certain point, there is still no intersection generated. I conducted a test and found that when the point cloud and a 3D model of a teapot appear in the scene simultaneously, the model can work normally, while the point cloud cannot. Here are my test results:
May I ask how to obtain the coordinates, index, and nodes path of the point cloud corresponding to the pixel points? |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 8 replies
-
I have found the problem. It is determined here that topology must be VK_ PRIMITIVE_ TOPOLOGY_ TRIANGLE_ LIST and vertexCount must be less than 3. I don't understand the source code part. How can I make modifications to make LineSegmentIntersector work on a point cloud? I will try to modify it tomorrow. This is Asia, I should go to bed now. |
Beta Was this translation helpful? Give feedback.
-
LineSegmentIntersector does not handle line and point datasttets, it crrently only support triangle meshes. Intersecting points and lines which are infinitely small with a line segment that is infinity thin is not something that can be made to work, to handle these types of data you have do something different than is done for triangle mesh. There are several ways one tackle this issue, essentially they all revolve around give the intersector primitive a thickness, and/or given the point or line a radius or thickness. One approach would be to have a polytope, cone or cylinder intersector that you check with a point or line segment is within the cone or cylinder. Another approach would be to give the point or line radius/thickness so the line segment can then check if the line segment intersects it. What approach to tackle will depend upon what problem you are trying to tackle. Is it picking points/lines on screen? Doing general intersection test? |
Beta Was this translation helpful? Give feedback.
-
Good to hear you've got a solution. Longer term I'd like to see the VSG have additional Intersector implementation like the OSG has. I would also like to add acceleration structures such as KdTree or similar scheme. There are some parallels with the needs of ray tracing on the GPU, while there wouldn't be a full overlap in functionality I am curious whether there is enough overalp to share some of the public interface for settings these things up. I have plenty of other tasks on my plate right now so I'm not in position to start experimenting with any of the above, hopefully over time I or others will be able to start tackling them for the core VSG. |
Beta Was this translation helpful? Give feedback.
-
For your second question about region selection, an alternate way is to create a vsg::Intersector subclass and create a series of convex polytopes in eye space by projecting the selection points to the the cameras near and far planes). Then maintain a stack of the polytopes transformed into the nodes local coordinate system using the pushTransform and popTransform functions, and then test whether the individual points are inside the local polytope. |
Beta Was this translation helpful? Give feedback.
-
Thank you for your reply. I have completed the click and box selection using Qt. I encountered some problems during this process. I customized and inherited a QWidget, converted vsgQt (QWindow) into a QWidget, and then handed it over to me as a custom QWidget object for layout. When I rewrite paintEvent to draw a polygon composed of mouse movement points, it always does not display this polygon. I think this is because the rendering of vsgQt is controlled by the QTimer timer, which will clear the content of my paintEvent to display the vsgQt window. My current implementation is to take a screenshot of the vsgQt window when clicking on the box selection, and display the result of the screenshot in another window; After completing the bounding box selection, calculate whether the point cloud falls in the bounding box area and switch the window back to the vsgQt window. It seems that there is no need for a vsgQt window. When needed, I can obtain real-time off screen rendered images and submit them to the QWidget for display, making it easier for me to use Qt's functions to display and draw other things, such as box selection, based on this image. So, is there any way to remove the window of vsgQt and instead render it in real-time as an image? Preserve everything except the window, turn the window display into a image, and users can implement some functions of the window through the interface. For example, interfaces for mouse or keyboard events, resizing, and other UI operations can be provided. Keep the default three frame buffers, reconstruct the swapchains, and so on. |
Beta Was this translation helpful? Give feedback.
-
The vsgQt::Viewer uses a timer in order to have a easy way of implementing continuous rendering. It's a pretty lighweight class so you should be able to write your own equivalent without timer if that suits you application. vsgQt::Window uses the VSG to provide Vulkan support because Qt's own Vulkan support is pretty poor, I did try to utilize Qt's Vulkan support but found it broken in too many ways to use for proper applications, so had to utilize the VSG for creating the Vulkan Instance and Surface. The VSG's is all about exposing the full capabilities of Vulkan, while Qt support for Vulkan looks to be a quick hack done without full understanding of Vulkan. You could use the VSG/Vulkan using off screen rendering and then copy the image to the Qt window but this would add an performance overhead. As for selection areas etc. You may be better off implementing these features in VSG/Vulkan rather than Qt. |
Beta Was this translation helpful? Give feedback.
Thank you for your answer. I have placed many transparent windows for layer Qt on the QWindow of vsgQt, which supports me to draw and display Qt Widegt on the transparent window.