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


C++ Primitive::getType方法代码示例

本文整理汇总了C++中Primitive::getType方法的典型用法代码示例。如果您正苦于以下问题:C++ Primitive::getType方法的具体用法?C++ Primitive::getType怎么用?C++ Primitive::getType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Primitive的用法示例。


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

示例1: dumpData

void GlobFit::dumpData(const std::vector<RelationEdge>& vecRelationEdge, const std::string& stageName)
{
  size_t maxVerticesNum = 0;
  for (size_t i = 0, iEnd = _vecPrimitive.size(); i < iEnd; ++ i) {
    Primitive* pPrimitive = _vecPrimitive[i];
    pPrimitive->prepareParameters();
    maxVerticesNum = std::max(pPrimitive->getPointIdx().size(), maxVerticesNum);
  }

  std::locale loc("C");

  std::string path = boost::filesystem::current_path().string();
  path = path+"/matlab/data/"+stageName+"/";
  boost::filesystem::create_directories(path);
  std::ofstream constraints((path+"constraints.dat").c_str());
  std::ofstream primitiveType((path+"primitiveType.dat").c_str());
  std::ofstream inputParameters((path+"inputParameters.dat").c_str());
  std::ofstream numVertices((path+"numVertices.dat").c_str());
  std::ofstream coordX((path+"coordX.dat").c_str());
  std::ofstream coordY((path+"coordY.dat").c_str());
  std::ofstream coordZ((path+"coordZ.dat").c_str());
  std::ofstream normalX((path+"normalX.dat").c_str());
  std::ofstream normalY((path+"normalY.dat").c_str());
  std::ofstream normalZ((path+"normalZ.dat").c_str());
  std::ofstream confVertices((path+"confVertices.dat").c_str());

  constraints.imbue(loc);
  primitiveType.imbue(loc);
  inputParameters.imbue(loc);
  inputParameters.precision(16);
  numVertices.imbue(loc);
  coordX.imbue(loc);
  coordX.precision(16);
  coordY.imbue(loc);
  coordY.precision(16);
  coordZ.imbue(loc);
  coordZ.precision(16);
  normalX.imbue(loc);
  normalX.precision(16);
  normalY.imbue(loc);
  normalY.precision(16);
  normalZ.imbue(loc);
  normalZ.precision(16);
  confVertices.imbue(loc);
  confVertices.precision(16);

  for (size_t i = 0, iEnd = vecRelationEdge.size(); i < iEnd; ++ i) {
    const RelationEdge& relationEdge = vecRelationEdge[i];
    constraints << relationEdge << std::endl;
  }

  for (size_t i = 0, iEnd = _vecPrimitive.size(); i < iEnd; ++ i) {
    Primitive* pPrimitive = _vecPrimitive[i];

    primitiveType << pPrimitive->getType() << std::endl;

    pPrimitive->prepareParameters();
    for (size_t j = 0, jEnd = Primitive::getNumParameter(); j < jEnd; ++ j) {
      inputParameters << pPrimitive->getParameter(j) << " ";
    }
    inputParameters << std::endl;

    numVertices << pPrimitive->getPointIdx().size() << std::endl;
    for (size_t j = 0, jEnd = pPrimitive->getPointIdx().size(); j < jEnd; ++ j) {
      const RichPoint* richPoint = _vecPointSet[pPrimitive->getPointIdx()[j]];
      const Point& point = richPoint->point;
      const Vector& normal = richPoint->normal;
      coordX << point.x() << " ";
      coordY << point.y() << " ";
      coordZ << point.z() << " ";
      normalX << normal.x() << " ";
      normalY << normal.y() << " ";
      normalZ << normal.z() << " ";
      confVertices << richPoint->confidence << " ";
    }

    for (size_t j = pPrimitive->getPointIdx().size(); j < maxVerticesNum; ++ j) {
      coordX << 0 << " ";
      coordY << 0 << " ";
      coordZ << 0 << " ";
      normalX << 0 << " ";
      normalY << 0 << " ";
      normalZ << 0 << " ";
      confVertices << 0 << " ";
    }
    coordX << std::endl;
    coordY << std::endl;
    coordZ << std::endl;
    normalX << std::endl;
    normalY << std::endl;
    normalZ << std::endl;
    confVertices << std::endl;
  }

  return;
}
开发者ID:SebastianRiedel,项目名称:globfit,代码行数:96,代码来源:Solver.cpp


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