|
|
In creating some testing for include file macros I came across code for
the two VAngle* macros (and two similar rotation related macros):
#macro VAngle(V1, V2)
acos(min(1, vdot(vnormalize(V1), vnormalize(V2))))
#end
The min(1,..) is obviously trying to protect acos from domain errors.
Why only the clamp to the positive side? Aren't we as exposed to <-1.0?
Often enough in code - including POV_Ray's own - I've seen code clamping
to a [-1..1] range after a dot product into acos() for acos domain
concerns.
I cannot come up with reasoning to clamp only the positive side. Anyone
else? If valid to do, we might be able to slightly streamline some
internal code.
Bill P.
Post a reply to this message
|
|