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


C++ BoundingBox函数代码示例

本文整理汇总了C++中BoundingBox函数的典型用法代码示例。如果您正苦于以下问题:C++ BoundingBox函数的具体用法?C++ BoundingBox怎么用?C++ BoundingBox使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了BoundingBox函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ti

// -----------------------------
// QtImage_IO::getVolumeFileInfo
// -----------------------------
// Purpose:
//   Nothing yet.
// ---- Change History ----
// 04/24/2010 -- Joe R. -- Initial implementation.
void QtImage_IO::getVolumeFileInfo(VolumeFileInfo::Data& data,
                                   const std::string& filename) const
{
    CVC::ThreadInfo ti(BOOST_CURRENT_FUNCTION);

    QImage img(filename.c_str());
    if(img.isNull())
        throw ReadError(
            boost::str(
                boost::format("QImage could not read %1%") % filename
            )
        );

    data._filename = filename;
    data._dimension = Dimension(img.width(),img.height(),1);
    data._boundingBox = BoundingBox(0.0,0.0,0.0,
                                    img.width()+1,
                                    img.height()+1,
                                    0.0);
    data._numVariables = 1; //just using grayscale for now, so 1 var
    data._numTimesteps = 1;
    data._voxelTypes = std::vector<VoxelType>(1,UChar);

    data._names.clear();
    data._names.push_back("QImage");
    data._tmin = 0.0;
    data._tmax = 0.0;

    data._minIsSet.clear();
    data._minIsSet.resize(data._numVariables);
    for(int i=0; i<data._minIsSet.size(); i++) data._minIsSet[i].resize(data._numTimesteps);
    data._min.clear();
    data._min.resize(data._numVariables);
    for(int i=0; i<data._min.size(); i++) data._min[i].resize(data._numTimesteps);
    data._maxIsSet.clear();
    data._maxIsSet.resize(data._numVariables);
    for(int i=0; i<data._maxIsSet.size(); i++) data._maxIsSet[i].resize(data._numTimesteps);
    data._max.clear();
    data._max.resize(data._numVariables);
    for(int i=0; i<data._max.size(); i++) data._max[i].resize(data._numTimesteps);
}
开发者ID:SoumyajitG,项目名称:VolRoverN,代码行数:48,代码来源:QtImage_IO.cpp

示例2: BoundedObject

World::World(double _width, double _height)
	: BoundedObject(Pd(), Qd(),
	  BoundingBox(Pd(-_width/2, -_height/2, 0), Pd(_width,0,0), Pd(0,_height,0), Pd(_width,_height,0), Pd(), Pd(), Pd(), Pd(_width/2, _height/2, HIGH)),
	  Assets::WorldMaterial)
{

	ObjectHandle tHandle;
	tHandle = Terrain(_width, _height);
	terrain = TO(Terrain, tHandle);
	children.insert(tHandle);

	ObjectHandle hudHandle;
	hudHandle = HUD(640, 480);
	hud = TO(HUD, hudHandle);
	children.insert(hudHandle);

	children.insert(Sky((int) _width, (int) _height));

	width = _width;
	height = _height;
}
开发者ID:FerryT,项目名称:OGO-2.3,代码行数:21,代码来源:world.cpp

示例3: switch

