本文整理匯總了Python中lib.GeoMath.getCenterEdge方法的典型用法代碼示例。如果您正苦於以下問題:Python GeoMath.getCenterEdge方法的具體用法?Python GeoMath.getCenterEdge怎麽用?Python GeoMath.getCenterEdge使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類lib.GeoMath
的用法示例。
在下文中一共展示了GeoMath.getCenterEdge方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: rotatePattern
# 需要導入模塊: from lib import GeoMath [as 別名]
# 或者: from lib.GeoMath import getCenterEdge [as 別名]
def rotatePattern(self, axis, angle):
middlePoint = GeoMath.getCenterEdge([self.points[0], self.points[len(self.points) - 1]])
middlePoint.append(1)
trans = GeoMath.Matrix(4, 4)
trans.matrix4Trans(middlePoint)
transIn = GeoMath.Matrix(4, 4)
transIn.copy(trans)
transIn.matrix4Inverse()
for num in range(len(self.points)):
pointRot = list(self.points[num])
pointRot.append(1)
pointRot = transIn.mulPoint4ToMatrix4(pointRot)
if(axis == [1, 0, 0]):
Rx = GeoMath.Matrix(4, 4)
Rx.singleRotx(angle)
pointRot = Rx.mulPoint4ToMatrix4(pointRot)
elif(axis == [0, 1, 0]):
Ry = GeoMath.Matrix(4, 4)
Ry.singleRoty(angle)
pointRot = Ry.mulPoint4ToMatrix4(pointRot)
else:
Rz = GeoMath.Matrix(4, 4)
Rz.singleRotz(angle)
pointRot = Rz.mulPoint4ToMatrix4(pointRot)
pointRot = trans.mulPoint4ToMatrix4(pointRot)
self.points[num] = pointRot
# Rotate normal
logging.debug('Normal not rotated:' + str(self.normal))
to_rotate_normal = self.normal
to_rotate_normal.append(0)
if(axis == [1, 0, 0]):
Rx = GeoMath.Matrix(4, 4)
Rx.singleRotx(angle)
normalRot = Rx.mulPoint4ToMatrix4(to_rotate_normal)
elif(axis == [0, 1, 0]):
Ry = GeoMath.Matrix(4, 4)
Ry.singleRoty(angle)
normalRot = Ry.mulPoint4ToMatrix4(to_rotate_normal)
else:
Rz = GeoMath.Matrix(4, 4)
Rz.singleRotz(angle)
normalRot = Rz.mulPoint4ToMatrix4(to_rotate_normal)
normalRot.pop()
logging.debug('Normal rotated: ' + str(normalRot))
self.normal = normalRot