Questions tagged [intersection]

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.

2483 questions
13
votes
4 answers

C++ - Finding intersection of two ranges

What is the best way to find the intersection of two ranges in C++? For example, if I have one range as [1...20] inclusive, and another as [13...45] inclusive, I want to get [13...20], as that is the intersection between them. I thought about using…
1110101001
  • 4,662
  • 7
  • 26
  • 48
13
votes
1 answer

Intersect dataframe on multiple columns

I have 2 dataframes: dat: 1900 obs of 9 variables V1 V2 V3 V4 V5 V6 V7 V8 V9 1 V_P50P50_Q3 chr12 106642383 106642395 + 18.1425 4.03e-08 0.0515 GGGGGACTCCCCC 2 V_P50RELAP65_Q5_01 …
Komal Rathi
  • 4,164
  • 13
  • 60
  • 98
13
votes
1 answer

Finding the intersection of two 3D polygons

a.k.a. Polygon clipping algorithm in 3D a.k.a. Finding the collision manifold between 2 colliding polygons Most algorithms for polygon clipping are described in detail for 2D and described as being extendable to 3D but without details. For example…
Richard Tingle
  • 16,906
  • 5
  • 52
  • 77
13
votes
2 answers

Python list intersection with non unique items

I have two strings and I would like to have the intersection on them including duplicate items: str_a = "aabbcc" str_b = "aabd" list(set(str_a) & set(str_b)) >> "ab" I would like to have it return: >> "aab" Any ideas?
RickyA
  • 15,465
  • 5
  • 71
  • 95
12
votes
3 answers

Intersection of multiple arrays in PostgreSQL

I have a view defined as: CREATE VIEW View1 AS SELECT Field1, Field2, array_agg(Field3) AS AggField FROM Table1 GROUP BY Field1, Field2; What I would like to do is get the intersection of the arrays in AggField with something like: SELECT…
DanielGibbs
  • 9,910
  • 11
  • 76
  • 121
12
votes
5 answers

Java- Intersection point of a Polygon and Line

Is there any function that will give me the intersection point of a Polygon and Line2D ? I have a Polygon and a line segment that I know intersect I want the actual value of the intersection point not a boolean answer.
bryan
  • 385
  • 2
  • 4
  • 7
12
votes
3 answers

Finding common elements between multiple dataframe columns

Hope you could help me. I am new to python and pandas, so please bear with me. I am trying to find the common word between three data frames and I am using Jupiter Notebook. Just for example: df1= A dog cat cow…
Tikku
  • 137
  • 1
  • 1
  • 6
12
votes
4 answers

Intersection between line and triangle in 3D

I have a line and a triangle somewhere in 3D space. In other words, I have 3 points ([x,y,z] each) for the triangle, and two points (also [x,y,z]) for the line. I need to figure out a way, hopefully using C++, to figure out if the line ever crosses…
Kaito Kid
  • 983
  • 4
  • 15
  • 34
12
votes
4 answers

finding point of intersection in R

I have 2 vectors: set.seed(1) x1 = rnorm(100,0,1) x2 = rnorm(100,1,1) I want to plot these as lines and then find the intersection points of the lines, also if there are multiple points of intersection then I want to locate each of them. I have…
SBS
  • 159
  • 1
  • 2
  • 8
12
votes
4 answers

f# Intersection of lists

let rec mem list x = match list with | [] -> false | head :: tail -> if x = list.Head then true else mem list.Tail x The function mem takes a list and a…
Bobson
  • 233
  • 3
  • 12
12
votes
3 answers

How to check intersection between a line and a rectangle?

The title says it all, Ive been searching around and couldnt find anything that was straight and to the point. How would I take a line with points (x1,y1) & (x2, y2) and check its intersection between a rectangle (xR,yR)? I saw in the Line2D package…
Code Doggo
  • 2,146
  • 6
  • 33
  • 58
12
votes
3 answers

Java method to find the rectangle that is the intersection of two rectangles using only left bottom point, width and height?

I have found the solution but wanted to ensure my logic is the most efficient. I feel that there is a better way. I have the (x,y) coordinate of the bottom left corner, height and width of 2 rectangles, and i need to return a third rectangle that is…
Doug B
  • 175
  • 1
  • 1
  • 7
12
votes
1 answer

Polygon Intersection with Line | Python Shapely

I have been trying to use shapely to find the intersection of a line and a polygon, but I'm having issues with some floating point numbers. Example code: polygon = [(4.0, -2.0), (5.0, -2.0), (4.0, -3.0), (3.0, -3.0), (4.0, -2.0)] shapely_poly =…
lisaah
  • 623
  • 1
  • 4
  • 14
11
votes
2 answers

Calculate if two infinite regex solution sets don't intersect

In calculate if two arbitrary regular expressions have any overlapping solutions (assuming it's possible). For example these two regular expressions can be shown to have no intersections by brute force because the two solution sets are calculable…
Kendall Hopkins
  • 43,213
  • 17
  • 66
  • 89
11
votes
2 answers

Drawing outline of intersecting circles

I have a set of points and each one has an area of "influence" or essentially a radius. I would like to be able to draw each one of these influence circles for all the points as a simple circular line. They will overlap however I wish to draw the…
iexus
  • 677
  • 11
  • 26