procedure to generate a line and angle

March 10 2010 by alex08 12
Maple

0

0


Can alone explain to me what is happening in this procedure? I know it is it is to generate a line p and an angle theta but don't understand what line and angle or how it does it.

> PolFm := proc(A,B)
 local n, mds, p, theta;
 n := [ A[2]-B[2], B[1]-A[1] ];   # Normal to the line
 if evalf((A[1]+B[1])*n[1] + (A[2]+B[2])*n[2]) < 0 then # makes sure we have the "right" normal
    n := - n
 end if;
 mds := sqrt( n[1]^2 + n[2]^2 );
 n := [(1/mds)*n[1],(1/mds)*n[2]];
 theta := argument(n[1]+I*n[2]);
 p := A[1]*n[1]+A[2]*n[2];
 return p, theta
end proc:

 

 
Loading Comments & Answers

You must be log into your MaplePrimes account in order to post a comment. If you don't have an account, you can create an account here.

     

Forgot Your Password? Create an Account