internal naming consistency
authorJames Preiss <japreiss@usc.edu>
Sun, 10 Jun 2018 02:04:40 +0000 (19:04 -0700)
committerJames Preiss <japreiss@usc.edu>
Sun, 10 Jun 2018 02:04:40 +0000 (19:04 -0700)
math3d.h

index 671636c..6540b63 100644 (file)
--- a/math3d.h
+++ b/math3d.h
@@ -107,6 +107,10 @@ static inline struct vec veltmul(struct vec a, struct vec b) {
 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);
@@ -346,7 +350,7 @@ static inline struct mat33 mtranspose(struct mat33 m) {
        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) {
@@ -357,7 +361,7 @@ static inline struct mat33 mscale(float s, struct mat33 a) {
 }
 // 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) {
@@ -380,14 +384,14 @@ static inline struct mat33 msub(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) {