本文整理汇总了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