00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 class EXPCL_PANDA FLOATNAME(LVecBase3) {
00025 PUBLISHED:
00026 typedef const FLOATTYPE *iterator;
00027 typedef const FLOATTYPE *const_iterator;
00028
00029 INLINE_LINMATH FLOATNAME(LVecBase3)();
00030 INLINE_LINMATH FLOATNAME(LVecBase3)(const FLOATNAME(LVecBase3) ©);
00031 INLINE_LINMATH FLOATNAME(LVecBase3) &operator = (const FLOATNAME(LVecBase3) ©);
00032 INLINE_LINMATH FLOATNAME(LVecBase3) &operator = (FLOATTYPE fill_value);
00033 INLINE_LINMATH FLOATNAME(LVecBase3)(FLOATTYPE fill_value);
00034 INLINE_LINMATH FLOATNAME(LVecBase3)(FLOATTYPE x, FLOATTYPE y, FLOATTYPE z);
00035
00036 INLINE_LINMATH static const FLOATNAME(LVecBase3) &zero();
00037 INLINE_LINMATH static const FLOATNAME(LVecBase3) &unit_x();
00038 INLINE_LINMATH static const FLOATNAME(LVecBase3) &unit_y();
00039 INLINE_LINMATH static const FLOATNAME(LVecBase3) &unit_z();
00040
00041 INLINE_LINMATH ~FLOATNAME(LVecBase3)();
00042
00043 INLINE_LINMATH FLOATTYPE operator [](int i) const;
00044 INLINE_LINMATH FLOATTYPE &operator [](int i);
00045
00046 INLINE_LINMATH bool is_nan() const;
00047
00048 INLINE_LINMATH FLOATTYPE get_cell(int i) const;
00049 INLINE_LINMATH FLOATTYPE get_x() const;
00050 INLINE_LINMATH FLOATTYPE get_y() const;
00051 INLINE_LINMATH FLOATTYPE get_z() const;
00052 INLINE_LINMATH void set_cell(int i, FLOATTYPE value);
00053 INLINE_LINMATH void set_x(FLOATTYPE value);
00054 INLINE_LINMATH void set_y(FLOATTYPE value);
00055 INLINE_LINMATH void set_z(FLOATTYPE value);
00056
00057 INLINE_LINMATH const FLOATTYPE *get_data() const;
00058 INLINE_LINMATH int get_num_components() const;
00059
00060 public:
00061 INLINE_LINMATH iterator begin();
00062 INLINE_LINMATH iterator end();
00063
00064 INLINE_LINMATH const_iterator begin() const;
00065 INLINE_LINMATH const_iterator end() const;
00066
00067 PUBLISHED:
00068 INLINE_LINMATH void fill(FLOATTYPE fill_value);
00069 INLINE_LINMATH void set(FLOATTYPE x, FLOATTYPE y, FLOATTYPE z);
00070
00071 INLINE_LINMATH FLOATTYPE dot(const FLOATNAME(LVecBase3) &other) const;
00072 INLINE_LINMATH FLOATNAME(LVecBase3) cross(const FLOATNAME(LVecBase3) &other) const;
00073
00074 INLINE_LINMATH bool operator < (const FLOATNAME(LVecBase3) &other) const;
00075 INLINE_LINMATH bool operator == (const FLOATNAME(LVecBase3) &other) const;
00076 INLINE_LINMATH bool operator != (const FLOATNAME(LVecBase3) &other) const;
00077
00078 INLINE_LINMATH int compare_to(const FLOATNAME(LVecBase3) &other) const;
00079 INLINE_LINMATH int compare_to(const FLOATNAME(LVecBase3) &other,
00080 FLOATTYPE threshold) const;
00081
00082 INLINE_LINMATH FLOATNAME(LVecBase3) operator - () const;
00083
00084 INLINE_LINMATH FLOATNAME(LVecBase3)
00085 operator + (const FLOATNAME(LVecBase3) &other) const;
00086 INLINE_LINMATH FLOATNAME(LVecBase3)
00087 operator - (const FLOATNAME(LVecBase3) &other) const;
00088
00089 INLINE_LINMATH FLOATNAME(LVecBase3) operator * (FLOATTYPE scalar) const;
00090 INLINE_LINMATH FLOATNAME(LVecBase3) operator / (FLOATTYPE scalar) const;
00091
00092 INLINE_LINMATH void operator += (const FLOATNAME(LVecBase3) &other);
00093 INLINE_LINMATH void operator -= (const FLOATNAME(LVecBase3) &other);
00094
00095 INLINE_LINMATH void operator *= (FLOATTYPE scalar);
00096 INLINE_LINMATH void operator /= (FLOATTYPE scalar);
00097
00098 INLINE_LINMATH void cross_into(const FLOATNAME(LVecBase3) &other);
00099
00100 INLINE_LINMATH bool almost_equal(const FLOATNAME(LVecBase3) &other,
00101 FLOATTYPE threshold) const;
00102 INLINE_LINMATH bool almost_equal(const FLOATNAME(LVecBase3) &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[3];
00114 struct {FLOATTYPE _0, _1, _2;} v;
00115 } _v;
00116
00117 private:
00118 static const FLOATNAME(LVecBase3) _zero;
00119 static const FLOATNAME(LVecBase3) _unit_x;
00120 static const FLOATNAME(LVecBase3) _unit_y;
00121 static const FLOATNAME(LVecBase3) _unit_z;
00122
00123 public:
00124 INLINE_LINMATH void write_datagram(Datagram &destination) const;
00125 INLINE_LINMATH void read_datagram(DatagramIterator &source);
00126
00127 public:
00128 static TypeHandle get_class_type() {
00129 return _type_handle;
00130 }
00131 static void init_type();
00132
00133 private:
00134 static TypeHandle _type_handle;
00135 };
00136
00137
00138 INLINE_LINMATH ostream &operator << (ostream &out, const FLOATNAME(LVecBase3) &vec) {
00139 vec.output(out);
00140 return out;
00141 };
00142
00143 #include "lvecBase3_src.I"