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


Python core.PVector类代码示例

本文整理汇总了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
开发者ID:monkstone,项目名称:processing.py-examples,代码行数:7,代码来源:arcball.py

示例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  
开发者ID:monkstone,项目名称:processing.py-examples,代码行数:14,代码来源:arcball.py

示例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  
开发者ID:monkstone,项目名称:processing.py-examples,代码行数:15,代码来源:arcball.py

示例4: add

 def add(cls, a, b, dest=None):
     return RealPVector.add(a, b, dest)
开发者ID:kazimuth,项目名称:python-mode-processing,代码行数:2,代码来源:prepend.py

示例5: dist

 def dist(cls, a, b):
     return RealPVector.dist(a, b)
开发者ID:kazimuth,项目名称:python-mode-processing,代码行数:2,代码来源:prepend.py

示例6: angleBetween

 def angleBetween(cls, a, b):
     return RealPVector.angleBetween(a, b)
开发者ID:kazimuth,项目名称:python-mode-processing,代码行数:2,代码来源:prepend.py

示例7: div

 def div(cls, a, b, dest=None):
     return RealPVector.div(a, b, dest)
开发者ID:kazimuth,项目名称:python-mode-processing,代码行数:2,代码来源:prepend.py

示例8: sub

 def sub(cls, a, b, dest=None):
     return RealPVector.sub(a, b, dest)
开发者ID:kazimuth,项目名称:python-mode-processing,代码行数:2,代码来源:prepend.py

示例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__
开发者ID:kazimuth,项目名称:processing.py,代码行数:8,代码来源:core.py

示例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)
开发者ID:dayitv89,项目名称:processing.py,代码行数:15,代码来源:core.py

示例11: add

 def add(cls, a, b, dest=None):
     return __pvector__.add(a, b, dest)
开发者ID:bhaskar4n,项目名称:processing.py,代码行数:2,代码来源:core.py

示例12: sub

 def sub(cls, a, b, dest=None):
     return __pvector__.sub(a, b, dest)
开发者ID:bhaskar4n,项目名称:processing.py,代码行数:2,代码来源:core.py

示例13: __magSq__

def __magSq__(a):
    return __pvector__.magSq(a)
开发者ID:bhaskar4n,项目名称:processing.py,代码行数:2,代码来源:core.py

示例14: fromAngle

 def fromAngle(cls, a, target=None):
     return __pvector__.fromAngle(a, target)
开发者ID:bhaskar4n,项目名称:processing.py,代码行数:2,代码来源:core.py

示例15: angleBetween

 def angleBetween(cls, a, b):
     return __pvector__.angleBetween(a, b)
开发者ID:bhaskar4n,项目名称:processing.py,代码行数:2,代码来源:core.py


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