本文整理汇总了C++中FaceSet::RemoveFace方法的典型用法代码示例。如果您正苦于以下问题:C++ FaceSet::RemoveFace方法的具体用法?C++ FaceSet::RemoveFace怎么用?C++ FaceSet::RemoveFace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FaceSet
的用法示例。
在下文中一共展示了FaceSet::RemoveFace方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateDelaunayOnSphere
void PointSet::CreateDelaunayOnSphere(PointSet* ps, FaceSet* fs, double* progress, std::stringstream* myMsg)
{
double dummy = 0;
if ( progress==NULL ) progress = &dummy;
int p_num = ps->GetCount();
PointSet tmpPS;
tmpPS.count = p_num;
tmpPS.capacity = p_num*2+4;
tmpPS.points = new Point4D [tmpPS.capacity];
const double OVERWRAP = 0.1;
int* OverwrapID = new int [p_num*2];
memset( OverwrapID, -1, sizeof(int)*2*p_num );
double center[3];
// Estimate Center
{
double pntRange[] = {
DBL_MAX, DBL_MAX, DBL_MAX,
-DBL_MAX, -DBL_MAX, -DBL_MAX,
};
for ( int i=0 ; i < p_num; i++ ) {
Point4D pnt = ps->GetPoint4DAt(i);
for ( int j=0; j < 3; j++ ) {
pntRange[j+0] = ( pntRange[j+0]>pnt.GetPoint(j) ? pnt.GetPoint(j) : pntRange[j+0]);
pntRange[j+3] = ( pntRange[j+3]<pnt.GetPoint(j) ? pnt.GetPoint(j) : pntRange[j+3]);
}
}
for ( int j=0; j < 3; j++ ) {
center[j] = ( pntRange[j+3]+pntRange[j+0] )/2;
}
}
// Project onto Sphere
{
Point4D Center( center[0], center[1], center[2] );
for ( int i=0; i < p_num; i++ ) {
double CntPnt[3];
(ps->GetPoint4DAt(i)-Center).GetPoint(CntPnt);
double lng = atan(CntPnt[1]/CntPnt[2])+( CntPnt[2]>0 ? 0 : M_PI ) +M_PI/2;
double lat = atan( CntPnt[0]/sqrt(CntPnt[1]*CntPnt[1]+CntPnt[2]*CntPnt[2]) ) +M_PI/2;
OverwrapID[i] = i;
tmpPS.points[i].SetPoint( lng, lat, lng*lng+lat*lat);
if ( lng < OVERWRAP ) {
OverwrapID[tmpPS.count] = i;
tmpPS.points[tmpPS.count++].SetPoint( lng+2*M_PI, lat, (lng+2*M_PI)*(lng+2*M_PI)+lat*lat );
}
}
}
// 外接4角形の作成
tmpPS.count += 4;
tmpPS.points[tmpPS.count-4].SetPoint( 6*M_PI, 2*M_PI, M_PI*M_PI*40 );
tmpPS.points[tmpPS.count-3].SetPoint( 6*M_PI, -1*M_PI, M_PI*M_PI*37 );
tmpPS.points[tmpPS.count-2].SetPoint( -2*M_PI, -1*M_PI, M_PI*M_PI*5 );
tmpPS.points[tmpPS.count-1].SetPoint( -2*M_PI, 2*M_PI, M_PI*M_PI*8 );
FaceSet myFS;
myFS.AddNewFace( tmpPS.count-2, tmpPS.count-3, tmpPS.count-4 );
myFS.AddNewFace( tmpPS.count-4, tmpPS.count-1, tmpPS.count-2 );
if ( !myFS.CheckDelaunay( &tmpPS ) ) {
// AfxMessageBox("Invalid initial Delaunay.", MB_ICONERROR);
// return;
throw "Invalid initial Delaunay.";
}
myFS.MakeDelaunay( &tmpPS, progress, myMsg );
for ( int i=1; i <= 4; i++ ) {
myFS.RemoveFaceV(tmpPS.count-i);
}
// IDの整理
{
int f_num = myFS.GetFaceCount(), *f_list=NULL ;
myFS.GetFaceIDList( &f_list, true );
for ( int i=0; i < f_num; i++ ) {
myFS.RemoveFace(i);
ASSERT(OverwrapID[f_list[i*3+0]]!=-1);
ASSERT(OverwrapID[f_list[i*3+1]]!=-1);
ASSERT(OverwrapID[f_list[i*3+2]]!=-1);
myFS.AddNewFace( OverwrapID[f_list[i*3+0]], OverwrapID[f_list[i*3+1]], OverwrapID[f_list[i*3+2]] );
}
delete [] f_list;
}
myFS.Unduplication();
delete [] OverwrapID;
*fs = myFS;
}