Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X
Hello,
I'm currently working on extracting the envelope from a cloud of points which is part of my diploma-thesis.This cloud of points has been created through the simulation of motion of a gear-flank. For extracting the envelope I thought out the following approach:
1) Create a mesh of points that will be projected onto the surface of the cloud. For now this mesh is a plain of rectangular shape. Later I will probably use a numerical approach for bending this plain, but the indices and everything except the commands for creating this mesh will remain the same.
2) For every point of the mesh the distance to every point of the simulation needs to be calculated.
3) Find the points with the minimal distance between the mesh and the cloud.
These points of the cloud have to be on the surface of my cloud and have to be part of the envelope.
So far so good. I got the simulation, the mesh and I know how to calculate the distances. For one point out of the mesh it is quite easy to find the closest point out of the cloud with a triple-for-loop. But I fail at writing this for all points of the mesh. Since the mesh itself has two dimensions I end up with a quintuple for-loop. But the way I set it up, I always get the coordinates of the very last combination checked instead of the points with the minimal distance...
I cannot upload the original file and the data is far to complex for writing it out in this text-editor. So I created a sample file with data in the exact structure (this is only a sample. This data is compiled through about 40 pages of code...) as the original data is. I also put in the for-loops I thought would work. But apparently they do not work completely.
Could someone please take a look at this and tell me how I can get this to work?
Thanks in advance,
Jonathan
Here you are. I think the attched file does what you are asking for. I wonder why you have chosen such a complicated data structure for your data points Config - basically thats a 5-dimensional array. I am sure things could be speeded up by chosing another structure but maybe that structure is necessary because of the way that points are derived from.
The main problem with your programs is, that you think that in a structure like
for k 0..2
m <-- min (a_k)
return m
you will get back the minimum of all a_k. Thats not true. The loop cycles outside of the min-function, not inside. In fact the min is obselete here as you put only a single value in that function which of course is returned.
In the example above m is assigned a_0, then a_1 and finally a_2 and so it is always a_2 which is returned.
See the attached file for a (surely not optimized) solution to your problem.
WE
What you are looking for is something called a "convex hull". There are standard algorithms for this. See, for example