I am using
ray_cast() to detect blocked points in 3D, but the function fails at some points. Here are three images of an object in three poses.
Image 1: This is the mapping of 3D points onto the object. (Each 3D point is assigned a unique RGB value.) In this view, all points should be shown as in Image 2 but
ray_cast() finds some being blocked.
Image 2: I got this image by modifying
dist as in
hit = obj.ray_cast(cam_local, direction, distance=dist) in code below to
Image 3: When pose is transformed (in this image, the bed is rotated 90 degrees along x-axis), some points (such as yellow and red ones) should be found blocked (i.e.
hit == True), but they remain in the scene.
Here is my code using
dist = np.linalg.norm(point_3d - cam_in_model_space) direction = ((point_3d - cam_in_model_space) / np.linalg.norm(point_3d - cam_in_model_space)) hit = obj.ray_cast(cam_local, direction, distance=dist)
hit == True, the point will not be shown in the scene.
Can anyone please give some clue to fix this?