本文整理汇总了C++中BoundingBox::getDelta方法的典型用法代码示例。如果您正苦于以下问题:C++ BoundingBox::getDelta方法的具体用法?C++ BoundingBox::getDelta怎么用?C++ BoundingBox::getDelta使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BoundingBox
的用法示例。
在下文中一共展示了BoundingBox::getDelta方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: zCompare
bool zCompare(RTShape *lhs, RTShape *rhs) {
BoundingBox lBox = lhs->getBoundingBox();
BoundingBox rBox = rhs->getBoundingBox();
if (lBox.getOrigin().z() < rBox.getOrigin().z()) {
return true;
}
if ((lBox.getOrigin().z() + lBox.getDelta().z())
< (rBox.getOrigin().z() + rBox.getDelta().z()) ) {
return true;
}
return false;
}
示例2: findMedian
float SurfaceAreaHeuristic::findMedian(BoundingBox box, vector<RTShape*> shapes, int axis) {
_box = box;
_axis = axis;
_shapes = &shapes;
sort();
float cost;
float bestpos = 0;
if (shapes.size() == 0) {
return 0;
}
float bestcost = calculateCost(shapes[0]->getBoundingBox().getOrigin().get(axis),0);
float bmin = box.getOrigin().get(axis);
float bmax = box.getOrigin().get(axis) + box.getDelta().get(axis);
vector<RTShape*>::iterator it;
int i=0;
for (it = shapes.begin(); it != shapes.end(); ++it) {
BoundingBox sBox = (*it)->getBoundingBox();
float min = sBox.getOrigin().get(axis);
float max = sBox.getOrigin().get(axis) + sBox.getDelta().get(axis);
if ((cost = calculateCost(min,i)) < bestcost && min > bmin && fabs(min - bmin) > 0.0001) {
//DPRINTF("%f %f %f\n", min, bmin, min-bmin);
bestcost = cost; bestpos = min;
}
//DPRINTF("%d\n", cost);
if ((cost = calculateCost(max,i)) < bestcost && max < bmax && fabs(max - bmax) > 0.0001) {
bestcost = cost; bestpos = max;
}
//DPRINTF("%d\n", cost);
i += 1;
}
//DPRINTF("\n"); box.print();
//DPRINTF("%d %d %f\n", i, axis, bestpos);
return bestpos;
}
示例3: Vector
TEST(RTPolySet, boundingBoxShouldBeUnionOfTriangles) {
RTPolySet ps;
RTTriangle t1(Vector(0,0,0), Vector(1,0,0), Vector(1,0,1));
ps.addTriangle(t1);
RTTriangle t2(Vector(5,5,5), Vector(6,6,5), Vector(6,6,6));
ps.addTriangle(t2);
BoundingBox box = ps.getBoundingBox();
VECTOR_EQUAL(0,0,0, box.getOrigin());
VECTOR_EQUAL(6,6,6, box.getDelta());
}