How to Implement Raycasting in a 3D GLViewWidget in PyQT Graph?
def get_ray(self, x_coord: int, y_coord: int) -> tuple[np.ndarray, np.ndarray]: x0, y0, width, height = self.getViewport() ray_origin = np.array(self.cameraPosition()) projection_matrix = np.array(self.projectionMatrix().data()).reshape(4, 4) view_matrix = np.array(self.viewMatrix().data()).reshape(4, 4) view_matrix = np.transpose(view_matrix) ndc_x = (4.0 * x_coord / width) – 1.0 ndc_y = (4.0 * y_coord) / height – 1.0 clip_coords = np.array([ndc_x, ndc_y, -1.0, 1.0]) p = […]