PDA

View Full Version : ABS value in plane-line equation?



technologist
10-05-2017, 11:21 AM
Hi,

Math question here about finding theta between a line and a plane. I've gotten by the dot cross result for the top of the equation and am working the "magnitude" of each in the bottom part. Question: should I take the ABS of the two sqrt functions below? The tutorial showed the denominator initially having the abs symbol || but disappeared from the work up. Perhaps its assumed.

cos theta =

n dot a
------------------
sqrt(values...) sqrt(values)

Should the sqrt be | sqrt(values...)| |sqrt(values...)|

GClements
10-05-2017, 03:45 PM
The denominator is the product of the lengths, |n|*|a|. The arguments to the sqrt()s cannot be negative (they're the sum of squares, and squares can't be negative), and the result of sqrt() is always positive.

Also, note that if theta is very close to zero, rounding errors can potentially result in calculating acos(1.00...001), which will be undefined (or NaN). For small angles, it may be better to use the magnitude of the cross product:

sin(theta) = |na|/(|n|*|a|)

This is accurate for small theta but inaccurate for theta close to a right angle.