sc::vec3(3)
πΈ 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 anothervec3. twin energy fr fr.vec3 (const vec2 &v)β grow avec2into avec3. glow-up arc.vec3 (const vec2 &v, double d)β take avec2vplus an extradouble dand make a wholevec3out of them.vec3 (const vec4 &v)β squash avec4vdown into avec3.vec3 (const vec4 &v, int dropAxis)β avec4vbut you get to choose which axis dies viadropAxis. choose wisely bestie, you don't get her back.vec3 & operator= (const vec3 &v)β assignment, i.e. becomingv. main character transformation.vec3 & operator+= (const vec3 &v)β addvonto yourself and keep the result. yes and.vec3 & operator-= (const vec3 &v)β subtractvfrom yourself and keep the result. the math version of "not me tho".vec3 & operator*= (const double d)β scale yourself by thedouble d, in place. slay.vec3 & operator/= (const double d)β divide yourself by thedouble d, in place.double & operator[] (int i)β index into her ati, and you get a mutabledouble &back. handle with care, that's a direct line to her soul.const double & operator[] (int i) constβ the const version of indexing ati, handing back aconst 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 thevec3 &. she's serving unit vector now.vec3 & apply (V_FCT_PTR fct)β apply the function pointerfctand get thevec3 &back.
π‘οΈ Protected Attributes
double n [3]β the protected attribute, an array of 3 doubles namedn. that's where the actual numbers live. protect her at all costs π
π«Ά Friends
these are the besties she trusts with her private business:
class vec2class vec4class mat3vec3 operator- (const vec3 &v)β unary minus. negatev, get avec3.vec3 operator+ (const vec3 &a, const vec3 &b)βaplusb, bothvec3, resultvec3.vec3 operator- (const vec3 &a, const vec3 &b)βaminusb, bothvec3, resultvec3.vec3 operator* (const vec3 &a, const double d)βvec3atimes thedoubled.vec3 operator* (const double d, const vec3 &a)β thedoubledtimes thevec3a. yes, both orders, because she's flexible like that.vec3 operator* (const mat4 &a, const vec3 &v)βmat4atimesvec3v.vec3 operator* (const vec3 &v, const mat4 &a)βvec3vtimesmat4a. order matters, always has, always will.double operator* (const vec3 &a, const vec3 &b)β dot product vibe check:vec3atimesvec3b, and you get a plaindoubleback.vec3 operator/ (const vec3 &a, const double d)βvec3adivided by thedoubled.vec3 operator^ (const vec3 &a, const vec3 &b)β the^operator onaandb. cross product behavior, no notes.int operator== (const vec3 &a, const vec3 &b)β equality check onaandb, returns anint. are they the same girl?int operator!= (const vec3 &a, const vec3 &b)β inequality check onaandb, returns anint. are they not the same girl?std::ostream & operator<< (std::ostream &s, vec3 &v)β streamvout tos. she loves to be perceived.std::istream & operator>> (std::istream &s, vec3 &v)β streamvin froms. reading her for filth (affectionate).void swap (vec3 &a, vec3 &b)β swapaandb. body swap episode, but make it vectors.vec3 min (const vec3 &a, const vec3 &b)β componentwise minimum ofaandb.vec3 max (const vec3 &a, const vec3 &b)β componentwise maximum ofaandb.vec3 prod (const vec3 &a, const vec3 &b)β componentwise product ofaandb.vec2 operator* (const mat3 &a, const vec2 &v)βmat3atimesvec2v, giving you avec2. yes this lives on thevec3page, she's friends with everybody.mat3 operator* (const mat3 &a, const mat3 &b)βmat3atimesmat3b, giving you amat3. 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
- fedora 43: mpqc-devel 2.3.1-65.fc43 Β· GPL-2.0-or-later AND LicenseRef-Callaway-LGPLv2+
- fedora 43: mpqc-devel 2.3.1-65.fc43 Β· GPL-2.0-or-later AND LicenseRef-Callaway-LGPLv2+
- ubuntu noble: libsc-doc 2.3.1-22build2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms