|
@@ -5,6 +5,7 @@
|
|
// This Source Code Form is subject to the terms of the Mozilla Public License
|
|
// This Source Code Form is subject to the terms of the Mozilla Public License
|
|
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
|
|
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
|
|
// obtain one at http://mozilla.org/MPL/2.0/.
|
|
// obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
+
|
|
#ifndef IGL_POS_H
|
|
#ifndef IGL_POS_H
|
|
#define IGL_POS_H
|
|
#define IGL_POS_H
|
|
|
|
|
|
@@ -29,30 +30,13 @@ template <typename S>
|
|
)
|
|
)
|
|
: F(F), FF(FF), FFi(FFi), fi(fi), ei(ei), reverse(reverse)
|
|
: F(F), FF(FF), FFi(FFi), fi(fi), ei(ei), reverse(reverse)
|
|
{}
|
|
{}
|
|
-
|
|
|
|
-// // Init the pos by specifying Face,Vertex Index and Orientation
|
|
|
|
-// Pos(Eigen::MatrixXi& F,
|
|
|
|
-// Eigen::MatrixXi& FF,
|
|
|
|
-// Eigen::MatrixXi& FFi,
|
|
|
|
-// int fi,
|
|
|
|
-// int vi,
|
|
|
|
-// bool reverse = false
|
|
|
|
-// )
|
|
|
|
-// : F(F), FF(FF), FFi(FFi), fi(fi), reverse(reverse)
|
|
|
|
-// {
|
|
|
|
-// ei = -1;
|
|
|
|
-// for (int i=0;i<3;++i)
|
|
|
|
-// if (F(fi,i) == vi)
|
|
|
|
-// ei = i;
|
|
|
|
-// assert(ei != -1);
|
|
|
|
-//
|
|
|
|
-// if (reverse)
|
|
|
|
-// ei = (ei-1)%3;
|
|
|
|
-// }
|
|
|
|
|
|
|
|
// Change Face
|
|
// Change Face
|
|
void flipF()
|
|
void flipF()
|
|
{
|
|
{
|
|
|
|
+ if (isBorder())
|
|
|
|
+ return;
|
|
|
|
+
|
|
int fin = (*FF)(fi,ei);
|
|
int fin = (*FF)(fi,ei);
|
|
int ein = (*FFi)(fi,ei);
|
|
int ein = (*FFi)(fi,ei);
|
|
int reversen = !reverse;
|
|
int reversen = !reverse;
|
|
@@ -79,6 +63,42 @@ template <typename S>
|
|
reverse = !reverse;
|
|
reverse = !reverse;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ bool isBorder()
|
|
|
|
+ {
|
|
|
|
+ return (*FF)(fi,ei) == -1;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /*!
|
|
|
|
+ * Returns the next edge skipping the border
|
|
|
|
+ * _________
|
|
|
|
+ * /\ c | b /\
|
|
|
|
+ * / \ | / \
|
|
|
|
+ * / d \ | / a \
|
|
|
|
+ * /______\|/______\
|
|
|
|
+ * v
|
|
|
|
+ * In this example, if a and d are of-border and the pos is iterating counterclockwise, this method iterate through the faces incident on vertex v,
|
|
|
|
+ * producing the sequence a, b, c, d, a, b, c, ...
|
|
|
|
+ */
|
|
|
|
+ bool NextFE()
|
|
|
|
+ {
|
|
|
|
+ if ( isBorder() ) // we are on a border
|
|
|
|
+ {
|
|
|
|
+ do
|
|
|
|
+ {
|
|
|
|
+ flipF();
|
|
|
|
+ flipE();
|
|
|
|
+ } while (!isBorder());
|
|
|
|
+ flipE();
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ flipF();
|
|
|
|
+ flipE();
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
// Get vertex index
|
|
// Get vertex index
|
|
int Vi()
|
|
int Vi()
|
|
{
|
|
{
|
|
@@ -98,6 +118,13 @@ template <typename S>
|
|
{
|
|
{
|
|
return fi;
|
|
return fi;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ // Get edge index
|
|
|
|
+ int Ei()
|
|
|
|
+ {
|
|
|
|
+ return ei;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
bool operator==(Pos& p2)
|
|
bool operator==(Pos& p2)
|
|
{
|
|
{
|
|
@@ -112,13 +139,14 @@ template <typename S>
|
|
);
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private:
|
|
int fi;
|
|
int fi;
|
|
int ei;
|
|
int ei;
|
|
bool reverse;
|
|
bool reverse;
|
|
|
|
|
|
const Eigen::Matrix<S, Eigen::Dynamic, Eigen::Dynamic>* F;
|
|
const Eigen::Matrix<S, Eigen::Dynamic, Eigen::Dynamic>* F;
|
|
- Eigen::Matrix<S, Eigen::Dynamic, Eigen::Dynamic>* FF;
|
|
|
|
- Eigen::Matrix<S, Eigen::Dynamic, Eigen::Dynamic>* FFi;
|
|
|
|
|
|
+ const Eigen::Matrix<S, Eigen::Dynamic, Eigen::Dynamic>* FF;
|
|
|
|
+ const Eigen::Matrix<S, Eigen::Dynamic, Eigen::Dynamic>* FFi;
|
|
};
|
|
};
|
|
|
|
|
|
}
|
|
}
|