Skip to content

Implemented ellipse-rectangle intersection test #3833

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

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

alecarraro
Copy link
Contributor

Added a specialized isdisjoint method for 2d Hyperrectangle and Ellipsoid intersection tests
(issue2064)

Copy link
Member

@schillic schillic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The implementation does not fully work.

julia> R5 = Hyperrectangle(N[0.0, 0.0], N[1.0, 1.0]);
julia> El5 = Ellipsoid(N[2.0, -2.0], Diagonal(N[1.9, 1.9]));
julia> isdisjoint(R5, El5)
false

Comment on lines +631 to +632
David Eberly, “Distance Between a Point and an Ellipse, an Ellipsoid, or a Hyperellipsoid”,
Geometric Tools, 2015. https://www.geometrictools.com/Documentation/DistancePointEllipseEllipsoid.pdf
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where exactly can I find the algorithm in that reference?

Comment on lines +627 to +631
### Notes
It works only for 2D axis-aligned rectangles and ellipsoids.

### Reference
David Eberly, “Distance Between a Point and an Ellipse, an Ellipsoid, or a Hyperellipsoid”,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
### Notes
It works only for 2D axis-aligned rectangles and ellipsoids.
### Reference
David Eberly, “Distance Between a Point and an Ellipse, an Ellipsoid, or a Hyperellipsoid”,
### Notes
It works only for 2D axis-aligned rectangles and ellipsoids.
### Reference
David Eberly, “Distance Between a Point and an Ellipse, an Ellipsoid, or a Hyperellipsoid”,

@assert dim(H) == dim(E) == 2 "$H and $E must both have 2 dimensions."

# center to the origin
H_trans = translate(H, -H.center)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You do not need H_trans. You can just use H and modify the center of bbox.

Comment on lines +643 to +646
bbox = overapproximate(H_trans ⊕ E_trans, Hyperrectangle)
if any(abs.(K) .> bbox.radius)
return true
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this first part necessary? It sounds more expensive to compute than the rest of the method.

@schillic schillic marked this pull request as draft May 23, 2025 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants