2012-10-27 67 views
-1

什麼樣的參數,我需要發送此功能,爲它工作,我是有點小白什麼樣的參數,我需要發送此功能爲它工作

def TransformSmoothParameters(vPoint): 
    """returns depthX (float), depthY (float), depthValue (int)""" 

    if vPoint.vector.z > _FLT_EPSILON: 

    # Center of depth sensor is at (0,0,0) in skeleton space, and 
    # and (160,120) in depth image coordinates. Note that positive Y 
    # is up in skeleton space and down in image coordinates. 
    # 

    pfDepthX = 0.5 + vPoint.vector.x * _NUI_CAMERA_SKELETON_TO_DEPTH_IMAGE_MULTIPLIER_320x240/(vPoint.vector.z * 320.0) 
    pfDepthY = 0.5 - vPoint.vector.y * _NUI_CAMERA_SKELETON_TO_DEPTH_IMAGE_MULTIPLIER_320x240/(vPoint.vector.z * 240.0) 

    # 
    # Depth is in meters in skeleton space. 
    # The depth image pixel format has depth in millimeters shifted left by 3. 
    # 

    pusDepthValue = int(vPoint.vector.z * 1000) << 3 
    return pfDepthX, pfDepthY, pusDepthValue 

return 0.0, 0.0, 0 

某種數組的?它會是什麼樣子?

回答

3

看起來你需要傳遞一個對象給函數。對象則有一個名爲vector數據屬性(這是另一個對象),其中有數據屬性xyz

下面的僞代碼可能會更清楚:

class vPoint: 
     def __init__(self, vector): 
      self.vector = vector 

    class vector: 
     def __init__(self, x, y, z): 
      self.x = #the x value 
      self.y = #the y value 
      self.z = #the z value 

這種方式,例如,您可以使用代碼中指定的vPoint.vector.x訪問x值。

相關問題