Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ngon-Segment intersection in 2D #646

Open
tomerarnon opened this issue Dec 5, 2023 · 4 comments
Open

Ngon-Segment intersection in 2D #646

tomerarnon opened this issue Dec 5, 2023 · 4 comments
Labels
feature help wanted Extra attention is needed

Comments

@tomerarnon
Copy link

julia> r = Rope(Point(1, 0), Point(1, 1), Point(2, 1));

julia> q = Quadrangle(Point(0,0), Point(0, 1), Point(1, 1), Point(1, 0));

julia> intersection(q, r)
ERROR: StackOverflowError:
Stacktrace:
 [1] intersection(f::Function, g₁::Quadrangle{2, Float64}, g₂::Rope{2, Float64, Vector{Point2}})
   @ Meshes ~/.julia/packages/Meshes/w8yhV/src/intersections.jl:100
 [2] intersection(f::Function, g₁::Rope{2, Float64, Vector{Point2}}, g₂::Quadrangle{2, Float64})
   @ Meshes ~/.julia/packages/Meshes/w8yhV/src/intersections.jl:100

julia> b = Box(Point(0,0), Point(1,1));

julia> intersection(b, r)
ERROR: StackOverflowError:
Stacktrace:
 [1] intersection(f::Function, g₁::Box{2, Float64}, g₂::Rope{2, Float64, Vector{Point2}})
   @ Meshes ~/.julia/packages/Meshes/w8yhV/src/intersections.jl:100
 [2] intersection(f::Function, g₁::Rope{2, Float64, Vector{Point2}}, g₂::Box{2, Float64})
   @ Meshes ~/.julia/packages/Meshes/w8yhV/src/intersections.jl:100

Related to #644. In my application, I would like to use a Rope to represent a "path", and I would like to find intersections between that path and a number of geometries. At the moment, those are segments, ngons (probably only rectangles), and other ropes.

I guess the stackoverlow is a red herring for any missing method: #246

@tomerarnon tomerarnon changed the title Stackoverflow with intersection involving ropes (with Box, Ngon) Stackoverflow with intersection involving ropes (with Box, Ngon) on master Dec 5, 2023
@tomerarnon
Copy link
Author

Intersections of Box/Ngon with Segment is also missing (I wanted to see whether I could process the Rope as a series of segments).

@juliohm juliohm added help wanted Extra attention is needed feature labels Dec 6, 2023
@juliohm juliohm changed the title Stackoverflow with intersection involving ropes (with Box, Ngon) on master Intersection between Rope and Ngon Dec 6, 2023
@juliohm
Copy link
Member

juliohm commented Dec 6, 2023

In the 2D case we need a new clipping algorithm between Segment and Ngon. We can then use this algorithm in the method with a Rope and a Ngon. The Box case should fallback to the Quadrangle case with convert(Quadrangle, box).

I am busy with other projects at the moment, and won't have the time to add these implementations in the following weeks. Feel free to propose algorithms as PRs for review.

@juliohm
Copy link
Member

juliohm commented Dec 6, 2023

Just to double check @tomerarnon, are you aware of our intersects predicate? It can check whether or not two geometries intersect without actually computing the intersection.

@tomerarnon
Copy link
Author

Yes!
intersects is great to rule out an intersection in some cases. But when one does exist, I need to get the point/s in some cases.

@juliohm juliohm changed the title Intersection between Rope and Ngon Ngon-Segment intersection in 2D Jul 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants