本文整理匯總了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]]