From: Luis Gracia (lug2002_at_med.cornell.edu)
Date: Wed Jan 12 2005 - 12:31:58 CST

Ekta Khurana said the following on 01/11/05 19:56:
> Hello, I want to find out the angle between two vectors, which can be
> found using the dot product and acos. I know I can use vecdot to find dot
> product in TCL. Could someone tell me what command I can use for acosine.
> Thanks,
> Ekta

proc angle { a b } {
   # Angle between two vectors
   set amag [veclength $a]
   set bmag [veclength $b]
   set dotprod [vecdot $a $b]
   return [expr 57.2958 * acos($dotprod / ($amag * $bmag))]
}

cheers,
Luis

-- 
Luis Gracia, PhD
Department of Physiology & Biophysics
Weill Medical College of Cornell University
1300 York Avenue, Box 75
New York, NY 10021
Tel: (212) 746-6375
Fax: (212) 746-8690
lug2002_at_med.cornell.edu