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


Python Math.Matrix类代码示例

本文整理汇总了Python中Math.Matrix的典型用法代码示例。如果您正苦于以下问题:Python Matrix类的具体用法?Python Matrix怎么用?Python Matrix使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Matrix类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __addEntryLit

 def __addEntryLit(self, id, matrix, visible = True):
     battleCtx = g_sessionProvider.getCtx()
     if battleCtx.isObserver(id):
         return 
     if matrix is None:
         return 
     mp = Math.WGReplayAwaredSmoothTranslationOnlyMP()
     mp.source = matrix
     scaledMatrix = None
     if self.__markerScale is not None:
         scaleMatrix = Matrix()
         scaleMatrix.setScale(Vector3(self.__markerScale, self.__markerScale, self.__markerScale))
         scaledMatrix = mathUtils.MatrixProviders.product(scaleMatrix, mp)
     if scaledMatrix is None:
         handle = self.__ownUI.addEntry(mp, self.zIndexManager.getVehicleIndex(id))
     else:
         handle = self.__ownUI.addEntry(scaledMatrix, self.zIndexManager.getVehicleIndex(id))
     entry = {'matrix': mp,
      'handle': handle}
     arena = BigWorld.player().arena
     entryVehicle = arena.vehicles[id]
     entityName = battleCtx.getPlayerEntityName(id, entryVehicle.get('team'))
     markerType = entityName.base
     entryName = entityName.name()
     self.__entrieLits[id] = entry
     vName = entryVehicle['vehicleType'].type.shortUserString
     self.__ownUI.entryInvoke(entry['handle'], ('init', [markerType,
       entryName,
       'lastLit',
       '',
       vName]))
     if not visible:
         self.__ownUI.entryInvoke(entry['handle'], ('setVisible', [visible]))
     if self.__markerScale is None:
         self.__parentUI.call('minimap.entryInited', [])
开发者ID:Infernux,项目名称:Projects,代码行数:35,代码来源:minimap.py

示例2: __addEntryMarker

 def __addEntryMarker(self, marker, matrix):
     if matrix is None:
         return
     else:
         mp = Math.WGReplayAwaredSmoothTranslationOnlyMP()
         mp.source = matrix
         scaledMatrix = None
         if self.__markerScale is not None:
             scaleMatrix = Matrix()
             scaleMatrix.setScale(Vector3(self.__markerScale, self.__markerScale, self.__markerScale))
             scaledMatrix = mathUtils.MatrixProviders.product(scaleMatrix, mp)
         zIndex = self.zIndexManager.getMarkerIndex(marker)
         if scaledMatrix is None:
             handle = self.__ownUI.addEntry(mp, zIndex)
         else:
             handle = self.__ownUI.addEntry(scaledMatrix, zIndex)
         entry = {'matrix': mp,
          'handle': handle}
         self.__entrieMarkers[marker] = entry
         self.__ownUI.entryInvoke(entry['handle'], ('init', ['fortConsumables',
           marker,
           '',
           '',
           'empty']))
         if self.__markerScale is None:
             self.__parentUI.call('minimap.entryInited', [])
         return handle
开发者ID:webiumsk,项目名称:WoT,代码行数:27,代码来源:minimap.py

示例3: scaleMarker

 def scaleMarker(self, handle, originalMatrix, scale):
     if handle is not None and originalMatrix is not None:
         scaleMatrix = Matrix()
         scaleMatrix.setScale(Vector3(scale, scale, scale))
         mp = mathUtils.MatrixProviders.product(scaleMatrix, originalMatrix)
         self.__ownUI.entrySetMatrix(handle, mp)
     return
开发者ID:webiumsk,项目名称:WoT,代码行数:7,代码来源:minimap.py

示例4: __update

 def __update(self, dx, dy, dz, rotateMode = True, zoomMode = True, isCallback = False):
     prevPos = self.__inputInertia.calcWorldPos(self.__aimingSystem.matrix)
     distChanged = False
     if zoomMode and dz != 0:
         prevDist = self.__aimingSystem.distanceFromFocus
         distDelta = dz * float(self.__curScrollSense)
         distMinMax = self.__cfg['distRange']
         newDist = mathUtils.clamp(distMinMax.min, distMinMax.max, prevDist - distDelta)
         if abs(newDist - prevDist) > 0.001:
             self.__aimingSystem.distanceFromFocus = newDist
             self.__userCfg['startDist'] = newDist
             self.__inputInertia.glideFov(self.__calcRelativeDist())
             self.__aimingSystem.aimMatrix = self.__calcAimMatrix()
             distChanged = True
         changeControlMode = prevDist == newDist and mathUtils.almostZero(newDist - distMinMax.min)
         if changeControlMode and self.__onChangeControlMode is not None:
             self.__onChangeControlMode()
             return
     if rotateMode:
         self.__updateAngles(dx, dy)
     if ENABLE_INPUT_ROTATION_INERTIA and not distChanged:
         self.__aimingSystem.update(0.0)
     if ENABLE_INPUT_ROTATION_INERTIA or distChanged:
         worldDeltaPos = prevPos - self.__aimingSystem.matrix.translation
         matInv = Matrix(self.__aimingSystem.matrix)
         matInv.invert()
         self.__inputInertia.glide(matInv.applyVector(worldDeltaPos))
     return
开发者ID:webiumsk,项目名称:WOT-0.9.15-CT,代码行数:28,代码来源:arcadecamera.py

示例5: __addDeadEntry

 def __addDeadEntry(self, entry, id):
     """
     adding death animation to minimap (WOTD-5884)
     """
     if id in BigWorld.entities.keys():
         m = self.__getEntryMatrixByLocation(id, entry['location'])
         scaledMatrix = None
         if self.__markerScale is not None:
             scaleMatrix = Matrix()
             scaleMatrix.setScale(Vector3(self.__markerScale, self.__markerScale, self.__markerScale))
             scaledMatrix = mathUtils.MatrixProviders.product(scaleMatrix, m)
         if scaledMatrix is None:
             entry['handle'] = self.__ownUI.addEntry(m, self.zIndexManager.getDeadVehicleIndex(id))
         else:
             entry['handle'] = self.__ownUI.addEntry(scaledMatrix, self.zIndexManager.getVehicleIndex(id))
         self.__entries[id] = entry
         if not GUI_SETTINGS.permanentMinimapDeath:
             self.__deadCallbacks[id] = BigWorld.callback(GUI_SETTINGS.minimapDeathDuration / 1000, partial(self.__delEntry, id))
         self.__callEntryFlash(id, 'setDead', [GUI_SETTINGS.permanentMinimapDeath])
         self.__callEntryFlash(id, 'init', [entry['markerType'],
          entry['entryName'],
          entry['vClass'],
          ''])
         if self.__markerScale is None:
             self.__parentUI.call('minimap.entryInited', [])
开发者ID:Infernux,项目名称:Projects,代码行数:25,代码来源:minimap.py

示例6: MatrixCallback

 def MatrixCallback(self):
     matr=self.ui.MatrixIn.toPlainText()
     matr=str(matr).split()
     matr=[float(element) for element in matr]
     
     dt=self.ui.DTIn.text()
     dt=str(dt).split(" ")
     dt=[float(element) for element in dt]
     
     
     if sqrt(len(matr))-int(sqrt(len(matr)))!=0 or  matr[0]=='':
         self.ui.textBrowser.append("Girilen matris kare ve bos olmayan bir matris olmalidir.")
         return
     
     matr=Matrix(int(sqrt(len(matr))), matr)
     try:
         if self.ui.radioMatrix.isChecked():
             self.ui.textBrowser.append("Cozum takimi : " + str(matr.gaussElimination(dt)))
         
         elif self.ui.radioMatrix2.isChecked():
             self.ui.textBrowser.append("Invers Matris :")
             for row in matr.inverse().matrix:
                 self.ui.textBrowser.append(str(row))
             
         elif self.ui.radioMatrix3.isChecked():
             self.ui.textBrowser.append("Determinant : " + str(matr.determinant()))
     except Exception as exc:
         self.ui.textBrowser.append(exc.args[0])
开发者ID:ckaygusu,项目名称:Educational,代码行数:28,代码来源:Launcher.py

示例7: __getLookAtYPR

 def __getLookAtYPR(self, lookAtPosition):
     lookDir = lookAtPosition - self.__position
     camMat = Matrix()
     camMat.lookAt(self.__position, lookDir, Vector3(0, 1, 0))
     camMat.invert()
     yaw = camMat.yaw
     pitch = camMat.pitch
     return Vector3(yaw, pitch, self.__ypr.z)
开发者ID:webiumsk,项目名称:WoT,代码行数:8,代码来源:videocamera.py

示例8: __calcAimOffset

 def __calcAimOffset(self, aimLocalTransform = None):
     worldCrosshair = Matrix(self.__crosshairMatrix)
     aimingSystemMatrix = self.__aimingSystem.matrix
     if aimLocalTransform is not None:
         worldCrosshair.postMultiply(aimLocalTransform)
     worldCrosshair.postMultiply(aimingSystemMatrix)
     aimOffset = cameras.projectPoint(worldCrosshair.translation)
     return Vector2(mathUtils.clamp(-0.95, 0.95, aimOffset.x), mathUtils.clamp(-0.95, 0.95, aimOffset.y))
开发者ID:webiumsk,项目名称:WOT0.9.10,代码行数:8,代码来源:snipercamera.py