void ImagePane::deleteCurrentBox()
        //if an inscription or surface box is deleted
        //all boxes below it in the hierarchy (graphs, or graphs and inscriptions)
        //are deleted too
{
    if(locked || currentBoxIndex == -1)
        return;
    switch(mode)
    {
    case SURFACE:
        if(surf->inscriptionCount() == 0 || confirmDelete("inscription"))
        {
            *surf = BoundingBox(QPoint(0,0), QPoint(0,0), 0);
            surf->deleteAllInscriptions();
            emit inscrImgListModified(); //signal picked up by TranscriptionWindow
            currentBoxIndex = -1;
        }
        break;
	case INSCRIPTION:
        if(surf->ptrInscrAt(currentBoxIndex)->boxCount() == 0
           || confirmDelete("graph"))
        {
            surf->deleteInscr(currentBoxIndex);
            emit inscrImgListModified(); //signal picked up by TranscriptionWindow
            currentBoxIndex--;
            if(currentBoxIndex == -1)
                currentBoxIndex = surf->inscriptionCount() - 1;
        }
        break;
	case GRAPH:
        surf->ptrInscrAt(currentInscrIndex)->deleteBox(currentBoxIndex);
        currentBoxIndex--;
        if(currentBoxIndex == -1)
            currentBoxIndex = surf->ptrInscrAt(currentInscrIndex)->count() - 1;
        break;
    default:
       break;
    }
    update();
}
开发者ID:cangjie-info,项目名称:ecdbgui,代码行数:40,代码来源:image_pane.cpp

示例4: KDTree

void PhotonMapping::TracePhotons() {
  std::cout << "trace photons" << std::endl;

  // first, throw away any existing photons
  delete kdtree;

  // consruct a kdtree to store the photons
  BoundingBox *bb = mesh->getBoundingBox();
  Vec3f min = bb->getMin();
  Vec3f max = bb->getMax();
  Vec3f diff = max-min;
  min -= 0.001*diff;
  max += 0.001*diff;
  kdtree = new KDTree(BoundingBox(min,max));

  // photons emanate from the light sources
  const std::vector<Face*>& lights = mesh->getLights();

  // compute the total area of the lights
  double total_lights_area = 0;
  for (unsigned int i = 0; i < lights.size(); i++) {
    total_lights_area += lights[i]->getArea();
  }

  // shoot a constant number of photons per unit area of light source
  // (alternatively, this could be based on the total energy of each light)
  for (unsigned int i = 0; i < lights.size(); i++) {  
    double my_area = lights[i]->getArea();
    int num = args->num_photons_to_shoot * my_area / total_lights_area;
    // the initial energy for this photon
    Vec3f energy = my_area/double(num) * lights[i]->getMaterial()->getEmittedColor();
    Vec3f normal = lights[i]->computeNormal();
    for (int j = 0; j < num; j++) {
      Vec3f start = lights[i]->RandomPoint();
      // the initial direction for this photon (for diffuse light sources)
      Vec3f direction = RandomDiffuseDirection(normal);
      TracePhoton(start,direction,energy,0);
    }
  }
}
开发者ID:HowOriginal,项目名称:AdvGraphicsProject,代码行数:40,代码来源:photon_mapping.cpp

示例5: BraunnerPoint

BraunnerTree::BraunnerTree(int _depth,vec3 _halfDimension, vec3 _center){

	if (_depth>=0)
	{
		this->nodeObjects = new BraunnerPoint();
		this->depth = depth;
		this->origin = _center;
		this->halfDimension = _halfDimension;
		myBox = BoundingBox(origin-halfDimension,origin+halfDimension);
		for(int i=0; i<8; ++i)
			{
			// Calcular a nova bounding box das folhas (ou ramos)
			vec3 newOrigin = origin;
			newOrigin.x += _halfDimension.x * (i&4 ? .5f : -.5f);//SImplificação de If (i==4) .5; else -.5;
			newOrigin.y += _halfDimension.y * (i&2 ? .5f : -.5f);
			newOrigin.z += _halfDimension.z * (i&1 ? .5f : -.5f);
			this->daughters[i] = new BraunnerTree(_depth-1,_halfDimension*0.5f,newOrigin);
		}


	}
}
开发者ID:GurgelDavi,项目名称:CodigosDDG2,代码行数:22,代码来源:BraunnerTree.cpp

示例6: BoundingBox

