本文整理汇总了C++中Transform3f::translateLocalInv方法的典型用法代码示例。如果您正苦于以下问题:C++ Transform3f::translateLocalInv方法的具体用法?C++ Transform3f::translateLocalInv怎么用?C++ Transform3f::translateLocalInv使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Transform3f
的用法示例。
在下文中一共展示了Transform3f::translateLocalInv方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: match
//.........这里部分代码省略.........
if (states[nei_idx] != 0)
continue;
states[nei_idx] = 1;
vertex_queue.push(nei_idx);
}
}
// now states[j] == 0 if j-th vertex shound not be moved
Vec3f edge_beg_pos, edge_end_pos, rot_axis;
// get rotation axis
edge_beg_pos.copy(xyz_sub[xyzmap[_mapping[edge_beg]]]);
edge_end_pos.copy(xyz_sub[xyzmap[_mapping[edge_end]]]);
rot_axis.diff(edge_end_pos, edge_beg_pos);
if (!rot_axis.normalize())
continue;
const Vertex &edge_end_vertex = _subgraph.getVertex(edge_end);
float max_sum_len = -1;
for (j = edge_end_vertex.neiBegin(); j != edge_end_vertex.neiEnd();
j = edge_end_vertex.neiNext(j))
{
int nei_idx_2 = edge_end_vertex.neiVertex(j);
int nei_idx_1 = _mapping[nei_idx_2];
if (nei_idx_2 == edge_beg)
continue;
if (nei_idx_1 == -1)
continue;
Vec3f nei1_pos;
Vec3f nei2_pos;
nei1_pos.copy(xyz_super[xyzmap[nei_idx_1]]);
nei2_pos.copy(xyz_sub[xyzmap[_mapping[nei_idx_2]]]);
nei1_pos.sub(edge_end_pos);
nei2_pos.sub(edge_end_pos);
float dot1 = Vec3f::dot(nei1_pos, rot_axis);
float dot2 = Vec3f::dot(nei2_pos, rot_axis);
nei1_pos.addScaled(rot_axis, -dot1);
nei2_pos.addScaled(rot_axis, -dot2);
if (max_sum_len > nei1_pos.length() + nei1_pos.length())
continue;
max_sum_len = nei1_pos.length() + nei1_pos.length();
if (!nei1_pos.normalize() || !nei2_pos.normalize())
continue;
double dp = Vec3f::dot(nei1_pos, nei2_pos);
if (dp > 1 - EPSILON)
dp = 1 - EPSILON;
if (dp < -1 + EPSILON)
dp = -1 + EPSILON;
double ang = acos(dp);
Vec3f cross;
cross.cross(nei1_pos, nei2_pos);
if (Vec3f::dot(cross, rot_axis) < 0)
ang = -ang;
matr.rotation(rot_axis.x, rot_axis.y, rot_axis.z, (float)ang);
matr.translateLocalInv(edge_end_pos);
matr.translate(edge_end_pos);
}
if (max_sum_len > 0)
{
for (j = _subgraph.vertexBegin(); j < _subgraph.vertexEnd(); j = _subgraph.vertexNext(j))
if (_mapping[j] >= 0 && states[j] != 0)
xyz_sub[xyzmap[_mapping[j]]].transformPoint(matr);
}
}
float sqsum = 0;
for (k = 0; k < xyz_sub.size(); k++)
sqsum += Vec3f::distSqr(xyz_sub[k], xyz_super[k]);
sqsum = sqrt(sqsum / xyz_sub.size());
if (sqsum > rms_threshold + eps)
return false;
return true;
}