point_set_random_simplify : function to random simplify a point set.
Author and support : nicolas.douillet (at) free.fr, 2019.
% Syntax
V_out = point_set_random_simplify(V_in);
V_out = point_set_random_simplify(V_in, smpf_coeff);
[V_out, idx_vect] = point_set_random_simplify(V_in, smpf_coeff);
% Description
V_out = point_set_random_simplify(V_in) randomly samples V_in point set
at the default rate of 0.5 (50% of the points are kept) and stores it in
V_out.
V_out = point_set_random_simplify(V_in, smpf_coeff) randomly samples
V_in point set at the rate given by smpf_coeff.
[V_out, idx_vect] = point_set_random_simplify(V_in, smpf_coeff) also
provides the index vector of the points kept, such that
V_out = V_in(idx_vect,:).
% See also : RAND,RANDI,COLON
% Input arguments
| | |
- V_in = [Vx Vy Vz] : numeric double matrix, size(V_in) = [nb_vertices_in, 3].
| | |
- smpf_coeff : numeric double scalar, 0 <= smpf_coeff <= 1. Default value
is smpf_coeff = 0.5.
% Output arguments
| | |
- V_out = [Vx Vy Vz] : numeric double matrix, size(V_out) = [numel(idx_vect), 3].
| | |
- idx_vect : numeric vector of integers > 0.
% Example
N = 20000;
X = 2*(rand(N,1)-0.5);
Y = 2*(rand(N,1)-0.5);
Z = 2*(rand(N,1)-0.5);
Rho = X.^2 + Y.^2 + Z.^2;
f = Rho <= 1;
X = X(f);
Y = Y(f);
Z = Z(f);
M = [X, Y, Z];
figure;
subplot(121);
plot3(X,Y,Z,'.','Color',[0 0 1],'Linewidth',2), hold on;
axis equal;
N = point_set_random_simplify(M);
subplot(122);
plot3(N(:,1), N(:,2), N(:,3),'.','Color',[0 0 1],'Linewidth',2), hold on;
axis equal;
Cita come
Nicolas Douillet (2025). Point set random simplify (https://www.mathworks.com/matlabcentral/fileexchange/73661-point-set-random-simplify), MATLAB Central File Exchange. Recuperato .
Compatibilità della release di MATLAB
Compatibilità della piattaforma
Windows macOS LinuxCategorie
Tag
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Scopri Live Editor
Crea script con codice, output e testo formattato in un unico documento eseguibile.