# How to find the centroid of a NURBS surface using C APIs of Hoops exchange?

**URL:** <https://forum.techsoft3d.com/t/how-to-find-the-centroid-of-a-nurbs-surface-using-c-apis-of-hoops-exchange/4335>\
**Category:** HOOPS Exchange\
**Created:** [January 17, 2025, 7:55am UTC](https://forum.techsoft3d.com/t/how-to-find-the-centroid-of-a-nurbs-surface-using-c-apis-of-hoops-exchange/4335 "2025-01-17T07:55:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![chandras](https://avatars.discourse-cdn.com/v4/letter/c/49beb7/32.png) [@chandras](https://forum.techsoft3d.com/u/chandras)\
**Post date:** [January 17, 2025, 7:55am UTC](https://forum.techsoft3d.com/t/how-to-find-the-centroid-of-a-nurbs-surface-using-c-apis-of-hoops-exchange/4335/1 "2025-01-17T07:55:33Z")

</div>

I am trying to find the centroid of NURB surface using Hoops exchange APIs. Please suggest some ideas. I used A3DComputePhysicalProperties to compute the centroid. It required converting of A3DRiBrepModel from a A3DTopoFace. But the in general this method is very slow (though i got the correct centroid) because this API is loaded with other computation of physical properties and I do not know the resolution of integration . can anybody suggest a better way to compute centroid of NURBS surface using Hoops API or we need to integrate manually.

---

<div class="post-metadata">

**Author:** ![Man](https://avatars.discourse-cdn.com/v4/letter/m/f17d59/32.png) [@Man](https://forum.techsoft3d.com/u/Man)\
**Post date:** [January 20, 2025, 2:25pm UTC](https://forum.techsoft3d.com/t/how-to-find-the-centroid-of-a-nurbs-surface-using-c-apis-of-hoops-exchange/4335/2 "2025-01-20T14:25:22Z")

</div>

Hello @chandras  
It looks like `A3DComputePhysicalProperties` is the current API for getting the centroid (`A3DPhysicalPropertiesData::m_sGravityCenter`). However, you mentioned that this method is slow. Can you provide more details, such as CAD data, specific results you obtained? This information will help us investigate further and possibly suggest optimizations or alternative approaches for your use case. Thank you.

Best Regards,  
Man

---

<div class="post-metadata">

**Author:** ![chandras](https://avatars.discourse-cdn.com/v4/letter/c/49beb7/32.png) [@chandras](https://forum.techsoft3d.com/u/chandras)\
**Post date:** [January 21, 2025, 8:02am UTC](https://forum.techsoft3d.com/t/how-to-find-the-centroid-of-a-nurbs-surface-using-c-apis-of-hoops-exchange/4335/3 "2025-01-21T08:02:03Z")

</div>

Hi man

Thank you for your response. You can take any complex model and adapt it to have only NURB surfaces using the `A3DAdaptAndReplaceAllBrepInModelFile` function, ensuring all surfaces are converted to NURB. Then, measure the computation time required to determine the gravity center (`A3DPhysicalPropertiesData::m_sGravityCenter`). For some models, this process takes an exceptionally long time (up to 50 minutes for the model I have) to compute the centroid of all the NURB surfaces.

If ‘m\_sGravityCenter’ is computed using an iterative method, it is possible that the process takes a long time to converge. This could explain the delays observed. If you are interested in discussing this further, feel free to email me at my provided email address to arrange a meeting.

chandra
