computational-geometry

Find medial axis of a polygon using C#

半世苍凉 提交于 2019-12-04 22:58:19
问题 I've been tasked to figure out how to find the centerline of a polygon. My google searches led me to believe that what I need is called the 'Medial Axis'. Like this: (source: kiev.ua) According to what I've read, what I need can be produced by using a 2D Voronoi diagram construction algorithm for segments. I've found a C# version of the Voronoi algorithm on codeplex (FortuneVoronoi) and after applying my polygon to it, I end up with this: alt text http://www.carbonatlas.com/geonotes/gaia

Finding All Intervals That Overlap a Point

空扰寡人 提交于 2019-12-04 22:07:57
Consider a large set of floating-point intervals in 1-dimension, e.g. [1.0, 2.5], 1.0 |---------------|2.5 [1.5, 3.6], 1.5|---------------------|3.6 ..... It is desired to find all intervals that contain a given point. For example given point = 1.2, algorithm should return the first interval, and if given point = 2.0, it should return the first two interval in the above example. In the problem I am dealing, this operation needs to be repeated for a large number of times for a large number of intervals. Therefore a brute-force search is not desired and performance is an important factor. After

centerline of a polygonal blob (binary image)

别等时光非礼了梦想. 提交于 2019-12-04 21:00:32
问题 I have a binary image of a worm (blob extraction which works well). I am interested in fitting a centerline on the blowb (worm). So far I came up with this: starting from a polygon (after outline extraction of blob in the image) I applied a voronoi computation and discarded all vertices which are outside of the polygon (blue) which gave me the black center line which I can further use to fit a smooth centerline. However, this computation is not at all robust (due removing voronoi vertices not

Greiner-Hormann clipping with degeneracies

社会主义新天地 提交于 2019-12-04 21:00:19
I'm trying to understand the paper "Clipping of Arbitrary Polygons with Degeneracies" by E. L Foster and J. R. Overfelt [1], which claims to extend the classic Greiner-Hormann polygon clipping algorithm by handling of degeneracies. However, I ran into some difficulties with the procedure they describe. Consider the situation depicted on Figure 6(c) and suppose the polygons are oriented in the same way. Start the labeling phase from the I5 (as opposed from I1, as they do): for both subject polygon S and clipping polygon C, I5 has previous and next labels (on, on). Therefore, according to Table

Multi-dimensional segment trees

…衆ロ難τιáo~ 提交于 2019-12-04 20:18:17
The problem I have to solve is the 4D version of the 1D problem of stabbing queries : find which intervals a number belongs to. I am looking for a multi-dimensional implementation of segment trees . Ideally, it will be in Java and it will use fractional cascading . Multi-dimensional implementations exist for kd-trees (k-NN searches) and range trees (given a bounding box, find all points in it) but for segment trees I've only found 1D implementations. I'd be happy to consider other data structures with similar space/time complexity to address the same problem. To expand on my comment, the

Finding all empty triangles

久未见 提交于 2019-12-04 18:54:07
问题 I have a small set of N points in the plane, N < 50 . I want to enumerate all triples of points from the set that form a triangle containing no other point. Even though the obvious brute force solution could be viable for my tiny N , it has complexity O(N^4) . Do you know a way to decrease the time complexity, say to O(N³) or O(N²) that would keep the code simple ? No library allowed. Much to my surprise, the number of such triangles is pretty large. Take any point as a center and sort the

Compute the size of Voronoi regions from Delaunay triangulation?

一世执手 提交于 2019-12-04 14:42:31
I would like to compute the mean and standard deviation of the areas of a set of Voronoi regions in 2D (if the region extends to infinity, I'll just clip it to the unit square). However if possible I would like to do this computation from the Delaunay Triangulation without explicitly computing the Voronoi regions? Is this even possible, or is it better to just compute the Voronoi diagram explicitly? In order to calculate the voronoi region of a vertex you need to iterate the 1-ring around it. Then the area of the region is defined as: A = 1/8 * (sum for every adjacent vertex p_i) { (cot alpha

Pratition rectangle into smaller ones containig exactly 1 point, maximize wastelands area

荒凉一梦 提交于 2019-12-04 14:31:25
问题 Given a rectangle R containing P points, orthogonal with axes, points are natural numbers. Parcel is a rectangle which: is totally inside R sides are orthgonal with axes contains exactly ONE point inside its sides must be adjacent to sides of R or contain point(s) from P Find an algorithm to find all possible parcels inside R, so their total area is minimal (maximize wastelands area). Example: One of many ways of division, 5 points(*), 2 parcels R |--------------------------------------------

How to find matching time intervals for more than 2 users

我的未来我决定 提交于 2019-12-04 13:14:17
问题 Find best suitable time from given time interval of different users. Rows: 5 fid userid FromDateTime ToDateTime flag 62 1 2012-07-18 01:48:20 2012-07-18 02:55:20 1 63 1 2012-07-18 10:30:46 2012-07-18 12:54:46 1 64 1 2012-07-18 18:50:24 2012-07-18 20:35:24 1 67 1 2012-07-18 15:03:36 2012-07-18 16:03:36 1 68 2 2012-07-18 21:10:47 2012-07-18 23:10:47 1 Above table show different free timesperiods available for different user, for examaple: user1 is free in 2012-07-18 01:48:20 to 2012-07-18 02:55

Point within circle

五迷三道 提交于 2019-12-04 12:59:50
Given the center point and radius of a circle, how do I know if a certain point (x,y) is in the circle? Anyone knows it? Thanks. Originally you asked for Objective-C. CGFloat DistanceBetweenTwoPoints(CGPoint point1,CGPoint point2) { CGFloat dx = point2.x - point1.x; CGFloat dy = point2.y - point1.y; return sqrt(dx*dx + dy*dy ); }; -(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { CGPoint point = [[touches anyObject] locationInView:self]; CGFloat distance = DistanceBetweenTwoPoints(self.circleCenter, point); if(distance < self.radius){ //inside the circle } } This code assumes,