How do I create some code that will check angles and select the next point to draw a line to based on smallest angle?

Hi,
I need to create the simplest code that will check the angles between a line connecting one central point and another and a line from the same initial central point to a triplet endpoint. I need the code to be able to select the correct central point to draw a line to based on smallest angle (see attached pics). Attached are the two files that contain the coordinates for the central points (f_points) and the endpoints (Triplets): The files are (1) F_points.mat (2) Triplets.mat
allpoints.png
Below is the same image with lines being created:
allpoints-with-lines.png
Below is an image which gives an idea of what is needed:
angles_from_points.png

5 Commenti

Do you additional information about neighbour points? How to find neighbour points?
Here is connections between points which distance is smaller than 400.
Some points should't be connected and some points should be (but they are not)
img1.png
I scaled X coordinate before finding distance (x/2)
The main requirement is that the lines connecting the neighboring central points must make the smallest angle with one of their corresponding endpoints.
How to find neighboring central points?
This is how looks like searching by distance
img11.png
Distance could be used to narrow down to a specific vicinity. Then, the angle that a potential line (between central points) would make with another line (from the the source central point to the corresponding endpoint) could be used to verify a line is correct. Is that what you did?

Accedi per commentare.

Risposte (1)

Here is some start
What about these?
img1.png img2.png img3.png
See attached script

5 Commenti

The angles need to be the smallest, but also they must come in pairs (twin angles within a small discrepancy). For example, in your 2nd picture, the inner triplet should have been the chosen one, based on the fact that the angles match and are also the smallest (see attached picture).
mismatched-angles.png
Attached shows the correct paths (Notice all the lines create the shallowest angles--this is key):
correct_path.png
I see what you are pointing out there but, as mentioned previously, the blue line needs to also have a matching "twin" angle on the other end or it is disqualified (see attched pic).
mismatched-angles2.png
Take a look at my picture in my previous comment...all the angles obey the rules.

Accedi per commentare.

Categorie

Prodotti

Release

R2019a

Richiesto:

il 16 Ott 2019

Commentato:

il 20 Ott 2019

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by