本文整理汇总了C++中Prefix::rotate方法的典型用法代码示例。如果您正苦于以下问题:C++ Prefix::rotate方法的具体用法?C++ Prefix::rotate怎么用?C++ Prefix::rotate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Prefix
的用法示例。
在下文中一共展示了Prefix::rotate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getPrefixFromWC
Prefix getPrefixFromWC(VEC coord)
{
Prefix pfx;
Orientation ori(SYMMETRY_HEXAGONAL);
if (coord.y > 0)
{
if (!(coord * VEC(COS30, -SIN30) > 0 && coord.x>0)){
ori.rotate(VP);
pfx.rotate(VP);
}
} else {
ori.rotate(VN);
pfx.rotate(VN);
}
VEC vertexpoint_[3];
double dist[3];
vertexpoint_[0] = ori.getWCFromOC(VEC(0, 0)) - coord;
vertexpoint_[1] = ori.getWCFromOC(VEC(COS30, -SIN30)) - coord;
vertexpoint_[2] = ori.getWCFromOC(VEC(COS30, SIN30)) - coord;
for (int i=0; i<3; i++)
dist[i] = vertexpoint_[i]*vertexpoint_[i];
if (dist[1] < dist[0])
pfx.rotate((dist[2]<dist[1])? FN: FP);
else if (dist[2] < dist[0])
pfx.rotate(FN);
for (int i=0; i<3; i++)
{
if (ori.getOCFromWC(coord).x > COS30)
return Prefix();
}
return pfx;
}
示例2: addNewEP
bool SymmetryObject::addNewEP(int sluten)
{
//cout << "i addfacetobe so is sluten = " << sluten << endl;
//vector<edge>::iterator ite = E_ToBe.end();
int sizE = E.size();
// Fixa:
// Rootera tillbaka ytan så att början
//och slutet alltid rör en rootPoint.
Prefix draBortPfxInv = E_ToBe[0].fr.Pfx;//.getSize();
cout << "The following prefix ska dras away" << endl;
draBortPfxInv.print();
draBortPfxInv = draBortPfxInv.getInverse();
for (unsigned int i=0; i<E_ToBe.size()-1; i++)
{
edge edgeToPushBack;
Prefix enAnnanPrefixIgen = draBortPfxInv;
enAnnanPrefixIgen.rotate(E_ToBe[i].fr.Pfx);
enAnnanPrefixIgen.simplify();
edgeToPushBack.fr.Pfx = enAnnanPrefixIgen;
edgeToPushBack.fr.index = E_ToBe[i].fr.index;
enAnnanPrefixIgen = draBortPfxInv;
enAnnanPrefixIgen.rotate(E_ToBe[i].to.Pfx);
enAnnanPrefixIgen.simplify();
edgeToPushBack.to.Pfx = enAnnanPrefixIgen;
edgeToPushBack.to.index = E_ToBe[i].to.index;
Prefix PfxNext;
Prefix PfxPrev;
switch (sluten) {
case NOT_CENTERED: {
edgeToPushBack.next = Edge(PfxNext, (i==E_ToBe.size()-2? sizE: sizE + i + 1));
edgeToPushBack.prev = Edge(PfxPrev, (i==0? sizE + E_ToBe.size() - 2: sizE + i - 1));
break;
}
case VERTEX_CENTERED: {
if (i==0)
PfxPrev.rotate(VN);
if (i==E_ToBe.size()-2)
PfxNext.rotate(VP);
edgeToPushBack.next = Edge(PfxNext, (i==E_ToBe.size()-2? sizE: sizE + i + 1));
edgeToPushBack.prev = Edge(PfxPrev, i==0? sizE + E_ToBe.size() - 2: sizE + i - 1);
//edgeToPushBack.next = (i==E_ToBe.size()-2? Edge(Pfx, sizE): Edge(Prefix(), sizE + i + 1));
break;
}
case EDGE_CENTERED: {
Prefix cpPrefixHelvete;
cpPrefixHelvete = E_ToBe[E_ToBe.size()-1].fr.Pfx;
cpPrefixHelvete.rotate(draBortPfxInv);
cout << "when it is done, it becomasar: ";
cpPrefixHelvete.print();
cout << endl;
if (i==0) {
PfxPrev = cpPrefixHelvete;
}
if (i==E_ToBe.size()-2) {
PfxNext = cpPrefixHelvete;
}
edgeToPushBack.next = Edge(PfxNext, (i==E_ToBe.size()-2? sizE: sizE + i + 1));
edgeToPushBack.prev = Edge(PfxPrev, (i==0? sizE + E_ToBe.size() - 2: sizE + i - 1));
break;
}
case FACE_CENTERED: {
Prefix PfxNext;
Prefix PfxPrev;
if (i==0)
PfxPrev.rotate(FN);
if (i==E_ToBe.size()-2)
PfxNext.rotate(FP);
edgeToPushBack.next = Edge(PfxNext, (i==E_ToBe.size()-2? sizE: sizE + i + 1));
edgeToPushBack.prev = Edge(PfxPrev, (i==0? sizE + E_ToBe.size() - 2: sizE + i - 1));
break;
}
default:
cout << "symmetryObject.cpp\tHIT SKA DEN INTE KOMMA!!!!!!!!!!!" << endl;
break;
}
// kolla genom om man kan hitta någon opposite
cout << endl;
//int kortastePrefix = 10000000;
edgeToPushBack.oppo.index = -1;
//edgeToPushBack.
//.........这里部分代码省略.........
示例3: isOppositeOf
// returns true if e is opposite edge. If pfx != null, pfx
bool edge::isOppositeOf(const edge &e, Prefix *pfx)
{
// avsluta om inte ens punkterna stämmer
if (fr.index != e.to.index || to.index != e.fr.index)
return false;
Prefix X;
//
cout << " ** drive isOppositeOf" << endl;
cout << "this: " << endl;
this->print();
cout << endl << "edge e: " << endl;
e.print();
switch(fr.index)
{
case VERTEX_CENTERED: {
cout << "a" << endl;
// fr = X e.to
X = fr.Pfx;
X.rotate(e.to.Pfx.getInverse());
Point e_fr(X * e.fr.Pfx, e.fr.index);
if (to.equalTo(e_fr)) {*pfx = X; return true;}
// fr [VP] = X e.to
X = fr.Pfx;
X.rotate(VP);
X.rotate(e.to.Pfx.getInverse());
e_fr = Point(X * e.fr.Pfx, e.fr.index);
if (to.equalTo(e_fr)) {*pfx = X; return true;}
// fr [VN] = X e.to
X = fr.Pfx;
X.rotate(VN);
X.rotate(e.to.Pfx.getInverse());
e_fr = Point(X * e.fr.Pfx, e.fr.index);
if (to.equalTo(e_fr)) {*pfx = X; return true;}
cout << "a" << endl;
break;
}
case EDGE_CENTERED: {
cout << "b" << endl;
X = fr.Pfx;
X.rotate(e.to.Pfx.getInverse());
Point e_fr(X * e.fr.Pfx, e.fr.index);
if (to.equalTo(e_fr)) {*pfx = X; return true;}
// fr [VP] = X e.to
X = fr.Pfx;
X.rotate(VP);
X.rotate(FP);
X.rotate(e.to.Pfx.getInverse());
e_fr = Point(X * e.fr.Pfx, e.fr.index);
if (to.equalTo(e_fr)) {*pfx = X; return true;}
break;
}
case FACE_CENTERED: {
cout << "c" << endl;
// fr = X e.to
X = fr.Pfx;
X.rotate(e.to.Pfx.getInverse());
Point e_fr(X * e.fr.Pfx, e.fr.index);
if (to.equalTo(e_fr)) {*pfx = X; return true;}
// fr [FP] = X e.to
X = fr.Pfx;
X.rotate(FP);
X.rotate(e.to.Pfx.getInverse());
e_fr = Point(X * e.fr.Pfx, e.fr.index);
if (to.equalTo(e_fr)) {*pfx = X; return true;}
// fr [FN] = X e.to
X = fr.Pfx;
X.rotate(FN);
X.rotate(e.to.Pfx.getInverse());
e_fr = Point(X * e.fr.Pfx, e.fr.index);
if (to.equalTo(e_fr)) {*pfx = X; return true;}
cout << "c" << endl;
break;
}
default: {
cout << "D" << endl;
X = fr.Pfx;
X.rotate(e.to.Pfx.getInverse());
Point e_fr(X * e.fr.Pfx, e.fr.index);
if (to.equalTo(e_fr)) {*pfx = X; return true;}
cout << "D" << endl;
break;
}
}
//.........这里部分代码省略.........