-
Notifications
You must be signed in to change notification settings - Fork 52
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
incircle predicate produces results that differ from original C code #48
Comments
This change fixes the differences in produced results between the Rust implementation and the original implementation in C.
Woah, thanks for finding this. I wonder how many other errors may have been introduced during the manual translation. Maybe it's time to do this properly with a C to rust converter. I know they're error prone, but since the underlying C files are really simple, they may actually work in this case. Related to this issue on geo |
As far as I can tell, the orient2d and incircle code are now correct. I've been running quite some random calculations (either point close to nearly straight line for orient2d, or close to unit circle for incircle) and I've not observed any differences between the results from predicates.c and the Rust code. |
That sounds promising, thanks for doing this and sharing the results. |
The predicates have been moved to crate |
While verifying the exact predicates implementation in Rust, I found that your
incircle code produces results that differ from the original predicates code in
C.
The problem lies in the following lines in exactpred.rs (lines 337-343):
These lines should be changed as follows (variables named 'cc' have been swapped with 'bb' and vice versa):
Note, the following are the original lines in predicates.c (lines 2839-2843):
After this change, the Rust incircle code produces identical results to the
original C code.
The text was updated successfully, but these errors were encountered: