intersection

Patterns for the overlap of two objects

I'm sure this has already been asked and answered so I apologize in advance for that but I'm not figuring out the correct keywords to search for. Searching for "Pattern" hits way too many Q & A's to be useful. I'm working on a regression testing app. I'm displaying a form on the screen and according to which user is logged in to the a...

Oriented Bounding Box vs Oriented Bounding Box intersection test (c/c++)

I'd like an optimized implementation for this test. It need not conform exactly to this prototype. bool OOBBIntersectOOBB( float center0[3], float halfExtents0[3], // or some other bounding description float rotation0[9], // quaternion would also be fine float center1[3], float halfExtents1[3], float rotation1[9]); ...

The intersection point between a spline and a line

Hi, I'm trying to find a way to calculate the intersection between a b-spline and a straight line. So far Google hasn't been much help. ...

Efficient maths algorithm to calculate intersections

For a game I am developing I need an algorithm that can calculate intersections. I have solved the problem, but the way I have done it is really nasty and I am hoping someone here might have a more elegant solution. A pair of points represent the end points of a line drawn between them. Given two pairs of points, do the drawn lines inte...

Java: Is there an easy, quick way to AND, OR, or XOR together sets?

That is, if I had two or more sets, and I wanted to return a new set containing either: All of the elements each set has in common (AND). All of the elements total of each set (OR). All of the elements unique to each set. (XOR). Is there an easy, pre-existing way to do that? Edit: That's the wrong terminology, isn't it? ...

How do I search a "Property Bag" table in SQL?

I have a basic "property bag" table that stores attributes about my primary table "Card." So when I want to start doing some advanced searching for cards, I can do something like this: SELECT dbo.Card.Id, dbo.Card.Name FROM dbo.Card INNER JOIN dbo.CardProperty ON dbo.CardProperty.IdCrd = dbo.Card.Id WHERE dbo.CardProperty.Id...

Efficient set intersection algorithm

Given two lists (not necessarily sorted), what is the most efficient non-recursive algorithm to find the intersection of those lists? ...

Compute the area of intersection between a circle and a triangle?

How does one compute the area of intersection between a triangle (specified as three (X,Y) pairs) and a circle (X,Y,R)? I've done some searching to no avail. This is for work, not school. :) It would look something like this in C#: struct { PointF vert[3]; } Triangle; struct { PointF center; float radius; } Circle; // returns the a...

area of intersection between circle and rectangle

i'm looking for a fast way to determine the area of intersection between a rectangle and a circle (I need to do millions of these calculations) A specific property is that in all cases the circle and rectangle always have 2 points of intersection. Java lib would be awesome! Thanks, Britske ...

Python - Intersection of two lists

Hi, I know how to get an intersection of two flat lists: b1 = [1,2,3,4,5,9,11,15] b2 = [4,5,6,7,8] b3 = [val for val in b1 if val in b2] or def intersect(a, b): return list(set(a) & set(b)) print intersect(b1, b2) But when I have to find intersection for nested lists then my problems starts: c1 = [1, 6, 7, 10, 13, 28, 32, ...

VB.NET Array Intersection

This could be terribly trivial, but I'm having trouble finding an answer that executes in less than n^2 time. Let's say I have two string arrays and I want to know which strings exist in both arrays. How would I do that, efficiently, in VB.NET or is there a way to do this other than a double loop? ...

(Ruby) If the array intersection operator ( & ) is inefficient, why is it available?

I asked a question yesterday about comparing ranges for overlap and its been stuck in my throat ever since. The consensus seems to be that my preferred answer which involves using the array intersection operator (&), is inefficient because comparing arrays is costly. I wonder then, why this feature is in the language? Could it be that ...

Line Segment container for fast Ray intersection? (2D)

I have a ray, I need to find the closest line segment that it hits. I think it's possible to do this in O(log n) time if I sort the line segments first, but I can't remember how to sort them... I think some sort of tree would work best, but how do I sort them by both start and end point? I would also like fast insertions into this data s...

Line intersection

How to find whether a line intercepted in a polygon ...

How do I see common Items between 2 array of Objects

How do I see common Items between 2 array of Objects. My intersect is not returning anything. The object is created from a Linq to SQL class. ...

Point-triangle intersection in 3d from mouse coordinates?

I know how to test intersection between a point and a triangle. ...But i dont get it, how i can move the starting position of the point onto the screen plane precisely by using my mouse coordinates, so the point angle should change depending on where mouse cursor is on the screen, also this should work perfectly no matter which perspect...

Union of All Intersecting Sets

Given a list of objects with multiple attributes I need to find the list of sets created by a union of all intersecting subsets. Specifically these are Person objects, each with many attributes. I need to create a list of 'master' sets based on a handful of unique identifiers such as SSN, DLN, etc. For instance, if Person A and Person...

How to Intersect two Arrays?

I'm working with VB.Net, and have two one-dimensional Arrays. Is there an Inbuilt function for finding the elements that are common to both of them? Or do I have to write one for myself? ...

Fastest horizontal line <-> convex polygon intersection algorithm?

Hi, I need to solve a relatively simple thing -- I've got n-vertices convex 2D polygon and a horizontal (!) line with some 'y' coordinate. I need only one thing: to check if the polygon is crossed with this line (i.e. have 2 intersections) or not. The fastest one I can think of is to find min/max y coordinates within a polygon (loop re...

std::map and performance, intersecting sets

I'm intersecting some sets of numbers, and doing this by storing a count of each time I see a number in a map. I'm finding the performance be very slow. Details: - One of the sets has 150,000 numbers in it - The intersection of that set and another set takes about 300ms the first time, and about 5000ms the second time - I haven't don...