static inline struct vec veltdiv(struct vec a, struct vec b) {
return mkvec(a.x / b.x, a.y / b.y, a.z / b.z);
}
+// element-wise vector reciprocal.
+static inline struct vec veltrecip(struct vec a) {
+ return mkvec(1.0f / a.x, 1.0f / a.y, 1.0f / a.z);
+}
// vector magnitude squared.
static inline float vmag2(struct vec v) {
return vdot(v, v);
return mt;
}
// multiply a matrix by a scalar.
-static inline struct mat33 mscale(float s, struct mat33 a) {
+static inline struct mat33 mscl(float s, struct mat33 a) {
struct mat33 sa;
for (int i = 0; i < 3; ++i) {
for (int j = 0; j < 3; ++j) {
}
// negate a matrix.
static inline struct mat33 mneg(struct mat33 a) {
- return mscale(-1.0, a);
+ return mscl(-1.0, a);
}
// add two matrices.
static inline struct mat33 madd(struct mat33 a, struct mat33 b) {
return c;
}
// multiply a matrix by a vector.
-static inline struct vec mvmult(struct mat33 a, struct vec v) {
+static inline struct vec mvmul(struct mat33 a, struct vec v) {
float x = a.m[0][0] * v.x + a.m[0][1] * v.y + a.m[0][2] * v.z;
float y = a.m[1][0] * v.x + a.m[1][1] * v.y + a.m[1][2] * v.z;
float z = a.m[2][0] * v.x + a.m[2][1] * v.y + a.m[2][2] * v.z;
return mkvec(x, y, z);
}
// multiply two matrices.
-static inline struct mat33 mmult(struct mat33 a, struct mat33 b) {
+static inline struct mat33 mmul(struct mat33 a, struct mat33 b) {
struct mat33 ab;
for (int i = 0; i < 3; ++i) {
for (int j = 0; j < 3; ++j) {