sc::vec3(3)

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

🌸 sc::vec3 β€” Library Functions Manual, section 3 🌸

okay bestie, so we're in sc::vec3(3) territory and it's literally the cutest little 3D vector class in the whole MPQC cinematic universe. three doubles, walking into a bar, doing math. iconic behavior. let's get into it πŸŽ€


NAME ✨

sc::vec3 β€” that's it, that's the name, no further explanation given and honestly? she's confident. a 3-component vector class. periodt.


SYNOPSIS πŸ’…

here's the whole menu of what this baby can do. every single one of these is real, don't skip any, I'm watching πŸ‘€

πŸ’– Public Member Functions

  • vec3 (const double x, const double y, const double z) β€” build her from three separate doubles: x, y, z. the classic.
  • vec3 (const double d) β€” one double in, all three components get it. one value, three vibes.
  • vec3 (const vec3 &v) β€” copy constructor, copying another vec3. twin energy fr fr.
  • vec3 (const vec2 &v) β€” grow a vec2 into a vec3. glow-up arc.
  • vec3 (const vec2 &v, double d) β€” take a vec2 v plus an extra double d and make a whole vec3 out of them.
  • vec3 (const vec4 &v) β€” squash a vec4 v down into a vec3.
  • vec3 (const vec4 &v, int dropAxis) β€” a vec4 v but you get to choose which axis dies via dropAxis. choose wisely bestie, you don't get her back.
  • vec3 & operator= (const vec3 &v) β€” assignment, i.e. becoming v. main character transformation.
  • vec3 & operator+= (const vec3 &v) β€” add v onto yourself and keep the result. yes and.
  • vec3 & operator-= (const vec3 &v) β€” subtract v from yourself and keep the result. the math version of "not me tho".
  • vec3 & operator*= (const double d) β€” scale yourself by the double d, in place. slay.
  • vec3 & operator/= (const double d) β€” divide yourself by the double d, in place.
  • double & operator[] (int i) β€” index into her at i, and you get a mutable double & back. handle with care, that's a direct line to her soul.
  • const double & operator[] (int i) const β€” the const version of indexing at i, handing back a const double &. look, don't touch.
  • double length () β€” her length. the whole magnitude of her.
  • double length2 () β€” her length, squared. same energy, no square root tax.
  • vec3 & normalize () β€” normalize in place, returns the vec3 &. she's serving unit vector now.
  • vec3 & apply (V_FCT_PTR fct) β€” apply the function pointer fct and get the vec3 & back.

πŸ›‘οΈ Protected Attributes

  • double n [3] β€” the protected attribute, an array of 3 doubles named n. that's where the actual numbers live. protect her at all costs πŸ”’

🫢 Friends

these are the besties she trusts with her private business:

  • class vec2
  • class vec4
  • class mat3
  • vec3 operator- (const vec3 &v) β€” unary minus. negate v, get a vec3.
  • vec3 operator+ (const vec3 &a, const vec3 &b) β€” a plus b, both vec3, result vec3.
  • vec3 operator- (const vec3 &a, const vec3 &b) β€” a minus b, both vec3, result vec3.
  • vec3 operator* (const vec3 &a, const double d) β€” vec3 a times the double d.
  • vec3 operator* (const double d, const vec3 &a) β€” the double d times the vec3 a. yes, both orders, because she's flexible like that.
  • vec3 operator* (const mat4 &a, const vec3 &v) β€” mat4 a times vec3 v.
  • vec3 operator* (const vec3 &v, const mat4 &a) β€” vec3 v times mat4 a. order matters, always has, always will.
  • double operator* (const vec3 &a, const vec3 &b) β€” dot product vibe check: vec3 a times vec3 b, and you get a plain double back.
  • vec3 operator/ (const vec3 &a, const double d) β€” vec3 a divided by the double d.
  • vec3 operator^ (const vec3 &a, const vec3 &b) β€” the ^ operator on a and b. cross product behavior, no notes.
  • int operator== (const vec3 &a, const vec3 &b) β€” equality check on a and b, returns an int. are they the same girl?
  • int operator!= (const vec3 &a, const vec3 &b) β€” inequality check on a and b, returns an int. are they not the same girl?
  • std::ostream & operator<< (std::ostream &s, vec3 &v) β€” stream v out to s. she loves to be perceived.
  • std::istream & operator>> (std::istream &s, vec3 &v) β€” stream v in from s. reading her for filth (affectionate).
  • void swap (vec3 &a, vec3 &b) β€” swap a and b. body swap episode, but make it vectors.
  • vec3 min (const vec3 &a, const vec3 &b) β€” componentwise minimum of a and b.
  • vec3 max (const vec3 &a, const vec3 &b) β€” componentwise maximum of a and b.
  • vec3 prod (const vec3 &a, const vec3 &b) β€” componentwise product of a and b.
  • vec2 operator* (const mat3 &a, const vec2 &v) β€” mat3 a times vec2 v, giving you a vec2. yes this lives on the vec3 page, she's friends with everybody.
  • mat3 operator* (const mat3 &a, const mat3 &b) β€” mat3 a times mat3 b, giving you a mat3. matrix besties supporting matrix besties.

Author πŸ‘‘

Generated automatically by Doxygen for MPQC from the source code. so like, no human author to stan, the robot did it, and honestly? the robot ate. πŸ”₯


and that's the whole page, bestie πŸ’œ this was sc::vec3(3) from MPQC Version 2.3.1 β€” go forth, normalize responsibly, and remember: don't drop the wrong axis πŸ™ˆ πŸ¦‹ ✨

πŸ“¦ where this page comes from