Rank: 101525 based on 0 downloads (last 30 days) and 0 file submitted
photo

Tilak Rajesh

E-mail

Personal Profile:
Professional Interests:

 

Watch this Author's files

 

Comments and Ratings by Tilak Rajesh
Updated File Comments Rating
20 Jul 2010 Equally spaced structured Point Cloud Cuboid generation Simple function to generate equally spaced point cloud forming a cuboid Author: Jveer

Here is a faster version compared with the Cuboid()

%%
clear
for i=1:100
tic
[P]=Cuboid([-1:0.1:1],[-2:0.1:2],[-3:0.1:3]);
%plot3(P(1,:),P(2,:),P(3,:),'*')
toc
end
%Approx worst case: Elapsed time is 0.006052 seconds.
%%
clear
for i=1:100
tic
[x,y,z]=meshgrid([-1:0.1:1],[-2:0.1:2],[-3:0.1:3]);
x=reshape(x,[],1);y=reshape(y,[],1);z=reshape(z,[],1);
%plot3(x,y,z,'*')
toc
end
%Approx worst case: Elapsed time is 0.001026 seconds.

Both code produce the same result but using meshgird is much faster. I find it interesting as to how gather lots of points in the cloud, especially when there is OUT OF MEMORY issues.
for example: [x,y,z]=meshgrid([-1:0.001:1],[-1:0.001:1],[-1:0.001:1]); gives OUT OF MEMORY.
I am thinking of taking only X and Y using meshgrid and using this to create slices of the cube in the x-y plane. Any better ways to overcome the OUT OF MEMORY problems ?

Contact us