ThreeDPoint.cpp (1247B)
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim:set ts=2 sw=2 sts=2 et cindent: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 /** 8 * Other similar methods can be added if needed. 9 */ 10 11 #include "ThreeDPoint.h" 12 13 #include "WebAudioUtils.h" 14 15 namespace mozilla::dom { 16 17 bool ThreeDPoint::FuzzyEqual(const ThreeDPoint& other) { 18 return WebAudioUtils::FuzzyEqual(x, other.x) && 19 WebAudioUtils::FuzzyEqual(y, other.y) && 20 WebAudioUtils::FuzzyEqual(z, other.z); 21 } 22 23 ThreeDPoint operator-(const ThreeDPoint& lhs, const ThreeDPoint& rhs) { 24 return ThreeDPoint(lhs.x - rhs.x, lhs.y - rhs.y, lhs.z - rhs.z); 25 } 26 27 ThreeDPoint operator*(const ThreeDPoint& lhs, const ThreeDPoint& rhs) { 28 return ThreeDPoint(lhs.x * rhs.x, lhs.y * rhs.y, lhs.z * rhs.z); 29 } 30 31 ThreeDPoint operator*(const ThreeDPoint& lhs, const double rhs) { 32 return ThreeDPoint(lhs.x * rhs, lhs.y * rhs, lhs.z * rhs); 33 } 34 35 bool operator==(const ThreeDPoint& lhs, const ThreeDPoint& rhs) { 36 return lhs.x == rhs.x && lhs.y == rhs.y && lhs.z == rhs.z; 37 } 38 39 } // namespace mozilla::dom