00001 // Filename: lvec3_ops_src.h 00002 // Created by: drose (08Mar00) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 // When possible, operators have been defined within the classes. 00020 // This file defines operator functions outside of classes where 00021 // necessary. It also defines some convenient out-of-class wrappers 00022 // around in-class functions (like dot, length, normalize). 00023 00024 00025 // scalar * vec (vec * scalar is defined in class) 00026 INLINE_LINMATH FLOATNAME(LVecBase3) 00027 operator * (FLOATTYPE scalar, const FLOATNAME(LVecBase3) &a); 00028 00029 INLINE_LINMATH FLOATNAME(LPoint3) 00030 operator * (FLOATTYPE scalar, const FLOATNAME(LPoint3) &a); 00031 00032 INLINE_LINMATH FLOATNAME(LVector3) 00033 operator * (FLOATTYPE scalar, const FLOATNAME(LVector3) &a); 00034 00035 00036 // dot product 00037 INLINE_LINMATH FLOATTYPE 00038 dot(const FLOATNAME(LVecBase3) &a, const FLOATNAME(LVecBase3) &b); 00039 00040 00041 // cross product 00042 INLINE_LINMATH FLOATNAME(LVecBase3) 00043 cross(const FLOATNAME(LVecBase3) &a, const FLOATNAME(LVecBase3) &b); 00044 00045 INLINE_LINMATH FLOATNAME(LVector3) 00046 cross(const FLOATNAME(LVector3) &a, const FLOATNAME(LVector3) &b); 00047 00048 00049 // Length of a vector. 00050 INLINE_LINMATH FLOATTYPE 00051 length(const FLOATNAME(LVector3) &a); 00052 00053 // A normalized vector. 00054 INLINE_LINMATH FLOATNAME(LVector3) 00055 normalize(const FLOATNAME(LVector3) &v); 00056 00057 #include "lvec3_ops_src.I"