ellipsoid_tree 0.1.0
Exact intersection tests for ellipsoids and friends
Loading...
Searching...
No Matches
ellipsoid_tree Namespace Reference

Classes

class  AABBTree
 Axis-aligned bounding box (AABB) tree over a set of leaf boxes. More...
 
struct  Ball
 Ball {x : ||x - center|| <= radius}. More...
 
class  BallTree
 Spatial index over a collection of balls. More...
 
struct  Box
 Axis-aligned box {x : lo <= x <= hi componentwise}. More...
 
struct  BoxClosestPointOptions
 Options controlling the iterative (M-metric) closest_point_in_box solve. More...
 
class  BoxTree
 Spatial index over a collection of axis-aligned boxes. More...
 
struct  ClosestPointResult
 Result of a closest-point query: the closest point and its squared distance. More...
 
struct  Color
 An RGBA color with components in [0, 1]. More...
 
struct  DrawKDTreeOptions
 Options controlling what draw_kdtree renders and how. More...
 
struct  DrawTreeOptions
 Options controlling what draw_tree renders and how. More...
 
struct  Ellipsoid
 Ellipsoid E(tau) = {x : (x - mu)^T Sigma^{-1} (x - mu) <= tau^2}. More...
 
class  EllipsoidTree
 Spatial index over a collection of ellipsoids sharing a fixed scale tau. More...
 
struct  FieldOptions
 Options controlling how draw_cg1_field maps field values to colors. More...
 
struct  Halfspace
 Halfspace {x : normal . x <= offset} (query object only; not a tree element type). More...
 
class  KDTree
 k-nearest-neighbor kd-tree over a fixed set of points. More...
 
class  Plot2D
 A world-coordinate 2D scene of drawable primitives with SVG and PNG writers. More...
 
struct  RenderedImage
 An in-memory RGB raster produced by Plot2D::render_rgb. More...
 
struct  Segment
 Line segment from a to b (query object only; not a tree element type). More...
 
struct  Simplex
 Simplex conv(V.col(0), ..., V.col(K-1)): K vertices in R^dim, K <= dim+1. More...
 
class  SimplexMesh
 Simplicial mesh in R^d (cells are d-simplices) with point location, closest-point, CG1 evaluation, and ellipsoid queries. More...
 
class  SimplexTree
 Spatial index over a collection of simplices (e.g. a mesh). More...
 
struct  Style
 Stroke and fill styling for a drawn primitive. More...
 

Enumerations

enum class  TextAnchor { start , middle , end }
 Horizontal text alignment relative to the anchor point. More...
 

Functions

template<class PairPredicate , class LeafPairCallback >
bool visit_pairs (const AABBTree &A, const AABBTree &B, PairPredicate &&overlaps_pair, LeafPairCallback &&on_leaf_pair)
 Dual-tree simultaneous descent over two trees: overlaps_pair(loA, hiA, loB, hiB) prunes node pairs; on_leaf_pair(ext_a, ext_b) is called for surviving leaf pairs and stops everything by returning false.
 
template<class PairPredicate , class LeafPairCallback >
bool visit_self_pairs (const AABBTree &T, PairPredicate &&overlaps_pair, LeafPairCallback &&on_leaf_pair)
 Self-collision variant: visits each unordered pair of distinct leaves at most once.
 
