-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Heron’s Forumula [sic] and other issues on tri-point.php #20
Comments
Thanks for this! Re shoelace vs Heron – can you point me to a reference? A lot of these examples are built on examples by other folks, so it's quite possible they had it wrong and I just copied it :) Re long/skinny triangles – can you explain how that's the case? What do you mean by "small delta"? |
https://en.wikipedia.org/wiki/Shoelace_formula Re. small delta: The problem is machine arithmetic. Addition and multiplication does not have infinite precision. So an exact comparison can fail. This is most likely to happen if you start with non-integers (e.g. a third and many other rational numbers cannot be represented exactly) Or the results of a multiplication exceed the precision that is being used. With a little thought you can see how the error becomes a significant fraction when you subtract the result of two multiplications. In all of these kinds of problems the final "==" can fail. so rather than Long skinny triangles are an example where you adding tiny values to large values. Perhaps the demos work on your web page because your x,y positions are small integers, but it wont work in the general case. |
Amazing, thank you! Let me dig into this when I have a minute and will update the tutorial |
On the page tri-point.php
"Heron’s Forumula:"
^ Formula is misspelt.
Also a visual check of the formula suggests this is actually the Shoelace formula not Heron's formula.
Adding up the area is a clever mathematical approach but it suffers from machine arithmetic issues, especially with long skinny triangles. It would be useful to discuss this limitation and how a small delta can be used to address this limitation..
The text was updated successfully, but these errors were encountered: