af062818b47340eef15700d2f0211576ba3506eevboxsync * Copyright (C) 2000 Ove Kaaven
af062818b47340eef15700d2f0211576ba3506eevboxsync * This library is free software; you can redistribute it and/or
af062818b47340eef15700d2f0211576ba3506eevboxsync * modify it under the terms of the GNU Lesser General Public
af062818b47340eef15700d2f0211576ba3506eevboxsync * License as published by the Free Software Foundation; either
af062818b47340eef15700d2f0211576ba3506eevboxsync * version 2.1 of the License, or (at your option) any later version.
af062818b47340eef15700d2f0211576ba3506eevboxsync * This library is distributed in the hope that it will be useful,
af062818b47340eef15700d2f0211576ba3506eevboxsync * but WITHOUT ANY WARRANTY; without even the implied warranty of
af062818b47340eef15700d2f0211576ba3506eevboxsync * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
af062818b47340eef15700d2f0211576ba3506eevboxsync * Lesser General Public License for more details.
af062818b47340eef15700d2f0211576ba3506eevboxsync * You should have received a copy of the GNU Lesser General Public
af062818b47340eef15700d2f0211576ba3506eevboxsync * License along with this library; if not, write to the Free Software
af062818b47340eef15700d2f0211576ba3506eevboxsync * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
589fd26cedb2b4ebbed14f2964cad03cc8ebbca2vboxsync * Sun LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
589fd26cedb2b4ebbed14f2964cad03cc8ebbca2vboxsync * other than GPL or LGPL is available it will apply instead, Sun elects to use only
589fd26cedb2b4ebbed14f2964cad03cc8ebbca2vboxsync * the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
589fd26cedb2b4ebbed14f2964cad03cc8ebbca2vboxsync * a choice of LGPL license versions is made available with the language indicating
589fd26cedb2b4ebbed14f2964cad03cc8ebbca2vboxsync * that LGPLv2 or any later version may be used, or where a choice of which version
589fd26cedb2b4ebbed14f2964cad03cc8ebbca2vboxsync * of the LGPL is applied is otherwise unspecified.
af062818b47340eef15700d2f0211576ba3506eevboxsync/*** constructors ***/
af062818b47340eef15700d2f0211576ba3506eevboxsync x = y = z = f;
af062818b47340eef15700d2f0211576ba3506eevboxsyncinline _D3DVECTOR::_D3DVECTOR(D3DVALUE _x, D3DVALUE _y, D3DVALUE _z)
af062818b47340eef15700d2f0211576ba3506eevboxsync/*** assignment operators ***/
af062818b47340eef15700d2f0211576ba3506eevboxsyncinline _D3DVECTOR& _D3DVECTOR::operator += (const _D3DVECTOR& v)
af062818b47340eef15700d2f0211576ba3506eevboxsync x += v.x; y += v.y; z += v.z;
af062818b47340eef15700d2f0211576ba3506eevboxsync return *this;
af062818b47340eef15700d2f0211576ba3506eevboxsyncinline _D3DVECTOR& _D3DVECTOR::operator -= (const _D3DVECTOR& v)
af062818b47340eef15700d2f0211576ba3506eevboxsync x -= v.x; y -= v.y; z -= v.z;
af062818b47340eef15700d2f0211576ba3506eevboxsync return *this;
af062818b47340eef15700d2f0211576ba3506eevboxsyncinline _D3DVECTOR& _D3DVECTOR::operator *= (const _D3DVECTOR& v)
af062818b47340eef15700d2f0211576ba3506eevboxsync x *= v.x; y *= v.y; z *= v.z;
af062818b47340eef15700d2f0211576ba3506eevboxsync return *this;
af062818b47340eef15700d2f0211576ba3506eevboxsyncinline _D3DVECTOR& _D3DVECTOR::operator /= (const _D3DVECTOR& v)
af062818b47340eef15700d2f0211576ba3506eevboxsync x /= v.x; y /= v.y; z /= v.z;
af062818b47340eef15700d2f0211576ba3506eevboxsync return *this;
af062818b47340eef15700d2f0211576ba3506eevboxsyncinline _D3DVECTOR& _D3DVECTOR::operator *= (D3DVALUE s)
af062818b47340eef15700d2f0211576ba3506eevboxsync x *= s; y *= s; z *= s;
af062818b47340eef15700d2f0211576ba3506eevboxsync return *this;
af062818b47340eef15700d2f0211576ba3506eevboxsyncinline _D3DVECTOR& _D3DVECTOR::operator /= (D3DVALUE s)
af062818b47340eef15700d2f0211576ba3506eevboxsync x /= s; y /= s; z /= s;
af062818b47340eef15700d2f0211576ba3506eevboxsync return *this;
af062818b47340eef15700d2f0211576ba3506eevboxsync/*** unary operators ***/
af062818b47340eef15700d2f0211576ba3506eevboxsync return _D3DVECTOR(-v.x, -v.y, -v.z);
af062818b47340eef15700d2f0211576ba3506eevboxsync/*** binary operators ***/
af062818b47340eef15700d2f0211576ba3506eevboxsyncinline _D3DVECTOR operator + (const _D3DVECTOR& v1, const _D3DVECTOR& v2)
af062818b47340eef15700d2f0211576ba3506eevboxsync return _D3DVECTOR(v1.x+v2.x, v1.y+v2.y, v1.z+v2.z);
af062818b47340eef15700d2f0211576ba3506eevboxsyncinline _D3DVECTOR operator - (const _D3DVECTOR& v1, const _D3DVECTOR& v2)
af062818b47340eef15700d2f0211576ba3506eevboxsync return _D3DVECTOR(v1.x-v2.x, v1.y-v2.y, v1.z-v2.z);
af062818b47340eef15700d2f0211576ba3506eevboxsyncinline _D3DVECTOR operator * (const _D3DVECTOR& v, D3DVALUE s)
af062818b47340eef15700d2f0211576ba3506eevboxsync return _D3DVECTOR(v.x*s, v.y*s, v.z*s);
af062818b47340eef15700d2f0211576ba3506eevboxsyncinline _D3DVECTOR operator * (D3DVALUE s, const _D3DVECTOR& v)
af062818b47340eef15700d2f0211576ba3506eevboxsync return _D3DVECTOR(v.x*s, v.y*s, v.z*s);
af062818b47340eef15700d2f0211576ba3506eevboxsyncinline _D3DVECTOR operator / (const _D3DVECTOR& v, D3DVALUE s)
af062818b47340eef15700d2f0211576ba3506eevboxsync return _D3DVECTOR(v.x/s, v.y/s, v.z/s);
af062818b47340eef15700d2f0211576ba3506eevboxsyncinline D3DVALUE SquareMagnitude(const _D3DVECTOR& v)
af062818b47340eef15700d2f0211576ba3506eevboxsync return v.x*v.x + v.y*v.y + v.z*v.z; /* DotProduct(v, v) */
af062818b47340eef15700d2f0211576ba3506eevboxsync return v / Magnitude(v);
af062818b47340eef15700d2f0211576ba3506eevboxsyncinline D3DVALUE DotProduct(const _D3DVECTOR& v1, const _D3DVECTOR& v2)
af062818b47340eef15700d2f0211576ba3506eevboxsyncinline _D3DVECTOR CrossProduct(const _D3DVECTOR& v1, const _D3DVECTOR& v2)
af062818b47340eef15700d2f0211576ba3506eevboxsync /* this is a left-handed cross product, right? */