title: Joint Weight Interpolation Maya
body: <p>How can you calculate the joint weight values of a point on a face in maya. Say we have a plane and we want to calculate what it's interpolated weight would be at an arbitrary point on the face. I know the copy skin weights tool in maya does a great job of this interpolation, but am not sure of the math behind it.</p>
  
  <pre><code>import maya.cmds as cmds
  
  if __name__ == '__main__':
      # Build two planes. One with no subdivs and one with 2.
      plane = cmds.polyPlane(name="plane_GEO",
                             subdivisionsX=1,
                             subdivisionsY=1,
                             width=10.0,
                             height=10.0)
      planeRef = cmds.polyPlane(name="plane_cn_GEO",
                                subdivisionsX=2,
                                subdivisionsY=2,
                                width=10.0,
                                height=10.0)
  
      #Move vertices.
      cmds.move(2, 0, 0, "%s.vtx[1]" % planeRef[0], relative=True)
      cmds.move(2, 0, 0, "%s.vtx[4]" % planeRef[0], relative=True)
      cmds.move(2, 0, 0, "%s.vtx[7]" % planeRef[0], relative=True)
      cmds.move(0, 0, 2, "%s.vtx[3:5]" % planeRef[0], relative=True)
  
      #Make joints.
      cmds.select(clear=True)
      jntA = cmds.joint(name="a_JNT", p=[5, 0, -5])
      cmds.select(clear=True)
      jntB = cmds.joint(name="b_JNT", p=[5, 0, 5])
      cmds.select(clear=True)
      jntC = cmds.joint(name="c_JNT", p=[-5, 0, 5])
      cmds.select(clear=True)
      jntD = cmds.joint(name="d_JNT", p=[-5, 0, -5])
      cmds.select(clear=True)
  
      #Bind joints.
      skinA = cmds.skinCluster([jntA, jntB, jntC, jntD],
                               plane[0],
                               name='%s_SKNCLUST' % plane[0],
                               toSelectedBones=True,
                               skinMethod=1,
                               normalizeWeights=1)
  
      skinB = cmds.skinCluster([jntA, jntB, jntC, jntD],
                               planeRef[0],
                               name='%s_SKNCLUST' % planeRef[0],
                               toSelectedBones=True,
                               skinMethod=1,
                               normalizeWeights=1)
  
      #Copy skin weight for reference of what joint weight is supposed to be.
      cmds.copySkinWeights(sourceSkin=skinA[0],
                           destinationSkin=skinB[0],
                           noMirror=True,
                           surfaceAssociation="closestPoint",
                           influenceAssociation="name")
      #Hide it.
      cmds.setAttr(planeRef[0] + ".visibility", 0)
  
      #Make a locator at a position.
      loc = cmds.spaceLocator(name="anno_LOC")
      cmds.move(2, 0, 2, loc[0])
  
      #Make an annotation.
      ano = cmds.annotate(loc[0],
                          tx="What is the joint weight values at this point?",
                          p=[2, 5, 2])
      anoTrans = cmds.listRelatives(ano, parent=True)
      cmds.rename(anoTrans, "weight_ANNOTATE")
  </code></pre>
  
  <p>This is a simple scene for showing of what I mean in maya. Hopefully it clears up the idea.</p>
  
  <p>Thanks for any help.</p>