本文整理汇总了Python中Camera.Camera.toRadian方法的典型用法代码示例。如果您正苦于以下问题:Python Camera.toRadian方法的具体用法?Python Camera.toRadian怎么用?Python Camera.toRadian使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Camera.Camera
的用法示例。
在下文中一共展示了Camera.toRadian方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: GLRenderArea
# 需要导入模块: from Camera import Camera [as 别名]
# 或者: from Camera.Camera import toRadian [as 别名]
#.........这里部分代码省略.........
self.camera.setRotZ(self.zRot / 16)
elif event.buttons(
) & QtCore.Qt.LeftButton and not self.autoCam and self.shiftPressed:
self.mouseRect = [self.lastPos, event.pos()]
elif event.buttons(
) & QtCore.Qt.MiddleButton and not self.autoCam and not self.shiftPressed:
self.xTrans += dx
self.zTrans -= dy
self.camera.setTransX(self.xTrans * 0.01)
self.camera.setTransZ(self.zTrans * 0.01)
elif event.buttons(
) & QtCore.Qt.RightButton and not self.autoCam and not self.shiftPressed:
self.yTrans += dy
self.camera.setTransY(self.yTrans * 0.01)
if not self.shiftPressed:
self.lastPos = event.pos()
def wheelEvent(self, event):
self.screen.data.offsetCurrentFrame(
numpy.sign(event.delta()) * int(
self.screen.parameterDialog.getScrollSpeed()))
def mousePickRect(self, pos1, pos2, append):
if self.frameData:
rect = [
numpy.min([pos1.x(), pos2.x()]),
numpy.min([pos1.y(), pos2.y()]),
numpy.max([pos1.x(), pos2.x()]),
numpy.max([pos1.y(), pos2.y()])
]
tv = math.tan(
self.camera.toRadian(
self.screen.parameterDialog.getVerticalFOV()) * 0.5)
th = math.tan(
self.camera.toRadian(
self.screen.parameterDialog.getHorizontalFOV()) * 0.5)
viewport_width = self.width()
viewport_height = viewport_width * (tv / th)
pTopLeft = [
(rect[0] - viewport_width * 0.5) / (viewport_width * 0.5),
-(rect[1] - self.height() * 0.5) / (viewport_height * 0.5)
]
pTopRight = [
(rect[2] - viewport_width * 0.5) / (viewport_width * 0.5),
-(rect[1] - self.height() * 0.5) / (viewport_height * 0.5)
]
pBottomLeft = [
(rect[0] - viewport_width * 0.5) / (viewport_width * 0.5),
-(rect[3] - self.height() * 0.5) / (viewport_height * 0.5)
]
pBottomRight = [
(rect[2] - viewport_width * 0.5) / (viewport_width * 0.5),
-(rect[3] - self.height() * 0.5) / (viewport_height * 0.5)
]
rayTopLeft1 = self.camera.inverseProj(pTopLeft[0], pTopLeft[1],
-1.0)
rayTopLeft2 = self.camera.inverseProj(pTopLeft[0], pTopLeft[1],
1.0)
rayTopRight1 = self.camera.inverseProj(pTopRight[0], pTopRight[1],
-1.0)
rayTopRight2 = self.camera.inverseProj(pTopRight[0], pTopRight[1],
1.0)