Date: Wed, 18 Jun 2003 13:00:54 +0200
From: Manuel Martin
To: efg2@efg2.com
Subject: Polygon area accuracy
Hi
I read then comments from Frank van het Veld about managing
formulas for polygon area and centroid
It's true that if you do A*B where A,B are big (say 1.0E7)
the result will lose accuracy because of size of numbers in
any computer.
Same is said for any other formula, such as SQR(A*B-B*C)
When working with geometry, a simple method can be applied
to improve (not solve) accuracy:
work with relative coordinates
So, calling:
X = A - A, Y = B - A, Z = C - A
(this is, substract a medium/origin Xo value to all Xi values
and a medium/origin Yo value to all Yi values)
we get:
X*Y instead of A*B
Area is _not_changed.
Centroid coordinates must be changed to real, not relative.
So:
Xc (world) = Xc (relative) + Xo
Yc (world) = Yc (relative) + Yo
And that's all.
Hope this help
Regards,
Manuel