Index: cc/CCMathUtil.cpp |
diff --git a/cc/CCMathUtil.cpp b/cc/CCMathUtil.cpp |
index d90eb090abef6fbc004f87cedc0a3188419486cf..751edba0e98ddeeca521b760d4cce8079dafc290 100644 |
--- a/cc/CCMathUtil.cpp |
+++ b/cc/CCMathUtil.cpp |
@@ -9,6 +9,7 @@ |
#include "FloatPoint.h" |
#include "FloatQuad.h" |
#include "IntRect.h" |
+#include <math.h> |
#include <public/WebTransformationMatrix.h> |
using WebKit::WebTransformationMatrix; |
@@ -376,4 +377,9 @@ FloatSize CCMathUtil::projectVector(const FloatSize& source, const FloatSize& de |
return FloatSize(projectedLength * destination.width(), projectedLength * destination.height()); |
} |
+float CCMathUtil::distanceBetweenPoints(const FloatPoint& p1, const FloatPoint& p2) |
+{ |
+ return sqrtf(fabs(p1.x() - p2.x()) * fabs(p1.x() - p2.x()) + fabs(p1.y() - p2.y()) * fabs(p1.y() - p2.y())); |
piman
2012/09/17 23:53:37
nit: no needs for fabs here. x² == |x|²
danakj
2012/09/17 23:55:05
o right :) thanks.
|
+} |
+ |
} // namespace cc |