[vtkusers] TriangleArea() return the not correct value.
asou at soum.co.jp
Wed Sep 3 23:02:45 EDT 2014
From: David Cole <dlrdave at aol.com>
Date: Wed, 3 Sep 2014 08:43:31 -0400
>> Error of up to 0.0000000000000001 is acceptable in my program.
> You have to be really careful with your code if you want/need to keep
> all your error levels close to DBL_EPSILON.
Thank you for your advice.
It has not been able to correctly represent the intent of my previous
The following is a quotation from first email.
From: Masato Asou <asou at soum.co.jp>
Date: Fri, 29 Aug 2014 11:41:15 +0900 (JST)
> $ ./a.out
> TriangleArea(A, B, C): 0.00000000526835606386
Above is not acceptable error.
Below is acceptable error.
> TriangleArea(B, C, A): 0.00000000000000009839
Heron's formula and cross product are acceptable.
> CrossProduct(A, B, C): 0.00000000000000011168
> CrossProduct(B, C, A): 0.00000000000000012055
> HeronsFormula(A, B, C): 0.00000000000000011252
> HeronsFormula(B, C, A): 0.00000000000000011252
> RectangularTriangle: 0.00000000000000017012
Error due to the order of the vertex is lage calculation result of
vtkTriangle::TriangleArea(). Error due to the order of the vertex is
small heron's formula and cross product.
From: David Gobbi <david.gobbi at gmail.com>
Date: Thu, 28 Aug 2014 21:19:08 -0600
> Note that there is a difference in efficiency, because Heron's formula
> requires applying sqrt() four times, while VTK's formula requires applying
> sqrt() only once.
Why vtkTriangle::TriangleArea() doesn't use cross product?
Also cross product requires applying sqrt() only once.
More information about the vtkusers