00001 // Filename: lvector2_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 //////////////////////////////////////////////////////////////////// 00020 // Class : LVector2 00021 // Description : This is a two-component vector offset. 00022 //////////////////////////////////////////////////////////////////// 00023 class EXPCL_PANDA FLOATNAME(LVector2) : public FLOATNAME(LVecBase2) { 00024 PUBLISHED: 00025 INLINE_LINMATH FLOATNAME(LVector2)(); 00026 INLINE_LINMATH FLOATNAME(LVector2)(const FLOATNAME(LVecBase2) ©); 00027 INLINE_LINMATH FLOATNAME(LVector2) &operator = (const FLOATNAME(LVecBase2) ©); 00028 INLINE_LINMATH FLOATNAME(LVector2) &operator = (FLOATTYPE fill_value); 00029 INLINE_LINMATH FLOATNAME(LVector2)(FLOATTYPE fill_value); 00030 INLINE_LINMATH FLOATNAME(LVector2)(FLOATTYPE x, FLOATTYPE y); 00031 00032 INLINE_LINMATH static const FLOATNAME(LVector2) &zero(); 00033 INLINE_LINMATH static const FLOATNAME(LVector2) &unit_x(); 00034 INLINE_LINMATH static const FLOATNAME(LVector2) &unit_y(); 00035 00036 INLINE_LINMATH FLOATNAME(LVector2) operator - () const; 00037 00038 INLINE_LINMATH FLOATNAME(LVecBase2) operator + (const FLOATNAME(LVecBase2) &other) const; 00039 INLINE_LINMATH FLOATNAME(LVector2) operator + (const FLOATNAME(LVector2) &other) const; 00040 00041 INLINE_LINMATH FLOATNAME(LVecBase2) operator - (const FLOATNAME(LVecBase2) &other) const; 00042 INLINE_LINMATH FLOATNAME(LVector2) operator - (const FLOATNAME(LVector2) &other) const; 00043 00044 INLINE_LINMATH FLOATTYPE length() const; 00045 INLINE_LINMATH FLOATTYPE length_squared() const; 00046 INLINE_LINMATH bool normalize(); 00047 INLINE_LINMATH FLOATNAME(LVector2) operator * (FLOATTYPE scalar) const; 00048 INLINE_LINMATH FLOATNAME(LVector2) operator / (FLOATTYPE scalar) const; 00049 00050 public: 00051 static TypeHandle get_class_type() { 00052 return _type_handle; 00053 } 00054 static void init_type(); 00055 00056 private: 00057 static TypeHandle _type_handle; 00058 }; 00059 00060 #include "lvector2_src.I"