ImageVerifierCode 换一换
格式:DOCX , 页数:92 ,大小:45.27KB ,
资源ID:7907493      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/7907493.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(几何模板.docx)为本站会员(b****5)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

几何模板.docx

1、几何模板大几何模板大几何模板 1(1)凸包 2(2)判断两条线段是否相交(平行,不平行) 4(3)三角形的外接圆(已知不在同一直线上的三点求经过三点的圆) 4(4)三角形的垂心内心重心中垂线 6(5)求直线的交点 10(6)根据线段两端点的坐标求垂直平分线上除中点外的另一点 11(7)根据两点坐标求直线方程 11(8)差积的应用 12(9)三角形的面积公式 12(10)三角形的内接圆 12(11)多边形的面积(适合凹多边形) 13(12)判断点是否在线段上 14(13)平面上两个点之间的距离 14(14)p点关于直线L的对称点 14(15)判断一个矩形是否在另一个矩形中 15(16)直线和圆的

2、交点+点关于线的对称点+点到线的距离+直线方程 16(17)判断点是否在多边形内 21(18)N点中三个点组成三角形面积最大 28(19)扇形的重心 31(20)多边形的重心 32(21)判断N点是否共面 33(22)求共线的点最多为多少 34(23)N个矩形的相交的面积 36(24)三角形外接圆+圆的参数方程 38(25)判断线段是否有交点并求交点 43(26)简单多边形的核 46(27)线段重叠+投影 50(28)二分+圆的参数方程 53(29)Pick公式 54(30)根据经度纬度求球面距离 56(31)两圆切线的交点 58(31)两圆切线的交点(32)线段与三角形的交 60(33)最近

3、最远点对 68-(1)凸包/*凸包cug_1038*/#include #include struct point int x, y; pp; point p100005; int stack100005, top; int dis(point a, point b) return (a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y); int multi(point b, point c, point a) return (b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x); void

