hi
i'm learning hdk and don't know how to get the centroid position of a group in hdk?
is there any function to get the central point position for the input group or is there any way/ways to get the central point position?
Thanks
hdk group centroid position
4816 3 1- totopu
- Member
- 3 posts
- Joined: 8月 2007
- Offline
- lucap
- Member
- 31 posts
- Joined: 7月 2005
- Offline
I don't know if there's a function that does this for you (might want to look at UT_BoundingBox). I did it the old fashion way:
FOR_ALL_GPOINTS(gdp, ppt)
{
UT_Vector4 pos4=ppt->getPos();
txSum+=pos4.x()/pos4.w();
tySum+=pos4.y()/pos4.w();
tzSum+=pos4.z()/pos4.w();
}
myCEX=txSum/myTotalPoints;
myCEY=tySum/myTotalPoints;
myCEZ=tzSum/myTotalPoints;
hope that helps
Luca
FOR_ALL_GPOINTS(gdp, ppt)
{
UT_Vector4 pos4=ppt->getPos();
txSum+=pos4.x()/pos4.w();
tySum+=pos4.y()/pos4.w();
tzSum+=pos4.z()/pos4.w();
}
myCEX=txSum/myTotalPoints;
myCEY=tySum/myTotalPoints;
myCEZ=tzSum/myTotalPoints;
hope that helps
Luca
- totopu
- Member
- 3 posts
- Joined: 8月 2007
- Offline
- edward
- Member
- 7899 posts
- Joined: 7月 2005
- Offline
-
- Quick Links