本文整理汇总了Python中processing.core.PVector类的典型用法代码示例。如果您正苦于以下问题:Python PVector类的具体用法?Python PVector怎么用?Python PVector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PVector类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __constrain
def __constrain(self, vector, axis):
"""
private constrain (used to constrain axis)
"""
vector.sub(axis.mult(axis, PVector.dot(axis, vector)))
vector.normalize()
return vector
示例2: __init__
def __init__(self, cx, cy, radius):
"""
Initialize instance of ArcBall with no constraint on axis of rotation
"""
self.center_x = cx
self.center_y = cy
self.radius = radius
self.v_down = PVector()
self.v_drag = PVector()
self.q_now = Quaternion()
self.q_down = Quaternion()
self.q_drag = Quaternion()
self.axis_set = [PVector(1.0, 0.0, 0.0), PVector(0.0, 1.0, 0.0), PVector(0.0, 0.0, 1.0)]
self.axis = -1
示例3: __mouse2sphere
def __mouse2sphere(self, x, y):
"""
private map mouse to ArcBall (sphere)
"""
v = PVector()
v.x = (x - self.center_x) / self.radius
v.y = (y - self.center_y) / self.radius
mag = v.x * v.x + v.y * v.y
if (mag > 1.0) :
v.normalize()
else:
v.z = sqrt(1.0 - mag)
if (self.axis != -1):
v = self.__constrain(v, self.axis_set[self.axis])
return v
示例4: add
def add(cls, a, b, dest=None):
return RealPVector.add(a, b, dest)
示例5: dist
def dist(cls, a, b):
return RealPVector.dist(a, b)
示例6: angleBetween
def angleBetween(cls, a, b):
return RealPVector.angleBetween(a, b)
示例7: div
def div(cls, a, b, dest=None):
return RealPVector.div(a, b, dest)
示例8: sub
def sub(cls, a, b, dest=None):
return RealPVector.sub(a, b, dest)
示例9: __init__
def __init__(self, x=0, y=0, z=0):
__pvector__.__init__(self, x, y, z)
self.add = self.__instance_add__
self.sub = self.__instance_sub__
self.mult = self.__instance_mult__
self.div = self.__instance_div__
self.cross = self.__instance_cross__
self.dist = self.__instance_dist__
示例10: __instance_lerp__
def __instance_lerp__(self, *args):
if len(args) == 4:
x = args[0]
y = args[1]
z = args[2]
t = args[3]
elif len(args) == 2:
v = args[0]
x = v.x
y = v.y
z = v.z
t = args[1]
else:
raise Exception('lerp takes either (x, y, z, t) or (v, t)')
__pvector__.lerp(self, x, y, z, t)
示例11: add
def add(cls, a, b, dest=None):
return __pvector__.add(a, b, dest)
示例12: sub
def sub(cls, a, b, dest=None):
return __pvector__.sub(a, b, dest)
示例13: __magSq__
def __magSq__(a):
return __pvector__.magSq(a)
示例14: fromAngle
def fromAngle(cls, a, target=None):
return __pvector__.fromAngle(a, target)
示例15: angleBetween
def angleBetween(cls, a, b):
return __pvector__.angleBetween(a, b)