Skip to content
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

Use robust-predicates in signed area #111

Merged
merged 3 commits into from
Jan 7, 2020
Merged

Use robust-predicates in signed area #111

merged 3 commits into from
Jan 7, 2020

Conversation

@w8r
Copy link
Owner

w8r commented Jan 7, 2020

👍 this is quite incredible, also there's almost no performance drop:

martinez@master

Hole_Hole
Martinez x 33,283 ops/sec ±3.15% (89 runs sampled)
JSTS x 1,896 ops/sec ±27.46% (77 runs sampled)
- Fastest is Martinez

Asia union
Martinez x 10.76 ops/sec ±3.40% (29 runs sampled)
JSTS x 8.09 ops/sec ±4.95% (25 runs sampled)
- Fastest is Martinez

States clip
Martinez x 260 ops/sec ±1.47% (87 runs sampled)
JSTS x 111 ops/sec ±1.59% (72 runs sampled)
- Fastest is Martinez

martinez@use-robust-predicates

Hole_Hole
Martinez x 27,079 ops/sec ±34.50% (90 runs sampled)
JSTS x 1,386 ops/sec ±25.14% (69 runs sampled)
- Fastest is Martinez

Asia union
Martinez x 10.43 ops/sec ±3.81% (29 runs sampled)
JSTS x 8.15 ops/sec ±4.40% (25 runs sampled)
- Fastest is Martinez

States clip
Martinez x 255 ops/sec ±1.69% (85 runs sampled)
JSTS x 109 ops/sec ±2.49% (74 runs sampled)
- Fastest is Martinez

@bluenote10
Copy link
Collaborator

Hey @rowanwins !

Hm, now that is weird: To avoid shooting myself in the foot with further changes, I was trying to setup active test cases for old GitHub issues (as a test for #116). I thought I'd start with some of this PR, but for some reason, I have trouble reproducing them. I'm on commit 245c8d4, and my signedArea is defined based on oriente2d. But I'm getting for instance:

#102

image

#90

image

I hope I'm doing something wrong :(, but the codepen seems to be running 0.6.0 and also still looks wonky. Or are these result somehow machine dependent?

@rowanwins
Copy link
Collaborator Author

Hey @bluenote10

I was just using the test site to run my visual checks

The demo site compiles directly from the src directory.

Screen

Screen2

Do you get different results using that approach?

@bluenote10
Copy link
Collaborator

Indeed that works!

Is there anything different with this approach in terms of e.g. input data preprocessing? If it wasn't for the codepen, I would have concluded that it is a difference browser vs nodejs. I'm not 100% sure the codepen includes the change though (I should mention that I'm not a JS programmer, so I'm not good at verifying these things).

@rowanwins
Copy link
Collaborator Author

Hmmm that's very strange, I just looked at the codepen and it looks to be setup correctly, I'll have to take a deeper look later...

@bluenote10
Copy link
Collaborator

Yeah, quite mysterious. I did a few more checks. I've added a

console.log(`${p0[0]}, ${p0[1]}, ${p1[0]}, ${p1[1]}, ${p2[0]}, ${p2[1]} => ${res}`);

in signedArea to get the output of both the demo in the browser and the nodejs equivalent. Looking at the diff I get (left is browser, right is node):

image

Unless console.log itself prints values differently in terms of precision, it looks like it is already the input data that has slightly less precision in the demo. I have no idea yet where this loss of precision is coming from. I found a JSON.parse + JSON.stringify and suspected that it might lose precision, but running it on the first value that differs I can't reproduce the precision loss:

image

@rowanwins
Copy link
Collaborator Author

Hmm ok so using node I am getting different results than what I'd expect for that codepen.... (eg it's wrong :( )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants