svg-2d icon indicating copy to clipboard operation
svg-2d copied to clipboard

Intersection.intersectShapes(shape1, shape2)

Open iklotzko opened this issue 11 years ago • 2 comments

I was using this utility and found it returns all the intersections shape1 or shape2 have, in addition to eachother.

for (var ix = 0; ix < weird_shapes.length; ix++) {
        var p = weird_shapes[ix];

        var path = p.getMyShape();
        var shape = new Path(path);
        var rectObj = new Rectangle(actualRect);
        var intersection = Intersection.intersectShapes(shape, rectObj);

}

the same intersection is seen for many shapes... In order to obviate this I had to determine using the points in the intersection and see whether or not they were in my shape much easier than determining if my shape was in my shape.

Do I have to re-initialize the Intersection object somehow on each test for intersectShapes?

iklotzko avatar Mar 04 '13 20:03 iklotzko

iklotzko,

Just to help me reproduce the issue, is there a specific combination of shape types that you are using?

Regarding the Intersection object, the "static method" intersectShapes creates a new Intersection object each time you call it. The rest of the state is maintained within the "static methods" off of intersectShapes, so no re-init is necessary.

-Kevin

thelonious avatar Mar 04 '13 21:03 thelonious

hmmm, not sure what you would call them but cutting up a circle into pizza pie-like slices, and using a rectangle to select various items.

  • ik

On Mon, Mar 4, 2013 at 4:32 PM, Kevin Lindsey [email protected]:

iklotzko,

Just to help me reproduce the issue, is there a specific combination of shape types that you are using?

Regarding the Intersection object, the "static method" intersectShapes creates a new Intersection object each time you call it. The rest of the state is maintained within the "static methods" off of intersectShapes, so no re-init is necessary.

-Kevin

— Reply to this email directly or view it on GitHubhttps://github.com/thelonious/svg-2d/issues/1#issuecomment-14406985 .

Ira Klotzko, Ph.D. Owner and Managing Director Irate Solutions, LLC. http://www.iratesolutions.com http://www.iratesolutions.com_201.984.7293 (w)_ 201.761.9374 (c) Skype: iklotzko IM(google) [email protected] IM(yahoo) iklotzko IM(aim) iklotzko

iklotzko avatar Mar 04 '13 21:03 iklotzko