void the::object::recalculateBoundingBox()
{
    float xMax = std::numeric_limits<float>::min();
    float yMax = std::numeric_limits<float>::min();
    float zMax = std::numeric_limits<float>::min();
    float xMin = std::numeric_limits<float>::max();
    float yMin = std::numeric_limits<float>::max();
    float zMin = std::numeric_limits<float>::max();

    for (auto & v : vertexes)
    {
        if (v.position.x > xMax) xMax = v.position.x;
        if (v.position.y > yMax) yMax = v.position.y;
        if (v.position.z > zMax) zMax = v.position.z;

        if (v.position.x < xMin) xMin = v.position.x;
        if (v.position.y < yMin) yMin = v.position.y;
        if (v.position.z < zMin) zMin = v.position.z;
    }

    boundingBox = BoundingBox(vec3(xMin, yMin, zMin), vec3(xMax, yMax, zMax));
}
开发者ID:donkaban,项目名称:synqera_engine,代码行数:22,代码来源:object.cpp

示例7: playerId

Player::Player(int16_t playerId, sf::Vector2f position, OutputSocket socket, char * nick) :
playerId(playerId),
timeSinceLastShot(sf::Time::Zero),
speed(500),
rotation(0),
cross_thickness(5),
socket(socket),
health(100),
playerInfo(0),
ip(socket.ip),
nick(nick),
ammo(10),
invisibleTime(sf::Time::Zero)
{
    boundingBox = BoundingBox(position.x, position.y, 50, 50);
    updateCross();
    horz_rect.width = boundingBox.width;
    vert_rect.height = boundingBox.height;
    type = EntityType::Player_T;
    setTeam(0);
    setValid(0);
}
开发者ID:gallowstree,项目名称:PE-Server,代码行数:22,代码来源:Player.cpp

示例8: TEST

TEST(GridTest, UniformGridSamplerTest) {
  glm::ivec3 size(8, 8, 8);
  UniformGridSampler s(size, BoundingBox(glm::vec3(0.0f), glm::vec3(1.0f)));
  glm::ivec3 index = glm::ivec3(0);
  glm::ivec3 check = glm::ivec3(0);
  glm::vec3 point = glm::vec3(0.0f);
  for (int i = 0; i < s.num_cells(); ++i) {
    point = (0.5f / (size - 1)) + (1.0f / (size - 1)) * index;
    s.PointToCellIndex(point, check);
    if (index != check)
      std::cout << "point = " << point << " index = " << index << " value = "
          << check << std::endl;
    EXPECT_EQ(index, check);
    index = s.StepCell(index);
  }
  index = glm::ivec3(0);
  for (int i = 0; i < s.num_cells(); ++i) {
    point = (1.0f / (size - 1)) * index;
    s.PointToCellIndex(point, check);
    if (index != check)
      std::cout << "point = " << point << " index = " << index << " value = "
          << check << std::endl;
    EXPECT_EQ(index, check);
    index = s.StepCell(index);
  }
  index = glm::ivec3(0);
  glm::ivec3 expected = glm::ivec3(0);
  for (int i = 0; i < s.num_vertices(); ++i) {
    point = (1.0f / (size - 1)) * index;
    s.PointToCellIndex(point, check);
    expected = glm::min(size - 2, index);
    if (expected != check)
      std::cout << "point = " << point << " index = " << expected << " value = "
          << check << std::endl;
    EXPECT_EQ(expected, check);
    index = s.StepVertex(index);
  }
}
开发者ID:rasmith,项目名称:RayTracerX,代码行数:38,代码来源:grid_test.cpp

示例9: if

			bool Flash::Init(HandleOrRid movieId)
			{
				FrameworkManagers *res = FrameworkManagers::Get();

				if(movieId.isHandle && movieId.handle != HANDLE_NONE) {
					FlashMovieManager::AddRef(movieId.handle);
					movie = movieId.handle;
				} else if(movieId.rid != RID_NONE) {
					movie = res->flashMovieManager->Load(movieId.rid);
				} else {
					Console::Error("Invalid flash movie handle or rid");
					return false;
				}

				if(!state.Init(movie)) {
					Console::Error("Flash movie state init failed");
					return false;
				}

				FlashMovie *mov = res->flashMovieManager->Get(movie);
				bounds = BoundingBox(Vector4(mov->size.x / 2.0f, mov->size.y / 2.0f, 0.0f, 1.0f), Vector4(mov->size.x / 2.0f, mov->size.y / 2.0f, 0.0f, 1.0f)); 
				return true;
			}
