本文整理汇总了C++中Triangles::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ Triangles::push_back方法的具体用法?C++ Triangles::push_back怎么用?C++ Triangles::push_back使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Triangles
的用法示例。
在下文中一共展示了Triangles::push_back方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: detect
bool detect(vector<Triangle_3> &a, vector<Triangle_3> &b)
{
std::vector<Box> boxes;
triangles.clear();
for ( Iterator i = a.begin(); i != a.end(); ++i)
triangles.push_back(*i);
for ( Iterator i = b.begin(); i != b.end(); ++i)
triangles.push_back(*i);
for(Iterator i = triangles.begin(); i!= triangles.end(); ++i)
boxes.push_back( Box( i->bbox(), i));
// Run the self intersection algorithm with all defaults
CGAL::box_self_intersection_d( boxes.begin(), boxes.end(), report_inters);
return true;
}
示例2: main
int main(int argc, char*argv[])
{
std::ifstream in((argc>1)?argv[1]:"data/triangles.xyz");
Triangles triangles;
Triangle_3 t;
while(in >> t){
triangles.push_back(t);
}
// Create the corresponding vector of bounding boxes
std::vector<Box> boxes;
for ( Iterator i = triangles.begin(); i != triangles.end(); ++i)
boxes.push_back( Box( i->bbox(), i));
// Create the corresponding vector of pointers to bounding boxes
std::vector<Box *> ptr;
for ( std::vector<Box>::iterator i = boxes.begin(); i != boxes.end(); ++i)
ptr.push_back( &*i);
// Run the self intersection algorithm with all defaults on the
// indirect pointers to bounding boxes. Avoids copying the boxes.
CGAL::box_self_intersection_d( ptr.begin(), ptr.end(), Report(triangles));
return 0;
}
示例3: fromOBJ
Mesh Mesh::fromOBJ(const std::string &filename, bool centralizeLoadedMesh)
{
std::ifstream in(filename);
if (!in.is_open())
throw FACELIB_EXCEPTION("Can't open file " + filename);
VectorOfPoints points;
Triangles triangles;
std::string line;
while (std::getline(in, line))
{
if (line.empty()) continue;
if (line[0] == 'v')
{
Poco::StringTokenizer tokens(line, " ");
double x = Poco::NumberParser::parseFloat(tokens[1]);
double y = Poco::NumberParser::parseFloat(tokens[2]);
double z = Poco::NumberParser::parseFloat(tokens[3]);
points.push_back(cv::Point3d(x,y,z));
}
else if (line[0] == 'f')
{
Poco::StringTokenizer tokens(line, " ");
int t1 = Poco::NumberParser::parse(tokens[1]) - 1;
int t2 = Poco::NumberParser::parse(tokens[2]) - 1;
int t3 = Poco::NumberParser::parse(tokens[3]) - 1;
triangles.push_back(cv::Vec3i(t1, t2, t3));
}
}
Mesh result = Mesh::fromPointcloud(points, centralizeLoadedMesh, false);
result.triangles = triangles;
return result;
}