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


C++ VertexVector::at方法代码示例

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


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

示例1: do_calculateMaxWidth

double FramedFace::do_calculateMaxWidth(const VertexVector& vertices) const
{
    double maxHeight=1000000.0;
    int vertexNum=(int) vertices.size();
    for (int i=0;i<vertexNum;i++)
    {
        int a1=i;   //verticies for 1st angle
        int a2=i+1;
        int a3=i+2;
        a1%=vertexNum;
        a2%=vertexNum;
        a3%=vertexNum;
        
        int b1=i+1; //verticies for 2nd angle
        int b2=i+2;
        int b3=i+3;
        b1%=vertexNum;
        b2%=vertexNum;
        b3%=vertexNum;
        
        double angle1=Point::angleMeasure(vertices.at(a1), vertices.at(a2), vertices.at(a3))/2.0; //1st angle measure
        double angle2=Point::angleMeasure(vertices.at(b1), vertices.at(b2), vertices.at(b3))/2.0; //2nd angle measure
        double edgeLength=Point::distance(vertices.at(a2), vertices.at(b2));
        
        double heightForEdge=edgeLength/(1.0/tan(angle1)+1.0/tan(angle2));
        /*if (heightForEdge<maxHeight)
         {
         maxHeight=heightForEdge;
         }*/
        maxHeight=fmin(heightForEdge,maxHeight);
    }
    return maxHeight;
}
开发者ID:apfitzen,项目名称:Wireframes-Calc,代码行数:33,代码来源:FramedFace.cpp

示例2: generateInnerPoints

void FramedFace::generateInnerPoints(double frameWidth,const VertexVector& vertices)
{
    int faceSize=(int) vertices.size();
    inners.resize(faceSize);
    
    Point bisector;
    double angle,factor;
    
    for (int i=0;i<faceSize;i++)
    {
        int index1=(i-1)%faceSize;
        int index2=i%faceSize;
        int index3=(i+1)%faceSize;
        
        if (index1==-1) { index1=faceSize-1; }
        
        Point v1=vertices.at(index1);
        Point v2=vertices.at(index2);
        Point v3=vertices.at(index3);
        
        bisector=Point::angleBisector(v1, v2, v3);
        angle=Point::angleMeasure(v1, v2, v3)/2.0;
        
        factor=frameWidth/sin(angle)/Point::distance(v2, bisector);
        inners.at(i)=Point::extendLine(v2, bisector, factor);
    }
}
开发者ID:apfitzen,项目名称:Wireframes-Calc,代码行数:27,代码来源:FramedFace.cpp

示例3: Triangle

std::vector<Triangle> FramedFace::connectInnerPoints(const VertexVector& vertices)
{
    int faceSize=(int) inners.size();
    std::vector<Triangle> generatedTriangles;
    generatedTriangles.reserve(2*faceSize);
    for (int i=0;i<faceSize;i++)
    {
        int index1=(i)%faceSize;
        int index2=(i+1)%faceSize;
        
        Point v1=vertices.at(index1);
        Point v2=vertices.at(index2);
        
        generatedTriangles.push_back( Triangle(v1,inners.at(index2),inners.at(index1)) );
        generatedTriangles.push_back( Triangle(v1,v2,inners.at(index2)) );
    }
    return generatedTriangles;
}
开发者ID:apfitzen,项目名称:Wireframes-Calc,代码行数:18,代码来源:FramedFace.cpp


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