Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/linmath/lvecBase4_src.h

Go to the documentation of this file.
00001 // Filename: lvecBase4_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 : LVecBase4
00021 // Description : This is the base class for all three-component
00022 //               vectors and points.
00023 ////////////////////////////////////////////////////////////////////
00024 class EXPCL_PANDA FLOATNAME(LVecBase4) {
00025 PUBLISHED:
00026   typedef const FLOATTYPE *iterator;
00027   typedef const FLOATTYPE *const_iterator;
00028 
00029   INLINE_LINMATH FLOATNAME(LVecBase4)();
00030   INLINE_LINMATH FLOATNAME(LVecBase4)(const FLOATNAME(LVecBase4) &copy);
00031   INLINE_LINMATH FLOATNAME(LVecBase4) &operator = (const FLOATNAME(LVecBase4) &copy);
00032   INLINE_LINMATH FLOATNAME(LVecBase4) &operator = (FLOATTYPE fill_value);
00033   INLINE_LINMATH FLOATNAME(LVecBase4)(FLOATTYPE fill_value);
00034   INLINE_LINMATH FLOATNAME(LVecBase4)(FLOATTYPE x, FLOATTYPE y, FLOATTYPE z, FLOATTYPE w);
00035 
00036   INLINE_LINMATH static const FLOATNAME(LVecBase4) &zero();
00037   INLINE_LINMATH static const FLOATNAME(LVecBase4) &unit_x();
00038   INLINE_LINMATH static const FLOATNAME(LVecBase4) &unit_y();
00039   INLINE_LINMATH static const FLOATNAME(LVecBase4) &unit_z();
00040   INLINE_LINMATH static const FLOATNAME(LVecBase4) &unit_w();
00041 
00042   INLINE_LINMATH ~FLOATNAME(LVecBase4)();
00043 
00044   INLINE_LINMATH FLOATTYPE operator [](int i) const;
00045   INLINE_LINMATH FLOATTYPE &operator [](int i);
00046 
00047   INLINE_LINMATH bool is_nan() const;
00048 
00049   INLINE_LINMATH FLOATTYPE get_cell(int i) const;
00050   INLINE_LINMATH FLOATTYPE get_x() const;
00051   INLINE_LINMATH FLOATTYPE get_y() const;
00052   INLINE_LINMATH FLOATTYPE get_z() const;
00053   INLINE_LINMATH FLOATTYPE get_w() const;
00054   INLINE_LINMATH void set_cell(int i, FLOATTYPE value);
00055   INLINE_LINMATH void set_x(FLOATTYPE value);
00056   INLINE_LINMATH void set_y(FLOATTYPE value);
00057   INLINE_LINMATH void set_z(FLOATTYPE value);
00058   INLINE_LINMATH void set_w(FLOATTYPE value);
00059 
00060   INLINE_LINMATH const FLOATTYPE *get_data() const;
00061   INLINE_LINMATH int get_num_components() const;
00062 
00063 public:
00064   INLINE_LINMATH iterator begin();
00065   INLINE_LINMATH iterator end();
00066 
00067   INLINE_LINMATH const_iterator begin() const;
00068   INLINE_LINMATH const_iterator end() const;
00069 
00070 PUBLISHED:
00071   INLINE_LINMATH void fill(FLOATTYPE fill_value);
00072   INLINE_LINMATH void set(FLOATTYPE x, FLOATTYPE y, FLOATTYPE z, FLOATTYPE w);
00073 
00074   INLINE_LINMATH FLOATTYPE dot(const FLOATNAME(LVecBase4) &other) const;
00075 
00076   INLINE_LINMATH bool operator < (const FLOATNAME(LVecBase4) &other) const;
00077   INLINE_LINMATH bool operator == (const FLOATNAME(LVecBase4) &other) const;
00078   INLINE_LINMATH bool operator != (const FLOATNAME(LVecBase4) &other) const;
00079 
00080   INLINE_LINMATH int compare_to(const FLOATNAME(LVecBase4) &other) const;
00081   INLINE_LINMATH int compare_to(const FLOATNAME(LVecBase4) &other,
00082                                 FLOATTYPE threshold) const;
00083 
00084   INLINE_LINMATH FLOATNAME(LVecBase4) operator - () const;
00085 
00086   INLINE_LINMATH FLOATNAME(LVecBase4)
00087   operator + (const FLOATNAME(LVecBase4) &other) const;
00088   INLINE_LINMATH FLOATNAME(LVecBase4)
00089   operator - (const FLOATNAME(LVecBase4) &other) const;
00090 
00091   INLINE_LINMATH FLOATNAME(LVecBase4) operator * (FLOATTYPE scalar) const;
00092   INLINE_LINMATH FLOATNAME(LVecBase4) operator / (FLOATTYPE scalar) const;
00093 
00094   INLINE_LINMATH void operator += (const FLOATNAME(LVecBase4) &other);
00095   INLINE_LINMATH void operator -= (const FLOATNAME(LVecBase4) &other);
00096 
00097   INLINE_LINMATH void operator *= (FLOATTYPE scalar);
00098   INLINE_LINMATH void operator /= (FLOATTYPE scalar);
00099 
00100   INLINE_LINMATH bool almost_equal(const FLOATNAME(LVecBase4) &other,
00101                            FLOATTYPE threshold) const;
00102   INLINE_LINMATH bool almost_equal(const FLOATNAME(LVecBase4) &other) const;
00103 
00104   INLINE_LINMATH void output(ostream &out) const;
00105 
00106 public:
00107   INLINE_LINMATH void generate_hash(ChecksumHashGenerator &hashgen) const;
00108   INLINE_LINMATH void generate_hash(ChecksumHashGenerator &hashgen,
00109                                     FLOATTYPE threshold) const;
00110 
00111 public:
00112   union {
00113         FLOATTYPE data[4];
00114         struct {FLOATTYPE _0, _1, _2, _3;} v;
00115   } _v;
00116 
00117 private:
00118   static const FLOATNAME(LVecBase4) _zero;
00119   static const FLOATNAME(LVecBase4) _unit_x;
00120   static const FLOATNAME(LVecBase4) _unit_y;
00121   static const FLOATNAME(LVecBase4) _unit_z;
00122   static const FLOATNAME(LVecBase4) _unit_w;
00123 
00124 public:
00125   INLINE_LINMATH void write_datagram(Datagram &destination) const;
00126   INLINE_LINMATH void read_datagram(DatagramIterator &source);
00127 
00128 public:
00129   static TypeHandle get_class_type() {
00130     return _type_handle;
00131   }
00132   static void init_type();
00133 
00134 private:
00135   static TypeHandle _type_handle;
00136 };
00137 
00138 INLINE_LINMATH ostream &operator << (ostream &out, const FLOATNAME(LVecBase4) &vec) {
00139   vec.output(out);
00140   return out;
00141 }
00142 
00143 #include "lvecBase4_src.I"

Generated on Fri May 2 00:40:17 2003 for Panda by doxygen1.3