- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
How to get the centroid of surface??? please~
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
05-22-2011 08:55 AM
Hi
i made the surface using api function - api_mk_fa_spl_ctrlpts()
this surface is closed.
i want to get the centroid the this surface but i don't know..
api_body_mass_props)?? if this function is right, how can i use this function.
i tried to test this function
ex)
BODY* bod = NULL;
api_make_cuboid(100,150,200, bod, NULL);
mass_prop;
api_body_mass_prop(bod,mpop, NULL,NULL);
SPAposition cp = mpop.get_centroid();
printf("%f %f %f\n",cp.x(), cp.y(), cp.z());
----------------------------------------------
result is 0.00000 0.00000 0.00000
this is wrong???
i'm starter. please help me !
Re: How to get the centroid of surface??? please~
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
05-22-2011 11:46 AM
Kobofa, Your cuboid (solid block) is created with its center at the origin. Therefore, the center of mass is located at the origin.
Try to achieve the desired effect by using api_solid_block ().
Best regards!
Re: How to get the centroid of surface??? please~
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
05-23-2011 12:43 AM
thank you !
i will try that.
then..how to get the centroid of face??? convert to solid from face?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
05-23-2011 03:00 AM
Re: then..how to get the centroid of face??? convert to solid from face?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
05-23-2011 08:20 AM
Hi kobofa,
You can call api_mk_by_faces to convert the face to a body, then use the mass-props API to get the centroid.
John
Re: then..how to get the centroid of face??? convert to solid from face?
[ Edited ]- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
05-26-2011 12:14 AM - last edited on 05-26-2011 12:17 AM
thank you
BODY* cucu = NULL;
BODY* cici = NULL;
api_mk_by_faces(cucu,4,Bspsurface_array,cici,NULL)
mass_props mpop;
api_body_mass_props(cucu,mpop,NULL,NULL);
double cp = mpop.get_volume();
printf("%lf\n",cp);
my code is that;
but didn't calculate the volume --;
what's wrong? hm..
i attached modeling picture; the picture is 4 surface;
Re: then..how to get the centroid of face??? convert to solid from face?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
05-26-2011 08:25 AM
Hi kobofa,
The API api_mk_by_faces does not create a solid body - it merely collects the input faces into a single body as single-shell lumps, all of which are 2D and have zero volume. This should be sufficient to calculate centroids, as in your original question.
If you need to make a solid from the surfaces in your picture, you will need to trim the faces so that you have coincident edges, then use the stitcher to create the solid. I'm sorry, but I'm not a stitcher expert, so maybe someone else can help you with this new question if it is important to you.
Best regards,
John
Re: thank you for your answer. john.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
06-09-2011 12:35 AM
then..this model is made by 6 faces. this is trimed surface. then don't covert to solid from 6 face???
kobofa, some fun api's to explore with stitching surfaces.. .
[ Edited ]
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
06-27-2011 11:12 AM - last edited on 06-27-2011 11:18 AM
kobofa, some fun api's to explore with stitching surfaces are api_imprint_stitch and api_stitch. You can use them to stitch together collections of untrimmed surfaces and later use for other modeling operations as in the video below.
http://www.csi-concepts.com/Demo/videos/stitched2.
Regards
Tim

