本文整理汇总了Python中Vector.crossProduct方法的典型用法代码示例。如果您正苦于以下问题:Python Vector.crossProduct方法的具体用法?Python Vector.crossProduct怎么用?Python Vector.crossProduct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vector
的用法示例。
在下文中一共展示了Vector.crossProduct方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: CreateTransformedNormal
# 需要导入模块: import Vector [as 别名]
# 或者: from Vector import crossProduct [as 别名]
def CreateTransformedNormal(aTriangle):
vec1 = [aTriangle.p1[X] - aTriangle.p2[X],aTriangle.p1[Y] - aTriangle.p2[Y],
aTriangle.p1[Z] - aTriangle.p2[Z]]
vec2 = [aTriangle.p3[X] - aTriangle.p2[X],aTriangle.p3[Y] - aTriangle.p2[Y],
aTriangle.p3[Z] - aTriangle.p2[Z]]
aTriangle.normal = Vector.crossProduct(vec2,vec1)
return aTriangle.normal
示例2:
# 需要导入模块: import Vector [as 别名]
# 或者: from Vector import crossProduct [as 别名]
identityMatrix = Matrix.MatrixMatrixMult(yRotateMatrix,identityMatrix)
identityMatrix = Matrix.MatrixMatrixMult(zRotateMatrix,identityMatrix)
worldMatrix = Matrix.MatrixMatrixMult(worldMatrix,identityMatrix)
#VIEW MATRIX
#creating a view matrix involves look,up and right vectors, and depending on the orientation and components of the look
#vector
lookVector = [lookPointX - cameraX,lookPointY - cameraY,lookPointZ - cameraZ,0.0]
lookVector = Vector.normalize(lookVector)
rightVector = Vector.crossProduct([0,1,0,0],lookVector)
rightVector = Vector.normalize(rightVector)
upVector = Vector.crossProduct(lookVector,rightVector)
upVector = Vector.normalize(upVector)
CameraPos = [cameraX,cameraY,cameraZ,1]
viewMatrix = [[rightVector[X],upVector[X],lookVector[X],0],
[rightVector[Y],upVector[Y],lookVector[Y],0],
[rightVector[Z],upVector[Z],lookVector[Z],0],
[-(Vector.dotProduct(CameraPos,rightVector)),-(Vector.dotProduct(CameraPos,upVector)),-(Vector.dotProduct(CameraPos,lookVector)),1]]