computational-geometry

polygon union without holes

有些话、适合烂在心里 提交于 2019-11-28 04:44:19
Im looking for some fairly easy (I know polygon union is NOT an easy operation but maybe someone could point me in the right direction with a relativly easy one) algorithm on merging two intersecting polygons. Polygons could be concave without holes and also output polygon should not have holes in it. Polygons are represented in counter-clockwise manner. What I mean is presented on a picture. As you can see even if there is a hole in union of polygons I dont need it in the output. Input polygons are for sure without holes. I think without holes it should be easier to do but still I dont have

How do you generate the non-convex hull from a series of points?

偶尔善良 提交于 2019-11-28 04:28:27
问题 I am currently trying to construct the area covered by a device over an operating period. The first step in this process appears to be constructing a polygon of the covered area. Since the pattern is not a standard shape, convex hulls overstate the covered area by jumping to the largest coverage area possible. I have found a paper that appears to cover the concept of non-convex hull generation, but no discussions on how to implement this within a high level language. http://www.geosensor.net

The Maximum Volume of Trapped Rain Water in 3D

柔情痞子 提交于 2019-11-28 04:00:06
A classic algorithm question in 2D version is typically described as Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining. For example, Given the input [0,1,0,2,1,0,1,3,2,1,2,1] the return value would be 6 The algorithm that I used to solve the above 2D problem is int trapWaterVolume2D(vector<int> A) { int n = A.size(); vector<int> leftmost(n, 0), rightmost(n, 0); //left exclusive scan, O(n), the highest bar to the left each point int leftMaxSoFar = 0; for (int i = 0; i < n; i++){ leftmost[i] =

Algorithm to generate random 2D polygon

僤鯓⒐⒋嵵緔 提交于 2019-11-28 03:57:20
I'm not sure how to approach this problem. I'm not sure how complex a task it is. My aim is to have an algorithm that generates any polygon. My only requirement is that the polygon is not complex (i.e. sides do not intersect). I'm using Matlab for doing the maths but anything abstract is welcome. Any aid/direction? EDIT: I was thinking more of code that could generate any polygon even things like this: There's a neat way to do what you want by taking advantage of the MATLAB classes DelaunayTri and TriRep and the various methods they employ for handling triangular meshes. The code below follows

Get the Surface Area of a Polyhedron (3D object)

拥有回忆 提交于 2019-11-28 03:17:20
问题 I have a 3D surface, (think about the xy plane). The plane can be slanted. (think about a slope road). Given a list of 3D coordinates that define the surface( Point3D1X , Point3D1Y , Point3D1Z , Point3D12X , Point3D2Y , Point3D2Z , Point3D3X , Point3D3Y , Point3D3Z , and so on), how to calculate the area of the surface? Note that my question here is analogous to finding area in 2D plane. In 2D plane we have a list of points that defines a polygon, and using this list of points we can find the

How can I create an internal spiral for a polygon?

核能气质少年 提交于 2019-11-28 01:27:17
For any shape how can I create a spiral inside it of a similar shape. This would be a similar idea to bounding (using Minkowski sum). Rather than creating the same shape inside the shape though it would be a spiral of same shape. I found this - http://www.cis.upenn.edu/~cis110/13su/lectures/Spiral.java It creates a spiral based on the parameters passed so it can be for any regular shape. I want the above for all shapes i.e. irregular polygons too. I am not hugely familiar with geometric terminology but I have looked up Involutes and an Internal Spiral Search Algorithm too but haven't been

Calculate endpoint given distance, bearing, starting point

本小妞迷上赌 提交于 2019-11-28 00:59:48
I am trying to find the destination point, given a starting point lat/long, bearing & distance. The calculator from this website below gives me the desired results. http://www.movable-type.co.uk/scripts/latlong.html When I try to implement the same through code, I don't get the right results. Below is my code - private GLatLng pointRadialDistance(double lat1, double lon1, double radianBearing, double radialDistance) { double rEarth = 6371.01; lat1 = DegreeToRadian(lat1); lon1 = DegreeToRadian(lon1); radianBearing = DegreeToRadian(radianBearing); radialDistance = radialDistance / rEarth; double

Calculate bounding polygon of alpha shape from the Delaunay triangulation

自古美人都是妖i 提交于 2019-11-27 21:32:59
Given a set of points in the plane, a notion of alpha-shape, for a given positive number alpha, is defined by finding the Delaunay triangulation and deleting any triangles for which at least one edge exceeds alpha in length. Here's an example using d3: http://bl.ocks.org/gka/1552725 The problem is that, when there are thousands of points, simply drawing all the interior triangles is too slow for an interactive visualization, so I'd like to just find the bounding polygons. This isn't so simple, because as you can see from that example sometimes there might be two such polygons. As a

Mesh to mesh intersections

白昼怎懂夜的黑 提交于 2019-11-27 21:00:36
问题 I'm looking for a library or a paper that describes how to determine if one triangular mesh intersects another. Interestingly I am coming up empty. If there is some way to do it in CGAL, it is eluding me. It seems like it clearly should be possible, because triangle intersection is possible and because each mesh contains a finite number of triangles. But I assume there must be a better way to do it than the obvious O(n*m) approach where one mesh has n triangles and the other has m triangles.

Camera pose estimation (OpenCV PnP)

只愿长相守 提交于 2019-11-27 19:54:07
I am trying to get a global pose estimate from an image of four fiducials with known global positions using my webcam. I have checked many stackexchange questions and a few papers and I cannot seem to get a a correct solution. The position numbers I do get out are repeatable but in no way linearly proportional to camera movement. FYI I am using C++ OpenCV 2.1. At this link is pictured my coordinate systems and the test data used below. % Input to solvePnP(): imagePoints = [ 481, 831; % [x, y] format 520, 504; 1114, 828; 1106, 507] objectPoints = [0.11, 1.15, 0; % [x, y, z] format 0.11, 1.37, 0