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/. */
8 * Other similar methods can be added if needed.
11 #include "ThreeDPoint.h"
12 #include "WebAudioUtils.h"
14 namespace mozilla::dom
{
16 bool ThreeDPoint::FuzzyEqual(const ThreeDPoint
& other
) {
17 return WebAudioUtils::FuzzyEqual(x
, other
.x
) &&
18 WebAudioUtils::FuzzyEqual(y
, other
.y
) &&
19 WebAudioUtils::FuzzyEqual(z
, other
.z
);
22 ThreeDPoint
operator-(const ThreeDPoint
& lhs
, const ThreeDPoint
& rhs
) {
23 return ThreeDPoint(lhs
.x
- rhs
.x
, lhs
.y
- rhs
.y
, lhs
.z
- rhs
.z
);
26 ThreeDPoint
operator*(const ThreeDPoint
& lhs
, const ThreeDPoint
& rhs
) {
27 return ThreeDPoint(lhs
.x
* rhs
.x
, lhs
.y
* rhs
.y
, lhs
.z
* rhs
.z
);
30 ThreeDPoint
operator*(const ThreeDPoint
& lhs
, const double rhs
) {
31 return ThreeDPoint(lhs
.x
* rhs
, lhs
.y
* rhs
, lhs
.z
* rhs
);
34 bool operator==(const ThreeDPoint
& lhs
, const ThreeDPoint
& rhs
) {
35 return lhs
.x
== rhs
.x
&& lhs
.y
== rhs
.y
&& lhs
.z
== rhs
.z
;
38 } // namespace mozilla::dom