示例9: bind

 def bind(self, vehicle, bindWorldPos = None):
     self.__vehicle = vehicle
     if vehicle is None:
         self.matrix = mathUtils.createIdentityMatrix()
         self.__lookAtProvider = None
         return
     toLocalMat = Matrix(vehicle.matrix)
     toLocalMat.invert()
     self.__boundLocalPos = None if bindWorldPos is None else toLocalMat.applyPoint(bindWorldPos)
     self.selectPlacement(_VehicleBounder.SELECT_CHASSIS)
开发者ID:kblw,项目名称:wot_client,代码行数:10,代码来源:videocamera.py

示例10: applyImpulse

 def applyImpulse(self, position, impulse, reason = ImpulseReason.ME_HIT):
     adjustedImpulse, noiseMagnitude = self.__dynamicCfg.adjustImpulse(impulse, reason)
     camMatrix = Matrix(self.__cam.matrix)
     impulseLocal = camMatrix.applyVector(adjustedImpulse)
     impulseAsYPR = Vector3(impulseLocal.x, -impulseLocal.y + impulseLocal.z, 0)
     rollPart = self.__dynamicCfg['impulsePartToRoll']
     impulseAsYPR.z = -rollPart * impulseAsYPR.x
     impulseAsYPR.x *= 1 - rollPart
     self.__impulseOscillator.applyImpulse(impulseAsYPR)
     self.__applyNoiseImpulse(noiseMagnitude)
开发者ID:webiumsk,项目名称:WOT0.9.10,代码行数:10,代码来源:snipercamera.py

示例11: destroyFireball

def destroyFireball(owner, fireball, fx, explosionFXName, targetHitCallback, prereqs):
    m = Matrix(fireball.motors[0].target)
    fx.detach()
    owner.delModel(fireball)
    explosion = BigWorld.Model('')
    owner.addModel(explosion)
    explosion.position = m.applyToOrigin()
    fireballfx = FX.bufferedOneShotEffect(explosionFXName, explosion, explosion, lambda : owner.delModel(explosion), 10.0, prereqs)
    if targetHitCallback != None:
        targetHitCallback(owner, m)
    return
开发者ID:webiumsk,项目名称:WOT-0.9.12-CT,代码行数:11,代码来源:projectiles.py

示例12: createSRTMatrix

def createSRTMatrix(scale, rotation, translation):
    scaleMatrix = Matrix()
    scaleMatrix.setScale(scale)
    result = Matrix()
    result.setRotateYPR(rotation)
    result.translation = translation
    result.preMultiply(scaleMatrix)
    return result
开发者ID:Infernux,项目名称:Projects,代码行数:8,代码来源:mathutils.py

示例13: __processBindToVehicleKey

 def __processBindToVehicleKey(self):
     if BigWorld.isKeyDown(Keys.KEY_LSHIFT) or BigWorld.isKeyDown(Keys.KEY_RSHIFT):
         self.__toggleView()
     elif BigWorld.isKeyDown(Keys.KEY_LALT) or BigWorld.isKeyDown(Keys.KEY_RALT):
         worldMat = Math.Matrix(self.__cam.invViewProvider)
         self.__basisMProv.selectNextPlacement()
         boundMatrixInv = Matrix(self.__basisMProv.matrix)
         boundMatrixInv.invert()
         worldMat.postMultiply(boundMatrixInv)
         self.__position = worldMat.translation
         self.__ypr = Vector3(worldMat.yaw, worldMat.pitch, worldMat.roll)
     else:
         self.__switchBind()
开发者ID:webiumsk,项目名称:WOT-0.9.15.1,代码行数:13,代码来源:videocamera.py

示例14: worldHitTest

    def worldHitTest(self, start, stop, worldMatrix):
        worldToLocal = Matrix(worldMatrix)
        worldToLocal.invert()
        testRes = self.__bspModel.collideSegment(worldToLocal.applyPoint(start), worldToLocal.applyPoint(stop))
        if testRes is None:
            return
        res = []
        for dist, normal, hitAngleCos, matKind in testRes:
            res.append((dist,
             worldMatrix.applyVector(normal),
             hitAngleCos,
             matKind))

        return res
开发者ID:wotmods,项目名称:WOTDecompiled,代码行数:14,代码来源:modelhittester.py

示例15: assembleCompoundModel

def assembleCompoundModel(models, position, vehicleDesc):
    tank = BigWorld.createCompoundTank()
    chassis = BigWorld.ModelLite(models[0])
    hull = BigWorld.ModelLite(models[1])
    turret = BigWorld.ModelLite(models[2])
    gun = BigWorld.ModelLite(models[3])
    matrix = Matrix()
    matrix.translation = position
    tank.attachPart(0, chassis, '', matrix)
    tank.attachPart(1, hull, 'V')
    tank.attachPart(2, turret, 'HP_turretJoint')
    tank.attachPart(3, gun, 'HP_gunJoint')
    BigWorld.addModel(tank)
    return tank
开发者ID:aevitas,项目名称:wotsdk,代码行数:14,代码来源:clientbenchmark.py


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