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
22
votes
3 answers
Calculation of intersections between line segments
I need help to understand how to calculate intersections. I have read several of the questions here and looked at several examples on other websites, but I'm still confused and don't get it, and I don't like to copy and paste code without…

3D-kreativ
- 9,053
- 37
- 102
- 159
22
votes
1 answer
how to intersect two arrays in objective C?
I have two arrays . Array1 contains 15 objects and Array2 contains 4 objects. There are 2 common objects from both array, I just want to get that resulted array of that 2 objects.
It should be like intersection of two Set, but how to do in…

Dishant
- 917
- 2
- 8
- 25
21
votes
6 answers
Find the shortest distance between a point and line segments (not line)
I have set of line segments (not lines), (A1, B1), (A2, B2), (A3, B3), where A,B are ending points of the line segment. Each A and B has (x,y) coordinates.
QUESTION:
I need to know the shortest distance between point O and line segments as shown in…

Spider
- 967
- 3
- 14
- 35
21
votes
4 answers
MySQL - Is it possible to get 'the difference' of two query results?
I need to merge two query results as in union, but I want to only keep the difference between the two results. Is this possible?
I am basically selecting ALL resources in Query 1, and NOT-ALLOWED resources in Query 2, I obviously need the ALLOWED…

Ropstah
- 17,538
- 24
- 120
- 194
21
votes
5 answers
calculating the point of intersection of two lines
I have dynamically generated lines that animate and I want to detect when a lines hits another. I'm trying to implement some basic linear algebra to obtain the equation of the lines and then solving for x,y, but the results are erratic. At this…

Adam
- 8,849
- 16
- 67
- 131
20
votes
2 answers
Set difference in C++
If I know that one set is a subset of another set and I would like to find the difference, what's the most efficient way to do this?
ex.
PSEUDO CODE
> set set1 = {1 2 3 4 5 6 7 8 9 10}
> set set2 = {5 6 7}
I want to subtract set2 from…

user620189
- 2,595
- 7
- 21
- 19
20
votes
5 answers
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,…

Daddy Warbox
- 4,500
- 9
- 41
- 56
20
votes
1 answer
Line intersection with AABB Rectangle?
Preferably without using any kind of loop, as this'll be used in a game.
I wish to intersect a line with a rectangle, of arbitrary size.
But I also wish for the intersection point[s] to be returned.
It's possible, I've done a little googling, but…

Steffan Donal
- 2,244
- 4
- 24
- 47
20
votes
7 answers
python date interval intersection
As a matter of general interest I'm wondering if there's a more elegant/efficient way to do this. I have a function that compares two start/end tuples of dates returning true if they intersect.
from datetime import date
def date_intersection(t1,…

jjon
- 680
- 1
- 8
- 23
18
votes
5 answers
Typescript: understanding union and Intersection types
I am trying to get an intuition about Union and Intersection types in typescript, but I can't figure out this case: Playground Link
interface A {
a: number;
}
interface B{
b: boolean;
}
type UnionCombinedType = A | B;
type…

niryo
- 1,275
- 4
- 15
- 26
18
votes
2 answers
Intersect two arrays
How can I find the intersecttion between 2 arrays in C#, in a fast way?

Haim Evgi
- 123,187
- 45
- 217
- 223
18
votes
4 answers
Quickest algorithm for finding sets with high intersection
I have a large number of user IDs (integers), potentially millions. These users all belong to various groups (sets of integers), such that there are on the order of 10 million groups.
To simplify my example and get to the essence of it, let's…

conradlee
- 12,985
- 17
- 57
- 93
18
votes
4 answers
Java collision detection between two Shape objects?
I would like to know the best way to tell if a Shape object intersects another shape.
Currently I have collision detection in my game sorted out as long as it involves a Shape intersecting a Rectangle or vice versa. The problem I'm having is that…

Monkeybro10
- 267
- 1
- 4
- 8
17
votes
2 answers
Intersection of two Counters
I'm trying to find the shared elements (and the shared number of occurrences) between two lists. For example, the intersection of these two lists:
a = [1, 1, 2, 3, 4, 5, 6, 7, 8, 1]
b = [1, 1, 3, 5, 7, 9]
should return Counter({1: 2, 3: 1, 5: 1, 7:…

MSeifert
- 145,886
- 38
- 333
- 352
16
votes
3 answers
Intersection types with Typescript
I have two union types:
type TypeA = string | number;
type TypeB = string | boolean;
I create an intersection type using the above:
type Combined = TypeA & TypeB;
Naturally, the Combined type will only be of type string, since it's the only type…

gmwill934
- 609
- 1
- 10
- 27