diff options
Diffstat (limited to 'tests/libsample/pointf.cpp')
-rw-r--r-- | tests/libsample/pointf.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/libsample/pointf.cpp b/tests/libsample/pointf.cpp index 2464c22bb..509863c41 100644 --- a/tests/libsample/pointf.cpp +++ b/tests/libsample/pointf.cpp @@ -34,6 +34,15 @@ PointF::PointF(double x, double y) : m_x(x), m_y(y) } void +PointF::midpoint(const PointF& other, PointF* midpoint) const +{ + if (!midpoint) + return; + midpoint->setX((m_x + other.m_x) / 2.0); + midpoint->setY((m_y + other.m_y) / 2.0); +} + +void PointF::show() { cout << "(x: " << m_x << ", y: " << m_y << ")"; |