Last change
on this file was
37,
checked in by (none), 15 years ago
|
Added original make3d
|
-
Property svn:executable set to
*
|
File size:
1.0 KB
|
Line | |
---|
1 | % HNORMALISE - Normalises array of homogeneous coordinates to a scale of 1 |
---|
2 | % |
---|
3 | % Usage: nx = hnormalise(x) |
---|
4 | % |
---|
5 | % Argument: |
---|
6 | % x - an Nxnpts array of homogeneous coordinates. |
---|
7 | % |
---|
8 | % Returns: |
---|
9 | % nx - an Nxnpts array of homogeneous coordinates rescaled so |
---|
10 | % that the scale values nx(N,:) are all 1. |
---|
11 | % |
---|
12 | % Note that any homogeneous coordinates at infinity (having a scale value of |
---|
13 | % 0) are left unchanged. |
---|
14 | |
---|
15 | % Peter Kovesi |
---|
16 | % School of Computer Science & Software Engineering |
---|
17 | % The University of Western Australia |
---|
18 | % pk at csse uwa edu au |
---|
19 | % http://www.csse.uwa.edu.au/~pk |
---|
20 | % |
---|
21 | % February 2004 |
---|
22 | |
---|
23 | function nx = hnormalise(x) |
---|
24 | |
---|
25 | [rows,npts] = size(x); |
---|
26 | nx = x; |
---|
27 | |
---|
28 | % Find the indices of the points that are not at infinity |
---|
29 | finiteind = find(abs(x(rows,:)) > eps); |
---|
30 | |
---|
31 | if length(finiteind) ~= npts |
---|
32 | warning('Some points are at infinity'); |
---|
33 | end |
---|
34 | |
---|
35 | % Normalise points not at infinity |
---|
36 | for r = 1:rows-1 |
---|
37 | nx(r,finiteind) = x(r,finiteind)./x(rows,finiteind); |
---|
38 | end |
---|
39 | nx(rows,finiteind) = 1; |
---|
40 | |
---|
Note: See
TracBrowser
for help on using the repository browser.