00001 // Filename: lvec4_ops_src.I 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 //////////////////////////////////////////////////////////////////// 00020 // Function: scalar * LVecBase4 00021 // Description: 00022 //////////////////////////////////////////////////////////////////// 00023 INLINE_LINMATH FLOATNAME(LVecBase4) 00024 operator * (FLOATTYPE scalar, const FLOATNAME(LVecBase4) &a) { 00025 return a * scalar; 00026 } 00027 00028 //////////////////////////////////////////////////////////////////// 00029 // Function: scalar * LPoint4 00030 // Description: 00031 //////////////////////////////////////////////////////////////////// 00032 INLINE_LINMATH FLOATNAME(LPoint4) 00033 operator * (FLOATTYPE scalar, const FLOATNAME(LPoint4) &a) { 00034 return a * scalar; 00035 } 00036 00037 //////////////////////////////////////////////////////////////////// 00038 // Function: scalar * LVector4 00039 // Description: 00040 //////////////////////////////////////////////////////////////////// 00041 INLINE_LINMATH FLOATNAME(LVector4) 00042 operator * (FLOATTYPE scalar, const FLOATNAME(LVector4) &a) { 00043 return a * scalar; 00044 } 00045 00046 //////////////////////////////////////////////////////////////////// 00047 // Function: dot product of LVecBase4 00048 // Description: 00049 //////////////////////////////////////////////////////////////////// 00050 00051 INLINE_LINMATH FLOATTYPE 00052 dot(const FLOATNAME(LVecBase4) &a, const FLOATNAME(LVecBase4) &b) { 00053 return a.dot(b); 00054 } 00055 00056 //////////////////////////////////////////////////////////////////// 00057 // Function: length of a vector 00058 // Description: 00059 //////////////////////////////////////////////////////////////////// 00060 00061 INLINE_LINMATH FLOATTYPE 00062 length(const FLOATNAME(LVector4) &a) { 00063 return a.length(); 00064 } 00065 00066 00067 //////////////////////////////////////////////////////////////////// 00068 // Function: normalize 00069 // Description: Returns a normalized vector from the given vector. 00070 //////////////////////////////////////////////////////////////////// 00071 00072 INLINE_LINMATH FLOATNAME(LVector4) 00073 normalize(const FLOATNAME(LVector4) &v) { 00074 FLOATNAME(LVector4) v1 = v; 00075 v1.normalize(); 00076 return v1; 00077 }