00001 // Filename: lvector3_src.h 00002 // Created by: drose (24Sep99) 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 // Class : LVector3 00021 // Description : This is a three-component vector distance (as opposed 00022 // to a three-component point, which represents a 00023 // particular point in space). Some of the methods are 00024 // slightly different between LPoint3 and LVector3; in 00025 // particular, subtraction of two points yields a 00026 // vector, while addition of a vector and a point yields 00027 // a point. 00028 //////////////////////////////////////////////////////////////////// 00029 class EXPCL_PANDA FLOATNAME(LVector3) : public FLOATNAME(LVecBase3) { 00030 PUBLISHED: 00031 INLINE_LINMATH FLOATNAME(LVector3)(); 00032 INLINE_LINMATH FLOATNAME(LVector3)(const FLOATNAME(LVecBase3) ©); 00033 INLINE_LINMATH FLOATNAME(LVector3) &operator = (const FLOATNAME(LVecBase3) ©); 00034 INLINE_LINMATH FLOATNAME(LVector3) &operator = (FLOATTYPE fill_value); 00035 INLINE_LINMATH FLOATNAME(LVector3)(FLOATTYPE fill_value); 00036 INLINE_LINMATH FLOATNAME(LVector3)(FLOATTYPE x, FLOATTYPE y, FLOATTYPE z); 00037 00038 INLINE_LINMATH static const FLOATNAME(LVector3) &zero(); 00039 INLINE_LINMATH static const FLOATNAME(LVector3) &unit_x(); 00040 INLINE_LINMATH static const FLOATNAME(LVector3) &unit_y(); 00041 INLINE_LINMATH static const FLOATNAME(LVector3) &unit_z(); 00042 00043 INLINE_LINMATH FLOATNAME(LVector3) operator - () const; 00044 00045 INLINE_LINMATH FLOATNAME(LVecBase3) operator + (const FLOATNAME(LVecBase3) &other) const; 00046 INLINE_LINMATH FLOATNAME(LVector3) operator + (const FLOATNAME(LVector3) &other) const; 00047 00048 INLINE_LINMATH FLOATNAME(LVecBase3) operator - (const FLOATNAME(LVecBase3) &other) const; 00049 INLINE_LINMATH FLOATNAME(LVector3) operator - (const FLOATNAME(LVector3) &other) const; 00050 00051 INLINE_LINMATH FLOATTYPE length() const; 00052 INLINE_LINMATH FLOATTYPE length_squared() const; 00053 INLINE_LINMATH bool normalize(); 00054 INLINE_LINMATH FLOATNAME(LVector3) cross(const FLOATNAME(LVecBase3) &other) const; 00055 INLINE_LINMATH FLOATNAME(LVector3) operator * (FLOATTYPE scalar) const; 00056 INLINE_LINMATH FLOATNAME(LVector3) operator / (FLOATTYPE scalar) const; 00057 00058 // Some special named constructors for LVector3. 00059 00060 INLINE_LINMATH static FLOATNAME(LVector3) up(CoordinateSystem cs = CS_default); 00061 INLINE_LINMATH static FLOATNAME(LVector3) right(CoordinateSystem cs = CS_default); 00062 INLINE_LINMATH static FLOATNAME(LVector3) forward(CoordinateSystem cs = CS_default); 00063 00064 INLINE_LINMATH static FLOATNAME(LVector3) down(CoordinateSystem cs = CS_default); 00065 INLINE_LINMATH static FLOATNAME(LVector3) left(CoordinateSystem cs = CS_default); 00066 INLINE_LINMATH static FLOATNAME(LVector3) back(CoordinateSystem cs = CS_default); 00067 00068 // INLINE_LINMATH static FLOATNAME(LVector3) & rfu(FLOATTYPE right, 00069 INLINE_LINMATH static FLOATNAME(LVector3) rfu(FLOATTYPE right, 00070 FLOATTYPE fwd,FLOATTYPE up, CoordinateSystem cs = CS_default); 00071 00072 public: 00073 static TypeHandle get_class_type() { 00074 return _type_handle; 00075 } 00076 static void init_type(); 00077 00078 private: 00079 static TypeHandle _type_handle; 00080 }; 00081 00082 #include "lvector3_src.I"