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


Python Camera.toRadian方法代码示例

本文整理汇总了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)
开发者ID:YPZhou,项目名称:Sistr,代码行数:70,代码来源:GLRenderArea.py


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