mirror of
				https://github.com/facebookresearch/pytorch3d.git
				synced 2025-11-04 18:02:14 +08:00 
			
		
		
		
	Fixed look_at_rotation bug for 3 camera positions (#220)
Summary: To address the issue https://github.com/facebookresearch/pytorch3d/issues/219 of Invalid rotation matrix when number of camera position is equal to 3 Pull Request resolved: https://github.com/facebookresearch/pytorch3d/pull/220 Reviewed By: bottler Differential Revision: D21877606 Pulled By: nikhilaravi fbshipit-source-id: f95ae44497cae33f2f0cff1b1718d866cf79bda1
This commit is contained in:
		
							parent
							
								
									5444c53cee
								
							
						
					
					
						commit
						4b78e95eeb
					
				@ -916,8 +916,8 @@ def look_at_rotation(
 | 
				
			|||||||
            msg = "Expected arg %s to have shape (N, 3); got %r"
 | 
					            msg = "Expected arg %s to have shape (N, 3); got %r"
 | 
				
			||||||
            raise ValueError(msg % (n, t.shape))
 | 
					            raise ValueError(msg % (n, t.shape))
 | 
				
			||||||
    z_axis = F.normalize(at - camera_position, eps=1e-5)
 | 
					    z_axis = F.normalize(at - camera_position, eps=1e-5)
 | 
				
			||||||
    x_axis = F.normalize(torch.cross(up, z_axis), eps=1e-5)
 | 
					    x_axis = F.normalize(torch.cross(up, z_axis, dim=1), eps=1e-5)
 | 
				
			||||||
    y_axis = F.normalize(torch.cross(z_axis, x_axis), eps=1e-5)
 | 
					    y_axis = F.normalize(torch.cross(z_axis, x_axis, dim=1), eps=1e-5)
 | 
				
			||||||
    R = torch.cat((x_axis[:, None, :], y_axis[:, None, :], z_axis[:, None, :]), dim=1)
 | 
					    R = torch.cat((x_axis[:, None, :], y_axis[:, None, :], z_axis[:, None, :]), dim=1)
 | 
				
			||||||
    return R.transpose(1, 2)
 | 
					    return R.transpose(1, 2)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user