本文整理汇总了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;
}
示例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);
}
}
示例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;
}