Skip to content
DeepForgeby svx
All problems
MediumLinear Algebrala-071

Angle Between Planes

Problem

Compute the acute angle between two planes in degrees from their normals n1 and n2:

theta = degrees(acos(|n1 . n2| / (||n1||_2 * ||n2||_2)))

Return None if either normal is the zero vector.

Hint

The angle between planes is the angle between their normals, taken as acute.

Test cases

case 1
in: [[1,0,0],[0,1,0]]
expected: 90
case 2
in: [[1,0,0],[1,0,0]]
expected: 0
case 3
in: [[1,0,0],[-1,0,0]]
expected: 0
case 4
in: [[1,1,0],[1,0,0]]
expected: 45
case 5
in: [[1,1,1],[1,1,0]]
expected: 35.26438968275466
Starter codePython
def angle_between_planes(n1, n2):
    # Your code here
    pass

5 test cases · run your code against them in the editor