Question: import numpy as np from numpy.core.multiarray import ndarray A=np.zeros((3,1)) A[0]=float(input( 'value of x for point A' )) A[1]=float(input( 'value of y for point A' ))
import numpy as np from numpy.core.multiarray import ndarray A=np.zeros((3,1)) A[0]=float(input('value of x for point A')) A[1]=float(input('value of y for point A')) A[2]=float(input('value of z for point A')) B=np.zeros((3,1)) B[0]=float(input('value of x for point B')) B[1]=float(input('value of y for point B')) B[2]=float(input('value of z for point B')) observer=np.zeros((3,1)) observer[0]=float(input('value of x for point of observer')) observer[1]=float(input('value of y for point of observer')) observer[2]=float(input('value of z for point of observer')) newA=A-observer newB=B-observer magnitude_v1=np.sqrt(newA[0]**2+newA[1]**2+newA[2]**2) unit_vectorA=newA/magnitude_v1 magnitude_v2=np.sqrt(newB[0]**2+newB[1]**2+newB[2]**2) unit_vectorB=newB/magnitude_v2 cos_angle=np.dot(unit_vectorA,unit_vectorB) angle_radians=np.arcos(cos_angle) angle_degrees=np.degrees(angle_radians)
Find the angle between the two points from the viewers perspective.Given the two points at: A=[4,5,1] and B=[9,-3,6] with the observer at position [-1, -2, 1] value of z for point of observerl Traceback (most recent call last) "C:/Users/rodr1/PyCharmProjects/Lab03/1ab03/individual cos_angle-np.dot (unit_vectorA, unit_vectorB) File 2.", Line 30, in module> ValueError: shapes (3,1) and (3,1) not aligned : 1 (dim 1) != 3 (dim 0) Process finished with exit code 1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
