.. # split from OEMathFunctions.rst:323

.. include:: ../substitutions

.. oe:namespace:: OEMath

.. meta::
   :keywords: OEGeom3DGetCenterOfMass

.. oe:function:: OEGeom3DGetCenterOfMass

   .. oe:language:: c++ java csharp

      .. oe:api::

         template<class T, class U>
         void OEGeom3DGetCenterOfMass(const T* xyz, unsigned int ncoord, U* com)
         template<class T, class U, class Z>
         void OEGeom3DGetCenterOfMass(const T* xyz, unsigned int ncoord,
                                      U* com, Z* weights)

   .. oe:language:: python

      .. oe:api:: python

         OEGeom3DGetCenterOfMass(xyz: OEFloatArray, ncoord: int,
                                 com: OEFloatArray) -> None
         OEGeom3DGetCenterOfMass(xyz: OEDoubleArray, ncoord: int,
                                 com: OEDoubleArray) -> None
         OEGeom3DGetCenterOfMass(xyz: OEFloatArray, ncoord: int,
                                 com: OEFloatArray, weights: OEFloatArray) -> None
         OEGeom3DGetCenterOfMass(xyz: OEDoubleArray, ncoord: int,
                                 com: OEDoubleArray, weights: OEDoubleArray) -> None

   Calculates the center-of-mass for the coordinates given by ``xyz``
   and places the cartesian center-of-mass in the output ``com``
   argument. The number of 3-element cartesian coordinates is
   specified by the ``ncoord`` parameter. Note, ``weights`` can be
   specified to weight each of the cartesian points differently.


