本文整理汇总了C++中WOEdge::GetbFace方法的典型用法代码示例。如果您正苦于以下问题:C++ WOEdge::GetbFace方法的具体用法?C++ WOEdge::GetbFace怎么用?C++ WOEdge::GetbFace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WOEdge
的用法示例。
在下文中一共展示了WOEdge::GetbFace方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
WOEdge::WOEdge(WOEdge& iBrother)
{
_paVertex = iBrother.GetaVertex();
_pbVertex = iBrother.GetbVertex();
_paFace = iBrother.GetaFace();
_pbFace = iBrother.GetbFace();
_pOwner = iBrother.GetOwner();
userdata = NULL;
iBrother.userdata = new oedgedata;
((oedgedata *)(iBrother.userdata))->_copy = this;
_vec = iBrother._vec;
_angle = iBrother._angle;
}
示例2: instanciateEdge
WOEdge *WFace::MakeEdge(WVertex *v1, WVertex *v2)
{
// First check whether the same oriented edge already exists or not:
vector<WEdge *>& v1Edges = v1->GetEdges();
for (vector<WEdge*>::iterator it1 = v1Edges.begin(), end = v1Edges.end(); it1 != end; it1++) {
WEdge *we = (*it1);
WOEdge *woea = we->GetaOEdge();
//if ((*it1)->GetbVertex() == v2) {
if ((woea->GetaVertex() == v1) && (woea->GetbVertex() == v2)) {
// The oriented edge already exists
cerr << "Warning: edge " << v1->GetId() << " - " << v2->GetId() << " appears twice, correcting" << endl;
// Adds the edge to the face
//AddEdge((*it1)->GetaOEdge());
AddEdge(woea);
(*it1)->setNumberOfOEdges((*it1)->GetNumberOfOEdges() + 1);
//sets these vertices as border:
v1->setBorder(true);
v2->setBorder(true);
//return (*it1)->GetaOEdge();
return woea;
}
WOEdge *woeb = we->GetbOEdge();
//if ((*it1)->GetbVertex() == v2)
if (woeb && (woeb->GetaVertex() == v1) && (woeb->GetbVertex() == v2)) {
// The oriented edge already exists
cerr << "Warning: edge " << v1->GetId() << " - " << v2->GetId() << " appears twice, correcting" << endl;
// Adds the edge to the face
//AddEdge((*it1)->GetaOEdge());
AddEdge(woeb);
(*it1)->setNumberOfOEdges((*it1)->GetNumberOfOEdges() + 1);
//sets these vertices as border:
v1->setBorder(true);
v2->setBorder(true);
//return (*it1)->GetaOEdge();
return woeb;
}
}
// the oriented edge we're about to build
WOEdge *pOEdge = new WOEdge;
// The edge containing the oriented edge.
WEdge *edge;
// checks whether this edge already exists or not
// If it exists, it points outward v2
bool exist = false;
WOEdge *pInvertEdge = NULL; // The inverted edge if it exists
vector<WEdge *>& v2Edges = v2->GetEdges();
vector<WEdge *>::iterator it;
for (it = v2Edges.begin(); it != v2Edges.end(); it++) {
if ((*it)->GetbVertex() == v1) {
// The invert edge already exists
exist = true;
pInvertEdge = (*it)->GetaOEdge();
break;
}
}
//DEBUG:
if (true == exist) { // The invert edge already exists
// Retrieves the corresponding edge
edge = pInvertEdge->GetOwner();
// Sets the a Face (retrieved from pInvertEdge
pOEdge->setaFace(pInvertEdge->GetbFace());
// Updates the invert edge:
pInvertEdge->setaFace(this);
}
else { // The invert edge does not exist yet
// we must create a new edge
//edge = new WEdge;
edge = instanciateEdge();
// updates the a,b vertex edges list:
v1->AddEdge(edge);
v2->AddEdge(edge);
}
pOEdge->setOwner(edge);
// Add the vertices:
pOEdge->setaVertex(v1);
pOEdge->setbVertex(v2);
// Debug:
if (v1->GetId() == v2->GetId())
cerr << "Warning: edge " << this << " null with vertex " << v1->GetId() << endl;
edge->AddOEdge(pOEdge);
//edge->setNumberOfOEdges(edge->GetNumberOfOEdges() + 1);
// Add this face (the b face)
pOEdge->setbFace(this);
// Adds the edge to the face
AddEdge(pOEdge);
return pOEdge;
//.........这里部分代码省略.........
示例3: gts_vertex_principal_directions
/*! gts_vertex_principal_directions:
* @v: a #WVertex.
* @s: a #GtsSurface.
* @Kh: mean curvature normal (a #Vec3r).
* @Kg: Gaussian curvature (a real).
* @e1: first principal curvature direction (direction of largest curvature).
* @e2: second principal curvature direction.
*
* Computes the principal curvature directions at a point given @Kh and @Kg, the mean curvature normal and
* Gaussian curvatures at that point, computed with gts_vertex_mean_curvature_normal() and
* gts_vertex_gaussian_curvature(), respectively.
*
* Note that this computation is very approximate and tends to be unstable. Smoothing of the surface or the principal
* directions may be necessary to achieve reasonable results.
*/
void gts_vertex_principal_directions(WVertex *v, Vec3r Kh, real Kg, Vec3r &e1, Vec3r &e2)
{
Vec3r N;
real normKh;
Vec3r basis1, basis2, d, eig;
real ve2, vdotN;
real aterm_da, bterm_da, cterm_da, const_da;
real aterm_db, bterm_db, cterm_db, const_db;
real a, b, c;
real K1, K2;
real *weights, *kappas, *d1s, *d2s;
int edge_count;
real err_e1, err_e2;
int e;
WVertex::incoming_edge_iterator itE;
/* compute unit normal */
normKh = Kh.norm();
if (normKh > 0.0) {
Kh.normalize();
}
else {
/* This vertex is a point of zero mean curvature (flat or saddle point). Compute a normal by averaging
* the adjacent triangles
*/
N[0] = N[1] = N[2] = 0.0;
for (itE = v->incoming_edges_begin(); itE != v->incoming_edges_end(); itE++)
N = Vec3r(N + (*itE)->GetaFace()->GetNormal());
real normN = N.norm();
if (normN <= 0.0)
return;
N.normalize();
}
/* construct a basis from N: */
/* set basis1 to any component not the largest of N */
basis1[0] = basis1[1] = basis1[2] = 0.0;
if (fabs (N[0]) > fabs (N[1]))
basis1[1] = 1.0;
else
basis1[0] = 1.0;
/* make basis2 orthogonal to N */
basis2 = (N ^ basis1);
basis2.normalize();
/* make basis1 orthogonal to N and basis2 */
basis1 = (N ^ basis2);
basis1.normalize();
aterm_da = bterm_da = cterm_da = const_da = 0.0;
aterm_db = bterm_db = cterm_db = const_db = 0.0;
int nb_edges = v->GetEdges().size();
weights = (real *)malloc(sizeof(real) * nb_edges);
kappas = (real *)malloc(sizeof(real) * nb_edges);
d1s = (real *)malloc(sizeof(real) * nb_edges);
d2s = (real *)malloc(sizeof(real) * nb_edges);
edge_count = 0;
for (itE = v->incoming_edges_begin(); itE != v->incoming_edges_end(); itE++) {
WOEdge *e;
WFace *f1, *f2;
real weight, kappa, d1, d2;
Vec3r vec_edge;
if (!*itE)
continue;
e = *itE;
/* since this vertex passed the tests in gts_vertex_mean_curvature_normal(), this should be true. */
//g_assert(gts_edge_face_number (e, s) == 2);
/* identify the two triangles bordering e in s */
f1 = e->GetaFace();
f2 = e->GetbFace();
/* We are solving for the values of the curvature tensor
* B = [ a b ; b c ].
* The computations here are from section 5 of [Meyer et al 2002].
*
* The first step is to calculate the linear equations governing the values of (a,b,c). These can be computed
* by setting the derivatives of the error E to zero (section 5.3).
//.........这里部分代码省略.........