本文整理汇总了C++中Vertex_iterator::vertex_begin方法的典型用法代码示例。如果您正苦于以下问题:C++ Vertex_iterator::vertex_begin方法的具体用法?C++ Vertex_iterator::vertex_begin怎么用?C++ Vertex_iterator::vertex_begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vertex_iterator
的用法示例。
在下文中一共展示了Vertex_iterator::vertex_begin方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: vertex_node
void vertex_node(Vertex_iterator vitr, Point& pt) {
double R[] = {0.0, 0.0, 0.0};
Point& S = vitr->point();
Halfedge_around_vertex_circulator vcir = vitr->vertex_begin();
std::size_t n = circulator_size(vcir);
for (std::size_t i = 0; i < n; i++, ++vcir) {
Point& p = vcir->opposite()->vertex()->point();
R[0] += p[0]; R[1] += p[1]; R[2] += p[2];
}
if (n == 6) {
pt = Point((10*S[0]+R[0])/16, (10*S[1]+R[1])/16, (10*S[2]+R[2])/16);
} else if (n == 3) {
double B = (5.0/8.0 - std::sqrt(3+2*std::cos(6.283/n))/64.0)/n;
double A = 1-n*B;
pt = Point((A*S[0]+B*R[0]), (A*S[1]+B*R[1]), (A*S[2]+B*R[2]));
} else {
double B = 3.0/8.0/n;
double A = 1-n*B;
pt = Point((A*S[0]+B*R[0]), (A*S[1]+B*R[1]), (A*S[2]+B*R[2]));
}
}
示例2: while
void MSDM2_Component::ProcessMSDM2_per_vertex( Vertex_iterator pVertex,double radius,std::vector<double> & TabDistance1,std::vector<double>& TabDistance2,std::vector<Point3d> &TabPoint1,std::vector<Point3d> &TabPoint2)
{
std::set<int> vertices ;
std::stack<Vertex_iterator> S ;
Point3d O = pVertex->point() ;
S.push(pVertex) ;
vertices.insert(pVertex->tag()) ;
TabDistance1.push_back(pVertex->KmaxCurv);
TabPoint1.push_back(pVertex->point());
TabDistance2.push_back(pVertex->curvmatch);
TabPoint2.push_back(pVertex->match);
int NbSommetInSphere=0;
//double SommeDistance=0; // MT
while(!S.empty())
{
Vertex_iterator v = S.top() ;
S.pop() ;
Point3d P = v->point() ;
Halfedge_around_vertex_circulator h = v->vertex_begin();
Halfedge_around_vertex_circulator pHalfedgeStart = h;
CGAL_For_all(h,pHalfedgeStart)
{
Point3d p1 = h->vertex()->point();
Point3d p2 = h->opposite()->vertex()->point();
Point3d p1m = h->vertex()->match;
Point3d p2m = h->opposite()->vertex()->match;
Vector V = (p2-p1);
Vector Vm = (p2m-p1m);
if(v==pVertex || V * (P - O) > 0.0)
{
double len_old = std::sqrt(V*V);
bool isect = sphere_clip_vector_MSDM2(O, radius, P, V) ;
double len_edge = std::sqrt(V*V);
NbSommetInSphere++;
double WeightedCurv1,WeightedCurv2;
Point3d WeightedP1,WeightedP2;
bool IsAlreadyIntegrated=false;
if(!isect)
{
Vertex_iterator w=h->opposite()->vertex();
if(vertices.find(w->tag()) == vertices.end())
{
vertices.insert(w->tag()) ;
S.push(w) ;
}
else
IsAlreadyIntegrated=true;
}
if (IsAlreadyIntegrated==false)
{
if(len_old!=0)
{
if(isect)
{
WeightedCurv1=(1-len_edge/len_old)*h->vertex()->KmaxCurv+len_edge/len_old*h->opposite()->vertex()->KmaxCurv;
WeightedP1=p1+V;
WeightedCurv2=(1-len_edge/len_old)*h->vertex()->curvmatch+len_edge/len_old*h->opposite()->vertex()->curvmatch;
WeightedP2=p1m+(len_edge/len_old)*Vm;
}
else
{
WeightedCurv1=h->opposite()->vertex()->KmaxCurv;
WeightedCurv2=h->opposite()->vertex()->curvmatch;
WeightedP1=p2;
WeightedP2=p2m;
}
}
else
{
WeightedCurv1=h->opposite()->vertex()->KmaxCurv;
WeightedCurv2=h->opposite()->vertex()->curvmatch;
WeightedP1=p2;
WeightedP2=p2m;
}
TabDistance1.push_back(WeightedCurv1);
TabPoint1.push_back(WeightedP1);
TabDistance2.push_back(WeightedCurv2);
TabPoint2.push_back(WeightedP2);
//.........这里部分代码省略.........
示例3: RunColorStep
//////////////////////////////////////////////////////////////////////////////////////////////////////
// run a step
float Remesh::RunColorStep() {
cur_iter++;
cerr << "ITERATION ( " << cur_iter << ") " << endl;
// COMPUTE THE MESH DISPLACEMENT
for (Vertex_iterator vi = data->mesh.p.vertices_begin(); vi!=data->mesh.p.vertices_end(); vi++) {
vi->delta = Kernel::Vector_3(0,0,0);
vi->delta_tmp = Kernel::Vector_3(0,0,0);
}
// from current to the closest destination point
for (Vertex_iterator vi = data->mesh.p.vertices_begin(); vi!=data->mesh.p.vertices_end(); vi++) {
#if MOVE_THE_MESH
Kernel::Point_3 closest_point = dst_mesh.closestColorPoint(vi->point(), (float *)(vi->color));
//Kernel::Point_3 closest_point = dst_mesh.closestPoint(vi->point());
#else
Kernel::Point_3 tmp_point = vi->point() + vi->motion_vec;
Kernel::Point_3 closest_point = dst_mesh.closestColorPoint(tmp_point, (float *)(vi->color));
#endif
//cerr << "closest_point (" << closest_point << ") has ID " << dst_mesh.vertex_mapping[closest_point]->id << endl;
//Kernel::Vector_3 closest_normal = dst_mesh.vertex_mapping[closest_point]->normal();
//Kernel::Vector_3 closest_normal = dst_mesh.vertexMapping(closest_point)->normal();
/*
vi->delta = closest_point - vi->point();
bool is_outside = v_norm((closest_point + closest_normal*v_norm(vi->delta)) - vi->point()) < v_norm(vi->delta);
// bool is_outside = v_norm(v_normalized(closest_normal) + v_normalized(vi->delta)) < 1.4142;
// bool is_outside = v_angle(closest_normal, vi->delta) > PI/2;
double dist_sign = (is_outside?1:-1);
vi->delta = vi->normal()*v_norm(vi->delta)*(-1)*dist_sign;
*/
vi->delta = closest_point- (vi->point() + vi->motion_vec);
//vi->delta = vi->normal()* (closest_normal*(closest_point-vi->point()));
// vi->delta == v_normalized(data->mesh.computeVectorComponent(vi->normal(),vi->delta,1))*v_norm(vi->delta);
// vi->delta = v_normalized(vi->delta)*data->mesh.computeVertexStatistics(*vi,1)*0.05;
// vi->delta = vi->normal(); //*alg_dt
}
// NORMALIZE the movements
float total_movement = 0;
int total_elements = 0;
double max_delta = data->mesh.edge_avg*alg_dt;
for (Vertex_iterator vi = data->mesh.p.vertices_begin(); vi!=data->mesh.p.vertices_end(); vi++) {
//vi->delta = v_normalized(vi->delta)*data->mesh.computeVertexStatistics(*vi,1)*0.1;
// double max_delta = data->mesh.computeVertexStatistics(*vi,1)*alg_dt;
// double min_delta = data->mesh.edge_avg/5;
// vi->delta = vi->delta;
// vi->delta = vi->delta + v_normalized(vi->delta)*(RAND_MAX/2-std::rand())*1.0/RAND_MAX*data->mesh.edge_avg/2*alg_smoothing;
// vi->delta = v_normalized(vi->delta)*max_delta;
double the_norm = v_norm(vi->delta);
if (the_norm > max_delta) {
vi->delta = v_normalized(vi->delta)*max_delta;
}
// if (the_norm < min_delta) vi->delta = v_normalized(vi->delta)*min_delta;
the_norm = v_norm(vi->delta);
if (! MOVE_THE_MESH || the_norm > max_delta*0.5) {
total_elements++;
total_movement += v_norm(vi->delta);
}
//vi->delta = vi->delta + Kernel::Vector_3((RAND_MAX/2-std::rand())*1.0/RAND_MAX, (RAND_MAX/2-std::rand())*1.0/RAND_MAX, (RAND_MAX/2-std::rand())*1.0/RAND_MAX)*data->mesh.computeVertexStatistics(*vi,1)*alg_smoothing;
// vi->delta = vi->delta + data->mesh.computeVectorComponent(vi->normal(),vi->laplacian()*alg_dt,0);
//vi->delta = vi->delta + vi->laplacian()*alg_smoothing;
}
data->mesh.diffuse(alg_smoothing, 0);
#if ADD_LENGTH_CONSTRAINT
for (Vertex_iterator vi = data->mesh.p.vertices_begin(); vi!=data->mesh.p.vertices_end(); vi++) {
// Add a cost for preserving the smoothness and the geometry of the mesh
HV_circulator h = vi->vertex_begin();
double geom_vx = 0 ;
double geom_vy = 0 ;
double geom_vz = 0 ;
int order=0;
do
{
const float xx = TO_FLOAT ( vi->point().x() );
const float yy = TO_FLOAT ( vi->point().y() );
const float zz = TO_FLOAT ( vi->point().z() );
const float xxx = TO_FLOAT ( h->opposite()->vertex()->point().x()) ;
const float yyy = TO_FLOAT ( h->opposite()->vertex()->point().y()) ;
const float zzz = TO_FLOAT ( h->opposite()->vertex()->point().z()) ;
double d = (xx - xxx) * (xx - xxx) + (yy - yyy) * (yy - yyy) + (zz - zzz) * (zz - zzz) ;
#if MOVE_THE_MESH
double t_d2x = (xx + vi->delta[0]) - (xxx + h->opposite()->vertex()->delta[0]) ;
//.........这里部分代码省略.........