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


Python Vector.z方法代码示例

本文整理汇总了Python中UM.Math.Vector.Vector.z方法的典型用法代码示例。如果您正苦于以下问题:Python Vector.z方法的具体用法?Python Vector.z怎么用?Python Vector.z使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UM.Math.Vector.Vector的用法示例。


在下文中一共展示了Vector.z方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Vertex

# 需要导入模块: from UM.Math.Vector import Vector [as 别名]
# 或者: from UM.Math.Vector.Vector import z [as 别名]
class Vertex(object):
    ##  Construct a vertex.
    #
    #   Possible keyword parameters:
    #   - position: Vector with the vertex' position.
    #   - normal: Vector with the vertex' normal
    #
    #   Unnamed arguments:
    #   - x, y, z passed as numbers.
    def __init__(self, *args, **kwargs):
        self._position = Vector()
        self._normal = None

        if len(args) == 3:
            self._position = Vector(args[0], args[1], args[2])

        if "position" in kwargs:
            self._position = kwargs["position"]

        if "normal" in kwargs:
            self._normal = kwargs["normal"]

    ##  Get the position the vertex
    #   \returns position Vector
    @property
    def position(self):
        return self._position

    ##  Set the position the vertex
    #   \param position Vector
    def setPosition(self, position):
        self._position = position
    
    ##  Get the normal the vertex
    #   \returns normal Vector
    @property
    def normal(self):
        return self._normal
    
    ##  Set the normal the vertex
    #   \param normal Vector
    def setNormal(self, normal):
        self._normal = normal

    def hasNormal(self):
        return self._normal != None
    
    ##  Convert the vertex into a string, which is required for parsing over sockets / streams
    #   It's kinda hackish to do it this way, but it would take to much effort to implement myself.
    def toString(self):
        return numpy.array([self._position.x(),self._position.y(),self._position.z(),self._normal.x(),self._normal.y(),self._normal.z()]).tostring()
开发者ID:Kiddo3D,项目名称:Uranium,代码行数:53,代码来源:Vertex.py


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