vendredi 6 mars 2015

How to define free area in MATLAB

The workspace is given as:



limits=[-1 4; -1 4; -1 4];


And in this workspace, there is a spherical obstacle which is defined as:



obstacle.origin_x=1.6;
obstacle.origin_y=0.8;
obstacle.origin_z=0.2;
obstacle.radius_obs=0.2;
save('obstacle.mat', 'obstacle');


I would like to create random point in the area of lim. I created random points using the code below:



function a=rndmpnt(lim, numofpoints)
x=lim(1,1)+(lim(1,2)-lim(1,1))*rand(1,numofpoint);
y=lim(2,1)+(lim(2,2)-lim(2,1))*rand(1,numofpoint);
z=lim(3,1)+(lim(3,2)-lim(3,1))*rand(1,numofpoint);

a=[x y z];


Now I would like to eliminate the points in the area of limits-obstacle. how can I do that?





Aucun commentaire:

Enregistrer un commentaire