sc::CS2Sphere(3)

πŸ“¦
version 2.3.1 Β· 4 versions
, in fedora 43, ubuntu noble

πŸ’– NAME πŸ’–

sc::CS2Sphere β€” bestie, this is the little sphere class that knows how to vibe-check other spheres. It's a 3D ball with a center and a radius, and it's obsessed with figuring out whether other spheres are touching it, overlapping it, or just orbiting nearby. Geometry queen energy πŸ‘‘βœ¨


πŸ¦‹ SYNOPSIS πŸ¦‹

Okay so here's the whole squad of member functions, no skips, no cuts, we're listing all of them because every single one ate πŸ’…

🌸 Public Member Functions 🌸

CS2Sphere (const SCVector3 &v, double rad)
CS2Sphere (double x, double y, double z, double rad)
void initialize (SCVector3 &v, double rad)
CS2Sphere & operator= (const CS2Sphere &s)
double distance (CS2Sphere &asphere)
double common_radius (CS2Sphere &asphere)
const SCVector3 & center (void) const
double x () const
double y () const
double z () const
SCVector3 center_vec (const SC2Sphere &asphere)
double radius (void) const
void recenter (const SCVector3 &v)
void print (std::ostream &os=ExEnv::out0()) const
int intersect (CS2Sphere *s, int n_spheres) const

πŸŽ€ Static Public Member Functions πŸŽ€

static void print_counts (std::ostream &=ExEnv::out0())

🧚 Static Public Attributes 🧚

static int n_no_spheres_
static int n_probe_enclosed_by_a_sphere_
static int n_probe_center_not_enclosed_
static int n_surface_of_s0_not_covered_
static int n_plane_totally_covered_
static int n_internal_edge_not_covered_
static int n_totally_covered_

🌈 DESCRIPTION 🌈

Not me about to explain a sphere like it's not the most iconic shape in all of geometry 😭 A sc::CS2Sphere is literally just a center plus a radius. You can build one from an SCVector3 and a radius, or from raw x, y, z coordinates and a radius β€” whichever feels more main character to you.

Then the fun part: it can measure how far away another sphere is, find a radius it shares with another sphere, hand you back its center (as a vector or as individual x, y, z values), and recenter itself onto a new vector if you need it to move. It can also print itself out, and it can intersect against an array of spheres to figure out what's going on β€” which is exactly the tea those static counters below are keeping track of. πŸ«–


✨ OPTIONS ✨

(okay technically these are constructors and member functions but we're treating them like the menu of choices they are, bestie)

  • CS2Sphere (const SCVector3 &v, double rad) β€” spin up a sphere from a center vector v and a radius rad. Instant glow-up 🌟
  • CS2Sphere (double x, double y, double z, double rad) β€” same energy, but you feed it the center as three loose doubles x, y, z plus the radius rad.
  • void initialize (SCVector3 &v, double rad) β€” set up the sphere in place from center vector v and radius rad.
  • CS2Sphere & operator= (const CS2Sphere &s) β€” copy another sphere s's whole vibe onto this one. Returns a reference to this sphere, so you can chain it like the icon you are πŸ’…
  • double distance (CS2Sphere &asphere) β€” how far apart are me and asphere? Returns the number, no drama.
  • double common_radius (CS2Sphere &asphere) β€” finds the radius that this sphere and asphere have in common.
  • const SCVector3 & center (void) const β€” hands you back a const reference to the center vector. Look, don't touch πŸ”’
  • double x () const β€” just the center's x-coordinate, bestie.
  • double y () const β€” just the center's y-coordinate. You knew that. πŸ’€
  • double z () const β€” and the z-coordinate, completing the trio ✨
  • SCVector3 center_vec (const SC2Sphere &asphere) β€” gives you a center vector computed with respect to asphere.
  • double radius (void) const β€” your radius. That's it. That's the function.
  • void recenter (const SCVector3 &v) β€” pack up and move the center to v. New location, same radius, same girl πŸ¦‹
  • void print (std::ostream &os=ExEnv::out0()) const β€” writes the sphere out to the stream os, which defaults to ExEnv::out0() if you don't wanna bother picking one.
  • int intersect (CS2Sphere *s, int n_spheres) const β€” the big one πŸ”₯ Checks this sphere against an array s of n_spheres spheres and returns an int. It tallies everything into the static counters listed below, so keep reading.
  • static void print_counts (std::ostream &=ExEnv::out0()) β€” static function that prints out all those accumulated counters to the stream, which defaults to ExEnv::out0(). Perfect for when you need receipts πŸ“Š

πŸ’œ Static Public Attributes πŸ’œ

These are the static counters, and every single one is a running tally of something intersect noticed. Not me keeping score 😭

  • static int n_no_spheres_ β€” count of the no-spheres case.
  • static int n_probe_enclosed_by_a_sphere_ β€” count of times the probe was enclosed by a sphere.
  • static int n_probe_center_not_enclosed_ β€” count of times the probe's center was not enclosed.
  • static int n_surface_of_s0_not_covered_ β€” count of times the surface of s0 was not covered.
  • static int n_plane_totally_covered_ β€” count of times the plane was totally covered. Slay, honestly.
  • static int n_internal_edge_not_covered_ β€” count of times an internal edge was not covered.
  • static int n_totally_covered_ β€” count of times everything was totally covered. The dream scenario πŸ‘‘

πŸ‘‘ AUTHOR πŸ‘‘

Generated automatically by Doxygen for MPQC from the source code. The robot wrote it, we just made it cute πŸŽ€


fr fr, that's the whole page. Every function, every counter, every default β€” nothing got left on read πŸ’–

MPQC β€” Version 2.3.1 β€” sc::CS2Sphere(3) 🌸 mwah, go forth and intersect responsibly 🫢

πŸ“¦ where this page comes from