|
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 #include "WebAudioUtils.h" |
|
13 |
|
14 namespace mozilla { |
|
15 |
|
16 namespace dom { |
|
17 |
|
18 bool |
|
19 ThreeDPoint::FuzzyEqual(const ThreeDPoint& other) |
|
20 { |
|
21 return WebAudioUtils::FuzzyEqual(x, other.x) && |
|
22 WebAudioUtils::FuzzyEqual(y, other.y) && |
|
23 WebAudioUtils::FuzzyEqual(z, other.z); |
|
24 } |
|
25 |
|
26 ThreeDPoint operator-(const ThreeDPoint& lhs, const ThreeDPoint& rhs) |
|
27 { |
|
28 return ThreeDPoint(lhs.x - rhs.x, lhs.y - rhs.y, lhs.z - rhs.z); |
|
29 } |
|
30 |
|
31 ThreeDPoint operator*(const ThreeDPoint& lhs, const ThreeDPoint& rhs) |
|
32 { |
|
33 return ThreeDPoint(lhs.x * rhs.x, lhs.y * rhs.y, lhs.z * rhs.z); |
|
34 } |
|
35 |
|
36 ThreeDPoint operator*(const ThreeDPoint& lhs, const double rhs) |
|
37 { |
|
38 return ThreeDPoint(lhs.x * rhs, lhs.y * rhs, lhs.z * rhs); |
|
39 } |
|
40 |
|
41 bool operator==(const ThreeDPoint& lhs, const ThreeDPoint& rhs) |
|
42 { |
|
43 return lhs.x == rhs.x && |
|
44 lhs.y == rhs.y && |
|
45 lhs.z == rhs.z; |
|
46 } |
|
47 |
|
48 } |
|
49 } |