亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? quadedge.c

?? 關于限制性四叉樹實現算法的
?? C
?? 第 1 頁 / 共 2 頁
字號:
/********************************************************************************* quadedge.C: routines for QuadEdge and Mesh classes and for contstruction** of constrained Delaunay triangulations (CDTs). **** Copyright (C) 1995 by Dani Lischinski **** This program is free software; you can redistribute it and/or modify** it under the terms of the GNU General Public License as published by** the Free Software Foundation; either version 2 of the License, or** (at your option) any later version.**** This program is distributed in the hope that it will be useful,** but WITHOUT ANY WARRANTY; without even the implied warranty of** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the** GNU General Public License for more details.**** You should have received a copy of the GNU General Public License** along with this program; if not, write to the Free Software** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.********************************************************************************/#include "quadedge.h"/*********************** Basic Topological Operators ************************/Edge* Mesh::MakeEdge(Boolean constrained = FALSE){	QuadEdge *qe = new QuadEdge(constrained);	qe->p = edges.insert(edges.first(), qe);	return qe->edges();}Edge* Mesh::MakeEdge(Point2d *a, Point2d *b, Boolean constrained = FALSE){	Edge *e = MakeEdge(constrained);	e->EndPoints(a, b);	return e;}void Splice(Edge* a, Edge* b)// This operator affects the two edge rings around the origins of a and b,// and, independently, the two edge rings around the left faces of a and b.// In each case, (i) if the two rings are distinct, Splice will combine// them into one; (ii) if the two are the same ring, Splice will break it// into two separate pieces. // Thus, Splice can be used both to attach the two edges together, and// to break them apart. See Guibas and Stolfi (1985) p.96 for more details// and illustrations.{	Edge* alpha = a->Onext()->Rot();	Edge* beta  = b->Onext()->Rot();	Edge* t1 = b->Onext();	Edge* t2 = a->Onext();	Edge* t3 = beta->Onext();	Edge* t4 = alpha->Onext();	a->next = t1;	b->next = t2;	alpha->next = t3;	beta->next = t4;}void Mesh::DeleteEdge(Edge* e){	// Make sure the starting edge does not get deleted:	if (startingEdge->QEdge() == e->QEdge()) {		Warning("Mesh::DeleteEdge: attempting to delete starting edge");		// try to recover:		startingEdge = (e != e->Onext()) ? e->Onext() : e->Dnext();		Assert(startingEdge->QEdge() != e->QEdge());	}	// remove edge from the edge list:	QuadEdge *qe = e->QEdge();	edges.remove(edges.prev(qe->p));	delete qe;}QuadEdge::~QuadEdge(){	// If there are no other edges from the origin or the destination	// the corresponding data pointers should be deleted:	if (e[0].data != NIL(Point2d) && e[0].next == e)		delete e[0].data;	if (e[2].data != NIL(Point2d) && e[2].next == (e+2))		delete e[2].data;	// Detach edge from the rest of the subdivision:	Splice(e, e->Oprev());	Splice(e->Sym(), e->Sym()->Oprev());}Mesh::~Mesh(){	QuadEdge *qp;	for (LlistPos p = edges.first(); !edges.isEnd(p); p = edges.next(p)) {		qp = (QuadEdge *)edges.retrieve(p);		delete qp;	}}/************* Topological Operations for Delaunay Diagrams *****************/Mesh::Mesh(const Point2d& a, const Point2d& b, const Point2d& c)// Initialize the mesh to the triangle defined by the points a, b, c.{	Point2d *da = new Point2d(a);	Point2d *db = new Point2d(b);	Point2d *dc = new Point2d(c);	Edge* ea = MakeEdge(da, db, TRUE);   	Edge* eb = MakeEdge(db, dc, TRUE);	Edge* ec = MakeEdge(dc, da, TRUE);	Splice(ea->Sym(), eb);	Splice(eb->Sym(), ec);	Splice(ec->Sym(), ea);	startingEdge = ec;}Mesh::Mesh(const Point2d& a, const Point2d& b,           const Point2d& c, const Point2d& d)// Initialize the mesh to the Delaunay triangulation of// the quadrilateral defined by the points a, b, c, d.// NOTE: quadrilateral is assumed convex.{	Boolean InCircle(const Point2d&, const Point2d&,	                 const Point2d&, const Point2d&);	Point2d *da = new Point2d(a);	Point2d *db = new Point2d(b);	Point2d *dc = new Point2d(c);	Point2d *dd = new Point2d(d);	Edge* ea = MakeEdge(da, db, TRUE);	Edge* eb = MakeEdge(db, dc, TRUE);	Edge* ec = MakeEdge(dc, dd, TRUE);	Edge* ed = MakeEdge(dd, da, TRUE);	Splice(ea->Sym(), eb);	Splice(eb->Sym(), ec);	Splice(ec->Sym(), ed);	Splice(ed->Sym(), ea);	// Split into two triangles:	if (InCircle(c, d, a, b)) {		// Connect d to b:		startingEdge = Connect(ec, eb);	} else {		// Connect c to a:		startingEdge = Connect(eb, ea);	}}// The following typedefs are necessary to avoid stupid warnings// on some compilers:typedef Point2d* Point2dPtr;typedef Edge*    EdgePtr;Mesh::Mesh( int numVertices, double *bdryVertices )// Initialize the mesh to the Delaunay triangulation of the// convex polygon defined by the coordinates in the bdryVertices// array. The number of vertices (coordinate pairs) is specified// via numVertices.// NOTE: polygon is assumed convex.{	Point2d orig, dest;	Edge *e0, *e1;	register int i;	Assert(numVertices >= 3);	Point2d **verts = new Point2dPtr[numVertices + 1];	Edge **edges = new EdgePtr[numVertices + 1];	// Create all vertices:	for (i = 0; i < numVertices; i++) {		verts[i] = new Point2d(bdryVertices[2*i], bdryVertices[2*i+1]);	}	verts[numVertices] = verts[0];	// Create all edges:	for (i = 0; i < numVertices; i++) {		edges[i] = MakeEdge(verts[i], verts[i+1], TRUE);	}	edges[numVertices] = edges[0];	// Connect edges together:	for (i = 0; i < numVertices; i++) {		Splice(edges[i]->Sym(), edges[i+1]);	}		// Triangulate:	Triangulate(edges[0]);	// Initialize starting edge:	startingEdge = edges[0];	delete[] verts;	delete[] edges;}Edge* Mesh::Connect(Edge* a, Edge* b)// Add a new edge e connecting the destination of a to the// origin of b, in such a way that all three have the same// left face after the connection is complete.// Additionally, the data pointers of the new edge are set.{	Edge* e = MakeEdge(a->Dest(), b->Org());	Splice(e, a->Lnext());	Splice(e->Sym(), b);	return e;}void Swap(Edge* e)// Essentially turns edge e counterclockwise inside its enclosing// quadrilateral. The data pointers are modified accordingly.{	Edge* a = e->Oprev();	Edge* b = e->Sym()->Oprev();	Splice(e, a);	Splice(e->Sym(), b);	Splice(e, a->Lnext());	Splice(e->Sym(), b->Lnext());	e->EndPoints(a->Dest(), b->Dest());}Point2d snap(const Point2d& x, const Point2d& a, const Point2d& b){	if (x == a)	    return a;	if (x == b)	    return b;	Real t1 = (x-a) | (b-a);	Real t2 = (x-b) | (a-b);		Real t = MAX(t1,t2) / (t1 + t2);		return ((t1 > t2) ? ((1-t)*a + t*b) : ((1-t)*b + t*a));}void Mesh::SplitEdge(Edge *e, const Point2d& x)// Shorten edge e s.t. its destination becomes x. Connect// x to the previous destination of e by a new edge. If e// is constrained, x is snapped onto the edge, and the new// edge is also marked as constrained.{	Point2d *dt;	if (e->isConstrained()) {		// snap the point to the edge before splitting:		dt = new Point2d(snap(x, e->Org2d(), e->Dest2d()));	} else	    dt = new Point2d(x);	Edge *t  = e->Lnext();	Splice(e->Sym(), t);	e->EndPoints(e->Org(), dt);	Edge *ne = Connect(e, t);	if (e->isConstrained())		ne->Constrain();}/*************** Geometric Predicates for Delaunay Diagrams *****************/inline Real TriArea(const Point2d& a, const Point2d& b, const Point2d& c)// Returns twice the area of the oriented triangle (a, b, c), i.e., the// area is positive if the triangle is oriented counterclockwise.{	return (b[X] - a[X])*(c[Y] - a[Y]) - (b[Y] - a[Y])*(c[X] - a[X]);}Boolean InCircle(const Point2d& a, const Point2d& b,                 const Point2d& c, const Point2d& d)// Returns TRUE if the point d is inside the circle defined by the// points a, b, c. See Guibas and Stolfi (1985) p.107.{	Real az = a | a;	Real bz = b | b;	Real cz = c | c;	Real dz = d | d;	Real det = (az * TriArea(b, c, d) - bz * TriArea(a, c, d) +				cz * TriArea(a, b, d) - dz * TriArea(a, b, c));	return (det > 0);}Boolean ccw(const Point2d& a, const Point2d& b, const Point2d& c)// Returns TRUE if the points a, b, c are in a counterclockwise order{	Real det = TriArea(a, b, c);	return (det > 0);}Boolean cw(const Point2d& a, const Point2d& b, const Point2d& c)// Returns TRUE if the points a, b, c are in a clockwise order{	Real det = TriArea(a, b, c);	return (det < 0);}Boolean RightOf(const Point2d& x, Edge* e)// Returns TRUE if the point x is strictly to the right of e{	return ccw(x, *(e->Dest()), *(e->Org()));}Boolean LeftOf(const Point2d& x, Edge* e)// Returns TRUE if the point x is strictly to the left of e{	return cw(x, *(e->Dest()), *(e->Org()));}Boolean OnEdge(const Point2d& x, Edge* e)// A predicate that determines if the point x is on the edge e.// The point is considered on if it is in the EPS-neighborhood// of the edge.{	Point2d a = e->Org2d(), b = e->Dest2d();	Real t1 = (x - a).norm(), t2 = (x - b).norm(), t3;	if (t1 <= EPS || t2 <= EPS)		return TRUE;	t3 = (a - b).norm();	if (t1 > t3 || t2 > t3)	    return FALSE;	Line line(a, b);	return (x == line);}Point2d Intersect(Edge *e, const Line& l)// Returns the intersection point between e and l (assumes it exists).{	return l.intersect(e->Org2d(), e->Dest2d());}Point2d CircumCenter(const Point2d& a, const Point2d& b, const Point2d& c)// Returns the center of the circle through points a, b, c.// From Graphics Gems I, p.22{	Real d1, d2, d3, c1, c2, c3;	d1 = (b - a) | (c - a);	d2 = (b - c) | (a - c);	d3 = (a - b) | (c - b);	c1 = d2 * d3;	c2 = d3 * d1;	c3 = d1 * d2;	return ((c2 + c3)*a + (c3 + c1)*c + (c1 + c2)*b) / (2*(c1 + c2 + c3));}/************* An Incremental Algorithm for the Construction of *************//************************ Delaunay Diagrams *********************************/Boolean hasLeftFace(Edge *e)// Returns TRUE if there is a triangular face to the left of e.{	return (e->Lprev()->Org() == e->Lnext()->Dest() &&	        LeftOf(e->Lprev()->Org2d(), e));}	inline Boolean hasRightFace(Edge *e)// Returns TRUE if there is a triangular face to the right of e.{	return hasLeftFace(e->Sym());}	void FixEdge(Edge *e)// A simple, but recursive way of doing things.// Flips e, if necessary, in which case calls itself// recursively on the two edges that were to the right// of e before it was flipped, to propagate the change.{	if (e->isConstrained())		return;	Edge *f = e->Oprev();	Edge *g = e->Dnext();	if (InCircle(*(e->Dest()), *(e->Onext()->Dest()),		         *(e->Org()), *(f->Dest()))) {		Swap(e);		FixEdge(f);		FixEdge(g);	}}void Mesh::Triangulate(Edge *first)// Triangulates the left face of first, which is assumed to be closed.// It is also assumed that all the vertices of that face lie to the// left of last (the edge preceeding first).	// This is NOT intended as a general simple polygon triangulation// routine. It is called by InsertEdge in order to restore a// triangulation after an edge has been inserted.// The routine consists of two loops: the outer loop continues as// long as the left face is not a triangle. The inner loop examines // successive triplets of vertices, creating a triangle whenever the// triplet is counterclockwise.{	Edge *a, *b, *e, *t1, *t2, *last = first->Lprev();	while (first->Lnext()->Lnext() != last) {		e = first->Lnext();		t1 = first;		while (e != last) {			t2 = e->Lnext();			if (t2 == last && t1 == first)			    break;			if (LeftOf(e->Dest2d(), t1)) {				if (t1 == first)					t1 = first = Connect(e, t1)->Sym();				else					t1 = Connect(e, t1)->Sym();				a = t1->Oprev(), b = t1->Dnext();				FixEdge(a);				FixEdge(b);				e = t2;			} else {				t1 = e;				e = t2;			}		}	}	a = last->Lnext(), b = last->Lprev();	FixEdge(a);	FixEdge(b);	FixEdge(last);}static Boolean coincide(const Point2d& a, const Point2d& b, Real dist)// Returns TRUE if the points a and b are closer than dist to each other.// This is useful for creating nicer meshes, by preventing points from// being too close to each other.{	Vector2d d = a - b;	if (fabs(d[X]) > dist || fabs(d[Y]) > dist)		return FALSE;	return ((d|d) <= dist*dist);}Edge *Mesh::InsertSite(const Point2d& x, Real dist /* = EPS */)

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人h版在线观看| 国产真实精品久久二三区| 国产精品―色哟哟| 国产欧美一区二区三区沐欲| 欧美一区二区观看视频| 在线成人午夜影院| 欧美一级免费大片| 欧美变态tickling挠脚心| 久久综合久久99| 中文字幕在线观看一区| 亚洲色图一区二区| 亚洲福利电影网| 三级欧美韩日大片在线看| 久久草av在线| www.欧美.com| 欧美日韩午夜影院| 精品国产乱码久久久久久蜜臀| 精品sm在线观看| 亚洲人成影院在线观看| 亚洲h动漫在线| 国产乱国产乱300精品| 国产69精品久久99不卡| 91蜜桃网址入口| 日韩视频在线一区二区| 久久久不卡影院| 亚洲在线成人精品| 国产在线国偷精品产拍免费yy| 成人影视亚洲图片在线| 欧美系列一区二区| 久久亚洲一级片| 一区二区三区不卡在线观看| 久久福利视频一区二区| 99re热视频这里只精品| 日韩一二三四区| 综合色天天鬼久久鬼色| 麻豆精品国产传媒mv男同 | 欧美日韩国产在线播放网站| 91精品国产综合久久精品麻豆| 欧美精品一区二区三区一线天视频 | 久久久99免费| 亚洲精品免费在线观看| 另类成人小视频在线| 99精品视频一区| 精品国产免费视频| 一区二区三区在线观看国产 | 国产美女精品人人做人人爽| 色噜噜久久综合| 久久亚洲综合色| 日本女人一区二区三区| 91同城在线观看| 国产亚洲成aⅴ人片在线观看| 亚洲成人免费电影| 91丨九色丨蝌蚪富婆spa| 精品三级在线看| 日本成人中文字幕| 欧美色视频在线| 亚洲乱码国产乱码精品精可以看 | 精品一区二区三区欧美| 在线免费视频一区二区| 国产精品丝袜黑色高跟| 韩国v欧美v亚洲v日本v| 日韩一级成人av| 日本女人一区二区三区| 欧美丰满嫩嫩电影| 午夜久久久久久| 欧美日韩精品一区二区三区四区| 亚洲日本护士毛茸茸| 成人黄色av电影| 国产精品毛片无遮挡高清| 国产精品一区二区果冻传媒| 欧美sm极限捆绑bd| 激情欧美一区二区三区在线观看| 日韩一区二区三区三四区视频在线观看 | 国产欧美视频在线观看| 国产精品一区二区男女羞羞无遮挡| 日韩欧美一区在线观看| 乱一区二区av| 欧美精品一区二区三区视频| 国产在线乱码一区二区三区| 精品国产露脸精彩对白| 精品一区二区三区在线观看国产 | 99精品久久只有精品| 中文字幕一区二区三区在线观看| 国产成人在线免费观看| 国产精品国产自产拍在线| 91丨九色丨黑人外教| 一区二区三区四区蜜桃| 欧美日韩午夜影院| 精品亚洲成a人| 欧美国产一区二区| 色美美综合视频| 蜜桃在线一区二区三区| 久久伊99综合婷婷久久伊| 成人免费高清视频在线观看| 一区二区三区久久久| 欧美一区二区三区日韩| 国产中文字幕一区| 亚洲免费观看高清完整版在线观看| 在线观看欧美精品| 蜜桃传媒麻豆第一区在线观看| 久久综合av免费| 91视频免费观看| 日本不卡不码高清免费观看| 国产日韩欧美高清| 欧美午夜片在线看| 狠狠久久亚洲欧美| 亚洲精品美腿丝袜| 久久久午夜精品理论片中文字幕| 97精品久久久久中文字幕| 丝袜亚洲精品中文字幕一区| 国产亚洲欧美日韩俺去了| 色综合天天综合色综合av | 91国产丝袜在线播放| 美女视频免费一区| 一区二区国产视频| 久久久精品黄色| 4438x成人网最大色成网站| 成人a区在线观看| 美日韩一区二区| 一区二区三区高清| 国产精品免费久久| 欧美成人一区二区三区片免费 | 日韩精品一区二区三区四区| 色综合久久99| 国产成人精品综合在线观看| 午夜av一区二区| 亚洲三级电影全部在线观看高清| 日韩欧美电影一二三| 欧美少妇bbb| 91亚洲大成网污www| 国产成人av电影在线播放| 日本亚洲三级在线| 亚洲成a人v欧美综合天堂| 国产精品白丝在线| 欧美韩日一区二区三区四区| 精品国产一区二区三区四区四| 欧美主播一区二区三区| 97久久精品人人澡人人爽| 国产激情一区二区三区四区 | av在线一区二区三区| 国产精品亚洲视频| 国产一区二区h| 狠狠v欧美v日韩v亚洲ⅴ| 蜜臀va亚洲va欧美va天堂| 日本 国产 欧美色综合| 日韩国产欧美视频| 天堂资源在线中文精品| 午夜久久久影院| 五月天网站亚洲| 日本在线不卡一区| 美国十次综合导航| 国产麻豆日韩欧美久久| 国产一区二区电影| 福利一区二区在线观看| 成人美女在线观看| 色婷婷久久久综合中文字幕 | 日日夜夜精品免费视频| 亚欧色一区w666天堂| 亚洲伊人色欲综合网| 天堂av在线一区| 久久99精品久久久久久国产越南 | 欧美日韩aaa| 欧美一区二区观看视频| 精品国产伦一区二区三区观看体验| 日韩欧美国产高清| 国产日韩亚洲欧美综合| 国产视频一区不卡| 综合在线观看色| 视频一区欧美精品| 韩国理伦片一区二区三区在线播放| 韩国欧美一区二区| aa级大片欧美| 欧美日韩免费一区二区三区视频| 91精品久久久久久蜜臀| 久久女同精品一区二区| 国产三级一区二区| 亚洲激情一二三区| 日本亚洲免费观看| 99久久综合国产精品| 欧美日韩一区二区在线观看| 精品久久人人做人人爰| 椎名由奈av一区二区三区| 日本成人在线视频网站| 国产a视频精品免费观看| 色丁香久综合在线久综合在线观看| 91精品国产综合久久精品性色| 国产亚洲欧洲一区高清在线观看| 亚洲欧洲日韩在线| 美女视频一区二区| 一本色道**综合亚洲精品蜜桃冫| 91精品国产综合久久蜜臀| 国产精品久久免费看| 另类小说欧美激情| 欧美日精品一区视频| 中文字幕精品在线不卡| 丝袜美腿高跟呻吟高潮一区| 99久久精品国产导航| 欧美电视剧免费全集观看| 亚洲欧美日韩成人高清在线一区| 老汉av免费一区二区三区|