开发者ID:ericroy,项目名称:maki-engine,代码行数:23,代码来源:MakiFlashComponent.cpp

示例10: BoundingBox

//============================================================
void GlBox::setWithXML(xmlNodePtr rootNode) {
  xmlNodePtr dataNode=NULL;

  GlXMLTools::getDataNode(rootNode,dataNode);

  // Parse Data
  if(dataNode) {
    GlXMLTools::setWithXML(dataNode,"position",position);
    GlXMLTools::setWithXML(dataNode,"size",size);
    fillColors.clear();
    GlXMLTools::setWithXML(dataNode,"fillColors",fillColors);
    outlineColors.clear();
    GlXMLTools::setWithXML(dataNode,"outlineColors",outlineColors);
    GlXMLTools::setWithXML(dataNode,"filled",filled);
    GlXMLTools::setWithXML(dataNode,"outlined",outlined);
    GlXMLTools::setWithXML(dataNode,"textureName",textureName);
    GlXMLTools::setWithXML(dataNode,"outlineSize",outlineSize);

    boundingBox = BoundingBox();
    boundingBox.expand(position-size/2.f);
    boundingBox.expand(position+size/2.f);
  }
}
开发者ID:kdbanman,项目名称:browseRDF,代码行数:24,代码来源:GlBox.cpp

示例11: p0

BoundingBox Rect::getBoundingBox()const
{
	glm::vec3 p0(kHugeValue),p1(-kHugeValue);

	p0.x = corner.x + v0.x + v1.x;
	p0.y = corner.y + v0.y + v1.y;
	p0.z = corner.z + v0.z + v1.z;
	p1.x = corner.x + v0.x + v1.x;
	p1.y = corner.y + v0.y + v1.y;
	p1.z = corner.z + v0.z + v1.z;

	p0.x = p0.x<corner.x? p0.x : corner.x;
	p0.y = p0.y<corner.y? p0.y : corner.y;
	p0.z = p0.z<corner.z? p0.z : corner.z;

	p1.x = p1.x>corner.x? p1.x : corner.x;
	p1.y = p1.y>corner.y? p1.y : corner.y;
	p1.z = p1.z>corner.z? p1.z : corner.z;

	p0 -= glm::vec3(KEpsilon);
	p1 += glm::vec3(KEpsilon);

	return BoundingBox(p1,p0);
}
开发者ID:RyanAdamsGD,项目名称:RayTracer,代码行数:24,代码来源:Rect.cpp

示例12: GraphicalObject

/**
 * Creates a new TextGlyph from the given XMLNode
 */
TextGlyph::TextGlyph(const XMLNode& node, unsigned int l2version)
 : GraphicalObject(2, l2version)
  ,mText("")
  ,mGraphicalObject("")
  ,mOriginOfText("")
{
    const XMLAttributes& attributes=node.getAttributes();
    const XMLNode* child;
    //ExpectedAttributes ea(getElementName());
    ExpectedAttributes ea;
    addExpectedAttributes(ea);
    this->readAttributes(attributes,ea);
    unsigned int n=0,nMax = node.getNumChildren();
    while(n<nMax)
    {
        child=&node.getChild(n);
        const std::string& childName=child->getName();
        if(childName=="boundingBox")
        {
            this->mBoundingBox=BoundingBox(*child);
        }
        else if(childName=="annotation")
        {
            this->mAnnotation=new XMLNode(*child);
        }
        else if(childName=="notes")
        {
            this->mNotes=new XMLNode(*child);
        }
        else
        {
            //throw;
        }
        ++n;
    }    
}
开发者ID:Alcibiades586,项目名称:roadrunner,代码行数:39,代码来源:TextGlyph.cpp

