当前位置: 首页>>代码示例>>C++>>正文


C++ Segment::Init方法代码示例

本文整理汇总了C++中Segment::Init方法的典型用法代码示例。如果您正苦于以下问题:C++ Segment::Init方法的具体用法?C++ Segment::Init怎么用?C++ Segment::Init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Segment的用法示例。


在下文中一共展示了Segment::Init方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: FacetToSegmentsGorizon

void Convex::FacetToSegmentsGorizon(FacetList *FL, SegmentList *SL)
{
    Facet       *pF;
    Segment     S;
    SegmentList SN;

    if ( FL->GetFirst(&pF) )
    {
        // з кожної грані створюємо три ребра
        do {
            S.Init(pF->A, pF->B);
            SN.Add(S);
            S.Init(pF->A, pF->C);
            SN.Add(S);
            S.Init(pF->C, pF->B);
            SN.Add(S);
        } while (FL->GetNext(&pF));
   
        // В список ребер горизонту включаємо лише зовнішні ребра видимої області
        while(!SN.IsEmpty())
        {
            SN.Remove(&S);
            if (SN.FindAndRemoveAll(S)==0)
            {
                SL->Add(S);

                #ifdef CONVEX_DEBUG
                    printf( "Add to horizon : ");
                    S.PrintPoints();
                #endif            
            };
        };
    
    };
}
开发者ID:dymo1991,项目名称:convhull,代码行数:35,代码来源:convex.cpp

示例2: Segment

ISegment*           URLType::ToSegment      (const std::vector<IBaseUrl *>& baseurls) const
{
    Segment *seg = new Segment();
    
    if(seg->Init(baseurls, this->sourceURL, this->range, this->type))
        return seg;

    delete(seg);

    return NULL;
}
开发者ID:ChristianKreuzberger,项目名称:AMuSt-libdash,代码行数:11,代码来源:URLType.cpp

示例3: Segment

ISegment*           BaseUrl::ToMediaSegment     (const std::vector<IBaseUrl *>& baseurls) const
{
    Segment *seg = new Segment();

    if(seg->Init(baseurls, this->url, this->byteRange, dash::metrics::MediaSegment))
        return seg;

    delete(seg);

    return NULL;
}
开发者ID:ChristianKreuzberger,项目名称:AMuSt-libdash,代码行数:11,代码来源:BaseUrl.cpp

示例4: DelVertexDoubles

void Convex::DelVertexDoubles(PointList *PL)
{
    PointList PP;
    Point P, L;
    Segment S;
    SegmentList SN;

    if ( PL->GetFirst(&P) )
    {
        do {
            PP.Add(P);
        } while (PL->GetNext(&P));
    };
    
    if ( PL->GetFirst(&L) )
    {
        do {
            if ( PP.GetFirst(&P) )
            {
                do {
                    S.Init(P, L); 
                    SN.Add(S);
                } while (PP.GetNext(&P));
            };  
        } while (PL->GetNext(&L));
    }; 

    if ( PL->GetFirst(&P) )
    {
        do {
            if ( SN.GetFirst(&S) )
            {
                do {
                    if (S.Into(P))
                        PL->FindAndRemoveAll(P);
                } while (SN.GetNext(&S));
            };  
        } while (PL->GetNext(&P));
    };
}
开发者ID:dymo1991,项目名称:convhull,代码行数:40,代码来源:convex.cpp

示例5: CreateSimplex

int Convex::CreateSimplex(FacetList* HullFaces, PointList *AllPoints)
{
    Point   PCurr, PCurr2, PMinX, PMinY, PMinZ, PMaxX, PMaxY, PMaxZ;
    Segment S;
    Facet   F, *pF;
    int     go, go2;

    AllPoints->GetFirst(&PCurr);
    PMinX.Init(PCurr);    PMinY.Init(PCurr);    PMinZ.Init(PCurr);
    PMaxX.Init(PCurr);    PMaxY.Init(PCurr);    PMaxZ.Init(PCurr);

    while( AllPoints->GetNext(&PCurr) )            // 1) find the minimum and maximum point to each direction
    {
        if (PCurr.GetX()<PMinX.GetX())
            PMinX.Init(PCurr);
        if (PCurr.GetY()<PMinY.GetY())
            PMinY.Init(PCurr);
        if (PCurr.GetZ()<PMinZ.GetZ())
            PMinZ.Init(PCurr);
        if (PCurr.GetX()>PMaxX.GetX())
            PMaxX.Init(PCurr);
        if (PCurr.GetY()>PMaxY.GetY())
            PMaxY.Init(PCurr);
        if (PCurr.GetZ()>PMaxZ.GetZ())
            PMaxZ.Init(PCurr);
    };

    if ( PMinX.IsMatch(PMaxX) || PMinY.IsMatch(PMaxY) || PMinZ.IsMatch(PMaxZ) )
    {
        printf( "Points are coplanars !\n" );
        return 0;                                   // 2) all points are coplanars
    };

    S.Init(PMaxX, PMinX);                           // 3) check to colinear
    AllPoints->GetFirst(&PCurr);
    go = go2 = 1;
    while ( go & go2 )
    {
        if (S.Square(PCurr)>0)
            go = 0;
        else
            go2 = AllPoints->GetNext(&PCurr);
    }
    if (go) {
        printf( "Points are colinears !\n" );
        return 0;   // all points are colinears
    };
                                                    
    F.Init(PMaxX, PMinX, PCurr);                     // 4) check to coplanar
    AllPoints->GetFirst(&PCurr2);
    go = go2 = 1;
    while ( go && go2 )
    {
        if (F.DistanceToPoint(PCurr2)>0)
            go = 0;
        else
            go2 = AllPoints->GetNext(&PCurr2);
    }
    if (go)
    {
        printf( "Points are coplanars !!\n" );
        return 0;                                   // all points are coplanar
    };
/*
    AllPoints->GetFirst(&PCurr);
    AllPoints->GetNext(&PCurr2);
    AllPoints->GetNext(&PMaxX);
    AllPoints->GetNext(&PMinX);
*/
    // Now we have four points : PMaxX, PMinX, PCurr, PCurr2
    pF = new Facet; 
    pF->CreateOrientatedFace( PCurr, PCurr2, PMaxX, PMinX );
    HullFaces->Add( pF );
    pF = new Facet; 
    pF->CreateOrientatedFace( PMinX, PCurr, PCurr2, PMaxX );
    HullFaces->Add( pF );
    pF = new Facet; 
    pF->CreateOrientatedFace( PMaxX, PMinX, PCurr, PCurr2 );
    HullFaces->Add( pF );
    pF = new Facet; 
    pF->CreateOrientatedFace( PMaxX, PMinX, PCurr2, PCurr );
    HullFaces->Add( pF );

    AllPoints->FindAndRemoveAll( PMinX );
    AllPoints->FindAndRemoveAll( PMaxX );
    AllPoints->FindAndRemoveAll( PCurr2 );
    AllPoints->FindAndRemoveAll( PCurr );

    insidePoint.Init(   (PMinX.GetX()+PMaxX.GetX()+PCurr2.GetX()+PCurr.GetX())/4, 
                        (PMinX.GetY()+PMaxX.GetY()+PCurr2.GetY()+PCurr.GetY())/4, 
                        (PMinX.GetZ()+PMaxX.GetZ()+PCurr2.GetZ()+PCurr.GetZ())/4 );

    return 1;
};
开发者ID:dymo1991,项目名称:convhull,代码行数:94,代码来源:convex.cpp


注:本文中的Segment::Init方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。