-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

ある種の配列?それはどのように見えるでしょうか?

4

1 に答える 1

3

関数にオブジェクトを渡す必要があるようです。次に、オブジェクトには、データ属性を持つvector(別のオブジェクトである)というデータ属性xyあり、z

以下の擬似コードはそれをより明確にするかもしれません:

    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

このようにして、たとえば、コードで指定されているようにxを使用して値にアクセスできます。vPoint.vector.x

于 2012-10-27T02:36:20.187 に答える