当前位置: 首页>>代码示例>>Python>>正文


Python Vector.crossProduct方法代码示例

本文整理汇总了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
开发者ID:LloydGhettoWolf,项目名称:Python-Renderer,代码行数:13,代码来源:Triangle.py

示例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]]

开发者ID:LloydGhettoWolf,项目名称:Python-Renderer,代码行数:30,代码来源:AppInfo.py


注:本文中的Vector.crossProduct方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。