基于狄洛尼三角网生成算法的源代码(4)
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:
或QQ:
处理(尽可能给您提供完整文档),感谢您的支持与谅解。

this.eID[1]=e2ID; this.eID[2]=e3ID; } /*
* 下面这个方法是私有方法
* 它的作用是找到三角形的外界圆圆心坐标 */
private Point findCenter(Map pointSet) { MyPoint p1=pointSet.get(this.pID[0]); MyPoint p2=pointSet.get(this.pID[1]); MyPoint p3=pointSet.get(this.pID[2]); double x1=p1.x,y1=p1.y; double x2=p2.x,y2=p2.y; double x3=p3.x,y3=p3.y; double tempx1=(y2-y1)*(y3*y3-y1*y1+x3*x3-x1*x1)*1.0; double tempx2=(y3-y1)*(y2*y2-y1*y1+x2*x2-x1*x1)*1.0; double tempx3=2*(x3-x1)*(y2-y1)-2*(x2-x1)*(y3-y1); double centerX=(tempx1-tempx2)/tempx3; double tempy1=(x2-x1)*(x3*x3-x1*x1+y3*y3-y1*y1)*1.0; double tempy2=(x3-x1)*(x2*x2-x1*x1+y2*y2-y1*y1)*1.0; double tempy3=2*(y3-y1)*(x2-x1)-2*(y2-y1)*(x3-x1); double centerY=(tempy1-tempy2)/tempy3; return new Point((int)centerX,(int)centerY); } /*
* 下面这个函数是判断一个自定义点是否在三角形的外接圆内 * 若在圆内,则返回true * 否则返回false */
public boolean isInCircle(MyPoint p,Map pointSet) { boolean flag=false; Point center=this.findCenter(pointSet); MyPoint first=pointSet.get(this.pID[0]); double tempr1=(center.x-first.x)*(center.x-first.x); double tempr2=(center.y-first.y)*(center.y-first.y); double r=Math.sqrt((tempr1+tempr2)); double distance=p.distance(center.x,center.y); if(distance }
} /*
* 下面这个方法是按顺时针顺序得到构成三角形的三个顶点 * 三个顶点将存储在一个数组中返回 */
public MyPoint[] getPoints(Map pointSet) { MyPoint[] temp=new MyPoint[3]; for(int i=0;i<3;i++) temp[i]=pointSet.get(this.pID[i]); return temp; } /* *
* 下面这个方法是按照顺时针的顺序得到构成这个三角形的三边 * 三条边存在一个一维数组中返回 */
public MyEdge[] getPoints(Map edgeSet) { MyEdge[] temp=new MyEdge[3]; for(int i=0;i<3;i++) temp[i]=edgeSet.get(this.pID[i]); return temp; }
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说综合文库基于狄洛尼三角网生成算法的源代码(4)在线全文阅读。
基于狄洛尼三角网生成算法的源代码(4).doc
将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
下载失败或者文档不完整,请联系客服人员解决!