本文整理汇总了C++中Primitive::points方法的典型用法代码示例。如果您正苦于以下问题:C++ Primitive::points方法的具体用法?C++ Primitive::points怎么用?C++ Primitive::points使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Primitive
的用法示例。
在下文中一共展示了Primitive::points方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: process
void SymmetryGroup::process(QVector<Primitive*> segments)
{
// Store the nodes
Group::process(segments);
// Compute the symmetry plane
Primitive * a = segments.first();
Primitive * b = segments.last();
Point cA = a->centerPoint();
Point cB = b->centerPoint();
Point point = (cA + cB) * 0.5;
Normal normal = (cA - cB).normalized();
symmetryPlane = Plane(normal, point);
// Representative points of two primitives
std::vector<Vec3d> pointsA = a->points();
std::vector<Vec3d> pointsB = b->points();
// Correspondences from both directions
correspondence[a->id].resize(pointsA.size());
correspondence[b->id].resize(pointsB.size());
for(int i = 0; i < pointsA.size(); i++)
{
pointsA[i] = symmetryPlane.reflection(pointsA[i]);
double dist = DBL_MAX;
int id_closest = -1;
// Find the point on \b closest to the reflected point on \a
for(int j = 0; j < pointsB.size(); j++)
{
double currDist = (pointsA[i] - pointsB[j]).norm();
if(currDist < dist)
{
id_closest = j;
dist = currDist;
}
}
correspondence[a->id][i] = id_closest;
correspondence[b->id][id_closest] = i;
}
}