计算几何
文章平均质量分 80
CCloth
这个作者很懒,什么都没留下…
展开
-
[解方程]Map 2022杭电多校第6场 1009
每组数据给出八个点,分别是一个大矩形四顶点和一个小矩形四顶点,保证小矩形一定在大矩形内部,求出点P满足P点在小矩形中的相对位置和大矩形中的相对位置相同。根据x坐标和y坐标方程解出该lambda和mu就可以求出P点坐标了,不过这题要注意精度,前期运算可以用整数进行,到了不得已的时候再转成浮点运算。...原创 2022-08-05 15:10:36 · 224 阅读 · 0 评论 -
[球体积交]Girlfriend 2021牛客多校第2场 F
ZYT and ZFeT are great PUAs and both have two girlfriends,but they never think that their girlfriends could be so great at magic.One day, when ZYT and ZFeT were busy training PU skills,they suddenly found themselves spelled by their girlfriends.And their g原创 2022-07-12 22:04:17 · 169 阅读 · 0 评论 -
[计算几何][找规律]迎风一刀斩 PTA L3-006
迎着一面矩形的大旗一刀斩下,如果你的刀够快的话,这笔直一刀可以切出两块多边形的残片。反过来说,如果有人拿着两块残片来吹牛,说这是自己迎风一刀斩落的,你能检查一下这是不是真的吗?注意摆在你面前的两个多边形可不一定是端端正正摆好的,它们可能被平移、被旋转(逆时针90度、180度、或270度),或者被(镜像)翻面。这里假设原始大旗的四边都与坐标轴是平行的。输入格式:输入第一行给出一个正整数N(≤20),随后给出N对多边形。每个多边形按下列格式给出:kx1y1⋯xkyk其中k(2&l原创 2022-03-26 09:16:12 · 773 阅读 · 4 评论 -
[单位圆最大覆盖]Circle and Points POJ1981
You are given N points in the xy-plane. You have a circle of radius one and move it on the xy-plane, so as to enclose as many of the points as possible. Find how many points can be simultaneously enclosed at the maximum. A point is considered enclosed by a原创 2022-02-13 16:18:51 · 592 阅读 · 0 评论 -
最小圆覆盖算法总结
一、定义什么是最小圆覆盖?其实和最小矩形覆盖定义是类似的,给出一个点集,求能覆盖住所有点的最小圆。二、两种算法求最小圆覆盖有两种算法,分别是增量法和模拟退火,个人推荐增量法,它的精度更高一些,且时间复杂度是稳定的线性级(点的顺序打乱后),所以下面也主要介绍增量法的原理。增量法前置知识1. 圆上三点确定唯一的一个圆。这个道理很简单,考虑三角形外接圆就行。2. 若已有某个点集的最小圆覆盖,向该点集中再加入一个圆外的点,这时最小圆会被更新,这个点一定出现在新的最小圆的边界上。反原创 2022-02-12 21:45:32 · 7117 阅读 · 1 评论 -
[半平面交]小凸想跑步 LibreOJ2008
题目描述小凸晚上喜欢到操场跑步,今天他跑完两圈之后,他玩起了这样一个游戏。操场是个凸 n 边形,n 个顶点按照逆时针从 0∼n−1 编号。现在小凸随机站在操场中的某个位置,标记为 P 点。将 P 点与 n 个顶点各连一条边,形成 n 个三角形。如果这时 P 点,0 号点,1 号点形成的三角形的面积是 n 个三角形中最小的一个,小凸则认为这是一次正确站位。现在小凸想知道他一次站位正确的概率是多少。输入格式第一行包含1个整数n,表示操场的顶点数和游戏的次数。接下来有n行,每行包含...原创 2022-02-09 14:11:56 · 2078 阅读 · 0 评论 -
与圆有关算法总结
一、两圆位置关系两圆间位置关系有五种,相离,外切,相交,内切,内含,利用圆心距d和半径差以及半径和的大小关系来判定。二、三角形内切圆三角形内切圆的圆心是三条角平分线的交点,因此可以转化为求直线交点问题,任取两角平分线交点即为圆心,得到圆心后利用叉乘求出圆心到边的距离就是半径。在引入向量这个概念后求角平分线也十分简单,先求两条边的向量,然后全部单位化,最后作向量加和就是角平分线的向量。三、三角形外接圆三角形外接圆的圆心是三条垂直平分线的交点,同样转为求两直线交点问题,因此要先求出至少两原创 2022-02-08 16:42:26 · 2035 阅读 · 0 评论 -
[分治]平面最近点对(加强版) 洛谷P1429
题目描述给定平面上 n 个点,找出其中的一对点的距离,使得在这 n 个点的所有点对中,该距离为所有点对中最小的输入格式第一行:n ,保证 2≤n≤200000 。接下来 n 行:每行两个实数:x y ,表示一个点的行坐标和列坐标,中间用一个空格隔开。输出格式仅一行,一个实数,表示最短距离,精确到小数点后面 4 位。输入输出样例输入 #131 11 22 2输出 #11.0000说明/提示数据保证 0≤x,y≤109题意: 显而易见,这道题需要原创 2022-02-03 23:08:21 · 2261 阅读 · 0 评论 -
[多边形切割]Pieces and Discs UVA12296
There is a rectangle on the Cartesian plane, whose bottom-left corner is (0,0), top-right corner is (L,W). You draw some line segments to divide the rectangle into pieces. Each line segment connects two points on the boundary of the original rectangle (the原创 2022-02-03 13:29:25 · 216 阅读 · 0 评论 -
[好题][旋转卡壳]最小矩形覆盖 AcWing2142
已知平面上不共线的一组点的坐标,求覆盖这组点的面积最小的矩形。输出矩形的面积和四个顶点的坐标。输入格式第一行包含一个整数n,表示点的数量。接下来n行,每行包含两个用空格隔开的浮点数,表示一个点的x坐标和y坐标。不用科学计数法,但如果小数部分为0,则可以写成整数。输出格式共5行,第1行输出一个浮点数,表示所求得的覆盖输入点集的最小矩形的面积。接下来4行,每行包含两个用空格隔开的浮点数,表示所求矩形的一个顶点的x坐标和y坐标。先输出y坐...原创 2022-02-01 17:30:27 · 916 阅读 · 0 评论 -
[旋转卡壳]最大土地面积 AcWing2617
在某块平面土地上有 N 个点,你可以选择其中的任意四个点,将这片土地围起来,当然,你希望这四个点围成的多边形面积最大。输入格式第 1 行一个正整数 N。接下来 N 行,每行 2 个数 x,y,表示该点的横坐标和纵坐标。输出格式最大的多边形面积,答案精确到小数点后 3 位。数据范围4≤N≤2000,|x|,|y|≤105输入样例:50 01 01 10 10.5 0.5输出样例:1.000题意:题意比较清晰,就是在点集中找四个点构成一个面积.原创 2022-01-31 12:02:53 · 1343 阅读 · 0 评论 -
Pick定理总结
一、定理内容Pick定理是一个非常简单的结论:s = a + b / 2 - 1,其中s是格点多边形的面积,a是多边形内部格点数,b是多边形边界上格点数。一般情况下都是用这个公式计算多边形内部格点个数,因为多边形面积和边界上格点数都可以很方便地求出。面积通过叉乘求出,边界上格点数通过gcd求出。同时通过这个公式可以知道格点多边形面积要么是个整数,要么是整数+0.5的形式。二、相关习题1. Triangle 51Nod3149这道是pick定理的裸题了,多边形固定为三角形,不过数据有些原创 2022-01-30 15:53:12 · 1027 阅读 · 0 评论 -
[凸包][覆盖所有圆]Convex hull POJ3405
There areMcircles (0 ≤M≤ 100) on a plane. Some circles can have zero radius. The task is to calculate the area of minimum convex domain containing all the circles.InputThe input contains the description of one test including:a line with valueM;...原创 2022-01-29 15:16:47 · 649 阅读 · 0 评论 -
[旋转卡壳]Triangle POJ2079
Given n distinct points on a plane, your task is to find the triangle that have the maximum area, whose vertices are from the given points.InputThe input consists of several test cases. The first line of each test case contains an integer n, indicating原创 2022-01-29 00:03:43 · 427 阅读 · 0 评论 -
旋转卡壳算法总结
一、历史背景1978年, M.I. Shamos's Ph.D. 的论文"Computational Geometry"标志着计算机科学的这一领域的诞生。 当时他发表成果的是一个寻找凸多边形直径的一个非常简单的算法, 即根据多边形的一对点距离的最大值来确定。后来直径演化为由一对对踵点对来确定。 Shamos提出了一个简单的O(n)时间的算法来确定一个凸n角形的对踵点对。 因为他们最多只有 3n/2 对, 直径可以在O(n)时间内算出。如...原创 2022-01-28 21:32:46 · 2704 阅读 · 1 评论 -
凸包算法总结
一、定义:凸包是一个相对于点集的概念,对于一个已经确定的点集,凸包就是由其中某些点构成的一个子集,这个子集中的点构成一个凸多边形,该多边形完全包围点集中所有点。关于凸包有一个形象的比喻:把点集中各点看作钉子,拿一个橡皮筋套住所有的钉子,最终橡皮筋就是一个凸包,使橡皮筋绷紧的钉子就是凸包中的顶点。二、求法:目前比较常见的两种求法分别为Graham扫描法和Andrew算法,由于两个算法都需要对点进行排序,因此它们的时间复杂度均为O(nlogn)...原创 2022-01-24 15:34:50 · 5745 阅读 · 1 评论 -
闵可夫斯基和总结
定义:给定两个点集A,B,定义点集C为{ c| c = a+b,a∈A,b∈B},两点间的加法为x坐标对应相加,y坐标对应相加,点集C即为A,B的闵可夫斯基和。性质:1. 凸集A和凸集B的闵可夫斯基和一定还是凸集。 可以利用凸集定义来证明,在凸集中任取两点其连线上的点一定全部出现在凸集内。 2. 两个凸包的闵可夫斯基和的凸包是对原来两个凸包的各边重排序。 如下图所示,考虑第一个凸包上的点4和第二个凸包上的...原创 2021-11-10 19:45:43 · 5046 阅读 · 0 评论 -
[直线关系][思维]Mr. Main and Windmills 第45届icpc区域赛昆明站I
Mr. Main took a train from city sss to city ttt and passed a plain full of windmills. The train ran in a straight line. A windmill is a machine used for wind power generation. Its fan blades rotate when the wind blows. From his perspective, colorful windmi原创 2021-11-06 21:18:49 · 473 阅读 · 0 评论 -
[dfs][凸包]The Fortified Forest POJ1873
Once upon a time, in a faraway land, there lived a king. This king owned a small collection of rare and valuable trees, which had been gathered by his ancestors on their travels. To protect his trees from thieves, the king ordered that a high fence be buil原创 2021-11-05 20:32:57 · 163 阅读 · 0 评论 -
[好题][半平面交][线性规划]Triathlon POJ1755
Triathlon is an athletic contest consisting of three consecutive sections that should be completed as fast as possible as a whole. The first section is swimming, the second section is riding bicycle and the third one is running.The speed of each contestan原创 2021-11-05 17:30:36 · 167 阅读 · 0 评论 -
半平面交模板总结
概念:什么是半平面?半平面实际上就是一条有方向的直线,不过它还包括这条直线一侧(具体哪侧自行设置)的全部区域。那半平面交的概念也呼之欲出了,就是这些半平面覆盖区域的交集。作用: 1. 求多边形的核。(能看到所有点的位置) 2. 求凸多边形最大内切圆。(二分) 3. 解决线性规划问题。(矩形切割面积)注意事项: 1.该模板中半平面的直线方向逆时针区域为半平面覆盖区域。 2. 半平面交的区域一定是个凸多边形...原创 2021-11-04 20:43:05 · 292 阅读 · 0 评论 -
[几何概型][矩形切割]Joining with Friend UVA11722
You are going from Dhaka to Chittagong by train and you came to know one of your old friends is going from city Chittagong to Sylhet. You also know that both the trains will have a stoppage at junction Akhaura at almost same time. You wanted to see your fr原创 2021-11-03 17:04:04 · 169 阅读 · 0 评论 -
[好题][半平面交][dfs]Nice Milk POJ1271
Little Tomy likes to cover his bread with some milk. He does this by putting it in the cup so that one of its sides (called bottom side) touches the bottom of the cup, just as the picture below:Since the milk in the cup is limited, only part of the br原创 2021-11-03 15:27:12 · 325 阅读 · 0 评论 -
[半平面交][贪心]Feng Shui POJ - 3384
Feng shui is the ancient Chinese practice of placement and arrangement of space to achieve harmony with the environment. George has recently got interested in it, and now wants to apply it to his home and bring harmony to it.There is a practice which say原创 2021-11-01 21:24:38 · 129 阅读 · 0 评论 -
[凸多边形最大内切圆][半平面交]Most Distant Point from the Sea POJ3525
The main land of Japan called Honshu is an island surrounded by the sea. In such an island, it is natural to ask a question: “Where is the most distant point from the sea?” The answer to this question for Honshu was found in 1996. The most distant point is原创 2021-11-01 20:17:55 · 216 阅读 · 0 评论 -
[多边形核][半平面交]Rotating Scoreboard POJ3335
This year, ACM/ICPC World finals will be held in a hall in form of a simple polygon. The coaches and spectators are seated along the edges of the polygon. We want to place a rotating scoreboard somewhere in the hall such that a spectator sitting anywhere o原创 2021-11-01 14:33:41 · 143 阅读 · 0 评论 -
[稳定凸包]Grandpa‘s Estate POJ1228
Being the only living descendant of his grandfather, Kamran the Believer inherited all of the grandpa's belongings. The most valuable one was a piece of convex polygon shaped farm in the grandpa's birth village. The farm was originally separated from the n原创 2021-10-27 21:43:32 · 156 阅读 · 0 评论 -
[凸包][思维]Wall POJ1113
Once upon a time there was a greedy King who ordered his chief Architect to build a wall around the King's castle. The King was so greedy, that he would not listen to his Architect's proposals to build a beautiful brick wall with a perfect shape and nice t原创 2021-10-27 20:15:36 · 319 阅读 · 0 评论 -
[凸包][多边形与圆关系]A Round Peg in a Ground Hole POJ1584
The DIY Furniture company specializes in assemble-it-yourself furniture kits. Typically, the pieces of wood are attached to one another using a wooden peg that fits into pre-cut holes in each piece to be attached. The pegs have a circular cross-section and原创 2021-10-27 19:14:29 · 246 阅读 · 0 评论 -
[思维][线段关系]Pipe POJ1039
The GX Light Pipeline Company started to prepare bent pipes for the new transgalactic light pipeline. During the design phase of the new pipe shape the company ran into the problem of determining how far the light can reach inside each component of the pip原创 2021-10-27 16:38:34 · 245 阅读 · 0 评论 -
[平面几何][思维]Kadj Squares POJ3347
In this problem, you are given a sequenceS1,S2, ...,Snof squares of different sizes. The sides of the squares are integer numbers. We locate the squares on the positivex-yquarter of the plane, such that their sides make 45 degrees withxandyaxes, ...原创 2021-10-27 14:45:55 · 106 阅读 · 0 评论 -
[线段关系]An Easy Problem POJ2826
It's raining outside. Farmer Johnson's bull Ben wants some rain to water his flowers. Ben nails two wooden boards on the wall of his barn. Shown in the pictures below, the two boards on the wall just look like two segments on the plane, as they have the sa原创 2021-10-27 09:20:56 · 154 阅读 · 0 评论 -
[极角排序]Space Ant POJ1696
The most exciting space discovery occurred at the end of the 20th century. In 1999, scientists traced down an ant-like creature in the planet Y1999 and called it M11. It has only one eye on the left side of its head and just three feet all on the right sid原创 2021-10-26 19:43:52 · 91 阅读 · 0 评论 -
[极角排序]Scrambled Polygon POJ2007
A closed polygon is a figure bounded by a finite number of line segments. The intersections of the bounding line segments are called the vertices of the polygon. When one starts at any vertex of a closed polygon and traverses each bounding line segment exa原创 2021-10-26 16:55:52 · 160 阅读 · 0 评论 -
[矩形判交]Intersection POJ1410
You are to write a program that has to decide whether a given line segment intersects a given rectangle.An example:line: start point: (4,9)end point: (11,2)rectangle: left-top: (1,5)right-bottom: (7,1)Figure 1: Line segment does not intersect rec.原创 2021-10-26 12:18:28 · 157 阅读 · 0 评论 -
[线段判交]Treasure Hunt POJ1066
Archeologists from the Antiquities and Curios Museum (ACM) have flown to Egypt to examine the great pyramid of Key-Ops. Using state-of-the-art technology they are able to determine that the lower floor of the pyramid is constructed from a series of straigh原创 2021-10-26 11:29:32 · 97 阅读 · 0 评论 -
[暴力][线段判交]Pick-up sticks POJ2653
Stan has n sticks of various length. He throws them one at a time on the floor in a random way. After finishing throwing, Stan tries to find the top sticks, that is these sticks such that there is no stick on top of them. Stan has noticed that the last thr原创 2021-10-26 10:49:46 · 118 阅读 · 0 评论 -
[线段判交][最短路]The Doors POJ1556
You are to find the length of the shortest path through a chamber containing obstructing walls. The chamber will always have sides at x = 0, x = 10, y = 0, and y = 10. The initial and final points of the path are always (0, 5) and (10, 5). There will also原创 2021-10-25 22:49:56 · 130 阅读 · 0 评论 -
[两线关系]Intersecting Lines POJ1269
We all know that a pair of distinct points on a plane defines a line and that a pair of lines on a plane will intersect in one of three ways: 1) no intersection because they are parallel, 2) intersect in a line because they are on top of one another (i.e.原创 2021-10-25 21:09:17 · 138 阅读 · 0 评论 -
[好题][枚举][叉积]Segments POJ3304
Givennsegments in the two dimensional space, write a program, which determines if there exists a line such that after projecting these segments on it, all projected segments have at least one point in common.InputInput begins with a numberTshowing ...原创 2021-10-25 20:46:32 · 102 阅读 · 0 评论