* Add scalar product to the FTPoint operators.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
diff --git a/src/FTGL/FTPoint.h b/src/FTGL/FTPoint.h
index 766ea4c..e2ee5e8 100644
--- a/src/FTGL/FTPoint.h
+++ b/src/FTGL/FTPoint.h
@@ -151,7 +151,7 @@ class FTGL_EXPORT FTPoint
}
/**
- * Operator *
+ * Operator * Scalar multiplication
*
* @param multiplier
* @return <code>this</code> multiplied by <code>multiplier</code>.
@@ -168,7 +168,7 @@ class FTGL_EXPORT FTPoint
/**
- * Operator *
+ * Operator * Scalar multiplication
*
* @param point
* @param multiplier
@@ -181,6 +181,21 @@ class FTGL_EXPORT FTPoint
/**
+ * Operator * Scalar product
+ *
+ * @param a First vector.
+ * @param b Second vector.
+ * @return <code>a.b</code> scalar product.
+ */
+ inline friend double operator * (FTPoint &a, FTPoint& b)
+ {
+ return a.values[0] * b.values[0]
+ + a.values[1] * b.values[1]
+ + a.values[2] * b.values[2];
+ }
+
+
+ /**
* Operator ^ Vector product
*
* @param point Second point