• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python Math.Matrix类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: __onResourcesLoaded

    def __onResourcesLoaded(self, resourceRefs):
        if self.guid not in BigWorld.userDataObjects:
            return
        else:
            self.__clear()
            if self.modelName in resourceRefs.failedIDs:
                return
            try:
                self.__model = resourceRefs[self.modelName]
                self.__modelMatrix = Matrix()
                self.__modelMatrix.setIdentity()
                servo = BigWorld.Servo(self.__modelMatrix)
                self.__model.addMotor(servo)
                BigWorld.addModel(self.__model)
                if self.actionName != '':
                    action = self.__model.action(self.actionName)
                    if action is not None:
                        action()
                if self.pixieName != '' and self.pixieName not in resourceRefs.failedIDs:
                    pixieNode = self.__model.node(self.pixieHardPoint)
                    pixieNode.attach(resourceRefs[self.pixieName])
                if self.soundName != '':
                    self.__sound = SoundGroups.g_instance.playSoundModel(self.__model, self.soundName)
            except:
                LOG_CURRENT_EXCEPTION()
                self.__model = None
                return

            self.__prevTime = BigWorld.time()
            self.__update()
            return
开发者ID:webiumsk,项目名称:WOT-0.9.12-CT,代码行数:31,代码来源:circularflyer.py


示例17: collideSegment

    def collideSegment(self, startPoint, endPoint, skipGun = False):
        res = None
        filterMethod = getattr(self.filter, 'segmentMayHitEntity', lambda : True)
        if not filterMethod(startPoint, endPoint, 0):
            return res
        modelsToCheck = (self.model,) if skipGun else (self.model, self.__gunModel)
        for model, desc in zip(modelsToCheck, self.__componentsDesc):
            toModel = Matrix(model.matrix)
            toModel.invert()
            collisions = desc['hitTester'].localHitTest(toModel.applyPoint(startPoint), toModel.applyPoint(endPoint))
            if collisions is None:
                continue
            for dist, _, hitAngleCos, matKind in collisions:
                if res is None or res.dist >= dist:
                    matInfo = desc['materials'].get(matKind)
                    res = SegmentCollisionResult(dist, hitAngleCos, matInfo.armor if matInfo is not None else 0)

        return res
开发者ID:kblw,项目名称:wot_client,代码行数:18,代码来源:detachedturret.py


示例18: findTargets

    def findTargets(self, actor, source, target):
        self.calculatedTargets = []
        origin = source.position + Vector3(0, 0.5, 0)
        yaw = source.yaw + math.pi / 2.0
        basis = Vector3(math.sin(yaw), 0, math.cos(yaw))
        left = []
        right = []
        leftOver = self.maxNodes
        victims = []
        if hasattr(self, 'victims'):
            victims = self.victims
        elif self.findTeam == 1:
            team = BigWorld.player().team()
            for i in team.members.keys():
                entity = BigWorld.entity(i)
                if entity:
                    if (entity.position - origin).length < self.maxRange:
                        victims.append(entity)

            entity = BigWorld.player()
            if entity:
                if (entity.position - origin).length < self.maxRange:
                    victims.append(entity)
        for e in victims:
            if e.inWorld:
                dpos = e.position - origin
                dpos.normalise()
                dotp = basis.dot(dpos)
                leftOver -= 2
                try:
                    self.calculatedTargets.append(e.model.node('biped Spine'))
                except:
                    self.calculatedTargets.append(e.model.node('Scene Root'))

        while leftOver > 0:
            m = Matrix()
            if leftOver % 2 == 0:
                m.setTranslate(self.randomStrike(source, basis, origin, 1))
                self.calculatedTargets.append(m)
            else:
                m.setTranslate(self.randomStrike(source, basis, origin, 0))
                self.calculatedTargets.append(m)
            leftOver -= 1
开发者ID:webiumsk,项目名称:WOT-0.9.14-CT,代码行数:43,代码来源:aoevictimnodelist.py


示例19: __calcCurOscillatorAcceleration

 def __calcCurOscillatorAcceleration(self, deltaTime):
     vehicle = BigWorld.player().vehicle
     if vehicle is None:
         return Vector3(0, 0, 0)
     curVelocity = vehicle.filter.velocity
     relativeSpeed = curVelocity.length / vehicle.typeDescriptor.physics['speedLimits'][0]
     if relativeSpeed >= SniperCamera._MIN_REL_SPEED_ACC_SMOOTHING:
         self.__accelerationSmoother.maxAllowedAcceleration = self.__dynamicCfg['accelerationThreshold']
     else:
         self.__accelerationSmoother.maxAllowedAcceleration = self.__dynamicCfg['accelerationMax']
     acceleration = self.__accelerationSmoother.update(vehicle, deltaTime)
     camMat = Matrix(self.__cam.matrix)
     acceleration = camMat.applyVector(-acceleration)
     accelSensitivity = self.__dynamicCfg['accelerationSensitivity']
     acceleration.x *= accelSensitivity.x
     acceleration.y *= accelSensitivity.y
     acceleration.z *= accelSensitivity.z
     oscillatorAcceleration = Vector3(0, -acceleration.y + acceleration.z, -acceleration.x)
     return oscillatorAcceleration
开发者ID:kblw,项目名称:wot_client,代码行数:19,代码来源:snipercamera.py


示例20: checkTurretDetachment

    def checkTurretDetachment(self, worldPos):
        if self.__vehicle is None:
            return
        if self.__vehicle.isTurretDetached and not self.__placement == _VehicleBounder.SELECT_DETACHED_TURRET:
            turretFound = None
            for turret in DetachedTurret.allTurrets:
                if turret.vehicleID == self.__vehicle.id and turret.model.visible:
                    turretFound = turret
                    break

            if turretFound is None:
                return
            turretToGoalShift = worldPos - turretFound.position
            toTurretMat = Matrix(turretFound.matrix)
            toTurretMat.invert()
            turretToGoalShift = toTurretMat.applyVector(turretToGoalShift)
            self.matrix = turretFound.matrix
            self.__lookAtProvider = None
            self.__placement = _VehicleBounder.SELECT_DETACHED_TURRET
            return turretToGoalShift
开发者ID:kblw,项目名称:wot_client,代码行数:20,代码来源:videocamera.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python Matrix.Matrix类代码示例发布时间:2022-05-24
下一篇:
Python MapList.MapList类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap