本文整理汇总了C++中TPoint::dot方法的典型用法代码示例。如果您正苦于以下问题:C++ TPoint::dot方法的具体用法?C++ TPoint::dot怎么用?C++ TPoint::dot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TPoint
的用法示例。
在下文中一共展示了TPoint::dot方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: general_opt
//.........这里部分代码省略.........
ballCenter[2] = (int) paramBallArea[3];
}
if(vm.count("filterVisiblePart")){
std::vector<double> vectNormalAndAngle;
theMaxAngle =vm["filterVisiblePart"].as<double>();
aNormal[0] = vm["nx"].as<double>();
aNormal[1] = vm["ny"].as<double>();
aNormal[2] = vm["nz"].as<double>();
aNormal /= aNormal.norm();
}
if(vm.count("filterNbFaces")){
double percent = vm["filterNbFaces"].as<double>();
moduloLimitFace = (int)(100.0/percent);
}
DGtal::Mesh<Z3i::RealPoint> theMesh(true);
MeshReader<Z3i::RealPoint>::importOFFFile(inputMeshName, theMesh, false);
DGtal::Mesh<Z3i::RealPoint> theNewMesh(true);
trace.info()<< "reading the input mesh ok: "<< theMesh.nbVertex() << std::endl;
for (DGtal::Mesh<Z3i::RealPoint>::VertexStorage::const_iterator it = theMesh.vertexBegin();
it != theMesh.vertexEnd(); it++){
theNewMesh.addVertex(*it);
}
unsigned int numMaxFaces = theMesh.nbFaces();
if (vm.count("filterFirstFaces"))
{
double percentFirst = vm["filterFirstFaces"].as<unsigned int>();
numMaxFaces = (numMaxFaces/100.0)*percentFirst;
}
unsigned int num =0;
for (DGtal::Mesh<Z3i::RealPoint>::FaceStorage::const_iterator it = theMesh.faceBegin();
it!= theMesh.faceEnd(); it++){
num++;
if(num>numMaxFaces){
break;
}
DGtal::Mesh<Z3i::RealPoint>::MeshFace aFace = *it;
bool okOrientation = true;
TPoint p0 = theMesh.getVertex(aFace.at(1));
TPoint p1 = theMesh.getVertex(aFace.at(0));
TPoint p2 = theMesh.getVertex(aFace.at(2));
TPoint vectNormal = ((p1-p0).crossProduct(p2 - p0)).getNormalized();
vectNormal /= vectNormal.norm();
if (vm.count("filterVisiblePart")){
okOrientation = vectNormal.dot(aNormal) > cos(theMaxAngle);
}
if( okOrientation && (!vm.count("filterNbFaces") || num%moduloLimitFace == 0 )){
theNewMesh.addFace(aFace);
}
if( vm.count("shrinkBallArea")){
TPoint ptCenter = (p0+p1+p2)/3.0;
if((ptCenter-ballCenter).norm() <= radius){
for(unsigned int i =0; i<3; i++){
TPoint &aVertex = theNewMesh.getVertex(aFace.at(i));
if(aVertex==theMesh.getVertex(aFace.at(i))){
aVertex-=vectNormal*distanceShrink;
}
}
}
}
if( vm.count("shrinkArea")){
Z3i::Domain aDomain(ptLower, ptUpper);
TPoint ptCenter = (p0+p1+p2)/3.0;
if(aDomain.isInside(ptCenter)){
for(unsigned int i =0; i<3; i++){
TPoint &aVertex = theNewMesh.getVertex(aFace.at(i));
if(aVertex==theMesh.getVertex(aFace.at(i))){
aVertex-=vectNormal*distanceShrink;
}
}
}
}
}
if(vm.count("scale"))
{
double scale = vm["scale"].as<double>();
for(unsigned int i =0; i<theNewMesh.nbVertex(); i++)
{
theNewMesh.getVertex(i) *= scale;
}
}
trace.info()<< "nbFaces init: " << theNewMesh.nbFaces() << std::endl;
trace.info()<< "New nbFaces: " << theMesh.nbFaces() << std::endl;
std::ofstream outMesh;
outMesh.open(outputMeshName.c_str(), std::ofstream::out);
MeshWriter<Z3i::RealPoint>::export2OFF(outMesh, theNewMesh);
}