Commit b5fc91ea authored by Matthias Möller's avatar Matthias Möller

add leafCount for scripting

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@13628 383ad7c9-94d9-4d36-a494-682f7c89f535
parent fe5eaa97
......@@ -127,6 +127,8 @@ class InfoSkeletonObjectPlugin : public QObject, BaseInterface, InformationInter
int jointCount(int _skeletonID);
/// get total number of branches for a given skeleton
int branchCount(int _skeletonID);
/// get total number of joints which have no childs for a given skeleton
int leafCount(int _skeletonID);
/// get minumum bounding box point
Vector boundingBoxMin(int _skeletonID);
......
......@@ -36,7 +36,7 @@
* *
* $Revision$ *
* $LastChangedBy$ *
* $Date$ *
* $Date$ *
* *
\*===========================================================================*/
#include "SkeletonObjectInfoPlugin.hh"
......@@ -55,6 +55,11 @@ void InfoSkeletonObjectPlugin::setDescriptions()
emit setSlotDescription("branchCount(int)",tr("get total number of branches for a given skeleton"),
QStringList(tr("skeletonID")), QStringList(tr("id of a skeleton")));
emit setSlotDescription("leafCount(int)",tr("get total number of leaves for a given skeleton"),
QStringList(tr("skeletonID")), QStringList(tr("id of a skeleton")));
emit setSlotDescription("boundingBoxMin(int)",tr("get minimum point of the axis-aligned bounding box"),
QStringList(tr("skeletonID")), QStringList(tr("id of a skeleton")));
......@@ -115,6 +120,25 @@ int InfoSkeletonObjectPlugin::branchCount(int _skeletonID)
//-----------------------------------------------------------------------------
int InfoSkeletonObjectPlusgins::leafCount(int _skeletonID)
{
Skeleton* skeleton = PluginFunctions::skeleton(_skeletonID);
if ( !skeleton )
{
emit log(LOGERR, tr("Unable to get skeleton"));
return -1;
}
int result = 0;
for (Skeleton::Iterator iter = skeleton->begin(); iter != skeleton->end(); ++iter)
if (iter->size() == 0)
++result;
return result;
}
//-----------------------------------------------------------------------------
Vector InfoSkeletonObjectPlugin::boundingBoxMin(int _skeletonID)
{
SkeletonObject* skeleton = PluginFunctions::skeletonObject(_skeletonID);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment