When to avoid surface reconstruction [closed] - algorithm

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
Suppose that you have a number of large point clouds and you want to observe whether they contain any valuable information or meaningful surfaces. To decrease the cost of surface reconstruction, you may ignore some point clouds with specific distribution, for instance, random distribution. How do you pick the point clouds with meaningful point orders and which ones do you avoid to reconstruct?

Two ideas:
Pick several locations and explore covariance matrix there. If the surface is well approximated by a plane in the neighbourhood, one of eigen values of the matrix will very small. The size of the neighbourhood used for analysis depends on smoothness of the surface.
Split the space into voxel grid. Count voxels containing at least one point. Then half size of voxels and count again. After several such measurements you will be able to approximate dependency of voxel number on voxel size. For surface-like distribution it should be number~(1/size)^2, for uniform distribution around volume it will be closer to (1/size)^3.

Related

how to fit polygon inside another polygon [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have two polygons as shown in the image below.
The left one is "rough polygon" and the right one is "final polygon"
Now, I'm looking for algorithm to fit "final polygon" inside "rough polygon" with best maximum scale.
you can rotate as well as translate "final polygon" as much as you want.
you can't perform individual x dimension or y dimension scaling.
you can only perform uniform scaling (where value of Sx and Sy are same).
Here is a possible line of attack for an exact solution by exhaustive trials; just ideas.
My guess is that a solution is achieved when there are three contacts. I mean three vertexes of either polygon touching an edge of the other or conversely. (If there are less than three contacts, you can inflate the internal polygon so that it comes into a third contact.)
Given two arbitrary triangles, it shouldn't be so difficult to find all possible three-contact positions.
So the global scheme is to take all triples of vertexes/sides from one polygon, and take all complementary triples of sides/vertexes of the other. For every combination, momentarily consider that you have triangles and find the possible three-contact positions. For for every candidate position check if the inner polygon stays confined in the outer one. In the end, keep the admissible solution with the largest scale factor.
For polygons with N and M sides, there will be O(N³M³) configurations to try, and the containment test can be as costly as O(NM). So this approach is only viable for very small polygons.
Scale the rightside polygon by 0.01. (geometrical)
Start spinnning it so fast that it draws circle. (geometrical)
Start incrementing the scale 0.01 by 0.01. (geometrical)
Stop when it touches the outer polygon. (geometrical)
Then bounce it to opposite direction until it bounces again. (physical)
Again and again.(iterations)
Until it cannot move/bounce again.(stuck optimally) (physical)
Use simulated annealing in case of false local solutions.(you need global solution)

Computing location based on a list of approximate distances [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I have N points in at 3D space (I think I can grasp myself general N-dimensional case) and approximate distances to these points, how can I compute my position relative to these N points?
EDIT
Please note that the distances are approximate, so the more approximate distances I have the more convenient result I should get
Thank you!
I would write down an equation that gives you some measure of the errors associated with a possible location, and then find the location that minimizes this measure. My first attempt would be to minimize the sum of the squares of the difference between the distance measured and the distance worked out from the possible location, for each of your approximate distance, so you are minimizing something like SUM_i((sqrt((X-Ai)^2 + (Y-Bi)^2 + (Z-Ci)^2) - Di)^2) where X,Y,Z is the location co-ordinates you are trying to find, (Ai,Bi,Ci) is the co-ordinates of one of the objects from which you are measuring distances, and Di is the distance measured. It doesn't look very pretty, but you should at least be able to compute derivatives and then find some sort of minimization routine in a math library.
You have distances from given N points in a 3D space and their approximate error values. So, you have a thick sphere for each of the points that you are in. You get all of them, calculate their intersection area, and take that area's center point as your approximate location.

Randomly generating coordinates inside a bounded region [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I have a list of longitudes and latitudes which forms boundary for a geographical area. I would like to generate some random co-ordinates inside this geographical area . Could you suggest some approaches I can take in any language?
Like any problem, there are many ways to solve it, the first thing came into my mind is
Let's call this "geographic area" a polygon.
Find the bounding box of the polygon (easy, just find maxX maxY minX minY).
Generate random coordinate inside the bounding box x=rand()%(maxX-minX)+minX (and same for Y)
Test that the coordinate is inside the polygon, there are many solutions to this problem and they are implemented in any given language so you don't have to implement it by yourself.
Here is an implementation in C/C++ (it is easy to change it to any other language) : Point in Polygon Algorithm
http://en.wikipedia.org/wiki/Point_in_polygon
Edit :
As Jan Dvorak suggested, it might be problematic to use it technique on huge areas, i believe that if your polygon is close to the equator and his size is less the 100km, it will work just fine.
Also you will run into problems if you are near the 180° line because right next to it is the -180°.
First, We'll model the earth's shape as a sphere. Solving the problem for oblate spheroid is much harder.
Generating a random point on a sphere is relatively easy.
Generating a random point on a spherical triangle is harder, but explained in this linked article.
You'll need to divide your polygon into spherical triangles and weight them according to their area. Then randomly select a spherical triangle based on the weights.
For the general case, triangulating a spherical polygon is not possible, however, for most practical cases triangulation is a simple task. One such algorithm is described here (algorithm 1, page 901) with C++ source code available here (search for "Computational methods for calculating geometric parameters of tectonic plates").
You can try this:
Compute all co-ordinates within this geographical area, see save in vector<Point> points.
Generate a random int number within [0, points.size()), see k.
points[k] is what you want.

Weiszfeld algo for "highway" distance? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
The problem is to find the point minimizing the travel distance for around 100 persons in different regions who want to meet in the same place. Travel is by car not by plane.
Assuming that I get access to an API giving me mileage / kilometric distance in terms of highway travel between any two points, how can I find the best place to meet?
On other Stackexchange sites (gis.stackexchange.com/questions/65563/meeting-point-minimizing-travel-distance-for-participants) I got directed to the Weiszfeld algo to solve this problem of geometric median.
I suspect that kilometric distance complexifies the problem, because it becomes possible to get stuck in local minima. I don't know really where to start. Any pointer would be appreciated.
Even though it may suffer from local minima, I would try local search, since road networks aren't adversarially designed. Pick a random starting point and then iterate as follows. Compute directions from the current point to the 100 clients. Evaluate each of the next-to-last stops in the directions and move the point to the best.
If the distances taken into account are Manhattan distances then the optimal meeting point is one of the points which has a x-coordinate equal to the x-coordinate of some input point, and the y-coordinate equal to the y-coordinate of some input point.

Given a point inside a rectangle, determine the side that's closest to the point [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I was curious if there was an elegant way to do this, aside from just calculating the distance from the point to each side and finding the minimum.
Some things I've thought about:
If it's a square, we can just draw the diagonals and figure out which of the 4 regions the point falls on. Each of these region corresponds to a closest side.
Perhaps we can divide up the rectangle into squares and go somewhere from there?
It seems an alternative solution would be too complicated and not worth looking for.
For rectangle you can use following regions:
I think the rectangle is not orthogonal to the coordinate system. First calculate the middle point of every side. This should be simple depending on how you have define the rectangle.
Then calculate the distance to this middle points. The smallest distance is the nearest side. You need not to calculate the full distance with pytagoras. The sum of the squared is enough.

Resources