Last change
on this file since 17 was
17,
checked in by zhangj, 10 years ago
|
To have a stable version on the server.
|
-
Property svn:executable set to
*
|
File size:
496 bytes
|
Line | |
---|
1 | function d = dist_point_droite(m1,m2,m3,pt) |
---|
2 | %% calcul la distance entre la droite et un point pt |
---|
3 | %% droite m1 *x + m2 *y =m3 |
---|
4 | % pt =[0 2] |
---|
5 | % dist_point_droite(1,2,4,pt) |
---|
6 | |
---|
7 | %% centre de la fenetre |
---|
8 | P= [pt 0]; |
---|
9 | |
---|
10 | %vecteur directeur normalise |
---|
11 | u = [-m2 m1 0]; |
---|
12 | |
---|
13 | if (norm(u)~=0) |
---|
14 | u = u/norm(u); |
---|
15 | end |
---|
16 | |
---|
17 | % vecteur AP, ou A appartient a la droite et P est le centre de la fenetre |
---|
18 | if (m1 ~= 0) |
---|
19 | A = [m3/m1 0 0]; |
---|
20 | elseif (m2 ~=0) |
---|
21 | A=[0 m3/m2 0]; |
---|
22 | else |
---|
23 | A=[0 0 0] |
---|
24 | end |
---|
25 | |
---|
26 | AP= P - A; |
---|
27 | |
---|
28 | d = norm(cross(AP,u),2); |
---|
Note: See
TracBrowser
for help on using the repository browser.