root/applications/dual/SIDP/jednoduchy system/make_box3.m @ 1084

Revision 862, 1.0 kB (checked in by zimamiro, 15 years ago)
Line 
1function [box zero range eigvec]=make_box3(points,num_of_points)
2
3%OK
4
5N=size(points,1);
6dim=size(points,2);
7
8meanval=mean(points,1);
9medianval=2*(median(abs(points-ones(N,1)*meanval),1));
10eigvec=eye(3);
11
12%range=1.5*sqrt(diag(eigval)/N);
13%pom=points*eigvec/2;
14%range=min((max(pom)-min(pom))',range);
15%range=(max(points)-min(points))';
16range=medianval';
17
18
19box=zeros(N,dim);
20pointer=-range;
21pointer(3)=(min(points))*[0;0;1];
22step=2*range/(num_of_points-1);
23jump=[1 num_of_points num_of_points^2];
24for i=1:N
25    for k=1:dim
26        box(i,k)=pointer(k)+step(k)*mod(floor((i-1)/jump(k)),num_of_points);
27    end
28end 
29
30box=box+ones(N,1)*(meanval.*[1 1 0]);
31range=ones(3,1)./(2*range);
32zero=box(1,:);
33
34plot3(points(:,1),points(:,2),points(:,3),'r.');
35hold on;
36plot3(box(:,1),box(:,2),box(:,3),'g.');
37hold off;
38
39%plot3(box(1,1),box(1,2),box(1,3),'r+');
40%plot3(box(2,1),box(2,2),box(2,3),'b+');
41%plot3(box(3,1),box(3,2),box(3,3),'b+');
42
43%plot3(box(64,1),box(64,2),box(64,3),'g+');
44%plot3(box(4,1),box(4,2),box(4,3),'b+');
45end
Note: See TracBrowser for help on using the browser.