本文整理汇总了Python中Math.Matrix.applyPoint方法的典型用法代码示例。如果您正苦于以下问题:Python Matrix.applyPoint方法的具体用法?Python Matrix.applyPoint怎么用?Python Matrix.applyPoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Math.Matrix
的用法示例。
在下文中一共展示了Matrix.applyPoint方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: worldHitTest
# 需要导入模块: from Math import Matrix [as 别名]
# 或者: from Math.Matrix import applyPoint [as 别名]
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
示例2: __pickVehicle
# 需要导入模块: from Math import Matrix [as 别名]
# 或者: from Math.Matrix import applyPoint [as 别名]
def __pickVehicle(self):
if self.__boundVehicleMProv is not None:
return
else:
x, y = GUI.mcursor().position
from AvatarInputHandler import cameras
dir, start = cameras.getWorldRayAndPoint(x, y)
end = start + dir.scale(100000.0)
pos, colldata = collideDynamicAndStatic(start, end, (), 0)
vehicle = None
if colldata is not None:
entity = colldata[0]
from Vehicle import Vehicle
if isinstance(entity, Vehicle):
vehMatProv = entity.matrix
vehMatInv = Matrix(vehMatProv)
vehMatInv.invert()
localPos = vehMatInv.applyPoint(pos)
result = Math.MatrixProduct()
localTransMat = Matrix()
localTransMat.translation = localPos
result.a = localTransMat
result.b = vehMatProv
return result
return
示例3: bind
# 需要导入模块: from Math import Matrix [as 别名]
# 或者: from Math.Matrix import applyPoint [as 别名]
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)
示例4: collideSegment
# 需要导入模块: from Math import Matrix [as 别名]
# 或者: from Math.Matrix import applyPoint [as 别名]
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