计算每个点的梯度
通过查找曲面上的法向量和点来开始查找点的梯度
点和周围点的最佳拟合平面。对法向量进行归一化,然后计算指定方向的斜率
如果“axisxyz”输入为“z”,则检查法线的z坐标。如果值为负值,则整个
法向量乘以-1,使z坐标为正。然后通过以下公式计算坡度:
斜率=sqrt(x**2+y**2)
如果“axisxyz”输入为“x”,则检查法线的x坐标。如果值为负值,则整个
法向量乘以-1,使x坐标为正。然后通过以下公式计算坡度:
斜率=sqrt(y**2+z**2)
如果“axisxyz”输入为“y”,则检查法线的y坐标。如果值为负值,则整个
法向量乘以-1,使y坐标为正。然后通过以下公式计算坡度:
斜率=sqrt(x**2+z**2)
如果“axisxyz”未输入为“x”、“y”或“z”,则函数将引发异常“axisxyz must be x,y,or z”。
from numpy.linalg import norm
from numpy.linalg import svd
Given an array, points, of shape (d,...)
representing points in d-dimensional space,
fit an d-dimensional plane to the points.
Return a point, p, on the plane (the