Finding the centre of multiple lines using least squares approach in Python

£可爱£侵袭症+ 提交于 2019-12-02 07:01:34

Could it simply be the fact that you should define in Python the matrix as 2 vectors (understand is a column of the matrix, not row! see: How to define two-dimensional array in python ), you'll then should define the ortho matrix like this:

    ortho= np.array([[0,1],[-1,0]])

Otherwise, what does the following means?

    numerall=n1l1[0]+n1l2[0]+n1l3[0]+n1l4[0]+n1l5[0]  #sum of (n.n^t)pi from wikipedia article
    denomall=n1l1[1]+n1l2[1]+n1l3[1]+n1l4[1]+n1l5[1] #sum of n.n^t        
    point=(numerall/denomall)

I do not understand your interpretation of the transposition of a Matrix; and the inverse of a matrix does not equals to a division.

Use an existing Python library like Numpy to do the computing instead of implementing it yourself. See: https://docs.scipy.org/doc/numpy-1.10.4/reference/generated/numpy.matrix.html

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!