Re: [Tutor] Calculating Deflection angles
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Well, first that sounds somehow like a homework assignment, so only some hints: a) work out the underlying math. Consider all special edge cases. b) I'm not completely sure what you need, but a feeling in the stomach tells me that you might need the atan function, it's provided in Python in the math module. Andreas nitin chandra wrote: > Hello Every One, > > I create a list of coordinates of 2 lines. > X11,Y11 & X12,Y12 as starting and ending of one line. > X21,Y21 & X22, Y22 as starting and ending of the 2nd line. > > Now is there any way to calculate the deflection angle between the two > lines? Will any modules be required other than Python 2.3 (on Linux)? > > and > > How will it be done? > > TIA, > > Nitin > ___ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.2 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFGi+h4HJdudm4KnO0RAgaTAKDV9dRcoFRuFpU0l0uNRrVmmUGZvACgm2B8 ute28hDtZfeMQGg+0QoF7Mo= =kBWC -END PGP SIGNATURE- ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Calculating Deflection angles
On Wed, 4 Jul 2007, nitin chandra wrote: > Hello Every One, > > I create a list of coordinates of 2 lines. > X11,Y11 & X12,Y12 as starting and ending of one line. > X21,Y21 & X22, Y22 as starting and ending of the 2nd line. > > Now is there any way to calculate the deflection angle between the two > lines? Will any modules be required other than Python 2.3 (on Linux)? I'm looking at my old book "A Programmer's Geometry" now. If you first put the equations for each line in the AX+BY+C=0 form, i.e., Line 1: A1*X + B1*Y + C1 = 0 Line 2: A2*X + B2*Y + C2 = 0 Then the angle between them is found by: theta = acos( (A1*A2 + B1*B2) / sqrt((A1**2+B1**2)*(A2**2+B2**2)) ) ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Calculating Deflection angles
"nitin chandra" <[EMAIL PROTECTED]> wrote > I create a list of coordinates of 2 lines. > X11,Y11 & X12,Y12 as starting and ending of one line. > X21,Y21 & X22, Y22 as starting and ending of the 2nd line. > > Now is there any way to calculate the deflection angle between the > two > lines? Will any modules be required other than Python 2.3 (on > Linux)? This is a standard math problem to which you can apply the standard math techniques. You can use the trigonometry functions found in the math module. HTH, -- Alan Gauld Author of the Learn to Program web site http://www.freenetpages.co.uk/hp/alan.gauld ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] Calculating Deflection angles
Hello Every One, I create a list of coordinates of 2 lines. X11,Y11 & X12,Y12 as starting and ending of one line. X21,Y21 & X22, Y22 as starting and ending of the 2nd line. Now is there any way to calculate the deflection angle between the two lines? Will any modules be required other than Python 2.3 (on Linux)? and How will it be done? TIA, Nitin ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor