| 1 | function wireframe(D,C,n)
|
---|
| 2 | % given 2 dim array f n Data points and square nxn adjacency
|
---|
| 3 | % array C of connections
|
---|
| 4 | % plot wireframe edge by edge between projected Begin and End x,y
|
---|
| 5 | % coordinates
|
---|
| 6 | % vectors X and Y are of length 2 and contain respectively the two
|
---|
| 7 | % x and y coordinates of the Begin- and Endpoints
|
---|
| 8 | % determine x,y range first for whole dataset
|
---|
| 9 |
|
---|
| 10 | % wel het figuurtje laten zien natuurlijk
|
---|
| 11 | figure
|
---|
| 12 | % hulp lijntjes
|
---|
| 13 | grid on
|
---|
| 14 |
|
---|
| 15 | % even randen
|
---|
| 16 | % xmin=1.2*min(min(D([1],:)));
|
---|
| 17 | % xmax=1.2*max(max(D([1],:)));
|
---|
| 18 | % ymin=1.2*min(min(D([2],:)));
|
---|
| 19 | % ymax=1.2*max(max(D([2],:)));
|
---|
| 20 | % gebruik onderstaande voor een vierkant
|
---|
| 21 | xmin=1.2*min(min(D([1 2],:)));
|
---|
| 22 | xmax=1.2*max(max(D([1 2],:)));
|
---|
| 23 | ymin = xmin;
|
---|
| 24 | ymax = xmax;
|
---|
| 25 | axis([xmin,xmax,ymin,ymax]);
|
---|
| 26 |
|
---|
| 27 | X = [0; 10];
|
---|
| 28 | Y = [0; 10];
|
---|
| 29 | % no cleanups between plot commands
|
---|
| 30 | hold on
|
---|
| 31 | % loop door de connectie array heen
|
---|
| 32 | % we trekken enkel lijntjes van de kleine naar de grootte om dubbel
|
---|
| 33 | % werk te voorkomen
|
---|
| 34 | for i=1:n
|
---|
| 35 | for j=i:n
|
---|
| 36 | if ( C(i,j) == 1 )
|
---|
| 37 | point1 = D(:,i);
|
---|
| 38 | point2 = D(:,j);
|
---|
| 39 | X = [ point1(1); point2(1) ];
|
---|
| 40 | Y = [ point1(2); point2(2) ];
|
---|
| 41 | plot(X, Y,'k-')
|
---|
| 42 |
|
---|
| 43 | end
|
---|
| 44 | end
|
---|
| 45 | end
|
---|
| 46 | %draw black line between 2 connected data vertex points at a time
|
---|
| 47 | hold off
|
---|
| 48 |
|
---|