4、 swap(point p, int s, int t) point tmp; tmp = ps; ps = pt; pt = tmp; int cmp(const void *a, const void *b) point *c = (point *)a; point *d = (point *)b; double k = multi(*c, *d, pp); if(k = dis(*d, pp) return 1; else return -1; void Graham(point p, int n, int stack, int &top) int i, u; u = 0; for(i

5、= 1;i n;i+) if(pi.y = pu.y & pi.x pu.x) u = i; else if(pi.y pu.y) u = i; swap(p, 0, u); pp = p0; qsort(p + 1, n - 1, sizeof(p0), cmp); stack0 = 0; stack1 = 1; top = 1; for(i = 2;i = 0) if(top = 0) break; top-; top+; stacktop = i; int main() int ca, i, j, n; int area; scanf(%d, &ca); for(i = 1;i = ca

6、;i+) scanf(%d, &n); for(j = 0;j n;j+) scanf(%d%d, &pj.x, &pj.y); Graham(p, n, stack, top); area = 0; for(j = 1;j = min(s2.x, e2.x) & (max(s2.x, e2.x) = min(s1.x, e1.x) & (max(s1.y, e1.y) = min(s2.y, e2.y) & (max(s2.y, e2.y) = min(s1.y, e1.y) & (multi(s2, e1, s1) * multi(e1, e2, s1) = 0) & (multi(s1,

7、 e2, s2) * multi(e2, e1, s2) = 0) ) return true; return false; (3)三角形的外接圆(已知不在同一直线上的三点求经过三点的圆)/*三角形的外接圆pku_1329*/#include #include const double eps = 1e-6;typedef struct TPoint double x; double y;TPoint;typedef struct TTriangle TPoint t3;TTriangle;typedef struct TCircle TPoint centre; double r;TCirc

8、le;double distance(TPoint p1, TPoint p2) /计算平面上两个点之间的距离 return sqrt(p1.x - p2.x) * (p1.x - p2.x) + (p1.y - p2.y) * (p1.y - p2.y); double triangleArea(TTriangle t) /已知三角形三个顶点的坐标,求三角形的面积 return fabs(t.t0.x * t.t1.y + t.t1.x * t.t2.y + t.t2.x * t.t0.y - t.t1.x * t.t0.y - t.t2.x * t.t1.y - t.t0.x * t.t2

9、.y) / 2; TCircle circumcircleOfTriangle(TTriangle t) /三角形的外接圆 TCircle tmp; double a, b, c, c1, c2; double xA, yA, xB, yB, xC, yC; a = distance(t.t0, t.t1); b = distance(t.t1, t.t2); c = distance(t.t2, t.t0); /根据S = a * b * c / R / 4;求半径R tmp.r = a * b * c / triangleArea(t) / 4; xA = t.t0.x; yA = t.t

10、0.y; xB = t.t1.x; yB = t.t1.y; xC = t.t2.x; yC = t.t2.y; c1 = (xA * xA + yA * yA - xB * xB - yB * yB) / 2; c2 = (xA * xA + yA * yA - xC * xC - yC * yC) / 2; tmp.centre.x = -(c1 * (yA - yC) - c2 * (yA - yB) / (xA - xB) * (yA - yC) - (xA - xC) * (yA - yB); tmp.centre.y = -(c1 * (xA - xC) - c2 * (xA -

11、xB) / (yA - yB) * (xA - xC) - (yA - yC) * (xA - xB); return tmp; int main() TTriangle t; TCircle circle; double c, d, e; while(scanf(%lf%lf%lf%lf%lf%lf, &t.t0.x, &t.t0.y, &t.t1.x, &t.t1.y, &t.t2.x, &t.t2.y) != EOF) circle = circumcircleOfTriangle(t); / printf(%lf %lf %lfn, circle.centre.x, circle.ce

12、ntre.y, circle.r); if(fabs(circle.centre.x) eps) printf(x2); else if(circle.centre.x 0) printf(x - %.3lf)2 + , -circle.centre.x); else printf(x + %.3lf)2 + , circle.centre.x); if(fabs(circle.centre.y) eps) printf(y2 = ); else if(circle.centre.y 0) printf(y - %.3lf)2 = , -circle.centre.y); else print

13、f(y + %.3lf)2 = , circle.centre.y); printf(%.3lf2n, circle.r); c = 2 * circle.centre.x; d = 2 * circle.centre.y; e = circle.centre.x * circle.centre.x + circle.centre.y * circle.centre.y - circle.r * circle.r; printf(x2 + y2 ); /if(fabs(c) eps) if(c 0) printf(- %.3lfx , -c); else printf(+ %.3lfx , c

14、); if(d 0) printf(- %.3lfy , -d); else printf(+ %.3lfy , d); if(e 0) printf(- %.3lf = 0n, -e); else printf(+ %.3lf = 0n, e); printf(n); return 0; (4)三角形的垂心内心重心中垂线/*cug_1011_垂心内心重心中垂线.cpp*/#include #include using namespace std;const double eps = 1e-6; struct point double x, y;void K() /到三边距离和最短 void

15、L(double a, double b, double c, double A, double B, double C) /垂线的交点 double t1, t2, t3; t1 = c * cos(A) / cos(M_PI / 2 - C); t2 = c * cos(B) / cos(M_PI / 2 - C); t3 = a * cos(C) / cos(M_PI / 2 - A); t1 += t2 + t3; printf(%.3lfn, t1); struct TLine double a, b, c;TLine lineFromSegment(point p1, point

16、p2) /线段所在直线,返回直线方程的三个系统 TLine tmp; tmp.a = p2.y - p1.y; tmp.b = p1.x - p2.x; tmp.c = p2.x * p1.y - p1.x * p2.y; return tmp;point LineInter(TLine l1, TLine l2) /求两直线得交点坐标 point tmp; if(fabs(l1.b) -eps) printf(%.3lf , b + c); return ; else if(B - 2 * M_PI / 3 -eps) printf(%.3lf , a + c); return ; else

17、 if(C - 2 * M_PI / 3 -eps) printf(%.3lf , a + b); return ; point pa, pb, pc, pc1, pa1; pa.x = 0, pa.y = 0; pb.x = c, pb.y = 0; pc.x = b * cos(A); pc.y = b * sin(A); pc1.x = c * cos(-M_PI / 3); pc1.y = c * sin(-M_PI / 3); pa1.x = a * cos(2 * M_PI / 3 - B) + c; pa1.y = a * sin(2 * M_PI / 3 - B); TLine

18、 l1, l2; l1 = lineFromSegment(pa, pa1); l2 = lineFromSegment(pc, pc1); point f = LineInter(l1, l2); printf(%.3lf , dis(pa, f) + dis(pb, f) + dis(pc, f); void I(double a, double b, double c, double A, double B, double C) /角平分线的交点到三顶点的距离和 double t, ans; t = (a + b - c) / 2; ans = t / cos(C / 2) + (b -

19、 t) / cos(A / 2) + (a - t) / cos(B / 2); printf(%.3lf , ans);void G(double a, double b, double c, double A, double B, double C) /中线的交点 double t1, t2, t3; t1 = sqrt(b / 2) * (b / 2) + a * a - 2 * a * b / 2 * cos(C); t2 = sqrt(a / 2) * (a / 2) + c * c - 2 * a * c / 2 * cos(B); t3 = sqrt(c / 2) * (c /

20、2) + b * b - 2 * b * c / 2 * cos(A); t1 += t2 + t3; printf(%.3lf , t1 * 2 / 3); void O(double a, double b, double c, double A, double B, double C) /垂线的交点 double t = (A + C - B) / 2; printf(%.3lfn, 3 * b / 2 / cos(t); int main() int i, ca; double a, b, c; double A, B, C; cin ca; for(i = 1;i a b c; A

21、= (b * b + c * c - a * a) / 2 / b / c; B = (a * a + c * c - b * b) / 2 / a / c; C = (a * a + b * b - c * c) / 2 / a / b; A = acos(A), B = acos(B), C = acos(C); F(a, b, c, A, B, C); I(a, b, c, A, B, C); G(a, b, c, A, B, C); O(a, b, c, A, B, C); return 0;=-(5)求直线的交点/*求直线的交点,注意平形的情况无解,避免RE*/TPoint Line

22、Inter(TLine l1, TLine l2) /求两直线得交点坐标 TPoint tmp; double a1 = l1.a; double b1 = l1.b; double c1 = l1.c; double a2 = l2.a; double b2 = l2.b; double c2 = l2.c; /注意这里b1 = 0 if(fabs(b1) eps) tmp.x = -c1 / a1; tmp.y = (-c2 - a2 * tmp.x) / b2; else tmp.x = (c1 * b2 - b1 * c2) / (b1 * a2 - b2 * a1); tmp.y =

23、 (-c1 - a1 * tmp.x) / b1; /cout 交点坐标 endl; /cout a1 * tmp.x + b1 * tmp.y + c1 endl; /cout a2 * tmp.x + b2 * tmp.y + c2 endl; return tmp;(6)根据线段两端点的坐标求垂直平分线上除中点外的另一点TPoint GetOtherPoint(TPoint pre, TPoint tmp) /*根据线段两端点的坐标求垂直平分线上除中点外的另一点*/ double kx, ky; TPoint other, mid; mid.x = (pre.x + tmp.x) / 2; mid.y = (pre.y + tmp.y) / 2; kx = pre.x - tmp.x; ky = pre.y - tmp.y; if(fabs(kx) eps) other.y = mid.y; other.x = 1.0; if(fabs(other.x - mid.x) eps) other.x = 2.0; else if(fabs(ky) eps) other.x = mid.x; other.y = 1.0; if(fabs(other.y - mid.y) eps) other.y = 2.0; else double k

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1