當前位置: 首頁>>代碼示例>>Python>>正文


Python QtGui.QVector3D方法代碼示例

本文整理匯總了Python中PyQt5.QtGui.QVector3D方法的典型用法代碼示例。如果您正苦於以下問題:Python QtGui.QVector3D方法的具體用法?Python QtGui.QVector3D怎麽用?Python QtGui.QVector3D使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PyQt5.QtGui的用法示例。


在下文中一共展示了QtGui.QVector3D方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _setUniformValueDirect

# 需要導入模塊: from PyQt5 import QtGui [as 別名]
# 或者: from PyQt5.QtGui import QVector3D [as 別名]
def _setUniformValueDirect(self, uniform, value):
        if type(value) is Vector:
            self._shader_program.setUniformValue(uniform, QVector3D(value.x, value.y, value.z))
        elif type(value) is Matrix:
            self._shader_program.setUniformValue(uniform, self._matrixToQMatrix4x4(value))
        elif type(value) is Color:
            self._shader_program.setUniformValue(uniform,
                QColor(value.r * 255, value.g * 255, value.b * 255, value.a * 255))
        elif type(value) is list and type(value[0]) is list and len(value[0]) == 4:
            self._shader_program.setUniformValue(uniform, self._matrixToQMatrix4x4(Matrix(value)))
        elif type(value) is list and len(value) == 2:
            self._shader_program.setUniformValue(uniform, QVector2D(value[0], value[1]))
        elif type(value) is list and len(value) == 3:
            self._shader_program.setUniformValue(uniform, QVector3D(value[0], value[1], value[2]))
        elif type(value) is list and len(value) == 4:
            self._shader_program.setUniformValue(uniform, QVector4D(value[0], value[1], value[2], value[3]))
        elif type(value) is list and type(value[0]) is list and len(value[0]) == 2:
            self._shader_program.setUniformValueArray(uniform, [QVector2D(i[0], i[1]) for i in value])
        else:
            self._shader_program.setUniformValue(uniform, value) 
開發者ID:Ultimaker,項目名稱:Uranium,代碼行數:22,代碼來源:ShaderProgram.py

示例2: setStart

# 需要導入模塊: from PyQt5 import QtGui [as 別名]
# 或者: from PyQt5.QtGui import QVector3D [as 別名]
def setStart(self, start):
        self.setStartValue(QVector3D(start.x, start.y, start.z)) 
開發者ID:Ultimaker,項目名稱:Cura,代碼行數:4,代碼來源:CameraAnimation.py

示例3: setTarget

# 需要導入模塊: from PyQt5 import QtGui [as 別名]
# 或者: from PyQt5.QtGui import QVector3D [as 別名]
def setTarget(self, target):
        self.setEndValue(QVector3D(target.x, target.y, target.z)) 
開發者ID:Ultimaker,項目名稱:Cura,代碼行數:4,代碼來源:CameraAnimation.py

示例4: qcolor_to_glvec

# 需要導入模塊: from PyQt5 import QtGui [as 別名]
# 或者: from PyQt5.QtGui import QVector3D [as 別名]
def qcolor_to_glvec(self, qcolor):
        return qtg.QVector3D(
            qcolor.red() / 255,
            qcolor.green() / 255,
            qcolor.blue() / 255
        ) 
開發者ID:PacktPublishing,項目名稱:Mastering-GUI-Programming-with-Python,代碼行數:8,代碼來源:wedge_animation.py

示例5: generateData

# 需要導入模塊: from PyQt5 import QtGui [as 別名]
# 或者: from PyQt5.QtGui import QVector3D [as 別名]
def generateData(self):
        # 生成模擬數據
        magneticFieldArray = []

        for i in range(self.m_fieldLines):
            horizontalAngle = (self.doublePi * i) / self.m_fieldLines
            xCenter = self.ellipse_a * math.cos(horizontalAngle)
            zCenter = self.ellipse_a * math.sin(horizontalAngle)

            # Rotate - arrow is always tangential to the origin.
            # 旋轉-箭頭始終與原點相切。
            yRotation = QQuaternion.fromAxisAndAngle(0.0, 1.0, 0.0,
                                                     horizontalAngle * self.radiansToDegrees)

            for j in range(self.m_arrowsPerLine):
                # Calculate the point on the ellipse centered on the origin and
                # 計算橢圓上以原點為中心的點
                # parallel to the x-axis.
                # 平行於X軸。
                verticalAngle = ((self.doublePi * j) / self.m_arrowsPerLine) + self.m_angleOffset
                xUnrotated = self.ellipse_a * math.cos(verticalAngle)
                y = self.ellipse_b * math.sin(verticalAngle)

                # Rotate the ellipse around the y-axis.
                # 圍繞Y軸旋轉橢圓。
                xRotated = xUnrotated * math.cos(horizontalAngle)
                zRotated = xUnrotated * math.sin(horizontalAngle)

                # Add the offset.
                # 添加偏移量。
                x = xCenter + xRotated
                z = zCenter + zRotated

                zRotation = QQuaternion.fromAxisAndAngle(0.0, 0.0, 1.0,
                                                         verticalAngle * self.radiansToDegrees)
                totalRotation = yRotation * zRotation

                itm = QScatterDataItem(QVector3D(x, y, z), totalRotation)
                magneticFieldArray.append(itm)

        if self.m_graph.selectedSeries() is self.m_magneticField:
            self.m_graph.clearSelection()

        self.m_magneticField.dataProxy().resetArray(magneticFieldArray) 
開發者ID:PyQt5,項目名稱:PyQt,代碼行數:46,代碼來源:MagneticOfSun.py


注:本文中的PyQt5.QtGui.QVector3D方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。