From 29419e480e29fd32ff2f8b5343418d4ae5243bc1 Mon Sep 17 00:00:00 2001 From: jules Date: Sat, 23 Mar 2013 11:09:30 +0000 Subject: [PATCH] Added a method Point::dotProduct() --- modules/juce_graphics/geometry/juce_Point.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/juce_graphics/geometry/juce_Point.h b/modules/juce_graphics/geometry/juce_Point.h index 1f7b99349a..0b3fa52d18 100644 --- a/modules/juce_graphics/geometry/juce_Point.h +++ b/modules/juce_graphics/geometry/juce_Point.h @@ -164,6 +164,9 @@ public: { return Point (transform.mat00 * x + transform.mat01 * y + transform.mat02, transform.mat10 * x + transform.mat11 * y + transform.mat12); } + /** Returns the dot-product of two points (x1 * x2 + y1 * y2). */ + FloatType getDotProduct (const Point& other) const noexcept { return x * other.x + y * other.y; } + /** Casts this point to a Point object. */ Point toInt() const noexcept { return Point (static_cast (x), static_cast (y)); }