#### Category : intersection

I am attempting to find the intersections of many polygons_with_holes to check the topology of a map. However, when using the CGAL::intersection() defined here (under 2D Regularized Boolean Set-Operations), the run time for one check exceeds 1 minute, sometimes reaching close to 2 minutes. I have about 60-70 polygons with holes, with a total of ..

Read more

I have two vectors containing integers, I can get an intersection of those vectors, but that only gives me the values, I also want to know the index positions/keys of the original items. How can I do this? I have tried to use lower_bound to search each vector for the items in the intersection to ..

Read more

I’m new here ! I just learned at school how to use vectors ! I wrote the code that I wrote on paper in c++ and I got a complete mess ! Basically what I need to do is find the elements that are also in vector A and vector B . I am attaching ..

Read more

There are two sets of segments M and N. There are requests to add segments to these sets. After each request, I need to print how many intersections are there in the total. How to do it in O(log|M|+log|N|)? Source: Windows Que..

Read more

I am trying to figure out how to calculate the point of intersection between two line segments – if it exists. However, I would like to know if the intersection exists for two line segments in their current form. For eg: Two lines if they are not parallel, will meet at some point if we ..

Read more

These are my answers for a codeforces problem and I don’t know why the first snippet gives a wrong answer. The second is accepted though. I want to know if there is a problem with the judgment test cases because they seem to give the same output. The problem says the following: Given the boundaries ..

Read more

I’m trying to check if there’s an intersection between a four-sided frustum that’s composed of a top, bottom, left and right plane (no near or far plane) and an oriented bounding box in 3D using C++. The result should be true if any part of the OBB is inside the frustum even only partially and ..

Read more

I have a frustum made of six planes, normals all pointing inwards. I can check if a point is inside the frustum with this function: char ClassifyPoint(float x, float y, float z, char thePlane) { Vector& aPos=mPlane[thePlane].mPos; Vector& aNorm=mPlane[thePlane].mNormal; float aD=(aPos.mX-x)*aNorm.mX+(aPos.mY-y)*aNorm.mY+(aPos.mZ-z)*aNorm.mZ; if (aD<-0.0005f) return 1;if (aD>0.0005f) return -1;return 0; } Which gives me -1, 0, ..

Read more

I am trying to use floats instead of doubles with standard Boost.Geometry Intersection method. But this code crashes, if I just change everything to floats already in the first loop. With double it works without problem. This is the error and the code: Unhandled Exception: System.AccessViolationException: Attempted to read or write protected memory. This is ..

Read more

I am new to C++. I have two vector<pair<int, float>> A and B in C++. A = <<1,1.5>, <2, 0.2>, <3, 1.5>>. B = <<1,0.8>, <1, 0.2>, <4, 1.5>>. I want to get the pairs with common first element from A and B, that is C = <<1,0.8>, <1, 0.2>, <1,1.5>>. I tried this #include ..

Read more