当前位置: 首页>>代码示例>>C++>>正文


C++ BoundingBox::getDelta方法代码示例

本文整理汇总了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;

}
开发者ID:havardh,项目名称:ECE594Q,代码行数:16,代码来源:SurfaceAreaHeuristic.cpp

示例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;
}
开发者ID:havardh,项目名称:ECE594Q,代码行数:47,代码来源:SurfaceAreaHeuristic.cpp

示例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());

}
开发者ID:havardh,项目名称:ECE594Q,代码行数:14,代码来源:RTPolySetTest.cpp


注:本文中的BoundingBox::getDelta方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。