文档下载 文档下载导航
设为首页 | 加入收藏
搜索 请输入内容:  
 导航当前位置: 文档下载 > 所有分类 > IT/计算机 > 计算机软件及应用 > 判断一个简单图是否为平面图(c++ )
侵权投诉

判断一个简单图是否为平面图(c++ )

ment *f = createGraph(pointCount);
f->at(i)->push_back(*ltra);
f->at(*ltra)->push_back(i);
fragmentsVector->push_back(f);
parent[*ltra] = i;
colour[*ltra] = BLACK;
}
}
colour[i] = BLACK;
}
}
}
return fragmentsVector;
}

vector< face* >* getFacesFromOneCircle(circle*& c)
{
vector< face* > *faces = new vector< face* >;
face* tempFace = new face; ///面用链表表示即可, 链表按顺时针记录面的点
tempFace->push_back(MAXINT); ///带MAXINT(当作无穷)的面是外面
circle::iterator ctra = c->begin();
circle::iterator cend = c->end();
for (; ctra != cend; ctra++)
{
tempFace->push_back(*ctra);
}
faces->push_back(tempFace);
faces->push_back(c);
c = NULL; ///circle c已经转变为其中一个face, 防止通过指针c改变它
return faces;
}

///标记已经嵌入到平面的点
void markEmbedPoint(const circle *c, int pointCount)
{
memset(pointEmbed, false, sizeof(bool)*pointCount);
circle::const_iterator ctra = c->begin();
circle::const_iterator cend = c->end();
for (; ctra != cend; ctra++)
{
if (*ctra != MAXINT)
{
pointEmbed[*ctra] = true;
}
}
}
///每次将alpha path嵌入到平面时, 更新已经嵌入到平面的结点
void addPoint(const path *alphaPath)
{
path::const_iterator ptra = alphaPath->begin();
path::const_iterator pend = alphaPath->end();
for (; ptra != pend; ptra++)
{
pointEmbed[*ptra] = true;
}
}

///标记已经嵌入到平面的边
void markEmbedEdge(const circle *c, int pointCount)
{
for (int i=0; i<pointCount; i++)
{
for (int j=0; j<pointCount; j++)
{
edgeEmbed[i][j] = false;
}
}
circle::const_iterator ctra = c->begin();
circle::const_iterator cend = c->end();
circle::const_iterator pre;
for (pre=ctra++; ctra != cend; ctra++)
{
edgeEmbed[*pre][*ctra] = true;
edgeEmbed[*ctra][*pre] = true;
pre = ctra;
}
edgeEmbed[*(c->begin())][*pre] = true;
edgeEmbed[*pre][*(c->begin())] = true;
}
///每次将alpha path嵌入到平面时更新已经嵌入到平面的边
void addEdge(const path *alphPath)
{
path::const_iterator ptra = alphPath->begin();
path::const_iterator pend = alphPath->end();
path::const_iterator pre;
for (pre = ptra++; ptra!=pend; ptra++)
{
edgeEmbed[*pre][*ptra] = true;
edgeEmbed[*ptra][*pre] = true;
pre = ptra;
}
}


///fragment与已经嵌入平面的子图的公共点就是contact point
bool* findContactPoint(const fragment *f)
{
int pointCount = f->size();
bool *contactPoint = new bool[pointCount];
memset(contactPoint, false, sizeof(bool) * pointCount);
for(int i=0; i < pointCount; i++)
{
if (pointEmbed[i] && !(f->at(i)->empty()))
{
contactPoint[i] = true;
}
}
return contactPoint;
}
///找一个face所包含的所有点
bool *findFacePoint(const face *fa, int pointCount)
{
bool *facePoint

上一页第3页

你可能喜欢

热门文档

相关文档

  • Visual C++设计二维平面图形

    新闻网页贴吧知道音乐图片视频地图百科文库 ...21 ~0~ 一、设计目的利用 Visual C++设计二维平面...继承关系很简单,就有一个基类 CShape 和几个派生类...

  • 实现一个简单画图的功能C++

    确定对象:名词短语(候选者)显示器荧光屏:一种输出...( 程序设计( C++) )自定义数据类型 enum Boolean ... cs3简单制作动态搞笑图片 81份文档 笑话大全集 ...

  • 图论平面图

    新闻网页贴吧知道音乐图片视频地图百科文库 ... 一个可平面图与其平面嵌入图拓扑同构, 因此我们将...Jordan曲线 平面上的简单闭曲线(自身不相交封闭曲 ...

  • 28-平面图与图着色

    平面图的必要条件:欧拉公式 适用于简单图的欧拉...均不在当中相交,则 称该图形是G的一个平面嵌入,...(c=1; c≤n; c++) if vi 的邻点没用颜色c ...

  • c++课程设计

    判断鼠标两次点击的图片能否消去,即图片是否相同且...《C++课程设计》 图 1.2 在创建过程的第一步 “...个有坐标位置属性的平面, 平面上零散地分布着若干个...

  • C++习题答案

    C++习题答案_电脑基础知识_IT/计算机_专业资料。4...判断一个整数是否为素数用一个函数来实现。 5-5 ...13-7 定义描述平面上一个带内的类point,重载“++...

  • 4.1.1_立体图形与平面图形(第1、2、3课时)

    怎样绘制一张 校园布局平面图?不同 的图形各有什么...上面看一些简单几何体或它们的组 合得到平面图形. ...这是一个工件的立体图,设计师们常常画出从不同方...

  • C++题目

    新闻网页贴吧知道音乐图片视频地图百科文库 ...设计你的学校的校园平面图,所含景点不少于 10 个...(一)功能要求:用 c/c++设计一系统,能提供下列服务...

  • Hough1

    如果直接利用图 像点阵进行搜索判断显然难以实现, ...将上述结论推广到任意平面图像上可知, 图像上任意...它由一系列 C 函数和少量 C++ 类 构成,实现了...

  • 华工C++习题及其解答(第3版)

    [i].name << endl; } 3.使用结构表示 X—Y 平面直角坐标系上的点,编写程序顺序读入一个四边形的四个顶点坐标,判别 由这四个顶点的连线构成的图形是否为正...

站点地图 | 文档上传 | 侵权投诉 | 手机版
本站所有资源均来自互联网,本站只负责收集和整理,均不承担任何法律责任,如有侵权等其它行为请联系我们.
文档下载 Copyright 2013 doc.guandang.net All Rights Reserved.  -  email