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
36
votes
14 answers

How to check intersection between 2 rotated rectangles?

Can someone explain how to check if one rotated rectangle intersect other rectangle?
Buron
  • 1,193
  • 2
  • 13
  • 23
34
votes
3 answers

Efficiently find points inside a circle sector

I have a set of 2d points distributed randomly. I need to perform a time intensive operation on a small subset of these points but I need to first figure out what points I need to perform this time intensive operation on. To determine what points I…
ApockofFork
  • 487
  • 1
  • 4
  • 10
31
votes
9 answers

How to intersect two polygons?

This seems non-trivial (it gets asked quite a lot on various forums), but I absolutely need this as a building block for a more complex algorithm. Input: 2 polygons (A and B) in 2D, given as a list of edges [(x0, y0, x1, y2), ...] each. The points…
Daren Thomas
  • 67,947
  • 40
  • 154
  • 200
29
votes
9 answers

Determining if two rays intersect

I have two rays on a 2D plane that extend to infinity, but both have a starting point. They are both described by a starting point and a vector in the direction of the ray extending to infinity. I want to find out if the two rays intersect, but I…
Faken
  • 11,352
  • 17
  • 59
  • 74
29
votes
3 answers

Vector intersection in C++

I have this function vector instersection(const vector &v1, const vector &v2); I have two vectors of strings and I want to find the strings that are present in both, which then fills a third vector with the common elemnts.…
Tyler
  • 1,933
  • 5
  • 18
  • 23
28
votes
2 answers

Intersection of two pandas dataframes based on column entries

Suppose I have two DataFrames like so: >>dfA S T prob 0 ! ! ! ! ! ! 8.1623999e-05 1 ! ! ! ! ! ! " 0.00354090007 2 ! ! ! ! ! ! . 0.00210241997 3 ! ! ! ! ! ! ? 6.55684998e-05 4 ! ! ! ! ! ! …
Bib
  • 425
  • 1
  • 4
  • 7
27
votes
3 answers

Efficient extraction of all sub-polygons generated by self-intersecting features in a MultiPolygon

Starting from a shapefile containing a fairly large number (about 20000) of potentially partially-overlapping polygons, I'd need to extract all the sub-polygons originated by intersecting their different "boundaries". In practice, starting from…
lbusett
  • 5,801
  • 2
  • 24
  • 47
27
votes
6 answers

Area of Intersection of Two Rotated Rectangles

I have two 2D rectangles, defined as an origin (x,y) a size (height, width) and an angle of rotation (0-360°). I can guarantee that both rectangles are the same size. I need to calculate the approximate area of intersection of these two…
Nate Thorn
  • 2,193
  • 2
  • 23
  • 27
26
votes
3 answers

Algorithm for determining whether a point is inside a 3D mesh

What is a fast algorithm for determining whether or not a point is inside a 3D mesh? For simplicity you can assume the mesh is all triangles and has no holes. What I know so far is that one popular way of determining whether or not a ray has…
Jeff Jenkins
  • 481
  • 1
  • 4
  • 7
26
votes
11 answers

2d game : fire at a moving target by predicting intersection of projectile and unit

Okay, this all takes place in a nice and simple 2D world... :) Suppose I have a static object A at position Apos, and a linearly moving object B at Bpos with bVelocity, and an ammo round with velocity Avelocity... How would I find out the angle that…
Led
  • 2,002
  • 4
  • 23
  • 31
25
votes
2 answers

Check if two line segments are colliding (only check if they are intersecting, not where)

I need a fast algorithm for checking if two non-infinite lines are crossing. Have to be fast because it'll run on a cell phone a lot. The algorithm do only have to return yes or no, it does not have to find out exactly where the lines cross! I have…
Mike
  • 301
  • 1
  • 4
  • 5
25
votes
7 answers

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.
user67424
  • 297
  • 1
  • 4
  • 6
24
votes
4 answers

How to intersect multiple sets?

I have this list: private List> scanList; So my list contains multiple scans as you can see. After each scan I add new set into the list. After all scans are finished I would like to take only the addresses that occur in every set and…
vale4674
  • 4,161
  • 13
  • 47
  • 72
22
votes
8 answers

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 {…
Mark Maxham
  • 1,501
  • 2
  • 13
  • 19
22
votes
5 answers

Ray-box Intersection Theory

I wish to determine the intersection point between a ray and a box. The box is defined by its min 3D coordinate and max 3D coordinate and the ray is defined by its origin and the direction to which it points. Currently, I am forming a plane for each…
Myx
  • 1,792
  • 5
  • 23
  • 37