[vtkusers] TriangleArea() return the not correct value.
Masato Asou
asou at soum.co.jp
Mon Sep 8 05:12:27 EDT 2014
Sorry for my delayed reply.
> With the cross product technique, there are six possible permutations
> of cross product, depending on which vectors you choose to do the
> cross product: a x b, a x c, b x a, b x c, c x a, and c x b. I think
> you will still hit a math problem with some of the permutations for
> your extreme case, won't you? If so, then whether or not your result
> is acceptable depends on being lucky about which permutation you
> choose.
As you have pointed out cross product approach also hit the round
off error problem, which depends on the choice of the vector pair.
However, the norm of the cross product is taken in this approach,
So that there are no subtraction in the final sqrt() operation.
For example, let a x b be sufferd from the round-off-error, to be
(e1, e2, e3) where e* is about machie epsilon.
Even in this case norm(a x b) = sqrt(e1**2 + e2**2 + e3**2) is the
order of 1e-16. Meanwhile, in the present implementation of
vtkTriangle::TraingleArea(), the area may become O(sqrt(e))~1e-8.
--
ASOU Masato
More information about the vtkusers
mailing list