Intersection is a term that relates to descriptive geometry and functions. Intersections are points which are included in multiple objects. They are intersections of the object they belong to.
Questions tagged [intersection]
2483 questions
16
votes
4 answers
Python list intersection efficiency: generator or filter()?
I would like to intersect two lists in Python (2.7). I need the result to be iterable:
list1 = [1,2,3,4]
list2 = [3,4,5,6]
result = (3,4) # any kind of iterable
Providing a full iteration will be performed first thing after the intersection, which…

Amnon Grossman
- 567
- 1
- 5
- 12
16
votes
6 answers
How do I do an integer list intersection while keeping duplicates?
I'm working on a Greatest Common Factor and Least Common Multiple assignment and I have to list the common factors. Intersection() won't work because that removes duplicates. Contains() won't work because if it sees the int in the second list it…

DuckReconMajor
- 163
- 1
- 6
16
votes
1 answer
Filter MongoDb collection if field array and argument array intersect
I'm creating a Meteor learning project. There is a collection in it, its documents have a property named keywords which is an array of strings. I have a second array of strings. I want to filter the collection that way, that it returned only those…

Evaldas Ilginis
- 502
- 4
- 9
15
votes
0 answers
Unity3D: How to show only the intersection/cross-section between two meshes at runtime?
The Problem
Hi, I'm basically trying to do the same thing as described here:
Unity Intersections Mask
With the caveat that the plane isn't exactly a plane but a (very large relative to the arbitrary 3D object) 3D Cone, and the camera I'm using has…

Chae Ho Shin
- 181
- 1
- 6
15
votes
2 answers
How to find an intersection of curve and circle?
I have a curve, derived from empirical data, and I can obtain a reasonable model of it. I need to identify a point (x, y) where the curve intersects a circle of known center and radius. The following code illustrates the question.
x <- c(0.05, 0.20,…

Mercurial
- 195
- 6
15
votes
10 answers
Intersection of two strings in Java
Need a Java function to find intersection of two strings. i.e. characters common to the strings.
Example:
String s1 = new String("Sychelless");
String s2 = new String("Sydney");

Deepak
- 2,094
- 8
- 35
- 48
15
votes
2 answers
Intersection of nD line with convex hull in Python
I have created a convex hull using scipy.spatial.ConvexHull. I need to compute the intersection point between the convex hull and a ray, starting at 0 and in the direction of some other defined point. The convex hull is known to contain 0 so the…

user2133814
- 2,431
- 1
- 24
- 34
15
votes
3 answers
Polygon intersection error in Shapely: "shapely.geos.TopologicalError: The operation 'GEOSIntersection_r' produced a null geometry"
I have been trying to debug this problem but unable to do so. I am trying to find the intersection of two Polygon objects. It works most of the time but for the following case, it raises the following exception:
P1 area: 13.125721955
P2 area:…

Nik
- 5,515
- 14
- 49
- 75
14
votes
3 answers
Python - matplotlib: find intersection of lineplots
I have a probably simple question, that keeps me going already for quiet a while. Is there a simple way to return the intersection of two plotted (non-analytical) datasets in python matplotlib ?
For elaboration, I have something like…

Christian
- 153
- 1
- 1
- 5
14
votes
2 answers
Intersect with a custom IEqualityComparer using Linq
Long story short: I have 2 collections of objects. One contains good values (Let's call it "Good"), the other default values (Mr. "Default"). I want the Intersect of the Union between Good and Default, and Default. In other words:…

Tipx
- 7,367
- 4
- 37
- 59
14
votes
4 answers
Algorithm / Data structure for largest set intersection in a collection of sets with a given set
I have a large collection of several million sets, C. The elements of my sets come from a universe of about 2000 possible elements. I need to know, for a given set, s, which set in C has the largest intersection with s? (Or the k sets in C with the…

newmanne
- 2,019
- 5
- 22
- 31
14
votes
4 answers
Find all intersecting data, not just the unique values
I thought that I understood Intersect, but it turns out I was wrong.
List list1 = new List() { 1, 2, 3, 2, 3};
List list2 = new List() { 2, 3, 4, 3, 4};
list1.Intersect(list2) => 2,3
//But what I want is:
// => …

Peterdk
- 15,625
- 20
- 101
- 140
13
votes
4 answers
Efficient set intersection - decide whether the intersection is larger than k
I am faced with a problem where I have to calculate intersections between all pairs in a collection of sets. None of the sets are smaller than a small constant k, and I'm only interested in whether two sets have an intersection larger than k-1…

Tamás
- 47,239
- 12
- 105
- 124
13
votes
2 answers
Event when two SVG elements touch
Is it possible in SVG, using any method, to call an even if two specific elements touch? Or would I have to code the long way, and figure out if their borders touch with complicated maths?

mortalc
- 525
- 1
- 5
- 9
13
votes
2 answers
Efficient, or fast, size of the set intersection of two vectors
I find myself needing to return the size of the intersection of two vectors:
std::vector A_, B_
I do not require the intersected values, just the size of the set. This function needs to be called a very large number of times. This is part of a…

Rusan Kax
- 1,894
- 2
- 13
- 17