本文整理汇总了C++中Mapping::findMapping方法的典型用法代码示例。如果您正苦于以下问题:C++ Mapping::findMapping方法的具体用法?C++ Mapping::findMapping怎么用?C++ Mapping::findMapping使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mapping
的用法示例。
在下文中一共展示了Mapping::findMapping方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: convertSub
bool PoseSeqItem::convertSub(BodyPtr orgBody, const Mapping& convInfo)
{
bool converted = false;
const Listing& jointMap = *convInfo.findListing("jointMap");
const Mapping& linkMap = *convInfo.findMapping("linkMap");
BodyPtr body = ownerBodyItem->body();
for(PoseSeq::iterator p = seq->begin(); p != seq->end(); ++p){
PosePtr pose = p->get<Pose>();
if(pose){
bool modified = false;
seq->beginPoseModification(p);
PosePtr orgPose = dynamic_cast<Pose*>(pose->duplicate());
if(jointMap.isValid()){
modified = true;
pose->setNumJoints(0);
int n = orgPose->numJoints();
for(int i=0; i < n; ++i){
if(orgPose->isJointValid(i)){
if(i < jointMap.size()){
int newJointId = jointMap[i].toInt();
if(newJointId >= 0){
pose->setJointPosition(newJointId, orgPose->jointPosition(i));
pose->setJointStationaryPoint(newJointId, orgPose->isJointStationaryPoint(i));
}
}
}
}
}
if(linkMap.isValid()){
modified = true;
pose->clearIkLinks();
int baseLinkIndex = -1;
for(Pose::LinkInfoMap::const_iterator q = orgPose->ikLinkBegin(); q != orgPose->ikLinkEnd(); ++q){
Link* orgLink = orgBody->link(q->first);
string linkName;
ValueNode* linkNameNode = linkMap.find(orgLink->name());
if(linkNameNode->isValid()){
linkName = linkNameNode->toString();
} else {
linkName = orgLink->name();
}
Link* link = body->link(linkName);
if(link){
const Pose::LinkInfo& orgLinkInfo = q->second;
Pose::LinkInfo* linkInfo = pose->addIkLink(link->index());
linkInfo->p = orgLinkInfo.p;
linkInfo->R = orgLinkInfo.R;
linkInfo->setStationaryPoint(orgLinkInfo.isStationaryPoint());
if(orgLinkInfo.isTouching()){
linkInfo->setTouching(orgLinkInfo.partingDirection());
}
linkInfo->setSlave(orgLinkInfo.isSlave());
if(orgLinkInfo.isBaseLink()){
baseLinkIndex = link->index();
}
}
}
if(baseLinkIndex >= 0){
pose->setBaseLink(baseLinkIndex);
}
}
if(modified){
seq->endPoseModification(p);
converted = true;
}
}
}
return converted;
}