sc::vec4(3)

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

πŸ¦‹ sc::vec4 πŸ¦‹

okay so bestie, welcome to the Library Functions Manual page for sc::vec4 πŸ’– this is a four-component vector and the way it's laid out? immaculate. Everything she can do, everyone she lets near her, all of it's right here. Let's go, no cap ✨


🌸 NAME 🌸

sc::vec4 β€” that's the whole name, she's short, she's sweet, she's iconic πŸ’…


✨ SYNOPSIS ✨

here's the whole menu, bestie β€” read it like a cafe board and order whatever your heart wants β˜•

πŸ’– Public Member Functions πŸ’–

these are the public ones, so literally anybody can call them. open invite energy πŸ‘‘

vec4 (const double x, const double y, const double z, const double w)
vec4 (const double d)
vec4 (const vec4 &v)
vec4 (const vec3 &v)
vec4 (const vec3 &v, const double d)
vec4 & operator= (const vec4 &v)
vec4 & operator+= (const vec4 &v)
vec4 & operator-= (const vec4 &v)
vec4 & operator*= (const double d)
vec4 & operator/= (const double d)
double & operator[] (int i)
const double & operator[] (int i) const
double length ()
double length2 ()
vec4 & normalize ()
vec4 & apply (V_FCT_PTR fct)

quick vibe check on what's in there:

  • the constructors: one takes four doubles β€” x, y, z and w; one takes a single double d; one is the copy constructor taking a const vec4 &v; one takes a const vec3 &v; and one takes a const vec3 &v plus a double d. five ways to be born, all valid πŸŽ€
  • the assignment and compound assignment crew: operator=, operator+=, operator-= all take a const vec4 &v, while operator*= and operator/= take a double d β€” and every single one of them hands you back a vec4 & 🫢
  • the indexing: operator[] takes an int i and gives you a double & β€” and there's a second one that's const, handing back a const double &, so your const objects get love too πŸ’œ
  • length() and length2() both return a double, no arguments, no drama
  • normalize() returns a vec4 & (she returns herself, queen behaviour πŸ‘‘)
  • apply() takes a V_FCT_PTR fct and also returns a vec4 &

πŸŽ€ Protected Attributes πŸŽ€

double n [4]

this one's protected, so it's not for just anyone β€” class-internal and friends only, VIP section, no plus-ones πŸ™ˆ

🌈 Friends 🌈

these are the besties who get to peek behind the curtain. full list, no skips:

class vec3
class mat4
vec4 operator- (const vec4 &v)
vec4 operator+ (const vec4 &a, const vec4 &b)
vec4 operator- (const vec4 &a, const vec4 &b)
vec4 operator* (const vec4 &a, const double d)
vec4 operator* (const double d, const vec4 &a)
vec4 operator* (const mat4 &a, const vec4 &v)
vec4 operator* (const vec4 &v, const mat4 &a)
double operator* (const vec4 &a, const vec4 &b)
vec4 operator/ (const vec4 &a, const double d)
int operator== (const vec4 &a, const vec4 &b)
int operator!= (const vec4 &a, const vec4 &b)
std::ostream & operator<< (std::ostream &s, vec4 &v)
std::istream & operator>> (std::istream &s, vec4 &v)
void swap (vec4 &a, vec4 &b)
vec4 min (const vec4 &a, const vec4 &b)
vec4 max (const vec4 &a, const vec4 &b)
vec4 prod (const vec4 &a, const vec4 &b)
vec3 operator* (const mat4 &a, const vec3 &v)
mat4 operator* (const mat4 &a, const mat4 &b)

look at all those operators fr fr β€” unary minus, plus, minus, multiply every which way (vector times double, double times vector, mat4 times vec4, vec4 times mat4, and vec4 times vec4 giving back a plain double), divide, == and != handing back an int, the << and >> stream friends, swap, min, max, prod, plus a couple of mat4/vec3 crossovers at the bottom. it's giving extended family 😭πŸ”₯


🫢 Author 🫢

Generated automatically by Doxygen for MPQC from the source code. (yes bestie, a robot wrote her bio and honestly? still ate πŸ’…)


and that's the whole page, no crumbs left 🌸 mwah πŸ’‹ this was MPQC Version 2.3.1, page sc::vec4(3) β€” go forth and multiply your vectors, periodt βœ¨πŸ‘‘

πŸ“¦ where this page comes from