本文整理汇总了C++中ofPtr::getMeanPos_abs方法的典型用法代码示例。如果您正苦于以下问题:C++ ofPtr::getMeanPos_abs方法的具体用法?C++ ofPtr::getMeanPos_abs怎么用?C++ ofPtr::getMeanPos_abs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ofPtr
的用法示例。
在下文中一共展示了ofPtr::getMeanPos_abs方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: repellNode
void zoneManager::repellNode(ofPtr<clamourNode> n, ofPtr<zone> z) {
// cout << "repell \n";
//finding centroid is not solved here so this method only works if zones drawn from the center
ofVec2f v = n->getMeanPos_abs() - n->getIntersect();
ofPoint p = clamourUtils::getInsideIntersect(z->getOuterEdge(), z->getPos_abs(), n->getIntersect());
p = p + v;
n->setRawPos_abs(p);
n->modifyHistory();
}
示例2: checkForCollisions
void nodeManager::checkForCollisions(ofPtr<clamourNode> n) {
bool collisionFound = false;
for(int i = 0; i < mCollisionMapBounds.size(); i ++) {
if(mCollisionMapBounds[i].inside(n->getMeanPos_abs())) {
vector <ofPtr<clamourNode> >::iterator target;
target = mCollisionMap[i].begin();
while(target != mCollisionMap[i].end()) {
if(*target != n) {
if((*target)->getBounds().inside(n->getMeanPos_abs())) {
bool isCollision = clamourUtils::pointInPath((*target)->getOuterEdge(), n->getMeanPos_abs());
if(isCollision) {
if(!n->getIsColliding() && !(*target)->getIsColliding())implementReactions(n , *target);
n->setIsColliding(true);
(*target)->setIsColliding(true);
collisionFound = true;
}
}
}
++target;
}
}
}
n->setIsColliding(collisionFound);
}
示例3: containNode
void zoneManager::containNode(ofPtr<clamourNode> n, ofPtr<zone> z) {
ofPoint intersect;
bool isOutside = clamourUtils::pathOutPath( n->getOuterEdge(), z->getOuterEdge(), intersect);
if(isOutside) {
ofVec2f v = n->getMeanPos_abs() - intersect;
ofVec2f vi(intersect - z->getPos_abs());
ofPoint p = clamourUtils::getInsideIntersect(z->getOuterEdge(), z->getPos_abs(), intersect);
ofVec2f d = (p - z->getPos_abs());
p -= d * 0.05; //move it slightly inside
p = p + v;
if(d.length() * 0.95 < vi.length()) { //only if necessary
n->setRawPos_abs(p);
n->modifyHistory();
}
}
}