Equally spaced structured Point Cloud Cuboid generation

Versione 1.0.0.0 (1,32 KB) da Jveer
Simple function to generate equally spaced point cloud forming a cuboid
1,1K download
Aggiornato 4 apr 2009

Visualizza la licenza

Inputs are vectors giving the x, y and z range. e.g x=1:100;y=40:70;z=80:250;

Apologies for lack of description but this submission is for a specific request. It is an extract from a much larger program.

% - B.I SOLID POINT CLOUD CUBOID
function [P]=Cuboid(x,y,z)
% - Generates coordinates for a solid cuboid composed of points

a=length(x);b=length(y);c=length(z); % assigning for coding simplicity
% B.I.1. Finding all x coordinates
xp=zeros(1,a*b*c); % preallocating
for nx=1:a
if nx==1,xp(1:c*b)=(repmat(x(nx),1,c*b));
else xp(((nx-1)*c*b)+1:nx*c*b)=repmat(x(nx),1,c*b);end
end
% B.I.2. Finding all y coordinates
yp=zeros(1,b*c); % preallocating
for ny=1:b
if ny==1,yp(1:c)=repmat(y(ny),1,c);
else yp(((ny-1)*c)+1:ny*c)=repmat(y(ny),1,c);
end
end
yp=repmat(yp,1,a);
% B.I.3. Finding all z coordinates
zp=repmat(z,1,b*a);
% B.I.4. Coordinates of the cuboid generated.
P=[xp;yp;zp];
end % To Optimize

Cita come

Jveer (2024). Equally spaced structured Point Cloud Cuboid generation (https://www.mathworks.com/matlabcentral/fileexchange/23551-equally-spaced-structured-point-cloud-cuboid-generation), MATLAB Central File Exchange. Recuperato .

Compatibilità della release di MATLAB
Creato con R2007a
Compatibile con qualsiasi release
Compatibilità della piattaforma
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!
Versione Pubblicato Note della release
1.0.0.0