title: Where is the center of vertices from multiple-objects in Maya?
body: <p>I want to find the center (by center I mean the default pivot position) of a selection of vertices coming from <strong>multiple objects</strong> in Maya. I thought it was the <a href="https://en.wikipedia.org/wiki/Centroid" rel="nofollow noreferrer">centroid</a> but it seems that this does not returns the correct coordinates.</p>
  
  <p>Here is an example:
  <a href="https://i.stack.imgur.com/GkmOO.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GkmOO.jpg" alt="enter image description here"></a></p>
  
  <p>I selected four vertices, the two poles of each sphere. In red is the "center" of this vertices, where Maya place the default pivot, and in blue is the centroid as I computed it.</p>
  
  <p>Either my computations are wrong or the center of the vertices is not the centroid, anyway these are clearly not the same coordinates. Here is my code:</p>
  
  <pre><code>loc = cmds.spaceLocator ()[0]
  vtxList = cmds.ls (sl = True, fl = True)
  
  vtxPosSum = [0, 0, 0]
  for vtx in vtxList:
      vtxPos = cmds.xform (vtx, q = True, ws = True, t = True)
      vtxPosSum[0] += vtxPos[0]
      vtxPosSum[1] += vtxPos[1]
      vtxPosSum[2] += vtxPos[2]
  
  barycentre = [vtxPosSum[0] / len(vtxList),
                vtxPosSum[1] / len(vtxList),
                vtxPosSum[2] / len(vtxList)]
  
  cmds.xform (loc, ws = True, t = barycentre)
  </code></pre>
  
  <p>So my question is, <strong>how can I find the position of the default Maya pivot when selecting vertices from multiple polygons?</strong></p>
  
  <p>Thanks</p>