本文整理汇总了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()