Question about convhull code

1 visualizzazione (ultimi 30 giorni)
Ingo Rück
Ingo Rück il 19 Lug 2017
Modificato: Jan il 19 Lug 2017
Hello everyone,
I'm using the function convhull to create a better looking hill chart. For that purpose I need to know how Matlab determines at which point the hull-curve should start. The documentation of convhull doesnt tell me anything and I'm too unexperienced to dig into the code of the function itself (that and I dont know when something is considered "reverse engineering", which might be illegal anyway).
  2 Commenti
Image Analyst
Image Analyst il 19 Lug 2017
Please include some screen shots. You can edit any program and see what it does, at least to some extent, for example
>> edit convhull.m
Perhaps you'd be interested in the boundary() or envelope() function instead - not sure until we see your data.
Jan
Jan il 19 Lug 2017
Modificato: Jan il 19 Lug 2017
@Ingo: You have mentioned in your other thread, that you need the hull start with the smallest X and Y position. By the way: Whenever you post multiple thread about one problem, add a link to the thread in the other forum also. Otherwise such "cross-posting" can waste the time of the ones, who write an already given answer. Thanks.

Accedi per commentare.

Risposta accettata

Jan
Jan il 19 Lug 2017
Modificato: Jan il 19 Lug 2017
Reading the M- and C-files is considered to be legal.
You can resort the output easily to be sure that it has the wanted order:
K = convhull(X,Y);
C = [X(K), Y(K)];
[~, Index] = sortrows(C); % Only the first entry matters
if Index(1) ~= 1 % Reordering required
K = circshift(K, -Index(1) + 1);
end
Now the first index in K is the position with the smallest X and Y values.
In the current Matlab version, K is ordered as you want it. But you cannot be sure if this is the general case, such that the above check is safer.

Più risposte (0)

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by