Young-hoo Kwon, Ph.d.

01-08-2003, 05:13 AM

Dear Ton and all,

I'd like to point out a mistake in your summary.

> As in Kwon3D, we label these matrix elements as t11, t12, t13, etc.

> Using such an attitude matrix, obtained from measurements, the joint

> angles can be easily extracted as follows:

>

> ph = atan2(-t32,t33)

> th = atan2(t31,sqrt(t32*t32+t33*t33))

> ps = atan2(-t21,t11)

> (..sqrt is the square root function)

>

ph = atan2(-t32,t33)

is not right because

atan2(-t32,t33) = atan2(sin(ph)cos(th),cos(ph)cos(th))

is not equivalent to

atan2(sin(ph),cos(ph)).

It depends on the sign of cos(th). If this is negative, you will have

atan2(-sin(ph),-cos(ph))

instead. Likewise,

atan2(t31,sqrt(t32*t32+t33*t33)) = atan2(sin(th),sqrt(cos(th)^2))

is not equivalent to

atan2(sin(th),cos(th))

because sqrt(a2) can be either +a or -a, etc.

I agree that the use of ATAN2 is relatively more convenient. I have used FORTRAN, QuickBASIC, C, C++, and now Visual C++. The function has evolved accordingly and atan

2 was forgotten in the process somehow. I will update my function using atan2. (^_^)

Young-Hoo Kwon

------------------------------------------------------

- Young-Hoo Kwon, Ph.D.

- Biomechanics Lab, Texas Woman's University

- ykwon@twu.edu

- http://kwon3d.com

------------------------------------------------------

---------------------------------------------------------------

To unsubscribe send SIGNOFF BIOMCH-L to LISTSERV@nic.surfnet.nl

For information and archives: http://isb.ri.ccf.org/biomch-l

---------------------------------------------------------------

I'd like to point out a mistake in your summary.

> As in Kwon3D, we label these matrix elements as t11, t12, t13, etc.

> Using such an attitude matrix, obtained from measurements, the joint

> angles can be easily extracted as follows:

>

> ph = atan2(-t32,t33)

> th = atan2(t31,sqrt(t32*t32+t33*t33))

> ps = atan2(-t21,t11)

> (..sqrt is the square root function)

>

ph = atan2(-t32,t33)

is not right because

atan2(-t32,t33) = atan2(sin(ph)cos(th),cos(ph)cos(th))

is not equivalent to

atan2(sin(ph),cos(ph)).

It depends on the sign of cos(th). If this is negative, you will have

atan2(-sin(ph),-cos(ph))

instead. Likewise,

atan2(t31,sqrt(t32*t32+t33*t33)) = atan2(sin(th),sqrt(cos(th)^2))

is not equivalent to

atan2(sin(th),cos(th))

because sqrt(a2) can be either +a or -a, etc.

I agree that the use of ATAN2 is relatively more convenient. I have used FORTRAN, QuickBASIC, C, C++, and now Visual C++. The function has evolved accordingly and atan

2 was forgotten in the process somehow. I will update my function using atan2. (^_^)

Young-Hoo Kwon

------------------------------------------------------

- Young-Hoo Kwon, Ph.D.

- Biomechanics Lab, Texas Woman's University

- ykwon@twu.edu

- http://kwon3d.com

------------------------------------------------------

---------------------------------------------------------------

To unsubscribe send SIGNOFF BIOMCH-L to LISTSERV@nic.surfnet.nl

For information and archives: http://isb.ri.ccf.org/biomch-l

---------------------------------------------------------------