Last change
on this file since 177 was
37,
checked in by (none), 15 years ago
|
Added original make3d
|
-
Property svn:executable set to
*
|
File size:
619 bytes
|
Line | |
---|
1 | % H = vgg_diagonalize_conic(C) Finds Euclidean transformation sending conic canonical position.
|
---|
2 | %
|
---|
3 | % For any symmetric matrix C, returns Euclidean transformation H such that
|
---|
4 | % H'*C*H
|
---|
5 | % is a diagonal matrix.
|
---|
6 | %
|
---|
7 | % Typical usage is to transform conics to canonical form, to classify or plot them.
|
---|
8 |
|
---|
9 | function H = vgg_diagonalize_conic(C)
|
---|
10 |
|
---|
11 | N = size(C,1);
|
---|
12 |
|
---|
13 | C = C/C(end,end);
|
---|
14 | s = C(1:end-1,end);
|
---|
15 | Q = C(1:end-1,1:end-1);
|
---|
16 |
|
---|
17 | [U,S,V] = svd(Q);
|
---|
18 | sw = diag([-1 ones(1,N-2)]);
|
---|
19 | if det(U) < 0
|
---|
20 | U = U*sw;
|
---|
21 | S = sw*S;
|
---|
22 | end
|
---|
23 | if det(V) < 0
|
---|
24 | V = V*sw;
|
---|
25 | S = S*sw;
|
---|
26 | end
|
---|
27 |
|
---|
28 | H = [U -inv(Q)*s; zeros(1,N-1) 1];
|
---|
29 |
|
---|
30 | return |
---|
Note: See
TracBrowser
for help on using the repository browser.