本文整理汇总了C++中DblVector::ExportForPSTricks方法的典型用法代码示例。如果您正苦于以下问题:C++ DblVector::ExportForPSTricks方法的具体用法?C++ DblVector::ExportForPSTricks怎么用?C++ DblVector::ExportForPSTricks使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DblVector
的用法示例。
在下文中一共展示了DblVector::ExportForPSTricks方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AlignSequence
void SharedImageSequence::AlignSequence(int noItMax, bool circular)
{
boost::progress_timer t(std::clog);
SharedImageSequence::iterator it0, it1, it2, it3, it4;
Mat3d rot; Vec3d trans;
DblVector maxRots;
DblVector maxTranss;
OrientAlongPrincipalAxises(true);
/// Main iteration
for(int i=0; i<noItMax; i++)
{
double maxRot=0, maxTrans=0, maxNorm=0, normSum = 0.0;
//std::cout << "\nIt " << i << std::endl;
int k=0, l=0;
bool flag=false;
for(it0=begin(); it0!=end(); it0++)
{
/// Update iterators
it1=it0;
it1++;
l=k+1;
if(it1==end())
{
OrientAlongPrincipalAxises(true);
if(circular)
{
it1=begin();
l=0;
flag = true;
}
else break;
}
/// Find the transformation between neighbors
if(it0->GetTransformation(*it1, &rot, &trans)==RET_FAILED) continue;
/// Output the strength of transformatiom
Frame F;
ConvertFrame(rot, trans, F);
//std::cout << "Views " << k << " " << l << std::endl;
double normTrans = Point3Dbl(F[0], F[1], F[2]).AbsVal();
double degRot = F[3]*180.0/THE_PI_DEF;
double norm = normTrans + F[3] * ROT_FACTOR;
normSum += norm;
if(norm>maxNorm) maxNorm = norm;
if(maxRot<degRot) maxRot=degRot;
if(maxTrans<normTrans) maxTrans=normTrans;
//std::cout << "Strength (rot, trans): " << degRot << " (deg) " << normTrans << " (mm) " << std::endl;
////std::cout << "Statistics (count, mean, sigma): " << noPoints << " " << mean[k] << " " << sigma[k] << std::endl;
/// Apply transformation to the tail and update means
if(!flag)
{
for(it2=it1; it2!=end(); it2++)
{
it2->ApplyTransformationToCoordImage(*it2, rot, trans);
}
}
else
{
double n=0;
for(it2=it1; it2!=end(); it2++, n++)
{
/// Get weight of transformation
Frame G=F;
Mat3d wRot; Vec3d wTrans;
double weight = 1.0/exp((double)n);//((double)size()-n)/(double)size();
/// Alter frame
G[0]*=weight; G[1]*=weight;
G[2]*=weight; G[3]*=weight;
ConvertFrameBack(G, wRot, wTrans);
it2->ApplyTransformationToCoordImage(*it2, wRot, wTrans);
}
}
//std::cout << std::endl;
k++;
}
//std::cout << "Max rot : " << maxRot << " (deg) " << std::endl;
//std::cout << "Max trans: " << maxTrans << " (mm) " << std::endl;
//std::cout << "Max norm: " << maxNorm << std::endl;
double avgNorm = normSum/(double)k;
//std::cout << "Avg norm: " << avgNorm << std::endl;
maxRots.push_back(maxRot);
maxTranss.push_back(maxTrans);
}
OrientAlongPrincipalAxises(true);
std::string rotStr = maxRots.ExportForPSTricks();
std::ofstream rotf("maxRotations.txt");
rotf << rotStr;
std::string transStr = maxTranss.ExportForPSTricks();
//.........这里部分代码省略.........