How to know a centroid of ON_Curve ?(C++/Rhino5)

I want to know the centroid of curve.
I find the AreaMassProperties method.
Can I use it to calculate the centroid ?
But, how to set two parameters,base_point and plane_normal ?

base_point (0,0,0) ?
plane_normal (0,0,1)?

bool AreaMassProperties(ON_3dPoint base_point, ON_3dVector plane_normal, ON_MassProperties& mp, bool bArea = true, bool bFirstMoments = true, bool bSecondMoments = true, bool bProductMoments = true, double rel_tol = 1.0e-6, double abs_tol = 1.0e-6) const;

See the following example.

https://github.com/mcneel/Rhino5Samples_CPP/blob/master/SampleCommands/cmdSampleCurveAreaCentroid.cpp

1 Like

Thank you. :smile:
I have a problem like below,because my curve may be open and be not on a plane.

  if (crv && crv->IsClosed() && crv->IsPlanar(0, ON_ZERO_TOLERANCE))
    rc = true;

like this file.
ProbCrvCG.3dm (60.0 KB)

Rhino’s AreaCentroid command doesn’t work on these curves (either).