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

Slow bounds intersection (or will crash) #90

Closed
jonathanolson opened this issue Sep 28, 2021 · 2 comments
Closed

Slow bounds intersection (or will crash) #90

jonathanolson opened this issue Sep 28, 2021 · 2 comments
Assignees

Comments

@jonathanolson
Copy link
Contributor

From phetsims/geometric-optics#163:

// this intersection takes a long time
const screenShape = new kite.Shape( 'M 172.00000000000000000000 39.00000000000000000000 L 172.00000000000000000000 -51.00000000000000000000 L 225.00000000000000000000 -83.00000000000000000000 L 225.00000000000000000000 72.00000000000000000000 L 172.00000000000000000000 39.00000000000000000000 Z ' );
const diskShape = new kite.Shape( 'M 201.27956700139799295357 -70.46480403958862837044 A 2.55913400279601432885 1.27956700139800716443 450 0 1 198.72043299860195020301 -70.46480403958862837044 A 2.55913400279601432885 1.27956700139800716443 450 0 1 201.27956700139799295357 -70.46480403958862837044 Z ' );
screenShape.shapeIntersection( diskShape ).toString();

// notably an example segment bounds intersection
const aSegment = new kite.EllipticalArc( new dot.Vector2( 199.99999999999997, -70.46480403958863 ), 2.5591340027960428, 1.2795670013980214, 7.853981633974483, -0.000012503268166819126, 1.5707963267948966, false );
const bSegment = new kite.EllipticalArc( new dot.Vector2( 199.99999999999997, -70.46480403958863 ), 2.5591340027960428, 1.2795670013980214, 7.853981633974483, -0.5863612898477928, -0.000012503268166819126, false );
kite.Segment.intersect( aSegment, bSegment );
@jonathanolson jonathanolson self-assigned this Sep 28, 2021
@jonathanolson
Copy link
Contributor Author

Looks like this creates ~21738100 BoundsIntersection instances, which probably takes up a good amount of memory.

@jonathanolson
Copy link
Contributor Author

Snapshot comparison looks good, closing.

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

1 participant