Closed jonathanolson closed 2 years ago
From https://github.com/phetsims/geometric-optics/issues/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 );
Looks like this creates ~21738100 BoundsIntersection instances, which probably takes up a good amount of memory.
Snapshot comparison looks good, closing.
From https://github.com/phetsims/geometric-optics/issues/163: