本文整理汇总了C++中Facet_iterator::normal方法的典型用法代码示例。如果您正苦于以下问题:C++ Facet_iterator::normal方法的具体用法?C++ Facet_iterator::normal怎么用?C++ Facet_iterator::normal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Facet_iterator
的用法示例。
在下文中一共展示了Facet_iterator::normal方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Init
void VSA_Component::Init(int NbProxy)
{
////Creation of the initial proxies by random seed triangle picking
m_Table_Proxy.clear();
m_NbProxy=NbProxy;
int NbFacet=m_Poly->size_of_facets();
int offset=NbFacet/NbProxy;
int i=0;
for(Facet_iterator pface = m_Poly->facets_begin();
pface != m_Poly->facets_end();
pface++)
{
if(i%offset==0)///this triangle is chosen
{
//a proxy is created
Proxy NewProxy;
NewProxy.Normal=pface->normal();
NewProxy.Seed=pface;
///the proxy is added
m_Table_Proxy.push_back(NewProxy);
}
pface->LabelVSA=-1;
i++;
}
m_Poly->NbFaceLabel=m_NbProxy;
}
示例2: DistorsionError
double VSA_Component::DistorsionError(Facet_iterator f,Proxy p)
{
Vector v=f->normal()-p.Normal;
double nrm=v*v;
double area=AreaFacetTriangleSeg(f);
return nrm*area;
}
示例3: ProxyFitting
void VSA_Component::ProxyFitting()
{
Vector * TabNormal=new Vector[m_NbProxy];
double * TabArea=new double[m_NbProxy];
double * DistanceMin=new double[m_NbProxy];
double * DistanceMax=new double[m_NbProxy];
for (int i=0;i<m_NbProxy;i++)
{
TabArea[i]=0;
TabNormal[i]=CGAL::NULL_VECTOR;
DistanceMin[i]=100000000;
DistanceMax[i]=0;
}
for(Facet_iterator pface = m_Poly->facets_begin();
pface != m_Poly->facets_end();
pface++)
{
double area=AreaFacetTriangleSeg(pface);
TabArea[pface->LabelVSA]+=area;
TabNormal[pface->LabelVSA]=TabNormal[pface->LabelVSA]+pface->normal()*area;
}
for (int i=0;i<m_NbProxy;i++)
{
m_Table_Proxy[i].Normal=TabNormal[i]/TabArea[i];
m_Table_Proxy[i].Area=TabArea[i];
m_Table_Proxy[i].TotalDistorsion=0;
}
// a new seed is assigned to each proxy
for(Facet_iterator pface = m_Poly->facets_begin();
pface != m_Poly->facets_end();
pface++)
{
double distance=DistorsionError(pface,m_Table_Proxy[pface->LabelVSA]);
m_Table_Proxy[pface->LabelVSA].TotalDistorsion+=distance;
if(distance<DistanceMin[pface->LabelVSA])
{
DistanceMin[pface->LabelVSA]=distance;
m_Table_Proxy[pface->LabelVSA].Seed=pface;
}
//we pick the facet corresponding to the max distorsion
if(distance>DistanceMax[pface->LabelVSA])
{
DistanceMax[pface->LabelVSA]=distance;
m_Table_Proxy[pface->LabelVSA].MostDistordedFacet=pface;
}
}
delete []DistanceMin;
delete []TabNormal;
delete []TabArea;
delete []DistanceMax;
}