链接 套模板 不知道有没有x,y=0情况,不过这种情况都按+号输出的. #include <iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<stdlib.h> #include<vector> #include<cmath> #include<queue> #include<set> using na…
题目链接:http://poj.org/problem?id=1329 #include<cstdio> #include<cmath> #include<algorithm> #include<iostream> #include<cstring> using namespace std; typedef long long ll; ; int sgn(double x) { ; ? - : ; } struct Point{ double x…
链接 求出三角形的外接圆,通过圆心和半径可以知道这个圆的上下左右最远点,分别判断这个四个点跟弧的两端点A,B的关系,假如判断P点,弧内给出点为C,判断PC是否与AB相交即可判断出P是否在弧上. 精度问题 ceil-eps floor+eps #include <iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<stdlib.h> #include&l…
/* 几何 求给定三角形的外接圆圆心 方法:求解二元方程组 */ #include<stdio.h> #include<string.h> #include<math.h> #include<stdlib.h> const double pi = acos(-1.0); ; struct Point{ double x,y; }; struct Circle{ Point center; double r; }; Point a,b,c,tp; Circle…
三角形两边的垂直平分线就能确定外接圆. 结果如下: matlab代码如下: clear all;close all;clc; p=rand(,); %(x,y) cen1=(p(,:)+p(,:))/; %三角形一条边中点 cen2=(p(,:)+p(,:))/; %另一条边中点 k1=-/((p(,)-p(,))/(p(,)-p(,))); %一条边垂直平分线 b1=cen1()-k1*cen1(); k2=-/((p(,)-p(,))/(p(,)-p(,))); %另一条边垂直平分线 b2=…
题目链接 抄的外心模版.然后,输出认真一点.1Y. #include <cstdio> #include <cstring> #include <string> #include <cmath> #include <algorithm> using namespace std; #define eps 1e-8 struct point { double x,y; }; struct line { point a,b; }; point inte…
目录 1 问题描述 2 解决方案   1 问题描述 问题描述 为二维空间中的点设计一个结构体,在此基础上为三角形设计一个结构体.分别设计独立的函数计算三角形的周长.面积.中心和重心.输入三个点,输出这三个点构成的三角形的周长.面积.外心和重心.结果保留小数点后2位数字. 样例输出 与上面的样例输入对应的输出.例: 数据规模和约定 输入数据中每一个数的范围. 例:doule型表示数据. 2 解决方案 本题主要考查三角形相关数学知识,刚开始做的时候,我对重心和外心的计算公式一点都记不起来,无语中..…
转自:http://blog.csdn.net/tyger/article/details/4480029 计算几何题的特点与做题要领:1.大部分不会很难,少部分题目思路很巧妙2.做计算几何题目,模板很重要,模板必须高度可靠.3.要注意代码的组织,因为计算几何的题目很容易上两百行代码,里面大部分是模板.如果代码一片混乱,那么会严重影响做题正确率.4.注意精度控制.5.能用整数的地方尽量用整数,要想到扩大数据的方法(扩大一倍,或扩大sqrt2).因为整数不用考虑浮点误差,而且运算比浮点快. 一.点…
//第一期 计算几何题的特点与做题要领: 1.大部分不会很难,少部分题目思路很巧妙 2.做计算几何题目,模板很重要,模板必须高度可靠. 3.要注意代码的组织,因为计算几何的题目很容易上两百行代码,里面大部分是模板.如果代码一片混乱,那么会严重影响做题正确率. 4.注意精度控制. 5.能用整数的地方尽量用整数,要想到扩大数据的方法(扩大一倍,或扩大sqrt2).因为整数不用考虑浮点误差,而且运算比浮点快. 一.点,线,面,形基本关系,点积叉积的理解 POJ 2318 TOYS(推荐) http:/…
计算几何: 堆几何模版就能够了. . .. Description Problem E 2D Geometry 110 in 1! This is a collection of 110 (in binary) 2D geometry problems. CircumscribedCircle x1 y1 x2 y2 x3 y3 Find out the circumscribed circle of triangle (x1,y1)-(x2,y2)-(x3,y3). These three p…