content/media/webaudio/ThreeDPoint.cpp

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/media/webaudio/ThreeDPoint.cpp	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,49 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* vim:set ts=2 sw=2 sts=2 et cindent: */
     1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +/**
    1.11 + * Other similar methods can be added if needed.
    1.12 + */
    1.13 +
    1.14 +#include "ThreeDPoint.h"
    1.15 +#include "WebAudioUtils.h"
    1.16 +
    1.17 +namespace mozilla {
    1.18 +
    1.19 +namespace dom {
    1.20 +
    1.21 +bool
    1.22 +ThreeDPoint::FuzzyEqual(const ThreeDPoint& other)
    1.23 +{
    1.24 +  return WebAudioUtils::FuzzyEqual(x, other.x) &&
    1.25 +    WebAudioUtils::FuzzyEqual(y, other.y) &&
    1.26 +    WebAudioUtils::FuzzyEqual(z, other.z);
    1.27 +}
    1.28 +
    1.29 +ThreeDPoint operator-(const ThreeDPoint& lhs, const ThreeDPoint& rhs)
    1.30 +{
    1.31 +  return ThreeDPoint(lhs.x - rhs.x, lhs.y - rhs.y, lhs.z - rhs.z);
    1.32 +}
    1.33 +
    1.34 +ThreeDPoint operator*(const ThreeDPoint& lhs, const ThreeDPoint& rhs)
    1.35 +{
    1.36 +  return ThreeDPoint(lhs.x * rhs.x, lhs.y * rhs.y, lhs.z * rhs.z);
    1.37 +}
    1.38 +
    1.39 +ThreeDPoint operator*(const ThreeDPoint& lhs, const double rhs)
    1.40 +{
    1.41 +  return ThreeDPoint(lhs.x * rhs, lhs.y * rhs, lhs.z * rhs);
    1.42 +}
    1.43 +
    1.44 +bool operator==(const ThreeDPoint& lhs, const ThreeDPoint& rhs)
    1.45 +{
    1.46 +  return lhs.x == rhs.x &&
    1.47 +         lhs.y == rhs.y &&
    1.48 +         lhs.z == rhs.z;
    1.49 +}
    1.50 +
    1.51 +}
    1.52 +}

mercurial