I have a collection of n 2D line segments in the plane, some non-orthogonal and possibly intersecting, which I am allowed to pre-process. I would like to be able to query to see if a given line segment (not in the collection) intersects any of the segments in the collection. Ideally I would like to know the number of intersections as well. How can this be done in o(n)?
2026-03-28 23:16:38.1774739798
How to query a collection of line segments to see if a given line segment intersects any of them
939 Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail At
1
There are 1 best solutions below
Related Questions in GEOMETRY
- Point in, on or out of a circle
- Find all the triangles $ABC$ for which the perpendicular line to AB halves a line segment
- How to see line bundle on $\mathbb P^1$ intuitively?
- An underdetermined system derived for rotated coordinate system
- Asymptotes of hyperbola
- Finding the range of product of two distances.
- Constrain coordinates of a point into a circle
- Position of point with respect to hyperbola
- Length of Shadow from a lamp?
- Show that the asymptotes of an hyperbola are its tangents at infinity points
Related Questions in COMPUTATIONAL-GEOMETRY
- Least Absolute Deviation (LAD) Line Fitting / Regression
- Why is the determinant test attractive for the Convex Hull algorithm?
- Geometry of the plane in 3D and cross product
- How can I give a polygon with exactly a given number of triangulations?
- How to draw an equilateral triangle inscribed in another triangle?
- An enclosing polygon with minimum area
- Merging overlapping axis-aligned rectangles
- Find algorithm to produce integer points in a polygon
- Closest line to a set of lines in 3D
- Why do we check $n^2 - n$ pairs of points in SlowConvexHull algorithm?
Related Questions in PLANE-GEOMETRY
- Euclidean Fifth Postulate
- Line coordinates from plane intersection
- Properties of a eclipse on a rotated plane to see a perfect circle from the original plane view?
- Perfect Pascal Mysticum Points
- Intersection of a facet and a plane
- Proving formula to find area of triangle in coordinate geometry.
- Prove that the intersection of a cylinder and a plane forms an ellipse
- Rank of Matrix , Intersection of 3 planes
- Composite of two rotations with different centers
- Can a plane be perpendicular in two other planes if those planes are not parallel to each other?
Trending Questions
- Induction on the number of equations
- How to convince a math teacher of this simple and obvious fact?
- Find $E[XY|Y+Z=1 ]$
- Refuting the Anti-Cantor Cranks
- What are imaginary numbers?
- Determine the adjoint of $\tilde Q(x)$ for $\tilde Q(x)u:=(Qu)(x)$ where $Q:U→L^2(Ω,ℝ^d$ is a Hilbert-Schmidt operator and $U$ is a Hilbert space
- Why does this innovative method of subtraction from a third grader always work?
- How do we know that the number $1$ is not equal to the number $-1$?
- What are the Implications of having VΩ as a model for a theory?
- Defining a Galois Field based on primitive element versus polynomial?
- Can't find the relationship between two columns of numbers. Please Help
- Is computer science a branch of mathematics?
- Is there a bijection of $\mathbb{R}^n$ with itself such that the forward map is connected but the inverse is not?
- Identification of a quadrilateral as a trapezoid, rectangle, or square
- Generator of inertia group in function field extension
Popular # Hahtags
second-order-logic
numerical-methods
puzzle
logic
probability
number-theory
winding-number
real-analysis
integration
calculus
complex-analysis
sequences-and-series
proof-writing
set-theory
functions
homotopy-theory
elementary-number-theory
ordinary-differential-equations
circles
derivatives
game-theory
definite-integrals
elementary-set-theory
limits
multivariable-calculus
geometry
algebraic-number-theory
proof-verification
partial-derivative
algebra-precalculus
Popular Questions
- What is the integral of 1/x?
- How many squares actually ARE in this picture? Is this a trick question with no right answer?
- Is a matrix multiplied with its transpose something special?
- What is the difference between independent and mutually exclusive events?
- Visually stunning math concepts which are easy to explain
- taylor series of $\ln(1+x)$?
- How to tell if a set of vectors spans a space?
- Calculus question taking derivative to find horizontal tangent line
- How to determine if a function is one-to-one?
- Determine if vectors are linearly independent
- What does it mean to have a determinant equal to zero?
- Is this Batman equation for real?
- How to find perpendicular vector to another vector?
- How to find mean and median from histogram
- How many sides does a circle have?
Theorem 3 in this paper of Chazelle says: given $n$ line segments and $O(n^2)$ preprocessing time, you can find all intersections between those and another line segment in $O(\log n+t)$ time where $t$ is the number of intersections.
This isn't exactly what you're after (in the case where there are many intersections it will not take time $o(n)$; obviously nothing that actually reports the intersections could, but perhaps something that merely determines whether there are any could) but it might be near enough for your application.
Hmm, actually we can adapt this to solve the easier version of your problem (i.e., without counting) too, though I make no claim it's anything like optimal even if Chazelle's algorithm is optimal for the problem he's solving. Take your $n$ line segments, divide them into (say) $\sqrt n$ groups of size $\sqrt n$, preprocess them separately, and when a new line segment comes along apply Chazelle's procedure to the groups one at a time. Stop as soon as you find any intersection. This never takes longer than $O(\sqrt n \log n)$.
I suspect (but have made no attempt to check) that actually Chazelle's argument solves the easier version of your problem in time $O(\log n)$ if you just make it stop as soon as it finds any intersection.
What about the harder version (counting)? Chazelle's paper has a brief section about counting, but considers only the question of counting all the intersections among $n$ line segments, which he can do in time $O(n^{1.695})$. I don't know (and have made no attempt to check) whether his technique can be adapted to count intersections in your scenario in time $o(n)$, but it might be worth a look.
That paper is from 1986. Some of the results in it have been improved since then. I don't know whether any of those improvements lead to better solutions to either version of your problem. (The ones I found with a quick search don't look as if they do.)