std::vector< std::vector< int > > pick_ellipsoid_batches (const EllipsoidTree &tree, const Eigen::Ref< const Eigen::MatrixXd > &anchor_points, int max_batches=-1, int num_threads=0)
 Partition the ellipsoids of tree (at the tree's tau) into batches of mutually non-intersecting ellipsoids.
 
std::vector< std::vector< int > > pick_ellipsoid_batches (const EllipsoidTree &tree, int max_batches=-1, int num_threads=0)
 Convenience: use the ellipsoid centers as anchors.
 
std::vector< int > geometric_sort (const Eigen::Ref< const Eigen::MatrixXd > &points)
 Returns a permutation of {0, ..., N-1} placing the points (columns of the input) in axis-alternating geometric order.
 
Box bounding_box (const Eigen::Ref< const Eigen::VectorXd > &point)
 Degenerate bounding box of a single point (lo == hi == point).
 
Box bounding_box (const Box &B)
 Bounding box of a box (the box itself).
 
Box bounding_box (const Ball &B)
 Axis-aligned bounding box of a ball.
 
Box bounding_box (const Ellipsoid &E, double tau)
 Tight axis-aligned bounding box of an ellipsoid at scale tau: half-width tau * sqrt(Sigma_kk) along axis k.
 
Box bounding_box (const Simplex &S)
 Axis-aligned bounding box of a simplex (componentwise min/max of its vertices).
 
Box bounding_box (const Segment &S)
 Axis-aligned bounding box of a segment.
 
std::pair< Eigen::MatrixXd, Eigen::VectorXd > simplex_transform (const Eigen::Ref< const Eigen::MatrixXd > &V)
 Affine (barycentric) coordinate operator of a simplex.
 
ClosestPointResult closest_point_in_simplex (const Eigen::Ref< const Eigen::VectorXd > &p, const Eigen::Ref< const Eigen::MatrixXd > &V, const Eigen::Ref< const Eigen::MatrixXd > &M)
 Closest point to p in the solid simplex conv(V), in the metric ||y||_M^2 = y^T M y with M symmetric positive definite.
 
ClosestPointResult closest_point_in_simplex (const Eigen::Ref< const Eigen::VectorXd > &p, const Eigen::Ref< const Eigen::MatrixXd > &V)
 Euclidean special case (M = I).
 
ClosestPointResult closest_point_in_box (const Eigen::Ref< const Eigen::VectorXd > &p, const Box &B)
 Closest point to p in the box, Euclidean metric: clamping, exact.
 
ClosestPointResult closest_point_in_box (const Eigen::Ref< const Eigen::VectorXd > &p, const Box &B, const Eigen::Ref< const Eigen::MatrixXd > &M, BoxClosestPointOptions opts=BoxClosestPointOptions())
 Closest point to p in the box, in the metric ||y||_M^2 = y^T M y with M symmetric positive definite.
 
bool intersects (const Eigen::Ref< const Eigen::VectorXd > &p, const Box &B)
 Whether point p lies in box B (componentwise coordinate-bounds test).
 
bool intersects (const Eigen::Ref< const Eigen::VectorXd > &p, const Ball &B)
 Whether point p lies in ball B (distance to center vs radius).
 
bool intersects (const Eigen::Ref< const Eigen::VectorXd > &p, const Ellipsoid &E, double tau)
 Whether point p lies in ellipsoid E(tau) (Mahalanobis test via an LDLT solve).
 
bool intersects (const Eigen::Ref< const Eigen::VectorXd > &p, const Halfspace &H)
 Whether point p lies in halfspace H (closed-form normal . p <= offset).
 
bool intersects (const Box &A, const Box &B)
 Whether boxes A and B overlap (per-axis interval overlap).
 
bool intersects (const Box &A, const Ball &B)
 Whether box A and ball B overlap (distance from the center to its clamped closest point in the box vs radius).
 
bool intersects (const Box &A, const Halfspace &H)
 Whether box A meets halfspace H (support function: min of normal . x over the box vs offset).
 
bool intersects (const Ball &A, const Ball &B)
 Whether balls A and B overlap (center distance vs the sum of radii).
 
bool intersects (const Ball &A, const Halfspace &H)
 Whether ball A meets halfspace H (closed-form support-function comparison against the offset).
 
bool intersects (const Ellipsoid &E, const Halfspace &H, double tau)
 Whether ellipsoid E(tau) meets halfspace H (support test: normal . mu - tau*sqrt(normal^T Sigma normal) vs offset).
 
bool intersects (const Simplex &S, const Halfspace &H)
 Whether simplex S meets halfspace H (support function: min of normal . x over the vertices vs offset).
 
bool intersects (const Segment &S, const Box &B)
 Whether segment S meets box B (slab method along the segment's parameter).
 
bool intersects (const Segment &S, const Ball &B)
 Whether segment S meets ball B (distance from its closest point to the center vs radius).
 
bool intersects (const Segment &S, const Ellipsoid &E, double tau)
 Whether segment S meets ellipsoid E(tau) (closed-form 1D minimization of the Mahalanobis quadratic over the segment).
 
bool intersects (const Eigen::Ref< const Eigen::VectorXd > &p, const Simplex &S)
 Point in simplex.
 
bool intersects (const Ball &B, const Simplex &S)
 Whether ball B and simplex S overlap (Euclidean distance from the center to the simplex, via face enumeration, vs radius).
 
bool intersects (const Segment &seg, const Simplex &S)
 Whether segment seg meets simplex S (coordinate-interval feasibility for a full-dimensional simplex, else a tolerance-based 1D distance minimization).
 
bool intersects (const Simplex &A, const Simplex &B)
 Simplices A and B intersect iff some point is a convex combination of both vertex sets: exists alpha, beta >= 0 with sum(alpha) = sum(beta) = 1 and V_A alpha = V_B beta — a linear feasibility problem.
 
bool intersects (const Box &A, const Simplex &S)
 Box and simplex intersect iff exists alpha >= 0, sum(alpha) = 1, with lo <= V alpha <= hi; the two-sided bound becomes equalities with slack variables s, t >= 0: V alpha - s = lo, s + t = hi - lo.
 
bool intersects (const Ellipsoid &A, const Ellipsoid &B, double tau)
 Exact ellipsoid-ellipsoid overlap (Gilitschenski & Hanebeck 2014): with the generalized eigendecomposition Sigma_A Phi = Sigma_B Phi Lambda, Phi^T Sigma_B Phi = I, and v = Phi^T (mu_A - mu_B), the ellipsoids overlap iff min over s in [0,1] of K(s) = 1 - s(1-s)/tau^2 * sum_i v_i^2 / (1 + s (lambda_i - 1)) is nonnegative.
 
bool intersects (const Ball &B, const Ellipsoid &E, double tau)
 Whether ball B and ellipsoid E(tau) overlap: treats the ball as an ellipsoid (Sigma = (radius/tau)^2 I) and applies the Gilitschenski-Hanebeck test.
 
bool intersects (const Box &A, const Ellipsoid &E, double tau)
 Whether box A and ellipsoid E(tau) overlap (closest point to mu in the box under the Sigma^{-1} metric, by projected coordinate descent, vs tau^2).
 
bool intersects (const Ellipsoid &E, const Simplex &S, double tau)
 Whether ellipsoid E(tau) and simplex S overlap (closest point to mu in the simplex under the Sigma^{-1} metric, by face enumeration, vs tau^2).
 
bool intersects (const Box &B, const Eigen::Ref< const Eigen::VectorXd > &p)
 Overlap test between box and point (arguments reversed).
 
bool intersects (const Ball &B, const Eigen::Ref< const Eigen::VectorXd > &p)
 Overlap test between ball and point (arguments reversed).
 
bool intersects (const Ellipsoid &E, const Eigen::Ref< const Eigen::VectorXd > &p, double tau)
 Overlap test between ellipsoid E(tau) and point (arguments reversed).
 
bool intersects (const Simplex &S, const Eigen::Ref< const Eigen::VectorXd > &p)
 Overlap test between simplex and point (arguments reversed).
 
bool intersects (const Halfspace &H, const Eigen::Ref< const Eigen::VectorXd > &p)
 Overlap test between halfspace and point (arguments reversed).
 
bool intersects (const Ball &B, const Box &A)
 Overlap test between ball and box (arguments reversed).
 
bool intersects (const Ellipsoid &E, const Box &A, double tau)
 Overlap test between ellipsoid E(tau) and box (arguments reversed).
 
bool intersects (const Halfspace &H, const Box &A)
 Overlap test between halfspace and box (arguments reversed).
 
bool intersects (const Box &A, const Segment &S)
 Overlap test between box and segment (arguments reversed).
 
bool intersects (const Ellipsoid &E, const Ball &B, double tau)
 Overlap test between ellipsoid E(tau) and ball (arguments reversed).
 
bool intersects (const Simplex &S, const Ball &B)
 Overlap test between simplex and ball (arguments reversed).
 
bool intersects (const Halfspace &H, const Ball &B)
 Overlap test between halfspace and ball (arguments reversed).
 
bool intersects (const Ball &B, const Segment &S)
 Overlap test between ball and segment (arguments reversed).
 
bool intersects (const Simplex &S, const Ellipsoid &E, double tau)
 Overlap test between simplex and ellipsoid E(tau) (arguments reversed).
 
bool intersects (const Halfspace &H, const Ellipsoid &E, double tau)
 Overlap test between halfspace and ellipsoid E(tau) (arguments reversed).
 
bool intersects (const Ellipsoid &E, const Segment &S, double tau)
 Overlap test between ellipsoid E(tau) and segment (arguments reversed).
 
bool intersects (const Halfspace &H, const Simplex &S)
 Overlap test between halfspace and simplex (arguments reversed).
 
bool intersects (const Simplex &S, const Segment &seg)
 Overlap test between simplex and segment (arguments reversed).
 
bool intersects (const Simplex &S, const Box &A)
 Overlap test between simplex and box (arguments reversed).
 
std::vector< std::pair< int, int > > collision_pairs (const EllipsoidTree &A, const EllipsoidTree &B)
 Each tree's tau is folded into the covariances so differing scales are handled exactly.
 
std::vector< std::pair< int, int > > collision_pairs (const SimplexTree &A, const EllipsoidTree &B)
 Every intersecting simplex-ellipsoid pair between the two families, found in one simultaneous descent of both trees.
 
std::vector< std::pair< int, int > > collision_pairs (const BallTree &A, const EllipsoidTree &B)
 Every intersecting ball-ellipsoid pair between the two families, found in one simultaneous descent of both trees.
 
std::vector< std::pair< int, int > > collision_pairs (const BoxTree &A, const EllipsoidTree &B)
 Every intersecting box-ellipsoid pair between the two families, found in one simultaneous descent of both trees.
 
std::vector< std::pair< int, int > > collision_pairs (const BoxTree &A, const BoxTree &B)
 Every intersecting box-box pair between the two families, found in one simultaneous descent of both trees.
 
std::vector< std::pair< int, int > > collision_pairs (const BallTree &A, const BallTree &B)
 Every intersecting ball-ball pair between the two families, found in one simultaneous descent of both trees.
 
std::vector< std::pair< int, int > > collision_pairs (const BoxTree &A, const BallTree &B)
 Every intersecting box-ball pair between the two families, found in one simultaneous descent of both trees.
 
std::vector< std::pair< int, int > > collision_pairs (const BallTree &A, const SimplexTree &B)
 Every intersecting ball-simplex pair between the two families, found in one simultaneous descent of both trees.
 
std::vector< std::pair< int, int > > collision_pairs (const SimplexTree &A, const SimplexTree &B)
 Every intersecting simplex-simplex pair between the two families, found in one simultaneous descent of both trees.
 
std::vector< std::pair< int, int > > collision_pairs (const BoxTree &A, const SimplexTree &B)
 Every intersecting box-simplex pair between the two families, found in one simultaneous descent of both trees.
 
std::vector< std::pair< int, int > > collision_pairs (const EllipsoidTree &A, const SimplexTree &B)
 Every intersecting pair between the ellipsoids and the simplices (arguments reversed).
 
std::vector< std::pair< int, int > > collision_pairs (const EllipsoidTree &A, const BallTree &B)
 Every intersecting pair between the ellipsoids and the balls (arguments reversed).
 
std::vector< std::pair< int, int > > collision_pairs (const EllipsoidTree &A, const BoxTree &B)
 Every intersecting pair between the ellipsoids and the boxes (arguments reversed).
 
std::vector< std::pair< int, int > > collision_pairs (const BallTree &A, const BoxTree &B)
 Every intersecting pair between the balls and the boxes (arguments reversed).
 
std::vector< std::pair< int, int > > collision_pairs (const SimplexTree &A, const BallTree &B)
 Every intersecting pair between the simplices and the balls (arguments reversed).
 
std::vector< std::pair< int, int > > collision_pairs (const SimplexTree &A, const BoxTree &B)
 Every intersecting pair between the simplices and the boxes (arguments reversed).
 
Color colormap_viridis (double t)
 The viridis colormap, t in [0, 1].
 
void draw_tree (Plot2D &fig, const EllipsoidTree &T, DrawTreeOptions opts=DrawTreeOptions())
 Draw an EllipsoidTree's objects and its AABB node hierarchy.
 
void draw_tree (Plot2D &fig, const BoxTree &T, DrawTreeOptions opts=DrawTreeOptions())
 Draw a BoxTree's objects and its AABB node hierarchy.
 
void draw_tree (Plot2D &fig, const BallTree &T, DrawTreeOptions opts=DrawTreeOptions())
 Draw a BallTree's objects and its AABB node hierarchy.
 
void draw_tree (Plot2D &fig, const SimplexTree &T, DrawTreeOptions opts=DrawTreeOptions())
 Draw a SimplexTree's objects and its AABB node hierarchy.
 
void draw_elements (Plot2D &fig, const EllipsoidTree &T, const std::vector< int > &inds, const Style &style)
 Draw only the listed elements (e.g. the results of a collision query).
 
void draw_elements (Plot2D &fig, const BoxTree &T, const std::vector< int > &inds, const Style &style)
 Draw the listed box elements in the given style.
 
void draw_elements (Plot2D &fig, const BallTree &T, const std::vector< int > &inds, const Style &style)
 Draw the listed ball elements in the given style.
 
void draw_elements (Plot2D &fig, const SimplexTree &T, const std::vector< int > &inds, const Style &style)
 Draw the listed simplex elements in the given style.
 
void draw_batches (Plot2D &fig, const EllipsoidTree &T, const std::vector< std::vector< int > > &batches, double fill_alpha=0.3, double stroke_width=1.3)
 Ellipsoids colored by batch (from pick_ellipsoid_batches).
 
void draw_kdtree (Plot2D &fig, const KDTree &T, DrawKDTreeOptions opts=DrawKDTreeOptions())
 Draw a kd-tree: its recursive splitting lines and the stored points.
 
void draw_cg1_field (Plot2D &fig, const SimplexMesh &mesh, const Eigen::Ref< const Eigen::VectorXd > &vertex_values, FieldOptions opts=FieldOptions())
 Render a CG1 nodal field on a 2D SimplexMesh through the viridis colormap.
 

Enumeration Type Documentation

◆ TextAnchor

enum class ellipsoid_tree::TextAnchor
strong

Horizontal text alignment relative to the anchor point.

Enumerator
start 
middle 
end 

Function Documentation

◆ visit_pairs()

template<class PairPredicate , class LeafPairCallback >
bool ellipsoid_tree::visit_pairs ( const AABBTree A,
const AABBTree B,
PairPredicate &&  overlaps_pair,
LeafPairCallback &&  on_leaf_pair 
)

Dual-tree simultaneous descent over two trees: overlaps_pair(loA, hiA, loB, hiB) prunes node pairs; on_leaf_pair(ext_a, ext_b) is called for surviving leaf pairs and stops everything by returning false.

A far-apart pair of clusters costs a single box test instead of one traversal per element.

◆ visit_self_pairs()

template<class PairPredicate , class LeafPairCallback >
bool ellipsoid_tree::visit_self_pairs ( const AABBTree T,
PairPredicate &&  overlaps_pair,
LeafPairCallback &&  on_leaf_pair 
)

Self-collision variant: visits each unordered pair of distinct leaves at most once.

Expanding a diagonal pair (n, n) into (L,L), (R,R), (L,R) — and never (R,L) — is what guarantees the once-only property.

◆ pick_ellipsoid_batches() [1/2]

std::vector< std::vector< int > > ellipsoid_tree::pick_ellipsoid_batches ( const EllipsoidTree tree,
const Eigen::Ref< const Eigen::MatrixXd > &  anchor_points,
int  max_batches = -1,
int  num_threads = 0 
)
inline

Partition the ellipsoids of tree (at the tree's tau) into batches of mutually non-intersecting ellipsoids.

anchor_points (one column per ellipsoid) drive the farthest-point ordering. Every ellipsoid lands in exactly one batch; if max_batches > 0, stop after that many batches (later ellipsoids then remain unassigned).

◆ pick_ellipsoid_batches() [2/2]

std::vector< std::vector< int > > ellipsoid_tree::pick_ellipsoid_batches ( const EllipsoidTree tree,
int  max_batches = -1,
int  num_threads = 0 
)
inline

Convenience: use the ellipsoid centers as anchors.

◆ geometric_sort()

std::vector< int > ellipsoid_tree::geometric_sort ( const Eigen::Ref< const Eigen::MatrixXd > &  points)
inline

Returns a permutation of {0, ..., N-1} placing the points (columns of the input) in axis-alternating geometric order.

◆ bounding_box() [1/6]

Box ellipsoid_tree::bounding_box ( const Eigen::Ref< const Eigen::VectorXd > &  point)
inline

Degenerate bounding box of a single point (lo == hi == point).

◆ bounding_box() [2/6]

Box ellipsoid_tree::bounding_box ( const Box B)
inline

Bounding box of a box (the box itself).

◆ bounding_box() [3/6]

Box ellipsoid_tree::bounding_box ( const Ball B)
inline

Axis-aligned bounding box of a ball.

◆ bounding_box() [4/6]

Box ellipsoid_tree::bounding_box ( const Ellipsoid E,
double  tau 
)
inline

Tight axis-aligned bounding box of an ellipsoid at scale tau: half-width tau * sqrt(Sigma_kk) along axis k.

◆ bounding_box() [5/6]

Box ellipsoid_tree::bounding_box ( const Simplex S)
inline

Axis-aligned bounding box of a simplex (componentwise min/max of its vertices).

◆ bounding_box() [6/6]

Box ellipsoid_tree::bounding_box ( const Segment S)
inline

Axis-aligned bounding box of a segment.

◆ simplex_transform()

std::pair< Eigen::MatrixXd, Eigen::VectorXd > ellipsoid_tree::simplex_transform ( const Eigen::Ref< const Eigen::MatrixXd > &  V)
inline

Affine (barycentric) coordinate operator of a simplex.

Returns (A, b) such that alpha = A x + b are the affine coordinates of x, i.e. x = V alpha with sum(alpha) = 1 whenever x lies in the affine hull of the vertices. For a lower-dimensional simplex the coordinates are those of the orthogonal projection of x onto the affine hull.

◆ closest_point_in_simplex() [1/2]

ClosestPointResult ellipsoid_tree::closest_point_in_simplex ( const Eigen::Ref< const Eigen::VectorXd > &  p,
const Eigen::Ref< const Eigen::MatrixXd > &  V,
const Eigen::Ref< const Eigen::MatrixXd > &  M 
)
inline

Closest point to p in the solid simplex conv(V), in the metric ||y||_M^2 = y^T M y with M symmetric positive definite.

Exact up to roundoff: enumerates all faces (vertex subsets), M-projects p onto each face's affine hull, and returns the best projection that lands inside its face. The minimizer lies in the relative interior of some face, where the projection onto that face's hull is both feasible and optimal, so the scan always finds it; affinely-degenerate vertex configurations are covered by their nondegenerate subsets. Cost is O(2^K) small solves for K vertices — intended for K <= ~10.

◆ closest_point_in_simplex() [2/2]

ClosestPointResult ellipsoid_tree::closest_point_in_simplex ( const Eigen::Ref< const Eigen::VectorXd > &  p,
const Eigen::Ref< const Eigen::MatrixXd > &  V 
)
inline

Euclidean special case (M = I).

◆ closest_point_in_box() [1/2]

ClosestPointResult ellipsoid_tree::closest_point_in_box ( const Eigen::Ref< const Eigen::VectorXd > &  p,
const Box B 
)
inline

Closest point to p in the box, Euclidean metric: clamping, exact.

◆ closest_point_in_box() [2/2]

ClosestPointResult ellipsoid_tree::closest_point_in_box ( const Eigen::Ref< const Eigen::VectorXd > &  p,
const Box B,
const Eigen::Ref< const Eigen::MatrixXd > &  M,
BoxClosestPointOptions  opts = BoxClosestPointOptions() 
)
inline

Closest point to p in the box, in the metric ||y||_M^2 = y^T M y with M symmetric positive definite.

Projected cyclic coordinate descent, which converges to the unique minimizer for box constraints; the returned distance_squared is an achieved value (an upper bound on the true minimum that converges to it).

◆ intersects() [1/42]

bool ellipsoid_tree::intersects ( const Eigen::Ref< const Eigen::VectorXd > &  p,
const Box B 
)
inline

Whether point p lies in box B (componentwise coordinate-bounds test).

◆ intersects() [2/42]

bool ellipsoid_tree::intersects ( const Eigen::Ref< const Eigen::VectorXd > &  p,
const Ball B 
)
inline

Whether point p lies in ball B (distance to center vs radius).

◆ intersects() [3/42]

bool ellipsoid_tree::intersects ( const Eigen::Ref< const Eigen::VectorXd > &  p,
const Ellipsoid E,
double  tau 
)
inline

Whether point p lies in ellipsoid E(tau) (Mahalanobis test via an LDLT solve).

◆ intersects() [4/42]

bool ellipsoid_tree::intersects ( const Eigen::Ref< const Eigen::VectorXd > &  p,
const Halfspace H 
)
inline

Whether point p lies in halfspace H (closed-form normal . p <= offset).

◆ intersects() [5/42]

bool ellipsoid_tree::intersects ( const Box A,
const Box B 
)
inline

Whether boxes A and B overlap (per-axis interval overlap).

◆ intersects() [6/42]

bool ellipsoid_tree::intersects ( const Box A,
const Ball B 
)
inline

Whether box A and ball B overlap (distance from the center to its clamped closest point in the box vs radius).

◆ intersects() [7/42]

bool ellipsoid_tree::intersects ( const Box A,
const Halfspace H 
)
inline

Whether box A meets halfspace H (support function: min of normal . x over the box vs offset).

◆ intersects() [8/42]

bool ellipsoid_tree::intersects ( const Ball A,
const Ball B 
)
inline

Whether balls A and B overlap (center distance vs the sum of radii).

◆ intersects() [9/42]

bool ellipsoid_tree::intersects ( const Ball A,
const Halfspace H 
)
inline

Whether ball A meets halfspace H (closed-form support-function comparison against the offset).

◆ intersects() [10/42]

bool ellipsoid_tree::intersects ( const Ellipsoid E,
const Halfspace H,
double  tau 
)
inline

Whether ellipsoid E(tau) meets halfspace H (support test: normal . mu - tau*sqrt(normal^T Sigma normal) vs offset).

◆ intersects() [11/42]

bool ellipsoid_tree::intersects ( const Simplex S,
const Halfspace H 
)
inline

Whether simplex S meets halfspace H (support function: min of normal . x over the vertices vs offset).

◆ intersects() [12/42]

bool ellipsoid_tree::intersects ( const Segment S,
const Box B 
)
inline

Whether segment S meets box B (slab method along the segment's parameter).

◆ intersects() [13/42]

bool ellipsoid_tree::intersects ( const Segment S,
const Ball B 
)
inline

Whether segment S meets ball B (distance from its closest point to the center vs radius).

◆ intersects() [14/42]

bool ellipsoid_tree::intersects ( const Segment S,
const Ellipsoid E,
double  tau 
)
inline

Whether segment S meets ellipsoid E(tau) (closed-form 1D minimization of the Mahalanobis quadratic over the segment).

◆ intersects() [15/42]

bool ellipsoid_tree::intersects ( const Eigen::Ref< const Eigen::VectorXd > &  p,
const Simplex S 
)
inline

Point in simplex.

For a full-dimensional simplex (dim+1 vertices) this is the exact barycentric test; a degenerate (zero-volume) full-dimensional simplex yields false. For a lower-dimensional simplex, membership is a measure-zero question and is decided within a small relative tolerance.

◆ intersects() [16/42]

bool ellipsoid_tree::intersects ( const Ball B,
const Simplex S 
)
inline

Whether ball B and simplex S overlap (Euclidean distance from the center to the simplex, via face enumeration, vs radius).

◆ intersects() [17/42]

bool ellipsoid_tree::intersects ( const Segment seg,
const Simplex S 
)
inline

Whether segment seg meets simplex S (coordinate-interval feasibility for a full-dimensional simplex, else a tolerance-based 1D distance minimization).

◆ intersects() [18/42]

bool ellipsoid_tree::intersects ( const Simplex A,
const Simplex B 
)
inline

Simplices A and B intersect iff some point is a convex combination of both vertex sets: exists alpha, beta >= 0 with sum(alpha) = sum(beta) = 1 and V_A alpha = V_B beta — a linear feasibility problem.

Works for any vertex counts (arbitrary convex hulls of point sets), including lower-dimensional simplices, with the LP's epsilon-tolerance semantics.

◆ intersects() [19/42]

bool ellipsoid_tree::intersects ( const Box A,
const Simplex S 
)
inline

Box and simplex intersect iff exists alpha >= 0, sum(alpha) = 1, with lo <= V alpha <= hi; the two-sided bound becomes equalities with slack variables s, t >= 0: V alpha - s = lo, s + t = hi - lo.

◆ intersects() [20/42]

bool ellipsoid_tree::intersects ( const Ellipsoid A,
const Ellipsoid B,
double  tau 
)
inline

Exact ellipsoid-ellipsoid overlap (Gilitschenski & Hanebeck 2014): with the generalized eigendecomposition Sigma_A Phi = Sigma_B Phi Lambda, Phi^T Sigma_B Phi = I, and v = Phi^T (mu_A - mu_B), the ellipsoids overlap iff min over s in [0,1] of K(s) = 1 - s(1-s)/tau^2 * sum_i v_i^2 / (1 + s (lambda_i - 1)) is nonnegative.

Any s with K(s) < 0 certifies separation, so the minimization exits early on that evidence.

◆ intersects() [21/42]

bool ellipsoid_tree::intersects ( const Ball B,
const Ellipsoid E,
double  tau 
)
inline

Whether ball B and ellipsoid E(tau) overlap: treats the ball as an ellipsoid (Sigma = (radius/tau)^2 I) and applies the Gilitschenski-Hanebeck test.

◆ intersects() [22/42]

bool ellipsoid_tree::intersects ( const Box A,
const Ellipsoid E,
double  tau 
)
inline

Whether box A and ellipsoid E(tau) overlap (closest point to mu in the box under the Sigma^{-1} metric, by projected coordinate descent, vs tau^2).

◆ intersects() [23/42]

bool ellipsoid_tree::intersects ( const Ellipsoid E,
const Simplex S,
double  tau 
)
inline

Whether ellipsoid E(tau) and simplex S overlap (closest point to mu in the simplex under the Sigma^{-1} metric, by face enumeration, vs tau^2).

◆ intersects() [24/42]

bool ellipsoid_tree::intersects ( const Box B,
const Eigen::Ref< const Eigen::VectorXd > &  p 
)
inline

Overlap test between box and point (arguments reversed).

◆ intersects() [25/42]

bool ellipsoid_tree::intersects ( const Ball B,
const Eigen::Ref< const Eigen::VectorXd > &  p 
)
inline

Overlap test between ball and point (arguments reversed).

◆ intersects() [26/42]

bool ellipsoid_tree::intersects ( const Ellipsoid E,
const Eigen::Ref< const Eigen::VectorXd > &  p,
double  tau 
)
inline

Overlap test between ellipsoid E(tau) and point (arguments reversed).

◆ intersects() [27/42]

bool ellipsoid_tree::intersects ( const Simplex S,
const Eigen::Ref< const Eigen::VectorXd > &  p 
)
inline

Overlap test between simplex and point (arguments reversed).

◆ intersects() [28/42]

bool ellipsoid_tree::intersects ( const Halfspace H,
const Eigen::Ref< const Eigen::VectorXd > &  p 
)
inline

Overlap test between halfspace and point (arguments reversed).

◆ intersects() [29/42]

bool ellipsoid_tree::intersects ( const Ball B,
const Box A 
)
inline

Overlap test between ball and box (arguments reversed).

◆ intersects() [30/42]

bool ellipsoid_tree::intersects ( const Ellipsoid E,
const Box A,
double  tau 
)
inline

Overlap test between ellipsoid E(tau) and box (arguments reversed).

◆ intersects() [31/42]

bool ellipsoid_tree::intersects ( const Halfspace H,
const Box A 
)
inline

Overlap test between halfspace and box (arguments reversed).

◆ intersects() [32/42]

bool ellipsoid_tree::intersects ( const Box A,
const Segment S 
)
inline

Overlap test between box and segment (arguments reversed).

◆ intersects() [33/42]

bool ellipsoid_tree::intersects ( const Ellipsoid E,
const Ball B,
double  tau 
)
inline

Overlap test between ellipsoid E(tau) and ball (arguments reversed).

◆ intersects() [34/42]

bool ellipsoid_tree::intersects ( const Simplex S,
const Ball B 
)
inline

Overlap test between simplex and ball (arguments reversed).

◆ intersects() [35/42]

bool ellipsoid_tree::intersects ( const Halfspace H,
const Ball B 
)
inline

Overlap test between halfspace and ball (arguments reversed).

◆ intersects() [36/42]

bool ellipsoid_tree::intersects ( const Ball B,
const Segment S 
)
inline

Overlap test between ball and segment (arguments reversed).

◆ intersects() [37/42]

bool ellipsoid_tree::intersects ( const Simplex S,
const Ellipsoid E,
double  tau 
)
inline

Overlap test between simplex and ellipsoid E(tau) (arguments reversed).

◆ intersects() [38/42]

bool ellipsoid_tree::intersects ( const Halfspace H,
const Ellipsoid E,
double  tau 
)
inline

Overlap test between halfspace and ellipsoid E(tau) (arguments reversed).

◆ intersects() [39/42]

bool ellipsoid_tree::intersects ( const Ellipsoid E,
const Segment S,
double  tau 
)
inline

Overlap test between ellipsoid E(tau) and segment (arguments reversed).

◆ intersects() [40/42]

bool ellipsoid_tree::intersects ( const Halfspace H,
const Simplex S 
)
inline

Overlap test between halfspace and simplex (arguments reversed).

◆ intersects() [41/42]

bool ellipsoid_tree::intersects ( const Simplex S,
const Segment seg 
)
inline

Overlap test between simplex and segment (arguments reversed).

◆ intersects() [42/42]

bool ellipsoid_tree::intersects ( const Simplex S,
const Box A 
)
inline

Overlap test between simplex and box (arguments reversed).

◆ collision_pairs() [1/16]

std::vector< std::pair< int, int > > ellipsoid_tree::collision_pairs ( const EllipsoidTree A,
const EllipsoidTree B 
)
inline

Each tree's tau is folded into the covariances so differing scales are handled exactly.

◆ collision_pairs() [2/16]

std::vector< std::pair< int, int > > ellipsoid_tree::collision_pairs ( const SimplexTree A,
const EllipsoidTree B 
)
inline

Every intersecting simplex-ellipsoid pair between the two families, found in one simultaneous descent of both trees.

◆ collision_pairs() [3/16]

std::vector< std::pair< int, int > > ellipsoid_tree::collision_pairs ( const BallTree A,
const EllipsoidTree B 
)
inline

Every intersecting ball-ellipsoid pair between the two families, found in one simultaneous descent of both trees.

◆ collision_pairs() [4/16]

std::vector< std::pair< int, int > > ellipsoid_tree::collision_pairs ( const BoxTree A,
const EllipsoidTree B 
)
inline

Every intersecting box-ellipsoid pair between the two families, found in one simultaneous descent of both trees.

◆ collision_pairs() [5/16]

std::vector< std::pair< int, int > > ellipsoid_tree::collision_pairs ( const BoxTree A,
const BoxTree B 
)
inline

Every intersecting box-box pair between the two families, found in one simultaneous descent of both trees.

◆ collision_pairs() [6/16]

std::vector< std::pair< int, int > > ellipsoid_tree::collision_pairs ( const BallTree A,
const BallTree B 
)
inline

Every intersecting ball-ball pair between the two families, found in one simultaneous descent of both trees.

◆ collision_pairs() [7/16]

std::vector< std::pair< int, int > > ellipsoid_tree::collision_pairs ( const BoxTree A,
const BallTree B 
)
inline

Every intersecting box-ball pair between the two families, found in one simultaneous descent of both trees.

◆ collision_pairs() [8/16]

std::vector< std::pair< int, int > > ellipsoid_tree::collision_pairs ( const BallTree A,
const SimplexTree B 
)
inline

Every intersecting ball-simplex pair between the two families, found in one simultaneous descent of both trees.

◆ collision_pairs() [9/16]

std::vector< std::pair< int, int > > ellipsoid_tree::collision_pairs ( const SimplexTree A,
const SimplexTree B 
)
inline

Every intersecting simplex-simplex pair between the two families, found in one simultaneous descent of both trees.

◆ collision_pairs() [10/16]

std::vector< std::pair< int, int > > ellipsoid_tree::collision_pairs ( const BoxTree A,
const SimplexTree B 
)
inline

Every intersecting box-simplex pair between the two families, found in one simultaneous descent of both trees.

◆ collision_pairs() [11/16]

std::vector< std::pair< int, int > > ellipsoid_tree::collision_pairs ( const EllipsoidTree A,
const SimplexTree B 
)
inline

Every intersecting pair between the ellipsoids and the simplices (arguments reversed).

◆ collision_pairs() [12/16]

std::vector< std::pair< int, int > > ellipsoid_tree::collision_pairs ( const EllipsoidTree A,
const BallTree B 
)
inline

Every intersecting pair between the ellipsoids and the balls (arguments reversed).

◆ collision_pairs() [13/16]

std::vector< std::pair< int, int > > ellipsoid_tree::collision_pairs ( const EllipsoidTree A,
const BoxTree B 
)
inline

Every intersecting pair between the ellipsoids and the boxes (arguments reversed).

◆ collision_pairs() [14/16]

std::vector< std::pair< int, int > > ellipsoid_tree::collision_pairs ( const BallTree A,
const BoxTree B 
)
inline

Every intersecting pair between the balls and the boxes (arguments reversed).

◆ collision_pairs() [15/16]

std::vector< std::pair< int, int > > ellipsoid_tree::collision_pairs ( const SimplexTree A,
const BallTree B 
)
inline

Every intersecting pair between the simplices and the balls (arguments reversed).

◆ collision_pairs() [16/16]

std::vector< std::pair< int, int > > ellipsoid_tree::collision_pairs ( const SimplexTree A,
const BoxTree B 
)
inline

Every intersecting pair between the simplices and the boxes (arguments reversed).

◆ colormap_viridis()

Color ellipsoid_tree::colormap_viridis ( double  t)
inline

The viridis colormap, t in [0, 1].

◆ draw_tree() [1/4]

void ellipsoid_tree::draw_tree ( Plot2D fig,
const EllipsoidTree T,
DrawTreeOptions  opts = DrawTreeOptions() 
)
inline

Draw an EllipsoidTree's objects and its AABB node hierarchy.

◆ draw_tree() [2/4]

void ellipsoid_tree::draw_tree ( Plot2D fig,
const BoxTree T,
DrawTreeOptions  opts = DrawTreeOptions() 
)
inline

Draw a BoxTree's objects and its AABB node hierarchy.

◆ draw_tree() [3/4]

void ellipsoid_tree::draw_tree ( Plot2D fig,
const BallTree T,
DrawTreeOptions  opts = DrawTreeOptions() 
)
inline

Draw a BallTree's objects and its AABB node hierarchy.

◆ draw_tree() [4/4]

void ellipsoid_tree::draw_tree ( Plot2D fig,
const SimplexTree T,
DrawTreeOptions  opts = DrawTreeOptions() 
)
inline

Draw a SimplexTree's objects and its AABB node hierarchy.

◆ draw_elements() [1/4]

void ellipsoid_tree::draw_elements ( Plot2D fig,
const EllipsoidTree T,
const std::vector< int > &  inds,
const Style style 
)
inline

Draw only the listed elements (e.g. the results of a collision query).

◆ draw_elements() [2/4]

void ellipsoid_tree::draw_elements ( Plot2D fig,
const BoxTree T,
const std::vector< int > &  inds,
const Style style 
)
inline

Draw the listed box elements in the given style.

◆ draw_elements() [3/4]

void ellipsoid_tree::draw_elements ( Plot2D fig,
const BallTree T,
const std::vector< int > &  inds,
const Style style 
)
inline

Draw the listed ball elements in the given style.

◆ draw_elements() [4/4]

void ellipsoid_tree::draw_elements ( Plot2D fig,
const SimplexTree T,
const std::vector< int > &  inds,
const Style style 
)
inline

Draw the listed simplex elements in the given style.

◆ draw_batches()

void ellipsoid_tree::draw_batches ( Plot2D fig,
const EllipsoidTree T,
const std::vector< std::vector< int > > &  batches,
double  fill_alpha = 0.3,
double  stroke_width = 1.3 
)
inline

Ellipsoids colored by batch (from pick_ellipsoid_batches).

◆ draw_kdtree()

void ellipsoid_tree::draw_kdtree ( Plot2D fig,
const KDTree T,
DrawKDTreeOptions  opts = DrawKDTreeOptions() 
)
inline

Draw a kd-tree: its recursive splitting lines and the stored points.

◆ draw_cg1_field()

void ellipsoid_tree::draw_cg1_field ( Plot2D fig,
const SimplexMesh mesh,
const Eigen::Ref< const Eigen::VectorXd > &  vertex_values,
FieldOptions  opts = FieldOptions() 
)
inline

Render a CG1 nodal field on a 2D SimplexMesh through the viridis colormap.

The PNG backend interpolates colors barycentrically per pixel (a dependency-free tripcolor); the SVG backend uses flat per-triangle fill.