示例13: PROFILE

void NavigationMesh::CollectGeometries(Vector<NavigationGeometryInfo>& geometryList)
{
    PROFILE(CollectNavigationGeometry);
    
    // Get Navigable components from child nodes, not from whole scene. This makes it possible to partition
    // the scene into several navigation meshes
    PODVector<Navigable*> navigables;
    node_->GetComponents<Navigable>(navigables, true);
    
    HashSet<Node*> processedNodes;
    for (unsigned i = 0; i < navigables.Size(); ++i)
    {
        if (navigables[i]->IsEnabledEffective())
            CollectGeometries(geometryList, navigables[i]->GetNode(), processedNodes, navigables[i]->IsRecursive());
    }
    
    // Get offmesh connections
    Matrix3x4 inverse = node_->GetWorldTransform().Inverse();
    PODVector<OffMeshConnection*> connections;
    node_->GetComponents<OffMeshConnection>(connections, true);
    
    for (unsigned i = 0; i < connections.Size(); ++i)
    {
        OffMeshConnection* connection = connections[i];
        if (connection->IsEnabledEffective() && connection->GetEndPoint())
        {
            const Matrix3x4& transform = connection->GetNode()->GetWorldTransform();
            
            NavigationGeometryInfo info;
            info.component_ = connection;
            info.boundingBox_ = BoundingBox(Sphere(transform.Translation(), connection->GetRadius())).Transformed(inverse);
            
            geometryList.Push(info);
        }
    }
}
开发者ID:SkunkWorks99,项目名称:Urho3D,代码行数:36,代码来源:NavigationMesh.cpp

示例14: EmptyBoundingBoxException

BoundingBox BoundingBox::join(const std::vector<BoundingBox>& boxes)
{
	if (boxes.empty())
	{
		throw EmptyBoundingBoxException();
	}

	double minX = boxes.front().minX, 		
		maxX = boxes.front().maxX,
		minY = boxes.front().minY,
		maxY = boxes.front().maxY,
		minZ = boxes.front().minZ,
		maxZ = boxes.front().maxZ;
	for (std::vector<BoundingBox>::const_iterator i = (boxes.begin()+1); i != boxes.end(); ++i)
	{
		minX = fmin(minX, i->minX);
		maxX = fmax(maxX, i->maxX);
		minY = fmin(minY, i->minY);
		maxY = fmax(maxY, i->maxY);
		minZ = fmin(minZ, i->minZ);
		maxZ = fmax(maxZ, i->maxZ);
	}
	return BoundingBox(minX, maxX, minY, maxY, minZ, maxZ);
}
开发者ID:boris-van-sosin,项目名称:GraphicsHW2,代码行数:24,代码来源:Geometry.cpp

示例15: sort

BoundingBox BoundingBoxHierarchy::_build(
  vector<RTShape*>::iterator first, 
  vector<RTShape*>::iterator last, 
  int axis) {

  if (first+1 < last) {
    sort(first, last, axis);

    vector<RTShape*>::iterator middle = first + ((last - first) / 2);

    left = new BoundingBoxHierarchy();
    right = new BoundingBoxHierarchy();

    BoundingBox leftBox = left->_build(first, middle, (axis+1)%3);
    BoundingBox rightBox = right->_build(middle, last, (axis+1)%3);

    return box = leftBox.unionWith(rightBox);
  } else if (first != last) {
    shape = *first;
    return box = shape->getBoundingBox();
  } else {
    return BoundingBox(Vector(0,0,0), Vector(0,0,0));
  }
}
开发者ID:havardh,项目名称:ECE594Q,代码行数:24,代码来源:BoundingBoxHierarchy.cpp


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