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

venn.js Cannot read property 'circle' of null #70

Closed
logust79 opened this issue May 13, 2016 · 2 comments
Closed

venn.js Cannot read property 'circle' of null #70

logust79 opened this issue May 13, 2016 · 2 comments

Comments

@logust79
Copy link

logust79 commented May 13, 2016

I have this dataset (a bit long, attach at the bottom), where it causes venn.js Cannot read property 'circle' of null error. at arcArea += circleArea(arc.circle.radius, arc.width);
I printed out the buggy loop data, it looks something like this:
innerPoints = [{...parentIndex: [0, 2]...}, {...parentIndex: [1, 2]...}, {...parentIndex: [0, 2]...}, {...parentIndex: [1, 2]...}, {...parentIndex: [1, 3]...}, {...parentIndex: [1, 3]...}
When it decides to nest-loop the first and last element of the list, it can't find matching index and arc will end up with null, causing the arcArea += circleArea(arc.circle.radius, arc.width); to fail.
A quick fix is to add a conditional to avoid updating arcArea when arc is null, although I have no clue if this breaks the mathematics.
Can you please have a look at this? Many thanks.
The dataset


var sets = [{ sets: ['a'], size: 226},
            { sets: ['b'], size: 733},
            { sets: ['c'], size: 279},
            { sets: ['d'], size: 332},
            { sets: ['e'], size: 244},
            { sets: ['f'], size: 650},
            { sets: ['a','b'], size: 214},
            { sets: ['a','c'], size: 119},
            { sets: ['a','d'], size: 187},
            { sets: ['a','e'], size: 155},
            { sets: ['a','f'], size: 186},
            { sets: ['b','c'], size: 202},
            { sets: ['b','d'], size: 332},
            { sets: ['b','e'], size: 244},
            { sets: ['b','f'], size: 415},
            { sets: ['c','d'], size: 127},
            { sets: ['c','e'], size: 103},
            { sets: ['c','f'], size: 191},
            { sets: ['d','e'], size: 244},
            { sets: ['d','f'], size: 222},
            { sets: ['e','f'], size: 149},
            { sets: ['a','b','c'], size: 117},
            { sets: ['a','b','d'], size: 187},
            { sets: ['a','b','e'], size: 155},
            { sets: ['a','b','f'], size: 179},
            { sets: ['a','c','d'], size: 116},
            { sets: ['a','c','e'], size: 100},
            { sets: ['a','c','f'], size: 104},
            { sets: ['a','d','e'], size: 155},
            { sets: ['a','d','f'], size: 170},
            { sets: ['a','e','f'], size: 139},
            { sets: ['b','c','d'], size: 127},
            { sets: ['b','c','e'], size: 103},
            { sets: ['b','c','f'], size: 171},
            { sets: ['b','d','e'], size: 244},
            { sets: ['b','d','f'], size: 222},
            { sets: ['b','e','f'], size: 149},
            { sets: ['c','d','e'], size: 103},
            { sets: ['c','d','f'], size: 109},
            { sets: ['c','e','f'], size: 88},
            { sets: ['d','e','f'], size: 149},
            { sets: ['a','b','c','d'], size: 116},
            { sets: ['a','b','c','e'], size: 100},
            { sets: ['a','b','c','f'], size: 103},
            { sets: ['a','b','d','e'], size: 155},
            { sets: ['a','b','d','f'], size: 170},
            { sets: ['a','b','e','f'], size: 139},
            { sets: ['a','c','d','e'], size: 100},
            { sets: ['a','c','d','f'], size: 103},
            { sets: ['a','c','e','f'], size: 97},
            { sets: ['a','d','e','f'], size: 139},
            { sets: ['b','c','d','e'], size: 103},
            { sets: ['b','c','d','f'], size: 109},
            { sets: ['b','c','e','f'], size: 88},
            { sets: ['b','d','e','f'], size: 149},
            { sets: ['c','d','e','f'], size: 88},
            { sets: ['a','b','c','d','e'], size: 100},
            { sets: ['a','b','c','d','f'], size: 103},
            { sets: ['a','b','c','e','f'], size: 87},
            { sets: ['a','b','d','e','f'], size: 139},
            { sets: ['a','c','d','e','f'], size: 87},
            { sets: ['b','c','d','e','f'], size: 88},
            { sets: ['a','b','c','d','e','f'], size: 87},
            
            ]
benfred added a commit that referenced this issue May 14, 2016
This caused some issues as seen here: #70 . Handle by
skipping over point that don't match (doesn't affect area since the point is the same).
@benfred
Copy link
Owner

benfred commented May 14, 2016

This seems to be caused when multiple circles intersect at nearly the same point - causing issues with the code that tries to figure out the intersection area. In your case this point occurs with the 'a', 'd', 'e', 'f' circles:

screen shot 2016-05-14 at 4 41 59 pm.

The last commit should fix 1792850

@logust79
Copy link
Author

Excellent work! Thank you very much!

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

No branches or pull requests

2 participants