mirror of
				https://github.com/facebookresearch/pytorch3d.git
				synced 2025-11-04 18:02:14 +08:00 
			
		
		
		
	Clamp matrices in matrix_to_euler_angles function (#1989)
Summary: Closes https://github.com/facebookresearch/pytorch3d/issues/1988 Credit goes to tylerlum for raising this issue and suggesting this fix in https://github.com/haosulab/ManiSkill/pull/1090 Pull Request resolved: https://github.com/facebookresearch/pytorch3d/pull/1989 Reviewed By: MichaelRamamonjisoa Differential Revision: D78021983 Pulled By: bottler fbshipit-source-id: d723f1924a399f4d7fd072e96ea740ae73cf280f
This commit is contained in:
		
							parent
							
								
									e55ea90609
								
							
						
					
					
						commit
						e3d3a67a89
					
				@ -294,10 +294,11 @@ def matrix_to_euler_angles(matrix: torch.Tensor, convention: str) -> torch.Tenso
 | 
			
		||||
    tait_bryan = i0 != i2
 | 
			
		||||
    if tait_bryan:
 | 
			
		||||
        central_angle = torch.asin(
 | 
			
		||||
            matrix[..., i0, i2] * (-1.0 if i0 - i2 in [-1, 2] else 1.0)
 | 
			
		||||
            torch.clamp(matrix[..., i0, i2], -1.0, 1.0)
 | 
			
		||||
            * (-1.0 if i0 - i2 in [-1, 2] else 1.0)
 | 
			
		||||
        )
 | 
			
		||||
    else:
 | 
			
		||||
        central_angle = torch.acos(matrix[..., i0, i0])
 | 
			
		||||
        central_angle = torch.acos(torch.clamp(matrix[..., i0, i0], -1.0, 1.0))
 | 
			
		||||
 | 
			
		||||
    o = (
 | 
			
		||||
        _angle_from_tan(
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user