SPHGROUP(nged)

create a group of all regions whose centers fall inside a sphere

πŸ“… published 7.44.0, from nixpkgs unstable

SPHGROUP(nged) β€” BRL-CAD User Commands β€” okay bestie, let's go. πŸ’–


✨ NAME ✨

SPHGROUP(nged) gives you sphgroup β€” create a group of all regions whose centers fall inside a sphere. No cap, it's giving spatial-search-but-make-it-a-combination energy. πŸ’…

🌸 SYNOPSIS 🌸

sphgroup gname target_sphere.s

πŸŽ€ DESCRIPTION πŸŽ€

okay so sphgroup creates a new combination called gname, and that combination contains all the regions in the database whose bounding-box center point lies within the bounding sphere defined by target_sphere.s. The sphere argument has to be an existing ELL or SPH primitive in the database, periodt.

Here's the tea on how it picks who gets in:

  • It scans all regions in the database β€” that means objects flagged as regions β€” and computes each region's axis-aligned bounding box. πŸ¦‹
  • A region is included in gname if the center of its bounding box is within or on the surface of target_sphere.s β€” specifically, if the distance from the bounding-box center to the sphere's center vertex is less than or equal to the sphere's radius. ⭐
  • Non-region objects, hidden objects, and the sphere primitive itself are skipped. πŸ™ˆ

All qualifying regions are added to gname as union (u) members with no item ID or air code set. If gname does not already exist, it is created; if it does exist, the new members are appended to it. 🫢

Note, bestie: the containment test uses the center of each region's bounding box, not all eight corners. A region whose center is outside the sphere is excluded even if part of its geometry overlaps the sphere. So yes, overlap alone does not save it β€” that's the documented behavior. 😭

πŸ”₯ EXAMPLES πŸ”₯

Example 1. Group all regions centered inside a sphere primitive

mged> sphgroup cluster.c search_sphere.s

This creates the combination cluster.c containing all regions whose bounding-box centers lie within the sphere primitive search_sphere.s. The sphere search_sphere.s must already exist in the database and must be an ELL or SPH primitive. πŸ’–

Example 2. First create the bounding sphere, then group

The page wraps this one in a lowkey cursed spot, so here's the exact text:

mged> make search_sphere.s sph mged> sphgroup nearby.c
search_sphere.s

This creates a unit sphere at the origin with make, then groups all regions centered within it into nearby.c. 🌈

πŸ‘‘ AUTHOR πŸ‘‘

BRL-CAD Team β€” iconic. πŸŽ€

πŸ“ BUG REPORTS πŸ“

If you find bugs or problems, the page says to report them via electronic mail to devs@brlcad.org. fr fr, tell the devs. πŸ’Œ


Cute footer sign-off: BRL-CAD made this page, the title is SPHGROUP(nged), and the footer did not give us a date β€” so no date invented here, bestie. πŸ’…πŸ«Ά

πŸ“¦ where this page comes from